Explorar el Código

feat(excells): 添加薪资调整推送功能中的日期字段和优化保存逻辑

- 添加了 startdate 和 enddate 字段到申请单条目中
- 初始化 saveDynamicObjects 列表用于保存动态对象
- 移除了 adjInfoId 字段的设置逻辑
- 将保存操作改为更新操作以优化性能
- 注释掉了原有的保存操作和错误处理逻辑
wyc hace 1 semana
padre
commit
db198d5fa3

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

@@ -160,6 +160,8 @@ public class PushAdjustOpPlugin extends AbstractOperationServicePlugIn implement
                 applyBillEntry.put("amount", entity.getBigDecimal(FormConstant.NCKD_MONEY));
                 applyBillEntry.put("position", position.getLong(FormConstant.ID_KEY));
                 applyBillEntry.put("reason", entity.getString(ExcellsConstant.NCKD_DESC));
+                applyBillEntry.put("startdate", entity.getDate(ExcellsConstant.NCKD_EFFDT));
+                applyBillEntry.put("enddate", entity.getDate(ExcellsConstant.NCKD_LEFFDT) == null ? DateUtil.getMaxDateAsDate() : entity.getDate(ExcellsConstant.NCKD_LEFFDT));
                 applyBillEntryData.add(applyBillEntry);
                 applyBill.put("applybillent", applyBillEntryData);
                 applyBillMap.put(id+"-"+orgId, applyBill);
@@ -175,6 +177,7 @@ public class PushAdjustOpPlugin extends AbstractOperationServicePlugIn implement
             }
             papams.put("data", applybillList);
             papams.put("isUseMatchAmount", Boolean.TRUE);
+            List<DynamicObject> saveDynamicObjects = new ArrayList<>();
             TXHandle tx = TX.requiresNew();
             try {
                 Map<String, Object> result = HCDMApplyBillServiceHelper.saveDraftApplyBill(papams);
@@ -191,12 +194,10 @@ public class PushAdjustOpPlugin extends AbstractOperationServicePlugIn implement
                         for (Map<String, Object> dataMap : list) {
                             Long uniqueCode = ConvertUtil.toLong(dataMap.get("_uniquecode"));
                             if (id == uniqueCode) {
-                                Object adjInfoId = dataMap.get("id");
-                                if (adjInfoId != null) {
-                                    dynamicObject.set(PositionStructureConstant.NCKD_ISSALADJPUSH, Boolean.TRUE);
-                                    dynamicObject.set(PositionStructureConstant.NCKD_SALADJPUSHTIME, new Date());
-                                    dynamicObject.set(PositionStructureConstant.NCKD_SALADJID, adjInfoId);
-                                }
+                                dynamicObject.set(PositionStructureConstant.NCKD_ISSALADJPUSH, Boolean.TRUE);
+                                dynamicObject.set(PositionStructureConstant.NCKD_SALADJPUSHTIME, new Date());
+//                                dynamicObject.set(PositionStructureConstant.NCKD_SALADJID, adjInfoId);
+
                             }
                             logger.info("成功推送的定调薪申请单,申请单ID: {}", uniqueCode);
                             saveDynamicObjects.add(dynamicObject);
@@ -211,16 +212,9 @@ public class PushAdjustOpPlugin extends AbstractOperationServicePlugIn implement
                 tx.close();
             }
 
-        }
-    }
-
-    List<DynamicObject> saveDynamicObjects = new ArrayList<>();
-
-    @Override
-    public void afterExecuteOperationTransaction(AfterOperationArgs e) {
-        if(this.getOperationResult() != null && this.getOperationResult().isSuccess()) {
             if (!saveDynamicObjects.isEmpty()) {
-                OperationResult operationResult = SaveServiceHelper.saveOperate(ExcellsConstant.EXCELLENTSSALLOWANCE_ENTITYID, saveDynamicObjects.toArray(new DynamicObject[0]), OperateOption.create());
+                SaveServiceHelper.update(saveDynamicObjects.toArray(new DynamicObject[0]));
+                /*OperationResult operationResult = SaveServiceHelper.saveOperate(ExcellsConstant.EXCELLENTSSALLOWANCE_ENTITYID, saveDynamicObjects.toArray(new DynamicObject[0]), OperateOption.create());
                 if (!operationResult.isSuccess()) {
                     StringJoiner errorMsg = new StringJoiner("\n");
                     for (IOperateInfo error : operationResult.getAllErrorOrValidateInfo()) {
@@ -233,8 +227,11 @@ public class PushAdjustOpPlugin extends AbstractOperationServicePlugIn implement
                     throw new ValidationException("保存职位津贴失败,原因:" + errorMsg.toString());
                 } else {
                     logger.info("成功保存 {} 条职位津贴记录", saveDynamicObjects.size());
-                }
+                }*/
             }
         }
     }
+
+
+
 }