添加重新计算接口

This commit is contained in:
2024-08-12 21:54:36 +08:00
parent 4a46a9d546
commit db64368787
3 changed files with 31 additions and 6 deletions

View File

@@ -6,6 +6,7 @@ import cn.lihongjie.coal.base.dto.CommonQuery;
import cn.lihongjie.coal.base.dto.IdRequest;
import cn.lihongjie.coal.empSalary.dto.CreateEmpSalaryDto;
import cn.lihongjie.coal.empSalary.dto.EmpSalaryDto;
import cn.lihongjie.coal.empSalary.dto.InitSalaryDto;
import cn.lihongjie.coal.empSalary.dto.UpdateEmpSalaryDto;
import cn.lihongjie.coal.empSalary.service.EmpSalaryService;
@@ -74,8 +75,16 @@ public class EmpSalaryController {
return this.service.batchSelectedEmpIds(request);
}
@PostMapping("/initSalary")
public Object initSalary(@RequestBody InitSalaryDto request) {
this.service.initSalary(request);
return true;
}
@PostMapping("/recalculate")
public Object recalculate(@RequestBody IdRequest request) {
this.service.recalculate(request);
return true;
}
@PostMapping("/archive")
public Object archive(@RequestBody IdRequest request) {

View File

@@ -0,0 +1,12 @@
package cn.lihongjie.coal.empSalary.dto;
import lombok.Data;
import java.util.*;
@Data
public class InitSalaryDto {
private String batchId;
private List<String> employeesIds;
}

View File

@@ -9,6 +9,7 @@ import cn.lihongjie.coal.common.ReflectUtils;
import cn.lihongjie.coal.empMonthAttendance.entity.EmpMonthAttendanceEntity;
import cn.lihongjie.coal.empSalary.dto.CreateEmpSalaryDto;
import cn.lihongjie.coal.empSalary.dto.EmpSalaryDto;
import cn.lihongjie.coal.empSalary.dto.InitSalaryDto;
import cn.lihongjie.coal.empSalary.dto.UpdateEmpSalaryDto;
import cn.lihongjie.coal.empSalary.entity.EmpSalaryEntity;
import cn.lihongjie.coal.empSalary.mapper.EmpSalaryMapper;
@@ -314,13 +315,16 @@ public class EmpSalaryService extends BaseService<EmpSalaryEntity, EmpSalaryRepo
}
}
/** 初始化工资 */
@SneakyThrows
public void initSalary(String batchId, List<String> employeesIds) {
public void initSalary(InitSalaryDto initSalaryDto) {
EmpSalaryBatchEntity batch = batchService.get(batchId);
EmpSalaryBatchEntity batch = batchService.get(initSalaryDto.getBatchId());
List<EmployeeDto> employees = employeeService.getDtoByIds(employeesIds);
List<EmployeeDto> employees = employeeService.getDtoByIds(initSalaryDto.getEmployeesIds());
StopWatch stopWatch = new StopWatch("initSalary: " + batch.getId());
@@ -390,7 +394,7 @@ public class EmpSalaryService extends BaseService<EmpSalaryEntity, EmpSalaryRepo
stopWatch.start("queryHistorySalary");
List<EmpSalaryEntity> salaryHis = this.queryHisSalary(employeesIds);
List<EmpSalaryEntity> salaryHis = this.queryHisSalary(initSalaryDto.getEmployeesIds());
Map<String, EmpSalaryEntity> salaryHisMap =
salaryHis.stream()