|
@@ -0,0 +1,61 @@
|
|
|
|
|
+package nckd.jxccl.sit.hcsi.opplugin.web.file.attach;
|
|
|
|
|
+
|
|
|
|
|
+import kd.bos.dataentity.OperateOption;
|
|
|
|
|
+import kd.bos.dataentity.entity.DynamicObject;
|
|
|
|
|
+import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
|
|
|
|
+import kd.bos.entity.plugin.PreparePropertysEventArgs;
|
|
|
|
|
+import kd.bos.entity.plugin.args.AfterOperationArgs;
|
|
|
|
|
+import kd.bos.logging.Log;
|
|
|
|
|
+import kd.bos.logging.LogFactory;
|
|
|
|
|
+import kd.bos.servicehelper.operation.SaveServiceHelper;
|
|
|
|
|
+import kd.sdk.plugin.Plugin;
|
|
|
|
|
+import nckd.jxccl.sit.hcsi.business.coordination.api.SinsurCoordBizSaveHandler;
|
|
|
|
|
+import nckd.jxccl.sit.hcsi.common.constant.SitConstant;
|
|
|
|
|
+
|
|
|
|
|
+import java.util.Arrays;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+import java.util.Map;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * Tyx 2025-12-05
|
|
|
|
|
+ * 险种基数设置保存插件 【nckd_hcsi_sibase_ext】
|
|
|
|
|
+ */
|
|
|
|
|
+public class SIBaseSaveOpEx extends AbstractOperationServicePlugIn implements Plugin {
|
|
|
|
|
+
|
|
|
|
|
+ private static final Log log = LogFactory.getLog(SIBaseSaveOpEx.class);
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onPreparePropertys(PreparePropertysEventArgs e) {
|
|
|
|
|
+ super.onPreparePropertys(e);
|
|
|
|
|
+ e.getFieldKeys().add("welfaretype.nckd_sinsurfilefields");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void afterExecuteOperationTransaction(AfterOperationArgs e) {
|
|
|
|
|
+ super.afterExecuteOperationTransaction(e);
|
|
|
|
|
+ DynamicObject[] bills = e.getDataEntities();
|
|
|
|
|
+ // 根据社保档案ID进行分组:
|
|
|
|
|
+ Map<Long, List<DynamicObject>> billsMap = Arrays.stream(bills)
|
|
|
|
|
+ .collect(Collectors.groupingBy(bill -> {
|
|
|
|
|
+ Long sinsurfileId = bill.getLong("sinsurfile.id");
|
|
|
|
|
+ return sinsurfileId != null ? sinsurfileId : 0L;
|
|
|
|
|
+ }));
|
|
|
|
|
+ for(Long sinsurFileId : billsMap.keySet()) {
|
|
|
|
|
+ if(sinsurFileId == 0L)
|
|
|
|
|
+ continue;
|
|
|
|
|
+ DynamicObject sinsurFileDyn = SitConstant.SINSURFILE_HELPER.loadOne(sinsurFileId);
|
|
|
|
|
+ List<DynamicObject> siBaseList = billsMap.get(sinsurFileId);
|
|
|
|
|
+ for (DynamicObject siBase : siBaseList) {
|
|
|
|
|
+ // 险种上新增了一个字段nckd_sinsurfilefields, 根据这个字段的值判断把险种维度写回档案上的哪个字段
|
|
|
|
|
+ Long welfAreTypeId = siBase.getLong("welfaretype.id");
|
|
|
|
|
+ String selectFields = "nckd_sinsurfilefields";
|
|
|
|
|
+ DynamicObject welfAreTypeDyn = SitConstant.WELFARETYPE_HELPER.queryOne(selectFields, welfAreTypeId);
|
|
|
|
|
+ String fieldKey = welfAreTypeDyn.getString("nckd_sinsurfilefields");
|
|
|
|
|
+ sinsurFileDyn.set(fieldKey, siBase.getLong("nckd_sinsurdimension.id"));
|
|
|
|
|
+ }
|
|
|
|
|
+ SaveServiceHelper.saveOperate("hcsi_sinsurfile", new DynamicObject[]{sinsurFileDyn}, OperateOption.create());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+}
|