Jelajahi Sumber

feat(base): 添加实体标识常量和ID查询功能

- 新增多个实体标识常量包括定调薪类型、单据类型、国家、货币等
- 添加根据编码查询最新ID和普通ID的工具方法
- 修改调薪记录查询方法使用编码而非ID参数
- 在多个业务模块中使用新的ID查询方法替代硬编码ID
- 优化任职档案保存和薪酬推送任务中的ID获取逻辑
- 增加优秀员工查询功能和绩效考核相关查询逻辑
wyc 4 hari lalu
induk
melakukan
9d457b9079

+ 17 - 1
code/base/nckd-jxccl-base-common/src/main/java/nckd/jxccl/base/common/constant/FormConstant.java

@@ -91,6 +91,20 @@ public class FormConstant {
     public static final String HSAS_CALPERSON = "hsas_calperson";
     /** 定调薪类型  实体标识 */
     public static final String HSBS_SALARYADJUSTRSN = "hsbs_salaryadjustrsn";
+    /** 定调薪类型  实体标识 */
+    public static final String HSBS_SALARYITEM = "hsbs_salaryitem";
+    /** 单据类型  实体标识 */
+    public static final String BOS_BILLTYPE = "bos_billtype";
+    /** 国家  实体标识 */
+    public static final String BD_COUNTRY = "bd_country";
+    /** 国家  实体标识 */
+    public static final String BD_CURRENCY = "bd_currency";
+    /** 定调薪方案 实体标识 */
+    public static final String HCDM_ADJAPPROVESCM = "hcdm_adjapprovescm";
+    /** 汇率标 实体标识 */
+    public static final String BD_EXRATETABLE = "bd_exratetable";
+    /** 频度 实体标识 */
+    public static final String HSBS_CALFREQUENCY = "hsbs_calfrequency";
     /**
      * 定调薪类型 默认值  用于  定调薪清单处理
      * */
@@ -483,7 +497,9 @@ public class FormConstant {
 
 
     /** 岗位工资标准(jt002)*/
-    public static final Long STANDARDITEM_ID_KEY = 2321899710350111744L;
+    public static final String POS_STANDARD_ITEM_NUMBER = "jt002";
+    /** 员工调薪(console_20)*/
+    public static final String HCDM_APPLYBILL_BT_ADJ = "hcdm_applybill_BT_ADJ";
 
     /** 全职任职类型编码 */
     public static final String FULLSERVICE_NUMBER = "1010_S";

+ 84 - 0
code/base/nckd-jxccl-base-helper/src/main/java/nckd/jxccl/base/entity/helper/EntityHelper.java

@@ -1,16 +1,26 @@
 package nckd.jxccl.base.entity.helper;
 
+import com.google.common.collect.Lists;
 import kd.bos.common.enums.EnableEnum;
 import kd.bos.context.RequestContext;
 import kd.bos.dataentity.entity.DynamicObject;
+import kd.bos.dataentity.entity.DynamicObjectCollection;
 import kd.bos.entity.EntityMetadataCache;
 import kd.bos.entity.MainEntityType;
 import kd.bos.entity.constant.StatusEnum;
+import kd.bos.orm.query.QCP;
+import kd.bos.orm.query.QFilter;
 import kd.bos.servicehelper.BusinessDataServiceHelper;
+import kd.bos.servicehelper.QueryServiceHelper;
 import kd.bos.servicehelper.user.UserServiceHelper;
 import nckd.jxccl.base.common.constant.FormConstant;
+import nckd.jxccl.base.common.utils.QueryFieldBuilder;
+import nckd.jxccl.base.orm.helper.QFilterCommonHelper;
 
 import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * 实体(DynamicObject) 帮助类
@@ -75,4 +85,78 @@ public class EntityHelper {
         dynamicObject.set(FormConstant.ENABLE, EnableEnum.YES.getCode());
         return dynamicObject;
     }
+
+
+    /**
+     * 根据编码查询最新的id
+     * @param entityNumber
+     * @param number
+     */
+    public static Long getLatestIdByNumber(String entityNumber, String number) {
+        Map<String, Long> map = getLatestIdByNumber(entityNumber, Lists.newArrayList(number));
+        return !map.isEmpty() ? map.get(number) : null;
+    }
+
+    /**
+     * 根据编码查询最新的id
+     * @param entityNumber
+     * @param number
+     * @return
+     */
+    public static Map<String,Long> getLatestIdByNumber(String entityNumber, List<String> number) {
+        QFilter filter = new QFilter("number", QCP.in, number)
+                .and(QFilterCommonHelper.getCurrentVersionFilter())
+                .and(QFilterCommonHelper.getStatusFilter())
+                .and(QFilterCommonHelper.getEnableFilter());
+        QueryFieldBuilder queryFieldBuilder = QueryFieldBuilder.create()
+                .add(FormConstant.ID_KEY)
+                .add(FormConstant.NUMBER_KEY)
+                .add(FormConstant.MODIFY_TIME_KEY);
+        DynamicObjectCollection query = QueryServiceHelper.query(entityNumber, queryFieldBuilder.buildSelect(), new QFilter[]{filter});
+
+        // 按number分组,取每组的第一条(即最新的记录)
+        return query.stream()
+                .collect(Collectors.groupingBy(
+                        obj -> obj.getString(FormConstant.NUMBER_KEY)
+                ))
+                .entrySet()
+                .stream()
+                .collect(Collectors.toMap(
+                        Map.Entry::getKey,
+                        entry -> entry.getValue().get(0).getLong(FormConstant.ID_KEY) // 取每组第一条记录的ID
+                ));
+    }
+
+    /**
+     * 根据编码查询id
+     * @param entityNumber
+     * @param number
+     */
+    public static Long getIdByNumber(String entityNumber,String number) {
+        Map<String, Long> map = getIdByNumber(entityNumber, Lists.newArrayList(number));
+        return !map.isEmpty() ? map.get(number) : null;
+    }
+
+
+    /**
+     * 根据编码查询id
+     * @param entityNumber
+     * @param number
+     * @return
+     */
+    public static Map<String,Long> getIdByNumber(String entityNumber, List<String> number) {
+        QFilter filter = new QFilter("number", QCP.in, number)
+                .and(QFilterCommonHelper.getStatusFilter())
+                .and(QFilterCommonHelper.getEnableFilter());
+        QueryFieldBuilder queryFieldBuilder = QueryFieldBuilder.create().add(FormConstant.ID_KEY).add(FormConstant.NUMBER_KEY);
+        DynamicObjectCollection query = QueryServiceHelper.query(entityNumber, queryFieldBuilder.buildSelect(), new QFilter[]{filter});
+        return query.stream()
+                .collect(Collectors.toMap(
+                        obj -> obj.getString(FormConstant.NUMBER_KEY),  // key: number
+                        obj -> obj.getLong(FormConstant.ID_KEY)         // value: id
+                ));
+
+    }
+
+
 }

+ 5 - 4
code/base/nckd-jxccl-base-helper/src/main/java/nckd/jxccl/base/swc/helper/AdjFileServiceHelper.java

@@ -33,12 +33,13 @@ public class AdjFileServiceHelper {
     /**
      * 获取员工某个薪酬项目最新定调薪记录
      * @param personIds 人员id
-     * @param standardItemId 定调薪项目id
+     * @param standardItemNumber 定调薪项目编码
      * @return: java.util.List<nckd.jxccl.base.swc.helper.AdjFileServiceHelper.SalaryAdjustmentResult>
      * @author W.Y.C
      * @date: 2025/12/21 16:06
      */
-    public static List<SalaryAdjustmentResult> getLastDecAdjRecords(List<Long> personIds,Long standardItemId) {
+    public static List<SalaryAdjustmentResult> getLastDecAdjRecords(List<Long> personIds,String standardItemNumber) {
+        Long salaryItemId = EntityHelper.getIdByNumber(FormConstant.HSBS_STANDARDITEM, standardItemNumber);
         //获取员工最新任职
         Map<Long, DynamicObject> empPosOrgRelByEmployeesMap = EmpPosOrgRelHelper.queryEmpPosOrgRelByEmployeesMap(personIds);
         List<Long> allEmpPosOrgRelIds = empPosOrgRelByEmployeesMap.values().stream()
@@ -48,7 +49,7 @@ public class AdjFileServiceHelper {
         List<SalaryAdjustmentResult> salaryAdjustmentResultList = new ArrayList<>();
 
         DynamicObject standardItem = EntityHelper.newEntity(FormConstant.HSBS_STANDARDITEM);
-        standardItem.set(FormConstant.ID_KEY, standardItemId);
+        standardItem.set(FormConstant.ID_KEY, salaryItemId);
         Map<String, Object> adjFileParams = new HashMap<>();
         adjFileParams.put("employees", personIds);
         List<String> status = new ArrayList<>();
@@ -75,7 +76,7 @@ public class AdjFileServiceHelper {
                 // 调薪档案ID
                 dataItem.put("adjfile", adjFileId);
                 // 调薪项目ID
-                dataItem.put("standarditem", standardItemId);
+                dataItem.put("standarditem", salaryItemId);
                 // 查询基准日期
                 dataItem.put("startdate", new Date());
                 // 唯一标识

+ 1 - 0
code/base/nckd-jxccl-base-helper/src/main/java/nckd/jxccl/base/swc/helper/SWCHelper.java

@@ -1,5 +1,6 @@
 package nckd.jxccl.base.swc.helper;
 
+import com.google.common.collect.Lists;
 import kd.bos.dataentity.entity.DynamicObject;
 import kd.bos.dataentity.entity.DynamicObjectCollection;
 import kd.bos.entity.tree.TreeNode;

+ 17 - 16
code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/excells/plugin/operate/PushAdjustOpPlugin.java

@@ -1,25 +1,19 @@
 package nckd.jxccl.hr.excells.plugin.operate;
 
 import com.alibaba.fastjson.JSON;
-import kd.bos.dataentity.OperateOption;
 import kd.bos.dataentity.entity.DynamicObject;
 import kd.bos.dataentity.entity.DynamicObjectCollection;
-import kd.bos.dataentity.utils.ObjectUtils;
 import kd.bos.db.tx.TX;
 import kd.bos.db.tx.TXHandle;
 import kd.bos.entity.EntityMetadataCache;
 import kd.bos.entity.MainEntityType;
-import kd.bos.entity.operate.result.IOperateInfo;
-import kd.bos.entity.operate.result.OperationResult;
 import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
 import kd.bos.entity.plugin.AddValidatorsEventArgs;
 import kd.bos.entity.plugin.PreparePropertysEventArgs;
-import kd.bos.entity.plugin.args.AfterOperationArgs;
 import kd.bos.entity.plugin.args.BeginOperationTransactionArgs;
 import kd.bos.entity.validate.BillStatus;
 import kd.bos.logging.Log;
 import kd.bos.logging.LogFactory;
-import kd.bos.servicehelper.BusinessDataServiceHelper;
 import kd.bos.servicehelper.DispatchServiceHelper;
 import kd.bos.servicehelper.operation.SaveServiceHelper;
 import kd.sdk.plugin.Plugin;
@@ -29,9 +23,9 @@ import nckd.jxccl.base.common.exception.ValidationException;
 import nckd.jxccl.base.common.utils.ConvertUtil;
 import nckd.jxccl.base.common.utils.DateUtil;
 import nckd.jxccl.base.common.utils.StrFormatter;
+import nckd.jxccl.base.entity.helper.EntityHelper;
 import nckd.jxccl.base.hrpi.helper.EmpPosOrgRelHelper;
 import nckd.jxccl.hr.excells.common.ExcellsConstant;
-import nckd.jxccl.hr.hstu.common.HonorStudentConstant;
 import nckd.jxccl.hr.psms.common.PositionStructureConstant;
 
 import java.util.ArrayList;
@@ -39,7 +33,6 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.StringJoiner;
 import java.util.stream.Collectors;
 
 /**
@@ -65,6 +58,14 @@ public class PushAdjustOpPlugin extends AbstractOperationServicePlugIn implement
 
     @Override
     public void beginOperationTransaction(BeginOperationTransactionArgs e) {
+        Long salaryItemId = EntityHelper.getIdByNumber(FormConstant.HSBS_STANDARDITEM, "jt007");
+        Long billTypeId = EntityHelper.getIdByNumber(FormConstant.BOS_BILLTYPE, FormConstant.HCDM_APPLYBILL_BT_ADJ);
+        Long countryId = EntityHelper.getIdByNumber(FormConstant.BD_COUNTRY, "001");
+        Long salaryAdjuStrSnId = EntityHelper.getIdByNumber(FormConstant.HSBS_SALARYADJUSTRSN, "youxiusheng");
+        Long currencyId = EntityHelper.getIdByNumber(FormConstant.BD_CURRENCY, "CNY");
+        Long adjApproveScmId = EntityHelper.getLatestIdByNumber(FormConstant.HCDM_ADJAPPROVESCM, "dingtiaoxin");
+        Long exRateTableId = EntityHelper.getIdByNumber(FormConstant.BD_EXRATETABLE, "ERT-01");
+        Long calFrequencyId = EntityHelper.getIdByNumber(FormConstant.HSBS_CALFREQUENCY, "000_m_001");
 
         List<Long> ids = new ArrayList<>();
         List<Long> personIds = new ArrayList<>();
@@ -127,19 +128,19 @@ public class PushAdjustOpPlugin extends AbstractOperationServicePlugIn implement
                 applyBill.put("_uniquecode", data.getLong(FormConstant.ID_KEY));
                 applyBill.put("org", orgId);
                 //定调薪明细字段显示方案   调薪明细字段
-                applyBill.put("billtype", 2215975998602655744L);
+                applyBill.put("billtype", billTypeId);
                 //国家
-                applyBill.put("billcountry", 1000001L);
+                applyBill.put("billcountry", countryId);
                 //定调薪类型(优秀生津贴)
-                applyBill.put("salaryadjrsn", 2352338051369287680L);
+                applyBill.put("salaryadjrsn", salaryAdjuStrSnId);
                 //默认币种
-                applyBill.put("billcurrency", 1L);
+                applyBill.put("billcurrency", currencyId);
                 //定调薪方案
-                applyBill.put("salaryadjscm", 2322515162646457344L);
+                applyBill.put("salaryadjscm", adjApproveScmId);
                 //汇率日期
                 applyBill.put("exchangeratedate", new Date());
                 //汇率表
-                applyBill.put("exctable", 2321965096026258432L);
+                applyBill.put("exctable", exRateTableId);
                 //默认生效日期
                 applyBill.put("effectivedate", data.getDate(FormConstant.CREATE_TIME_KEY));
                 //草稿状态
@@ -155,8 +156,8 @@ public class PushAdjustOpPlugin extends AbstractOperationServicePlugIn implement
                 Map<String, Object> applyBillEntry = new HashMap<>();
                 applyBillEntry.put("adjfile", adjFileId);
                 applyBillEntry.put("employee", employeeId);
-                applyBillEntry.put("standarditem", 2321901326927149056L);    //定调薪项目
-                applyBillEntry.put("frequency", 1095454108284088320L);       //频度  月
+                applyBillEntry.put("standarditem", salaryItemId);    //定调薪项目
+                applyBillEntry.put("frequency", calFrequencyId);       //频度  月
                 applyBillEntry.put("amount", entity.getBigDecimal(FormConstant.NCKD_MONEY));
                 applyBillEntry.put("position", position.getLong(FormConstant.ID_KEY));
                 applyBillEntry.put("reason", entity.getString(ExcellsConstant.NCKD_DESC));

+ 51 - 8
code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/ijp/plugin/form/recgen/IntJobPostFormPlugin.java

@@ -9,16 +9,21 @@ import kd.bos.form.events.AfterDoOperationEventArgs;
 import kd.bos.form.plugin.AbstractFormPlugin;
 import kd.bos.orm.query.QCP;
 import kd.bos.orm.query.QFilter;
+import kd.bos.servicehelper.QueryServiceHelper;
 import kd.hr.hbp.business.servicehelper.HRQueryEntityHelper;
 import kd.sdk.plugin.Plugin;
 import nckd.jxccl.base.common.constant.FormConstant;
 import nckd.jxccl.base.common.utils.ConvertUtil;
 import nckd.jxccl.base.common.utils.DateUtil;
+import nckd.jxccl.base.common.utils.QueryFieldBuilder;
 import nckd.jxccl.base.orm.helper.QFilterCommonHelper;
 import nckd.jxccl.hr.ijp.common.IntJobPostConstant;
 import org.apache.commons.lang3.StringUtils;
 
 import java.time.LocalDateTime;
+import java.util.Date;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
 * 三类人员记录生成
@@ -40,6 +45,14 @@ public class IntJobPostFormPlugin extends AbstractFormPlugin implements Plugin {
                     this.getView().showTipNotification("请先选择人员类别!");
                 }else if(org == null){
                     this.getView().showTipNotification("请先选择二级单位!");
+                }else{
+                    if("A".equalsIgnoreCase(talentType)){
+                        getExcellentEmp();
+                    }else if("B".equalsIgnoreCase(talentType)){
+
+                    }else{
+
+                    }
                 }
             }
         }
@@ -49,28 +62,58 @@ public class IntJobPostFormPlugin extends AbstractFormPlugin implements Plugin {
     //本单位工作(工作信息-进本单位时间)满5年,距法定退休年龄(工作信息-新法定退休日期)超过5年且上年度员工绩效考核为优秀的所有员工
     private void getExcellentEmp(){
         DynamicObject org = ConvertUtil.toDynamicObjectOrNull(this.getModel().getValue(IntJobPostConstant.NCKD_ORG));
-        String structLongNumber = org.getString(FormConstant.STRUCTLONGNUMBER);
         //前5年
         LocalDateTime firstFiveYears = DateUtil.minusYears(DateUtil.now(), 5);
         //后5年
         LocalDateTime fiveYearsLater = DateUtil.addYears(DateUtil.now(), 5);
 
-        QFilter qFilter = new QFilter(String.join(".", FormConstant.ADMINORG, FormConstant.STRUCTLONGNUMBER), QCP.like, structLongNumber + "%")
+        QueryFieldBuilder queryFieldBuilder = QueryFieldBuilder.create()
+                .add(FormConstant.ID_KEY)
+                .add(FormConstant.STARTDATE)
+                .addIdNumberName(FormConstant.ADMINORG)
+                .addIdNumberName(FormConstant.POSITION_KEY)
+                .addGroup(new String[]{FormConstant.EMPLOYEE_KEY}, FormConstant.ID_KEY, FormConstant.NAME_KEY, FormConstant.EMP_NUMBER_KEY)
+                .orderDesc(FormConstant.STARTDATE);
+
+        QFilter qFilter = new QFilter(String.join(".", FormConstant.ADMINORG, FormConstant.NCKD_SECONDORG), QCP.equals, org.getLong(FormConstant.ID_KEY))
                 .and(QFilterCommonHelper.getValidDateFilter(FormConstant.STARTDATE, FormConstant.ENDDATE))
-                //任职类型:上挂全职任职
+                //任职类型:上挂/全职任职
                 .and(String.join( ".", FormConstant.POSTYPE, FormConstant.NUMBER_KEY), QCP.in,new String[]{"JTCC_1002", "1010_S"})
                 //在职人员
                 .and(String.join(".", FormConstant.HRPI_EMPENTREL, FormConstant.LABOR_REL_STATUS, FormConstant.IS_HIRED), QCP.equals, EnableEnum.YES.getCode())
                 //进本单位满5年
                 .and(String.join(".", FormConstant.HRPI_EMPENTREL, FormConstant.STARTDATE), QCP.less_equals, DateUtil.toDate(firstFiveYears));
                 //新法定退休日期超过5年条件,或退休日期为空
-/*        QFilter lanretdtFilter = new QFilter(String.join(".", FormConstant.HRPI_EMPENTREL, FormConstant.NCKD_NEWPLANRETDT), QCP.is_null,null)
-                .and(String.join(".", FormConstant.HRPI_EMPENTREL, FormConstant.NCKD_NEWPLANRETDT), QCP.large_equals, DateUtil.toDate(fiveYearsLater));
-        qFilter.and(qFilter1);*/
+        QFilter lanRetDtFilter = new QFilter(String.join(".", FormConstant.HRPI_PERSERLEN, FormConstant.NCKD_NEWPLANRETDT), QCP.is_null,null)
+                .or(String.join(".", FormConstant.HRPI_PERSERLEN, FormConstant.NCKD_NEWPLANRETDT), QCP.large_equals, DateUtil.toDate(fiveYearsLater));
+        qFilter.and(lanRetDtFilter);
+        QueryEntityType queryEntityType = (QueryEntityType) EntityMetadataCache.getDataEntityType("personfilequery");
+        DynamicObjectCollection personList = HRQueryEntityHelper.getInstance().getQueryDyoColl(queryEntityType, queryFieldBuilder.buildSelect(), new QFilter[]{qFilter}, queryFieldBuilder.buildOrder());
+        Map<Long, DynamicObject> personMap = personList.stream()
+                .collect(Collectors.groupingBy(
+                        obj -> obj.getLong(String.join(".", FormConstant.EMPLOYEE_KEY, FormConstant.ID_KEY))
+                ))
+                .entrySet()
+                .stream()
+                .collect(Collectors.toMap(
+                        Map.Entry::getKey,
+                        entry -> entry.getValue().get(0) // 由于已按日期降序排列,取第一条即为最新
+                ));
 
+        //获取上年和上上年考核结果
+        QueryFieldBuilder perfManagerQueryFieldBuilder = QueryFieldBuilder.create()
+                .addIdNumberName("nckd_appraisalresult")
+                .add("nckd_appraisalyear");
 
-        QueryEntityType queryEntityType = (QueryEntityType) EntityMetadataCache.getDataEntityType("personfilequery");
-//        DynamicObjectCollection personList = HRQueryEntityHelper.getInstance().getQueryDyoColl(queryEntityType, queryFieldBuilder.buildSelect(), new QFilter[]{qFilter}, queryFieldBuilder.buildOrder());
+        Date beginDate = DateUtil.beginOfYear(DateUtil.minusYears(DateUtil.nowDate(), 2));
+        Date endDate = DateUtil.endOfYear(DateUtil.minusYears(DateUtil.nowDate(), 1));
+        QFilter perfManagerFilter = new QFilter("nckd_appraisalyear",QCP.large_equals,beginDate)
+                .and("nckd_appraisalyear",QCP.less_equals,endDate)
+                .and(String.join(".", "nckd_perfmanager", FormConstant.NCKD_PERSON), QCP.in, personMap.keySet());
+        DynamicObjectCollection query = QueryServiceHelper.query("nckd_perfmanagerentry", perfManagerQueryFieldBuilder.buildSelect(), new QFilter[]{perfManagerFilter});
+        for (DynamicObject dynamicObject : query) {
+            
+        }
 
     }
 }

+ 78 - 73
code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/psms/plugin/operate/file/PersonPosFileSaveOpPlugin.java

@@ -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);
         }
     }
 

+ 18 - 10
code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/psms/task/PsmsAdjustSalaryTask.java

@@ -30,6 +30,7 @@ import nckd.jxccl.base.common.utils.ConvertUtil;
 import nckd.jxccl.base.common.utils.DateUtil;
 import nckd.jxccl.base.common.utils.QueryFieldBuilder;
 import nckd.jxccl.base.common.utils.StrFormatter;
+import nckd.jxccl.base.entity.helper.EntityHelper;
 import nckd.jxccl.base.swc.helper.AdjFileServiceHelper;
 import nckd.jxccl.hr.psms.common.PositionStructureConstant;
 
@@ -62,7 +63,14 @@ public class PsmsAdjustSalaryTask extends AbstractTask implements Plugin {
     @Override
     public void execute(RequestContext requestContext, Map<String, Object> map) throws KDException {
         logger.info("开始执行职位体系推送薪酬任务, 参数: {}", JSON.toJSONString(map));
-        
+        Long salaryItemId = EntityHelper.getIdByNumber(FormConstant.HSBS_STANDARDITEM, "jt008");
+        Long billTypeId = EntityHelper.getIdByNumber(FormConstant.BOS_BILLTYPE, FormConstant.HCDM_APPLYBILL_BT_ADJ);
+        Long countryId = EntityHelper.getIdByNumber(FormConstant.BD_COUNTRY, "001");
+        Long salaryAdjuStrSnId = EntityHelper.getIdByNumber(FormConstant.HSBS_SALARYADJUSTRSN, "zhijibiandong");
+        Long currencyId = EntityHelper.getIdByNumber(FormConstant.BD_CURRENCY, "CNY");
+        Long adjApproveScmId = EntityHelper.getLatestIdByNumber(FormConstant.HCDM_ADJAPPROVESCM, "dingtiaoxin");
+        Long exRateTableId = EntityHelper.getIdByNumber(FormConstant.BD_EXRATETABLE, "ERT-01");
+        Long calFrequencyId = EntityHelper.getIdByNumber(FormConstant.HSBS_CALFREQUENCY, "000_m_001");
         //1:为本月数据,2:为上月数据
         Integer type = ConvertUtil.toInt(map.get("type"));
         Date beginDateParam = ConvertUtil.toDate(map.get("beginDateParam"));
@@ -172,7 +180,7 @@ public class PsmsAdjustSalaryTask extends AbstractTask implements Plugin {
         if(!needAdjustSalaryId.isEmpty()){
             logger.info("开始获取人员最新岗位工资标准定薪记录");
             //获取人员最新岗位工资标准定薪记录
-            List<AdjFileServiceHelper.SalaryAdjustmentResult> salaryAdjustmentResultList = AdjFileServiceHelper.getLastDecAdjRecords(needPersonId, FormConstant.STANDARDITEM_ID_KEY);
+            List<AdjFileServiceHelper.SalaryAdjustmentResult> salaryAdjustmentResultList = AdjFileServiceHelper.getLastDecAdjRecords(needPersonId, FormConstant.POS_STANDARD_ITEM_NUMBER);
             Map<Long, List<AdjFileServiceHelper.SalaryAdjustmentResult>> salaryAdjustmentResultMap = salaryAdjustmentResultList.stream()
                     .collect(Collectors.groupingBy(result -> result.employee.getLong(FormConstant.ID_KEY)));
             
@@ -230,19 +238,19 @@ public class PsmsAdjustSalaryTask extends AbstractTask implements Plugin {
                                 applyBill.put("org", orgId);
                             }
                             //定调薪明细字段显示方案   调薪明细字段
-                            applyBill.put("billtype", 2215975998602655744L);
+                            applyBill.put("billtype", billTypeId);
                             //国家
-                            applyBill.put("billcountry", 1000001L);
+                            applyBill.put("billcountry", countryId);
                             //定调薪类型
-                            applyBill.put("salaryadjrsn", 2352338490244480000L);
+                            applyBill.put("salaryadjrsn", salaryAdjuStrSnId);
                             //默认币种
-                            applyBill.put("billcurrency", 1L);
+                            applyBill.put("billcurrency", currencyId);
                             //定调薪方案
-                            applyBill.put("salaryadjscm", 2322515162646457344L);
+                            applyBill.put("salaryadjscm", adjApproveScmId);
                             //汇率日期
                             applyBill.put("exchangeratedate", new Date());
                             //汇率表
-                            applyBill.put("exctable", 2321965096026258432L);
+                            applyBill.put("exctable", exRateTableId);
                             //默认生效日期
                             applyBill.put("effectivedate", date);
                             //草稿状态
@@ -274,8 +282,8 @@ public class PsmsAdjustSalaryTask extends AbstractTask implements Plugin {
                             Long positionId = personPosFile.getLong(String.join(".",PositionStructureConstant.NCKD_POSITIONHR, FormConstant.ID_KEY));
                             applyBillEntry.put("adjfile", salaryAdjustmentResult.adjFileInfo.getLong(FormConstant.ID_KEY));
                             applyBillEntry.put("employee", employeeId);
-                            applyBillEntry.put("standarditem", 2321901533681170432L);    //定调薪项目   职位系数
-                            applyBillEntry.put("frequency", 1095454108284088320L);       //频度  月
+                            applyBillEntry.put("standarditem", salaryItemId);    //定调薪项目   职位系数
+                            applyBillEntry.put("frequency", calFrequencyId);       //频度  月
                             applyBillEntry.put("amount", coefficient);
                             applyBillEntry.put("position", positionId);
                             applyBillEntry.put("joblevel", jobLevel.getLong(FormConstant.ID_KEY));

+ 17 - 15
code/opmc/nckd-jxccl-opmc/src/main/java/nckd/jxccl/opmc/pm/plugin/operate/salary/PushAdjustOpPlugin.java

@@ -3,17 +3,13 @@ package nckd.jxccl.opmc.pm.plugin.operate.salary;
 import com.alibaba.fastjson.JSON;
 import kd.bos.context.RequestContext;
 import kd.bos.dataentity.entity.DynamicObject;
-import kd.bos.db.tx.TX;
-import kd.bos.db.tx.TXHandle;
 import kd.bos.entity.ExtendedDataEntity;
 import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
 import kd.bos.entity.plugin.AddValidatorsEventArgs;
 import kd.bos.entity.plugin.PreparePropertysEventArgs;
 import kd.bos.entity.plugin.args.AfterOperationArgs;
 import kd.bos.entity.plugin.args.BeginOperationTransactionArgs;
-import kd.bos.entity.plugin.args.EndOperationTransactionArgs;
 import kd.bos.entity.validate.AbstractValidator;
-import kd.bos.servicehelper.BusinessDataServiceHelper;
 import kd.bos.servicehelper.operation.SaveServiceHelper;
 import kd.sdk.plugin.Plugin;
 import kd.sdk.swc.hcdm.business.helper.HCDMApplyBillServiceHelper;
@@ -21,15 +17,14 @@ import nckd.jxccl.base.common.constant.FormConstant;
 import nckd.jxccl.base.common.exception.ValidationException;
 import nckd.jxccl.base.common.utils.ConvertUtil;
 import nckd.jxccl.base.common.utils.StrFormatter;
+import nckd.jxccl.base.entity.helper.EntityHelper;
 import nckd.jxccl.opmc.pm.common.SalAdjTrackerConstant;
 
-import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.StringJoiner;
 import java.util.UUID;
 
 /**
@@ -76,7 +71,14 @@ public class PushAdjustOpPlugin extends AbstractOperationServicePlugIn implement
     List<DynamicObject> pushAdjusts = new ArrayList<>();
     @Override
     public void beginOperationTransaction(BeginOperationTransactionArgs e) {
-
+        Long salaryItemId = EntityHelper.getIdByNumber(FormConstant.HSBS_STANDARDITEM, FormConstant.POS_STANDARD_ITEM_NUMBER);
+        Long billTypeId = EntityHelper.getIdByNumber(FormConstant.BOS_BILLTYPE, FormConstant.HCDM_APPLYBILL_BT_ADJ);
+        Long countryId = EntityHelper.getIdByNumber(FormConstant.BD_COUNTRY, "001");
+        Long salaryAdjuStrSnId = EntityHelper.getIdByNumber(FormConstant.HSBS_SALARYADJUSTRSN, "kaohe");
+        Long currencyId = EntityHelper.getIdByNumber(FormConstant.BD_CURRENCY, "CNY");
+        Long adjApproveScmId = EntityHelper.getLatestIdByNumber(FormConstant.HCDM_ADJAPPROVESCM, "dingtiaoxin");
+        Long exRateTableId = EntityHelper.getIdByNumber(FormConstant.BD_EXRATETABLE, "ERT-01");
+        Long calFrequencyId = EntityHelper.getIdByNumber(FormConstant.HSBS_CALFREQUENCY, "000_m_001");
         String operateKey = e.getOperationKey();
 
         List<DynamicObject> updateAdjusts = new ArrayList<>();
@@ -114,19 +116,19 @@ public class PushAdjustOpPlugin extends AbstractOperationServicePlugIn implement
                     applyBill.put("_uniquecode", uniquecode);
                     applyBill.put("org", orgId);
                     //定调薪明细字段显示方案   调薪明细字段
-                    applyBill.put("billtype", 2215975998602655744L);
+                    applyBill.put("billtype", billTypeId);
                     //国家
-                    applyBill.put("billcountry", 1000001L);
+                    applyBill.put("billcountry", countryId);
                     //定调薪类型
-                    applyBill.put("salaryadjrsn", 2352337648716103680L);
+                    applyBill.put("salaryadjrsn", salaryAdjuStrSnId);
                     //默认币种
-                    applyBill.put("billcurrency", 1L);
+                    applyBill.put("billcurrency", currencyId);
                     //定调薪方案
-                    applyBill.put("salaryadjscm", 2322515162646457344L);
+                    applyBill.put("salaryadjscm", adjApproveScmId);
                     //汇率日期
                     applyBill.put("exchangeratedate", new Date());
                     //汇率表
-                    applyBill.put("exctable", 2321965096026258432L);
+                    applyBill.put("exctable", exRateTableId);
                     //默认生效日期
                     applyBill.put("effectivedate", new Date());
                     //草稿状态
@@ -142,8 +144,8 @@ public class PushAdjustOpPlugin extends AbstractOperationServicePlugIn implement
                     Long positionId = pushAdjust.getDynamicObject(SalAdjTrackerConstant.NCKD_POSITION).getLong(FormConstant.ID_KEY);
                     applyBillEntry.put("adjfile", adjFileInfo.getLong(FormConstant.ID_KEY));
                     applyBillEntry.put("employee", employeeId);
-                    applyBillEntry.put("standarditem", 2321899710350111744L);    //定调薪项目   岗位工资标准
-                    applyBillEntry.put("frequency", 1095454108284088320L);       //频度  月
+                    applyBillEntry.put("standarditem", salaryItemId);    //定调薪项目   岗位工资标准
+                    applyBillEntry.put("frequency", calFrequencyId);       //频度  月
                     applyBillEntry.put("amount", pushAdjust.getBigDecimal(SalAdjTrackerConstant.NCKD_MONEY));
 //            applyBillEntry.put("nckd_postgrade", salaryfile.getLong("position.nckd_postgrade.id"));  //岗级
                     applyBillEntry.put("position", positionId);

+ 4 - 4
code/opmc/nckd-jxccl-opmc/src/main/java/nckd/jxccl/opmc/pm/plugin/operate/salary/SalaryAdjOpPlugin.java

@@ -26,7 +26,6 @@ import kd.bos.servicehelper.QueryServiceHelper;
 import kd.bos.servicehelper.operation.OperationServiceHelper;
 import kd.bos.servicehelper.operation.SaveServiceHelper;
 import kd.bos.servicehelper.user.UserServiceHelper;
-import kd.hr.hbp.common.model.AuthorizedOrgResultWithSub;
 import kd.hr.hbp.common.model.OrgSubInfo;
 import kd.sdk.hr.hbp.business.helper.permission.HRPermissionServiceHelper;
 import kd.sdk.plugin.Plugin;
@@ -119,6 +118,7 @@ public class SalaryAdjOpPlugin extends AbstractOperationServicePlugIn implements
                 ));
 
         List<SalaryAdjustmentResult> salaryAdjustmentResultList = new ArrayList<>();
+        Long salaryItemId = EntityHelper.getIdByNumber(FormConstant.HSBS_STANDARDITEM, FormConstant.POS_STANDARD_ITEM_NUMBER);
         for (DynamicObject perfManager : perfManagerList) {
             long id = perfManager.getLong(FormConstant.ID_KEY);
             if(perfManagerToSalaryAdjMap.get(id) == null) {
@@ -215,7 +215,7 @@ public class SalaryAdjOpPlugin extends AbstractOperationServicePlugIn implements
                         .collect(Collectors.toList());
 
                 DynamicObject standardItem = EntityHelper.newEntity(FormConstant.HSBS_STANDARDITEM);
-                standardItem.set(FormConstant.ID_KEY, FormConstant.STANDARDITEM_ID_KEY);
+                standardItem.set(FormConstant.ID_KEY, salaryItemId);
                 Map<String, Object> adjFileParams = new HashMap<>();
                 adjFileParams.put("employees", allPersonIds);
                 List<String> status = new ArrayList<>();
@@ -242,7 +242,7 @@ public class SalaryAdjOpPlugin extends AbstractOperationServicePlugIn implements
                         // 调薪档案ID
                         dataItem.put("adjfile", adjFileId);
                         // 调薪项目ID
-                        dataItem.put("standarditem", FormConstant.STANDARDITEM_ID_KEY);
+                        dataItem.put("standarditem", salaryItemId);
                         // 查询基准日期
                         dataItem.put("startdate", new Date());
                         // 唯一标识
@@ -368,7 +368,7 @@ public class SalaryAdjOpPlugin extends AbstractOperationServicePlugIn implements
                             List<StdTableDataMatchParam> matchParams = new ArrayList<>();
                             StdTableDataMatchParam stdTableDataMatchParam = new StdTableDataMatchParam();
                             stdTableDataMatchParam.setStdTableId(result.salaryStDv.getLong(FormConstant.ID_KEY));
-                            stdTableDataMatchParam.setStdItemId(FormConstant.STANDARDITEM_ID_KEY);
+                            stdTableDataMatchParam.setStdItemId(salaryItemId);
                             stdTableDataMatchParam.setGradeId(result.oldSalaryGrade.getLong(FormConstant.ID_KEY));
                             stdTableDataMatchParam.setRankId(newSalaryRank.getLong(FormConstant.ID_KEY));
                             matchParams.add(stdTableDataMatchParam);

+ 4 - 2
code/swc/nckd-jxccl-swc/src/main/java/nckd/jxccl/swc/hscs/business/custfetch/PosSalaryGrade1.java

@@ -16,6 +16,7 @@ import nckd.jxccl.base.common.constant.FormConstant;
 import nckd.jxccl.base.common.utils.ConvertUtil;
 import nckd.jxccl.base.common.utils.DateUtil;
 import nckd.jxccl.base.common.utils.QueryFieldBuilder;
+import nckd.jxccl.base.entity.helper.EntityHelper;
 import nckd.jxccl.base.swc.helper.AdjFileServiceHelper;
 
 import java.math.BigDecimal;
@@ -41,6 +42,7 @@ public class PosSalaryGrade1 implements ICustomFetchDataService {
     public Map<Long, Map<String, Object>> fetchDataCalPerson(List<Long> calPersonIdList, Map<Long, Map<String, Object>> paramsMap, Map<String, Object> extParamMap) {
         Map<Long, Map<String, Object>> resultMap = new HashMap<Long, Map<String, Object>>();
 
+        Long salaryItemId = EntityHelper.getIdByNumber(FormConstant.HSBS_STANDARDITEM, FormConstant.POS_STANDARD_ITEM_NUMBER);
         QueryFieldBuilder queryFieldBuilder = QueryFieldBuilder.create()
                 .add(FormConstant.ID_KEY)
                 .add(FormConstant.EMP_NUMBER_KEY)
@@ -74,7 +76,7 @@ public class PosSalaryGrade1 implements ICustomFetchDataService {
             if(!employeeToCalPersonMap.isEmpty()) {
                 //获取人员最新岗位工资标准定薪记录
                 List<Long> allPersonIds = ConvertUtil.toList(employeeToCalPersonMap.values());
-                List<AdjFileServiceHelper.SalaryAdjustmentResult> salaryAdjustmentResultList = AdjFileServiceHelper.getLastDecAdjRecords(allPersonIds, FormConstant.STANDARDITEM_ID_KEY);
+                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());
@@ -96,7 +98,7 @@ public class PosSalaryGrade1 implements ICustomFetchDataService {
                         for (AdjFileServiceHelper.SalaryAdjustmentResult result : salaryAdjustmentResultList) {
                             StdTableDataMatchParam stdTableDataMatchParam = new StdTableDataMatchParam();
                             stdTableDataMatchParam.setStdTableId(result.salaryStDv.getLong(FormConstant.ID_KEY));
-                            stdTableDataMatchParam.setStdItemId(FormConstant.STANDARDITEM_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) {

+ 27 - 18
code/swc/nckd-jxccl-swc/src/main/java/nckd/jxccl/swc/init/plugin/operate/BuildApplyBillOpPlugin.java

@@ -22,6 +22,7 @@ import kd.sdk.swc.hcdm.common.dto.stdtab.match.StdTableGradeRankRangeMatchResult
 import nckd.jxccl.base.common.constant.FormConstant;
 import nckd.jxccl.base.common.utils.ConvertUtil;
 import nckd.jxccl.base.common.utils.DateUtil;
+import nckd.jxccl.base.entity.helper.EntityHelper;
 import nckd.jxccl.base.swc.helper.SWCHelper;
 
 import java.util.*;
@@ -51,35 +52,35 @@ public class BuildApplyBillOpPlugin extends AbstractOperationServicePlugIn imple
      * left join t_bas_billtype_l b on a.fid = b.fid
      * where a.fbillformid  like 'hcdm_applybill'
      */
-    private static final Long changeSalaryBillTypeId = 2215975998602655744L;
+//    private static final Long changeSalaryBillTypeId = 2215975998602655744L;
     /**
      * 定调薪申请单  定调薪明细字段显示方案   员工定薪
      */
-    private static final Long setSalaryBillEntryTypeId = 2215982957338868736L;
+//    private static final Long setSalaryBillEntryTypeId = 2215982957338868736L;
     /**
      * 定调薪项目   岗位工资标准   t_hsbs_standarditem
      */
-    private static final Long salaryStdItemId = 2321899710350111744L;
+//    private static final Long salaryStdItemId = 2321899710350111744L;
     /**
      * 频度  月   t_hsbs_calfrequency
      */
-    private static final Long frequencyItemId = 1095454108284088320L;
+//    private static final Long frequencyItemId = 1095454108284088320L;
     /**
      * 汇率表   通用汇率   T_BD_ExRateTable
      */
-    private static final Long exchangeTableId = 2321965096026258432L;
+//    private static final Long exchangeTableId = 2321965096026258432L;
     /**
      * 国家   中国   T_BD_Country
      */
-    private static final Long countryItemId = 1000001L;
+//    private static final Long countryItemId = 1000001L;
     /**
      * 定调薪方案   t_hcdm_adjapprovescm
      */
-    private static final Long salaryAdjScmItemId = 2322515162646457344L;
+//    private static final Long salaryAdjScmItemId = 2322515162646457344L;
     /**
      * 默认币种   人民币   select * from T_BD_Currency
      */
-    private static final Long currencyItemId = 1L;
+//    private static final Long currencyItemId = 1L;
 
 
 
@@ -126,16 +127,23 @@ public class BuildApplyBillOpPlugin extends AbstractOperationServicePlugIn imple
 
         DynamicObjectCollection salaryTypeDyns = SWCHelper.getSalaryTypeDyns();
 
+        Long salaryItemId = EntityHelper.getIdByNumber(FormConstant.HSBS_STANDARDITEM, FormConstant.POS_STANDARD_ITEM_NUMBER);
+        Long billTypeId = EntityHelper.getIdByNumber(FormConstant.BOS_BILLTYPE, FormConstant.HCDM_APPLYBILL_BT_ADJ);
+        Long countryId = EntityHelper.getIdByNumber(FormConstant.BD_COUNTRY, "001");
+        Long currencyId = EntityHelper.getIdByNumber(FormConstant.BD_CURRENCY, "CNY");
+        Long adjApproveScmId = EntityHelper.getLatestIdByNumber(FormConstant.HCDM_ADJAPPROVESCM, "dingtiaoxin");
+        Long exRateTableId = EntityHelper.getIdByNumber(FormConstant.BD_EXRATETABLE, "ERT-01");
+        Long calFrequencyId = EntityHelper.getIdByNumber(FormConstant.HSBS_CALFREQUENCY, "000_m_001");
         String uniquecode = UUID.randomUUID().toString().replace("-", "");
         applyBill.put("_uniquecode", uniquecode);
         //applyBill.put("org",orgId);
         //applyBill.put("billtype", 2215975998602655744L);   //定调薪明细字段显示方案   调薪明细字段
-        applyBill.put("billcountry", countryItemId);                //国家
+        applyBill.put("billcountry", countryId);                //国家
         //applyBill.put("salaryadjrsn", 2352340656979984384L);  //定调薪类型
-        applyBill.put("billcurrency", currencyItemId);           //默认币种
-        applyBill.put("salaryadjscm", salaryAdjScmItemId);   //定调薪方案
+        applyBill.put("billcurrency", currencyId);           //默认币种
+        applyBill.put("salaryadjscm", adjApproveScmId);   //定调薪方案
         applyBill.put("exchangeratedate", new Date());   //汇率日期
-        applyBill.put("exctable", exchangeTableId);  //汇率表
+        applyBill.put("exctable", exRateTableId);  //汇率表
         applyBill.put("effectivedate", new Date());   //默认生效日期
         applyBill.put("isdraft", "1"); //草稿状态
         applyBill.put("auditstatus", "A"); //审核状态
@@ -156,11 +164,11 @@ public class BuildApplyBillOpPlugin extends AbstractOperationServicePlugIn imple
             //定调薪明细字段显示方案   调薪明细字段
             if(billType.equals("调动单")){
                 //定调薪明细字段显示方案
-                applyBill.put("billtype", changeSalaryBillTypeId);
+                applyBill.put("billtype", billTypeId);
                 //定调薪类型
                 applyBill.put("salaryadjrsn", salaryTypeDyns.get(1).getLong("id"));
             }else if(billType.equals("入职单")){
-                applyBill.put("billtype", setSalaryBillEntryTypeId);
+                applyBill.put("billtype", billTypeId);
                 applyBill.put("salaryadjrsn", salaryTypeDyns.get(0).getLong("id"));
             }
 
@@ -169,8 +177,8 @@ public class BuildApplyBillOpPlugin extends AbstractOperationServicePlugIn imple
 
             applyBillEntry.put("adjfile", salaryfile.getLong("id"));
             applyBillEntry.put("employee", employeeId);
-            applyBillEntry.put("standarditem", salaryStdItemId);    //定调薪项目   岗位工资标准
-            applyBillEntry.put("frequency", frequencyItemId);       //频度  月
+            applyBillEntry.put("standarditem", salaryItemId);    //定调薪项目   岗位工资标准
+            applyBillEntry.put("frequency", calFrequencyId);       //频度  月
             //applyBillEntry.put("amount", BigDecimal.ZERO);
             Long postgradeId = salaryfile.getLong("position.nckd_postgrade.id");
             applyBillEntry.put("nckd_postgrade", postgradeId);  //岗级
@@ -178,7 +186,7 @@ public class BuildApplyBillOpPlugin extends AbstractOperationServicePlugIn imple
             /**
              * 获取标准表
              */
-            Long salaryStandardId = getSalarystandard(salaryfile.getLong("stdscm.id"),salaryStdItemId);
+            Long salaryStandardId = getSalarystandard(salaryfile.getLong("stdscm.id"),salaryItemId);
             /**
              * 获取薪等
              */
@@ -253,6 +261,7 @@ public class BuildApplyBillOpPlugin extends AbstractOperationServicePlugIn imple
      * @return
      */
     public Long getSalaryGradeID(Long postgradeId,Long salarystandardId){
+        Long salaryItemId = EntityHelper.getIdByNumber(FormConstant.HSBS_STANDARDITEM, FormConstant.POS_STANDARD_ITEM_NUMBER);
 
         List<StdTableGradeRankRangeMatchParam> matchParams = new ArrayList<>();
         StdTableGradeRankRangeMatchParam stdTableGradeRankMatchParam = new StdTableGradeRankRangeMatchParam();
@@ -264,7 +273,7 @@ public class BuildApplyBillOpPlugin extends AbstractOperationServicePlugIn imple
         /*
          * 定调薪项目  hsbs_standarditem
          */
-        stdTableGradeRankMatchParam.setStdItemId(salaryStdItemId);
+        stdTableGradeRankMatchParam.setStdItemId(salaryItemId);
         /**
          * 匹配类型 为0 时
          * 定调薪人员属性 key 为  定调薪人员属性配置(hcdm_contrastpropconf)的ID