|
|
@@ -19,6 +19,7 @@ import kd.sdk.swc.hcdm.common.dto.stdtab.match.StdTableDataMatchResult;
|
|
|
import nckd.jxccl.base.common.constant.FormConstant;
|
|
|
import nckd.jxccl.base.common.enums.psms.TypeStateEnum;
|
|
|
import nckd.jxccl.base.common.utils.QueryFieldBuilder;
|
|
|
+import nckd.jxccl.base.entity.helper.EntityHelper;
|
|
|
import nckd.jxccl.base.swc.helper.AdjFileServiceHelper;
|
|
|
import nckd.jxccl.hr.psms.common.PositionStructureConstant;
|
|
|
|
|
|
@@ -29,7 +30,6 @@ import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
-import java.util.stream.Stream;
|
|
|
|
|
|
/**
|
|
|
* 员工职位档案-保存
|
|
|
@@ -70,90 +70,95 @@ public class PersonPosFileSaveOpPlugin extends AbstractOperationServicePlugIn im
|
|
|
}
|
|
|
|
|
|
//====================================== 获取当前人员所在定调的岗位标准工资一档金额 begin ======================================
|
|
|
- Map<Long, BigDecimal> amountMap = new HashMap<>(e.getDataEntities().length);
|
|
|
- if(!allPersonIds.isEmpty() && !jobLevelIds.isEmpty()) {
|
|
|
- //获取人员最新岗位工资标准定薪记录
|
|
|
- List<AdjFileServiceHelper.SalaryAdjustmentResult> salaryAdjustmentResultList = AdjFileServiceHelper.getLastDecAdjRecords(allPersonIds, FormConstant.STANDARDITEM_ID_KEY);
|
|
|
- if (!salaryAdjustmentResultList.isEmpty()) {
|
|
|
- //薪酬标准ID
|
|
|
- List<Long> salaryStIds = salaryAdjustmentResultList.stream().map(result -> result.salaryStDv.getLong(FormConstant.ID_KEY)).collect(Collectors.toList());
|
|
|
- QFilter filter = new QFilter(FormConstant.ID_KEY, QCP.in, salaryStIds)
|
|
|
- .and(String.join(".", "rankentry", "rank", FormConstant.NUMBER_KEY), QCP.equals, "01");
|
|
|
- //获取标准表中01档的薪档
|
|
|
- QueryFieldBuilder salaryStandFieldBuilder = QueryFieldBuilder.create()
|
|
|
- .add(FormConstant.ID_KEY)
|
|
|
- .addIdNumberNameWithExtras(new String[]{"rankentry", "rank"},FormConstant.INDEX_KEY);
|
|
|
- DynamicObjectCollection salaryStandardColl = QueryServiceHelper.query("hcdm_salarystandard", salaryStandFieldBuilder.buildSelect(), new QFilter[]{filter});
|
|
|
- Map<Long, DynamicObject> salaryStandardMap = salaryStandardColl.stream()
|
|
|
- .collect(Collectors.toMap(
|
|
|
- obj -> obj.getLong(FormConstant.ID_KEY),
|
|
|
- obj -> obj
|
|
|
- ));
|
|
|
+ try {
|
|
|
+ Long salaryItemId = EntityHelper.getIdByNumber(FormConstant.HSBS_STANDARDITEM, FormConstant.POS_STANDARD_ITEM_NUMBER);
|
|
|
+ Map<Long, BigDecimal> amountMap = new HashMap<>(e.getDataEntities().length);
|
|
|
+ if (!allPersonIds.isEmpty() && !jobLevelIds.isEmpty()) {
|
|
|
+ //获取人员最新岗位工资标准定薪记录
|
|
|
+ List<AdjFileServiceHelper.SalaryAdjustmentResult> salaryAdjustmentResultList = AdjFileServiceHelper.getLastDecAdjRecords(allPersonIds, FormConstant.POS_STANDARD_ITEM_NUMBER);
|
|
|
+ if (!salaryAdjustmentResultList.isEmpty()) {
|
|
|
+ //薪酬标准ID
|
|
|
+ List<Long> salaryStIds = salaryAdjustmentResultList.stream().map(result -> result.salaryStDv.getLong(FormConstant.ID_KEY)).collect(Collectors.toList());
|
|
|
+ QFilter filter = new QFilter(FormConstant.ID_KEY, QCP.in, salaryStIds)
|
|
|
+ .and(String.join(".", "rankentry", "rank", FormConstant.NUMBER_KEY), QCP.equals, "01");
|
|
|
+ //获取标准表中01档的薪档
|
|
|
+ QueryFieldBuilder salaryStandFieldBuilder = QueryFieldBuilder.create()
|
|
|
+ .add(FormConstant.ID_KEY)
|
|
|
+ .addIdNumberNameWithExtras(new String[]{"rankentry", "rank"}, FormConstant.INDEX_KEY);
|
|
|
+ DynamicObjectCollection salaryStandardColl = QueryServiceHelper.query("hcdm_salarystandard", salaryStandFieldBuilder.buildSelect(), new QFilter[]{filter});
|
|
|
+ Map<Long, DynamicObject> salaryStandardMap = salaryStandardColl.stream()
|
|
|
+ .collect(Collectors.toMap(
|
|
|
+ obj -> obj.getLong(FormConstant.ID_KEY),
|
|
|
+ obj -> obj
|
|
|
+ ));
|
|
|
|
|
|
- if (!salaryStandardMap.isEmpty()) {
|
|
|
- List<StdTableDataMatchParam> matchParams = new ArrayList<>();
|
|
|
- for (AdjFileServiceHelper.SalaryAdjustmentResult result : salaryAdjustmentResultList) {
|
|
|
- StdTableDataMatchParam stdTableDataMatchParam = new StdTableDataMatchParam();
|
|
|
- stdTableDataMatchParam.setStdTableId(result.salaryStDv.getLong(FormConstant.ID_KEY));
|
|
|
- stdTableDataMatchParam.setStdItemId(FormConstant.STANDARDITEM_ID_KEY);
|
|
|
- stdTableDataMatchParam.setGradeId(result.salaryGrade.getLong(FormConstant.ID_KEY));
|
|
|
- DynamicObject dynamicObject = salaryStandardMap.get(result.salaryStDv.getLong(FormConstant.ID_KEY));
|
|
|
- if(dynamicObject != null) {
|
|
|
- long rankId = dynamicObject.getLong(String.join(".", "rankentry", "rank", FormConstant.ID_KEY));
|
|
|
- stdTableDataMatchParam.setRankId(rankId);
|
|
|
- matchParams.add(stdTableDataMatchParam);
|
|
|
+ if (!salaryStandardMap.isEmpty()) {
|
|
|
+ List<StdTableDataMatchParam> matchParams = new ArrayList<>();
|
|
|
+ for (AdjFileServiceHelper.SalaryAdjustmentResult result : salaryAdjustmentResultList) {
|
|
|
+ StdTableDataMatchParam stdTableDataMatchParam = new StdTableDataMatchParam();
|
|
|
+ stdTableDataMatchParam.setStdTableId(result.salaryStDv.getLong(FormConstant.ID_KEY));
|
|
|
+ stdTableDataMatchParam.setStdItemId(salaryItemId);
|
|
|
+ stdTableDataMatchParam.setGradeId(result.salaryGrade.getLong(FormConstant.ID_KEY));
|
|
|
+ DynamicObject dynamicObject = salaryStandardMap.get(result.salaryStDv.getLong(FormConstant.ID_KEY));
|
|
|
+ if (dynamicObject != null) {
|
|
|
+ long rankId = dynamicObject.getLong(String.join(".", "rankentry", "rank", FormConstant.ID_KEY));
|
|
|
+ stdTableDataMatchParam.setRankId(rankId);
|
|
|
+ matchParams.add(stdTableDataMatchParam);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- if(!matchParams.isEmpty()) {
|
|
|
- //获取薪酬项目、薪等、薪档对应金额(入参params的数组下标和出参的数组下标一一对应)
|
|
|
- List<StdTableDataMatchResult> stdTableDataMatchResults = HCDMSalaryStdServiceHelper.matchStdTableData(matchParams);
|
|
|
- for (int i = 0; i < salaryAdjustmentResultList.size(); i++) {
|
|
|
- AdjFileServiceHelper.SalaryAdjustmentResult result = salaryAdjustmentResultList.get(i);
|
|
|
- if (i < stdTableDataMatchResults.size() && stdTableDataMatchResults.get(i) != null) {
|
|
|
- //当前薪等01档的金额
|
|
|
- amountMap.put(result.employee.getLong(FormConstant.ID_KEY), stdTableDataMatchResults.get(i).getAmount());
|
|
|
+ if (!matchParams.isEmpty()) {
|
|
|
+ //获取薪酬项目、薪等、薪档对应金额(入参params的数组下标和出参的数组下标一一对应)
|
|
|
+ List<StdTableDataMatchResult> stdTableDataMatchResults = HCDMSalaryStdServiceHelper.matchStdTableData(matchParams);
|
|
|
+ for (int i = 0; i < salaryAdjustmentResultList.size(); i++) {
|
|
|
+ AdjFileServiceHelper.SalaryAdjustmentResult result = salaryAdjustmentResultList.get(i);
|
|
|
+ if (i < stdTableDataMatchResults.size() && stdTableDataMatchResults.get(i) != null) {
|
|
|
+ //当前薪等01档的金额
|
|
|
+ amountMap.put(result.employee.getLong(FormConstant.ID_KEY), stdTableDataMatchResults.get(i).getAmount());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ } else {
|
|
|
+ logger.warn("未获取薪酬标准表中01档的薪档数据,薪酬标准ID:{}", salaryStIds);
|
|
|
}
|
|
|
} else {
|
|
|
- logger.warn("未获取薪酬标准表中01档的薪档数据,薪酬标准ID:{}",salaryStIds);
|
|
|
+ logger.warn("未获取到人员岗位工资标准定薪记录,人员ID:{}", allPersonIds);
|
|
|
}
|
|
|
- } else {
|
|
|
- logger.warn("未获取到人员岗位工资标准定薪记录,人员ID:{}",allPersonIds);
|
|
|
}
|
|
|
- }
|
|
|
- //====================================== 获取当前人员所在定调的岗位标准工资一档金额 end ======================================
|
|
|
- Map<Long, DynamicObject> jobLevelMap = new HashMap<>(e.getDataEntities().length);
|
|
|
- if(!jobLevelIds.isEmpty()) {
|
|
|
- MainEntityType jobLevelEntityType = EntityMetadataCache.getDataEntityType(FormConstant.HBJM_JOBLEVELHR);
|
|
|
- //重新加载职级信息,避免获取不到系数
|
|
|
- DynamicObject[] load = BusinessDataServiceHelper.load(jobLevelIds.toArray(new Long[0]), jobLevelEntityType);
|
|
|
- jobLevelMap = Arrays.stream(load)
|
|
|
- .collect(Collectors.toMap(
|
|
|
- obj -> obj.getLong(FormConstant.ID_KEY),
|
|
|
- obj -> obj
|
|
|
- ));
|
|
|
- }
|
|
|
+ //====================================== 获取当前人员所在定调的岗位标准工资一档金额 end ======================================
|
|
|
+ Map<Long, DynamicObject> jobLevelMap = new HashMap<>(e.getDataEntities().length);
|
|
|
+ if (!jobLevelIds.isEmpty()) {
|
|
|
+ MainEntityType jobLevelEntityType = EntityMetadataCache.getDataEntityType(FormConstant.HBJM_JOBLEVELHR);
|
|
|
+ //重新加载职级信息,避免获取不到系数
|
|
|
+ DynamicObject[] load = BusinessDataServiceHelper.load(jobLevelIds.toArray(new Long[0]), jobLevelEntityType);
|
|
|
+ jobLevelMap = Arrays.stream(load)
|
|
|
+ .collect(Collectors.toMap(
|
|
|
+ obj -> obj.getLong(FormConstant.ID_KEY),
|
|
|
+ obj -> obj
|
|
|
+ ));
|
|
|
+ }
|
|
|
|
|
|
- for (DynamicObject dataEntity : e.getDataEntities()) {
|
|
|
- long jobLevelId = dataEntity.getLong(String.join(".", PositionStructureConstant.NCKD_JOBLEVELHR, FormConstant.ID_KEY));
|
|
|
- DynamicObject jobLevel = jobLevelMap.get(jobLevelId);
|
|
|
- if(jobLevel != null){
|
|
|
- DynamicObject person = dataEntity.getDynamicObject(FormConstant.NCKD_PERSON);
|
|
|
- long personId = person.getLong(FormConstant.ID_KEY);
|
|
|
- //当前岗位工资01档金额
|
|
|
- BigDecimal amount = amountMap.get(personId);
|
|
|
- if (amount != null && amount.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
- BigDecimal coefficient = jobLevel.getBigDecimal(PositionStructureConstant.NCKD_COEFFICIENT);
|
|
|
- if(coefficient.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
- dataEntity.set(PositionStructureConstant.NCKD_COEFFICIENT, coefficient);
|
|
|
- dataEntity.set(PositionStructureConstant.NCKD_CURRENTPOSTSALARY, amount);
|
|
|
- dataEntity.set(PositionStructureConstant.NCKD_POSTALLOWANCE, coefficient.multiply(amount));
|
|
|
+ for (DynamicObject dataEntity : e.getDataEntities()) {
|
|
|
+ long jobLevelId = dataEntity.getLong(String.join(".", PositionStructureConstant.NCKD_JOBLEVELHR, FormConstant.ID_KEY));
|
|
|
+ DynamicObject jobLevel = jobLevelMap.get(jobLevelId);
|
|
|
+ if (jobLevel != null) {
|
|
|
+ DynamicObject person = dataEntity.getDynamicObject(FormConstant.NCKD_PERSON);
|
|
|
+ long personId = person.getLong(FormConstant.ID_KEY);
|
|
|
+ //当前岗位工资01档金额
|
|
|
+ BigDecimal amount = amountMap.get(personId);
|
|
|
+ if (amount != null && amount.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ BigDecimal coefficient = jobLevel.getBigDecimal(PositionStructureConstant.NCKD_COEFFICIENT);
|
|
|
+ if (coefficient.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ dataEntity.set(PositionStructureConstant.NCKD_COEFFICIENT, coefficient);
|
|
|
+ dataEntity.set(PositionStructureConstant.NCKD_CURRENTPOSTSALARY, amount);
|
|
|
+ dataEntity.set(PositionStructureConstant.NCKD_POSTALLOWANCE, coefficient.multiply(amount));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ logger.warn("未获取到员工【{}】最新岗位工资标准定薪记录01档的薪等金额,人员ID:", person.getString(FormConstant.NAME_KEY));
|
|
|
}
|
|
|
- } else {
|
|
|
- logger.warn("未获取到员工【{}】最新岗位工资标准定薪记录01档的薪等金额,人员ID:", person.getString(FormConstant.NAME_KEY));
|
|
|
}
|
|
|
}
|
|
|
+ }catch (Exception e1){
|
|
|
+ logger.error("获取人员岗位工资标准定薪记录01档的薪等金额异常",e1);
|
|
|
}
|
|
|
}
|
|
|
|