切换数据处理原则

This commit is contained in:
caozehui
2025-12-10 11:15:43 +08:00
parent 5105e77823
commit c3443fcc91
3 changed files with 18 additions and 15 deletions

View File

@@ -554,6 +554,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
child.put("pid", adPlan.getFatherPlanId()); child.put("pid", adPlan.getFatherPlanId());
child.put("name", adPlan.getName()); child.put("name", adPlan.getName());
child.put("timeCheck", adPlan.getTimeCheck()); child.put("timeCheck", adPlan.getTimeCheck());
child.put("dataRule", adPlan.getDataRule());
List<PqStandardDev> pqStandardDevs = adPlanStandardDevMapper.listByPlanId(Collections.singletonList(adPlan.getId())); List<PqStandardDev> pqStandardDevs = adPlanStandardDevMapper.listByPlanId(Collections.singletonList(adPlan.getId()));
List<String> devTypeIdList = pqStandardDevs.stream().map(PqStandardDev::getDevType).collect(Collectors.toList()); List<String> devTypeIdList = pqStandardDevs.stream().map(PqStandardDev::getDevType).collect(Collectors.toList());

View File

@@ -75,6 +75,8 @@ public class ResultParam {
// 模式id // 模式id
private String patternId; private String patternId;
private String code;
} }
@Data @Data
@@ -104,5 +106,8 @@ public class ResultParam {
@ApiModelProperty(value = "通道号", required = true) @ApiModelProperty(value = "通道号", required = true)
private String chnNum; private String chnNum;
@ApiModelProperty(value = "数据处理原则", required = true)
private String dataRuleId;
} }
} }

View File

