58 lines
2.2 KiB
Java
58 lines
2.2 KiB
Java
package com.engine.salary.util;
|
|
|
|
import com.engine.salary.entity.salarysob.po.SalarySobRangePO;
|
|
import com.engine.salary.enums.UserStatusEnum;
|
|
import com.engine.salary.service.impl.SalarySobRangeServiceImpl;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* @author Harryxzy
|
|
* @date 2022/10/08 16:06
|
|
* @description 薪资账套工具
|
|
*/
|
|
public class SalarySobUtil {
|
|
|
|
// 处理历史数据将薪资账套中将关联人员状态转换为List
|
|
public static void handleEmployeeStatusHistory(){
|
|
// 根据薪资账套查询人员
|
|
SalarySobRangeServiceImpl salarySobRangeService = new SalarySobRangeServiceImpl();
|
|
List<SalarySobRangePO> salarySobRangePOS = salarySobRangeService.listAllSalarySobRange();
|
|
if(CollectionUtils.isNotEmpty(salarySobRangePOS)){
|
|
// 判断是否已经转换过
|
|
SalarySobRangePO salarySobRangePO = salarySobRangePOS.get(0);
|
|
if(salarySobRangePO.getEmployeeStatuses() == null || salarySobRangePO.getEmployeeStatuses().equals("")){
|
|
salarySobRangePOS.stream().forEach(item ->{
|
|
List<String> employeeStatus = new ArrayList<>();
|
|
if(item.getEmployeeStatus() == 0){
|
|
// 全部
|
|
employeeStatus.addAll(UserStatusEnum.getAllStatus());
|
|
}else if(item.getEmployeeStatus() == 1){
|
|
// 在职
|
|
employeeStatus.addAll(UserStatusEnum.getNormalStatus());
|
|
}else if(item.getEmployeeStatus() == 2){
|
|
// 离职
|
|
employeeStatus.addAll(UserStatusEnum.getUnavailableStatus());
|
|
}
|
|
StringBuilder sb = new StringBuilder();
|
|
for(int i=0; i<employeeStatus.size(); i++){
|
|
sb.append(employeeStatus.get(i));
|
|
if(i+1!=employeeStatus.size()){
|
|
sb.append(",");
|
|
}
|
|
}
|
|
item.setEmployeeStatuses(sb.toString());
|
|
salarySobRangeService.updateEmployeeStatuses(item);
|
|
});
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|