xzy-fix-薪资账套
This commit is contained in:
parent
7ffd295be0
commit
6dcecfb1c1
|
|
@ -39,33 +39,58 @@ public class SalarySobRangeBO {
|
|||
if (CollectionUtils.isEmpty(salarySobRanges)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
Map<Integer, List<SalarySobRangePO>> rangeMap = SalaryEntityUtil.group2Map(salarySobRanges, SalarySobRangePO::getTargetType);
|
||||
List<SalarySobRangeEmpQueryParam> resultParams = Lists.newArrayListWithExpectedSize(rangeMap.size());
|
||||
rangeMap.forEach((targetType, salarySobRangePOS) -> {
|
||||
List<String> employeeStatus = salarySobRangePOS.stream()
|
||||
.map(e -> SalaryEmployeeStatusEnum.parseByValue(e.getEmployeeStatus()))
|
||||
.filter(Objects::nonNull)
|
||||
.map(e -> e.name().toLowerCase())
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
if (employeeStatus.contains(SalaryEmployeeStatusEnum.ALL.name().toLowerCase())) {
|
||||
List<SalarySobRangeEmpQueryParam> resultParams = Lists.newArrayListWithExpectedSize(salarySobRanges.size());
|
||||
salarySobRanges.stream().forEach( item -> {
|
||||
List<String> employeeStatus= new ArrayList<>();
|
||||
List<SalaryEmployeeStatusEnum> salaryEmployeeStatusEnums = SalaryEmployeeStatusEnum.parseByValues(item.getEmployeeStatuses());
|
||||
salaryEmployeeStatusEnums.stream().forEach(e -> e.name().toLowerCase());
|
||||
if(salaryEmployeeStatusEnums.contains((SalaryEmployeeStatusEnum.ALL.name().toLowerCase()))){
|
||||
employeeStatus = Collections.emptyList();
|
||||
}
|
||||
if (employeeStatus.contains(SalaryEmployeeStatusEnum.NORMAL.name().toLowerCase())) {
|
||||
}else if (employeeStatus.contains(SalaryEmployeeStatusEnum.NORMAL.name().toLowerCase())) {
|
||||
employeeStatus = UserStatusEnum.getNormalStatus();
|
||||
}
|
||||
if (employeeStatus.contains(SalaryEmployeeStatusEnum.UNAVAILABLE.name().toLowerCase())) {
|
||||
}else if (employeeStatus.equals(SalaryEmployeeStatusEnum.UNAVAILABLE.name().toLowerCase())) {
|
||||
employeeStatus = UserStatusEnum.getUnavailableStatus();
|
||||
}
|
||||
TargetTypeEnum targetTypeEnum = TargetTypeEnum.parseByValue(targetType);
|
||||
TargetTypeEnum targetTypeEnum = TargetTypeEnum.parseByValue(item.getTargetType());
|
||||
SalarySobRangeEmpQueryParam queryParam = SalarySobRangeEmpQueryParam.builder()
|
||||
.targetType(Optional.ofNullable(targetTypeEnum).map(TargetTypeEnum::name).orElse(StringUtils.EMPTY))
|
||||
.targetIds(SalaryEntityUtil.properties(salarySobRangePOS, SalarySobRangePO::getTargetId))
|
||||
.targetIds(SalaryEntityUtil.properties(salarySobRanges, SalarySobRangePO::getTargetId))
|
||||
.employeeStatus(employeeStatus)
|
||||
.build();
|
||||
resultParams.add(queryParam);
|
||||
});
|
||||
return resultParams;
|
||||
|
||||
|
||||
|
||||
|
||||
// Map<Integer, List<SalarySobRangePO>> rangeMap = SalaryEntityUtil.group2Map(salarySobRanges, SalarySobRangePO::getTargetType);
|
||||
// List<SalarySobRangeEmpQueryParam> resultParams = Lists.newArrayListWithExpectedSize(rangeMap.size());
|
||||
// rangeMap.forEach((targetType, salarySobRangePOS) -> {
|
||||
// List<String> employeeStatus = salarySobRangePOS.stream()
|
||||
// .map(e -> SalaryEmployeeStatusEnum.parseByValue(e.getEmployeeStatus()))
|
||||
// .filter(Objects::nonNull)
|
||||
// .map(e -> e.name().toLowerCase())
|
||||
// .distinct()
|
||||
// .collect(Collectors.toList());
|
||||
// if (employeeStatus.contains(SalaryEmployeeStatusEnum.ALL.name().toLowerCase())) {
|
||||
// employeeStatus = Collections.emptyList();
|
||||
// }
|
||||
// if (employeeStatus.contains(SalaryEmployeeStatusEnum.NORMAL.name().toLowerCase())) {
|
||||
// employeeStatus = UserStatusEnum.getNormalStatus();
|
||||
// }
|
||||
// if (employeeStatus.contains(SalaryEmployeeStatusEnum.UNAVAILABLE.name().toLowerCase())) {
|
||||
// employeeStatus = UserStatusEnum.getUnavailableStatus();
|
||||
// }
|
||||
// TargetTypeEnum targetTypeEnum = TargetTypeEnum.parseByValue(targetType);
|
||||
// SalarySobRangeEmpQueryParam queryParam = SalarySobRangeEmpQueryParam.builder()
|
||||
// .targetType(Optional.ofNullable(targetTypeEnum).map(TargetTypeEnum::name).orElse(StringUtils.EMPTY))
|
||||
// .targetIds(SalaryEntityUtil.properties(salarySobRangePOS, SalarySobRangePO::getTargetId))
|
||||
// .employeeStatus(employeeStatus)
|
||||
// .build();
|
||||
// resultParams.add(queryParam);
|
||||
// });
|
||||
// return resultParams;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import lombok.NoArgsConstructor;
|
|||
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 关联人员
|
||||
|
|
@ -52,6 +53,12 @@ public class SalarySobRangePO {
|
|||
*/
|
||||
private Integer employeeStatus;
|
||||
|
||||
/**
|
||||
* 人员状态使用逗号分隔
|
||||
* @see SalaryEmployeeStatusEnum
|
||||
*/
|
||||
private List<Integer> employeeStatuses;
|
||||
|
||||
/**
|
||||
* 是包含还是排除 0:排除、1:包含
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package com.engine.salary.enums.salarysob;
|
|||
|
||||
import com.engine.salary.enums.BaseEnum;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
|
|
@ -17,9 +19,24 @@ public enum SalaryEmployeeStatusEnum implements BaseEnum<Integer> {
|
|||
|
||||
ALL(0, "全部", 85155),
|
||||
//在职,对应人力资源表中状态,试用0,正式1,临时2,试用延期3
|
||||
NORMAL(1, "在职", 100120),
|
||||
//离职,对应人力资源表中状态,解雇4,离职5,退休6
|
||||
UNAVAILABLE(2, "离职", 85902),
|
||||
NORMAL(1, "试用,正式,临时,临时延期", 100120),
|
||||
//离职老,对应人力资源表中状态,解雇4,离职5,退休6
|
||||
UNAVAILABLE(2, "解雇,离职,退休", 85902),
|
||||
|
||||
|
||||
TRIAL(3, "试用", 100121),
|
||||
|
||||
FORMAL(4, "正式", 100122),
|
||||
|
||||
TEMPORARY(5, "临时", 100123),
|
||||
|
||||
DELAY(6, "试用延期", 100124),
|
||||
|
||||
FIRE(7, "解雇", 100125),
|
||||
|
||||
DEPARTURE(8, "离职", 100126),
|
||||
|
||||
RETIRED(9, "退休", 100127),
|
||||
;
|
||||
|
||||
private int value;
|
||||
|
|
@ -57,4 +74,16 @@ public enum SalaryEmployeeStatusEnum implements BaseEnum<Integer> {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<SalaryEmployeeStatusEnum> parseByValues(List<Integer> value) {
|
||||
ArrayList<SalaryEmployeeStatusEnum> results = new ArrayList<>();
|
||||
for (SalaryEmployeeStatusEnum statusEnum : SalaryEmployeeStatusEnum.values()) {
|
||||
for(Integer v : value){
|
||||
if(Objects.equals(statusEnum.getValue(),v)){
|
||||
results.add(statusEnum);
|
||||
}
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -520,10 +520,38 @@
|
|||
<if test="param.status != null and param.status.toString == 'NORMAL'">
|
||||
AND em.status in (0,1,2,3)
|
||||
</if>
|
||||
-- 离职
|
||||
-- 离职(解雇,离职,退休)
|
||||
<if test="param.status != null and param.status.toString == 'UNAVAILABLE'">
|
||||
AND em.status in (4,5,6)
|
||||
</if>
|
||||
-- 试用
|
||||
<if test="param.status != null and param.status.toString == 'TRIAL'">
|
||||
AND em.status in (0)
|
||||
</if>
|
||||
-- 正式
|
||||
<if test="param.status != null and param.status.toString == 'FORMAL'">
|
||||
AND em.status in (1)
|
||||
</if>
|
||||
-- 临时
|
||||
<if test="param.status != null and param.status.toString == 'TEMPORARY'">
|
||||
AND em.status in (2)
|
||||
</if>
|
||||
-- 试用延期
|
||||
<if test="param.status != null and param.status.toString == 'DELAY'">
|
||||
AND em.status in (3)
|
||||
</if>
|
||||
-- 解雇
|
||||
<if test="param.status != null and param.status.toString == 'FIRE'">
|
||||
AND em.status in (4)
|
||||
</if>
|
||||
-- 离职
|
||||
<if test="param.status != null and param.status.toString == 'DEPARTURE'">
|
||||
AND em.status in (5)
|
||||
</if>
|
||||
-- 退休
|
||||
<if test="param.status != null and param.status.toString == 'RETIRED'">
|
||||
AND em.status in (6)
|
||||
</if>
|
||||
)
|
||||
</if>
|
||||
</sql>
|
||||
|
|
@ -564,10 +592,38 @@
|
|||
<if test="param.status != null and param.status.toString == 'NORMAL'">
|
||||
AND em.status in (0,1,2,3)
|
||||
</if>
|
||||
-- 离职
|
||||
-- 离职(解雇,离职,退休)
|
||||
<if test="param.status != null and param.status.toString == 'UNAVAILABLE'">
|
||||
AND em.status in (4,5,6)
|
||||
</if>
|
||||
-- 试用
|
||||
<if test="param.status != null and param.status.toString == 'TRIAL'">
|
||||
AND em.status in (0)
|
||||
</if>
|
||||
-- 正式
|
||||
<if test="param.status != null and param.status.toString == 'FORMAL'">
|
||||
AND em.status in (1)
|
||||
</if>
|
||||
-- 临时
|
||||
<if test="param.status != null and param.status.toString == 'TEMPORARY'">
|
||||
AND em.status in (2)
|
||||
</if>
|
||||
-- 试用延期
|
||||
<if test="param.status != null and param.status.toString == 'DELAY'">
|
||||
AND em.status in (3)
|
||||
</if>
|
||||
-- 解雇
|
||||
<if test="param.status != null and param.status.toString == 'FIRE'">
|
||||
AND em.status in (4)
|
||||
</if>
|
||||
-- 离职
|
||||
<if test="param.status != null and param.status.toString == 'DEPARTURE'">
|
||||
AND em.status in (5)
|
||||
</if>
|
||||
-- 退休
|
||||
<if test="param.status != null and param.status.toString == 'RETIRED'">
|
||||
AND em.status in (6)
|
||||
</if>
|
||||
)
|
||||
</if>
|
||||
</sql>
|
||||
|
|
@ -608,10 +664,40 @@
|
|||
<if test="param.status != null and param.status.toString == 'NORMAL'">
|
||||
AND em.status in (0,1,2,3)
|
||||
</if>
|
||||
-- 离职
|
||||
|
||||
-- 离职(解雇,离职,退休)
|
||||
<if test="param.status != null and param.status.toString == 'UNAVAILABLE'">
|
||||
AND em.status in (4,5,6)
|
||||
</if>
|
||||
-- 试用
|
||||
<if test="param.status != null and param.status.toString == 'TRIAL'">
|
||||
AND em.status in (0)
|
||||
</if>
|
||||
-- 正式
|
||||
<if test="param.status != null and param.status.toString == 'FORMAL'">
|
||||
AND em.status in (1)
|
||||
</if>
|
||||
-- 临时
|
||||
<if test="param.status != null and param.status.toString == 'TEMPORARY'">
|
||||
AND em.status in (2)
|
||||
</if>
|
||||
-- 试用延期
|
||||
<if test="param.status != null and param.status.toString == 'POSTPONE'">
|
||||
AND em.status in (3)
|
||||
</if>
|
||||
-- 解雇
|
||||
<if test="param.status != null and param.status.toString == 'FIRE'">
|
||||
AND em.status in (4)
|
||||
</if>
|
||||
-- 离职
|
||||
<if test="param.status != null and param.status.toString == 'DEPARTURE'">
|
||||
AND em.status in (5)
|
||||
</if>
|
||||
-- 退休
|
||||
<if test="param.status != null and param.status.toString == 'RETIRED'">
|
||||
AND em.status in (6)
|
||||
</if>
|
||||
|
||||
)
|
||||
</if>
|
||||
</sql>
|
||||
|
|
|
|||
Loading…
Reference in New Issue