| | |
| | | import com.ruoyi.project.system.mapper.SysDeptMapper; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import com.ruoyi.staff.controller.TaxCalculator; |
| | | import com.ruoyi.staff.mapper.SchemeApplicableStaffMapper; |
| | | import com.ruoyi.staff.mapper.SchemeInsuranceDetailMapper; |
| | | import com.ruoyi.staff.mapper.StaffOnJobMapper; |
| | | import com.ruoyi.staff.pojo.SchemeApplicableStaff; |
| | | import com.ruoyi.staff.pojo.SchemeInsuranceDetail; |
| | | import com.ruoyi.staff.pojo.StaffOnJob; |
| | | import com.ruoyi.staff.mapper.*; |
| | | import com.ruoyi.staff.pojo.*; |
| | | import com.ruoyi.staff.service.SchemeApplicableStaffService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private final SysUserMapper sysUserMapper; |
| | | private final SysDeptMapper sysDeptMapper; |
| | | private final StaffOnJobMapper staffOnJobMapper; |
| | | private final PersonalShiftMapper personalShiftMapper; |
| | | private final PersonalAttendanceLocationConfigMapper personalAttendanceLocationConfigMapper; |
| | | private final SalesLedgerProductionAccountingService salesLedgerProductionAccountingService; |
| | | private final SubsidyConfigurationMapper subsidyConfigurationMapper; |
| | | |
| | | |
| | | @Override |
| | |
| | | // å®åå·¥èµ |
| | | BigDecimal netSalary = new BigDecimal("0.00"); |
| | | map.put("netSalary", netSalary); |
| | | // è°ç¨åºæ¬å·¥èµ |
| | | // æ ¹æ®æçæ°æ®è®¡ç®ç½ç天æ°åå¤çå¤©æ° |
| | | BigDecimal dayDays = new BigDecimal("0.00"); |
| | | BigDecimal nightDays = new BigDecimal("0.00"); |
| | | |
| | | // æ¥è¯¢å½ææçè®°å½ |
| | | List<PersonalShift> shiftList = personalShiftMapper.selectList(new LambdaQueryWrapper<PersonalShift>() |
| | | .eq(PersonalShift::getStaffOnJobId, staffId) |
| | | .like(PersonalShift::getWorkTime, date)); |
| | | |
| | | if(!CollectionUtils.isEmpty(shiftList)){ |
| | | // æ¶éææç次é
ç½®ID |
| | | List<Integer> configIds = shiftList.stream() |
| | | .map(PersonalShift::getPersonalAttendanceLocationConfigId) |
| | | .filter(Objects::nonNull) |
| | | .collect(Collectors.toList()); |
| | | |
| | | if(!CollectionUtils.isEmpty(configIds)){ |
| | | // æ¥è¯¢ç次é
ç½®ä¿¡æ¯ |
| | | List<PersonalAttendanceLocationConfig> configList = personalAttendanceLocationConfigMapper.selectList( |
| | | new LambdaQueryWrapper<PersonalAttendanceLocationConfig>() |
| | | .in(PersonalAttendanceLocationConfig::getId, configIds)); |
| | | |
| | | // æå»ºç次é
ç½®æ å° |
| | | Map<Integer, String> configMap = configList.stream() |
| | | .collect(Collectors.toMap( |
| | | PersonalAttendanceLocationConfig::getId, |
| | | PersonalAttendanceLocationConfig::getShift, |
| | | (a, b) -> a)); |
| | | |
| | | // ç»è®¡ç½çåå¤çå¤©æ° |
| | | for (PersonalShift shift : shiftList) { |
| | | Integer configId = shift.getPersonalAttendanceLocationConfigId(); |
| | | String shiftName = configMap.get(configId); |
| | | if(shiftName != null){ |
| | | // æ ¹æ®ç次åç§°å¤æï¼å
å«"ç½"æ"æ¥"为ç½çï¼å
å«"å¤"为å¤ç |
| | | if(shiftName.contains("ç½") || shiftName.contains("æ¥")){ |
| | | dayDays = dayDays.add(BigDecimal.ONE); |
| | | } else if(shiftName.contains("å¤")){ |
| | | nightDays = nightDays.add(BigDecimal.ONE); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | map.put("dayDays", dayDays); // ç½çå¤©æ° |
| | | map.put("nightDays", nightDays); // å¤çå¤©æ° |
| | | |
| | | // æ¥è¯¢é¤è¡¥åå¤ç补贴 |
| | | // 计ç®é¤è¡¥ï¼åæç¹æï¼åå¤çè¡¥å© |
| | | BigDecimal mealAmount = new BigDecimal("0.00"); // é¤è¡¥ |
| | | BigDecimal nightAmount = new BigDecimal("0.00"); // å¤çè¡¥å© |
| | | |
| | | // è·åé¤è¡¥åå¤ç补贴æ åï¼ä»è¡¥è´´é
ç½®ä¸è·åï¼ |
| | | SubsidyConfiguration subsidyConfig = subsidyConfigurationMapper.selectOne(null); |
| | | BigDecimal mealStandard = new BigDecimal("0.00"); // é¤è¡¥æ å |
| | | BigDecimal nightStandard = new BigDecimal("0.00"); // å¤ç补贴æ å |
| | | if(subsidyConfig != null){ |
| | | mealStandard = subsidyConfig.getMealAmount() != null ? subsidyConfig.getMealAmount() : new BigDecimal("0.00"); |
| | | nightStandard = subsidyConfig.getNightAmount() != null ? subsidyConfig.getNightAmount() : new BigDecimal("0.00"); |
| | | } |
| | | |
| | | // é¤è¡¥ï¼æ°æä¸ºåæç¹æï¼è®¡ç®æ¹å¼ä¸º(ç½ç天æ°+å¤ç天æ°)*é¤è¡¥æ å |
| | | StaffOnJob staffOnJobDto = staffOnJobMapper.selectById(staffId); |
| | | if(staffOnJobDto == null){ |
| | | return; |
| | | } |
| | | |
| | | String nation = staffOnJobDto.getNation(); |
| | | if("åæ".equals(nation)){ |
| | | mealAmount = dayDays.add(nightDays).multiply(mealStandard); |
| | | } |
| | | |
| | | // å¤çè¡¥å©ï¼å¤ç天æ°*å¤ç补贴æ å |
| | | nightAmount = nightDays.multiply(nightStandard); |
| | | |
| | | map.put("mealAmount", mealAmount); // é¤è¡¥ |
| | | map.put("nightAmount", nightAmount); // å¤çè¡¥å© |
| | | |
| | | // è°ç¨åºæ¬å·¥èµ |
| | | basicSalary = staffOnJobDto.getBasicSalary(); |
| | | map.put("basicSalary", basicSalary); |
| | | // åºåå·¥èµ |
| | | map.put("grossSalary", basicSalary); |
| | | // åºåå·¥èµï¼åºæ¬å·¥èµ+é¤è¡¥+å¤çè¡¥å©+å
¶ä»æ¶å
¥ï¼ |
| | | grossSalary = basicSalary.add(mealAmount).add(nightAmount).add(otherIncome); |
| | | map.put("grossSalary", grossSalary); |
| | | // å®åå·¥èµåå§å¼ |
| | | netSalary = grossSalary; |
| | | map.put("netSalary", netSalary); |
| | | // 个ç¨éé¢ï¼æ 社ä¿çï¼ |
| | | BigDecimal bigDecimal = TaxCalculator.calculateMonthlyTax(basicSalary, socialPersonal, fundPersonal); |
| | | map.put("salaryTax", bigDecimal); |
| | |
| | | // 个ç¨éé¢ï¼ç¤¾ä¿çï¼ |
| | | bigDecimal = TaxCalculator.calculateMonthlyTax(basicSalary, socialPersonal, fundPersonal); |
| | | map.put("salaryTax", bigDecimal); |
| | | // åºæ£å·¥èµ |
| | | map.put("deductSalary", bigDecimal.add(fundPersonal).add(socialPersonal)); |
| | | // å®åå·¥èµ |
| | | map.put("netSalary", basicSalary.subtract(bigDecimal).subtract(fundPersonal).subtract(socialPersonal)); |
| | | |
| | | // åºæ£å·¥èµ = ä¸ªç¨ + å
¬ç§¯é个人 + 社ä¿ä¸ªäºº + å
¶ä»æ¯åº |
| | | deductSalary = bigDecimal.add(fundPersonal).add(socialPersonal).add(otherDeduct); |
| | | map.put("deductSalary", deductSalary); |
| | | |
| | | // å®åå·¥èµ = åºåå·¥èµ - åºæ£å·¥èµ |
| | | netSalary = grossSalary.subtract(deductSalary); |
| | | map.put("netSalary", netSalary); |
| | | |
| | | } |
| | | |