@@ -983,10 +983,10 @@ public class ResultServiceImpl implements IResultService {
DictData dictData = dictDataService.getDictDataById(param.getPatternId()); DictData dictData = dictDataService.getDictDataById(param.getPatternId());
if (PatternEnum.CONTRAST.getValue().equals(dictData.getCode())) { if (PatternEnum.CONTRAST.getValue().equals(dictData.getCode())) {
this.createTempResultTable(param.getCode() + "_temp", true); this.createTempResultTable(param.getCode() + "_temp", true);
this.contrastCalculateResult(param.getPlanId(), param.getCode() + "_temp", param.getErrorSysId(), param.getDeviceId(), param.getChnNum()); this.contrastCalculateResult(param.getPlanId(), param.getCode() + "_temp", param.getErrorSysId(), param.getDeviceId(), param.getChnNum(), param.getDataRuleId());
} else { } else {
this.createTempResultTable(param.getCode() + "_temp", false); this.createTempResultTable(param.getCode() + "_temp", false);
this.simAndDigCalculateResult(param.getPlanId(), param.getScriptId(), param.getCode() + "_temp", param.getErrorSysId(), param.getDeviceId()); this.simAndDigCalculateResult(param.getPlanId(), param.getScriptId(), param.getCode() + "_temp", param.getErrorSysId(), param.getDeviceId(), param.getDataRuleId());
} }
} }
@@ -1000,9 +1000,9 @@ public class ResultServiceImpl implements IResultService {
public void reCalculate(ResultParam.ChangeErrorSystemParam param) { public void reCalculate(ResultParam.ChangeErrorSystemParam param) {
DictData dictData = dictDataService.getDictDataById(param.getPatternId()); DictData dictData = dictDataService.getDictDataById(param.getPatternId());
if (PatternEnum.CONTRAST.getValue().equals(dictData.getCode())) { if (PatternEnum.CONTRAST.getValue().equals(dictData.getCode())) {
this.contrastCalculateResult(param.getPlanId(), param.getCode(), param.getErrorSysId(), param.getDeviceId(), param.getChnNum()); this.contrastCalculateResult(param.getPlanId(), param.getCode(), param.getErrorSysId(), param.getDeviceId(), param.getChnNum(), param.getDataRuleId());
} else { } else {
this.simAndDigCalculateResult(param.getPlanId(), param.getScriptId(), param.getCode(), param.getErrorSysId(), param.getDeviceId()); this.simAndDigCalculateResult(param.getPlanId(), param.getScriptId(), param.getCode(), param.getErrorSysId(), param.getDeviceId(), param.getDataRuleId());
} }
} }
@@ -1533,8 +1533,7 @@ public class ResultServiceImpl implements IResultService {
AdPlan plan = adPlanService.getById(queryParam.getPlanId()); AdPlan plan = adPlanService.getById(queryParam.getPlanId());
PqDev dev = pqDevService.getById(queryParam.getDeviceId()); PqDev dev = pqDevService.getById(queryParam.getDeviceId());
DictData dictData = dictDataService.getById(plan.getDataRule()); formContentVO.setDataRule(plan.getDataRule());
formContentVO.setDataRule(dictData.getName());
formContentVO.setDeviceName(dev.getName()); formContentVO.setDeviceName(dev.getName());
formContentVO.setErrorSysId(plan.getErrorSysId()); formContentVO.setErrorSysId(plan.getErrorSysId());
@@ -1581,8 +1580,6 @@ public class ResultServiceImpl implements IResultService {
public ContrastResultVO getContrastResult(ResultParam.QueryParam queryParam) { public ContrastResultVO getContrastResult(ResultParam.QueryParam queryParam) {
ContrastResultVO contrastResultVO = new ContrastResultVO(); ContrastResultVO contrastResultVO = new ContrastResultVO();
AdPlan plan = adPlanService.getById(queryParam.getPlanId());
List<DictTree> dictTreeList = dictTreeService.getDictTreeById(Collections.singletonList(queryParam.getScriptType())); List<DictTree> dictTreeList = dictTreeService.getDictTreeById(Collections.singletonList(queryParam.getScriptType()));
List<String> fatherIdList = dictTreeList.stream().map(DictTree::getId).collect(Collectors.toList()); List<String> fatherIdList = dictTreeList.stream().map(DictTree::getId).collect(Collectors.toList());
@@ -1604,8 +1601,8 @@ public class ResultServiceImpl implements IResultService {
} }
} }
contrastResultVO.setResultMap(this.getResultMap(dictTree, adTypeList, queryParam.getDeviceId() + CnSocketUtil.SPLIT_TAG + queryParam.getChnNum(), unit, queryParam.getNum(), queryParam.getWaveNum(), queryParam.getIsWave(), String.valueOf(plan.getCode()))); contrastResultVO.setResultMap(this.getResultMap(dictTree, adTypeList, queryParam.getDeviceId() + CnSocketUtil.SPLIT_TAG + queryParam.getChnNum(), unit, queryParam.getNum(), queryParam.getWaveNum(), queryParam.getIsWave(), queryParam.getCode()));
contrastResultVO.setRawDataMap(this.getRawDataMap(dictTree, adTypeList, queryParam.getDeviceId() + CnSocketUtil.SPLIT_TAG + queryParam.getChnNum(), unit, queryParam.getNum(), queryParam.getWaveNum(), queryParam.getIsWave(), String.valueOf(plan.getCode()), contrastResultVO.getResultMap().keySet().stream().collect(Collectors.toList()))); contrastResultVO.setRawDataMap(this.getRawDataMap(dictTree, adTypeList, queryParam.getDeviceId() + CnSocketUtil.SPLIT_TAG + queryParam.getChnNum(), unit, queryParam.getNum(), queryParam.getWaveNum(), queryParam.getIsWave(), queryParam.getCode(), contrastResultVO.getResultMap().keySet().stream().collect(Collectors.toList())));
return contrastResultVO; return contrastResultVO;
} }
@@ -3067,7 +3064,7 @@ public class ResultServiceImpl implements IResultService {
* @param errorSysId * @param errorSysId
* @param devId * @param devId
*/ */
private void simAndDigCalculateResult(String planId, String scriptId, String code, String errorSysId, String devId) { private void simAndDigCalculateResult(String planId, String scriptId, String code, String errorSysId, String devId, String dataRuleId) {
String oldCode = code.replace("_temp", ""); String oldCode = code.replace("_temp", "");
PreDetectionParam param = new PreDetectionParam(); PreDetectionParam param = new PreDetectionParam();
param.setCode(code); param.setCode(code);
@@ -3085,8 +3082,8 @@ public class ResultServiceImpl implements IResultService {
// } else { // } else {
// dataRule = DictDataEnum.SECTION_VALUE; // dataRule = DictDataEnum.SECTION_VALUE;
// } // }
AdPlan plan = adPlanService.getById(planId); // AdPlan plan = adPlanService.getById(planId);
DictData dictData = dictDataService.getDictDataById(plan.getDataRule()); DictData dictData = dictDataService.getDictDataById(dataRuleId);
if (ObjectUtil.isNotNull(dictData)) { if (ObjectUtil.isNotNull(dictData)) {
dataRule = DictDataEnum.getDictDataEnumByCode(dictData.getCode()); dataRule = DictDataEnum.getDictDataEnumByCode(dictData.getCode());
} else { } else {
@@ -3146,7 +3143,7 @@ public class ResultServiceImpl implements IResultService {
* @param deviceId * @param deviceId
* @param chnNum * @param chnNum
*/ */
private void contrastCalculateResult(String planId, String code, String errorSysId, String deviceId, String chnNum) { private void contrastCalculateResult(String planId, String code, String errorSysId, String deviceId, String chnNum, String dataRuleId) {
String oldCode = code.replace("_temp", ""); String oldCode = code.replace("_temp", "");
Map<String, String> devIdMapComm = new HashMap<>(); Map<String, String> devIdMapComm = new HashMap<>();
@@ -3189,7 +3186,7 @@ public class ResultServiceImpl implements IResultService {
} }
DictDataEnum dataRule; DictDataEnum dataRule;
DictData dictData = dictDataService.getDictDataById(plan.getDataRule()); DictData dictData = dictDataService.getDictDataById(dataRuleId);
if (ObjectUtil.isNotNull(dictData)) { if (ObjectUtil.isNotNull(dictData)) {
dataRule = DictDataEnum.getDictDataEnumByCode(dictData.getCode()); dataRule = DictDataEnum.getDictDataEnumByCode(dictData.getCode());
} else { } else {