diff --git a/detection/src/main/java/com/njcn/gather/detection/controller/PreDetectionController.java b/detection/src/main/java/com/njcn/gather/detection/controller/PreDetectionController.java index 2adc871d..836cd7c7 100644 --- a/detection/src/main/java/com/njcn/gather/detection/controller/PreDetectionController.java +++ b/detection/src/main/java/com/njcn/gather/detection/controller/PreDetectionController.java @@ -134,7 +134,7 @@ public class PreDetectionController extends BaseController { List pqDevList = iPqDevService.getDevInfo(param.getDevIds()); Map devIdMapComm = pqDevList.stream().collect(Collectors.toMap(PreDetection::getDevIP, PreDetection::getDevId)); - detectionServiceImpl.text(devDataList,param.getErrorSysId(),devIdMapComm,sourceIssues, DictDataEnum.AT_WILL_VALUE); + detectionServiceImpl.processing(devDataList,param,devIdMapComm,sourceIssues, DictDataEnum.AT_WILL_VALUE); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); } diff --git a/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java b/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java index 52a63c47..c9d235e9 100644 --- a/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java +++ b/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java @@ -26,6 +26,8 @@ import com.njcn.gather.device.script.service.IPqScriptDtlsService; import com.njcn.gather.storage.pojo.po.AdHarmonicResult; import com.njcn.gather.storage.pojo.po.AdNonHarmonicResult; import com.njcn.gather.storage.service.DetectionDataDealService; +import com.njcn.gather.system.config.pojo.po.SysTestConfig; +import com.njcn.gather.system.config.service.ISysTestConfigService; import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum; import com.njcn.gather.system.pojo.enums.DicDataEnum; import com.njcn.gather.system.reg.pojo.vo.SysRegResVO; @@ -71,6 +73,7 @@ public class SocketDevResponseService { private final DetectionDataDealService detectionDataDealService; private final ISysRegResService iSysRegResService; private final IPqScriptCheckDataService iPqScriptCheckDataService; + private final ISysTestConfigService sysTestConfigService; private final ExecutorService executorPool = Executors.newFixedThreadPool(10); @@ -109,6 +112,9 @@ public class SocketDevResponseService { */ List successXieyi = new ArrayList<>(); List successXieyi3 = new ArrayList<>(); + DictDataEnum dataRule; + + //标识当前检测小项是否结束 @@ -826,7 +832,7 @@ public class SocketDevResponseService { //开启线程进行入库原始数据操作 baseDataInsert(realDataXiList, sourceIssue, param, SocketManager.valueTypeMap); - Map flag = detectionServiceImpl.text(realDataXiList, param.getErrorSysId(), devIdMapComm, sourceIssue, DictDataEnum.AT_WILL_VALUE); + Map flag = detectionServiceImpl.processing(realDataXiList, param, devIdMapComm, sourceIssue, dataRule); System.out.println(flag); long tem = SocketManager.getSourceTarget(sourceIssue.getType()) - 1; @@ -1113,7 +1119,12 @@ public class SocketDevResponseService { //初始化有效数据数 Map sysRegResMap = iSysRegResService.listRegRes(); - + SysTestConfig oneConfig = sysTestConfigService.getOneConfig(); + if(ObjectUtil.isNotNull(oneConfig)){ + dataRule=DictDataEnum.getDictDataEnumByCode(oneConfig.getDataRule()); + }else{ + dataRule=DictDataEnum.AT_WILL_VALUE; + } //字典树 SocketManager.valueTypeMap.clear(); SocketManager.valueTypeMap = iPqScriptCheckDataService.getValueTypeMap(param.getScriptId()); @@ -1279,10 +1290,10 @@ public class SocketDevResponseService { } if (CollUtil.isNotEmpty(adNonHarmonicResultList)) { - detectionDataDealService.acceptAdNon(adNonHarmonicResultList, "1"); + detectionDataDealService.acceptAdNon(adNonHarmonicResultList, param.getCode()); } if (CollUtil.isNotEmpty(adHarmonicResultList)) { - detectionDataDealService.acceptAd(adHarmonicResultList, "1"); + detectionDataDealService.acceptAd(adHarmonicResultList, param.getCode()); } System.out.println("原始数据插入数据库执行成功========================================="); // }; diff --git a/detection/src/main/java/com/njcn/gather/detection/pojo/param/PreDetectionParam.java b/detection/src/main/java/com/njcn/gather/detection/pojo/param/PreDetectionParam.java index 624381de..2094ec8a 100644 --- a/detection/src/main/java/com/njcn/gather/detection/pojo/param/PreDetectionParam.java +++ b/detection/src/main/java/com/njcn/gather/detection/pojo/param/PreDetectionParam.java @@ -56,4 +56,9 @@ public class PreDetectionParam { * 所属误差体系 */ private String errorSysId; + + /** + * 自动生成,用于生成数据表后缀 + */ + private String code; } diff --git a/detection/src/main/java/com/njcn/gather/detection/service/impl/DetectionServiceImpl.java b/detection/src/main/java/com/njcn/gather/detection/service/impl/DetectionServiceImpl.java index a30b89d1..b91d7dcf 100644 --- a/detection/src/main/java/com/njcn/gather/detection/service/impl/DetectionServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/detection/service/impl/DetectionServiceImpl.java @@ -8,6 +8,7 @@ import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSON; import com.github.yulichang.wrapper.MPJLambdaWrapper; +import com.njcn.gather.detection.pojo.param.PreDetectionParam; import com.njcn.gather.detection.pojo.po.DevData; import com.njcn.gather.detection.pojo.vo.DetectionData; import com.njcn.gather.device.err.pojo.param.PqErrSysParam; @@ -59,12 +60,11 @@ public class DetectionServiceImpl { * 开始处理指标类型 * 一共20组数据,开始处理格式 */ - public Map text(List dev, String errorSysId, Map devIdMapComm, SourceIssue issue, DictDataEnum dataRule) { + public Map processing(List dev, PreDetectionParam detection, Map devIdMapComm, SourceIssue issue, DictDataEnum dataRule) { Map> devDataMap = dev.stream().collect(Collectors.groupingBy(DevData::getId)); Map stringBooleanMap = new LinkedHashMap<>(); - String code = "1"; devDataMap.forEach(((key, value) -> { - stringBooleanMap.put(key, DetectionIndexProcessing(value, code, errorSysId, devIdMapComm, dataRule, issue)); + stringBooleanMap.put(key, DetectionIndexProcessing(value, detection.getCode(), detection.getErrorSysId(), devIdMapComm, dataRule, issue)); })); return stringBooleanMap; } @@ -666,7 +666,7 @@ public class DetectionServiceImpl { */ private void setDetection(DictDataEnum dataRule, List harmDataList, PqErrSysDtls errSysDtl, DetectionData data, Double v) { List qualifiedList = harmDataList.stream() - .filter(x -> v == 0 ? x == v : x > 0 && NumberUtil.isIn(devSubtractChannelData(x, v, errSysDtl.getErrorValueType()), + .filter(x -> v == 0 ? x.equals(v) : x > 0 && NumberUtil.isIn(devSubtractChannelData(x, v, errSysDtl.getErrorValueType()), BigDecimal.valueOf(-errSysDtl.getMaxErrorValue()), BigDecimal.valueOf(errSysDtl.getMaxErrorValue()))).collect(Collectors.toList()); isData(dataRule, harmDataList, data, qualifiedList); diff --git a/detection/src/main/java/com/njcn/gather/detection/service/impl/PreDetectionServiceImpl.java b/detection/src/main/java/com/njcn/gather/detection/service/impl/PreDetectionServiceImpl.java index 20974e98..061afda9 100644 --- a/detection/src/main/java/com/njcn/gather/detection/service/impl/PreDetectionServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/detection/service/impl/PreDetectionServiceImpl.java @@ -102,10 +102,10 @@ public class PreDetectionServiceImpl implements PreDetectionService { 查询计划什么模式的(除了对比式,其他都是一个计划对应一个源) */ AdPlan plan = iAdPlanService.getById(param.getPlanId()); - PqSource pqSource = pqSourceService.getById(plan.getDatasourceId()); param.setSourceId(plan.getDatasourceId()); if (ObjectUtil.isNotNull(plan)) { plan.setErrorSysId(plan.getId()); + param.setCode(String.valueOf(plan.getCode())); String code = dictDataService.getDictDataById(plan.getPattern()).getCode(); DictDataEnum dictDataEnumByCode = DictDataEnum.getDictDataEnumByCode(code); switch (dictDataEnumByCode) { diff --git a/device/src/main/java/com/njcn/gather/device/script/service/impl/PqScriptDtlsServiceImpl.java b/device/src/main/java/com/njcn/gather/device/script/service/impl/PqScriptDtlsServiceImpl.java index e6dea178..053345f6 100644 --- a/device/src/main/java/com/njcn/gather/device/script/service/impl/PqScriptDtlsServiceImpl.java +++ b/device/src/main/java/com/njcn/gather/device/script/service/impl/PqScriptDtlsServiceImpl.java @@ -15,6 +15,7 @@ import com.njcn.gather.device.script.mapper.PqScriptMapper; import com.njcn.gather.device.script.pojo.param.PqScriptCheckDataParam; import com.njcn.gather.device.script.pojo.param.PqScriptIssueParam; import com.njcn.gather.device.script.pojo.po.PqScript; +import com.njcn.gather.device.script.pojo.po.PqScriptCheckData; import com.njcn.gather.device.script.pojo.po.PqScriptDtls; import com.njcn.gather.device.script.pojo.po.SourceIssue; import com.njcn.gather.device.script.service.IPqScriptCheckDataService; @@ -215,9 +216,8 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl