代码微调

This commit is contained in:
wr
2025-01-08 15:09:25 +08:00
parent 6de6c0955d
commit bbbe729568
6 changed files with 29 additions and 13 deletions

View File

@@ -134,7 +134,7 @@ public class PreDetectionController extends BaseController {
List<PreDetection> pqDevList = iPqDevService.getDevInfo(param.getDevIds());
Map<String, String> 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);
}

View File

@@ -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<String> successXieyi = new ArrayList<>();
List<String> successXieyi3 = new ArrayList<>();
DictDataEnum dataRule;
//标识当前检测小项是否结束
@@ -826,7 +832,7 @@ public class SocketDevResponseService {
//开启线程进行入库原始数据操作
baseDataInsert(realDataXiList, sourceIssue, param, SocketManager.valueTypeMap);
Map<String, Integer> flag = detectionServiceImpl.text(realDataXiList, param.getErrorSysId(), devIdMapComm, sourceIssue, DictDataEnum.AT_WILL_VALUE);
Map<String, Integer> 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<String, SysRegResVO> 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("原始数据插入数据库执行成功=========================================");
// };

View File

@@ -56,4 +56,9 @@ public class PreDetectionParam {
* 所属误差体系
*/
private String errorSysId;
/**
* 自动生成,用于生成数据表后缀
*/
private String code;
}

View File

@@ -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<String, Integer> text(List<DevData> dev, String errorSysId, Map<String, String> devIdMapComm, SourceIssue issue, DictDataEnum dataRule) {
public Map<String, Integer> processing(List<DevData> dev, PreDetectionParam detection, Map<String, String> devIdMapComm, SourceIssue issue, DictDataEnum dataRule) {
Map<String, List<DevData>> devDataMap = dev.stream().collect(Collectors.groupingBy(DevData::getId));
Map<String, Integer> 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<Double> harmDataList, PqErrSysDtls errSysDtl, DetectionData data, Double v) {
List<Double> 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);

View File

@@ -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) {

View File

@@ -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<PqScriptDtlsMapper, PqS
queryWrapper.selectAll(PqScriptDtls.class)
.selectAs(DictTree::getCode, PqScriptDtls::getScriptCode)
.leftJoin(DictTree.class, DictTree::getId, PqScriptDtls::getScriptType)
.eq(PqScriptDtls::getEnable, 1).eq(PqScriptDtls::getIndex, 48);
// .eq(PqScriptDtls::getIndex, 48)
.eq(PqScriptCheckData::getEnable, DataStateEnum.ENABLE.getCode());
if (isPhaseSequence.equals(CommonEnum.PHASE_TEST.getValue())) {
//相序
queryWrapper.eq(PqScriptDtls::getIndex, -1)