| | |
| | | import me.zhengjie.modules.system.repository.SysConfigHolidayRepository; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.modules.system.service.RoleService; |
| | | import me.zhengjie.modules.system.service.SysCompanyService; |
| | | import me.zhengjie.modules.system.service.SysConfigIndividualIncomeTaxService; |
| | | import me.zhengjie.modules.system.service.SysUserLevelInsuranceService; |
| | | import me.zhengjie.modules.system.service.SysUserLevelOtherService; |
| | | import me.zhengjie.modules.system.service.SysUserLevelWageService; |
| | | import me.zhengjie.modules.system.service.UserService; |
| | | import me.zhengjie.modules.system.service.dto.RoleSmallDto; |
| | | import me.zhengjie.modules.system.service.dto.SysCompanyDto; |
| | | import me.zhengjie.modules.system.service.dto.SysCompanyQueryCriteria; |
| | | import me.zhengjie.modules.system.service.dto.SysConfigHolidayQueryCriteria; |
| | | import me.zhengjie.modules.system.service.dto.SysConfigIndividualIncomeTaxDto; |
| | | import me.zhengjie.modules.system.service.dto.SysConfigIndividualIncomeTaxQueryCriteria; |
| | |
| | | private final SysConfigHolidayRepository sysConfigHolidayRepository; |
| | | private final RoleService roleService; |
| | | private final DictDetailRepository dictDetailRepository; |
| | | private final SysCompanyService sysCompanyService; |
| | | // ==================== 以下为定时生成工资记录主要依赖 ==================== |
| | | private final UserService userService; |
| | | private final SysUserLevelWageService sysUserLevelWageService; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<SalaryDto> queryAll(SalaryQueryCriteria criteria){ |
| | | public List<SalaryDto> queryAll(SalaryQueryCriteria criteria) { |
| | | // 判断工资查询类工资年月是否为空 |
| | | if (criteria.getSalaryYearMonth() != null && !"".equals(criteria.getSalaryYearMonth())) { |
| | | // 工资年月:国际时间转中国时间 |
| | | criteria.setSalaryYearMonth(DateUtil.internationalTimeToChinaTime(criteria.getSalaryYearMonth())); |
| | | } |
| | | return salaryMapper.toDto(salaryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | |
| | | throw new BadRequestException("找到相同用户相同年月的工资记录!"); |
| | | } else if (salaryList.size() == 1) { |
| | | // 判断是否是同一条记录 |
| | | if (salaryList.get(0).getId() != resources.getId()) { |
| | | if (salaryList.get(0).getId().longValue() != resources.getId().longValue()) { |
| | | throw new BadRequestException("找到相同用户相同年月的工资记录!"); |
| | | } |
| | | } |
| | |
| | | @Override |
| | | public void download(List<SalaryDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | List<SysCompanyDto> sysCompanyDtoList = sysCompanyService.queryAll(new SysCompanyQueryCriteria()); |
| | | Map<Long, String> companyNameMap = sysCompanyDtoList.stream().collect(Collectors.toMap(companyDto -> companyDto.getId(), companyDto -> companyDto.getLabel())); |
| | | for (SalaryDto salary : all) { |
| | | String userNickName = salary.getUserId() != null ? userRepository.findById(salary.getUserId()).orElseGet(User::new).getNickName() : ""; |
| | | User user = userRepository.findById(salary.getUserId()).orElseGet(User::new); |
| | | String userNickName = salary.getUserId() != null ? user.getNickName() : ""; |
| | | String publicityStatus = salary.getPublicityStatus() != null ? dictDetailRepository.findByDictNameAndValue(Constant.PUBLICITY_STATUS, salary.getPublicityStatus()).getLabel() : ""; |
| | | String approveStatus = salary.getApproveStatus() != null ? dictDetailRepository.findByDictNameAndValue(Constant.APPROVE_STATUS, salary.getApproveStatus()).getLabel() : ""; |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("员工姓名", userNickName); |
| | | map.put("工资年月", salary.getSalaryYearMonth()); |
| | | map.put("公司", companyNameMap.get(user.getCompanyId())); |
| | | map.put("级别工资", salary.getLevelWage()); |
| | | map.put("基本工资比例", salary.getBasicWageProportion()); |
| | | map.put("基本工资", salary.getBasicWage()); |
| | |
| | | map.put("备注", salary.getRemarks()); |
| | | map.put("公示状态", publicityStatus); |
| | | map.put("承认状态", approveStatus); |
| | | map.put("创建者", salary.getCreateBy()); |
| | | map.put("创建时间", salary.getCreateTime()); |
| | | map.put("更新者", salary.getUpdateBy()); |
| | | map.put("更新时间", salary.getUpdateTime()); |
| | | // map.put("创建者", salary.getCreateBy()); |
| | | // map.put("创建时间", salary.getCreateTime()); |
| | | // map.put("更新者", salary.getUpdateBy()); |
| | | // map.put("更新时间", salary.getUpdateTime()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | |
| | | taskDaliyQueryCriteria.setUserId(userId); |
| | | taskDaliyQueryCriteria.setTargetYearMonth(targetYearMonth); |
| | | // 查询某月已完成工时 |
| | | Double completedWork = taskDaliyService.queryCompletedWork(taskDaliyQueryCriteria); |
| | | Double completedWork = taskDaliyService.queryCompletedWork(taskDaliyQueryCriteria, false); |
| | | // 已完成绩效工时 |
| | | salary.setAlreadyCompletedAchievementsHours(completedWork); |
| | | // 已完成业绩工时 |
| | |
| | | // 判断循环是否结束 |
| | | if (i == sysConfigIndividualIncomeTaxDtoList.size() - 1) { |
| | | // 个人所得税 |
| | | salary.setIndividualIncomeTax(taxAmount); |
| | | // salary.setIndividualIncomeTax(taxAmount); |
| | | salary.setIndividualIncomeTax(new BigDecimal(0)); |
| | | // 税后金额 |
| | | salary.setAfterTaxAmount(taxableAmount.subtract(taxAmount).compareTo(new BigDecimal(0)) == -1 ? new BigDecimal(0) : taxableAmount.subtract(taxAmount)); |
| | | } |