huminmin
3 小时以前 35f70b350f298bbac8de18adf613990122004c4e
修改工资计算逻辑
已修改1个文件
21 ■■■■■ 文件已修改
src/main/java/com/ruoyi/staff/service/impl/SchemeApplicableStaffServiceImpl.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/staff/service/impl/SchemeApplicableStaffServiceImpl.java
@@ -285,9 +285,6 @@
        // 实发工资初始值
        netSalary = grossSalary;
        map.put("netSalary", netSalary);
        // 个税金额(无社保版)
        BigDecimal bigDecimal = TaxCalculator.calculateMonthlyTax(basicSalary, socialPersonal, fundPersonal);
        map.put("salaryTax", bigDecimal);
        // 计时工资 计件工资
        UserProductionAccountingDto userProductionAccountingDto = new UserProductionAccountingDto();
        userProductionAccountingDto.setUserId(getUidByStaffId(staffId));
@@ -323,6 +320,7 @@
                socialPersonal = socialPersonal.add(amount);
            }
        }
        BigDecimal currentMonthSocialPersonal = socialPersonal;
        BigDecimal socialSupplementAmount = calculateSocialSupplementAmount(
                staffId,
                staffOnJobDto,
@@ -331,18 +329,16 @@
                currentDetailList,
                socialPersonal
        );
        if (socialSupplementAmount.compareTo(BigDecimal.ZERO) > 0) {
            socialPersonal = socialPersonal.add(socialSupplementAmount);
        }
        map.put("socialPersonal", socialPersonal);
        BigDecimal totalSocialPersonal = currentMonthSocialPersonal.add(socialSupplementAmount);
        map.put("socialPersonal", currentMonthSocialPersonal);
        map.put("fundPersonal", fundPersonal);
        map.put("socialSupplementAmount", socialSupplementAmount);
        // 个税金额(社保版)
        bigDecimal = TaxCalculator.calculateMonthlyTax(basicSalary, socialPersonal, fundPersonal);
        BigDecimal bigDecimal = TaxCalculator.calculateMonthlyTax(grossSalary, totalSocialPersonal, fundPersonal);
        map.put("salaryTax", bigDecimal);
        // 应扣工资 = 个税 + 公积金个人 + 社保个人 + 其他支出
        deductSalary = bigDecimal.add(fundPersonal).add(socialPersonal).add(otherDeduct);
        // 应扣工资 = 个税 + 公积金个人 + 社保个人 + 社保补缴 + 其他支出
        deductSalary = bigDecimal.add(fundPersonal).add(totalSocialPersonal).add(otherDeduct);
        map.put("deductSalary", deductSalary);
        // 实发工资 = 应发工资 - 应扣工资
@@ -473,6 +469,7 @@
    /**
     * 统计员工当年1月到目标月份之前已缴纳的社保个人部分总额
     * 这里同时包含 socialPersonal 和 socialSupplementAmount,避免历史补缴情形被重复计算。
     *
     * 查询逻辑:
     * 1. 根据目标月份获取当年年份前缀(如 "2024-")
@@ -525,8 +522,8 @@
        // 6. 累加社保个人部分金额
        return detailList.stream()
                .map(StaffSalaryDetail::getSocialPersonal)  // 获取社保个人部分
                .filter(Objects::nonNull)
                .map(detail -> defaultZero(detail.getSocialPersonal())
                        .add(defaultZero(detail.getSocialSupplementAmount())))
                .reduce(BigDecimal.ZERO, BigDecimal::add);  // 累加求和
    }