|
|
@@ -3,10 +3,10 @@ package nckd.jxccl.sit.hcsi.formplugin.web.coordination;
|
|
|
import kd.bos.dataentity.entity.DynamicObject;
|
|
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
|
import kd.bos.dataentity.serialization.SerializationUtils;
|
|
|
-import kd.bos.db.DB;
|
|
|
+import kd.bos.dataentity.utils.ObjectUtils;
|
|
|
import kd.bos.entity.EntityMetadataCache;
|
|
|
import kd.bos.entity.datamodel.IDataModel;
|
|
|
-import kd.bos.form.MessageBoxOptions;
|
|
|
+import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
|
|
import kd.bos.form.control.EntryGrid;
|
|
|
import kd.bos.form.events.AfterDoOperationEventArgs;
|
|
|
import kd.bos.form.events.BeforeDoOperationEventArgs;
|
|
|
@@ -16,9 +16,17 @@ import kd.bos.form.plugin.AbstractFormPlugin;
|
|
|
import kd.bos.org.utils.DynamicObjectUtils;
|
|
|
import kd.bos.orm.query.QFilter;
|
|
|
import kd.hr.hbp.business.servicehelper.HRBaseServiceHelper;
|
|
|
+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.StdDimDTO;
|
|
|
+import kd.sdk.sit.sitbp.common.StdInsuranceItemDTO;
|
|
|
+import kd.sdk.sit.sitbp.common.StdResultInfoDTO;
|
|
|
+import nckd.jxccl.sit.hcsi.common.constant.SitConstant;
|
|
|
+import nckd.jxccl.sit.hcsi.utils.SITCoordinationUtils;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
import java.util.stream.Stream;
|
|
|
@@ -71,7 +79,70 @@ public class SinSurEmpChgCoordBatchEditPluginEx extends AbstractFormPlugin imple
|
|
|
this.getView().updateView("nckd_subentryentity");
|
|
|
}
|
|
|
|
|
|
+ @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("entryentity");
|
|
|
+ DynamicObject sinSurStd = (DynamicObject) model.getValue("sinsurstd_r31", rowIndex);
|
|
|
+ getStdInfoAndStdDimfromCache(sinSurStd);
|
|
|
+ int subRowIndex = e.getChangeSet()[0].getRowIndex();
|
|
|
+ DynamicObject welfaretype = (DynamicObject) model.getValue("nckd_welfaretype", subRowIndex);
|
|
|
+ DynamicObject sinSurDimension = (DynamicObject) model.getValue("nckd_sinsurdimension", subRowIndex);
|
|
|
+ getDimensionValue(sinSurStd, welfaretype, sinSurDimension, rowIndex, subRowIndex);
|
|
|
+ }
|
|
|
+ // 如果是 参保标准发生变化,当前单据体下的子单据体都需要更新
|
|
|
+ else if (HRStringUtils.equals(key, "sinsurstd_r31")) {
|
|
|
+ Object newValue = e.getChangeSet()[0].getNewValue();
|
|
|
+ if(!ObjectUtils.isEmpty(newValue)) {
|
|
|
+ getStdInfoAndStdDimfromCache((DynamicObject) newValue);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 从缓存中获取参保标准的信息,如果没有缓存则生成缓存
|
|
|
+ * @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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 子单据体获取并设置维度值
|
|
|
+ * @param sinSurStd
|
|
|
+ * @param welfaretype
|
|
|
+ * @param sinSurDimension
|
|
|
+ * @param subRowIndex
|
|
|
+ */
|
|
|
+ public void getDimensionValue(DynamicObject sinSurStd, DynamicObject welfaretype, DynamicObject sinSurDimension, int rowIndex, int subRowIndex) {
|
|
|
+ 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 || sinSurDimension == 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) {
|
|
|
+ model.setValue(SitConstant.INSURANCE_PAY_BASE_CONSTANTS.get(key), result.get(key), rowIndex, subRowIndex);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
@Override
|