Prechádzať zdrojové kódy

feat:新增校核相关功能

hyx 5 mesiacov pred
rodič
commit
bb66a8b278
30 zmenil súbory, kde vykonal 2338 pridanie a 27 odobranie
  1. 19 0
      server/service/service-sys/src/main/java/com/c503/ca/cadv/module/check/domain/CheckResult.java
  2. 635 22
      server/service/service-sys/src/main/java/com/c503/ca/cadv/module/check/util/CheckUtil.java
  3. 16 0
      server/service/service-sys/src/main/java/com/c503/ca/cadv/module/cmp/domain/FillConfig.java
  4. 35 0
      server/service/service-sys/src/main/java/com/c503/ca/cadv/module/cmp/domain/RevCalCmdParam.java
  5. 41 0
      server/service/service-sys/src/main/java/com/c503/ca/cadv/module/cmp/domain/RevCalConfig.java
  6. 3 0
      server/service/service-sys/src/main/java/com/c503/ca/cadv/module/cmp/domain/vo/FillConfigVO.java
  7. 35 0
      server/service/service-sys/src/main/java/com/c503/ca/cadv/module/cmp/domain/vo/RevCalCmdParamVO.java
  8. 35 0
      server/service/service-sys/src/main/java/com/c503/ca/cadv/module/cmp/domain/vo/RevCalConfigVO.java
  9. 8 0
      server/service/service-sys/src/main/java/com/c503/ca/cadv/module/cmp/repository/RevCalCmdParamRepository.java
  10. 8 0
      server/service/service-sys/src/main/java/com/c503/ca/cadv/module/cmp/repository/RevCalConfigRepository.java
  11. 42 4
      server/service/service-sys/src/main/java/com/c503/ca/cadv/module/cmp/service/FillConfigService.java
  12. 100 0
      server/service/service-sys/src/main/java/com/c503/ca/cadv/module/cmp/service/RevCalCmdParamService.java
  13. 207 0
      server/service/service-sys/src/main/java/com/c503/ca/cadv/module/cmp/service/RevCalConfigService.java
  14. 114 0
      server/service/service-sys/src/main/java/com/c503/ca/cadv/module/cmp/util/RevCalCompConfigUtils.java
  15. 80 0
      server/service/service-sys/src/main/java/com/c503/ca/cadv/module/cmp/web/FillConfigResource.java
  16. 104 0
      server/service/service-sys/src/main/java/com/c503/ca/cadv/module/cmp/web/RevCalCmdParamResource.java
  17. 130 0
      server/service/service-sys/src/main/java/com/c503/ca/cadv/module/cmp/web/RevCalConfigResource.java
  18. 23 0
      server/service/service-sys/src/main/java/com/c503/ca/cadv/module/cmp/xml/RevCalCmdParamXml.java
  19. 38 0
      server/service/service-sys/src/main/java/com/c503/ca/cadv/module/cmp/xml/RevCalConfigXml.java
  20. 21 0
      server/service/service-sys/src/main/java/com/c503/ca/cadv/module/cmp/xml/RevCalConfigXmlList.java
  21. 15 0
      server/service/service-sys/src/main/java/com/c503/ca/cadv/module/ge/domain/CmdParamType.java
  22. 6 0
      server/service/service-sys/src/main/java/com/c503/ca/cadv/module/ge/repository/CmdParamRepository.java
  23. 4 0
      server/service/service-sys/src/main/java/com/c503/ca/cadv/module/ge/service/CmdParamService.java
  24. 24 1
      server/service/service-sys/src/main/java/com/c503/ca/cadv/module/plan/domain/CmdInst.java
  25. 30 0
      server/service/service-sys/src/main/java/com/c503/ca/cadv/module/plan/domain/CmdParamInst.java
  26. 2 0
      server/service/service-sys/src/main/java/com/c503/ca/cadv/module/plan/domain/vo/CmdInstVO.java
  27. 10 0
      server/service/service-sys/src/main/java/com/c503/ca/cadv/module/plan/domain/vo/CmdParamInstVO.java
  28. 43 0
      server/service/service-sys/src/main/java/com/c503/ca/cadv/module/plan/util/CmdConvertUtils.java
  29. 403 0
      server/service/service-sys/src/main/java/com/c503/ca/cadv/module/plan/util/CompUtils.java
  30. 107 0
      server/service/service-sys/src/main/resources/mappings/module/ge/CmdParamMapper.xml

+ 19 - 0
server/service/service-sys/src/main/java/com/c503/ca/cadv/module/check/domain/CheckResult.java

@@ -0,0 +1,19 @@
+package com.c503.ca.cadv.module.check.domain;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * @Author hyx
+ * @Date 2024/6/20 16:44
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class CheckResult {
+
+    private boolean result;
+
+    private CompResult compResult;
+}

+ 635 - 22
server/service/service-sys/src/main/java/com/c503/ca/cadv/module/check/util/CheckUtil.java

@@ -9,11 +9,11 @@ import com.c503.ca.cadv.common.util.JacksonUtils;
 import com.c503.ca.cadv.common.util.exception.RuntimeErrorException;
 import com.c503.ca.cadv.common.util.xml.XmlUtils;
 import com.c503.ca.cadv.enhance.ftp.FtpUtils;
-import com.c503.ca.cadv.module.check.domain.CompResult;
-import com.c503.ca.cadv.module.check.domain.RsltFileXDO;
-import com.c503.ca.cadv.module.check.domain.StCmdInfoXDO;
+import com.c503.ca.cadv.module.check.domain.*;
 import com.c503.ca.cadv.module.check.domain.orin.racpa.RacpaXDO;
 import com.c503.ca.cadv.module.check.domain.orin.racpa.StruRacpaData;
+import com.c503.ca.cadv.module.check.domain.orin.rpgnc.RpgncXDO;
+import com.c503.ca.cadv.module.check.domain.orin.rpgnc.StrRpgncBody;
 import com.c503.ca.cadv.module.check.domain.orin.rpppc.RpppcXDO;
 import com.c503.ca.cadv.module.check.domain.orin.rpppc.StrRpppcBody;
 import com.c503.ca.cadv.module.check.domain.orin.rprlytrk.RprlytrkXDO;
@@ -23,6 +23,7 @@ import com.c503.ca.cadv.module.check.domain.orin.rsbeod.StruRsbeoData;
 import com.c503.ca.cadv.module.check.domain.orin.rsbeod.StruRsbeod;
 import com.c503.ca.cadv.module.cmp.domain.vo.FillConfigVO;
 import com.c503.ca.cadv.module.cmp.util.CmpHelper;
+import com.c503.ca.cadv.module.cmp.util.RevCalCompConfigUtils;
 import com.c503.ca.cadv.module.ge.domain.enums.ParamSignType;
 import com.c503.ca.cadv.module.ge.domain.vo.CmdVO;
 import com.c503.ca.cadv.module.ge.util.CmdHelper;
@@ -36,17 +37,24 @@ import com.c503.ca.cadv.module.info.domain.vo.TargetVO;
 import com.c503.ca.cadv.module.info.domain.vo.TargetZbVO;
 import com.c503.ca.cadv.module.info.domain.vo.TaskVO;
 import com.c503.ca.cadv.module.info.util.InfoHelper;
+import com.c503.ca.cadv.module.plan.domain.CmdInst;
+import com.c503.ca.cadv.module.plan.domain.CmdParamInst;
 import com.c503.ca.cadv.module.plan.domain.vo.CmdInstVO;
 import com.c503.ca.cadv.module.plan.domain.vo.CmdParamInstVO;
 import com.c503.ca.cadv.module.plan.domain.vo.ConfigFileVO;
 import com.c503.ca.cadv.module.plan.domain.vo.FileDataVO;
+import com.c503.ca.cadv.module.plan.util.CmdConvertUtils;
+import com.c503.ca.cadv.module.plan.util.CompUtils;
 import com.c503.ca.cadv.module.plan.util.PlanHelper;
