mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 07:46:40 +08:00
cleanup
This commit is contained in:
@@ -5,24 +5,20 @@ import cn.lihongjie.coal.base.dto.IdRequest;
|
||||
import cn.lihongjie.coal.base.entity.OrgCommonEntity;
|
||||
import cn.lihongjie.coal.base.service.BaseService;
|
||||
import cn.lihongjie.coal.common.ExcelUtils;
|
||||
import cn.lihongjie.coal.common.GroovyScriptUtils;
|
||||
import cn.lihongjie.coal.common.MapUtils;
|
||||
import cn.lihongjie.coal.common.ReflectUtils;
|
||||
import cn.lihongjie.coal.empMonthAttendance.dto.EmpMonthAttendanceDto;
|
||||
import cn.lihongjie.coal.empMonthAttendance.entity.EmpMonthAttendanceEntity;
|
||||
import cn.lihongjie.coal.empMonthAttendance.mapper.EmpMonthAttendanceMapper;
|
||||
import cn.lihongjie.coal.empSalary.dto.*;
|
||||
import cn.lihongjie.coal.empSalary.entity.EmpSalaryEntity;
|
||||
import cn.lihongjie.coal.empSalary.mapper.EmpSalaryMapper;
|
||||
import cn.lihongjie.coal.empSalary.repository.EmpSalaryRepository;
|
||||
import cn.lihongjie.coal.empSalaryBatch.dto.EmpSalaryBatchDto;
|
||||
import cn.lihongjie.coal.empSalaryBatch.entity.EmpSalaryBatchEntity;
|
||||
import cn.lihongjie.coal.empSalaryBatch.mapper.EmpSalaryBatchMapper;
|
||||
import cn.lihongjie.coal.empSalaryBatch.service.EmpSalaryBatchService;
|
||||
import cn.lihongjie.coal.empSalaryItem.entity.EmpSalaryItemEntity;
|
||||
import cn.lihongjie.coal.empSalaryItem.service.EmpSalaryItemService;
|
||||
import cn.lihongjie.coal.employee.dto.EmployeeCalculateDto;
|
||||
import cn.lihongjie.coal.employee.dto.EmployeeDto;
|
||||
import cn.lihongjie.coal.employee.entity.EmployeeEntity;
|
||||
import cn.lihongjie.coal.employee.mapper.EmployeeMapper;
|
||||
import cn.lihongjie.coal.employee.service.EmployeeService;
|
||||
@@ -46,7 +42,6 @@ import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.codehaus.groovy.control.CompilerConfiguration;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.redisson.api.RLock;
|
||||
import org.redisson.api.RedissonClient;
|
||||
@@ -744,15 +739,6 @@ public class EmpSalaryService extends BaseService<EmpSalaryEntity, EmpSalaryRepo
|
||||
|
||||
@Autowired EmpSalaryMapper empSalaryMapper;
|
||||
|
||||
private static @NotNull GroovyClassLoader initClassLoader(GroovyClassLoader groovyClassLoader) {
|
||||
GroovyScriptUtils.initSecurityCustomizer();
|
||||
|
||||
CompilerConfiguration config = new CompilerConfiguration();
|
||||
config.addCompilationCustomizers(GroovyScriptUtils.SecurityCustomizer);
|
||||
groovyClassLoader = new GroovyClassLoader(GroovyScriptUtils.class.getClassLoader(), config);
|
||||
return groovyClassLoader;
|
||||
}
|
||||
|
||||
private void checkDuplicate(EmpSalaryBatchEntity batch, List<EmployeeCalculateDto> employees) {
|
||||
List<EmpSalaryEntity> exists =
|
||||
em.createQuery(
|
||||
@@ -801,63 +787,6 @@ select id from tmp1 where rk = 1
|
||||
.getResultList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建计算上下文
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> buildCtx(
|
||||
EmpSalaryBatchEntity batchEntity,
|
||||
EmployeeDto employee,
|
||||
EmpMonthAttendanceEntity attendanceEntity,
|
||||
EmpSalaryEntity salaryEntity) {
|
||||
|
||||
EmpSalaryBatchDto batch = empSalaryBatchMapper.toDto(batchEntity);
|
||||
|
||||
EmpMonthAttendanceDto attendance = empMonthAttendanceMapper.toDto(attendanceEntity);
|
||||
|
||||
EmpSalaryDto salary = empSalaryMapper.toDto(salaryEntity);
|
||||
|
||||
// if (batch!=null )em.detach(batch);
|
||||
// em.detach(employee);
|
||||
// if (attendance!=null )em.detach(attendance);
|
||||
// if (salary!=null )em.detach(salary);
|
||||
|
||||
Map<String, Object> empMap =
|
||||
employee == null ? new HashMap<>() : ReflectUtils.toMap(employee);
|
||||
|
||||
if (employee != null) {
|
||||
|
||||
empMap.put("empName", employee.getName());
|
||||
empMap.put("empCode", employee.getCode());
|
||||
|
||||
Try.run(() -> empMap.put("departmentId", employee.getDepartment().getId()));
|
||||
Try.run(() -> empMap.put("departmentCode", employee.getDepartment().getCode()));
|
||||
Try.run(() -> empMap.put("departmentName", employee.getDepartment().getName()));
|
||||
Try.run(() -> empMap.put("jobPostId", employee.getJobPost().getId()));
|
||||
Try.run(() -> empMap.put("jobPostCode", employee.getJobPost().getCode()));
|
||||
Try.run(() -> empMap.put("jobPostName", employee.getJobPost().getName()));
|
||||
}
|
||||
|
||||
Map<String, Object> batchMap = batch == null ? new HashMap<>() : ReflectUtils.toMap(batch);
|
||||
Map<String, Object> attendanceMap =
|
||||
attendance == null ? new HashMap<>() : ReflectUtils.toMap(attendance);
|
||||
Map<String, Object> salaryMap =
|
||||
ReflectUtils.toMap(salary == null ? new EmpSalaryEntity() : salary);
|
||||
|
||||
Map<String, Object> ctx = new HashMap<>();
|
||||
ctx.putAll(salaryMap);
|
||||
ctx.putAll(empMap);
|
||||
ctx.putAll(batchMap);
|
||||
ctx.putAll(attendanceMap);
|
||||
|
||||
// 移除通用字段
|
||||
|
||||
removeCommonField(ctx);
|
||||
|
||||
return ctx;
|
||||
}
|
||||
|
||||
public void deleteByBatchId(IdRequest request) {
|
||||
|
||||
Integer cnt = this.repository.deleteByBatchId(request.getIds());
|
||||
|
||||
Reference in New Issue
Block a user