|
@@ -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.exception.RuntimeErrorException;
|
|
import com.c503.ca.cadv.common.util.xml.XmlUtils;
|
|
import com.c503.ca.cadv.common.util.xml.XmlUtils;
|
|
import com.c503.ca.cadv.enhance.ftp.FtpUtils;
|
|
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.RacpaXDO;
|
|
import com.c503.ca.cadv.module.check.domain.orin.racpa.StruRacpaData;
|
|
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.RpppcXDO;
|
|
import com.c503.ca.cadv.module.check.domain.orin.rpppc.StrRpppcBody;
|
|
import com.c503.ca.cadv.module.check.domain.orin.rpppc.StrRpppcBody;
|
|
import com.c503.ca.cadv.module.check.domain.orin.rprlytrk.RprlytrkXDO;
|
|
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.check.domain.orin.rsbeod.StruRsbeod;
|
|
import com.c503.ca.cadv.module.cmp.domain.vo.FillConfigVO;
|
|
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.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.enums.ParamSignType;
|
|
import com.c503.ca.cadv.module.ge.domain.vo.CmdVO;
|
|
import com.c503.ca.cadv.module.ge.domain.vo.CmdVO;
|
|
import com.c503.ca.cadv.module.ge.util.CmdHelper;
|
|
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.TargetZbVO;
|
|
import com.c503.ca.cadv.module.info.domain.vo.TaskVO;
|
|
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.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.CmdInstVO;
|
|
import com.c503.ca.cadv.module.plan.domain.vo.CmdParamInstVO;
|
|
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.ConfigFileVO;
|
|
import com.c503.ca.cadv.module.plan.domain.vo.FileDataVO;
|
|
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.c503.ca.cadv.module.plan.util.PlanHelper;
|
|
|
|
+import com.google.common.collect.Maps;
|
|
import org.apache.commons.compress.utils.Lists;
|
|
import org.apache.commons.compress.utils.Lists;
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
|
+import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -55,7 +63,7 @@ import java.util.stream.Collectors;
|
|
*/
|
|
*/
|
|
public class CheckUtil {
|
|
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);
|
|
Target target = InfoHelper.getTargetService().getByTargetCode(targetCode);
|
|
if (target == null) {
|
|
if (target == null) {
|
|
@@ -88,8 +96,60 @@ public class CheckUtil {
|
|
throw new RuntimeErrorException("反算文件数据获取失败");
|
|
throw new RuntimeErrorException("反算文件数据获取失败");
|
|
}
|
|
}
|
|
CompResult<List<CmdInstVO>, List<StCmdInfoXDO>> compResult = revCalComp(rsltFileXDO, ftpId, taskId, targetCode, filename);
|
|
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) {
|
|
public static RsltFileXDO getRsltFile(String ftpId, String taskId, String targetId, CatalogType catalogType, String filename) {
|
|
@@ -212,8 +272,19 @@ public class CheckUtil {
|
|
//cfg第一层指令集合
|
|
//cfg第一层指令集合
|
|
List<CmdInstVO> cmdInstVOList = null;
|
|
List<CmdInstVO> cmdInstVOList = null;
|
|
for (FileDataVO fileData : configFileVO.getFileDataList()) {
|
|
for (FileDataVO fileData : configFileVO.getFileDataList()) {
|
|
- if (rsltFileXDO.getSzFileName().equals(fileDataVO.getFile())) {
|
|
|
|
|
|
+ if (rsltFileXDO.getSzFileName().equals(fileData.getFile())) {
|
|
cmdInstVOList = fileData.getCmdInstList();
|
|
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;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -221,13 +292,392 @@ public class CheckUtil {
|
|
throw new RuntimeException("无该反算文件名");
|
|
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;
|
|
boolean existSpecialCmd = false;
|
|
int indexToReplace = -1;
|
|
int indexToReplace = -1;
|
|
List<CmdInstVO> cmdInstVOListToAdd = Lists.newArrayList();
|
|
List<CmdInstVO> cmdInstVOListToAdd = Lists.newArrayList();
|
|
@@ -289,7 +739,7 @@ public class CheckUtil {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (GNCF != null) {
|
|
if (GNCF != null) {
|
|
- handleRpgnCmd(cmdInstVO, GNCF, ftpId, taskId, targetId, "GNCF");
|
|
|
|
|
|
+ handleRpgncCmd(cmdInstVO, GNCF, ftpId, taskId, targetId, "GNCF");
|
|
indexToReplace = i;
|
|
indexToReplace = i;
|
|
existSpecialCmd = true;
|
|
existSpecialCmd = true;
|
|
break;
|
|
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) {
|
|
if (existSpecialCmd && indexToReplace != -1) {
|
|
cmdInstVOList.remove(indexToReplace);
|
|
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);
|
|
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) {
|
|
if (fillConfigVO == null) {
|
|
throw new RuntimeException("特殊比对[RPPPC]的生成模式[" + generateMode + "]未配置");
|
|
throw new RuntimeException("特殊比对[RPPPC]的生成模式[" + generateMode + "]未配置");
|
|
}
|
|
}
|
|
@@ -767,7 +1225,7 @@ public class CheckUtil {
|
|
Target target = InfoHelper.getTargetService().findOne(targetId);
|
|
Target target = InfoHelper.getTargetService().findOne(targetId);
|
|
|
|
|
|
String injType = "RACPA";
|
|
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) {
|
|
if (fillConfigVO == null) {
|
|
throw new RuntimeException("特殊比对[" + injType + "]的生成模式[" + generateMode + "]未配置");
|
|
throw new RuntimeException("特殊比对[" + injType + "]的生成模式[" + generateMode + "]未配置");
|
|
}
|
|
}
|
|
@@ -979,7 +1437,7 @@ public class CheckUtil {
|
|
Target target = InfoHelper.getTargetService().findOne(targetId);
|
|
Target target = InfoHelper.getTargetService().findOne(targetId);
|
|
|
|
|
|
String injType = "RSBEOD";
|
|
String injType = "RSBEOD";
|
|
- FillConfigVO fillConfigVO = CmpHelper.getFillConfigService().findWithInjType(injType, target.getTargetCode());
|
|
|
|
|
|
+ FillConfigVO fillConfigVO = CmpHelper.getFillConfigService().findWithInjType(injType, target.getTargetCode(), cmdInstVO.getIsDc());
|
|
if (fillConfigVO == null) {
|
|
if (fillConfigVO == null) {
|
|
throw new RuntimeException("特殊比对[" + injType + "]未配置");
|
|
throw new RuntimeException("特殊比对[" + injType + "]未配置");
|
|
}
|
|
}
|
|
@@ -1083,7 +1541,7 @@ public class CheckUtil {
|
|
|
|
|
|
Target target = InfoHelper.getTargetService().findOne(targetId);
|
|
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) {
|
|
if (fillConfigVO == null) {
|
|
throw new RuntimeException("特殊比对[" + cmdInstVO.getCmdCode() + "]未配置");
|
|
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();
|
|
String rpgncFileName = rpgnc.getCmdParamInstList().get(0).getValue();
|
|
ParamSignType singleParamSign = rpgnc.getCmdParamInstList().get(0).getSingleParamSign();
|
|
ParamSignType singleParamSign = rpgnc.getCmdParamInstList().get(0).getSingleParamSign();
|
|
if (singleParamSign == ParamSignType.D || singleParamSign == ParamSignType.M) {
|
|
if (singleParamSign == ParamSignType.D || singleParamSign == ParamSignType.M) {
|
|
rpgncFileName = rpgnc.getCmdParamInstList().get(0).getParaPath();
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
}
|