Browse Source

薪资逻辑修改-年休计算公式

yuansh 3 weeks ago
parent
commit
7310a97a82

+ 4 - 0
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/salary/entity/SalaryAttendanceHoliday.java

@@ -2,6 +2,7 @@ package org.jeecg.modules.salary.entity;
 
 import java.io.Serializable;
 import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
@@ -79,4 +80,7 @@ public class SalaryAttendanceHoliday implements Serializable {
 	@Excel(name = "备注", width = 15)
 	private String remarks;
 
+	@TableField(exist = false)
+	private String adjustment;
+
 }

+ 2 - 0
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/salary/mapper/SalaryAttendanceHolidayMapper.java

@@ -17,4 +17,6 @@ public interface SalaryAttendanceHolidayMapper extends BaseMapper<SalaryAttendan
 	public boolean deleteByMainId(String mainId);
 
 	public List<SalaryAttendanceHoliday> selectByMainId(@Param("id") String mainId, @Param("orgName") String orgName, @Param("name") String name);
+
+	public List<SalaryAttendanceHoliday> selectListByYear(@Param("yearWith") String yearWith);
 }

+ 13 - 0
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/salary/mapper/xml/SalaryAttendanceHolidayMapper.xml

@@ -23,4 +23,17 @@
 			AND a.name LIKE '%${name}%'
 		</if>
 	</select>
+
+	<select id="selectListByYear" parameterType="java.lang.String" resultType="org.jeecg.modules.salary.entity.SalaryAttendanceHoliday">
+		SELECT
+			a.*,
+			b.adjustment
+		FROM
+			salary_attendance_holiday a
+			LEFT JOIN sys_user b ON a.user_id = b.id and b.del_flag=0
+		WHERE
+			a.del_flag = 0
+		  AND a.year_with_month = #{yearWith}
+
+	</select>
 </mapper>

+ 31 - 14
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/salary/service/impl/SalaryManagementServiceImpl.java

@@ -1011,23 +1011,24 @@ public class SalaryManagementServiceImpl extends ServiceImpl<SalaryManagementMap
                 List<SalaryManagementHoliday> holidayListNBSY = new ArrayList<>();//宁波森语
                 List<SalaryManagementHoliday> holidayListZZ = new ArrayList<>();//正织
 
-                QueryWrapper<SalaryAttendanceHoliday> queryWrapper = new QueryWrapper<>();
-                queryWrapper.eq("del_flag", "0");
-                queryWrapper.like("year_with_month", yearWith + "%");
-                List<SalaryAttendanceHoliday> list = salaryAttendanceHolidayMapper.selectList(queryWrapper);
+//                QueryWrapper<SalaryAttendanceHoliday> queryWrapper = new QueryWrapper<>();
+//                queryWrapper.eq("del_flag", "0");
+//                queryWrapper.like("year_with_month", yearWith + "%");
+//                List<SalaryAttendanceHoliday> list = salaryAttendanceHolidayMapper.selectList(queryWrapper);
+                List<SalaryAttendanceHoliday> list = salaryAttendanceHolidayMapper.selectListByYear(yearWith);
 
                 if (list.size() < 1) {
                     return Result.error("执行失败,没有找到" + yearWith + "的年休数据!");
                 }
 
