| | |
| | | import com.ruoyi.project.system.mapper.SysDeptMapper; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import com.ruoyi.staff.controller.TaxCalculator; |
| | | import com.ruoyi.staff.dto.SalaryStat; |
| | | import com.ruoyi.staff.mapper.SchemeApplicableStaffMapper; |
| | | import com.ruoyi.staff.mapper.SchemeInsuranceDetailMapper; |
| | | import com.ruoyi.staff.mapper.StaffOnJobMapper; |
| | |
| | | private final SysDeptMapper sysDeptMapper; |
| | | private final StaffOnJobMapper staffOnJobMapper; |
| | | private final SalesLedgerProductionAccountingService salesLedgerProductionAccountingService; |
| | | private final SalaryStatServiceImpl salaryStatService; |
| | | |
| | | |
| | | @Override |
| | |
| | | : calculateLatestDeptSocialSupplementAmount(staffOnJobDto); |
| | | BigDecimal pieceSalary = normalizeMoney(getBigDecimal(map, "pieceSalary")); |
| | | BigDecimal hourlySalary = normalizeMoney(getBigDecimal(map, "hourlySalary")); |
| | | BigDecimal socialPersonal = normalizeMoney(getBigDecimal(map, "socialPersonal")); |
| | | BigDecimal fundPersonal = normalizeMoney(getBigDecimal(map, "fundPersonal")); |
| | | // 加班工资:手工填写,不按倍率自动计算 |
| | | BigDecimal overtimePay = normalizeMoney(getBigDecimal(map, "overtimePay")); |
| | | BigDecimal socialPersonal = BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP); |
| | | BigDecimal fundPersonal = BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP); |
| | | |
| | | UserProductionAccountingDto userProductionAccountingDto = new UserProductionAccountingDto(); |
| | | userProductionAccountingDto.setUserId(getUidByStaffId(staffId)); |
| | |
| | | } |
| | | for (SchemeInsuranceDetail detail : detailList) { |
| | | if("公积金".equals(detail.getInsuranceType())){ |
| | | fundPersonal = fundPersonal.add(calculateByEmployeeIdType(detail.getInsuranceType(), fundPersonal, staffOnJobDto, detail)); |
| | | fundPersonal = calculateByEmployeeIdType(detail.getInsuranceType(), fundPersonal, basicSalary, staffOnJobDto, detail); |
| | | }else{ |
| | | socialPersonal = socialPersonal.add(calculateByEmployeeIdType(detail.getInsuranceType(), socialPersonal, staffOnJobDto, detail)); |
| | | socialPersonal = calculateByEmployeeIdType(detail.getInsuranceType(), socialPersonal, basicSalary, staffOnJobDto, detail); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | BigDecimal grossSalary = basicSalary.add(pieceSalary).add(hourlySalary).add(otherIncome); |
| | | BigDecimal grossSalary = basicSalary.add(pieceSalary).add(hourlySalary).add(overtimePay).add(otherIncome); |
| | | BigDecimal salaryTax = TaxCalculator.calculateMonthlyTax( |
| | | grossSalary, |
| | | socialPersonal.add(socialSupplementAmount), |
| | |
| | | .add(socialPersonal) |
| | | .add(socialSupplementAmount) |
| | | .add(otherDeduct); |
| | | BigDecimal netSalary = grossSalary.subtract(deductSalary); |
| | | // 应扣工资(手动填写),从实发工资中扣除 |
| | | BigDecimal manualDeduct = normalizeMoney(getBigDecimal(map, "manualDeduct")); |
| | | BigDecimal netSalary = grossSalary.subtract(deductSalary).subtract(manualDeduct); |
| | | |
| | | // 请假次数、缺勤次数、迟到次数、早退次数,请假原因自动带入备注(备注已填写时保留原备注) |
| | | SalaryStat salaryStat = salaryStatService.stat(staffId, staffOnJobDto.getStaffName(), date); |
| | | |
| | | if (!hasText(map, "staffName")) { |
| | | map.put("staffName", staffOnJobDto.getStaffName()); |
| | |
| | | map.put("basicSalary", basicSalary); |
| | | map.put("pieceSalary", pieceSalary); |
| | | map.put("hourlySalary", hourlySalary); |
| | | map.put("overtimeHours", salaryStat.getOvertimeHours()); |
| | | map.put("overtimePay", overtimePay); |
| | | map.put("otherIncome", otherIncome); |
| | | map.put("socialPersonal", socialPersonal); |
| | | map.put("fundPersonal", fundPersonal); |
| | |
| | | map.put("grossSalary", grossSalary); |
| | | map.put("salaryTax", salaryTax); |
| | | map.put("deductSalary", deductSalary); |
| | | map.put("leaveCount", salaryStat.getLeaveCount()); |
| | | map.put("absenceCount", salaryStat.getAbsenceCount()); |
| | | map.put("lateCount", salaryStat.getLateCount()); |
| | | map.put("earlyCount", salaryStat.getEarlyCount()); |
| | | map.put("manualDeduct", manualDeduct); |
| | | map.put("netSalary", netSalary); |
| | | if (!hasText(map, "remark") && StringUtils.isNotEmpty(salaryStat.getLeaveReason())) { |
| | | map.put("remark", salaryStat.getLeaveReason()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param detail |
| | | * @return |
| | | */ |
| | | public BigDecimal calculateByEmployeeIdType(String type,BigDecimal bigDecimal, StaffOnJob staffOnJobDto,SchemeInsuranceDetail detail) { |
| | | public BigDecimal calculateByEmployeeIdType(String type,BigDecimal bigDecimal, BigDecimal basicSalary, StaffOnJob staffOnJobDto,SchemeInsuranceDetail detail) { |
| | | // 判断是否调用基本工资 |
| | | if (detail.getUseBasicSalary() == 1) { |
| | | BigDecimal divide = detail.getPaymentBase().multiply(detail.getPersonalRatio()).divide(new BigDecimal("100"), 2); |
| | | bigDecimal = bigDecimal.add(divide); |
| | | }else{ |
| | | // 调用基本工资 |
| | | BigDecimal multiply = staffOnJobDto.getBasicSalary().multiply(detail.getPersonalRatio().divide(new BigDecimal("100"), 2)); |
| | | // 调用当前工资表中的基本工资 |
| | | BigDecimal multiply = basicSalary.multiply(detail.getPersonalRatio().divide(new BigDecimal("100"), 2)); |
| | | bigDecimal = bigDecimal.add(multiply); |
| | | } |
| | | bigDecimal = bigDecimal.add(detail.getPersonalFixed()); |
| | |
| | | BigDecimal socialSupplementAmount = BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP); |
| | | for (SchemeInsuranceDetail detail : detailList) { |
| | | if (!"公积金".equals(detail.getInsuranceType())) { |
| | | socialSupplementAmount = socialSupplementAmount.add( |
| | | calculateByEmployeeIdType(detail.getInsuranceType(), socialSupplementAmount, staffOnJobDto, detail) |
| | | socialSupplementAmount = calculateByEmployeeIdType( |
| | | detail.getInsuranceType(), |
| | | socialSupplementAmount, |
| | | normalizeMoney(staffOnJobDto.getBasicSalary()), |
| | | staffOnJobDto, |
| | | detail |
| | | ); |
| | | } |
| | | } |