| | |
| | | */ |
| | | package me.zhengjie.modules.salary.service.impl; |
| | | |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.util.ArrayList; |
| | | import java.util.Calendar; |
| | | import java.util.Collections; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.exception.BadRequestException; |
| | | import me.zhengjie.modules.attendance.service.AttendanceService; |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceQueryCriteria; |
| | |
| | | import me.zhengjie.modules.project.service.ProjectPerformanceDetailService; |
| | | import me.zhengjie.modules.project.service.dto.ProjectPerformanceDetailQueryCriteria; |
| | | import me.zhengjie.modules.salary.domain.Salary; |
| | | import me.zhengjie.modules.system.domain.SysConfigHoliday; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.DictDetailRepository; |
| | | import me.zhengjie.modules.system.repository.SysConfigHolidayRepository; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.modules.system.service.*; |
| | | import me.zhengjie.modules.system.service.dto.*; |
| | | import me.zhengjie.modules.task.service.TaskDaliyService; |
| | | import me.zhengjie.modules.task.service.dto.TaskDaliyQueryCriteria; |
| | | import me.zhengjie.utils.*; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.salary.repository.SalaryRepository; |
| | | import me.zhengjie.modules.salary.service.SalaryService; |
| | | import me.zhengjie.modules.salary.service.dto.SalaryDto; |
| | | import me.zhengjie.modules.salary.service.dto.SalaryQueryCriteria; |
| | | import me.zhengjie.modules.salary.service.mapstruct.SalaryMapper; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.*; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | import me.zhengjie.modules.system.domain.SysConfigHoliday; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.DictDetailRepository; |
| | | 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.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.SysConfigHolidayQueryCriteria; |
| | | import me.zhengjie.modules.system.service.dto.SysConfigIndividualIncomeTaxDto; |
| | | import me.zhengjie.modules.system.service.dto.SysConfigIndividualIncomeTaxQueryCriteria; |
| | | import me.zhengjie.modules.system.service.dto.SysUserLevelInsuranceDto; |
| | | import me.zhengjie.modules.system.service.dto.SysUserLevelInsuranceQueryCriteria; |
| | | import me.zhengjie.modules.system.service.dto.SysUserLevelOtherDto; |
| | | import me.zhengjie.modules.system.service.dto.SysUserLevelOtherQueryCriteria; |
| | | import me.zhengjie.modules.system.service.dto.SysUserLevelWageDto; |
| | | import me.zhengjie.modules.system.service.dto.SysUserLevelWageQueryCriteria; |
| | | import me.zhengjie.modules.system.service.dto.UserDto; |
| | | import me.zhengjie.modules.system.service.dto.UserQueryCriteria; |
| | | import me.zhengjie.modules.task.service.TaskDaliyService; |
| | | import me.zhengjie.modules.task.service.dto.TaskDaliyQueryCriteria; |
| | | import me.zhengjie.utils.DateUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import me.zhengjie.utils.PageUtil; |
| | | import me.zhengjie.utils.QueryHelp; |
| | | import me.zhengjie.utils.SecurityUtils; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | |
| | | // 定时器 |
| | | while (true) { |
| | | // 判断个人业绩比例是否为空 |
| | | if (salary.getPersonalPerformanceProportion() != null && !"".equals(salary.getPersonalPerformanceProportion())) { |
| | | if (salary.getPersonalPerformanceProportion() != null) { |
| | | // 应完成业绩工时 |
| | | salary.setNeedCompletedPerformanceHours(Double.valueOf(workDays * 8 * (1 + salary.getPersonalPerformanceProportion() / 100))); |
| | | // 清空定时器 |
| | |
| | | // 定时器 |
| | | while (true) { |
| | | // 判断预计基础工资、全勤小时数是否为空 |
| | | if (salary.getBasicWage() != null && !"".equals(salary.getBasicWage()) && salary.getFullDays() != null && !"".equals(salary.getFullDays())) { |
| | | if (salary.getBasicWage() != null && salary.getFullDays() != null) { |
| | | // 缺勤小时数 |
| | | salary.setAbsenceDays(Double.valueOf(salary.getFullDays() - attendanceHours)); |
| | | // 小时工资 |
| | |
| | | // 绩效定时器 |
| | | while (true) { |
| | | // 判断预计绩效工资、应完成绩效工时是否为空 |
| | | if (salary.getAchievementsWage() != null && !"".equals(salary.getAchievementsWage()) && salary.getNeedCompletedAchievementsHours() != null && !"".equals(salary.getNeedCompletedAchievementsHours())) { |
| | | if (salary.getAchievementsWage() != null && salary.getNeedCompletedAchievementsHours() != null) { |
| | | // 实际绩效工资 |
| | | salary.setActualAchievementsWage(salary.getAchievementsWage().multiply(new BigDecimal(completedWork / salary.getNeedCompletedAchievementsHours()))); |
| | | // 清空绩效定时器 |
| | |
| | | // 业绩定时器 |
| | | while (true) { |
| | | // 判断预计业绩工资、应完成业绩工时是否为空 |
| | | if (salary.getPerformanceWage() != null && !"".equals(salary.getPerformanceWage()) && salary.getNeedCompletedPerformanceHours() != null && !"".equals(salary.getNeedCompletedPerformanceHours())) { |
| | | if (salary.getPerformanceWage() != null && salary.getNeedCompletedPerformanceHours() != null) { |
| | | // 实际业绩工资 |
| | | salary.setActualPerformanceWage(completedWork >= salary.getNeedCompletedPerformanceHours() ? salary.getPerformanceWage() : new BigDecimal(0)); |
| | | // 清空业绩定时器 |
| | |
| | | // 团队定时器 |
| | | while (true) { |
| | | // 判断预计团队工资、实达标团队工时是否为空 |
| | | if (salary.getTeamWage() != null && !"".equals(salary.getTeamWage()) && salary.getActualComplianceTeamHours() != null && !"".equals(salary.getActualComplianceTeamHours())) { |
| | | if (salary.getTeamWage() != null && salary.getActualComplianceTeamHours() != null) { |
| | | // 实际团队工资 |
| | | salary.setActualTeamWage(salary.getActualComplianceTeamHours() != 0 ? salary.getTeamWage().multiply(new BigDecimal(salary.getActualComplianceTeamHours() / completedWork)) : new BigDecimal(0)); |
| | | // 清空团队定时器 |
| | |
| | | // 判断 实际基础工资、实际绩效工资、实际业绩工资、实际团队工资、公积金个人缴纳金额、养老险个人缴纳金额、 |
| | | // 医疗险个人缴纳金额、失业险个人缴纳金额、生育险个人缴纳金额、工伤险个人缴纳金额 是否为空 |
| | | if ( |
| | | salary.getActualBasicWage() != null && !"".equals(salary.getActualBasicWage()) && |
| | | salary.getActualAchievementsWage() != null && !"".equals(salary.getActualAchievementsWage()) && |
| | | salary.getActualPerformanceWage() != null && !"".equals(salary.getActualPerformanceWage()) && |
| | | salary.getActualTeamWage() != null && !"".equals(salary.getActualTeamWage()) && |
| | | salary.getAccumulationPersonalAmount() != null && !"".equals(salary.getAccumulationPersonalAmount()) && |
| | | salary.getPensionPersonalAmount() != null && !"".equals(salary.getPensionPersonalAmount()) && |
| | | salary.getMedicalPersonalAmount() != null && !"".equals(salary.getMedicalPersonalAmount()) && |
| | | salary.getUnemploymentPersonalAmount() != null && !"".equals(salary.getUnemploymentPersonalAmount()) && |
| | | salary.getMaternityPersonalAmount() != null && !"".equals(salary.getMaternityPersonalAmount()) && |
| | | salary.getIndustrialInjuryPersonalAmount() != null && !"".equals(salary.getIndustrialInjuryPersonalAmount()) |
| | | salary.getActualBasicWage() != null && |
| | | salary.getActualAchievementsWage() != null && |
| | | salary.getActualPerformanceWage() != null && |
| | | salary.getActualTeamWage() != null && |
| | | salary.getAccumulationPersonalAmount() != null && |
| | | salary.getPensionPersonalAmount() != null && |
| | | salary.getMedicalPersonalAmount() != null && |
| | | salary.getUnemploymentPersonalAmount() != null && |
| | | salary.getMaternityPersonalAmount() != null && |
| | | salary.getIndustrialInjuryPersonalAmount() != null |
| | | ) { |
| | | // 税前金额 |
| | | salary.setPreTaxAmount(salary.getActualBasicWage().add(salary.getActualAchievementsWage()).add(salary.getActualPerformanceWage()).add(salary.getActualTeamWage())); |
| | |
| | | // 循环个人所得税列表 |
| | | for (int i = 0; i < sysConfigIndividualIncomeTaxDtoList.size(); i ++) { |
| | | // 判断计税金额所在个人所得税范围 |
| | | if (sysConfigIndividualIncomeTaxDtoList.get(i).getGearAmountEnd() != null && !"".equals(sysConfigIndividualIncomeTaxDtoList.get(i).getGearAmountEnd()) && |
| | | if (sysConfigIndividualIncomeTaxDtoList.get(i).getGearAmountEnd() != null && |
| | | taxableAmount.compareTo(sysConfigIndividualIncomeTaxDtoList.get(i).getGearAmountEnd()) == 1) { |
| | | // 税额 |
| | | taxAmount.add( |
| | |
| | | } else if ( |
| | | (taxableAmount.compareTo(sysConfigIndividualIncomeTaxDtoList.get(i).getGearAmountStart()) == 1 || |
| | | taxableAmount.compareTo(sysConfigIndividualIncomeTaxDtoList.get(i).getGearAmountStart()) == 0) && |
| | | (sysConfigIndividualIncomeTaxDtoList.get(i).getGearAmountEnd() == null || "".equals(sysConfigIndividualIncomeTaxDtoList.get(i).getGearAmountEnd()) || |
| | | (sysConfigIndividualIncomeTaxDtoList.get(i).getGearAmountEnd() == null || |
| | | taxableAmount.compareTo(sysConfigIndividualIncomeTaxDtoList.get(i).getGearAmountEnd()) == -1 || |
| | | taxableAmount.compareTo(sysConfigIndividualIncomeTaxDtoList.get(i).getGearAmountEnd()) == 0) |
| | | ) { |