-                String salaryBase = salaryChangeRecordMapper.selectSalary();
-                if (StringUtils.isBlank(salaryBase)) {
-                    return Result.error("计算失败,工资基数异常!");
-                }
-
-                String salaryBaseText = AesEncryptUtil.desEncrypt(salaryBase).trim();
-
-                BigDecimal salaryBaseBig = new BigDecimal(salaryBaseText);
+//                String salaryBase = salaryChangeRecordMapper.selectSalary();
+//                if (StringUtils.isBlank(salaryBase)) {
+//                    return Result.error("计算失败,工资基数异常!");
+//                }
+//
+//                String salaryBaseText = AesEncryptUtil.desEncrypt(salaryBase).trim();
+//
+//                BigDecimal salaryBaseBig = new BigDecimal(salaryBaseText);
 
                 for (SalaryAttendanceHoliday o : list) {
 
@@ -1061,7 +1062,23 @@ public class SalaryManagementServiceImpl extends ServiceImpl<SalaryManagementMap
 
                     //应发薪资 = 基本薪资/(单休26,双休22)*剩余年休
                     BigDecimal wages = new BigDecimal("0");
-                    wages = salaryBaseBig.divide(workingHours, 12, BigDecimal.ROUND_HALF_UP).multiply(surplus).setScale(2, BigDecimal.ROUND_HALF_UP);;
+//                    wages = salaryBaseBig.divide(workingHours, 12, BigDecimal.ROUND_HALF_UP).multiply(surplus).setScale(2, BigDecimal.ROUND_HALF_UP);;
+
+                    String adjustment = o.getAdjustment();
+                    BigDecimal adjustmentBig = new BigDecimal("0");
+                    if(StringUtils.isNotBlank(adjustment)){
+                        try {
+                            adjustmentBig = new BigDecimal(AesEncryptUtil.desEncrypt(adjustment).trim());
+                        }catch (Exception e){
+                            return Result.error(o.getName()+"基本薪资异常,请查看!");
+                        }
+                    }else{
+                        return Result.error(o.getName()+"基本薪资为空,请维护!");
+                    }
+
+                    //2025-3-12 王仕洋 提供年休新算法
+                    //年休的薪资 = 个人薪资/(单休26,双休22)*剩余年休天数 *(2)双倍工资
+                    wages = adjustmentBig.divide(workingHours, 12, BigDecimal.ROUND_HALF_UP).multiply(surplus).multiply(new BigDecimal("2")).setScale(2, BigDecimal.ROUND_HALF_UP);;
                     String wagesText = AesEncryptUtil.encrypt(wages.toString()).trim();
                     salaryManagementHoliday.setWages(wagesText);//应发薪资
                     salaryManagementHoliday.setPayTaxes(wagesText);//应纳税所得额
@@ -1957,7 +1974,7 @@ public class SalaryManagementServiceImpl extends ServiceImpl<SalaryManagementMap
         if (salaryAttendanceDetailListZZ != null && salaryAttendanceDetailListZZ.size() > 0) {
 
             int num = 0;
-            for (SalaryManagementDetail o : salaryAttendanceDetailListNBSY) {
+            for (SalaryManagementDetail o : salaryAttendanceDetailListZZ) {
                 if(!o.getActualOccurrence().equals("nghotxDTNyeHgH0mlfbJig==") && !o.getActualOccurrence().equals("HV3ndEx8HV9kd1WNbxLgwg==")){
                     num ++;
                 }

+ 15 - 4
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysUserController.java

@@ -114,10 +114,13 @@ public class SysUserController {
 		//根据公司id过滤
 //        LoginUser sysUser = (LoginUser)SecurityUtils.getSubject().getPrincipal();
 //        queryWrapper.lambda().like(SysUser::getPkOrg,sysUser.getOrgCode());
-        if(StringUtils.isNotBlank(syHireType) && syHireType.equals("在职")){
-            queryWrapper.last("and IFNULL(sy_Hire_Type,'在职') !='离职' order by substring_index(work_no, '-', 1) + 0 asc,work_no asc");
+        if(StringUtils.isNotBlank(syHireType)){
+
+            queryWrapper.last("and IFNULL(sy_Hire_Type,'在职') ='"+syHireType+"' order by substring_index(work_no, '-', 1) + 0 asc,work_no asc");
+
+//            queryWrapper.last("and IFNULL(sy_Hire_Type,'在职') !='离职' order by substring_index(work_no, '-', 1) + 0 asc,work_no asc");
         }else{
-            queryWrapper.last("order by substring_index(work_no, '-', 1) + 0 asc,work_no asc");
+            queryWrapper.last(" order by substring_index(work_no, '-', 1) + 0 asc,work_no asc");
         }
 
         if(StringUtils.isNotBlank(deptName)){
@@ -643,6 +646,8 @@ public class SysUserController {
         }
         String deptName = sysUser.getDeptName();
         sysUser.setDeptName(null);
+        String syHireType = sysUser.getSyHireType();
+        sysUser.setSyHireType(null);
 
         // Step.1 组装查询条件
         QueryWrapper<SysUser> queryWrapper = QueryGenerator.initQueryWrapper(sysUser, request.getParameterMap());
@@ -676,7 +681,13 @@ public class SysUserController {
             }
 
         }
-        queryWrapper.last("and IFNULL(sy_Hire_Type,'在职') !='离职' order by substring_index(work_no, '-', 1) + 0 asc,work_no asc");
+        if(StringUtils.isNotBlank(syHireType)){
+
+            queryWrapper.last("and IFNULL(sy_Hire_Type,'在职') ='"+syHireType+"' order by substring_index(work_no, '-', 1) + 0 asc,work_no asc");
+//            queryWrapper.last("and IFNULL(sy_Hire_Type,'在职') !='离职' order by substring_index(work_no, '-', 1) + 0 asc,work_no asc");
+        }else{
+            queryWrapper.last(" order by substring_index(work_no, '-', 1) + 0 asc,work_no asc");
+        }
         //update-end--Author:kangxiaolin  Date:20180825 for:[03]用户导出,如果选择数据则只导出相关数据----------------------
         List<SysUser> pageList = sysUserService.list(queryWrapper);
         List<SysUserAddress> pageList2 = new ArrayList<>();