mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 15:55:18 +08:00
完善
This commit is contained in:
@@ -10,6 +10,6 @@ import java.util.List;
|
|||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface EmpMonthAttendanceRepository extends BaseRepository<EmpMonthAttendanceEntity> {
|
public interface EmpMonthAttendanceRepository extends BaseRepository<EmpMonthAttendanceEntity> {
|
||||||
@Query("select false")
|
@Query("select exists (select 1 from EmpSalaryEntity s where s.empMonthAttendance.id in :ids)")
|
||||||
boolean isLinked(List<String> ids);
|
boolean isLinked(List<String> ids);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,28 @@ public class EmpSalaryController {
|
|||||||
return this.service.list(request);
|
return this.service.list(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前批次初始化可选择的人员ID
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/batchSelectEmpIds")
|
||||||
|
public Object batchSelectEmpIds(@RequestBody IdRequest request) {
|
||||||
|
return this.service.batchSelectEmpIds(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前批次已经选择的人员ID
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/batchSelectedEmpIds")
|
||||||
|
public Object batchSelectedEmpIds(@RequestBody IdRequest request) {
|
||||||
|
return this.service.batchSelectedEmpIds(request);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/archive")
|
@PostMapping("/archive")
|
||||||
public Object archive(@RequestBody IdRequest request) {
|
public Object archive(@RequestBody IdRequest request) {
|
||||||
this.service.archive(request);
|
this.service.archive(request);
|
||||||
|
|||||||
@@ -21,17 +21,12 @@ import java.time.LocalDate;
|
|||||||
@Data
|
@Data
|
||||||
@Entity
|
@Entity
|
||||||
public class EmpSalaryEntity extends OrgCommonEntity {
|
public class EmpSalaryEntity extends OrgCommonEntity {
|
||||||
|
|
||||||
@ManyToOne
|
|
||||||
private EmpSalaryBatchEntity batch;
|
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne private EmpSalaryBatchEntity batch;
|
||||||
private EmployeeEntity employee;
|
|
||||||
|
|
||||||
|
@ManyToOne private EmployeeEntity employee;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne private EmpMonthAttendanceEntity empMonthAttendance;
|
||||||
private EmpMonthAttendanceEntity empMonthAttendance;
|
|
||||||
|
|
||||||
|
|
||||||
private BigDecimal item0;
|
private BigDecimal item0;
|
||||||
private BigDecimal item1;
|
private BigDecimal item1;
|
||||||
@@ -85,54 +80,35 @@ public class EmpSalaryEntity extends OrgCommonEntity {
|
|||||||
private BigDecimal item49;
|
private BigDecimal item49;
|
||||||
private BigDecimal item50;
|
private BigDecimal item50;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private BigDecimal yfheji;
|
private BigDecimal yfheji;
|
||||||
private BigDecimal kfheji;
|
private BigDecimal kfheji;
|
||||||
private BigDecimal sfheji;
|
private BigDecimal sfheji;
|
||||||
|
|
||||||
|
/** 出勤记录冗余字段 */
|
||||||
/**
|
|
||||||
* 出勤记录冗余字段
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
@Comment("是否全勤")
|
@Comment("是否全勤")
|
||||||
private Boolean fullAttendance;
|
private Boolean fullAttendance;
|
||||||
|
|
||||||
|
|
||||||
@Comment("是否满勤")
|
@Comment("是否满勤")
|
||||||
private Boolean fullWork;
|
private Boolean fullWork;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Comment("应出勤天数")
|
@Comment("应出勤天数")
|
||||||
private Double shouldAttendanceDays;
|
private Double shouldAttendanceDays;
|
||||||
|
|
||||||
|
|
||||||
@Comment("实际出勤天数")
|
@Comment("实际出勤天数")
|
||||||
private Double actualAttendanceDays;
|
private Double actualAttendanceDays;
|
||||||
|
|
||||||
|
|
||||||
@Comment("加班天数")
|
@Comment("加班天数")
|
||||||
private Double overtimeDays;
|
private Double overtimeDays;
|
||||||
|
|
||||||
|
|
||||||
@Comment("请假天数")
|
@Comment("请假天数")
|
||||||
private Double leaveDays;
|
private Double leaveDays;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Comment("事假天数")
|
@Comment("事假天数")
|
||||||
private Double personalLeaveDays;
|
private Double personalLeaveDays;
|
||||||
|
|
||||||
|
|
||||||
@Comment("病假天数")
|
@Comment("病假天数")
|
||||||
private Double sickLeaveDays;
|
private Double sickLeaveDays;
|
||||||
|
|
||||||
|
|
||||||
@Comment("婚假天数")
|
@Comment("婚假天数")
|
||||||
private Double marriageLeaveDays;
|
private Double marriageLeaveDays;
|
||||||
|
|
||||||
@@ -148,34 +124,22 @@ public class EmpSalaryEntity extends OrgCommonEntity {
|
|||||||
@Comment("年假天数")
|
@Comment("年假天数")
|
||||||
private Double annualLeaveDays;
|
private Double annualLeaveDays;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Comment("迟到次数")
|
@Comment("迟到次数")
|
||||||
private Integer lateTimes;
|
private Integer lateTimes;
|
||||||
|
|
||||||
@Comment("迟到分钟数")
|
@Comment("迟到分钟数")
|
||||||
private Integer lateMinutes;
|
private Integer lateMinutes;
|
||||||
|
|
||||||
|
|
||||||
@Comment("早退次数")
|
@Comment("早退次数")
|
||||||
private Integer earlyTimes;
|
private Integer earlyTimes;
|
||||||
|
|
||||||
@Comment("早退分钟数")
|
@Comment("早退分钟数")
|
||||||
private Integer earlyMinutes;
|
private Integer earlyMinutes;
|
||||||
|
|
||||||
|
|
||||||
@Comment("旷工次数")
|
@Comment("旷工次数")
|
||||||
private Integer absenteeismTimes;
|
private Integer absenteeismTimes;
|
||||||
|
|
||||||
|
/** 员工信息冗余字段 */
|
||||||
/**
|
|
||||||
* 员工信息冗余字段
|
|
||||||
*/
|
|
||||||
|
|
||||||
private String empName;
|
private String empName;
|
||||||
|
|
||||||
private String empCode;
|
private String empCode;
|
||||||
@@ -226,33 +190,28 @@ public class EmpSalaryEntity extends OrgCommonEntity {
|
|||||||
@Comment("手机号")
|
@Comment("手机号")
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Comment("部门")
|
@Comment("部门")
|
||||||
private String departmentId;
|
private String departmentId;
|
||||||
|
|
||||||
@Comment("部门")
|
@Comment("部门")
|
||||||
private String departmentCode;
|
private String departmentCode;
|
||||||
|
|
||||||
|
|
||||||
@Comment("部门")
|
@Comment("部门")
|
||||||
private String departmentName;
|
private String departmentName;
|
||||||
|
|
||||||
@Comment("岗位")
|
@Comment("岗位")
|
||||||
private String jobPostId;
|
private String jobPostId;
|
||||||
|
|
||||||
@Comment("岗位")
|
@Comment("岗位")
|
||||||
private String jobPostCode;
|
private String jobPostCode;
|
||||||
|
|
||||||
|
|
||||||
@Comment("岗位")
|
@Comment("岗位")
|
||||||
private String jobPostName;
|
private String jobPostName;
|
||||||
|
|
||||||
|
|
||||||
@Comment("银行编码")
|
@Comment("银行编码")
|
||||||
private String bank;
|
private String bank;
|
||||||
|
|
||||||
@DictTranslate(dictKey = DictCode.BANK)
|
@DictTranslate(dictKey = DictCode.BANK)
|
||||||
private String bankName;
|
private String bankName;
|
||||||
|
|
||||||
@Comment("银行卡号")
|
@Comment("银行卡号")
|
||||||
@@ -261,8 +220,6 @@ public class EmpSalaryEntity extends OrgCommonEntity {
|
|||||||
@Comment("收款人姓名")
|
@Comment("收款人姓名")
|
||||||
private String bankCardName;
|
private String bankCardName;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Comment("离职时间")
|
@Comment("离职时间")
|
||||||
private LocalDate resignDate;
|
private LocalDate resignDate;
|
||||||
|
|
||||||
@@ -275,61 +232,177 @@ public class EmpSalaryEntity extends OrgCommonEntity {
|
|||||||
@DictTranslate(dictKey = DictCode.EMP_STATUS)
|
@DictTranslate(dictKey = DictCode.EMP_STATUS)
|
||||||
private String empStatusName;
|
private String empStatusName;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Comment("养老保险基数")
|
@Comment("养老保险基数")
|
||||||
private Double insurance1Base;
|
private Double insurance1Base;
|
||||||
|
|
||||||
@Comment("养老保险比例")
|
@Comment("养老保险比例")
|
||||||
private Double insurance1Percent;
|
private Double insurance1Percent;
|
||||||
|
|
||||||
|
|
||||||
@Comment("医疗保险基数")
|
@Comment("医疗保险基数")
|
||||||
private Double insurance2Base;
|
private Double insurance2Base;
|
||||||
|
|
||||||
@Comment("医疗保险比例")
|
@Comment("医疗保险比例")
|
||||||
private Double insurance2Percent;
|
private Double insurance2Percent;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Comment("失业保险基数")
|
@Comment("失业保险基数")
|
||||||
private Double insurance3Base;
|
private Double insurance3Base;
|
||||||
|
|
||||||
@Comment("失业保险比例")
|
@Comment("失业保险比例")
|
||||||
private Double insurance3Percent;
|
private Double insurance3Percent;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Comment("工伤保险基数")
|
@Comment("工伤保险基数")
|
||||||
private Double insurance4Base;
|
private Double insurance4Base;
|
||||||
|
|
||||||
@Comment("工伤保险比例")
|
@Comment("工伤保险比例")
|
||||||
private Double insurance4Percent;
|
private Double insurance4Percent;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Comment("生育保险基数")
|
@Comment("生育保险基数")
|
||||||
private Double insurance5Base;
|
private Double insurance5Base;
|
||||||
|
|
||||||
@Comment("生育保险比例")
|
@Comment("生育保险比例")
|
||||||
private Double insurance5Percent;
|
private Double insurance5Percent;
|
||||||
|
|
||||||
@Comment("住房公积金基数")
|
@Comment("住房公积金基数")
|
||||||
private Double insurance6Base;
|
private Double insurance6Base;
|
||||||
|
|
||||||
@Comment("住房公积金比例")
|
@Comment("住房公积金比例")
|
||||||
private Double insurance6Percent;
|
private Double insurance6Percent;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Comment("归档状态")
|
@Comment("归档状态")
|
||||||
@ColumnDefault("'0'")
|
@ColumnDefault("'0'")
|
||||||
private String archiveStatus = "0";
|
private String archiveStatus = "0";
|
||||||
|
|
||||||
|
public void update(EmpSalaryEntity salaryEntity) {
|
||||||
|
|
||||||
|
updateItems(salaryEntity);
|
||||||
|
|
||||||
|
updateEmpInfo(salaryEntity);
|
||||||
|
|
||||||
|
updateAttendance(salaryEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateAttendance(EmpSalaryEntity salaryEntity) {
|
||||||
|
this.fullAttendance = salaryEntity.fullAttendance;
|
||||||
|
this.fullWork = salaryEntity.fullWork;
|
||||||
|
this.shouldAttendanceDays = salaryEntity.shouldAttendanceDays;
|
||||||
|
this.actualAttendanceDays = salaryEntity.actualAttendanceDays;
|
||||||
|
this.overtimeDays = salaryEntity.overtimeDays;
|
||||||
|
this.leaveDays = salaryEntity.leaveDays;
|
||||||
|
this.personalLeaveDays = salaryEntity.personalLeaveDays;
|
||||||
|
this.sickLeaveDays = salaryEntity.sickLeaveDays;
|
||||||
|
this.marriageLeaveDays = salaryEntity.marriageLeaveDays;
|
||||||
|
this.maternityLeaveDays = salaryEntity.maternityLeaveDays;
|
||||||
|
this.paternityLeaveDays = salaryEntity.paternityLeaveDays;
|
||||||
|
this.funeralLeaveDays = salaryEntity.funeralLeaveDays;
|
||||||
|
this.annualLeaveDays = salaryEntity.annualLeaveDays;
|
||||||
|
this.lateTimes = salaryEntity.lateTimes;
|
||||||
|
this.lateMinutes = salaryEntity.lateMinutes;
|
||||||
|
this.earlyTimes = salaryEntity.earlyTimes;
|
||||||
|
this.earlyMinutes = salaryEntity.earlyMinutes;
|
||||||
|
this.absenteeismTimes = salaryEntity.absenteeismTimes;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateEmpInfo(EmpSalaryEntity salaryEntity) {
|
||||||
|
|
||||||
|
this.empName = salaryEntity.empName;
|
||||||
|
this.empCode = salaryEntity.empCode;
|
||||||
|
this.sex = salaryEntity.sex;
|
||||||
|
this.sexName = salaryEntity.sexName;
|
||||||
|
this.nation = salaryEntity.nation;
|
||||||
|
this.nationName = salaryEntity.nationName;
|
||||||
|
this.marriage = salaryEntity.marriage;
|
||||||
|
this.marriageName = salaryEntity.marriageName;
|
||||||
|
this.entryDate = salaryEntity.entryDate;
|
||||||
|
this.idCard = salaryEntity.idCard;
|
||||||
|
this.education = salaryEntity.education;
|
||||||
|
this.educationName = salaryEntity.educationName;
|
||||||
|
this.school = salaryEntity.school;
|
||||||
|
this.nativePlace = salaryEntity.nativePlace;
|
||||||
|
this.address = salaryEntity.address;
|
||||||
|
this.phone = salaryEntity.phone;
|
||||||
|
this.departmentId = salaryEntity.departmentId;
|
||||||
|
this.departmentCode = salaryEntity.departmentCode;
|
||||||
|
this.departmentName = salaryEntity.departmentName;
|
||||||
|
this.jobPostId = salaryEntity.jobPostId;
|
||||||
|
this.jobPostCode = salaryEntity.jobPostCode;
|
||||||
|
this.jobPostName = salaryEntity.jobPostName;
|
||||||
|
this.bank = salaryEntity.bank;
|
||||||
|
this.bankName = salaryEntity.bankName;
|
||||||
|
this.bankCardNumber = salaryEntity.bankCardNumber;
|
||||||
|
this.bankCardName = salaryEntity.bankCardName;
|
||||||
|
this.resignDate = salaryEntity.resignDate;
|
||||||
|
this.resignReason = salaryEntity.resignReason;
|
||||||
|
this.empStatus = salaryEntity.empStatus;
|
||||||
|
this.empStatusName = salaryEntity.empStatusName;
|
||||||
|
this.insurance1Base = salaryEntity.insurance1Base;
|
||||||
|
this.insurance1Percent = salaryEntity.insurance1Percent;
|
||||||
|
this.insurance2Base = salaryEntity.insurance2Base;
|
||||||
|
this.insurance2Percent = salaryEntity.insurance2Percent;
|
||||||
|
this.insurance3Base = salaryEntity.insurance3Base;
|
||||||
|
this.insurance3Percent = salaryEntity.insurance3Percent;
|
||||||
|
this.insurance4Base = salaryEntity.insurance4Base;
|
||||||
|
this.insurance4Percent = salaryEntity.insurance4Percent;
|
||||||
|
this.insurance5Base = salaryEntity.insurance5Base;
|
||||||
|
this.insurance5Percent = salaryEntity.insurance5Percent;
|
||||||
|
this.insurance6Base = salaryEntity.insurance6Base;
|
||||||
|
this.insurance6Percent = salaryEntity.insurance6Percent;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateItems(EmpSalaryEntity salaryEntity) {
|
||||||
|
|
||||||
|
this.item0 = salaryEntity.item0;
|
||||||
|
this.item1 = salaryEntity.item1;
|
||||||
|
this.item2 = salaryEntity.item2;
|
||||||
|
this.item3 = salaryEntity.item3;
|
||||||
|
this.item4 = salaryEntity.item4;
|
||||||
|
this.item5 = salaryEntity.item5;
|
||||||
|
this.item6 = salaryEntity.item6;
|
||||||
|
this.item7 = salaryEntity.item7;
|
||||||
|
this.item8 = salaryEntity.item8;
|
||||||
|
this.item9 = salaryEntity.item9;
|
||||||
|
this.item10 = salaryEntity.item10;
|
||||||
|
this.item11 = salaryEntity.item11;
|
||||||
|
this.item12 = salaryEntity.item12;
|
||||||
|
this.item13 = salaryEntity.item13;
|
||||||
|
this.item14 = salaryEntity.item14;
|
||||||
|
this.item15 = salaryEntity.item15;
|
||||||
|
this.item16 = salaryEntity.item16;
|
||||||
|
this.item17 = salaryEntity.item17;
|
||||||
|
this.item18 = salaryEntity.item18;
|
||||||
|
this.item19 = salaryEntity.item19;
|
||||||
|
this.item20 = salaryEntity.item20;
|
||||||
|
this.item21 = salaryEntity.item21;
|
||||||
|
this.item22 = salaryEntity.item22;
|
||||||
|
this.item23 = salaryEntity.item23;
|
||||||
|
this.item24 = salaryEntity.item24;
|
||||||
|
this.item25 = salaryEntity.item25;
|
||||||
|
this.item26 = salaryEntity.item26;
|
||||||
|
this.item27 = salaryEntity.item27;
|
||||||
|
this.item28 = salaryEntity.item28;
|
||||||
|
this.item29 = salaryEntity.item29;
|
||||||
|
this.item30 = salaryEntity.item30;
|
||||||
|
this.item31 = salaryEntity.item31;
|
||||||
|
this.item32 = salaryEntity.item32;
|
||||||
|
this.item33 = salaryEntity.item33;
|
||||||
|
this.item34 = salaryEntity.item34;
|
||||||
|
this.item35 = salaryEntity.item35;
|
||||||
|
this.item36 = salaryEntity.item36;
|
||||||
|
this.item37 = salaryEntity.item37;
|
||||||
|
this.item38 = salaryEntity.item38;
|
||||||
|
this.item39 = salaryEntity.item39;
|
||||||
|
this.item40 = salaryEntity.item40;
|
||||||
|
this.item41 = salaryEntity.item41;
|
||||||
|
this.item42 = salaryEntity.item42;
|
||||||
|
this.item43 = salaryEntity.item43;
|
||||||
|
this.item44 = salaryEntity.item44;
|
||||||
|
this.item45 = salaryEntity.item45;
|
||||||
|
this.item46 = salaryEntity.item46;
|
||||||
|
this.item47 = salaryEntity.item47;
|
||||||
|
this.item48 = salaryEntity.item48;
|
||||||
|
this.item49 = salaryEntity.item49;
|
||||||
|
this.item50 = salaryEntity.item50;
|
||||||
|
this.yfheji = salaryEntity.yfheji;
|
||||||
|
this.kfheji = salaryEntity.kfheji;
|
||||||
|
this.sfheji = salaryEntity.sfheji;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,8 +14,11 @@ import cn.lihongjie.coal.empSalary.entity.EmpSalaryEntity;
|
|||||||
import cn.lihongjie.coal.empSalary.mapper.EmpSalaryMapper;
|
import cn.lihongjie.coal.empSalary.mapper.EmpSalaryMapper;
|
||||||
import cn.lihongjie.coal.empSalary.repository.EmpSalaryRepository;
|
import cn.lihongjie.coal.empSalary.repository.EmpSalaryRepository;
|
||||||
import cn.lihongjie.coal.empSalaryBatch.entity.EmpSalaryBatchEntity;
|
import cn.lihongjie.coal.empSalaryBatch.entity.EmpSalaryBatchEntity;
|
||||||
|
import cn.lihongjie.coal.empSalaryBatch.service.EmpSalaryBatchService;
|
||||||
import cn.lihongjie.coal.empSalaryItem.service.EmpSalaryItemService;
|
import cn.lihongjie.coal.empSalaryItem.service.EmpSalaryItemService;
|
||||||
|
import cn.lihongjie.coal.employee.dto.EmployeeDto;
|
||||||
import cn.lihongjie.coal.employee.entity.EmployeeEntity;
|
import cn.lihongjie.coal.employee.entity.EmployeeEntity;
|
||||||
|
import cn.lihongjie.coal.employee.service.EmployeeService;
|
||||||
import cn.lihongjie.coal.exception.BizException;
|
import cn.lihongjie.coal.exception.BizException;
|
||||||
|
|
||||||
import groovy.lang.Binding;
|
import groovy.lang.Binding;
|
||||||
@@ -92,6 +95,7 @@ public class EmpSalaryService extends BaseService<EmpSalaryEntity, EmpSalaryRepo
|
|||||||
public void unarchive(IdRequest dto) {
|
public void unarchive(IdRequest dto) {
|
||||||
this.repository.unArchive(dto);
|
this.repository.unArchive(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Autowired EmpSalaryItemService empSalaryItemService;
|
@Autowired EmpSalaryItemService empSalaryItemService;
|
||||||
|
|
||||||
public EmpSalaryDto update(UpdateEmpSalaryDto request) {
|
public EmpSalaryDto update(UpdateEmpSalaryDto request) {
|
||||||
@@ -113,30 +117,216 @@ public class EmpSalaryService extends BaseService<EmpSalaryEntity, EmpSalaryRepo
|
|||||||
this.repository.deleteAllById(request.getIds());
|
this.repository.deleteAllById(request.getIds());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Autowired EmpSalaryBatchService batchService;
|
||||||
|
@Autowired EmployeeService employeeService;
|
||||||
|
|
||||||
|
private static void batchModifing(EmpSalaryBatchEntity batch) {
|
||||||
|
throw new BizException(
|
||||||
|
String.format(
|
||||||
|
"批次 %s-%s-%s 正在编辑中, 无法操作",
|
||||||
|
batch.getBatchYearMonth().getYear(),
|
||||||
|
batch.getBatchYearMonth().getMonthValue(),
|
||||||
|
batch.getBatchNo()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static @NotNull Script initScriptClass(
|
||||||
|
GroovyClassLoader groovyClassLoader, String script)
|
||||||
|
throws InstantiationException, IllegalAccessException {
|
||||||
|
Class parsedClass = groovyClassLoader.parseClass(script);
|
||||||
|
|
||||||
|
Script scriptObj = (Script) parsedClass.newInstance();
|
||||||
|
return scriptObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static @NotNull GroovyClassLoader initClassLoader(GroovyClassLoader groovyClassLoader) {
|
||||||
|
CompilerConfiguration config = new CompilerConfiguration();
|
||||||
|
config.addCompilationCustomizers(GroovyScriptUtils.SecurityCustomizer);
|
||||||
|
groovyClassLoader = new GroovyClassLoader(GroovyScriptUtils.class.getClassLoader(), config);
|
||||||
|
return groovyClassLoader;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化工资
|
* 查询批次可选的员工
|
||||||
*
|
*
|
||||||
* @param batch
|
* @param idRequest
|
||||||
* @param employees
|
* @return
|
||||||
*/
|
*/
|
||||||
|
public List<String> batchSelectEmpIds(IdRequest idRequest) {
|
||||||
|
|
||||||
|
return em.createQuery(
|
||||||
|
"select distinct e.id from EmpSalaryEntity e where e.id not in (select s.employee.id from EmpSalaryEntity s where s.batch.id =:batchId)",
|
||||||
|
String.class)
|
||||||
|
.setParameter("batchId", idRequest.getId())
|
||||||
|
.getResultList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询批次已选的员工
|
||||||
|
*
|
||||||
|
* @param idRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<String> batchSelectedEmpIds(IdRequest idRequest) {
|
||||||
|
|
||||||
|
return em.createQuery(
|
||||||
|
"select distinct e.id from EmpSalaryEntity e where e.id in (select s.employee.id from EmpSalaryEntity s where s.batch.id =:batchId)",
|
||||||
|
String.class)
|
||||||
|
.setParameter("batchId", idRequest.getId())
|
||||||
|
.getResultList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按照ID进行重新计算
|
||||||
|
*
|
||||||
|
* @param ids
|
||||||
|
*/
|
||||||
|
public void recalculate(IdRequest ids) {
|
||||||
|
|
||||||
|
List<EmpSalaryEntity> salaries =
|
||||||
|
em.createQuery(
|
||||||
|
"select s from EmpSalaryEntity s join fetch s.employee join fetch s.batch join fetch s.empMonthAttendance where s.id in :ids",
|
||||||
|
EmpSalaryEntity.class)
|
||||||
|
.setParameter("ids", ids.getIds())
|
||||||
|
.getResultList();
|
||||||
|
|
||||||
|
recalculate(salaries, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 针对某个员工重新计算, 用于编辑表单的预览 */
|
||||||
|
public EmpSalaryDto recalculatePreview(UpdateEmpSalaryDto dto) {
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重新计算 */
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
public void initSalary(EmpSalaryBatchEntity batch, List<EmployeeEntity> employees) {
|
public void recalculate(List<EmpSalaryEntity> salaries, boolean update) {
|
||||||
|
|
||||||
|
if (salaries.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
EmpSalaryBatchEntity batch = salaries.get(0).getBatch();
|
||||||
|
|
||||||
StopWatch stopWatch = new StopWatch("initSalary: " + batch.getId());
|
StopWatch stopWatch = new StopWatch("initSalary: " + batch.getId());
|
||||||
|
|
||||||
stopWatch.start("getLock");
|
stopWatch.start("getLock");
|
||||||
RLock lock = redissonClient.getLock("initSalary." + batch.getId());
|
RLock lock = redissonClient.getLock("batchModify." + batch.getId());
|
||||||
|
|
||||||
boolean tryLock = lock.tryLock();
|
boolean tryLock = lock.tryLock();
|
||||||
|
|
||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
if (!tryLock) {
|
if (!tryLock) {
|
||||||
throw new BizException(
|
batchModifing(batch);
|
||||||
String.format(
|
}
|
||||||
"批次 %s-%s-%s 正在初始化中",
|
GroovyClassLoader groovyClassLoader = null;
|
||||||
batch.getBatchYearMonth().getYear(),
|
|
||||||
batch.getBatchYearMonth().getMonthValue(),
|
try {
|
||||||
batch.getBatchNo()));
|
|
||||||
|
// 判断批次状态
|
||||||
|
|
||||||
|
stopWatch.start("checkBatchStatus");
|
||||||
|
checkBatchStatus(batch);
|
||||||
|
stopWatch.stop();
|
||||||
|
|
||||||
|
// 查询考勤数据
|
||||||
|
|
||||||
|
stopWatch.start("genScript");
|
||||||
|
// 生成计算脚本
|
||||||
|
String script = genScript(batch);
|
||||||
|
|
||||||
|
stopWatch.stop();
|
||||||
|
|
||||||
|
stopWatch.start("parseScript");
|
||||||
|
groovyClassLoader = initClassLoader(groovyClassLoader);
|
||||||
|
|
||||||
|
Script scriptObj = initScriptClass(groovyClassLoader, script);
|
||||||
|
|
||||||
|
stopWatch.stop();
|
||||||
|
|
||||||
|
List<EmployeeDto> dtoByIds =
|
||||||
|
this.employeeService.getDtoByIds(
|
||||||
|
salaries.stream().map(e -> e.getEmployee().getId()).toList());
|
||||||
|
|
||||||
|
Map<String, EmployeeDto> dtoMap =
|
||||||
|
dtoByIds.stream().collect(Collectors.toMap(e -> e.getId(), e -> e));
|
||||||
|
|
||||||
|
// 执行计算脚本
|
||||||
|
|
||||||
|
for (var salary : salaries) {
|
||||||
|
|
||||||
|
var employee = salary.getEmployee();
|
||||||
|
|
||||||
|
EmpMonthAttendanceEntity attendance = salary.getEmpMonthAttendance();
|
||||||
|
stopWatch.start("buildCtx: " + employee.getName());
|
||||||
|
|
||||||
|
Map<String, Object> ctx =
|
||||||
|
buildCtx(batch, dtoMap.get(employee.getId()), attendance, salary);
|
||||||
|
|
||||||
|
stopWatch.stop();
|
||||||
|
|
||||||
|
// 计算
|
||||||
|
|
||||||
|
stopWatch.start("execScript: " + employee.getName());
|
||||||
|
scriptObj.setBinding(new Binding(Map.of("salary", ctx)));
|
||||||
|
|
||||||
|
scriptObj.run();
|
||||||
|
stopWatch.stop();
|
||||||
|
|
||||||
|
// 转化为工资数据
|
||||||
|
|
||||||
|
stopWatch.start("convertToSalary: " + employee.getName());
|
||||||
|
EmpSalaryEntity salaryEntity = ReflectUtils.fromMap(ctx, EmpSalaryEntity.class);
|
||||||
|
|
||||||
|
salary.update(salaryEntity);
|
||||||
|
|
||||||
|
stopWatch.stop();
|
||||||
|
salaries.add(salaryEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存到数据库
|
||||||
|
|
||||||
|
if (update) {
|
||||||
|
|
||||||
|
stopWatch.start("saveAll");
|
||||||
|
|
||||||
|
this.repository.saveAll(salaries);
|
||||||
|
stopWatch.stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
lock.unlock();
|
||||||
|
|
||||||
|
if (stopWatch.isRunning()) {
|
||||||
|
stopWatch.stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (groovyClassLoader != null) {
|
||||||
|
groovyClassLoader.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info(stopWatch.prettyPrint());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 初始化工资 */
|
||||||
|
@SneakyThrows
|
||||||
|
public void initSalary(String batchId, List<String> employeesIds) {
|
||||||
|
|
||||||
|
EmpSalaryBatchEntity batch = batchService.get(batchId);
|
||||||
|
|
||||||
|
List<EmployeeDto> employees = employeeService.getDtoByIds(employeesIds);
|
||||||
|
|
||||||
|
StopWatch stopWatch = new StopWatch("initSalary: " + batch.getId());
|
||||||
|
|
||||||
|
stopWatch.start("getLock");
|
||||||
|
RLock lock = redissonClient.getLock("batchModify." + batch.getId());
|
||||||
|
|
||||||
|
boolean tryLock = lock.tryLock();
|
||||||
|
|
||||||
|
stopWatch.stop();
|
||||||
|
if (!tryLock) {
|
||||||
|
batchModifing(batch);
|
||||||
}
|
}
|
||||||
GroovyClassLoader groovyClassLoader = null;
|
GroovyClassLoader groovyClassLoader = null;
|
||||||
|
|
||||||
@@ -164,27 +354,14 @@ public class EmpSalaryService extends BaseService<EmpSalaryEntity, EmpSalaryRepo
|
|||||||
|
|
||||||
stopWatch.start("genScript");
|
stopWatch.start("genScript");
|
||||||
// 生成计算脚本
|
// 生成计算脚本
|
||||||
String script = "";
|
String script = genScript(batch);
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
script = empSalaryItemService.genScript(batch.getOrganizationId());
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("生成计算脚本失败", e);
|
|
||||||
throw new BizException("生成计算脚本失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
|
|
||||||
stopWatch.start("parseScript");
|
stopWatch.start("parseScript");
|
||||||
CompilerConfiguration config = new CompilerConfiguration();
|
groovyClassLoader = initClassLoader(groovyClassLoader);
|
||||||
config.addCompilationCustomizers(GroovyScriptUtils.SecurityCustomizer);
|
|
||||||
groovyClassLoader =
|
|
||||||
new GroovyClassLoader(GroovyScriptUtils.class.getClassLoader(), config);
|
|
||||||
|
|
||||||
Class parsedClass = groovyClassLoader.parseClass(script);
|
Script scriptObj = initScriptClass(groovyClassLoader, script);
|
||||||
|
|
||||||
Script scriptObj = (Script) parsedClass.newInstance();
|
|
||||||
|
|
||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
|
|
||||||
@@ -192,7 +369,7 @@ public class EmpSalaryService extends BaseService<EmpSalaryEntity, EmpSalaryRepo
|
|||||||
|
|
||||||
List<EmpSalaryEntity> salaries = new ArrayList<>();
|
List<EmpSalaryEntity> salaries = new ArrayList<>();
|
||||||
|
|
||||||
for (EmployeeEntity employee : employees) {
|
for (EmployeeDto employee : employees) {
|
||||||
|
|
||||||
EmpMonthAttendanceEntity attendance =
|
EmpMonthAttendanceEntity attendance =
|
||||||
attMap.containsKey(employee.getId())
|
attMap.containsKey(employee.getId())
|
||||||
@@ -219,7 +396,7 @@ public class EmpSalaryService extends BaseService<EmpSalaryEntity, EmpSalaryRepo
|
|||||||
stopWatch.start("convertToSalary: " + employee.getName());
|
stopWatch.start("convertToSalary: " + employee.getName());
|
||||||
EmpSalaryEntity salaryEntity = ReflectUtils.fromMap(ctx, EmpSalaryEntity.class);
|
EmpSalaryEntity salaryEntity = ReflectUtils.fromMap(ctx, EmpSalaryEntity.class);
|
||||||
salaryEntity.setBatch(batch);
|
salaryEntity.setBatch(batch);
|
||||||
salaryEntity.setEmployee(employee);
|
salaryEntity.setEmployee(em.getReference(EmployeeEntity.class, employee.getId()));
|
||||||
salaryEntity.setEmpMonthAttendance(attendance);
|
salaryEntity.setEmpMonthAttendance(attendance);
|
||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
salaries.add(salaryEntity);
|
salaries.add(salaryEntity);
|
||||||
@@ -246,14 +423,26 @@ public class EmpSalaryService extends BaseService<EmpSalaryEntity, EmpSalaryRepo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String genScript(EmpSalaryBatchEntity batch) {
|
||||||
|
String script = "";
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
script = empSalaryItemService.genScript(batch.getOrganizationId());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("生成计算脚本失败", e);
|
||||||
|
throw new BizException("生成计算脚本失败");
|
||||||
|
}
|
||||||
|
return script;
|
||||||
|
}
|
||||||
|
|
||||||
private @NotNull Map<String, List<EmpMonthAttendanceEntity>> queryAttendanceMap(
|
private @NotNull Map<String, List<EmpMonthAttendanceEntity>> queryAttendanceMap(
|
||||||
EmpSalaryBatchEntity batch, List<EmployeeEntity> employees) {
|
EmpSalaryBatchEntity batch, List<EmployeeDto> employees) {
|
||||||
List<EmpMonthAttendanceEntity> attendances =
|
List<EmpMonthAttendanceEntity> attendances =
|
||||||
em.createQuery(
|
em.createQuery(
|
||||||
"select a from EmpMonthAttendanceEntity a where a.employee.id in :empIds and a.yearMonth = :yearMonth",
|
"select a from EmpMonthAttendanceEntity a where a.employee.id in :empIds and a.yearMonth = :yearMonth",
|
||||||
EmpMonthAttendanceEntity.class)
|
EmpMonthAttendanceEntity.class)
|
||||||
.setParameter(
|
.setParameter("empIds", employees.stream().map(EmployeeDto::getId).toList())
|
||||||
"empIds", employees.stream().map(EmployeeEntity::getId).toList())
|
|
||||||
.setParameter("yearMonth", batch.getBatchYearMonth())
|
.setParameter("yearMonth", batch.getBatchYearMonth())
|
||||||
.getResultList();
|
.getResultList();
|
||||||
|
|
||||||
@@ -264,14 +453,13 @@ public class EmpSalaryService extends BaseService<EmpSalaryEntity, EmpSalaryRepo
|
|||||||
|
|
||||||
private void checkBatchStatus(EmpSalaryBatchEntity batch) {}
|
private void checkBatchStatus(EmpSalaryBatchEntity batch) {}
|
||||||
|
|
||||||
private void checkDuplicate(EmpSalaryBatchEntity batch, List<EmployeeEntity> employees) {
|
private void checkDuplicate(EmpSalaryBatchEntity batch, List<EmployeeDto> employees) {
|
||||||
List<EmpSalaryEntity> exists =
|
List<EmpSalaryEntity> exists =
|
||||||
em.createQuery(
|
em.createQuery(
|
||||||
"select s from EmpSalaryEntity s where s.batch.id = :batchId and s.employee.id in :empIds",
|
"select s from EmpSalaryEntity s where s.batch.id = :batchId and s.employee.id in :empIds",
|
||||||
EmpSalaryEntity.class)
|
EmpSalaryEntity.class)
|
||||||
.setParameter("batchId", batch.getId())
|
.setParameter("batchId", batch.getId())
|
||||||
.setParameter(
|
.setParameter("empIds", employees.stream().map(EmployeeDto::getId).toList())
|
||||||
"empIds", employees.stream().map(EmployeeEntity::getId).toList())
|
|
||||||
.getResultList();
|
.getResultList();
|
||||||
|
|
||||||
if (!exists.isEmpty()) {
|
if (!exists.isEmpty()) {
|
||||||
@@ -299,7 +487,7 @@ public class EmpSalaryService extends BaseService<EmpSalaryEntity, EmpSalaryRepo
|
|||||||
*/
|
*/
|
||||||
public Map<String, Object> buildCtx(
|
public Map<String, Object> buildCtx(
|
||||||
EmpSalaryBatchEntity batch,
|
EmpSalaryBatchEntity batch,
|
||||||
EmployeeEntity employee,
|
EmployeeDto employee,
|
||||||
EmpMonthAttendanceEntity attendance,
|
EmpMonthAttendanceEntity attendance,
|
||||||
EmpSalaryEntity salary) {
|
EmpSalaryEntity salary) {
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ import cn.lihongjie.coal.base.dto.CommonQuery;
|
|||||||
import cn.lihongjie.coal.base.dto.IdRequest;
|
import cn.lihongjie.coal.base.dto.IdRequest;
|
||||||
import cn.lihongjie.coal.base.service.BaseService;
|
import cn.lihongjie.coal.base.service.BaseService;
|
||||||
import cn.lihongjie.coal.common.Ctx;
|
import cn.lihongjie.coal.common.Ctx;
|
||||||
import cn.lihongjie.coal.common.FreeMakerUtils;
|
|
||||||
import cn.lihongjie.coal.common.JpaUtils;
|
|
||||||
import cn.lihongjie.coal.empSalary.entity.EmpSalaryEntity;
|
import cn.lihongjie.coal.empSalary.entity.EmpSalaryEntity;
|
||||||
import cn.lihongjie.coal.empSalaryBatch.entity.EmpSalaryBatchEntity;
|
import cn.lihongjie.coal.empSalaryBatch.entity.EmpSalaryBatchEntity;
|
||||||
import cn.lihongjie.coal.empSalaryItem.dto.CreateEmpSalaryItemDto;
|
import cn.lihongjie.coal.empSalaryItem.dto.CreateEmpSalaryItemDto;
|
||||||
@@ -76,51 +74,54 @@ public class EmpSalaryItemService
|
|||||||
public List<EmpSalaryItemEntity> findAllBy(
|
public List<EmpSalaryItemEntity> findAllBy(
|
||||||
String organizationId, List<String> dependOn, List<String> dependOnSysItem) {
|
String organizationId, List<String> dependOn, List<String> dependOnSysItem) {
|
||||||
|
|
||||||
Map<String, Object> params = new HashMap<>();
|
// Map<String, Object> params = new HashMap<>();
|
||||||
|
//
|
||||||
|
// params.put("organizationId", organizationId);
|
||||||
|
// params.put("dependOn", dependOn);
|
||||||
|
// params.put("dependOnSysItem", dependOnSysItem);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// List<String> ids =
|
||||||
|
// JpaUtils.execNativeQuery(
|
||||||
|
// em,
|
||||||
|
// FreeMakerUtils.render(
|
||||||
|
// """
|
||||||
|
//
|
||||||
|
// select * from t_emp_salary_item
|
||||||
|
// <@where>
|
||||||
|
//
|
||||||
|
// <#if organizationId??>
|
||||||
|
// AND organization_id = :organizationId
|
||||||
|
//
|
||||||
|
// </#if>
|
||||||
|
//
|
||||||
|
// <#if dependOn?? && !dependOnSysItem??>
|
||||||
|
// AND depend_on @> ARRAY[:dependOn]
|
||||||
|
// </#if>
|
||||||
|
//
|
||||||
|
// <#if dependOnSysItem?? && !dependOn??>
|
||||||
|
// AND depend_on_sys_item @> ARRAY[:dependOnSysItem]
|
||||||
|
// </#if>
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// <#if dependOn?? && dependOnSysItem??>
|
||||||
|
// AND (depend_on @> ARRAY[:dependOn] or
|
||||||
|
// depend_on_sys_item @> ARRAY[:dependOnSysItem])
|
||||||
|
// </#if>
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// </@where>
|
||||||
|
// """,
|
||||||
|
// params),
|
||||||
|
// params,
|
||||||
|
// String.class);
|
||||||
|
|
||||||
params.put("organizationId", organizationId);
|
return new ArrayList<>();
|
||||||
params.put("dependOn", dependOn);
|
|
||||||
params.put("dependOnSysItem", dependOnSysItem);
|
|
||||||
|
|
||||||
|
// return findAllByIds(ids);
|
||||||
List<String> ids =
|
|
||||||
JpaUtils.execNativeQuery(
|
|
||||||
em,
|
|
||||||
FreeMakerUtils.render(
|
|
||||||
"""
|
|
||||||
|
|
||||||
select * from t_emp_salary_item
|
|
||||||
<@where>
|
|
||||||
|
|
||||||
<#if organizationId??>
|
|
||||||
AND organization_id = :organizationId
|
|
||||||
|
|
||||||
</#if>
|
|
||||||
|
|
||||||
<#if dependOn?? && !dependOnSysItem??>
|
|
||||||
AND depend_on @> ARRAY[:dependOn]
|
|
||||||
</#if>
|
|
||||||
|
|
||||||
<#if dependOnSysItem?? && !dependOn??>
|
|
||||||
AND depend_on_sys_item @> ARRAY[:dependOnSysItem]
|
|
||||||
</#if>
|
|
||||||
|
|
||||||
|
|
||||||
<#if dependOn?? && dependOnSysItem??>
|
|
||||||
AND (depend_on @> ARRAY[:dependOn] or depend_on_sys_item @> ARRAY[:dependOnSysItem])
|
|
||||||
</#if>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</@where>
|
|
||||||
""",
|
|
||||||
params),
|
|
||||||
params,
|
|
||||||
String.class);
|
|
||||||
|
|
||||||
return findAllByIds(ids);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updatePriority(List<EmpSalaryItemEntity> enabled) {
|
private void updatePriority(List<EmpSalaryItemEntity> enabled) {
|
||||||
@@ -357,6 +358,22 @@ public class EmpSalaryItemService
|
|||||||
throw new BizException("工资项目名称重复");
|
throw new BizException("工资项目名称重复");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (CollectionUtils.isNotEmpty(
|
||||||
|
empSalarySysItemService.findAll(
|
||||||
|
new Specification<EmpSalarySysItemEntity>() {
|
||||||
|
@Override
|
||||||
|
public Predicate toPredicate(
|
||||||
|
Root<EmpSalarySysItemEntity> root,
|
||||||
|
CriteriaQuery<?> query,
|
||||||
|
CriteriaBuilder criteriaBuilder) {
|
||||||
|
|
||||||
|
return criteriaBuilder.and(
|
||||||
|
criteriaBuilder.equal(root.get("name"), entity.getName()));
|
||||||
|
}
|
||||||
|
}))) {
|
||||||
|
throw new BizException("与系统预设项目名称重复, 请换一个名称");
|
||||||
|
}
|
||||||
|
|
||||||
this.repository.save(entity);
|
this.repository.save(entity);
|
||||||
this.reSyncAll(entity.getOrganizationId(), null, request.getName());
|
this.reSyncAll(entity.getOrganizationId(), null, request.getName());
|
||||||
return getById(entity.getId());
|
return getById(entity.getId());
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import cn.lihongjie.coal.file.service.FileService;
|
|||||||
import cn.lihongjie.coal.jobPost.dto.CreateJobPostDto;
|
import cn.lihongjie.coal.jobPost.dto.CreateJobPostDto;
|
||||||
import cn.lihongjie.coal.jobPost.entity.JobPostEntity;
|
import cn.lihongjie.coal.jobPost.entity.JobPostEntity;
|
||||||
import cn.lihongjie.coal.jobPost.service.JobPostService;
|
import cn.lihongjie.coal.jobPost.service.JobPostService;
|
||||||
|
import cn.lihongjie.coal.pojoProcessor.PojoProcessor;
|
||||||
|
|
||||||
import io.vavr.Function1;
|
import io.vavr.Function1;
|
||||||
import io.vavr.Function2;
|
import io.vavr.Function2;
|
||||||
@@ -44,6 +45,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -235,4 +237,16 @@ public class EmployeeService extends BaseService<EmployeeEntity, EmployeeReposit
|
|||||||
|
|
||||||
this.repository.saveAll(list);
|
this.repository.saveAll(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Autowired PojoProcessor pojoProcessor;
|
||||||
|
|
||||||
|
public List<EmployeeDto> getDtoByIds(List<String> employeesIds) {
|
||||||
|
|
||||||
|
List<EmployeeDto> collect = this.repository.findAllById(employeesIds).stream().map(this::toDto).collect(Collectors.toList());
|
||||||
|
|
||||||
|
|
||||||
|
pojoProcessor.process(collect, false);
|
||||||
|
|
||||||
|
return collect;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user