|
|
@@ -14,6 +14,7 @@ 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;
|
|
|
@@ -30,6 +31,7 @@ import nckd.jxccl.base.common.utils.DateUtil;
|
|
|
import nckd.jxccl.base.common.utils.StrFormatter;
|
|
|
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;
|
|
|
@@ -164,7 +166,7 @@ public class PushAdjustOpPlugin extends AbstractOperationServicePlugIn implement
|
|
|
}
|
|
|
}
|
|
|
if(!applyBillMap.isEmpty()) {
|
|
|
- List<DynamicObject> saveDynamicObjects = new ArrayList<>();
|
|
|
+
|
|
|
|
|
|
Map<String, Object> papams = new HashMap<>();
|
|
|
List<Map<String, Object>> applybillList = new ArrayList<>();
|
|
|
@@ -173,56 +175,64 @@ public class PushAdjustOpPlugin extends AbstractOperationServicePlugIn implement
|
|
|
}
|
|
|
papams.put("data", applybillList);
|
|
|
papams.put("isUseMatchAmount", Boolean.TRUE);
|
|
|
- Map<String, Object> result = HCDMApplyBillServiceHelper.saveDraftApplyBill(papams);
|
|
|
- logger.info("推送定调薪结果:{}", JSON.toJSONString(result));
|
|
|
-
|
|
|
- if (!ConvertUtil.toBoolean(result.get("success")) || result.get("data") == null || ConvertUtil.toList(result.get("data")).isEmpty()) {
|
|
|
- logger.error("推送定调薪失败,原因:{}", JSON.toJSONString(result));
|
|
|
- throw new ValidationException("推送定调薪失败,原因:" + JSON.toJSONString(result));
|
|
|
- } else {
|
|
|
- MainEntityType depEmpEntityType = EntityMetadataCache.getDataEntityType(ExcellsConstant.EXCELLENTSSALLOWANCE_ENTITYID);
|
|
|
- DynamicObject[] load = BusinessDataServiceHelper.load(ids.toArray(new Long[0]), depEmpEntityType);
|
|
|
- List<Map<String, Object>> list = ConvertUtil.toList(result.get("data"));
|
|
|
- for (DynamicObject dynamicObject : load) {
|
|
|
- long id = dynamicObject.getLong(FormConstant.ID_KEY);
|
|
|
- for (Map<String, Object> dataMap : list) {
|
|
|
- Long uniqueCode = ConvertUtil.toLong(dataMap.get("_uniquecode"));
|
|
|
- if (id == uniqueCode) {
|
|
|
- dynamicObject.set(PositionStructureConstant.NCKD_ISSALADJPUSH, Boolean.TRUE);
|
|
|
- dynamicObject.set(PositionStructureConstant.NCKD_SALADJPUSHTIME, new Date());
|
|
|
- dynamicObject.set(PositionStructureConstant.NCKD_SALADJID, ConvertUtil.toMap(dataMap.get("id")));
|
|
|
+ TXHandle tx = TX.requiresNew();
|
|
|
+ try {
|
|
|
+ Map<String, Object> result = HCDMApplyBillServiceHelper.saveDraftApplyBill(papams);
|
|
|
+ logger.info("推送定调薪结果:{}", JSON.toJSONString(result));
|
|
|
+
|
|
|
+ if (!ConvertUtil.toBoolean(result.get("success")) || result.get("data") == null || ConvertUtil.toList(result.get("data")).isEmpty()) {
|
|
|
+ logger.error("推送定调薪失败,原因:{}", JSON.toJSONString(result));
|
|
|
+ throw new ValidationException("推送定调薪失败,原因:" + JSON.toJSONString(result));
|
|
|
+ } else {
|
|
|
+ MainEntityType depEmpEntityType = EntityMetadataCache.getDataEntityType(ExcellsConstant.EXCELLENTSSALLOWANCE_ENTITYID);
|
|
|
+ List<Map<String, Object>> list = ConvertUtil.toList(result.get("data"));
|
|
|
+ for (DynamicObject dynamicObject : e.getDataEntities()) {
|
|
|
+ long id = dynamicObject.getLong(FormConstant.ID_KEY);
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ logger.info("成功推送的定调薪申请单,申请单ID: {}", uniqueCode);
|
|
|
+ saveDynamicObjects.add(dynamicObject);
|
|
|
}
|
|
|
- logger.info("成功推送的定调薪申请单,申请单ID: {}",uniqueCode);
|
|
|
- saveDynamicObjects.add(dynamicObject);
|
|
|
}
|
|
|
+ tx.commit();
|
|
|
}
|
|
|
-// SaveServiceHelper.update(load);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ tx.markRollback();
|
|
|
+ throw ex;
|
|
|
+ }finally {
|
|
|
+ tx.close();
|
|
|
}
|
|
|
- //独立事务隔离跨库操作
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ List<DynamicObject> saveDynamicObjects = new ArrayList<>();
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void afterExecuteOperationTransaction(AfterOperationArgs e) {
|
|
|
+ if(this.getOperationResult() != null && this.getOperationResult().isSuccess()) {
|
|
|
if (!saveDynamicObjects.isEmpty()) {
|
|
|
- TXHandle tx = TX.requiresNew();
|
|
|
- try {
|
|
|
- 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()) {
|
|
|
- errorMsg.add(error.getMessage());
|
|
|
- }
|
|
|
- if (!ObjectUtils.isEmpty(operationResult.getMessage())) {
|
|
|
- errorMsg.add(operationResult.getMessage());
|
|
|
- }
|
|
|
- logger.error("保存职位津贴失败,原因:{}", errorMsg.toString());
|
|
|
- tx.markRollback();
|
|
|
- throw new ValidationException("保存职位津贴失败,原因:" + errorMsg.toString());
|
|
|
- } else {
|
|
|
- tx.commit();
|
|
|
- logger.info("成功保存 {} 条职位津贴记录", saveDynamicObjects.size());
|
|
|
+ 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()) {
|
|
|
+ errorMsg.add(error.getMessage());
|
|
|
+ }
|
|
|
+ if (!ObjectUtils.isEmpty(operationResult.getMessage())) {
|
|
|
+ errorMsg.add(operationResult.getMessage());
|
|
|
}
|
|
|
- } catch (Exception ex) {
|
|
|
- tx.markRollback();
|
|
|
- throw ex;
|
|
|
- } finally {
|
|
|
- tx.close();
|
|
|
+ logger.error("保存职位津贴失败,原因:{}", errorMsg.toString());
|
|
|
+ throw new ValidationException("保存职位津贴失败,原因:" + errorMsg.toString());
|
|
|
+ } else {
|
|
|
+ logger.info("成功保存 {} 条职位津贴记录", saveDynamicObjects.size());
|
|
|
}
|
|
|
}
|
|
|
}
|