|
|
@@ -0,0 +1,109 @@
|
|
|
+package nckd.jxccl.sit.hcsi.formplugin.web.coordination;
|
|
|
+
|
|
|
+import kd.bos.dataentity.entity.DynamicObject;
|
|
|
+import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
|
+import kd.bos.dataentity.utils.ObjectUtils;
|
|
|
+import kd.bos.entity.datamodel.IDataModel;
|
|
|
+import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
|
|
+import kd.bos.form.plugin.AbstractFormPlugin;
|
|
|
+import kd.hr.hbp.common.cache.HRPageCache;
|
|
|
+import kd.hr.hbp.common.util.HRStringUtils;
|
|
|
+import kd.sdk.plugin.Plugin;
|
|
|
+import kd.sdk.sit.sitbp.business.helper.SITBPServiceHelper;
|
|
|
+import kd.sdk.sit.sitbp.common.StdResultInfoDTO;
|
|
|
+import nckd.jxccl.sit.hcsi.common.constant.SitConstant;
|
|
|
+import nckd.jxccl.sit.hcsi.utils.SITCoordinationUtils;
|
|
|
+
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Set;
|
|
|
+
|
|
|
+/**
|
|
|
+ * Tyx 2025-12-05
|
|
|
+ * 员工变动处理核定单 【nckd_hpdi_empcoordver_ext】
|
|
|
+ */
|
|
|
+public class HCSIEmpCoordVerifBillEditEx extends AbstractFormPlugin implements Plugin {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void propertyChanged(PropertyChangedArgs e) {
|
|
|
+ super.propertyChanged(e);
|
|
|
+ IDataModel model = this.getModel();
|
|
|
+ String key = e.getProperty().getName();
|
|
|
+ // 如果是 参保标准 / 险种 / 险种维度发生变化,需要去取参保标准中的标准维度值
|
|
|
+ // 如果是 险种 / 险种维度发生变化,只需要修改当前子单据体的数据
|
|
|
+ if(HRStringUtils.equalsAny(key, "nckd_welfaretype", "nckd_sinsurdimension")) {
|
|
|
+ int rowIndex = model.getEntryCurrentRowIndex("nckd_entryentity");
|
|
|
+ DynamicObject sinSurStd = (DynamicObject) model.getValue("sinsurstd_r31");
|
|
|
+ getStdInfoAndStdDimfromCache(sinSurStd);
|
|
|
+ DynamicObject welfaretype = (DynamicObject) model.getValue("nckd_welfaretype", rowIndex);
|
|
|
+ DynamicObject sinSurDimension = (DynamicObject) model.getValue("nckd_sinsurdimension", rowIndex);
|
|
|
+ getDimensionValue(sinSurStd, welfaretype, sinSurDimension, rowIndex);
|
|
|
+ }
|
|
|
+ else if (HRStringUtils.equals(key, "sinsurstd_r31")) {
|
|
|
+ Object newValue = e.getChangeSet()[0].getNewValue();
|
|
|
+ if(!ObjectUtils.isEmpty(newValue)) {
|
|
|
+ getStdInfoAndStdDimfromCache((DynamicObject) newValue);
|
|
|
+ getDimensionValue((DynamicObject) newValue);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 参保标准修改的情况下,把当前单据体下数据也改一下
|
|
|
+ * @param sinSurStd
|
|
|
+ */
|
|
|
+ public void getDimensionValue(DynamicObject sinSurStd) {
|
|
|
+ DynamicObjectCollection entryCols = this.getModel().getDataEntity(true).getDynamicObjectCollection("nckd_entryentity");
|
|
|
+ for(int i = 0 ; i < entryCols.size(); i++) {
|
|
|
+ DynamicObject subEntry = entryCols.get(i);
|
|
|
+ DynamicObject welfaretype = subEntry.getDynamicObject("nckd_welfaretype");
|
|
|
+ DynamicObject sinSurDimension = subEntry.getDynamicObject("nckd_sinsurdimension");
|
|
|
+ getDimensionValue(sinSurStd, welfaretype, sinSurDimension, i);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 子单据体获取并设置维度值
|
|
|
+ * @param sinSurStd
|
|
|
+ * @param welfaretype
|
|
|
+ * @param sinSurDimension
|
|
|
+ */
|
|
|
+ public void getDimensionValue(DynamicObject sinSurStd, DynamicObject welfaretype, DynamicObject sinSurDimension, int rowIndex) {
|
|
|
+ IDataModel model = this.getModel();
|
|
|
+ HRPageCache pageCache = new HRPageCache(this.getView());
|
|
|
+ String cacheKey = String.valueOf(sinSurStd.getLong("id"));
|
|
|
+ StdResultInfoDTO stdResultInfoDTO = pageCache.get(cacheKey, StdResultInfoDTO.class);
|
|
|
+
|
|
|
+ if(welfaretype == null)
|
|
|
+ return;
|
|
|
+
|
|
|
+ SITCoordinationUtils SITCoordinationUtils = new SITCoordinationUtils();
|
|
|
+ Map result = SITCoordinationUtils.dealStdResult(stdResultInfoDTO, sinSurStd, welfaretype, sinSurDimension);
|
|
|
+
|
|
|
+ Set<Long> keySet = SitConstant.INSURANCE_PAY_BASE_CONSTANTS.keySet();
|
|
|
+ for (Long key : keySet) {
|
|
|
+ if(result.get(key) == null) {
|
|
|
+ model.setValue(SitConstant.INSURANCE_PAY_BASE_CONSTANTS.get(key), null, rowIndex);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ model.setValue(SitConstant.INSURANCE_PAY_BASE_CONSTANTS.get(key), result.get(key), rowIndex);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 从缓存中获取参保标准的信息,如果没有缓存则生成缓存
|
|
|
+ * @param sinSurStd
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public void getStdInfoAndStdDimfromCache (DynamicObject sinSurStd) {
|
|
|
+ HRPageCache pageCache = new HRPageCache(this.getView());
|
|
|
+ String cacheKey = String.valueOf(sinSurStd.getLong("id"));
|
|
|
+ StdResultInfoDTO stdResultInfoDTO = pageCache.get(cacheKey, StdResultInfoDTO.class);
|
|
|
+ if(stdResultInfoDTO == null) {
|
|
|
+ stdResultInfoDTO = SITBPServiceHelper.getStdInfoAndStdDim(Arrays.asList(sinSurStd.getLong("id"))).get(sinSurStd.getLong("id"));
|
|
|
+ pageCache.put(cacheKey, stdResultInfoDTO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|