|
@@ -0,0 +1,154 @@
|
|
|
|
|
+package nckd.jxccl.sit.hcsi.formplugin.web.datacomparison;
|
|
|
|
|
+
|
|
|
|
|
+import kd.bos.algo.DataSet;
|
|
|
|
|
+import kd.bos.algo.Row;
|
|
|
|
|
+import kd.bos.dataentity.entity.DynamicObject;
|
|
|
|
|
+import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
|
|
|
+import kd.bos.dataentity.utils.ObjectUtils;
|
|
|
|
|
+import kd.bos.entity.datamodel.AbstractFormDataModel;
|
|
|
|
|
+import kd.bos.entity.datamodel.IDataModel;
|
|
|
|
|
+import kd.bos.entity.datamodel.TableValueSetter;
|
|
|
|
|
+import kd.bos.form.IFormView;
|
|
|
|
|
+import kd.bos.form.control.EntryGrid;
|
|
|
|
|
+import kd.bos.form.events.AfterDoOperationEventArgs;
|
|
|
|
|
+import kd.bos.form.events.BeforeDoOperationEventArgs;
|
|
|
|
|
+import kd.bos.form.operate.FormOperate;
|
|
|
|
|
+import kd.bos.form.plugin.AbstractFormPlugin;
|
|
|
|
|
+import kd.bos.logging.Log;
|
|
|
|
|
+import kd.bos.logging.LogFactory;
|
|
|
|
|
+import nckd.jxccl.sit.hcsi.business.datacomparison.DataComparisonQueryService;
|
|
|
|
|
+import nckd.jxccl.sit.hcsi.business.importtaskguide.ImportTaskGuideImportService;
|
|
|
|
|
+
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
|
|
+import java.util.Arrays;
|
|
|
|
|
+import java.util.EventObject;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * Tyx 2025-10-31
|
|
|
|
|
+ * 社保明细差异对比单表达插件
|
|
|
|
|
+ */
|
|
|
|
|
+public class DetailCompareBillEdit extends AbstractFormPlugin {
|
|
|
|
|
+ private static final Log logger = LogFactory.getLog(DetailCompareBillEdit.class);
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void registerListener(EventObject e) {
|
|
|
|
|
+ super.registerListener(e);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void beforeDoOperation(BeforeDoOperationEventArgs args) {
|
|
|
|
|
+ super.beforeDoOperation(args);
|
|
|
|
|
+ FormOperate formOperate = (FormOperate)args.getSource();
|
|
|
|
|
+ String key = formOperate.getOperateKey();
|
|
|
|
|
+ switch (key) {
|
|
|
|
|
+ case "donothing_query":
|
|
|
|
|
+ beforeDoQueryVerify(args);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "donothing_confirm":
|
|
|
|
|
+ beforeDoConfirmVerify(args);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 比对确认操作前校验
|
|
|
|
|
+ * @param args
|
|
|
|
|
+ */
|
|
|
|
|
+ private void beforeDoConfirmVerify(BeforeDoOperationEventArgs args) {
|
|
|
|
|
+ EntryGrid entryGrid = this.getControl("nckd_entryentity");
|
|
|
|
|
+ int[] selectRows = entryGrid.getSelectRows();
|
|
|
|
|
+ if(selectRows.length == 0 ) {
|
|
|
|
|
+ this.getView().showTipNotification("请先选中数据!");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 点击查询前校验:
|
|
|
|
|
+ */
|
|
|
|
|
+ private void beforeDoQueryVerify(BeforeDoOperationEventArgs args) {
|
|
|
|
|
+ IDataModel model = this.getModel();
|
|
|
|
|
+ DynamicObject dyn = model.getDataEntity();
|
|
|
|
|
+ DynamicObject period = dyn.getDynamicObject("nckd_period");
|
|
|
|
|
+ DynamicObject welfarepayer = dyn.getDynamicObject("nckd_welfarepayer");
|
|
|
|
|
+ DynamicObjectCollection welfaretypeCols = dyn.getDynamicObjectCollection("nckd_welfaretype");
|
|
|
|
|
+ if(ObjectUtils.isEmpty(period)) {
|
|
|
|
|
+ args.setCancel(true);
|
|
|
|
|
+ this.getView().showTipNotification("请先选择期间!");
|
|
|
|
|
+ }
|
|
|
|
|
+ if(ObjectUtils.isEmpty(welfarepayer)) {
|
|
|
|
|
+ args.setCancel(true);
|
|
|
|
|
+ this.getView().showTipNotification("请先选择参保单位!");
|
|
|
|
|
+ }
|
|
|
|
|
+ if(welfaretypeCols.size() == 0) {
|
|
|
|
|
+ args.setCancel(true);
|
|
|
|
|
+ this.getView().showTipNotification("请先选择险种!");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) {
|
|
|
|
|
+ super.afterDoOperation(afterDoOperationEventArgs);
|
|
|
|
|
+ IDataModel model = this.getModel();
|
|
|
|
|
+ IFormView view = this.getView();
|
|
|
|
|
+ String key = afterDoOperationEventArgs.getOperateKey();
|
|
|
|
|
+ switch (key) {
|
|
|
|
|
+ case "donothing_query":
|
|
|
|
|
+ model.deleteEntryData("nckd_entryentity");
|
|
|
|
|
+ DataComparisonQueryService service = new DataComparisonQueryService(model, view);
|
|
|
|
|
+ DataSet dataSet = service.doQuery();
|
|
|
|
|
+ handleCompareData(dataSet);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "donothing_confirm":
|
|
|
|
|
+ doConfirm();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 比对实际执行方法
|
|
|
|
|
+ */
|
|
|
|
|
+ private void doConfirm() {
|
|
|
|
|
+ IDataModel model = this.getModel();
|
|
|
|
|
+ EntryGrid entryGrid = this.getControl("nckd_entryentity");
|
|
|
|
|
+ int[] selectRows = entryGrid.getSelectRows();
|
|
|
|
|
+ for (int i : selectRows) {
|
|
|
|
|
+ model.setValue("nckd_datastatus", "B", i);
|
|
|
|
|
+ }
|
|
|
|
|
+ this.getView().updateView("nckd_entryentity");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 处理比对数据
|
|
|
|
|
+ * @param dataSet
|
|
|
|
|
+ */
|
|
|
|
|
+ private void handleCompareData(DataSet dataSet) {
|
|
|
|
|
+ TableValueSetter setter = new TableValueSetter();
|
|
|
|
|
+ String[] columnName = dataSet.getRowMeta().getFieldNames();
|
|
|
|
|
+ int rowIndex = 0;
|
|
|
|
|
+ AbstractFormDataModel model = (AbstractFormDataModel) this.getModel();
|
|
|
|
|
+ while(dataSet.hasNext()) {
|
|
|
|
|
+ Row rowData = dataSet.next();
|
|
|
|
|
+ List<String> excludeFields = Arrays.asList("type");
|
|
|
|
|
+ // 赋值
|
|
|
|
|
+ for(String columnKey : columnName) {
|
|
|
|
|
+ if(excludeFields.contains(columnKey))
|
|
|
|
|
+ continue;
|
|
|
|
|
+ setter.set(columnKey, rowData.get(columnKey), rowIndex);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 比对,单位/个人缴费金额系统内<>单位/个人缴费金额系统外的话,比对结果=不一致
|
|
|
|
|
+ BigDecimal value1 = rowData.getBigDecimal("companysysvalue");
|
|
|
|
|
+ BigDecimal value2 = rowData.getBigDecimal("companyoutvalue");
|
|
|
|
|
+ BigDecimal value3 = rowData.getBigDecimal("personsysvalue");
|
|
|
|
|
+ BigDecimal value4 = rowData.getBigDecimal("personoutvalue");
|
|
|
|
|
+
|
|
|
|
|
+ if(value1.compareTo(value2) != 0 || value3.compareTo(value4) != 0) {
|
|
|
|
|
+ setter.set("compareresult", "C", rowIndex);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ rowIndex++;
|
|
|
|
|
+ }
|
|
|
|
|
+ model.beginInit();
|
|
|
|
|
+ model.batchCreateNewEntryRow("nckd_entryentity", setter);
|
|
|
|
|
+ model.endInit();
|
|
|
|
|
+ this.getView().updateView("nckd_entryentity");
|
|
|
|
|
+ }
|
|
|
|
|
+}
|