xzy-fix-薪资档案中默认人员范围
This commit is contained in:
parent
8c4050fe73
commit
7c358fe3a0
|
|
@ -75,6 +75,7 @@ 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()) {
|
||||
|
|
|
|||
|
|
@ -18,10 +18,13 @@ import com.engine.salary.entity.salarysob.param.SalarySobDisableParam;
|
|||
import com.engine.salary.entity.salarysob.param.SalarySobDuplicateParam;
|
||||
import com.engine.salary.entity.salarysob.param.SalarySobListQueryParam;
|
||||
import com.engine.salary.entity.salarysob.po.*;
|
||||
import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeListDTO;
|
||||
import com.engine.salary.entity.taxagent.param.TaxAgentRangeQueryParam;
|
||||
import com.engine.salary.entity.taxagent.po.TaxAgentAdminPO;
|
||||
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
|
||||
import com.engine.salary.enums.SalarySystemTypeEnum;
|
||||
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
|
||||
import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum;
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.mapper.salarysob.SalarySobMapper;
|
||||
import com.engine.salary.service.*;
|
||||
|
|
@ -68,6 +71,8 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
|
||||
private SalarySobItemHideBiz salarySobItemHideService = new SalarySobItemHideBiz();
|
||||
|
||||
private SalarySobRangeBiz salarySobRangeBiz = new SalarySobRangeBiz();
|
||||
|
||||
private SalarySobMapper getSalarySobMapper() {
|
||||
return MapperProxyFactory.getProxy(SalarySobMapper.class);
|
||||
}
|
||||
|
|
@ -98,6 +103,10 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
return ServiceUtil.getService(TaxAgentAdminServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private TaxAgentManageRangeService getTaxAgentManageRangeService(User user) {
|
||||
return ServiceUtil.getService(TaxAgentManageRangeServiceImpl.class, user);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SalarySobPO getById(Long id) {
|
||||
|
|
@ -234,6 +243,7 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
if (CollectionUtils.isNotEmpty(salarySobPOS)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98403, "薪资账套名称已存在"));
|
||||
}
|
||||
|
||||
// 保存参数转换成薪资账套po
|
||||
SalarySobPO salarySobPO = SalarySobBO.convert2PO(saveParam, (long) user.getUID());
|
||||
// 保存薪资账套
|
||||
|
|
@ -251,10 +261,13 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
saveDefaultEmpField(salarySobPO);
|
||||
// 新建薪资账套时,保存默认的薪资项目
|
||||
saveDefaultItem(salarySobPO);
|
||||
// 新建薪资账套时,保存默认的关联人员范围及从范围中排除
|
||||
saveDefaultEmployeeRange(salarySobPO);
|
||||
// 返回薪资账套的主键id
|
||||
return salarySobPO.getId();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新建薪资账套时,保存默认的员工信息字段
|
||||
*
|
||||
|
|
@ -322,6 +335,104 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 新建薪资账套时,保存默认的关联人员范围及从范围中排除
|
||||
* @return void
|
||||
* @author Harryxzy
|
||||
* @date 2022/10/9 15:30
|
||||
*/
|
||||
private void saveDefaultEmployeeRange(SalarySobPO salarySobPO) {
|
||||
// 获取人员范围列表
|
||||
TaxAgentRangeQueryParam queryParam = TaxAgentRangeQueryParam.builder().taxAgentId(salarySobPO.getTaxAgentId()).build();
|
||||
queryParam.setCurrent(1);
|
||||
queryParam.setPageSize(100000);
|
||||
List<TaxAgentManageRangeListDTO> includeList = (List<TaxAgentManageRangeListDTO>) getTaxAgentManageRangeService(user).listPageByParamAndIncludeType(queryParam, NumberUtils.INTEGER_ONE).getList();
|
||||
includeList.stream().forEach(item->{
|
||||
item.setEmployeeStatus(parseEnum2ValueStr(item.getEmployeeStatus()));
|
||||
});
|
||||
// 获取从范围中排除
|
||||
List<TaxAgentManageRangeListDTO> excludeList = (List<TaxAgentManageRangeListDTO>) getTaxAgentManageRangeService(user).listPageByParamAndIncludeType(queryParam, NumberUtils.INTEGER_ZERO).getList();
|
||||
excludeList.stream().forEach(item->{
|
||||
item.setEmployeeStatus(parseEnum2ValueStr(item.getEmployeeStatus()));
|
||||
});
|
||||
// 将TaxAgentManageRangeListDTO转换为SalarySobRangePO
|
||||
List<SalarySobRangePO> rangeList = convert2SalarySobRangePO(salarySobPO.getId(),includeList,excludeList);
|
||||
// 保存SalarySobRangePO
|
||||
if (CollectionUtils.isNotEmpty(rangeList)) {
|
||||
salarySobRangeBiz.batchInsert(rangeList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description 将TaxAgentManageRangeListDTO转换为SalarySobRangePO
|
||||
* @return List<SalarySangePO>
|
||||
* @author Harryxzy
|
||||
* @date 2022/10/9 16:06
|
||||
*/
|
||||
private List<SalarySobRangePO> convert2SalarySobRangePO(Long salarySobID,List<TaxAgentManageRangeListDTO> includeList, List<TaxAgentManageRangeListDTO> excludeList) {
|
||||
Date now = new Date();
|
||||
ArrayList<SalarySobRangePO> result = new ArrayList<SalarySobRangePO>();
|
||||
// 关联人员范围
|
||||
includeList.stream().forEach(item->{
|
||||
SalarySobRangePO salarySobRangePO = SalarySobRangePO.builder()
|
||||
.salarySobId(salarySobID)
|
||||
.targetType(item.getTargetType().getValue())
|
||||
.targetId(item.getTargetId())
|
||||
.employeeStatuses(item.getEmployeeStatus())
|
||||
.includeType(1)
|
||||
.creator(Long.valueOf(user.getUID()))
|
||||
.createTime(now)
|
||||
.updateTime(now)
|
||||
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
|
||||
.deleteType(0)
|
||||
.build();
|
||||
result.add(salarySobRangePO);
|
||||
});
|
||||
// 从范围中排除
|
||||
excludeList.stream().forEach(item->{
|
||||
SalarySobRangePO salarySobRangePO = SalarySobRangePO.builder()
|
||||
.salarySobId(salarySobID)
|
||||
.targetType(item.getTargetType().getValue())
|
||||
.targetId(item.getTargetId())
|
||||
.employeeStatuses(item.getEmployeeStatus())
|
||||
.includeType(0)
|
||||
.creator(Long.valueOf(user.getUID()))
|
||||
.createTime(now)
|
||||
.updateTime(now)
|
||||
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
|
||||
.deleteType(0)
|
||||
.build();
|
||||
result.add(salarySobRangePO);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description 将枚举的defaultLabel转换为value
|
||||
* @return String
|
||||
* @author Harryxzy
|
||||
* @date 2022/10/9 16:56
|
||||
*/
|
||||
private String parseEnum2ValueStr(String employeeStatus) {
|
||||
String[] split = employeeStatus.split(",");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (SalaryEmployeeStatusEnum statusEnum : SalaryEmployeeStatusEnum.values()) {
|
||||
for(int i =0;i<split.length;i++){
|
||||
if(statusEnum.getDefaultLabel().equals(split[i])){
|
||||
sb.append(statusEnum.getValue());
|
||||
if(i+1 != split.length){
|
||||
sb.append(",");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Long update(SalarySobBasicSaveParam saveParam) {
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue