| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.production.dto.UserAccountDto; |
| | | import com.ruoyi.production.dto.UserProductionAccountingDto; |
| | | import com.ruoyi.production.service.SalesLedgerProductionAccountingService; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.domain.SysUserDept; |
| | |
| | | |
| | | @Autowired |
| | | private StaffOnJobMapper staffOnJobMapper; |
| | | |
| | | @Autowired |
| | | private SalesLedgerProductionAccountingService salesLedgerProductionAccountingService; |
| | | |
| | | |
| | | @Override |
| | |
| | | * 通过员工id计算社保方案 |
| | | * @param id |
| | | */ |
| | | public void calculateByEmployeeId(Integer id,Map<String, Object> map) { |
| | | public void calculateByEmployeeId(Integer id,Map<String, Object> map,String date) { |
| | | // 1. 入参校验 |
| | | if (id == null) { |
| | | return; // 或返回空列表,根据业务需求调整 |
| | |
| | | // 个税金额(无社保版) |
| | | BigDecimal bigDecimal = TaxCalculator.calculateMonthlyTax(basicSalary, schemeAmount, gjj); |
| | | map.put("salaryTax", bigDecimal); |
| | | // 计时工资 计件工资 |
| | | UserProductionAccountingDto userProductionAccountingDto = new UserProductionAccountingDto(); |
| | | userProductionAccountingDto.setUserId(getUidByStaffId(staffId)); |
| | | userProductionAccountingDto.setDate(date); |
| | | UserAccountDto byUserId = salesLedgerProductionAccountingService.getByUserId(userProductionAccountingDto); |
| | | if(byUserId != null){ |
| | | map.put("pieceSalary", byUserId.getAccountBalance()); |
| | | map.put("hourlySalary", byUserId.getAccount()); |
| | | // 应发 实发增加 |
| | | grossSalary = grossSalary.add(byUserId.getAccountBalance()).add(byUserId.getAccount()); |
| | | map.put("grossSalary", grossSalary); |
| | | netSalary = netSalary.add(byUserId.getAccountBalance()).add(byUserId.getAccount()); |
| | | map.put("netSalary", netSalary); |
| | | } |
| | | // 2. 查询该人员对应的社保方案 |
| | | List<SchemeApplicableStaff> schemeList = schemeApplicableStaffMapper.selectSchemeByStaffId(staffId); |
| | | if (CollectionUtils.isEmpty(schemeList)) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 通过员工Id获取用户id |
| | | * @param staffId |
| | | * @return |
| | | */ |
| | | public Long getUidByStaffId(Long staffId){ |
| | | StaffOnJob staffOnJob = staffOnJobMapper.selectById(staffId); |
| | | if(staffOnJob == null){ |
| | | return -1L; // 返回不存在Id |
| | | } |
| | | SysUser sysUser = sysUserMapper.selectOne(new LambdaQueryWrapper<SysUser>() |
| | | .eq(SysUser::getUserName, staffOnJob.getStaffNo()) |
| | | .eq(SysUser::getDelFlag, "0") |
| | | .last("limit 1")); |
| | | if(sysUser == null){ |
| | | return -1L; // 返回不存在Id |
| | | } |
| | | return sysUser.getUserId(); |
| | | } |
| | | |
| | | /** |
| | | * 计算 |
| | | * @param type |
| | | * @param bigDecimal |