Merge branch 'develop' into dev-LeeD
This commit is contained in:
commit
c92f4f0b28
|
|
@ -70,4 +70,15 @@ public class SalarySobRangeBiz {
|
|||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateEmployeeStatuses(SalarySobRangePO item) {
|
||||
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
SalarySobRangeMapper mapper = sqlSession.getMapper(SalarySobRangeMapper.class);
|
||||
mapper.updateEmployeeStatuses(item);
|
||||
sqlSession.commit();
|
||||
} finally {
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import com.engine.salary.entity.hrm.SubCompanyInfo;
|
|||
import com.engine.salary.entity.salarysob.dto.SalarySobRangeListDTO;
|
||||
import com.engine.salary.entity.salarysob.param.SalarySobRangeEmpQueryParam;
|
||||
import com.engine.salary.entity.salarysob.po.SalarySobRangePO;
|
||||
import com.engine.salary.enums.UserStatusEnum;
|
||||
import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum;
|
||||
import com.engine.salary.enums.salarysob.TargetTypeEnum;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
|
|
@ -39,33 +38,55 @@ 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())) {
|
||||
employeeStatus = Collections.emptyList();
|
||||
List<SalarySobRangeEmpQueryParam> resultParams = Lists.newArrayListWithExpectedSize(salarySobRanges.size());
|
||||
salarySobRanges.stream().forEach( item -> {
|
||||
List<String> employeeStatus= new ArrayList<>();
|
||||
String[] split = item.getEmployeeStatuses().split(",");
|
||||
List<Integer> enumsList = Arrays.asList(split).stream().map(i-> Integer.valueOf(i)).collect(Collectors.toList());
|
||||
List<SalaryEmployeeStatusEnum> salaryEmployeeStatusEnums = SalaryEmployeeStatusEnum.parseByValues(enumsList);
|
||||
for(SalaryEmployeeStatusEnum e: salaryEmployeeStatusEnums){
|
||||
employeeStatus.add(e.getValue().toString());
|
||||
}
|
||||
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);
|
||||
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(Arrays.asList(item.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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -92,7 +113,8 @@ public class SalarySobRangeBO {
|
|||
return salarySobRanges.stream()
|
||||
.map(salarySobRangePO -> {
|
||||
TargetTypeEnum targetTypeEnum = TargetTypeEnum.parseByValue(salarySobRangePO.getTargetType());
|
||||
SalaryEmployeeStatusEnum salaryEmployeeStatusEnum = SalaryEmployeeStatusEnum.parseByValue(salarySobRangePO.getEmployeeStatus());
|
||||
|
||||
String employeeStatusesStr = parseByEmployeeStatuses(salarySobRangePO.getEmployeeStatuses());
|
||||
return SalarySobRangeListDTO.builder()
|
||||
.id(salarySobRangePO.getId())
|
||||
.salarySobId(salarySobRangePO.getSalarySobId())
|
||||
|
|
@ -102,14 +124,31 @@ public class SalarySobRangeBO {
|
|||
.orElse(StringUtils.EMPTY))
|
||||
.targetId(salarySobRangePO.getTargetId())
|
||||
.targetName(buildTargetName(salarySobRangePO, employeeComInfoMap, departmentComInfoMap, subCompanyComInfoMap,positionComInfoMap))
|
||||
.employeeStatus(Optional.ofNullable(salaryEmployeeStatusEnum)
|
||||
.map(e -> SalaryI18nUtil.getI18nLabel(e.getLabelId(), e.getDefaultLabel()))
|
||||
.orElse(StringUtils.EMPTY))
|
||||
.employeeStatus(employeeStatusesStr)
|
||||
.build();
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换employeeStatuses
|
||||
* @param employeeStatuses
|
||||
* @return
|
||||
*/
|
||||
private static String parseByEmployeeStatuses(String employeeStatuses) {
|
||||
String[] split = employeeStatuses.split(",");
|
||||
List<Integer> enumsList = Arrays.asList(split).stream().map(item-> Integer.valueOf(item)).collect(Collectors.toList());
|
||||
List<SalaryEmployeeStatusEnum> salaryEmployeeStatusEnums = SalaryEmployeeStatusEnum.parseByValues(enumsList);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for(int i=0 ; i<salaryEmployeeStatusEnums.size();i++){
|
||||
sb.append(salaryEmployeeStatusEnums.get(i).getDefaultLabel());
|
||||
if(i+1!=salaryEmployeeStatusEnums.size()){
|
||||
sb.append(",");
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析薪资账套人员范围中对象的名称(可能是人员名称、部门名称、岗位名称……)
|
||||
*
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.engine.salary.entity.salarysob.bo;
|
|||
import com.engine.salary.constant.SalaryDefaultTenantConstant;
|
||||
import com.engine.salary.entity.salarysob.param.SalarySobRangeSaveParam;
|
||||
import com.engine.salary.entity.salarysob.po.SalarySobRangePO;
|
||||
import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
|
@ -48,7 +49,8 @@ public class SalarySobRangeSaveBO {
|
|||
String key = saveParam.getIncludeType() + "-" + targetParam.getTargetType().getValue() + "-" + targetParam.getTargetId();
|
||||
if (salarySobRangeMap.containsKey(key)) {
|
||||
SalarySobRangePO salarySobRangePO = salarySobRangeMap.get(key);
|
||||
salarySobRangePO.setEmployeeStatus(saveParam.getEmployeeStatus().getValue());
|
||||
salarySobRangePO.setEmployeeStatuses(parseEnumListToStr(saveParam.getEmployeeStatus()));
|
||||
// salarySobRangePO.setEmployeeStatus(saveParam.getEmployeeStatus().getValue());
|
||||
salarySobRangePO.setUpdateTime(now);
|
||||
handleResult.getNeedUpdateSalarySobRanges().add(salarySobRangePO);
|
||||
continue;
|
||||
|
|
@ -57,7 +59,8 @@ public class SalarySobRangeSaveBO {
|
|||
.salarySobId(saveParam.getSalarySobId())
|
||||
.targetType(targetParam.getTargetType().getValue())
|
||||
.targetId(targetParam.getTargetId())
|
||||
.employeeStatus(saveParam.getEmployeeStatus().getValue())
|
||||
.employeeStatuses(parseEnumListToStr(saveParam.getEmployeeStatus()))
|
||||
// .employeeStatus(saveParam.getEmployeeStatus().getValue())
|
||||
.includeType(saveParam.getIncludeType())
|
||||
.creator(employeeId)
|
||||
.createTime(now)
|
||||
|
|
@ -86,4 +89,16 @@ public class SalarySobRangeSaveBO {
|
|||
*/
|
||||
private Collection<SalarySobRangePO> needInsertSalarySobRanges;
|
||||
}
|
||||
|
||||
public static String parseEnumListToStr(SalaryEmployeeStatusEnum[] salaryEmployeeStatusEnums){
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for(int i=0;i<salaryEmployeeStatusEnums.length;i++){
|
||||
sb.append(salaryEmployeeStatusEnums[i].getValue().toString());
|
||||
if(i+1 != salaryEmployeeStatusEnums.length){
|
||||
sb.append(",");
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public class SalarySobRangeSaveParam {
|
|||
|
||||
//员工状态
|
||||
@DataCheck(require = true, message = "员工状态不允许为空")
|
||||
private SalaryEmployeeStatusEnum employeeStatus;
|
||||
private SalaryEmployeeStatusEnum[] employeeStatus;
|
||||
|
||||
@Data
|
||||
//薪资账套人员范围保存参数中的对象
|
||||
|
|
|
|||
|
|
@ -52,6 +52,12 @@ public class SalarySobRangePO {
|
|||
*/
|
||||
private Integer employeeStatus;
|
||||
|
||||
/**
|
||||
* 人员状态使用逗号分隔
|
||||
* @see SalaryEmployeeStatusEnum
|
||||
*/
|
||||
private String employeeStatuses;
|
||||
|
||||
/**
|
||||
* 是包含还是排除 0:排除、1:包含
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -84,6 +84,15 @@ public enum UserStatusEnum implements BaseEnum {
|
|||
return Arrays.asList(FIRE.getValue().toString(), DEPARTURE.getValue().toString(), RETIRED.getValue().toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* 全部状态
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static List<String> getAllStatus() {
|
||||
return Arrays.asList(TRIAL.getValue().toString(), FORMAL.getValue().toString(), TEMPORARY.getValue().toString(), DELAY.getValue().toString(),FIRE.getValue().toString(), DEPARTURE.getValue().toString(), RETIRED.getValue().toString());
|
||||
}
|
||||
|
||||
public static List<UserStatusEnum> getEffectiveList() {
|
||||
return Arrays.stream(UserStatusEnum.values()).filter(v -> v != INVALID).collect(Collectors.toList());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
@ -15,11 +17,26 @@ import java.util.Objects;
|
|||
**/
|
||||
public enum SalaryEmployeeStatusEnum implements BaseEnum<Integer> {
|
||||
|
||||
ALL(0, "全部", 85155),
|
||||
//在职,对应人力资源表中状态,试用0,正式1,临时2,试用延期3
|
||||
NORMAL(1, "在职", 100120),
|
||||
//离职,对应人力资源表中状态,解雇4,离职5,退休6
|
||||
UNAVAILABLE(2, "离职", 85902),
|
||||
// ALL(10, "全部", 85155),
|
||||
// //在职,对应人力资源表中状态,试用0,正式1,临时2,试用延期3
|
||||
// NORMAL(1, "试用,正式,临时,临时延期", 100120),
|
||||
// //离职老,对应人力资源表中状态,解雇4,离职5,退休6
|
||||
// UNAVAILABLE(2, "解雇,离职,退休", 85902),
|
||||
|
||||
|
||||
TRIAL(0, "试用", 100121),
|
||||
|
||||
FORMAL(1, "正式", 100122),
|
||||
|
||||
TEMPORARY(2, "临时", 100123),
|
||||
|
||||
DELAY(3, "试用延期", 100124),
|
||||
|
||||
FIRE(4, "解雇", 100125),
|
||||
|
||||
DEPARTURE(5, "离职", 100126),
|
||||
|
||||
RETIRED(6, "退休", 100127),
|
||||
;
|
||||
|
||||
private int value;
|
||||
|
|
@ -57,4 +74,17 @@ 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>
|
||||
|
|
|
|||
|
|
@ -85,4 +85,9 @@ public interface SalarySobRangeMapper {
|
|||
*/
|
||||
List<Long> listEmployeeIds(@Param("params") Collection<SalarySobRangeEmpQueryParam> params);
|
||||
|
||||
/**
|
||||
* 更新人员状态使用逗号分割
|
||||
* @param item
|
||||
*/
|
||||
void updateEmployeeStatuses(@Param("param") SalarySobRangePO item);
|
||||
}
|
||||
|
|
@ -30,6 +30,7 @@
|
|||
, t.update_time
|
||||
, t.delete_type
|
||||
, t.tenant_key
|
||||
, t.employee_statuses
|
||||
</sql>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
|
|
@ -324,7 +325,7 @@
|
|||
|
||||
<insert id="batchInsert">
|
||||
INSERT INTO hrsa_salary_sob_range(salary_sob_id, target_type, target_id, employee_status, include_type,
|
||||
creator, create_time, update_time, delete_type, tenant_key)
|
||||
creator, create_time, update_time, delete_type, tenant_key,employee_statuses)
|
||||
VALUES
|
||||
<foreach collection="collection" item="item" separator=",">
|
||||
(
|
||||
|
|
@ -337,13 +338,14 @@
|
|||
#{item.createTime},
|
||||
#{item.updateTime},
|
||||
#{item.deleteType},
|
||||
#{item.tenantKey}
|
||||
#{item.tenantKey},
|
||||
#{item.employeeStatuses}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="batchInsert" databaseId="oracle">
|
||||
INSERT INTO hrsa_salary_sob_range(salary_sob_id, target_type, target_id, employee_status, include_type,
|
||||
creator, create_time, update_time, delete_type, tenant_key)
|
||||
creator, create_time, update_time, delete_type, tenant_key,employee_statuses)
|
||||
|
||||
<foreach collection="collection" item="item" separator="union all">
|
||||
select
|
||||
|
|
@ -356,14 +358,15 @@
|
|||
#{item.createTime,jdbcType=DATE},
|
||||
#{item.updateTime,jdbcType=DATE},
|
||||
#{item.deleteType,jdbcType=INTEGER},
|
||||
#{item.tenantKey,jdbcType=VARCHAR}
|
||||
#{item.tenantKey,jdbcType=VARCHAR},
|
||||
#{item.employeeStatuses,jdbcType=VARCHAR}
|
||||
from dual
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="batchInsert" databaseId="sqlserver">
|
||||
<foreach collection="collection" item="item" separator=";">
|
||||
INSERT INTO hrsa_salary_sob_range( salary_sob_id, target_type, target_id, employee_status, include_type,
|
||||
creator, create_time, update_time, delete_type, tenant_key)
|
||||
creator, create_time, update_time, delete_type, tenant_key,employee_statuses)
|
||||
VALUES
|
||||
(
|
||||
#{item.salarySobId},
|
||||
|
|
@ -375,7 +378,8 @@
|
|||
#{item.createTime},
|
||||
#{item.updateTime},
|
||||
#{item.deleteType},
|
||||
#{item.tenantKey}
|
||||
#{item.tenantKey},
|
||||
#{item.employeeStatuses}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
|
@ -399,6 +403,10 @@
|
|||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="updateEmployeeStatuses">
|
||||
UPDATE hrsa_salary_sob_range set employee_statuses = #{param.employeeStatuses} WHERE id = #{param.id}
|
||||
</update>
|
||||
|
||||
<select id="listEmployeeIds" resultType="long">
|
||||
SELECT id FROM hrmresource em
|
||||
WHERE em.status not in (7)
|
||||
|
|
|
|||
|
|
@ -36,6 +36,14 @@ public interface SalarySobRangeService {
|
|||
*/
|
||||
List<SalarySobRangePO> listBySalarySobIdAndIncludeType(Long salarySobId, Integer includeType);
|
||||
|
||||
/***
|
||||
* @description 获取所有的薪资账套的人员范围
|
||||
* @return List<SalarySangePO>
|
||||
* @author Harryxzy
|
||||
* @date 2022/10/8 16:12
|
||||
*/
|
||||
List<SalarySobRangePO> listAllSalarySobRange();
|
||||
|
||||
/**
|
||||
* 根据查询条件查询薪资账套的人员范围
|
||||
*
|
||||
|
|
@ -65,4 +73,10 @@ public interface SalarySobRangeService {
|
|||
* @param salarySobIds 薪资账套id
|
||||
*/
|
||||
void deleteBySalarySobIds(Collection<Long> salarySobIds);
|
||||
|
||||
/**
|
||||
* 更新人员状态从status中存到statuses中
|
||||
* @param item
|
||||
*/
|
||||
void updateEmployeeStatuses(SalarySobRangePO item);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,6 +69,11 @@ public class SalarySobRangeServiceImpl extends Service implements SalarySobRange
|
|||
return salarySobRangeBiz.listSome(SalarySobRangePO.builder().salarySobId(salarySobId).includeType(includeType).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SalarySobRangePO> listAllSalarySobRange() {
|
||||
return salarySobRangeBiz.listSome(SalarySobRangePO.builder().build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<SalarySobRangeListDTO> listPageByParamAndIncludeType(SalarySobRangeQueryParam queryParam, Integer includeType) {
|
||||
// 查询人员范围
|
||||
|
|
@ -190,4 +195,9 @@ public class SalarySobRangeServiceImpl extends Service implements SalarySobRange
|
|||
public void deleteBySalarySobIds(Collection<Long> salarySobIds) {
|
||||
salarySobRangeBiz.deleteBySalarySobIds(salarySobIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEmployeeStatuses(SalarySobRangePO item) {
|
||||
salarySobRangeBiz.updateEmployeeStatuses(item);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
||||
|
|
|
|||
|
|
@ -159,11 +159,12 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM
|
|||
List<String> personnelStatuss = Lists.newArrayList();
|
||||
if (employeeStatus != null) {
|
||||
// 查询人员状态
|
||||
if (employeeStatus.equals(SalaryEmployeeStatusEnum.NORMAL)) {
|
||||
personnelStatuss = UserStatusEnum.getNormalStatus();
|
||||
} else if (employeeStatus.equals(SalaryEmployeeStatusEnum.UNAVAILABLE)) {
|
||||
personnelStatuss = UserStatusEnum.getUnavailableStatus();
|
||||
}
|
||||
// if (employeeStatus.equals(SalaryEmployeeStatusEnum.NORMAL)) {
|
||||
// personnelStatuss = UserStatusEnum.getNormalStatus();
|
||||
// } else if (employeeStatus.equals(SalaryEmployeeStatusEnum.UNAVAILABLE)) {
|
||||
// personnelStatuss = UserStatusEnum.getUnavailableStatus();
|
||||
// }
|
||||
personnelStatuss.add(employeeStatus.getValue().toString());
|
||||
}
|
||||
// 根据上一步的查询参数查询人员
|
||||
includeSalaryEmployees = listSalaryEmployeeByManageRange(includeTaxAgentManageRanges, personnelStatuss);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import com.engine.salary.entity.taxagent.param.TaxAgentAdminChangeCheckParam;
|
|||
import com.engine.salary.entity.taxagent.param.TaxAgentQueryParam;
|
||||
import com.engine.salary.entity.taxagent.param.TaxAgentSaveParam;
|
||||
import com.engine.salary.entity.taxagent.po.*;
|
||||
import com.engine.salary.enums.UserStatusEnum;
|
||||
import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum;
|
||||
import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum;
|
||||
import com.engine.salary.enums.taxagent.TaxAgentRoleTypeEnum;
|
||||
|
|
@ -599,11 +598,11 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService {
|
|||
if (employeeStatus != null) {
|
||||
List<String> personnelStatusList;
|
||||
// 查询人员状态
|
||||
if (employeeStatus.equals(SalaryEmployeeStatusEnum.NORMAL)) {
|
||||
allEmployees = allEmployees.stream().filter(f -> UserStatusEnum.getNormalStatus().contains(f.getStatus())).collect(Collectors.toList());
|
||||
} else if (employeeStatus.equals(SalaryEmployeeStatusEnum.UNAVAILABLE)) {
|
||||
allEmployees = allEmployees.stream().filter(f -> UserStatusEnum.getUnavailableStatus().contains(f.getStatus())).collect(Collectors.toList());
|
||||
}
|
||||
// if (employeeStatus.equals(SalaryEmployeeStatusEnum.NORMAL)) {
|
||||
// allEmployees = allEmployees.stream().filter(f -> UserStatusEnum.getNormalStatus().contains(f.getStatus())).collect(Collectors.toList());
|
||||
// } else if (employeeStatus.equals(SalaryEmployeeStatusEnum.UNAVAILABLE)) {
|
||||
// allEmployees = allEmployees.stream().filter(f -> UserStatusEnum.getUnavailableStatus().contains(f.getStatus())).collect(Collectors.toList());
|
||||
// }
|
||||
}
|
||||
|
||||
// 是否开启分权
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
|||
import com.engine.salary.entity.taxagent.param.TaxAgentEmpSaveParam;
|
||||
import com.engine.salary.entity.taxagent.po.TaxAgentManageRangePO;
|
||||
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
|
||||
import com.engine.salary.enums.UserStatusEnum;
|
||||
import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum;
|
||||
import com.engine.salary.enums.salarysob.TargetTypeEnum;
|
||||
import com.engine.salary.enums.taxagent.TaxAgentRangeTypeEnum;
|
||||
|
|
@ -150,11 +149,12 @@ public class SyncTaxAgentEmpJob extends BaseCronJob {
|
|||
List<String> personnelStatuss = Lists.newArrayList();
|
||||
if (employeeStatus != null) {
|
||||
// 查询人员状态
|
||||
if (employeeStatus.equals(SalaryEmployeeStatusEnum.NORMAL)) {
|
||||
personnelStatuss = UserStatusEnum.getNormalStatus();
|
||||
} else if (employeeStatus.equals(SalaryEmployeeStatusEnum.UNAVAILABLE)) {
|
||||
personnelStatuss = UserStatusEnum.getUnavailableStatus();
|
||||
}
|
||||
// if (employeeStatus.equals(SalaryEmployeeStatusEnum.NORMAL)) {
|
||||
// personnelStatuss = UserStatusEnum.getNormalStatus();
|
||||
// } else if (employeeStatus.equals(SalaryEmployeeStatusEnum.UNAVAILABLE)) {
|
||||
// personnelStatuss = UserStatusEnum.getUnavailableStatus();
|
||||
// }
|
||||
personnelStatuss.add(employeeStatus.getValue().toString());
|
||||
}
|
||||
// 根据上一步的查询参数查询人员
|
||||
includeSalaryEmployees = listSalaryEmployeeByManageRange(includeTaxAgentManageRanges, personnelStatuss);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,55 @@
|
|||
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 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(salarySobRangePOS != null){
|
||||
// 判断是否已经转换过
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -23,6 +23,7 @@ import com.engine.salary.service.impl.SalarySobServiceImpl;
|
|||
import com.engine.salary.util.SalaryDateUtil;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
import com.engine.salary.util.SalarySobUtil;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import com.engine.salary.wrapper.proxy.SalaryAcctRecordWrapperProxy;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
|
|
@ -56,6 +57,10 @@ public class SalaryAcctRecordWrapper extends Service implements SalaryAcctRecord
|
|||
// private ComInfoCache comInfoCache;
|
||||
|
||||
public PageInfo<SalaryAcctRecordListDTO> listPage(SalaryAcctRecordQueryParam queryParam) {
|
||||
|
||||
// 处理历史数据将薪资账套中将关联人员状态转换为List
|
||||
SalarySobUtil.handleEmployeeStatusHistory();
|
||||
|
||||
EmployBiz employBiz = new EmployBiz();
|
||||
// 查询薪资核算记录(分页)
|
||||
PageInfo<SalaryAcctRecordPO> page = getSalaryAcctRecordService(user).listPageByParam(queryParam);
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import com.engine.salary.service.impl.SalarySobServiceImpl;
|
|||
import com.engine.salary.service.impl.TaxAgentServiceImpl;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
import com.engine.salary.util.SalarySobUtil;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import weaver.hrm.User;
|
||||
|
||||
|
|
@ -51,6 +52,9 @@ public class SalarySobWrapper extends Service {
|
|||
*/
|
||||
public PageInfo<SalarySobListDTO> listPage(SalarySobListQueryParam queryParam) {
|
||||
|
||||
// 处理历史数据将薪资账套中将关联人员状态转换为List
|
||||
SalarySobUtil.handleEmployeeStatusHistory();
|
||||
|
||||
// 查询薪资账套
|
||||
PageInfo<SalarySobPO> page = getSalarySobService(user).listPageByParam(queryParam);
|
||||
// 薪资账套po转换成薪资账套列表dto
|
||||
|
|
|
|||
Loading…
Reference in New Issue