+import com.google.common.collect.Maps;
 import org.apache.commons.compress.utils.Lists;
 import org.apache.commons.lang.StringUtils;
 
 import java.io.File;
 import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 
 /**
@@ -55,7 +63,7 @@ import java.util.stream.Collectors;
  */
 public class CheckUtil {
 
-    public static CompResult<List<CmdInstVO>, List<StCmdInfoXDO>> check(String targetCode, String filename) {
+    public static CheckResult check(String targetCode, String filename) {
 
         Target target = InfoHelper.getTargetService().getByTargetCode(targetCode);
         if (target == null) {
@@ -88,8 +96,60 @@ public class CheckUtil {
             throw new RuntimeErrorException("反算文件数据获取失败");
         }
         CompResult<List<CmdInstVO>, List<StCmdInfoXDO>> compResult = revCalComp(rsltFileXDO, ftpId, taskId, targetCode, filename);
-
-        return compResult;
+        List<CmdInstVO> cmdInstVOList = compResult.getObj();
+        List<StCmdInfoXDO> stCmdInfoXDOList = compResult.getCompObj();
+        List<CmdInstVO> removeCmd = new ArrayList<>();
+        List<StCmdInfoXDO> removeStCmdInfoXDOList = new ArrayList<>();
+        for (CmdInstVO cmdInstVO : cmdInstVOList) {
+            List<CmdParamInstVO> cmdParamInstList = cmdInstVO.getCmdParamInstList();
+            if (CollectionsUtils.isNotEmpty(cmdParamInstList)) {
+                List<CmdParamInstVO> newCmdParamInstList = new ArrayList<>();
+                for (CmdParamInstVO cmdParamInstVO : cmdParamInstList) {
+                    if (cmdParamInstVO.getCompResult() != CompResult.COMP_EQUAL) {
+                        newCmdParamInstList.add(cmdParamInstVO);
+                    }
+                }
+                if (newCmdParamInstList.size() > 0) {
+                    cmdInstVO.setCmdParamInstList(newCmdParamInstList);
+                } else {
+                    removeCmd.add(cmdInstVO);
+                }
+            } else {
+                removeCmd.add(cmdInstVO);
+            }
+        }
+        if (removeCmd.size() > 0) {
+            cmdInstVOList.removeAll(removeCmd);
+        }
+        for (StCmdInfoXDO stCmdInfoXDO : stCmdInfoXDOList) {
+            List<StCmdPara> stCmdParaList = stCmdInfoXDO.getStCmdParaList();
+            if (CollectionsUtils.isNotEmpty(stCmdParaList)) {
+                List<StCmdPara> newStCmdParaList = new ArrayList<>();
+                for (StCmdPara stCmdPara : stCmdParaList) {
+                    if (stCmdPara.getCompResult() != CompResult.COMP_EQUAL) {
+                        newStCmdParaList.add(stCmdPara);
+                    }
+                }
+                if (newStCmdParaList.size() > 0) {
+                    stCmdInfoXDO.setStCmdParaList(stCmdParaList);
+                } else {
+                    removeStCmdInfoXDOList.add(stCmdInfoXDO);
+                }
+            } else {
+                removeStCmdInfoXDOList.add(stCmdInfoXDO);
+            }
+        }
+        if (removeStCmdInfoXDOList.size() > 0) {
+            stCmdInfoXDOList.removeAll(removeStCmdInfoXDOList);
+        }
+        CheckResult checkResult = new CheckResult();
+        if (cmdInstVOList.size() > 0 && stCmdInfoXDOList.size() > 0) {
+            checkResult.setCompResult(compResult);
+            checkResult.setResult(false);
+        } else {
+            checkResult.setResult(true);
+        }
+        return checkResult;
     }
 
     public static RsltFileXDO getRsltFile(String ftpId, String taskId, String targetId, CatalogType catalogType, String filename) {
@@ -212,8 +272,19 @@ public class CheckUtil {
         //cfg第一层指令集合
         List<CmdInstVO> cmdInstVOList = null;
         for (FileDataVO fileData : configFileVO.getFileDataList()) {
-            if (rsltFileXDO.getSzFileName().equals(fileDataVO.getFile())) {
+            if (rsltFileXDO.getSzFileName().equals(fileData.getFile())) {
                 cmdInstVOList = fileData.getCmdInstList();
+                if (CollectionsUtils.isNotEmpty(cmdInstVOList)) {
+                    for (CmdInstVO cmdInstVO : cmdInstVOList) {
+                        if ("zc".equals(fileData.getOutType())) {
+                            cmdInstVO.setIsDc(0);
+                        } else if ("d".equals(fileData.getOutType())) {
+                            cmdInstVO.setIsDc(1);
+                        } else {
+                            cmdInstVO.setIsDc(2);
+                        }
+                    }
+                }
                 break;
             }
         }
@@ -221,13 +292,392 @@ public class CheckUtil {
             throw new RuntimeException("无该反算文件名");
         }
         //处理特殊指令
-        //TODO 未完成
-        while (checkAndAddSpecialCmd(cmdInstVOList, ftpId, taskId, targetId));
+        while (checkAndAddSpecialCmd(cmdInstVOList, ftpId, taskId, targetId, stCmdInfoXDOList));
 
-        return null;
+        // s类型参数的指令移至外层
+        moveCmdOfS(cmdInstVOList);
+        // B W类型参数处理
+        checkAndHandlerBW(cmdInstVOList, stCmdInfoXDOList, szDataList, rsltFileXDO.getStLoadDataList().get(0).getUiCmdNumList());
+        // 比对
+        compare(cmdInstVOList, stCmdInfoXDOList, ftpId, taskId, targetId);
+
+        // 比对结果对象
+        CompResult<List<CmdInstVO>, List<StCmdInfoXDO>> compResult = new CompResult<>();
+        compResult.setObj(cmdInstVOList);
+        compResult.setCompObj(stCmdInfoXDOList);
+
+        if (CollectionsUtils.isEmpty(cmdInstVOList)) {
+            throw new RuntimeErrorException("数据库无[" + filename + "]历史填表指令数据,无法进行比较");
+        }
+
+        return compResult;
+    }
+
+    public static void compare(List<CmdInstVO> cmdInstVOList, List<StCmdInfoXDO> stCmdInfoXDOList, String ftpId, String taskId, String targetId) {
+        int i;
+        // 按顺序逐个比对指令
+        for (i = 0; i < cmdInstVOList.size() && i < stCmdInfoXDOList.size(); i++) {
+            CmdInstVO cmdInstVO = cmdInstVOList.get(i);
+            StCmdInfoXDO stCmdInfoXDO = stCmdInfoXDOList.get(i);
+
+            List<CmdParamInstVO> cmdParamInstVOList = cmdInstVO.getCmdParamInstList();
+            List<StCmdPara> stCmdParaList = stCmdInfoXDO.getStCmdParaList();
+            if (CollectionsUtils.isEmpty(cmdInstVOList) || CollectionsUtils.isEmpty(stCmdParaList)) {
+                continue;
+            }
+            int j;
+            // 按顺序逐个比对指令参数
+            for (j = 0; j < cmdParamInstVOList.size() && j < stCmdParaList.size(); j++) {
+                CmdParamInstVO cmdParamInstVO = cmdParamInstVOList.get(j);
+                StCmdPara stCmdPara = stCmdParaList.get(j);
+                cmdParamInstVO.setCmdCode(cmdInstVO.getCmdCode());
+                // 指令参数比对
+                cmdParamComp(cmdParamInstVO, stCmdPara, ftpId, taskId, targetId);
+                // 取值范围校验
+                // 参数比对结果为相等时
+                if (cmdParamInstVO.getCompResult() != null && CompResult.COMP_EQUAL == cmdParamInstVO.getCompResult()) {
+                    if (StringUtils.isEmpty(cmdParamInstVO.getValueRange())) {
+                        // 取值范围为空,判断长度
+                        checkRangeWithLength(cmdParamInstVO);
+                    } else {
+                        // 按取值范围校验
+                        checkValueRange(cmdParamInstVO);
+                    }
+                }
+            }
+            if (!cmdInstVO.getCmdCode().equals(stCmdInfoXDO.getSzZlCode())) {
+                for (int k = 0; k < cmdParamInstVOList.size(); k++) {
+                    cmdParamInstVOList.get(k).setParamValue("无比对对象");
+                    cmdParamInstVOList.get(k).setCompValue("无比对对象");
+                    cmdParamInstVOList.get(k).setCompResult(CompResult.COMP_NO_OBJ);
+                }
+                for (int k = 0; k < stCmdParaList.size(); k++) {
+                    stCmdParaList.get(k).setCompValue("无比对对象");
+                    stCmdParaList.get(k).setCompResult(CompResult.COMP_NO_OBJ);
+                }
+            } else {
+                // 逐个比较后,cfg指令参数数目超出
+                while (j < cmdParamInstVOList.size()) {
+                    cmdParamInstVOList.get(j).setParamValue("无比对对象");
+                    cmdParamInstVOList.get(j).setCompValue("无比对对象");
+                    cmdParamInstVOList.get(j).setCompResult(CompResult.COMP_NO_OBJ);
+                    j++;
+                }
+                // 逐个比较后,反算指令参数数目超出
+                while (j < stCmdParaList.size()) {
+                    stCmdParaList.get(j).setCompValue("无比对对象");
+                    stCmdParaList.get(j).setCompResult(CompResult.COMP_NO_OBJ);
+                    j++;
+                }
+            }
+        }
+        // 逐个比较后,cfg指令数目超出
+        while (i < cmdInstVOList.size()) {
+            List<CmdParamInstVO> cmdParamInstVOList = cmdInstVOList.get(i).getCmdParamInstList();
+            for (CmdParamInstVO cmdParamInstVO : cmdParamInstVOList) {
+                cmdParamInstVO.setParamValue("无比对对象");
+                cmdParamInstVO.setCompValue("无比对对象");
+                cmdParamInstVO.setCompResult(CompResult.COMP_NO_OBJ);
+            }
+            i++;
+        }
+        // 逐个比较后,反算指令数目超出
+        while (i < stCmdInfoXDOList.size()) {
+            List<StCmdPara> stCmdParaList = stCmdInfoXDOList.get(i).getStCmdParaList();
+            for (StCmdPara stCmdPara : stCmdParaList) {
+                stCmdPara.setCompValue("无比对对象");
+                stCmdPara.setCompResult(CompResult.COMP_NO_OBJ);
+            }
+            i++;
+        }
+
+    }
+
+    public static void checkValueRange(CmdParamInstVO cmdParamInstVO) {
+        try {
+            BigDecimal paramValue = toBigDecimal(cmdParamInstVO.getParamValue());
+            String[] valueRanges = cmdParamInstVO.getValueRange().split("\\|");
+            for (String range : valueRanges) {
+                if (range.charAt(0) == '=') {
+                    BigDecimal r = toBigDecimal(range.substring(1));
+                    if (paramValue.compareTo(r) == 0) {
+                        return;
+                    }
+                }
+                if (range.contains("~")) {
+                    BigDecimal min = toBigDecimal(range.substring(0, range.indexOf('~')));
+                    BigDecimal max = toBigDecimal(range.substring(range.indexOf('~') + 1));
+                    if (paramValue.compareTo(min) >= 0 && paramValue.compareTo(max) <= 0) {
+                        return;
+                    }
+                }
+            }
+            cmdParamInstVO.setCompResult(CompResult.OUT_RANGE);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static void checkRangeWithLength(CmdParamInstVO cmdParamInstVO) {
+        try {
+            String paramValue = cmdParamInstVO.getParamValue();
+            BigDecimal pv = toBigDecimal(paramValue);
+            if (cmdParamInstVO.getType().equals(CmdParamUtil.getType(CmdParamUtil.SIGNED))) {
+                BigDecimal minLength = BigDecimal.valueOf((-1) * Math.pow(2, cmdParamInstVO.getLen() - 1));
+                BigDecimal maxLength = BigDecimal.valueOf(Math.pow(2, cmdParamInstVO.getLen() - 1));
+                if (!(pv.compareTo(minLength) >= 0 && pv.compareTo(maxLength) <= 0)) {
+                    cmdParamInstVO.setCompResult(CompResult.OUT_RANGE);
+                }
+            }
+            if (cmdParamInstVO.getType().equals(CmdParamUtil.getType(CmdParamUtil.UNSIGNED))) {
+                BigDecimal maxLength = BigDecimal.valueOf(Math.pow(2, cmdParamInstVO.getLen()));
+                if (!(pv.compareTo(BigDecimal.valueOf(0)) >= 0 && pv.compareTo(maxLength) <= 0)) {
+                    cmdParamInstVO.setCompResult(CompResult.OUT_RANGE);
+                }
+
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static BigDecimal toBigDecimal(String value) throws Exception {
+        BigDecimal pv;
+        if (value.charAt(value.length() - 1) == 'H') {
+            value = value.substring(0, value.length() - 1);
+            pv = new BigDecimal(Long.valueOf(value, 16));
+        } else {
+            pv = new BigDecimal(value);
+        }
+        return pv;
+    }
+
+    /**
+     * 指令参数比较
+     */
+    public static void cmdParamComp(CmdParamInstVO cmdParamInstVO,
+                              StCmdPara stCmdPara,
+                              String ftpId, String taskId, String targetId) {
+        // 单个参数标识
+        switch (cmdParamInstVO.getSingleParamSign()) {
+            case A:
+                // 无操作
+                break;
+            case M:
+            case F:
+            case W:
+            case B:
+                compFileValue(cmdParamInstVO, stCmdPara);
+                break;
+            case C:
+                // 比较填表值(不考虑参数类型)
+                compC(cmdParamInstVO, stCmdPara);
+                break;
+            case D:
+                // 比较标称值
+                compD(cmdParamInstVO, stCmdPara);
+                break;
+            case S:
+                // 第二层指令比对
+                compare(cmdParamInstVO.getCmdInstList(), stCmdPara.getStCmdInfoXDOList(), ftpId, taskId, targetId);
+                break;
+            case T:
+            case V:
+                // 比较填表值(考虑参数类型)
+                compT(cmdParamInstVO, stCmdPara);
+                break;
+            default:
+                break;
+        }
+    }
+
+    public static boolean compFileValue(CmdParamInstVO cmdParamInstVO, StCmdPara stCmdPara) {
+        if (cmdParamInstVO.getFileValue() == null) {
+            cmdParamInstVO.setCompValue("文件值获取失败");
+            cmdParamInstVO.setCompResult(CompResult.COMP_NO_FILE_VALUE);
+            return false;
+        }
+        cmdParamInstVO.setParamValue(cmdParamInstVO.getFileValue());
+        if(cmdParamInstVO.getParamValue().equals(stCmdPara.getSzCalcValue())){
+            stCmdPara.setCompValue(stCmdPara.getSzCalcValue());
+            cmdParamInstVO.setCompValue(cmdParamInstVO.getParamValue());
+            cmdParamInstVO.setCompResult(CompResult.COMP_EQUAL);
+            stCmdPara.setCompResult(CompResult.COMP_EQUAL);
+            return true;
+        }
+
+        return CompUtils.cmdParamValAndRsltFileVal(cmdParamInstVO, stCmdPara);
+    }
+
+    public static boolean compC(CmdParamInstVO cmdParamInstVO, StCmdPara stCmdPara) {
+        cmdParamInstVO.setParamValue(cmdParamInstVO.getValue());
+        cmdParamInstVO.setCompValue(cmdParamInstVO.getParamValue());
+        stCmdPara.setCompValue(stCmdPara.getSzCalcValue());
+        boolean equal = cmdParamInstVO.getCompValue().equals(stCmdPara.getCompValue());
+        if (!equal) {
+            equal = RevCalCompConfigUtils.check(cmdParamInstVO.getCompValue(), stCmdPara.getCompValue(), cmdParamInstVO.getObjectCode(), cmdParamInstVO);
+        }
+        cmdParamInstVO.setCompResult(equal ? CompResult.COMP_EQUAL : CompResult.COMP_NO_EQUAL);
+        stCmdPara.setCompResult(equal ? CompResult.COMP_EQUAL : CompResult.COMP_NO_EQUAL);
+        return equal;
+    }
+
+    public static boolean compD(CmdParamInstVO cmdParamInstVO, StCmdPara stCmdPara) {
+        cmdParamInstVO.setParamValue(cmdParamInstVO.getFix());
+        if(StringUtils.isNotEmpty(cmdParamInstVO.getParamValue()) && cmdParamInstVO.getParamValue().equals(stCmdPara.getSzCalcValue())){
+            stCmdPara.setCompValue(stCmdPara.getSzCalcValue());
+            cmdParamInstVO.setCompValue(cmdParamInstVO.getParamValue());
+            cmdParamInstVO.setCompResult(CompResult.COMP_EQUAL);
+            stCmdPara.setCompResult(CompResult.COMP_EQUAL);
+            return true;
+        }
+        return CompUtils.cmdParamValAndRsltFileVal(cmdParamInstVO, stCmdPara);
+    }
+
+    public static boolean compT(CmdParamInstVO cmdParamInstVO, StCmdPara stCmdPara) {
+        cmdParamInstVO.setParamValue(cmdParamInstVO.getValue());
+        if(StringUtils.isNotEmpty(cmdParamInstVO.getParamValue()) && cmdParamInstVO.getParamValue().equals(stCmdPara.getSzCalcValue())){
+            stCmdPara.setCompValue(stCmdPara.getSzCalcValue());
+            cmdParamInstVO.setCompValue(cmdParamInstVO.getParamValue());
+            cmdParamInstVO.setCompResult(CompResult.COMP_EQUAL);
+            stCmdPara.setCompResult(CompResult.COMP_EQUAL);
+            return true;
+        }
+        return CompUtils.cmdParamValAndRsltFileVal(cmdParamInstVO, stCmdPara);
+    }
+
+    public static void moveCmdOfS(List<CmdInstVO> cmdInstVOList) {
+        if (CollectionsUtils.isNotEmpty(cmdInstVOList)) {
+            Map<Integer, List<CmdInstVO>> CmdInstVOMapToMove = Maps.newHashMap();
+            // 下标偏移量
+            int indexOffset = 0;
+            for (int i = 0; i < cmdInstVOList.size(); i++) {
+                List<CmdParamInstVO> cmdParamInstVOList = cmdInstVOList.get(i).getCmdParamInstList();
+                if (CollectionsUtils.isNotEmpty(cmdParamInstVOList)) {
+                    for (int j = 0; j < cmdParamInstVOList.size(); j++) {
+                        if (ParamSignType.S.equals(cmdParamInstVOList.get(j).getSingleParamSign())) {
+                            if (CollectionsUtils.isNotEmpty(cmdParamInstVOList.get(j).getCmdInstList())) {
+                                if (CollectionsUtils.isNotEmpty(CmdInstVOMapToMove.get(i))) {
+                                    CmdInstVOMapToMove.get(i).addAll(cmdParamInstVOList.get(j).getCmdInstList());
+                                } else {
+                                    CmdInstVOMapToMove.put(i, cmdParamInstVOList.get(j).getCmdInstList());
+                                }
+                                cmdParamInstVOList.get(j).setSingleParamSign(ParamSignType.A);
+                                cmdParamInstVOList.get(j).setCmdInstList(null);
+                            }
+                        }
+                    }
+                }
+            }
+
+            if (!CmdInstVOMapToMove.isEmpty()) {
+                for (Map.Entry<Integer, List<CmdInstVO>> entry : CmdInstVOMapToMove.entrySet()) {
+                    Integer index = entry.getKey();
+                    List<CmdInstVO> cmdInstVOListOfS = entry.getValue();
+                    for (int i = 0; i < cmdInstVOListOfS.size(); i++) {
+                        cmdInstVOList.add(index + indexOffset + 1 + i, cmdInstVOListOfS.get(i));
+                    }
+                    indexOffset += cmdInstVOListOfS.size();
+                }
+            }
+        }
     }
 
-    private static boolean checkAndAddSpecialCmd(List<CmdInstVO> cmdInstVOList, String ftpId, String taskId, String targetId) {
+    public static void checkAndHandlerBW(List<CmdInstVO> cmdInstVOList, List<StCmdInfoXDO> stCmdInfoXDOList, List<String> szDataList, List<String> cmdNumList) {
+
+        //反算指令的下标偏移量
+        int indexOffset = 0;
+        for (int i = 0; i < cmdInstVOList.size(); i++) {
+            CmdInstVO cmdInstVO = cmdInstVOList.get(i);
+            StCmdInfoXDO stCmdInfoXD = stCmdInfoXDOList.get(i);
+            if (CollectionsUtils.isNotEmpty(cmdInstVO.getCmdParamInstList())) {
+                //该指令的全部b类型参数
+                List<CmdParamInstVO> allCmaParamOfBList = com.google.common.collect.Lists.newArrayList();
+                for (CmdParamInstVO cmdParamInstVO : cmdInstVO.getCmdParamInstList()) {
+                    if (ParamSignType.B.equals(cmdParamInstVO.getSingleParamSign()) || ParamSignType.W.equals(cmdParamInstVO.getSingleParamSign())) {
+                        //判断反算是否正常的BW类型
+                        if (!isNormalBW(cmdInstVO, stCmdInfoXD)) {
+                            String value = cmdParamInstVO.getFileValue();
+                            if(StringUtils.isNotEmpty(value) && value.toUpperCase().endsWith("H")){
+                                value = value.substring(0, value.length() - 1);
+                                cmdParamInstVO.setFileValue(value);
+                            }
+                            allCmaParamOfBList.add(cmdParamInstVO);
+                        }
+                    }
+                }
+
+                //含有b类型参数时
+                if (allCmaParamOfBList.size() > 0) {
+                    //1.清空填表指令内的非B类型参数
+                    cmdInstVO.setCmdParamInstList(allCmaParamOfBList);
+                    //填表数据内一条指令生成一遍szData
+                    //对应的szData在szDataList的i号位置,该szData反算出来的指令数目uiCmdNumList的i号位置
+                    //对应反算指令stCmdInfoXDOList[uiCmdNumList(0) + ...  + uiCmdNumList(i - 1), uiCmdNumList(0) + ...  + uiCmdNumList(i) - 1]
+
+                    //2.删除该段反算指令,并填充构建的数据块指令
+                    int cmdNumIndex = 0;
+                    //该反算指令的开始下标
+                    int cmdInfoStartIndex = 0;
+                    while (cmdNumIndex < i) {
+                        cmdInfoStartIndex += Integer.parseInt(cmdNumList.get(cmdNumIndex));
+                        cmdNumIndex++;
+                    }
+
+                    //待删除项目
+                    int delNum = 0;
+                    if (CollectionsUtils.isNotEmpty(cmdNumList) && StringUtils.isNotEmpty(cmdNumList.get(i))) {
+                        delNum = Integer.parseInt(cmdNumList.get(i));
+                    }
+                    //已删除项目
+                    int hasDelNum = 0;
+                    while (hasDelNum < delNum) {
+                        //一直删除该位置的反算指令,直至删除数目达到该段反算指令的数目
+                        stCmdInfoXDOList.remove(cmdInfoStartIndex - indexOffset);
+                        hasDelNum++;
+                    }
+                    //组建反算指令
+                    StCmdInfoXDO stCmdInfoXDO = new StCmdInfoXDO();
+                    stCmdInfoXDO.setSzZlCode(cmdInstVO.getCmdCode());
+                    stCmdInfoXDO.setSzZlName("数据块");
+                    stCmdInfoXDO.setStCmdParaList(com.google.common.collect.Lists.newArrayList());
+                    int cmdParamNum = cmdInstVO.getCmdParamInstList().size();
+                    int temp = 0;
+                    while (temp < cmdParamNum) {
+                        StCmdPara stCmdPara = new StCmdPara();
+                        stCmdPara.setSzValExpln("数据块");
+                        stCmdPara.setSzCalcValue(szDataList.get(i));
+                        stCmdPara.setCompValue(szDataList.get(i));
+                        stCmdInfoXDO.getStCmdParaList().add(stCmdPara);
+                        temp++;
+                    }
+
+                    //添加至反算指令集合,位置为该反算指令的开始下标
+                    stCmdInfoXDOList.add(cmdInfoStartIndex - indexOffset, stCmdInfoXDO);
+                    //反算指令集合被修改,下次循环使用的还是旧下标,所以记录下标偏移量
+                    indexOffset = indexOffset + hasDelNum - 1;
+                }
+            }
+        }
+    }
+
+    public static boolean isNormalBW(CmdInstVO cmdInstVO, StCmdInfoXDO stCmdInfoXDO) {
+        //该指令的全部b类型参数
+        boolean containBW = false;
+        for (CmdParamInstVO cmdParamInstVO : cmdInstVO.getCmdParamInstList()) {
+            if (ParamSignType.B.equals(cmdParamInstVO.getSingleParamSign()) || ParamSignType.W.equals(cmdParamInstVO.getSingleParamSign())) {
+                containBW = true;
+            }
+        }
+        if (containBW && cmdInstVO.getCmdCode().equals(stCmdInfoXDO.getSzZlCode())) {
+            return true;
+        }
+
+        return false;
+    }
+
+
+    private static boolean checkAndAddSpecialCmd(List<CmdInstVO> cmdInstVOList, String ftpId, String taskId, String targetId, List<StCmdInfoXDO> stCmdInfoXDOList) {
         boolean existSpecialCmd = false;
         int indexToReplace = -1;
         List<CmdInstVO> cmdInstVOListToAdd = Lists.newArrayList();
@@ -289,7 +739,7 @@ public class CheckUtil {
                         }
                     }
                     if (GNCF != null) {
-                        handleRpgnCmd(cmdInstVO, GNCF, ftpId, taskId, targetId, "GNCF");
+                        handleRpgncCmd(cmdInstVO, GNCF, ftpId, taskId, targetId, "GNCF");
                         indexToReplace = i;
                         existSpecialCmd = true;
                         break;
@@ -311,13 +761,21 @@ public class CheckUtil {
                     }
                 }
             }
+            // 新增第2圈返回GNC参数设置比对,替换临时做的第二圈反算比对
+            if ("SECOND".equals(cmdInstVO.getCmdCode())) {
+                cmdInstVOListToAdd = handleSECONDCmd(cmdInstVO, targetId, stCmdInfoXDOList, i);
+                indexToReplace = i;
+                existSpecialCmd = true;
+                break;
+            }
         }
 
-        //替换并添加指令
+        // 替换并添加指令
         if (existSpecialCmd && indexToReplace != -1) {
             cmdInstVOList.remove(indexToReplace);
-            for (int i = 0; i < cmdInstVOListToAdd.size(); i ++) {
-                cmdInstVOList.add(cmdInstVOListToAdd.get(i));
+            for (int i = 0; i < cmdInstVOListToAdd.size(); i++) {
+                // 在删除位置添加
+                cmdInstVOList.add(indexToReplace + i, cmdInstVOListToAdd.get(i));
             }
         }
 
@@ -348,7 +806,7 @@ public class CheckUtil {
 
         Target target = InfoHelper.getTargetService().getById(targetId);
 
-        FillConfigVO fillConfigVO = CmpHelper.getFillConfigService().findWithInjTypeAndGenMode(cmdInstVO.getCmdCode(), generateMode, target.getTargetCode());
+        FillConfigVO fillConfigVO = CmpHelper.getFillConfigService().findWithInjTypeAndGenMode(cmdInstVO.getCmdCode(), generateMode, target.getTargetCode(), cmdInstVO.getIsDc());
         if (fillConfigVO == null) {
             throw new RuntimeException("特殊比对[RPPPC]的生成模式[" + generateMode + "]未配置");
         }
@@ -767,7 +1225,7 @@ public class CheckUtil {
         Target target = InfoHelper.getTargetService().findOne(targetId);
 
         String injType = "RACPA";
-        FillConfigVO fillConfigVO = CmpHelper.getFillConfigService().findWithInjTypeAndGenMode(injType, generateMode, target.getTargetCode());
+        FillConfigVO fillConfigVO = CmpHelper.getFillConfigService().findWithInjTypeAndGenMode(injType, generateMode, target.getTargetCode(), cmdInstVO.getIsDc());
         if (fillConfigVO == null) {
             throw new RuntimeException("特殊比对[" + injType + "]的生成模式[" + generateMode + "]未配置");
         }
@@ -979,7 +1437,7 @@ public class CheckUtil {
         Target target = InfoHelper.getTargetService().findOne(targetId);
 
         String injType = "RSBEOD";
-        FillConfigVO fillConfigVO = CmpHelper.getFillConfigService().findWithInjType(injType, target.getTargetCode());
+        FillConfigVO fillConfigVO = CmpHelper.getFillConfigService().findWithInjType(injType, target.getTargetCode(), cmdInstVO.getIsDc());
         if (fillConfigVO == null) {
             throw new RuntimeException("特殊比对[" + injType + "]未配置");
         }
@@ -1083,7 +1541,7 @@ public class CheckUtil {
 
         Target target = InfoHelper.getTargetService().findOne(targetId);
 
-        FillConfigVO fillConfigVO = CmpHelper.getFillConfigService().findWithInjType(cmdInstVO.getCmdCode(), target.getTargetCode());
+        FillConfigVO fillConfigVO = CmpHelper.getFillConfigService().findWithInjType(cmdInstVO.getCmdCode(), target.getTargetCode(), cmdInstVO.getIsDc());
         if (fillConfigVO == null) {
             throw new RuntimeException("特殊比对[" + cmdInstVO.getCmdCode() + "]未配置");
         }
@@ -1172,16 +1630,171 @@ public class CheckUtil {
     }
 
 
-    public static void handleRpgnCmd(CmdInstVO rpgnc, CmdInstVO cmdInstVO, String ftpId, String taskId, String targetId, String type) {
+
+    public static void handleRpgncCmd(CmdInstVO rpgnc, CmdInstVO cmdInstVO, String ftpId, String taskId, String targetId, String type) {
         String rpgncFileName = rpgnc.getCmdParamInstList().get(0).getValue();
         ParamSignType singleParamSign = rpgnc.getCmdParamInstList().get(0).getSingleParamSign();
         if (singleParamSign == ParamSignType.D || singleParamSign == ParamSignType.M) {
             rpgncFileName = rpgnc.getCmdParamInstList().get(0).getParaPath();
         }
 
-        //G
+        // G指令计划起始时间
+        String beginTime = rpgnc.getCmdParamInstList().get(1).getValue();
+        // G指令计划结束时间
+        String endTime = rpgnc.getCmdParamInstList().get(2).getValue();
+
+        // 获取rpgnc文件数据对象
+        String orinServerPath = getServerPath(taskId, targetId, CatalogType.ORIN, null);
+        RpgncXDO rpgncXDO = getFileXDO(ftpId, orinServerPath, rpgncFileName, RpgncXDO.class);
+        if (rpgncXDO == null) {
+            throw new RuntimeErrorException(rpgncFileName + "获取失败");
+        }
+
+        List<StrRpgncBody> filterStrRpngcBodyList = Lists.newArrayList();
+
+        List<StrRpgncBody> strRpgncBodyList = rpgncXDO.getStrRpgncBodyList();
+        if (CollectionsUtils.isNotEmpty(strRpgncBodyList)) {
+            for (StrRpgncBody strRpgncBody : strRpgncBodyList) {
+                if (beginTime.compareTo(strRpgncBody.getCEventTimeSpan()) <= 0
+                        && endTime.compareTo(strRpgncBody.getCEventTimeSpan()) >= 0) {
+                    filterStrRpngcBodyList.add(strRpgncBody);
+                }
+            }
+        }
+
+        if (CollectionsUtils.isEmpty(filterStrRpngcBodyList)) {
+            throw new RuntimeErrorException(rpgncFileName + "无在[" + beginTime + "," + endTime + "]时间范围内的数据");
+        }
+
+        if ("GNCF".equals(type)) {
+            addInnerCmdInstVOByRpgnc(cmdInstVO, filterStrRpngcBodyList, targetId);
+        }
+        if ("GNC02".equals(type)) {
+            fillCmdParamByRpgnc(cmdInstVO, filterStrRpngcBodyList);
+        }
+    }
+
+    public static void addInnerCmdInstVOByRpgnc(CmdInstVO GNCF, List<StrRpgncBody> filterStrRpgncBodyList, String targetId) {
+
+        CmdParamInstVO cmdParamInstVO = GNCF.getCmdParamInstList().get(1);
+        cmdParamInstVO.setSingleParamSign(ParamSignType.S);
+
+        if (null == cmdParamInstVO.getCmdInstList()) {
+            List<CmdInstVO> cmdInstVOList = com.google.common.collect.Lists.newArrayList();
+            cmdParamInstVO.setCmdInstList(cmdInstVOList);
+        }
+
+        List<CmdInstVO> cmdInstVOList = com.google.common.collect.Lists.newArrayList();
+
+        for (StrRpgncBody strRpgncBody : filterStrRpgncBodyList) {
+            CmdVO cmdVO = CmdHelper.getCmdService().getCmdWithParamByTargetIdAndCode(targetId, strRpgncBody.getCEventCode());
+            CmdInstVO innerCmdInstVO = BeanConvertUtils.map(cmdVO, CmdInstVO.class);
+            List<CmdParamInstVO> innerCmdParamInstVOList = JacksonUtils.deserializeList(JacksonUtils.toJsonString(cmdVO.getCmdParamVOList()), CmdParamInstVO.class);
+            innerCmdParamInstVOList.get(0).setSingleParamSign(ParamSignType.V);
+            innerCmdParamInstVOList.get(0).setValue(strRpgncBody.getCEventTimeSpan());
+            innerCmdInstVO.setCmdParamInstList(innerCmdParamInstVOList);
+            cmdInstVOList.add(innerCmdInstVO);
+        }
+        cmdParamInstVO.setCmdInstList(cmdInstVOList);
+    }
+
+    public static void fillCmdParamByRpgnc(CmdInstVO GNC02, List<StrRpgncBody> filterStrRpgncBodyList) {
+        List<CmdParamInstVO> cmdParamInstVOList = GNC02.getCmdParamInstList();
+
+        //全部填上标称值
+        cmdParamInstVOList.forEach(cmdParamInstVO -> {
+            if (StringUtils.isEmpty(cmdParamInstVO.getValue())) {
+                cmdParamInstVO.setSingleParamSign(ParamSignType.V);
+                cmdParamInstVO.setValue(cmdParamInstVO.getFix());
+            }
+        });
+
+        //第26条参数为截取文件的指令个数
+        cmdParamInstVOList.get(25).setSingleParamSign(ParamSignType.V);
+        cmdParamInstVOList.get(25).setValue(String.valueOf(filterStrRpgncBodyList.size()));
+
+        //从45条参数开始填充指令时间
+        int paramIndex = 44;
+        for (StrRpgncBody strRpgncBody : filterStrRpgncBodyList) {
+            if (paramIndex < cmdParamInstVOList.size()) {
+                cmdParamInstVOList.get(paramIndex).setSingleParamSign(ParamSignType.V);
+                cmdParamInstVOList.get(paramIndex).setValue(strRpgncBody.getCEventTimeSpan());
+                paramIndex++;
+
+                cmdParamInstVOList.get(paramIndex).setSingleParamSign(ParamSignType.V);
+                cmdParamInstVOList.get(paramIndex).setValue(strRpgncBody.getCEventCode() + " " + strRpgncBody.getCEventName());
+                paramIndex++;
+            }
+        }
     }
 
-    public static void handleRpgncCmd(CmdInstVO cmdInstVO, CmdInstVO gnc02, String ftpId, String taskId, String targetId, String gnc021) {
+    /**
+     * 处理第二圈反算比对特殊比对功能,指令参数基本固定不变
+     * GF154,GF155,GF156,GF157,GF158,GF159,GF160,GD006,GF759,GF709,GF710,G114,G123,G116,G117,G119,G120,G14
+     *
+     * @param cmdInstVO
+     * @param targetId
+     */
+    public static List<CmdInstVO> handleSECONDCmd(CmdInstVO cmdInstVO, String targetId, List<StCmdInfoXDO> stCmdInfoXDOList, int i) {
+        List<CmdInstVO> cmdInstVOS = com.google.common.collect.Lists.newArrayList();
+        CmdVO GNCF1 = CmdHelper.getCmdService().getCmdWithParamByTargetIdAndCode(targetId, "GNCF1");
+        CmdInstVO gncf1CmdInstVO = CmdConvertUtils.convertCmdVoToCmdInstVo(GNCF1);
+        gncf1CmdInstVO.getCmdParamInstList().get(0).setSingleParamSign(ParamSignType.S);
+        cmdInstVOS.add(gncf1CmdInstVO);
+        List<CmdInstVO> sCmdInstVos = com.google.common.collect.Lists.newArrayList();
+        CmdVO GI017 = CmdHelper.getCmdService().getCmdWithParamByTargetIdAndCode(targetId, "GI017");
+        CmdInstVO gi017 = CmdConvertUtils.convertCmdVoToCmdInstVo(GI017);
+        gi017.getCmdParamInstList().get(0).setSingleParamSign(ParamSignType.C);
+        gi017.getCmdParamInstList().get(0).setValue("66666666H(不允许)");
+        gi017.setSort(0);
+        sCmdInstVos.add(gi017);
+        CmdVO GI002 = CmdHelper.getCmdService().getCmdWithParamByTargetIdAndCode(targetId, "GI002");
+        CmdInstVO gi002 = CmdConvertUtils.convertCmdVoToCmdInstVo(GI002);
+        gi002.getCmdParamInstList().get(0).setSingleParamSign(ParamSignType.C);
+        gi002.getCmdParamInstList().get(0).setValue("ffffffffH(不校)");
+        gi002.setSort(1);
+        sCmdInstVos.add(gi002);
+        CmdVO GI029 = CmdHelper.getCmdService().getCmdWithParamByTargetIdAndCode(targetId, "GI029");
+        CmdInstVO gi029 = CmdConvertUtils.convertCmdVoToCmdInstVo(GI029);
+        gi029.getCmdParamInstList().get(0).setSingleParamSign(ParamSignType.C);
+        gi029.getCmdParamInstList().get(0).setValue("66666666H(19根数)");
+        gi029.setSort(2);
+        sCmdInstVos.add(gi029);
+        CmdVO GI020 = CmdHelper.getCmdService().getCmdWithParamByTargetIdAndCode(targetId, "GI020");
+        CmdInstVO gi020 = CmdConvertUtils.convertCmdVoToCmdInstVo(GI020);
+        gi020.getCmdParamInstList().get(0).setSingleParamSign(ParamSignType.C);
+        gi020.getCmdParamInstList().get(0).setValue("66666666H(不允许)");
+        gi020.setSort(3);
+        sCmdInstVos.add(gi020);
+        List<CmdInstVO> secCmdInstVos = com.google.common.collect.Lists.newArrayList();
+        List<CmdParamInstVO> secondCmdParamInsts = cmdInstVO.getCmdParamInstList();
+        if(stCmdInfoXDOList.size() < secondCmdParamInsts.size() + i + 5){
+            throw new RuntimeErrorException("反算文件格式错误!");
+        }
+        for (int index = 0; index < secondCmdParamInsts.size(); index++) {
+
+            String cmdCode = stCmdInfoXDOList.get(index + i + 5).getSzZlCode();
+            secCmdInstVos.add(CmdConvertUtils.convertCmdVoToCmdInstVo(CmdHelper.getCmdService().getCmdWithParamByTargetIdAndCode(targetId, cmdCode)));
+        }
+
+        for (int index = 0; index < secondCmdParamInsts.size(); index++) {
+            CmdParamInstVO paramInstVO = secondCmdParamInsts.get(index);
+            CmdInstVO cmdInstVO1 = secCmdInstVos.get(index);
+            cmdInstVO1.setSort(index + 4);
+            if (cmdInstVO1.getCmdParamInstList() != null) {
+                cmdInstVO1.getCmdParamInstList().get(0).setValueRange(paramInstVO.getValueRange());
+                cmdInstVO1.getCmdParamInstList().get(0).setSingleParamSign(paramInstVO.getSingleParamSign());
+                cmdInstVO1.getCmdParamInstList().get(0).setFix(paramInstVO.getFix());
+                cmdInstVO1.getCmdParamInstList().get(0).setValue(paramInstVO.getValue());
+                cmdInstVO1.getCmdParamInstList().get(0).setFileValue(paramInstVO.getFileValue());
+            }
+            sCmdInstVos.add(cmdInstVO1);
+        }
+
+        gncf1CmdInstVO.getCmdParamInstList().get(0).setCmdInstList(sCmdInstVos);
+        List<CmdInst> sCmdInsts = BeanConvertUtils.mapAsList(sCmdInstVos, CmdInst.class);
+        String sValue = CmdParamInst.formatValueOfS(sCmdInsts);
+        gncf1CmdInstVO.getCmdParamInstList().get(0).setValue(sValue);
+        return cmdInstVOS;
     }
 }

+ 16 - 0
server/service/service-sys/src/main/java/com/c503/ca/cadv/module/cmp/domain/FillConfig.java

@@ -9,6 +9,7 @@ import com.c503.ca.cadv.common.mvc.domain.IdAutoEntity;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
+import org.apache.commons.lang.StringUtils;
 
 @Data
 @EqualsAndHashCode(callSuper = true)
@@ -57,5 +58,20 @@ public class FillConfig extends IdAutoEntity<String> {
     @TableField("target_code")
     private String targetCode;
 
+    @TableField("is_dc")
+    private Integer isDc;
+
+    @Override
+    public String toString() {
+        return "{" +
+                "injType='" + (StringUtils.isNotEmpty(injType) ? injType : "") + '\'' +
+                ", generateMode='" + (StringUtils.isNotEmpty(generateMode) ? generateMode : "") + '\'' +
+                ", timeOffset=" + (timeOffset != null ? timeOffset.toString() : "") +
+                ", addCmdCode='" + (StringUtils.isNotEmpty(addCmdCode) ? addCmdCode : "") + '\'' +
+                ", delCmdCode='" + (StringUtils.isNotEmpty(delCmdCode) ? delCmdCode : "") + '\'' +
+                ", uppperLimit=" + (uppperLimit != null ? uppperLimit.toString() : "") +
+                ", isDc=" + (isDc != null ? isDc.toString() : "") +
+                '}';
+    }
 
 }

+ 35 - 0
server/service/service-sys/src/main/java/com/c503/ca/cadv/module/cmp/domain/RevCalCmdParam.java

@@ -0,0 +1,35 @@
+package com.c503.ca.cadv.module.cmp.domain;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.c503.ca.cadv.common.mvc.domain.IdAutoEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+@TableName("rev_cal_cmd_param")
+public class RevCalCmdParam extends IdAutoEntity<String> {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableField("config_id")
+    private String configId;
+
+    @TableField("cmd_code")
+    private String cmdCode;
+
+    @TableField("data_no")
+    private String dataNo;
+
+    @TableField("target_code")
+    private String targetCode;
+
+    @TableField(exist = false)
+    private String cmdParamName;
+
+    @TableField(exist = false)
+    private String cmdName;
+}

+ 41 - 0
server/service/service-sys/src/main/java/com/c503/ca/cadv/module/cmp/domain/RevCalConfig.java

@@ -0,0 +1,41 @@
+package com.c503.ca.cadv.module.cmp.domain;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.c503.ca.cadv.common.mvc.domain.IdAutoEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.util.List;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+@TableName("rev_cal_config")
+public class RevCalConfig extends IdAutoEntity<String> {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableField("source_value")
+    private String sourceValue;
+
+    @TableField("target_value")
+    private String targetValue;
+
+    @TableField("target_code")
+    private String targetCode;
+
+    @TableField("type_")
+    private Integer type;
+
+    @TableField("precision_")
+    private String precision;
+
+    @TableField("allowable_error")
+    private String allowableError;
+
+    @TableField(exist = false)
+    private List<RevCalCmdParam> revCalCmdParamList;
+
+}

+ 3 - 0
server/service/service-sys/src/main/java/com/c503/ca/cadv/module/cmp/domain/vo/FillConfigVO.java

@@ -40,4 +40,7 @@ public class FillConfigVO extends DataEntityVO<String> {
     @ApiModelProperty(value = "目标码")
     private String targetCode;
 
+    @ApiModelProperty(value = "是否代传")
+    private Integer isDc;
+
 }

+ 35 - 0
server/service/service-sys/src/main/java/com/c503/ca/cadv/module/cmp/domain/vo/RevCalCmdParamVO.java

@@ -0,0 +1,35 @@
+package com.c503.ca.cadv.module.cmp.domain.vo;
+
+import com.c503.ca.cadv.common.mvc.domain.vo.DataEntityVO;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+@ApiModel(value="RevCalCompCmdParam对象", description="反算比对特殊配置参数绑定")
+public class RevCalCmdParamVO extends DataEntityVO<String> {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "反算比对特殊配置Id")
+    private String configId;
+
+    @ApiModelProperty(value = "指令代号")
+    private String cmdCode;
+
+    @ApiModelProperty(value = "指令参数序号")
+    private String dataNo;
+
+    @ApiModelProperty(value = "目标码")
+    private String targetCode;
+
+    @ApiModelProperty(value = "指令参数名称")
+    private String cmdParamName;
+
+    @ApiModelProperty(value = "参数类型")
+    private Integer type;
+}

+ 35 - 0
server/service/service-sys/src/main/java/com/c503/ca/cadv/module/cmp/domain/vo/RevCalConfigVO.java

@@ -0,0 +1,35 @@
+package com.c503.ca.cadv.module.cmp.domain.vo;
+
+import com.c503.ca.cadv.common.mvc.domain.vo.DataEntityVO;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+@ApiModel(value="RevCalConfig对象", description="反算比对特殊配置")
+public class RevCalConfigVO extends DataEntityVO<String> {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "原值,type为0时有效")
+    private String sourceValue;
+
+    @ApiModelProperty(value = "可匹配值,type为0时有效")
+    private String targetValue;
+
+    @ApiModelProperty(value = "目标码")
+    private String targetCode;
+
+    @ApiModelProperty(value = "类型:0为等价,1为精度")
+    private Integer type;
+
+    @ApiModelProperty(value = "精度,type为1时有效")
+    private String precision;
+
+    @ApiModelProperty(value = "允许误差,type为2时有效")
+    private String allowableError;
+}

+ 8 - 0
server/service/service-sys/src/main/java/com/c503/ca/cadv/module/cmp/repository/RevCalCmdParamRepository.java

@@ -0,0 +1,8 @@
+package com.c503.ca.cadv.module.cmp.repository;
+
+
+import com.c503.ca.cadv.common.mvc.repository.BaseRepository;
+import com.c503.ca.cadv.module.cmp.domain.RevCalCmdParam;
+
+public interface RevCalCmdParamRepository extends BaseRepository<RevCalCmdParam> {
+}

+ 8 - 0
server/service/service-sys/src/main/java/com/c503/ca/cadv/module/cmp/repository/RevCalConfigRepository.java

@@ -0,0 +1,8 @@
+package com.c503.ca.cadv.module.cmp.repository;
+
+
+import com.c503.ca.cadv.common.mvc.repository.BaseRepository;
+import com.c503.ca.cadv.module.cmp.domain.RevCalConfig;
+
+public interface RevCalConfigRepository extends BaseRepository<RevCalConfig> {
+}

+ 42 - 4
server/service/service-sys/src/main/java/com/c503/ca/cadv/module/cmp/service/FillConfigService.java

@@ -4,23 +4,61 @@
 package com.c503.ca.cadv.module.cmp.service;
 
 
+import com.c503.ca.cadv.common.mvc.QueryDetail;
+import com.c503.ca.cadv.common.mvc.domain.IdAutoEntity;
 import com.c503.ca.cadv.common.mvc.service.DataVOService;
 import com.c503.ca.cadv.module.cmp.domain.FillConfig;
 import com.c503.ca.cadv.module.cmp.domain.vo.FillConfigVO;
 import com.c503.ca.cadv.module.cmp.repository.FillConfigRepository;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.StringUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
 @Service
 @Transactional(rollbackFor = Exception.class)
 public class FillConfigService extends DataVOService<FillConfigRepository, FillConfig, FillConfigVO> {
 
 
 
-    public FillConfigVO findWithInjTypeAndGenMode(String injType, String genMode, String targetCode){
-        return copyBeanToVO(findOne(createQuery().lambda().eq(FillConfig::getInjType,injType).eq(FillConfig::getGenerateMode,genMode).eq(FillConfig::getTargetCode, targetCode)));
+    @Override
+    public boolean saveOrUpdate(FillConfigVO entity) {
+        QueryDetail<FillConfig> query = createQuery();
+        if (StringUtils.isEmpty(entity.getGenerateMode())) {
+            entity.setGenerateMode(null);
+            query.lambda().isNull(FillConfig::getGenerateMode);
+        } else {
+            query.lambda().eq(FillConfig::getGenerateMode, entity.getGenerateMode());
+        }
+        query.lambda().eq(FillConfig::getInjType, entity.getInjType())
+                .eq(FillConfig::getIsDc, entity.getIsDc())
+                .eq(FillConfig::getTargetCode, entity.getTargetCode());
+        if (StringUtils.isNotEmpty(entity.getId())) {
+            query.lambda().ne(IdAutoEntity::getId, entity.getId());
+        }
+        if (count(query) > 0) {
+            throw new RuntimeException("保存失败,存在目标码,注入数据,生成模式,是否代传都相同的数据");
+        }
+        return super.saveOrUpdate(entity);
+    }
+
+    public FillConfigVO findWithInjTypeAndGenMode(String injType, String genMode, String targetCode, Integer isDc){
+        return copyBeanToVO(findOne(createQuery().lambda()
+                .eq(FillConfig::getInjType,injType)
+                .eq(FillConfig::getGenerateMode,genMode)
+                .eq(FillConfig::getIsDc, isDc)
+                .eq(FillConfig::getTargetCode, targetCode)));
     }
-    public  FillConfigVO findWithInjType(String injTpye,String targetCode){
-        return  copyBeanToVO(findOne(createQuery().lambda().eq(FillConfig::getInjType,injTpye).eq(FillConfig::getTargetCode, targetCode)));
+    public  FillConfigVO findWithInjType(String injType,String targetCode, Integer isDc){
+        return  copyBeanToVO(findOne(createQuery().lambda()
+                .eq(FillConfig::getInjType,injType)
+                .eq(FillConfig::getIsDc, isDc)
+                .eq(FillConfig::getTargetCode, targetCode)));
     }
+
+
 }

+ 100 - 0
server/service/service-sys/src/main/java/com/c503/ca/cadv/module/cmp/service/RevCalCmdParamService.java

@@ -0,0 +1,100 @@
+package com.c503.ca.cadv.module.cmp.service;
+
+import com.c503.ca.cadv.common.mvc.QueryDetail;
+import com.c503.ca.cadv.common.mvc.domain.IdAutoEntity;
+import com.c503.ca.cadv.common.mvc.service.DataVOService;
+import com.c503.ca.cadv.module.cmp.domain.RevCalCmdParam;
+import com.c503.ca.cadv.module.cmp.domain.vo.RevCalCmdParamVO;
+import com.c503.ca.cadv.module.cmp.repository.RevCalCmdParamRepository;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Service
+@Transactional(rollbackFor = Exception.class)
+public class RevCalCmdParamService extends DataVOService<RevCalCmdParamRepository, RevCalCmdParam, RevCalCmdParamVO> {
+
+    @Override
+    public boolean removeByIds(Collection<? extends Serializable> idList) {
+        return super.physicalRemoveByIds(idList);
+    }
+
+    @Override
+    public boolean saveOrUpdate(RevCalCmdParamVO entity) {
+        QueryDetail<RevCalCmdParam> query = createQuery();
+        query.lambda().eq(RevCalCmdParam::getCmdCode, entity.getCmdCode())
+                .eq(RevCalCmdParam::getDataNo, entity.getDataNo())
+                .eq(RevCalCmdParam::getTargetCode, entity.getTargetCode())
+                .eq(RevCalCmdParam::getConfigId, entity.getConfigId());
+        if (StringUtils.isNotEmpty(entity.getId())) {
+            query.lambda().ne(IdAutoEntity::getId, entity.getId());
+        }
+        if (count(query) > 0) {
+            throw new RuntimeException("保存失败,该指令参数已经绑定过该配置不可重复绑定");
+        }
+        return super.saveOrUpdate(entity);
+    }
+
+    public List<RevCalCmdParam> findByCmdParam(String cmdCode, Integer dataNo, String objectCode) {
+        QueryDetail<RevCalCmdParam> query = createQuery();
+        query.lambda().eq(RevCalCmdParam::getCmdCode, cmdCode)
+                .eq(RevCalCmdParam::getDataNo, dataNo)
+                .eq(RevCalCmdParam::getTargetCode, objectCode);
+        return findAll(query);
+    }
+
+    public List<RevCalCmdParam> findByConfigIds(Collection<? extends Serializable> idList) {
+        QueryDetail<RevCalCmdParam> query = createQuery();
+        query.lambda().in(RevCalCmdParam::getConfigId, idList);
+        return findAll(query);
+    }
+
+    public List<RevCalCmdParam> findByConfigId(String configId) {
+        QueryDetail<RevCalCmdParam> query = createQuery();
+        query.lambda().eq(RevCalCmdParam::getConfigId, configId);
+        return findAll(query);
+    }
+
+    public List<RevCalCmdParam> findByTargetCode(String targetCode) {
+        QueryDetail<RevCalCmdParam> query = createQuery();
+        query.lambda().eq(RevCalCmdParam::getTargetCode, targetCode);
+        return findAll(query);
+    }
+
+    public boolean physicalRemoveByTargetCode(String targetCode) {
+        List<RevCalCmdParam> list = findByTargetCode(targetCode);
+        if (CollectionUtils.isEmpty(list)) {
+            return true;
+        }
+        return physicalRemoveByIds(list.stream().map(IdAutoEntity::getId).collect(Collectors.toList()));
+    }
+
+    public void bindBatch(List<RevCalCmdParamVO> list) {
+        for (RevCalCmdParamVO revCalCmdParamVO : list) {
+            try {
+                saveOrUpdate(revCalCmdParamVO);
+            } catch (Exception e) {
+                throw new RuntimeException("指令代号[" + revCalCmdParamVO.getCmdCode() + "]参数序号[" + revCalCmdParamVO.getDataNo() + "]绑定失败," + e.getMessage());
+            }
+        }
+    }
+
+    public void delByCmdCode(String cmdCode, Integer dataNo,String targetCode) {
+        QueryDetail<RevCalCmdParam> query = createQuery();
+        query.lambda().eq(RevCalCmdParam::getTargetCode, targetCode)
+                .eq(RevCalCmdParam::getCmdCode, cmdCode);
+        if (dataNo != null) {
+            query.lambda().eq(RevCalCmdParam::getDataNo, dataNo);
+        }
+        List<RevCalCmdParam> revCalCmdParamList = findAll(query);
+        if (CollectionUtils.isNotEmpty(revCalCmdParamList)) {
+            physicalRemoveByIds(revCalCmdParamList.stream().map(IdAutoEntity::getId).collect(Collectors.toList()));
+        }
+    }
+}

+ 207 - 0
server/service/service-sys/src/main/java/com/c503/ca/cadv/module/cmp/service/RevCalConfigService.java

@@ -0,0 +1,207 @@
+package com.c503.ca.cadv.module.cmp.service;
+
+import com.c503.ca.cadv.common.mvc.QueryDetail;
+import com.c503.ca.cadv.common.mvc.domain.IdAutoEntity;
+import com.c503.ca.cadv.common.mvc.service.DataVOService;
+import com.c503.ca.cadv.common.util.BeanConvertUtils;
+import com.c503.ca.cadv.common.util.xml.XmlUtils;
+import com.c503.ca.cadv.module.cmp.domain.RevCalCmdParam;
+import com.c503.ca.cadv.module.cmp.domain.RevCalConfig;
+import com.c503.ca.cadv.module.cmp.domain.vo.RevCalConfigVO;
+import com.c503.ca.cadv.module.cmp.repository.RevCalConfigRepository;
+import com.c503.ca.cadv.module.cmp.xml.RevCalCmdParamXml;
+import com.c503.ca.cadv.module.cmp.xml.RevCalConfigXml;
+import com.c503.ca.cadv.module.cmp.xml.RevCalConfigXmlList;
+import com.c503.ca.cadv.module.ge.domain.CmdParamType;
+import com.c503.ca.cadv.module.info.service.TargetService;
+import com.c503.ca.cadv.module.sys.domain.vo.DictVO;
+import com.c503.ca.cadv.module.sys.util.DictUtils;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.io.File;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+@Service
+@Transactional(rollbackFor = Exception.class)
+public class RevCalConfigService extends DataVOService<RevCalConfigRepository, RevCalConfig, RevCalConfigVO> {
+
+    @Resource
+    private RevCalCmdParamService revCalCmdParamService;
+
+    @Resource
+    private TargetService targetService;
+
+    @Override
+    public boolean saveOrUpdate(RevCalConfigVO entity) {
+        Integer type = entity.getType();
+        if (type == 0) {
+            entity.setPrecision("");
+            entity.setAllowableError("");
+        } else if (type == 1) {
+            entity.setSourceValue("");
+            entity.setTargetValue("");
+            entity.setAllowableError("");
+        } else if (type == 2 || type == 3) {
+            entity.setSourceValue("");
+            entity.setTargetValue("");
+            entity.setPrecision("");
+        } else if (type == 4) {
+            entity.setSourceValue("");
+            entity.setTargetValue("");
+            entity.setPrecision("");
+            entity.setAllowableError("");
+        }
+        return super.saveOrUpdate(entity);
+    }
+
+    @Override
+    public boolean removeByIds(Collection<? extends Serializable> idList) {
+        List<String> revCalCmdParamIdList = revCalCmdParamService.findByConfigIds(idList).stream().map(IdAutoEntity::getId).collect(Collectors.toList());
+        revCalCmdParamService.physicalRemoveByIds(revCalCmdParamIdList);
+        return physicalRemoveByIds(idList);
+    }
+
+    public RevCalConfigXmlList generateXml(String targetCode) {
+        RevCalConfigXmlList xmlList = new RevCalConfigXmlList();
+        List<RevCalConfigXml> list = new ArrayList<>();
+        xmlList.setRevCalConfigXmlList(list);
+        QueryDetail<RevCalConfig> query = createQuery();
+        query.lambda().eq(RevCalConfig::getTargetCode, targetCode);
+        List<RevCalConfig> revCalConfigList = findAll(query);
+        if (CollectionUtils.isEmpty(revCalConfigList)) {
+            return null;
+        }
+        for (RevCalConfig revCalConfig : revCalConfigList) {
+            RevCalConfigXml revCalConfigXml = BeanConvertUtils.map(revCalConfig, RevCalConfigXml.class);
+            list.add(revCalConfigXml);
+            List<RevCalCmdParam> revCalCmdParamList = revCalCmdParamService.findByConfigId(revCalConfig.getId());
+            if (CollectionUtils.isNotEmpty(revCalCmdParamList)) {
+                revCalConfigXml.setRevCalCmdParamXmlList(BeanConvertUtils.mapAsList(revCalCmdParamList, RevCalCmdParamXml.class));
+            }
+        }
+
+        return xmlList;
+    }
+
+    public List<RevCalConfig> findByTargetCode(String targetCode) {
+        QueryDetail<RevCalConfig> query = createQuery();
+        query.lambda().eq(RevCalConfig::getTargetCode, targetCode);
+        return findAll(query);
+    }
+
+    public void importFile(File cacheFile, String objectCode) {
+        if (cacheFile.exists()) {
+            try {
+                RevCalConfigXmlList xmlList = null;
+                try {
+                    xmlList = (RevCalConfigXmlList) XmlUtils.fromIgnoreXML(cacheFile, RevCalConfigXmlList.class);
+                } catch (Exception e) {
+                    log.error("xml转换失败");
+                    throw new RuntimeException("xml转换失败");
+                }
+                if (xmlList == null) {
+                    throw new RuntimeException("导入文件为空!");
+                }
+                List<RevCalConfigXml> revCalConfigXmlList = xmlList.getRevCalConfigXmlList();
+                if (CollectionUtils.isNotEmpty(revCalConfigXmlList)) {
+                    List<RevCalConfig> revCalConfigList = new ArrayList<>();
+                    List<RevCalCmdParam> revCalCmdParamList = new ArrayList<>();
+
+                    Set<String> targetCodeSet = revCalConfigXmlList.stream().map(RevCalConfigXml::getTargetCode).collect(Collectors.toSet());
+                    for (RevCalConfigXml revCalConfigXml : revCalConfigXmlList) {
+                        List<RevCalCmdParamXml> revCalCmdParamXmlList = revCalConfigXml.getRevCalCmdParamXmlList();
+
+                        RevCalConfig revCalConfig = BeanConvertUtils.map(revCalConfigXml, RevCalConfig.class);
+                        revCalConfigList.add(revCalConfig);
+                        Integer type = revCalConfig.getType();
+                        if (type == null) {
+                            throw new RuntimeException("类型[type]不能为空!");
+                        }
+                        if (type != 0 && type != 1 && type != 2 && type != 3 && type != 4) {
+                            throw new RuntimeException("类型[type]错误!");
+                        }
+                        if (revCalConfig.getTargetCode() == null) {
+                            throw new RuntimeException("目标码[targetCode]不能为空!");
+                        }
+                        if(!revCalConfigXml.getTargetCode().equals(objectCode)){
+                            throw new RuntimeException("类型[targetCode]不能匹配!");
+                        }
+                        if (type == 0 && (StringUtils.isEmpty(revCalConfig.getSourceValue()) || StringUtils.isEmpty(revCalConfig.getTargetValue()))) {
+                            throw new RuntimeException("类型[type]为0时,原值[sourceValue]和匹配值[targetValue]不能为空!");
+                        }
+                        if (type == 1 && StringUtils.isEmpty(revCalConfig.getPrecision())) {
+                            throw new RuntimeException("类型[type]为1时,精度[precision]不能为空!");
+                        }
+                        if ((type == 2 || type == 3) && StringUtils.isEmpty(revCalConfig.getAllowableError())) {
+                            throw new RuntimeException("类型[type]为2/3时,误差值/有效位[allowableError]不能为空!");
+                        }
+
+                        if (CollectionUtils.isNotEmpty(revCalCmdParamXmlList)) {
+                            targetCodeSet.addAll(revCalCmdParamXmlList.stream().map(RevCalCmdParamXml::getTargetCode).collect(Collectors.toSet()));
+                            List<RevCalCmdParam> list = BeanConvertUtils.mapAsList(revCalCmdParamXmlList, RevCalCmdParam.class);
+                            revCalCmdParamList.addAll(list);
+                            revCalConfig.setRevCalCmdParamList(list);
+                        }
+
+                    }
+                    if (targetCodeSet.size() != 1) {
+                        throw new RuntimeException("导入文件只能存在一种目标码!");
+                    }
+                    for (String targetCode : targetCodeSet) {
+                        boolean success = physicalRemoveByTargetCode(targetCode);
+                        boolean success1 = revCalCmdParamService.physicalRemoveByTargetCode(targetCode);
+                        if (!success || !success1) {
+                            throw new RuntimeException("删除 "+ targetCode +"反算比对规则配置数据失败!");
+                        }
+                    }
+
+                    for (RevCalConfig revCalConfig : revCalConfigList) {
+                        save(revCalConfig);
+                    }
+
+                    for (RevCalConfig revCalConfig : revCalConfigList) {
+                        List<RevCalCmdParam> list = revCalConfig.getRevCalCmdParamList();
+                        if (CollectionUtils.isNotEmpty(list)) {
+                            for (RevCalCmdParam revCalCmdParam : list) {
+                                revCalCmdParam.setConfigId(revCalConfig.getId());
+                            }
+                        }
+                    }
+
+                    revCalCmdParamService.saveOrUpdateBatch(revCalCmdParamList);
+                }
+            } catch (Exception e) {
+                throw new RuntimeException(e.getMessage());
+            }
+        }
+    }
+
+    private boolean physicalRemoveByTargetCode(String targetCode) {
+        List<RevCalConfig> list = findByTargetCode(targetCode);
+        if (CollectionUtils.isEmpty(list)) {
+            return true;
+        }
+        return physicalRemoveByIds(list.stream().map(IdAutoEntity::getId).collect(Collectors.toList()));
+    }
+
+    public List<CmdParamType> getCmdParamTypeList() {
+        List<CmdParamType> result = new ArrayList<>();
+        List<DictVO> dictList = DictUtils.getDictList("dvc_cmd_param_type");
+        for (DictVO dict : dictList) {
+            CmdParamType cmdParamType = new CmdParamType();
+            cmdParamType.setType(Integer.parseInt(dict.getVal()));
+            cmdParamType.setName(dict.getName());
+            result.add(cmdParamType);
+        }
+        return result;
+    }
+}

+ 114 - 0
server/service/service-sys/src/main/java/com/c503/ca/cadv/module/cmp/util/RevCalCompConfigUtils.java

@@ -0,0 +1,114 @@
+package com.c503.ca.cadv.module.cmp.util;
+
+import com.c503.ca.cadv.common.util.CollectionsUtils;
+import com.c503.ca.cadv.common.util.spring.SpringContextHolder;
+import com.c503.ca.cadv.module.cmp.domain.RevCalCmdParam;
+import com.c503.ca.cadv.module.cmp.domain.RevCalConfig;
+import com.c503.ca.cadv.module.cmp.service.RevCalCmdParamService;
+import com.c503.ca.cadv.module.cmp.service.RevCalConfigService;
+import com.c503.ca.cadv.module.plan.domain.vo.CmdParamInstVO;
+import com.c503.ca.cadv.module.plan.util.CompUtils;
+import org.assertj.core.util.Lists;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+public class RevCalCompConfigUtils {
+    private static volatile RevCalConfigService revCalConfigService;
+
+    public static RevCalConfigService getRevCalConfigService() {
+        if (revCalConfigService == null) {
+            synchronized (RevCalConfigService.class) {
+                if (revCalConfigService == null) {
+                    revCalConfigService = SpringContextHolder.getBean(RevCalConfigService.class);
+                }
+            }
+        }
+        return revCalConfigService;
+    }
+
+    private static volatile RevCalCmdParamService revCalCmdParamService;
+
+    public static RevCalCmdParamService getRevCalCmdParamService() {
+        if (revCalCmdParamService == null) {
+            synchronized (RevCalCmdParamService.class) {
+                if (revCalCmdParamService == null) {
+                    revCalCmdParamService = SpringContextHolder.getBean(RevCalCmdParamService.class);
+                }
+            }
+        }
+        return revCalCmdParamService;
+    }
+
+    public static boolean check(String value1, String value2, String objectCode, CmdParamInstVO cmdParamInstVO) {
+        List<RevCalCmdParam> revCalCmdParamList = getRevCalCmdParamService().findByCmdParam(cmdParamInstVO.getCmdCode(), cmdParamInstVO.getDataNo(), objectCode);
+        if (CollectionsUtils.isEmpty(revCalCmdParamList)) {
+            return false;
+        }
+        for (RevCalCmdParam revCalCmdParam : revCalCmdParamList) {
+            if (checkOne(value1, value2, revCalCmdParam)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public static boolean checkOne(String value1, String value2, RevCalCmdParam revCalCmdParam) {
+        RevCalConfig revCalConfig = getRevCalConfigService().findOne(revCalCmdParam.getConfigId());
+        if (revCalConfig == null) {
+            return false;
+        }
+        Integer type = revCalConfig.getType();
+        if (type == 0) {
+            String sourceValue = revCalConfig.getSourceValue();
+            String targetValue = revCalConfig.getTargetValue();
+            if (!sourceValue.equals(value1) && !sourceValue.equals(value2)) {
+                return false;
+            }
+            List<String> targetValueList = Lists.newArrayList(targetValue.split(","));
+            if ((sourceValue.equals(value1) && !targetValueList.contains(value2)) || (sourceValue.equals(value2) && !targetValueList.contains(value1))) {
+                return false;
+            }
+        } else if (type == 1){
+            try {
+                if ("0".equals(revCalConfig.getPrecision())) {
+                    return true;
+                }
+                BigDecimal bigDecimal1 = new BigDecimal(value1);
+                BigDecimal bigDecimal2 = new BigDecimal(value2);
+                BigDecimal precision = new BigDecimal(revCalConfig.getPrecision());
+                bigDecimal1 = bigDecimal1.divide(precision).setScale(0, BigDecimal.ROUND_DOWN);
+                bigDecimal2 = bigDecimal2.divide(precision).setScale(0, BigDecimal.ROUND_DOWN);
+                return bigDecimal1.compareTo(bigDecimal2) == 0 ? true : false;
+            } catch (Exception e) {
+                return false;
+            }
+        } else if (type == 2) {
+            try {
+                BigDecimal bigDecimal1 = new BigDecimal(value1);
+                BigDecimal bigDecimal2 = new BigDecimal(value2);
+                return bigDecimal1.subtract(bigDecimal2).abs().subtract(new BigDecimal(revCalConfig.getAllowableError())).compareTo(new BigDecimal("0")) == 1 ? false : true;
+            } catch (Exception e) {
+                return false;
+            }
+        } else if (type == 3) {
+            try {
+                String allowableError = revCalConfig.getAllowableError();
+                BigDecimal bigDecimal = new BigDecimal(allowableError);
+                //bigDecimal = bigDecimal.setScale(0, RoundingMode.HALF_UP);
+                BigDecimal bigDecimal1 = new BigDecimal(value1);
+                BigDecimal bigDecimal2 = new BigDecimal(value2);
+                bigDecimal1 = CompUtils.validDigital1(bigDecimal1, bigDecimal.intValue());
+                bigDecimal2 = CompUtils.validDigital1(bigDecimal2, bigDecimal.intValue());
+                return bigDecimal1.compareTo(bigDecimal2) == 0 ? true : false;
+            } catch (Exception e) {
+                return false;
+            }
+        } else if (type == 4) {
+            return true;
+        } else {
+            return false;
+        }
+        return true;
+    }
+}

+ 80 - 0
server/service/service-sys/src/main/java/com/c503/ca/cadv/module/cmp/web/FillConfigResource.java

@@ -0,0 +1,80 @@
+/*
+* Copyright &copy; 2020-2021  c503-htphy All rights reserved.
+*/
+package com.c503.ca.cadv.module.cmp.web;
+
+import com.c503.ca.cadv.common.rest.base.DataVOResource;
+import com.c503.ca.cadv.common.util.JacksonUtils;
+import com.c503.ca.cadv.common.util.domain.CustomMessage;
+import com.c503.ca.cadv.common.util.domain.PageModel;
+import com.c503.ca.cadv.common.util.domain.ResultBuilder;
+import com.c503.ca.cadv.module.cmp.domain.vo.FillConfigVO;
+import com.c503.ca.cadv.module.cmp.service.FillConfigService;
+import com.c503.ca.cadv.module.config.annotation.RepeatSubmit;
+import com.c503.ca.cadv.module.log.util.MyLog;
+import com.c503.ca.cadv.module.log.util.OperateType;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.google.common.collect.Lists;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+
+/**
+* <p>
+* 比对信息填充配制表 控制器
+* </p>
+*
+* @author jintch
+*/
+@RestController
+@RequestMapping("/cmp/fill-config")
+@Api(tags = "cmp_FillConfig")
+public class FillConfigResource extends DataVOResource<FillConfigService, FillConfigVO> {
+    public FillConfigResource(FillConfigService service) {
+        super(service);
+    }
+
+    @GetMapping(value = "/")
+    @ApiOperation(value = "获取比对信息填充配制表列表", notes = "根据分页参数,获取分页列表")
+    public ResponseEntity<CustomMessage<JsonNode>> getPage(PageModel pm) {
+        service.findVOPage(pm);
+        JsonNode rs = JacksonUtils.toJsonNodeWithDefaultMapper(pm);
+        return ResultBuilder.buildObject(rs);
+    }
+
+    /**
+    * 保存 比对信息填充配制表
+    */
+    @PostMapping(value = "/", produces = MediaType.APPLICATION_JSON_VALUE)
+    @ApiOperation(value = "保存比对信息填充配制表", notes = "")
+    @MyLog(value = "保存比对信息填充配制", type = "id", model = "注入数据配置")
+    @RepeatSubmit
+    public ResponseEntity<CustomMessage<FillConfigVO>> save(@Valid @RequestBody FillConfigVO vo) {
+        try {
+            boolean success = service.saveOrUpdate(vo);
+            if (success) {
+                return ResultBuilder.buildOk(vo, "保存成功");
+            } else {
+                return ResultBuilder.buildFailed("保存失败");
+            }
+        } catch (Exception e) {
+            return ResultBuilder.buildFailed(e.getMessage());
+        }
+    }
+
+    /**
+    * 批量删除
+    */
+    @PostMapping(value = "/del")
+    @ApiOperation(value = "删除实体", notes = "批量删除,ID通过逗号分隔")
+    @MyLog(value = "删除比对信息填充配制", type = OperateType.DELETE, model = "注入数据配置")
+    public ResponseEntity<CustomMessage<String>> delete(@RequestBody String[] ids) {
+        service.removeByIds(Lists.newArrayList(ids));
+        return ResultBuilder.buildOk("删除成功");
+    }
+
+}

+ 104 - 0
server/service/service-sys/src/main/java/com/c503/ca/cadv/module/cmp/web/RevCalCmdParamResource.java

@@ -0,0 +1,104 @@
+package com.c503.ca.cadv.module.cmp.web;
+
+import com.c503.ca.cadv.common.rest.base.DataVOResource;
+import com.c503.ca.cadv.common.util.JacksonUtils;
+import com.c503.ca.cadv.common.util.domain.CustomMessage;
+import com.c503.ca.cadv.common.util.domain.PageModel;
+import com.c503.ca.cadv.common.util.domain.ResultBuilder;
+import com.c503.ca.cadv.module.cmp.domain.vo.RevCalCmdParamVO;
+import com.c503.ca.cadv.module.cmp.service.RevCalCmdParamService;
+import com.c503.ca.cadv.module.config.annotation.RepeatSubmit;
+import com.c503.ca.cadv.module.ge.domain.CmdAndCmdParam;
+import com.c503.ca.cadv.module.ge.service.CmdParamService;
+import com.c503.ca.cadv.module.log.util.MyLog;
+import com.c503.ca.cadv.module.log.util.OperateType;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.google.common.collect.Lists;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.collections.CollectionUtils;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.validation.Valid;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@RestController
+@RequestMapping("/cmp/rev-cal-cmd-param")
+@Api(tags = "cmp_RevCalCmdParam")
+public class RevCalCmdParamResource extends DataVOResource<RevCalCmdParamService, RevCalCmdParamVO> {
+    public RevCalCmdParamResource(RevCalCmdParamService service) {
+        super(service);
+    }
+
+    @Resource
+    private CmdParamService cmdParamService;
+
+    @GetMapping(value = "/")
+    @ApiOperation(value = "获取反算比对特殊配置参数绑定列表", notes = "根据分页参数,获取分页列表")
+    public ResponseEntity<CustomMessage<JsonNode>> getPage(PageModel pm) {
+        service.findVOPage(pm);
+        List<RevCalCmdParamVO> data = pm.getData();
+        if (CollectionUtils.isNotEmpty(data)) {
+            List<CmdAndCmdParam> cmdParamList = cmdParamService.findParamByObjCode(data.get(0).getTargetCode());
+            if (CollectionUtils.isNotEmpty(cmdParamList)) {
+                Map<String, CmdAndCmdParam> map = new HashMap<>();
+                for (CmdAndCmdParam cmdParam : cmdParamList) {
+                    map.put(cmdParam.getCmdCode() + "-" + cmdParam.getDataNo(), cmdParam);
+                }
+                for (RevCalCmdParamVO revCalCmdParamVO : data) {
+                    CmdAndCmdParam cmdParam = map.get(revCalCmdParamVO.getCmdCode() + "-" + revCalCmdParamVO.getDataNo());
+                    if (cmdParam != null) {
+                        revCalCmdParamVO.setCmdParamName(cmdParam.getExplain());
+                        revCalCmdParamVO.setType(cmdParam.getType());
+                    }
+                };
+            }
+        }
+        JsonNode rs = JacksonUtils.toJsonNodeWithDefaultMapper(pm);
+        return ResultBuilder.buildObject(rs);
+    }
+
+    /**
+     * 保存 比对信息填充配制表
+     */
+    @PostMapping(value = "/", produces = MediaType.APPLICATION_JSON_VALUE)
+    @ApiOperation(value = "保存", notes = "")
+    @MyLog(value = "保存反算比对特殊配置参数绑定", type = "id", model = "注入数据配置")
+    @RepeatSubmit
+    public ResponseEntity<CustomMessage<RevCalCmdParamVO>> save(@Valid @RequestBody RevCalCmdParamVO vo) {
+        try {
+            boolean success = service.saveOrUpdate(vo);
+            if (success) {
+                return ResultBuilder.buildOk(vo, "保存成功");
+            } else {
+                return ResultBuilder.buildFailed("保存失败");
+            }
+        } catch (Exception e) {
+            return ResultBuilder.buildFailed(e.getMessage());
+        }
+    }
+
+    /**
+     * 批量删除
+     */
+    @PostMapping(value = "/del")
+    @ApiOperation(value = "删除实体", notes = "批量删除,ID通过逗号分隔")
+    @MyLog(value = "删除反算比对特殊配置参数绑定", type = OperateType.DELETE, model = "注入数据配置")
+    public ResponseEntity<CustomMessage<String>> delete(@RequestBody String[] ids) {
+        service.removeByIds(Lists.newArrayList(ids));
+        return ResultBuilder.buildOk("删除成功");
+    }
+
+    @PostMapping(value = "/bindBatch")
+    @ApiOperation(value = "批量绑定", notes = "")
+    @RepeatSubmit
+    public ResponseEntity<CustomMessage<String>> bindBatch(@RequestBody List<RevCalCmdParamVO> list) {
+        service.bindBatch(list);
+        return ResultBuilder.buildOk("保存成功");
+    }
+}

+ 130 - 0
server/service/service-sys/src/main/java/com/c503/ca/cadv/module/cmp/web/RevCalConfigResource.java

@@ -0,0 +1,130 @@
+package com.c503.ca.cadv.module.cmp.web;
+
+import com.c503.ca.cadv.common.config.SystemProperties;
+import com.c503.ca.cadv.common.rest.base.DataVOResource;
+import com.c503.ca.cadv.common.util.FileUtils;
+import com.c503.ca.cadv.common.util.IdGen;
+import com.c503.ca.cadv.common.util.JacksonUtils;
+import com.c503.ca.cadv.common.util.domain.CustomMessage;
+import com.c503.ca.cadv.common.util.domain.PageModel;
+import com.c503.ca.cadv.common.util.domain.ResultBuilder;
+import com.c503.ca.cadv.common.util.xml.XmlUtils;
+import com.c503.ca.cadv.module.cmp.domain.vo.RevCalConfigVO;
+import com.c503.ca.cadv.module.cmp.service.RevCalConfigService;
+import com.c503.ca.cadv.module.cmp.xml.RevCalConfigXmlList;
+import com.c503.ca.cadv.module.config.annotation.RepeatSubmit;
+import com.c503.ca.cadv.module.ge.domain.CmdParamType;
+import com.c503.ca.cadv.module.log.util.MyLog;
+import com.c503.ca.cadv.module.log.util.OperateType;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.google.common.collect.Lists;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.validation.Valid;
+import java.io.File;
+import java.util.List;
+
+
+@RestController
+@RequestMapping("/cmp/rev-cal")
+@Api(tags = "cmp_RevCalConfig")
+public class RevCalConfigResource extends DataVOResource<RevCalConfigService, RevCalConfigVO> {
+    public RevCalConfigResource(RevCalConfigService service) {
+        super(service);
+    }
+
+    @GetMapping(value = "/")
+    @ApiOperation(value = "获取反算比对特殊配置列表", notes = "根据分页参数,获取分页列表")
+    public ResponseEntity<CustomMessage<JsonNode>> getPage(PageModel pm) {
+        service.findVOPage(pm);
+        JsonNode rs = JacksonUtils.toJsonNodeWithDefaultMapper(pm);
+        return ResultBuilder.buildObject(rs);
+    }
+
+    /**
+    * 保存 比对信息填充配制表
+    */
+    @PostMapping(value = "/", produces = MediaType.APPLICATION_JSON_VALUE)
+    @ApiOperation(value = "保存", notes = "")
+    @MyLog(value = "保存反算比对特殊配置", type = "id", model = "注入数据配置")
+    @RepeatSubmit
+    public ResponseEntity<CustomMessage<RevCalConfigVO>> save(@Valid @RequestBody RevCalConfigVO vo) {
+        try {
+            boolean success = service.saveOrUpdate(vo);
+            if (success) {
+                return ResultBuilder.buildOk(vo, "保存成功");
+            } else {
+                return ResultBuilder.buildFailed("保存失败");
+            }
+        } catch (Exception e) {
+            return ResultBuilder.buildFailed(e.getMessage());
+        }
+    }
+
+    /**
+    * 批量删除
+    */
+    @PostMapping(value = "/del")
+    @ApiOperation(value = "删除实体", notes = "批量删除,ID通过逗号分隔")
+    @MyLog(value = "删除反算比对特殊配置", type = OperateType.DELETE, model = "注入数据配置")
+    public ResponseEntity<CustomMessage<String>> delete(@RequestBody String[] ids) {
+        service.removeByIds(Lists.newArrayList(ids));
+        return ResultBuilder.buildOk("删除成功");
+    }
+
+    @GetMapping("export")
+    @ApiOperation(value = "导出反算比对规则配置")
+    public void export(@RequestParam("targetCode") String targetCode) {
+        RevCalConfigXmlList xmlList = service.generateXml(targetCode);
+        if (xmlList == null) {
+            throw new RuntimeException("该目标无反算比对规则配置");
+        }
+        String filePath = SystemProperties.getInstance().getFileDownloadPath() + "/" + IdGen.uuid() + "/";
+        String fileName = targetCode + ".xml";
+        FileUtils.createFile(filePath + fileName);
+        FileUtils.writeFile(filePath + fileName, XmlUtils.toIgnoreFieldXML(xmlList));
+        try {
+            FileUtils.downloadFile(response(), fileName, filePath + fileName);
+        } catch (Exception e) {
+            log.error("下载失败:{}", e.getMessage());
+        } finally {
+            new File(filePath + fileName).delete();
+            new File(filePath).delete();
+        }
+    }
+
+    @PostMapping("import")
+    @ApiOperation(value = "导入反算比对规则配置")
+    public ResponseEntity<CustomMessage<String>> importFile(@RequestParam MultipartFile file, @RequestParam("targetCode") String targetCode) {
+
+        String path = SystemProperties.getInstance().getFileUploadPath() + "/" + IdGen.uuid() + "_" + file.getOriginalFilename();
+        File cacheFile = null;
+        try {
+            boolean success = FileUtils.createFile(path);
+            if (!success) {
+                throw new RuntimeException("本地缓存文件创建失败!");
+            }
+            cacheFile = new File(path);
+            FileUtils.upload(file, cacheFile);
+            service.importFile(cacheFile, targetCode);
+        } catch (Exception e) {
+            return ResultBuilder.buildFailed("导入失败!" + e);
+        } finally {
+
+        }
+        return ResultBuilder.buildOk("导入成功!");
+    }
+
+
+    @GetMapping(value = "/getCmdParamType")
+    @ApiOperation(value = "获取参数类型", notes = "")
+    public ResponseEntity<CustomMessage<List<CmdParamType>>> getCmdParamTypeList() {
+        List<CmdParamType> cmdParamTypeList =  service.getCmdParamTypeList();
+        return ResultBuilder.buildDataOk(cmdParamTypeList);
+    }
+}

+ 23 - 0
server/service/service-sys/src/main/java/com/c503/ca/cadv/module/cmp/xml/RevCalCmdParamXml.java

@@ -0,0 +1,23 @@
+package com.c503.ca.cadv.module.cmp.xml;
+
+import com.thoughtworks.xstream.annotations.XStreamAlias;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@XStreamAlias("revCalCmdParam")
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class RevCalCmdParamXml {
+
+    @XStreamAlias("cmdCode")
+    private String cmdCode;
+
+    @XStreamAlias("dataNo")
+    private String dataNo;
+
+    @XStreamAlias("targetCode")
+    private String targetCode;
+
+}

+ 38 - 0
server/service/service-sys/src/main/java/com/c503/ca/cadv/module/cmp/xml/RevCalConfigXml.java

@@ -0,0 +1,38 @@
+package com.c503.ca.cadv.module.cmp.xml;
+
+import com.thoughtworks.xstream.annotations.XStreamAlias;
+import com.thoughtworks.xstream.annotations.XStreamImplicit;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+@XStreamAlias("revCalConfig")
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class RevCalConfigXml {
+
+    @XStreamAlias("sourceValue")
+    private String sourceValue;
+
+    @XStreamAlias("targetValue")
+    private String targetValue;
+
+    @XStreamAlias("targetCode")
+    private String targetCode;
+
+    @XStreamAlias("type")
+    private Integer type;
+
+    @XStreamAlias("precision")
+    private String precision;
+
+    @XStreamAlias("allowableError")
+    private String allowableError;
+
+    @XStreamAlias("revCalCmdParam")
+    @XStreamImplicit
+    private List<RevCalCmdParamXml> revCalCmdParamXmlList;
+}

+ 21 - 0
server/service/service-sys/src/main/java/com/c503/ca/cadv/module/cmp/xml/RevCalConfigXmlList.java

@@ -0,0 +1,21 @@
+package com.c503.ca.cadv.module.cmp.xml;
+
+import com.thoughtworks.xstream.annotations.XStreamAlias;
+import com.thoughtworks.xstream.annotations.XStreamImplicit;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+@XStreamAlias("revCalConfigList")
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class RevCalConfigXmlList {
+
+    @XStreamAlias("revCalConfig")
+    @XStreamImplicit
+    private List<RevCalConfigXml> revCalConfigXmlList;
+
+}

+ 15 - 0
server/service/service-sys/src/main/java/com/c503/ca/cadv/module/ge/domain/CmdParamType.java

@@ -0,0 +1,15 @@
+package com.c503.ca.cadv.module.ge.domain;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class CmdParamType {
+
+    private Integer type;
+
+    private String name;
+}

+ 6 - 0
server/service/service-sys/src/main/java/com/c503/ca/cadv/module/ge/repository/CmdParamRepository.java

@@ -4,7 +4,11 @@
 package com.c503.ca.cadv.module.ge.repository;
 
 import com.c503.ca.cadv.common.mvc.repository.BaseRepository;
+import com.c503.ca.cadv.module.ge.domain.CmdAndCmdParam;
 import com.c503.ca.cadv.module.ge.domain.CmdParam;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
 
 /**
  * <p>
@@ -13,7 +17,9 @@ import com.c503.ca.cadv.module.ge.domain.CmdParam;
  *
  * @author jintch
  */
+@Repository
 public interface CmdParamRepository extends BaseRepository<CmdParam> {
 
 
+    List<CmdAndCmdParam> findParamByObjCode(String objectCode);
 }

+ 4 - 0
server/service/service-sys/src/main/java/com/c503/ca/cadv/module/ge/service/CmdParamService.java

@@ -4,6 +4,7 @@
 package com.c503.ca.cadv.module.ge.service;
 
 import com.c503.ca.cadv.common.mvc.service.DataVOService;
+import com.c503.ca.cadv.module.ge.domain.CmdAndCmdParam;
 import com.c503.ca.cadv.module.ge.domain.CmdParam;
 import com.c503.ca.cadv.module.ge.domain.vo.CmdParamVO;
 import com.c503.ca.cadv.module.ge.repository.CmdParamRepository;
@@ -28,4 +29,7 @@ public class CmdParamService extends DataVOService<CmdParamRepository, CmdParam,
         return findAllVO(createQuery().lambda().eq(CmdParam::getCmdId, cmdId));
     }
 
+    public List<CmdAndCmdParam> findParamByObjCode(String objectCode) {
+        return repository.findParamByObjCode(objectCode);
+    }
 }

+ 24 - 1
server/service/service-sys/src/main/java/com/c503/ca/cadv/module/plan/domain/CmdInst.java

@@ -16,7 +16,7 @@ import java.util.List;
 @Data
 @Accessors(chain = true)
 @TableName("inj_cmd_inst")
-public class CmdInst extends IdAutoEntity<String> {
+public class CmdInst extends IdAutoEntity<String> implements Comparable<CmdInst>{
 
     @TableField("file_data_id")
     private String fileDataId;
@@ -86,4 +86,27 @@ public class CmdInst extends IdAutoEntity<String> {
         text.append(enter);
         return text.toString();
     }
+
+    @Override
+    public int compareTo(CmdInst cmdInst) {
+        return this.sort - cmdInst.sort > 0 ? 1 : -1;
+    }
+
+    public String formatValueOfS() {
+        String and = "&";
+        StringBuilder text = new StringBuilder();
+        text.append(getPlanManualMark()).append(and).append(and);
+        text.append(getCmdCode()).append(and);
+        text.append(getSign()).append(and);
+        text.append(getPackageSign()).append(and);
+        text.append(getPackageNo()).append(and);
+        text.append(getField()).append(and);
+        text.append(getAllParamSign()).append(and);
+
+        List<CmdParamInst> cmdParamInstList = getCmdParamInstList();
+        for (CmdParamInst cmdParamInst : cmdParamInstList) {
+            text.append(cmdParamInst.formatValueOfS());
+        }
+        return text.toString();
+    }
 }

+ 30 - 0
server/service/service-sys/src/main/java/com/c503/ca/cadv/module/plan/domain/CmdParamInst.java

@@ -73,6 +73,21 @@ public class CmdParamInst extends IdAutoEntity<String> implements Comparable<Cmd
     @TableField(exist = false)
     private List<CmdInst> cmdInstList;
 
+    public static String formatValueOfS(List<CmdInst> cmdInstList) {
+        if (cmdInstList != null) {
+            StringBuilder text = new StringBuilder();
+            cmdInstList.sort(CmdInst::compareTo);
+            for (int i = 0; i < cmdInstList.size(); i++) {
+                text.append(cmdInstList.get(i).formatValueOfS());
+                if (i != (cmdInstList.size() - 1)) {
+                    text.append(";");
+                }
+            }
+            return text.toString();
+        }
+        return null;
+    }
+
     @Override
     public int compareTo(CmdParamInst cmdParamInst) {
         return this.dataNo - cmdParamInst.dataNo > 0 ? 1 : -1;
@@ -91,4 +106,19 @@ public class CmdParamInst extends IdAutoEntity<String> implements Comparable<Cmd
         }
         return this.value;
     }
+
+    public String formatValueOfS() {
+        String and = "&";
+        StringBuilder text = new StringBuilder();
+        text.append(getDataNo()).append(and).append(getSingleParamSign().getValue()).append(and).append(formatValueInS()).append(and);
+        return text.toString();
+    }
+
+    public String formatValueInS() {
+        if (getSingleParamSign().equals(ParamSignType.D)) {
+            return "";
+        }
+        return this.value;
+    }
+
 }

+ 2 - 0
server/service/service-sys/src/main/java/com/c503/ca/cadv/module/plan/domain/vo/CmdInstVO.java

@@ -60,4 +60,6 @@ public class CmdInstVO extends DataEntityVO<String> {
 
     @ApiModelProperty(value = "目标码")
     private String objectCode;
+
+    private Integer isDc;
 }

+ 10 - 0
server/service/service-sys/src/main/java/com/c503/ca/cadv/module/plan/domain/vo/CmdParamInstVO.java

@@ -79,4 +79,14 @@ public class CmdParamInstVO extends DataEntityVO<String> {
 
     @ApiModelProperty(value = "当单个参数标识为S时的值")
     private List<CmdInstVO> cmdInstList;
+
+    private String objectCode;
+
+    private String cmdCode;
+
+    private String paramValue;
+
+    private String compValue;
+
+    private Integer compResult;
 }

+ 43 - 0
server/service/service-sys/src/main/java/com/c503/ca/cadv/module/plan/util/CmdConvertUtils.java

@@ -0,0 +1,43 @@
+package com.c503.ca.cadv.module.plan.util;
+
+import com.c503.ca.cadv.module.ge.domain.enums.ParamSignType;
+import com.c503.ca.cadv.module.ge.domain.vo.CmdParamVO;
+import com.c503.ca.cadv.module.ge.domain.vo.CmdVO;
+import com.c503.ca.cadv.module.plan.domain.vo.CmdInstVO;
+import com.c503.ca.cadv.module.plan.domain.vo.CmdParamInstVO;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.compress.utils.Lists;
+
+import java.util.List;
+
+public class CmdConvertUtils {
+
+    public static CmdInstVO convertCmdVoToCmdInstVo(CmdVO cmdVO){
+        CmdInstVO cmdInstVO = new CmdInstVO();
+        //设置指令
+        cmdInstVO.setCmdCode(cmdVO.getCmdCode());
+        cmdInstVO.setCmdName(cmdVO.getCmdName());
+        cmdInstVO.setKeyStr(cmdVO.getKeyStr());
+        cmdInstVO.setObjectCode(cmdVO.getObjectCode());
+        List<CmdParamVO> cmdParamList = cmdVO.getCmdParamVOList();
+        if(CollectionUtils.isNotEmpty(cmdParamList)){
+            List<CmdParamInstVO> cmdParamInstVOList = Lists.newArrayList();
+            for(CmdParamVO cmdParamVO: cmdParamList){
+                CmdParamInstVO cmdParamInstVO = new CmdParamInstVO();
+                cmdParamInstVO.setCode(cmdParamVO.getCode());
+                cmdParamInstVO.setSingleParamSign(ParamSignType.D);
+                cmdParamInstVO.setExplain(cmdParamVO.getExplain());
+                cmdParamInstVO.setType(cmdParamVO.getType() == null ? null : cmdParamVO.getType().toString());
+                cmdParamInstVO.setLen(cmdParamVO.getLen());
+                cmdParamInstVO.setDimen(cmdParamVO.getDimen());
+                cmdParamInstVO.setValueRange(cmdParamVO.getValueRange());
+                cmdParamInstVO.setParaPath(cmdParamVO.getParaPath());
+                cmdParamInstVO.setFix(cmdParamVO.getFix());
+                cmdParamInstVOList.add(cmdParamInstVO);
+            }
+            cmdInstVO.setCmdParamInstList(cmdParamInstVOList);
+        }
+
+        return cmdInstVO;
+    }
+}

+ 403 - 0
server/service/service-sys/src/main/java/com/c503/ca/cadv/module/plan/util/CompUtils.java

@@ -0,0 +1,403 @@
+package com.c503.ca.cadv.module.plan.util;
+
+import com.c503.ca.cadv.common.util.DateUtils;
+import com.c503.ca.cadv.common.util.JacksonUtils;
+import com.c503.ca.cadv.module.check.domain.CompResult;
+import com.c503.ca.cadv.module.check.domain.StCmdPara;
+import com.c503.ca.cadv.module.cmp.util.RevCalCompConfigUtils;
+import com.c503.ca.cadv.module.ge.util.CmdParamUtil;
+import com.c503.ca.cadv.module.plan.domain.vo.CmdParamInstVO;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
+
+import java.math.BigDecimal;
+import java.math.MathContext;
+import java.math.RoundingMode;
+import java.util.Date;
+import java.util.TimeZone;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+@Slf4j
+public class CompUtils {
+
+    public static final int PRECISION_THIRTEEN = 15;
+    public static final int PRECISION_SEVEN = 7;
+
+    public static final String ABS_TIME = "ABS_TIME";
+    public static final String RLT_TIME = "RLT_TIME";
+    public static final String FLOAT = "FLOAT";
+
+    /**
+     * 根据参数类型,参数值与反算值比对
+     */
+    public static boolean cmdParamValAndRsltFileVal(CmdParamInstVO cmdParamInstVO, StCmdPara stCmdPara) {
+        String paramValue = cmdParamInstVO.getParamValue();
+        String szCalcValue = stCmdPara.getSzCalcValue();
+        switch (CmdParamUtil.getTypeCode(cmdParamInstVO.getType())) {
+            case CmdParamUtil.SIGNED: // 0
+            case CmdParamUtil.UNSIGNED: // 1
+            case CmdParamUtil.STD_FLOAT: // 2
+            case CmdParamUtil.USTD_FLOAT: // 3
+            case CmdParamUtil.USTD_INT: // 9
+            case CmdParamUtil.FLOAT_ABSTIME: // 10
+            case CmdParamUtil.FILL_FOALT: // 17
+                return numWithNum(cmdParamInstVO, stCmdPara, paramValue, szCalcValue);
+            case CmdParamUtil.URLTTIME: // 4
+                return rltTimeOrFloatWithRltTimeOrFloat(cmdParamInstVO, stCmdPara);
+            case CmdParamUtil.DATABUF: // 5
+                return strContainsStr(cmdParamInstVO, stCmdPara, paramValue, szCalcValue);
+            case CmdParamUtil.FIX_POINT: // 6
+                return false;
+            case CmdParamUtil.US_FIX_POINT: // 7
+                return false;
+            case CmdParamUtil.RLTTIME: // 8
+            case CmdParamUtil.FLOAT_RLTTIME: // 14
+            case CmdParamUtil.TF_FLOAT_TIME: // 15
+            case CmdParamUtil.BIT_ABSTIME: // 19
+                return timeWithTime(cmdParamInstVO, stCmdPara);
+            case CmdParamUtil.POINT_RLTTIME: // 11
+                return false;
+            case CmdParamUtil.US_FIX_ABSTIME: // 12
+                return absTimeWithAbsTime(cmdParamInstVO, stCmdPara);
+            case CmdParamUtil.CMDBUF: // 13
+            case CmdParamUtil.GPS_WEEKTIME: // 16
+                return strWithStr(cmdParamInstVO, stCmdPara, paramValue, szCalcValue);
+            case CmdParamUtil.BIT_RLTTIME: // 18
+            case CmdParamUtil.BIT8_RLTTIME: //20
+                return rltTimeToFloatWithRltTimeToFloat(cmdParamInstVO, stCmdPara);
+            default:
+                log.error("cmdParamValAndRsltFileVal指令参数类型匹配失败");
+        }
+        return false;
+    }
+
+    private static boolean strContainsStr(CmdParamInstVO cmdParamInstVO, StCmdPara stCmdPara, String paramValue, String szCalcValue) {
+        try {
+            cmdParamInstVO.setCompValue(paramValue.toLowerCase());
+            if (StringUtils.isEmpty(stCmdPara.getCompValue())) {
+                stCmdPara.setCompValue(szCalcValue.toLowerCase());
+            } else {
+                stCmdPara.setCompValue(stCmdPara.getCompValue().toLowerCase());
+            }
+            boolean equal = stCmdPara.getCompValue().contains(cmdParamInstVO.getCompValue());
+            if (!equal) {
+                equal = RevCalCompConfigUtils.check(cmdParamInstVO.getCompValue(), stCmdPara.getCompValue(), cmdParamInstVO.getObjectCode(), cmdParamInstVO);
+            }
+            cmdParamInstVO.setCompResult(equal ? CompResult.COMP_EQUAL : CompResult.COMP_NO_EQUAL);
+            stCmdPara.setCompResult(equal ? CompResult.COMP_EQUAL : CompResult.COMP_NO_EQUAL);
+            return equal;
+        } catch (Exception e) {
+            log.error("strContainsStr:{},{}", paramValue, szCalcValue);
+            setErrorResult(cmdParamInstVO, stCmdPara);
+            return false;
+        }
+    }
+
+    /**
+     * 时间与时间的比较
+     */
+    private static boolean timeWithTime(CmdParamInstVO cmdParamInstVO, StCmdPara stCmdPara) {
+        String paramValue = cmdParamInstVO.getParamValue();
+        // 判断参数值为何种类型 --- 相对时,绝对时,浮点数
+        String absOrRltOrFloat = isAbsOrRltOrFloat(paramValue);
+        if (null == absOrRltOrFloat) {
+            setErrorResult(cmdParamInstVO, stCmdPara);
+        }
+        if (ABS_TIME.equals(absOrRltOrFloat)) {
+            return absTimeWithAbsTime(cmdParamInstVO, stCmdPara);
+        } else {
+            return rltTimeOrFloatWithRltTimeOrFloat(cmdParamInstVO, stCmdPara);
+        }
+    }
+
+    /**
+     * 绝对时与绝对时比较
+     */
+    private static boolean absTimeWithAbsTime(CmdParamInstVO cmdParamInstVO, StCmdPara stCmdPara) {
+        try {
+            String paramValue = cmdParamInstVO.getParamValue();
+            String szCalcValue = stCmdPara.getSzCalcValue();
+            cmdParamInstVO.setCompValue(paramValue);
+            stCmdPara.setCompValue(szCalcValue);
+            String pattern1 = "yyyy/MM/dd HH:mm:ss.SSSS" , pattern2 = "yyyy/MM/dd HH:mm:ss.SSSS";
+            if (paramValue.contains("T")) {
+                pattern1 = "yyyy-MM-dd HH:mm:ss.SSSS";
+                paramValue = paramValue.replace("T" , " ");
+            } else {
+                paramValue = paramValue.replace("-" , " ");
+            }
+            if (szCalcValue.contains("T")) {
+                pattern2 = "yyyy-MM-dd HH:mm:ss.SSSS";
+                szCalcValue = szCalcValue.replace("T" , " ");
+            } else {
+                szCalcValue = szCalcValue.replace("-" , " ");
+            }
+            Date paramDate = DateUtils.parseDate(paramValue, pattern1, TimeZone.getTimeZone("Asia/Shanghai"));
+            Date calDate = DateUtils.parseDate(szCalcValue, pattern2, TimeZone.getTimeZone("Asia/Shanghai"));
+            boolean equal = Math.abs(paramDate.getTime() - calDate.getTime()) <= 5;
+            if (!equal) {
+                equal = RevCalCompConfigUtils.check(String.valueOf(paramDate.getTime()), String.valueOf(calDate.getTime()), cmdParamInstVO.getObjectCode(), cmdParamInstVO);
+            }
+            cmdParamInstVO.setCompResult(equal ? CompResult.COMP_EQUAL : CompResult.COMP_NO_EQUAL);
+            stCmdPara.setCompResult(equal ? CompResult.COMP_EQUAL : CompResult.COMP_NO_EQUAL);
+            return equal;
+        } catch (Exception e) {
+            setErrorResult(cmdParamInstVO, stCmdPara);
+            return false;
+        }
+    }
+
+    /**
+     * 相对时或浮点数与相对时或浮点数比较
+     */
+    private static boolean rltTimeOrFloatWithRltTimeOrFloat(CmdParamInstVO cmdParamInst, StCmdPara stCmdPara) {
+        String paramValue = cmdParamInst.getParamValue();
+        String szCalcValue = stCmdPara.getSzCalcValue();
+        try {
+            // 判断是非为时间类型
+            if (paramValue.contains("T") || paramValue.lastIndexOf("-") > 1) {
+                // 时间转相对秒
+                paramValue = rlTimeToFloat(paramValue);
+            }
+            if (szCalcValue.contains("T") || szCalcValue.lastIndexOf("-") > 1) {
+                szCalcValue = rlTimeToFloat(szCalcValue);
+            }
+            return numWithNum(cmdParamInst, stCmdPara, paramValue, szCalcValue);
+        } catch (Exception e) {
+            log.error("rltTimeOrFloatWithRltTimeOrFloat:{},{}" , paramValue, szCalcValue);
+            return false;
+        }
+    }
+
+    private static boolean rltTimeToFloatWithRltTimeToFloat(CmdParamInstVO cmdParamInstVO, StCmdPara stCmdPara) {
+        BigDecimal pv, sv;
+        String paramValue = cmdParamInstVO.getParamValue();
+        String szCalcValue = stCmdPara.getSzCalcValue();
+        try {
+            paramValue = rlTimeToFloat(paramValue);
+            szCalcValue = rlTimeToFloat(szCalcValue);
+            pv = new BigDecimal(paramValue);
+            sv = new BigDecimal(szCalcValue);
+        } catch (Exception e) {
+            log.error("rltTimeToFloatWithRltTimeToFloat:{},{}" , paramValue, szCalcValue);
+            setErrorResult(cmdParamInstVO, stCmdPara);
+            return false;
+        }
+
+        cmdParamInstVO.setCompValue(pv.toPlainString());
+        stCmdPara.setCompValue(sv.toPlainString());
+        boolean equal = pv.subtract(sv).abs().subtract(new BigDecimal("0.0005")).compareTo(new BigDecimal("0")) == 1 ? false : true;
+        if (!equal) {
+            equal = RevCalCompConfigUtils.check(pv.toPlainString(), sv.toPlainString(), cmdParamInstVO.getObjectCode(), cmdParamInstVO);
+        }
+        cmdParamInstVO.setCompResult(equal ? CompResult.COMP_EQUAL : CompResult.COMP_NO_EQUAL);
+        stCmdPara.setCompResult(equal ? CompResult.COMP_EQUAL : CompResult.COMP_NO_EQUAL);
+        return equal;
+    }
+
+    /**
+     * 数值之间比较
+     */
+    private static boolean numWithNum(CmdParamInstVO cmdParamInstVO, StCmdPara stCmdPara, String paramValue, String szCalcValue) {
+        BigDecimal pv, sv;
+        boolean isHex = false;
+        try {
+            if (paramValue.charAt(paramValue.length() - 1) != 'H' && !paramValue.matches("^[A-Fa-f0-9]+$")
+                    && szCalcValue.contains("(") && szCalcValue.contains(")")) {
+                String stCompValue = szCalcValue.substring(szCalcValue.lastIndexOf('(') + 1, szCalcValue.lastIndexOf(')'));
+
+                cmdParamInstVO.setCompValue(paramValue);
+                stCmdPara.setCompValue(stCompValue);
+
+                boolean equal = paramValue.equals(stCompValue);
+                cmdParamInstVO.setCompResult(equal ? CompResult.COMP_EQUAL : CompResult.COMP_NO_EQUAL);
+                stCmdPara.setCompResult(equal ? CompResult.COMP_EQUAL : CompResult.COMP_NO_EQUAL);
+                return equal;
+            }
+
+            // 判断十六进制
+            if (szCalcValue.charAt(szCalcValue.length() - 1) == 'H' ) {
+                szCalcValue = Long.valueOf(szCalcValue.substring(0, szCalcValue.length() - 1), 16) + "";
+            } else if (szCalcValue.contains("(") && szCalcValue.endsWith(")") && szCalcValue.charAt(szCalcValue.indexOf("(") - 1) == 'H') {
+                szCalcValue = Long.valueOf(szCalcValue.substring(0, szCalcValue.indexOf("(") - 1), 16) + "";
+            }
+            if (paramValue.charAt(paramValue.length() - 1) == 'H') {
+                paramValue = Long.valueOf(paramValue.substring(0, paramValue.length() - 1), 16) + "";
+                isHex = true;
+            } else if  (paramValue.contains("(") && paramValue.contains(")") && paramValue.charAt(paramValue.indexOf("(") - 1) == 'H') {
+                paramValue = Long.valueOf(paramValue.substring(0, paramValue.indexOf("(") - 1), 16) + "";
+                isHex = true;
+            }
+
+            // 判断二进制
+            if (szCalcValue.charAt(szCalcValue.length() - 1) == 'B' ) {
+                szCalcValue = Long.valueOf(szCalcValue.substring(0, szCalcValue.length() - 1), 2) + "";
+            } else if (szCalcValue.contains("(") && szCalcValue.endsWith(")") && szCalcValue.charAt(szCalcValue.indexOf("(") - 1) == 'B') {
+                szCalcValue = Long.valueOf(szCalcValue.substring(0, szCalcValue.indexOf("(") - 1), 2) + "";
+            }
+            if (paramValue.charAt(paramValue.length() - 1) == 'B') {
+                paramValue = Long.valueOf(paramValue.substring(0, paramValue.length() - 1), 2) + "";
+                isHex = true;
+            } else if  (paramValue.contains("(") && paramValue.contains(")") && paramValue.charAt(paramValue.indexOf("(") - 1) == 'B') {
+                paramValue = Long.valueOf(paramValue.substring(0, paramValue.indexOf("(") - 1), 2) + "";
+                isHex = true;
+            }
+
+            pv = new BigDecimal(paramValue);
+            sv = new BigDecimal(szCalcValue);
+            // 根据指令参数长度,获取有效位数
+            if (cmdParamInstVO.getLen() != null && cmdParamInstVO.getLen() == 64) {
+                pv = validDigital(pv, PRECISION_THIRTEEN);
+                sv = validDigital(sv, PRECISION_THIRTEEN);
+            } else {
+                pv = validDigital(pv, PRECISION_SEVEN);
+                sv = validDigital(sv, PRECISION_SEVEN);
+            }
+        } catch (Exception e) {
+            log.error("numWithNum:{},{}" , paramValue, szCalcValue);
+            setErrorResult(cmdParamInstVO, stCmdPara);
+            return false;
+        }
+
+        if (isHex && StringUtils.isNotEmpty(cmdParamInstVO.getDimen())) {
+            pv = pv.multiply(new BigDecimal(getDimen(cmdParamInstVO.getDimen())));
+        }
+
+        cmdParamInstVO.setCompValue(pv.toPlainString());
+        stCmdPara.setCompValue(sv.toPlainString());
+        boolean equal = pv.compareTo(sv) == 0;
+        if (!equal) {
+            equal = RevCalCompConfigUtils.check(pv.toPlainString(), sv.toPlainString(), cmdParamInstVO.getObjectCode(), cmdParamInstVO);
+        }
+        cmdParamInstVO.setCompResult(equal ? CompResult.COMP_EQUAL : CompResult.COMP_NO_EQUAL);
+        stCmdPara.setCompResult(equal ? CompResult.COMP_EQUAL : CompResult.COMP_NO_EQUAL);
+        return equal;
+    }
+
+
+    public static String getDimen(String str) {
+        String number = getNumber(str);
+        if (StringUtils.isEmpty(number)) {
+            return "1";
+        }
+        return number;
+    }
+
+    public static String getNumber(String str) {
+        if (StringUtils.isNotEmpty(str)) {
+            String pReg = "(\\d+\\.\\d+)";
+            Pattern p = Pattern.compile(pReg);
+            Matcher m = p.matcher(str);
+            if (m.find()) {
+                str = m.group(1) == null ? "" : m.group(1);
+            } else {
+                pReg = "(\\d+)";
+                p = Pattern.compile(pReg);
+                m = p.matcher(str);
+                if (m.find()) {
+                    str = m.group(1) == null ? "" : m.group(1);
+                } else {
+                    str = "";
+                }
+            }
+            return str;
+        }
+        return null;
+    }
+
+
+    private static boolean strWithStr(CmdParamInstVO cmdParamInstVO, StCmdPara stCmdPara, String paramValue, String szCalcValue) {
+        try {
+            cmdParamInstVO.setCompValue(paramValue);
+            if (StringUtils.isEmpty(stCmdPara.getCompValue())) {
+                stCmdPara.setCompValue(szCalcValue);
+            }
+            boolean equal = cmdParamInstVO.getCompValue().equals(stCmdPara.getCompValue());
+            if (!equal) {
+                equal = RevCalCompConfigUtils.check(cmdParamInstVO.getCompValue(), stCmdPara.getCompValue(), cmdParamInstVO.getObjectCode(), cmdParamInstVO);
+            }
+            cmdParamInstVO.setCompResult(equal ? CompResult.COMP_EQUAL : CompResult.COMP_NO_EQUAL);
+            stCmdPara.setCompResult(equal ? CompResult.COMP_EQUAL : CompResult.COMP_NO_EQUAL);
+            return equal;
+        } catch (Exception e) {
+            log.error("strWithStr:{},{}" , paramValue, szCalcValue);
+            setErrorResult(cmdParamInstVO, stCmdPara);
+            return false;
+        }
+    }
+
+    /**
+     * 判断参数值为何种类型 --- 相对时,绝对时,浮点数
+     */
+    private static String isAbsOrRltOrFloat(String paramValue) {
+        try {
+            if (paramValue.contains("0000/00/") || paramValue.contains("0000-00-") || (paramValue.contains("T") && paramValue.lastIndexOf("T") < 6) || (paramValue.contains("-") && paramValue.lastIndexOf("-") < 6)) {
+                return RLT_TIME;
+            } else if (paramValue.contains("T") || paramValue.lastIndexOf("-") > 1) {
+                return ABS_TIME;
+            } else {
+                return FLOAT;
+            }
+        } catch (Exception e) {
+            log.error("isAbsOrRltOrFloat({}):{}" , paramValue, e.toString());
+        }
+        return null;
+    }
+
+    /**
+     * 相对时转相对秒(可带符号)
+     */
+    private static String rlTimeToFloat(String rltTime) {
+        String ch;
+        if (rltTime.contains("T")) {
+            ch = "T";
+            if ("-".equals(rltTime.charAt(7) + "")) {
+                rltTime = rltTime.substring(8);
+            }
+        } else {
+            ch = "-";
+            if ("/".equals(rltTime.charAt(7) + "")) {
+                rltTime = rltTime.substring(8);
+            }
+        }
+        String day = rltTime.substring(0, rltTime.lastIndexOf(ch));
+        String sign = "";
+        if ("-".equals(day.substring(0, 1))) {
+            sign = "-";
+            day = day.substring(1);
+        }
+        String hour = rltTime.substring(rltTime.lastIndexOf(ch) + 1, rltTime.indexOf(":"));
+        String min = rltTime.substring(rltTime.indexOf(":") + 1, rltTime.lastIndexOf(":"));
+        String s = rltTime.substring(rltTime.lastIndexOf(":") + 1, rltTime.indexOf("."));
+        String ms = rltTime.substring(rltTime.indexOf(".") + 1);
+        return sign + (Integer.parseInt(day) * 24 * 60 * 60 + Integer.parseInt(hour) * 60 * 60 + Integer.parseInt(min) * 60 + Integer.parseInt(s)) + "." + ms;
+    }
+
+    /**
+     * 保留指定位数的有效数字
+     */
+    public static BigDecimal validDigital(BigDecimal bigDecimal, int precision) {
+        MathContext mathContext = new MathContext(precision, RoundingMode.HALF_UP);
+        return bigDecimal.divide(BigDecimal.ONE, mathContext);
+    }
+
+
+    public static BigDecimal validDigital1(BigDecimal bigDecimal, int precision) {
+        MathContext mathContext = new MathContext(precision, RoundingMode.DOWN);
+        return bigDecimal.divide(BigDecimal.ONE, mathContext);
+    }
+
+    /**
+     * 设置比对错误结果
+     */
+    public static void setErrorResult(CmdParamInstVO cmdParamInstVO, StCmdPara stCmdPara) {
+        cmdParamInstVO.setCompValue(cmdParamInstVO.getParamValue());
+        stCmdPara.setCompValue(stCmdPara.getSzCalcValue());
+        cmdParamInstVO.setCompResult(CompResult.COMP_BREAK);
+        stCmdPara.setCompResult(CompResult.COMP_BREAK);
+        log.debug(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>setError");
+        log.debug(JacksonUtils.toJsonString(cmdParamInstVO));
+        log.debug(JacksonUtils.toJsonString(stCmdPara));
+    }
+}

+ 107 - 0
server/service/service-sys/src/main/resources/mappings/module/ge/CmdParamMapper.xml

@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.c503.ca.cadv.module.ge.repository.CmdParamRepository">
+
+
+        <!-- 通用查询结果列 -->
+        <sql id="Base_Column_List">
+                a.id_ AS id,
+                a.created_by AS createdBy,
+                a.created_date AS createdDate,
+                a.last_modified_by AS lastModifiedBy,
+                a.last_modified_date AS lastModifiedDate,
+                a.deleted_ AS deleted,
+                a.version_ AS version,
+                a.cmd_id AS cmdId,
+                a.code_ AS code,
+                a.group_no AS groupNo,
+                a.no_in_group AS noInGroup,
+                a.data_no AS dataNo,
+                a.len_ AS len,
+                a.type_ AS type,
+                a.dimen_ AS dimen,
+                a.fix_ AS fix,
+                a.para_path AS paraPath,
+                a.explain_ AS explain,
+                a.value_range AS valueRange,
+                a.sz_para_code AS szParaCode
+                a.object_code AS objectCode
+    </sql>
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.c503.ca.cadv.module.ge.domain.CmdParam">
+        <id column="id" property="id" javaType="java.lang.String"
+            jdbcType="VARCHAR"/>
+        <result column="createdBy" property="createdBy"/>
+        <result column="createdDate" property="createdDate"/>
+        <result column="lastModifiedBy" property="lastModifiedBy"/>
+        <result column="lastModifiedDate" property="lastModifiedDate"/>
+        <result column="deleted" property="deleted"/>
+        <result column="version" property="version"/>
+        <result column="cmdId" property="cmdId"/>
+        <result column="code" property="code"/>
+        <result column="groupNo" property="groupNo"/>
+        <result column="noInGroup" property="noInGroup"/>
+        <result column="dataNo" property="dataNo"/>
+        <result column="len" property="len"/>
+        <result column="type" property="type"/>
+        <result column="dimen" property="dimen"/>
+        <result column="fix" property="fix"/>
+        <result column="paraPath" property="paraPath"/>
+        <result column="explain" property="explain"/>
+        <result column="valueRange" property="valueRange"/>
+        <result column="szParaCode" property="szParaCode"/>
+        <result column="objectCode" property="objectCode"/>
+    </resultMap>
+
+
+    <select id="findParamPageList" resultType="com.c503.ca.cadv.module.ge.domain.CmdAndCmdParam">
+        SELECT a.id_,
+               a.cmd_id,
+               a.code_,
+               a.group_no,
+               a.no_in_group,
+               a.data_no,
+               a.len_,
+               a.type_,
+               a.dimen_,
+               a.fix_,
+               a.explain_,
+               a.para_path,
+               a.created_date,
+               a.value_range,
+               a.sz_para_code,
+               b.id_,
+               b.key_str,
+               b.cmd_code,
+               b.object_code
+        from ge_cmd_param a
+                 left join ge_cmd b on a.cmd_id = b.id_ ${ew.customSqlSegment}
+    </select>
+
+    <select id="findParamByObjCode" resultType="com.c503.ca.cadv.module.ge.domain.CmdAndCmdParam">
+        SELECT a.id_,
+               a.cmd_id,
+               a.code_,
+               a.group_no,
+               a.no_in_group,
+               a.data_no,
+               a.len_,
+               a.type_,
+               a.dimen_,
+               a.fix_,
+               a.explain_,
+               a.para_path,
+               a.created_date,
+               a.value_range,
+               a.sz_para_code,
+               b.id_,
+               b.key_str,
+               b.cmd_code,
+               b.object_code
+        from ge_cmd_param a
+                 left join ge_cmd b on a.cmd_id = b.id_ where b.object_code = #{objectCode}
+    </select>
+
+
+</mapper>