diff --git a/detection/src/main/java/com/njcn/gather/detection/controller/PunctualityController.java b/detection/src/main/java/com/njcn/gather/detection/controller/PunctualityController.java deleted file mode 100644 index b1a14f32..00000000 --- a/detection/src/main/java/com/njcn/gather/detection/controller/PunctualityController.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.njcn.gather.detection.controller; - -import com.njcn.common.pojo.annotation.OperateInfo; -import com.njcn.common.pojo.enums.response.CommonResponseEnum; -import com.njcn.common.pojo.response.HttpResult; -import com.njcn.web.controller.BaseController; -import com.njcn.web.utils.HttpResultUtil; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -/** - * @author wr - * @description - * @date 2024/12/10 14:25 - */ -@Slf4j -@Api(tags = "守时检测") -@RestController -@RequestMapping("/punctuality") -@RequiredArgsConstructor -public class PunctualityController extends BaseController { - -// private final PunctualityService punctualityService; - - @OperateInfo - @PostMapping("/deliveryTime") - @ApiOperation("下发守时检测") - @ApiImplicitParam(name = "queryParam", value = "查询参数", required = true) - public HttpResult list(@RequestBody Object param) { - String methodDescribe = getMethodDescribe("list"); -// punctualityService.triggerTimeMark(); - 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 cb5e3cbb..9ad6a525 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 @@ -1703,7 +1703,7 @@ public class SocketDevResponseService { adNonHarmonicResult.setSort(sourceIssue.getIndex()); adNonHarmonicResult.setAdType(checkDataMap.get(sqlDataDTO.getDesc())); - adNonHarmonicResult.setDataType("avg"); + adNonHarmonicResult.setDataType(sourceIssue.getDataType()); Double a = listDTO.getA(); Double b = listDTO.getB(); @@ -1735,7 +1735,7 @@ public class SocketDevResponseService { adHarmonicResult.setScriptId(param.getScriptId()); adHarmonicResult.setSort(sourceIssue.getIndex()); adHarmonicResult.setAdType(checkDataMap.get(sqlDataDTO.getDesc())); - adHarmonicResult.setDataType("avg"); + adHarmonicResult.setDataType(sourceIssue.getDataType()); if (!DicDataEnum.HSV.getCode().equals(sourceIssue.getType()) && !DicDataEnum.HSI.getCode().equals(sourceIssue.getType()) && !DicDataEnum.HP.getCode().equals(sourceIssue.getType())) { if (CollUtil.isNotEmpty(data.getSqlData())) { diff --git a/detection/src/main/java/com/njcn/gather/detection/handler/SocketSourceResponseService.java b/detection/src/main/java/com/njcn/gather/detection/handler/SocketSourceResponseService.java index 194bb2ba..cd554c7a 100644 --- a/detection/src/main/java/com/njcn/gather/detection/handler/SocketSourceResponseService.java +++ b/detection/src/main/java/com/njcn/gather/detection/handler/SocketSourceResponseService.java @@ -357,14 +357,10 @@ public class SocketSourceResponseService { socketMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue() + stepTag + sourceIssue.getType()); int ignoreCount; int readData; - if (sourceIssue.getType().equals(DicDataEnum.F.getCode())) { + if (DicDataEnum.F.getCode().equals(sourceIssue.getType())) { ignoreCount = 1; readData = 2; socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_01.getValue()); - } else if (sourceIssue.getType().equals(DicDataEnum.HP.getCode())) { - ignoreCount = 2; - readData = 5; - socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_01.getValue()); } else if (DicDataEnum.VOLTAGE.getCode().equals(sourceIssue.getType())) { ignoreCount = 5; readData = 1; @@ -372,9 +368,13 @@ public class SocketSourceResponseService { } else { ignoreCount = 5; readData = 5; - socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_02.getValue()); + //区分实时数据还是分钟数据 + if ("real".equals(sourceIssue.getDataType())) { + socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_02.getValue()); + } else { + socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_01.getValue()); + } } - List moniterIdList = devList.stream().flatMap(x -> x.getMonitorList().stream()).map(PreDetection.MonitorListDTO::getLineId).collect(Collectors.toList()); DevPhaseSequenceParam phaseSequenceParam = new DevPhaseSequenceParam(); phaseSequenceParam.setMoniterIdList(moniterIdList); diff --git a/detection/src/main/java/com/njcn/gather/detection/service/PunctualityService.java b/detection/src/main/java/com/njcn/gather/detection/service/PunctualityService.java deleted file mode 100644 index 1369ae90..00000000 --- a/detection/src/main/java/com/njcn/gather/detection/service/PunctualityService.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.njcn.gather.detection.service; - -/** - * @Description: 守时检测流程 - * @Author: wr - * @Date: 2024/12/10 14:23 - */ -public interface PunctualityService { - - /** - * 触发时间标识 - */ - void triggerTimeMark(); -} 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 e156d041..b4f81d7e 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 @@ -219,7 +219,7 @@ public class DetectionServiceImpl { result.setMonitorId(devID + "_" + split[1]); result.setScriptId(sourceIssue.getScriptId()); result.setSort(sourceIssue.getIndex()); - result.setDataType("avg"); + result.setDataType(sourceIssue.getDataType()); Integer isQualified; List dtlsCheckData = errDtlsCheckData.stream().filter(x -> x.getValueTypeCode().equals(s.split("\\$")[1])).collect(Collectors.toList()); if (CollUtil.isNotEmpty(dtlsCheckData)) { @@ -312,7 +312,7 @@ public class DetectionServiceImpl { List integerBooleanA = harmRangeComparison(isQualified, new ArrayList<>(), type, TYPE_A, sourceIssue, dataRule, devHarmMap.get(TYPE_A), fData, num); List integerBooleanB = harmRangeComparison(isQualified, new ArrayList<>(), type, TYPE_B, sourceIssue, dataRule, devHarmMap.get(TYPE_B), fData, num); List integerBooleanC = harmRangeComparison(isQualified, new ArrayList<>(), type, TYPE_C, sourceIssue, dataRule, devHarmMap.get(TYPE_C), fData, num); - harmonicResult.setDataType("avg"); + harmonicResult.setDataType(sourceIssue.getDataType()); reflectHarmonic("a", integerBooleanA, harmonicResult, num); reflectHarmonic("b", integerBooleanB, harmonicResult, num); reflectHarmonic("c", integerBooleanC, harmonicResult, num); @@ -375,7 +375,7 @@ public class DetectionServiceImpl { result.setMonitorId(devID + "_" + split[1]); result.setScriptId(sourceIssue.getScriptId()); result.setSort(sourceIssue.getIndex()); - result.setDataType("avg"); + result.setDataType(sourceIssue.getDataType()); List pqErrSysDtls = new ArrayList<>(); Integer isQualified = 4; if (CollUtil.isNotEmpty(errDtlsCheckData)) { @@ -498,7 +498,7 @@ public class DetectionServiceImpl { List integerBooleanA = harmRangeComparison(isQualified, pqErrSysDtls, type, TYPE_A, sourceIssue, dataRule, devMap.get(TYPE_A), fData, num); List integerBooleanB = harmRangeComparison(isQualified, pqErrSysDtls, type, TYPE_B, sourceIssue, dataRule, devMap.get(TYPE_B), fData, num); List integerBooleanC = harmRangeComparison(isQualified, pqErrSysDtls, type, TYPE_C, sourceIssue, dataRule, devMap.get(TYPE_C), fData, num); - harmonicResult.setDataType("avg"); + harmonicResult.setDataType(sourceIssue.getDataType()); reflectHarmonic("a", integerBooleanA, harmonicResult, num); reflectHarmonic("b", integerBooleanB, harmonicResult, num); reflectHarmonic("c", integerBooleanC, harmonicResult, num); @@ -558,7 +558,7 @@ public class DetectionServiceImpl { pqErrSysDtls = errDtlsCheckData.get(0).getErrSysDtls(); } } - result.setDataType("avg"); + result.setDataType(sourceIssue.getDataType()); if (StrUtil.isBlank(type)) { //取出源所对应的相别信息 List channelTypeAList = checkData.stream() @@ -729,7 +729,7 @@ public class DetectionServiceImpl { result.setMonitorId(devID + "_" + split[1]); result.setScriptId(sourceIssue.getScriptId()); result.setSort(sourceIssue.getIndex()); - result.setDataType("avg"); + result.setDataType(sourceIssue.getDataType()); List magErrList = new ArrayList<>(); Integer isQualified = 4; if (CollUtil.isNotEmpty(errDtlsCheckData)) { diff --git a/detection/src/main/java/com/njcn/gather/err/service/impl/PqErrSysServiceImpl.java b/detection/src/main/java/com/njcn/gather/err/service/impl/PqErrSysServiceImpl.java index d230e361..19bfb159 100644 --- a/detection/src/main/java/com/njcn/gather/err/service/impl/PqErrSysServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/err/service/impl/PqErrSysServiceImpl.java @@ -24,7 +24,6 @@ import com.njcn.gather.system.dictionary.service.IDictTreeService; import com.njcn.web.factory.PageFactory; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.ObjectUtils; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/detection/src/main/java/com/njcn/gather/monitor/service/impl/PqMonitorServiceImpl.java b/detection/src/main/java/com/njcn/gather/monitor/service/impl/PqMonitorServiceImpl.java index e6d01bf1..383396f8 100644 --- a/detection/src/main/java/com/njcn/gather/monitor/service/impl/PqMonitorServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/monitor/service/impl/PqMonitorServiceImpl.java @@ -3,7 +3,6 @@ package com.njcn.gather.monitor.service.impl; import cn.hutool.core.bean.BeanUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.njcn.gather.device.pojo.po.PqDev; import com.njcn.gather.monitor.mapper.PqMonitorMapper; import com.njcn.gather.monitor.pojo.param.PqMonitorParam; import com.njcn.gather.monitor.pojo.po.PqMonitor; diff --git a/detection/src/main/java/com/njcn/gather/result/pojo/vo/ResultVO.java b/detection/src/main/java/com/njcn/gather/result/pojo/vo/ResultVO.java index 4b0741e4..be98da8e 100644 --- a/detection/src/main/java/com/njcn/gather/result/pojo/vo/ResultVO.java +++ b/detection/src/main/java/com/njcn/gather/result/pojo/vo/ResultVO.java @@ -4,7 +4,6 @@ import com.njcn.gather.storage.pojo.vo.RawDataVO; import com.njcn.gather.storage.pojo.vo.RawResultDataVO; import lombok.Data; -import java.math.BigDecimal; import java.util.List; import java.util.Map; diff --git a/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptCheckDataParam.java b/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptCheckDataParam.java index a08e7049..336731cd 100644 --- a/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptCheckDataParam.java +++ b/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptCheckDataParam.java @@ -20,6 +20,12 @@ public class PqScriptCheckDataParam { @ApiModelProperty("相别,字典表") private String phase; + /** + * pq_script_checkdata 里dataType 删除,由根据计划中的数据源,来进行配置脚本增加扩展性 + */ + @ApiModelProperty("数据类型,来源于字典表,包括实时数据(3s)、分钟统计数据(1min/3min/5min/10min)等") + private String dataType; + @ApiModelProperty("检测指标类型(true:code(I$real) ,false展示id ,默认false)") private Boolean isValueTypeName=false; diff --git a/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptDtlsParam.java b/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptDtlsParam.java index af5f22a0..e3b519e9 100644 --- a/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptDtlsParam.java +++ b/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptDtlsParam.java @@ -84,11 +84,6 @@ public class PqScriptDtlsParam { */ private String pid; - /** - * 数据类型,来源于字典表,包括实时数据(3s)、分钟统计数据(1min/3min/5min/10min)等 - */ - private String dataType; - /** * 相别,字典表 */ diff --git a/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptIssueParam.java b/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptIssueParam.java index ab19365b..907aa48a 100644 --- a/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptIssueParam.java +++ b/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptIssueParam.java @@ -23,7 +23,7 @@ public class PqScriptIssueParam { @ApiModelProperty("终端id集合") private List devIds; - @ApiModelProperty() + @ApiModelProperty("校验步骤") private String isPhaseSequence; @ApiModelProperty("源id") diff --git a/detection/src/main/java/com/njcn/gather/script/pojo/po/PqScriptCheckData.java b/detection/src/main/java/com/njcn/gather/script/pojo/po/PqScriptCheckData.java index dc025289..c48298c2 100644 --- a/detection/src/main/java/com/njcn/gather/script/pojo/po/PqScriptCheckData.java +++ b/detection/src/main/java/com/njcn/gather/script/pojo/po/PqScriptCheckData.java @@ -39,10 +39,6 @@ public class PqScriptCheckData implements Serializable { @TableField(exist = false) private String valueTypeCode; - /** - * 数据类型,来源于字典表,包括实时数据(3s)、分钟统计数据(1min/3min/5min/10min)等 - */ - private String dataType; /** * 相别,字典表 diff --git a/detection/src/main/java/com/njcn/gather/script/pojo/po/SourceIssue.java b/detection/src/main/java/com/njcn/gather/script/pojo/po/SourceIssue.java index 6e63fb63..8a2bd8c6 100644 --- a/detection/src/main/java/com/njcn/gather/script/pojo/po/SourceIssue.java +++ b/detection/src/main/java/com/njcn/gather/script/pojo/po/SourceIssue.java @@ -50,6 +50,9 @@ public class SourceIssue { @JSONField(serialize = false) private List devValueTypeList; + @JSONField(serialize = false) + private String dataType; + @JSONField(serialize = false) private String desc; diff --git a/detection/src/main/java/com/njcn/gather/script/service/IPqScriptCheckDataService.java b/detection/src/main/java/com/njcn/gather/script/service/IPqScriptCheckDataService.java index f0f22be7..ac320d83 100644 --- a/detection/src/main/java/com/njcn/gather/script/service/IPqScriptCheckDataService.java +++ b/detection/src/main/java/com/njcn/gather/script/service/IPqScriptCheckDataService.java @@ -3,7 +3,6 @@ package com.njcn.gather.script.service; import com.baomidou.mybatisplus.extension.service.IService; import com.njcn.gather.script.pojo.param.PqScriptCheckDataParam; import com.njcn.gather.script.pojo.po.PqScriptCheckData; -import com.njcn.gather.script.pojo.vo.PqScriptCheckDataVO; import java.util.List; import java.util.Map; diff --git a/detection/src/main/java/com/njcn/gather/script/service/IPqScriptDtlsService.java b/detection/src/main/java/com/njcn/gather/script/service/IPqScriptDtlsService.java index 45f67d77..bd8d20b2 100644 --- a/detection/src/main/java/com/njcn/gather/script/service/IPqScriptDtlsService.java +++ b/detection/src/main/java/com/njcn/gather/script/service/IPqScriptDtlsService.java @@ -1,7 +1,6 @@ package com.njcn.gather.script.service; import com.baomidou.mybatisplus.extension.service.IService; -import com.njcn.gather.detection.pojo.param.DevPhaseSequenceParam; import com.njcn.gather.detection.pojo.param.PreDetectionParam; import com.njcn.gather.script.pojo.param.PqScriptDtlsParam; import com.njcn.gather.script.pojo.param.PqScriptIssueParam; @@ -9,11 +8,9 @@ import com.njcn.gather.script.pojo.param.ScriptParam; import com.njcn.gather.script.pojo.po.PqScriptCheckData; import com.njcn.gather.script.pojo.po.PqScriptDtls; import com.njcn.gather.script.pojo.po.SourceIssue; -import com.njcn.gather.script.pojo.vo.PqScriptCheckDataVO; import com.njcn.gather.script.pojo.vo.PqScriptDtlDataVO; import java.util.List; -import java.util.Map; /** * @author caozehui diff --git a/detection/src/main/java/com/njcn/gather/script/service/impl/PqScriptCheckDataServiceImpl.java b/detection/src/main/java/com/njcn/gather/script/service/impl/PqScriptCheckDataServiceImpl.java index 2bb07a63..8856f982 100644 --- a/detection/src/main/java/com/njcn/gather/script/service/impl/PqScriptCheckDataServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/script/service/impl/PqScriptCheckDataServiceImpl.java @@ -2,19 +2,17 @@ package com.njcn.gather.script.service.impl; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.yulichang.wrapper.MPJLambdaWrapper; import com.njcn.common.pojo.enums.common.DataStateEnum; -import com.njcn.common.pojo.enums.response.CommonResponseEnum; import com.njcn.common.pojo.exception.BusinessException; import com.njcn.gather.detection.pojo.enums.DetectionCodeEnum; import com.njcn.gather.detection.pojo.enums.DetectionResponseEnum; import com.njcn.gather.script.mapper.PqScriptCheckDataMapper; import com.njcn.gather.script.pojo.param.PqScriptCheckDataParam; import com.njcn.gather.script.pojo.po.PqScriptCheckData; -import com.njcn.gather.script.pojo.po.PqScriptDtls; -import com.njcn.gather.script.pojo.vo.PqScriptCheckDataVO; import com.njcn.gather.script.service.IPqScriptCheckDataService; import com.njcn.gather.system.dictionary.mapper.DictTreeMapper; import com.njcn.gather.system.dictionary.pojo.po.DictTree; @@ -36,61 +34,68 @@ import java.util.stream.Collectors; @RequiredArgsConstructor public class PqScriptCheckDataServiceImpl extends ServiceImpl implements IPqScriptCheckDataService { - private final String REAL="real$"; + private final String SYMBOL="$"; private final DictTreeMapper dictTreeMapper; @Override public List getValueType(PqScriptCheckDataParam param) { - MPJLambdaWrapper queryWrapper = new MPJLambdaWrapper<>(); - queryWrapper.selectAll(PqScriptCheckData.class) - .leftJoin(DictTree.class, DictTree::getId, PqScriptCheckData::getValueType) - .eq(PqScriptCheckData::getScriptId, param.getScriptId()) - .eq(ObjectUtil.isNotNull(param.getIndex()),PqScriptCheckData::getScriptIndex, param.getIndex()) - .eq(PqScriptCheckData::getEnable, DataStateEnum.ENABLE.getCode()); - if (param.getIsValueTypeName()) { - queryWrapper.selectAs(DictTree::getCode, PqScriptCheckData::getValueType); - } - List pqScriptCheckData = this.getBaseMapper().selectJoinList(PqScriptCheckData.class, queryWrapper); - if(CollUtil.isNotEmpty(pqScriptCheckData)){ + String dataType = param.getDataType(); + if(StrUtil.isNotBlank(dataType)){ + String[] split = dataType.split(","); + if (split.length > 1) { + dataType = split[0]; + } + MPJLambdaWrapper queryWrapper = new MPJLambdaWrapper<>(); + queryWrapper.selectAll(PqScriptCheckData.class) + .leftJoin(DictTree.class, DictTree::getId, PqScriptCheckData::getValueType) + .eq(PqScriptCheckData::getScriptId, param.getScriptId()) + .eq(ObjectUtil.isNotNull(param.getIndex()), PqScriptCheckData::getScriptIndex, param.getIndex()) + .eq(PqScriptCheckData::getEnable, DataStateEnum.ENABLE.getCode()); if (param.getIsValueTypeName()) { - List checkData = pqScriptCheckData.stream().map(x -> x.getDataType() + "$" + x.getValueType()).distinct().collect(Collectors.toList()); - String U = REAL + DetectionCodeEnum.U1.getCode(); - if(!checkData.contains(U)){ - if(checkData.contains(REAL+DetectionCodeEnum.V2_50.getCode())){ - checkData.add(U); + queryWrapper.selectAs(DictTree::getCode, PqScriptCheckData::getValueType); + } + List pqScriptCheckData = this.getBaseMapper().selectJoinList(PqScriptCheckData.class, queryWrapper); + if (CollUtil.isNotEmpty(pqScriptCheckData)) { + if (param.getIsValueTypeName()) { + final String finalDataType = dataType; + List checkData = pqScriptCheckData.stream().map(x -> finalDataType + SYMBOL + x.getValueType()).distinct().collect(Collectors.toList()); + String U = finalDataType + SYMBOL+ DetectionCodeEnum.U1.getCode(); + if (!checkData.contains(U)) { + if (checkData.contains(finalDataType + SYMBOL + DetectionCodeEnum.V2_50.getCode())) { + checkData.add(U); + } } - } - String I = REAL + DetectionCodeEnum.I1.getCode(); - if(!checkData.contains(I)){ - if(checkData.contains(REAL+DetectionCodeEnum.I2_50.getCode())){ - checkData.add(I); + String I = finalDataType + SYMBOL + DetectionCodeEnum.I1.getCode(); + if (!checkData.contains(I)) { + if (checkData.contains(finalDataType + SYMBOL + DetectionCodeEnum.I2_50.getCode())) { + checkData.add(I); + } } + return checkData.stream().distinct().collect(Collectors.toList()); + } else { + return pqScriptCheckData.stream().map(PqScriptCheckData::getValueType).distinct().collect(Collectors.toList()); } - return checkData.stream().distinct().collect(Collectors.toList()); - } else { - return pqScriptCheckData.stream().map(PqScriptCheckData::getValueType).distinct().collect(Collectors.toList()); } } return new ArrayList<>(); } @Override - public Map getValueTypeMap(String scriptId) { + public Map getValueTypeMap(String scriptId) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.select(PqScriptCheckData::getValueType) .eq(PqScriptCheckData::getScriptId, scriptId) .eq(PqScriptCheckData::getEnable, DataStateEnum.ENABLE.getCode()); List pqScriptCheckData = this.baseMapper.selectList(queryWrapper); - if(CollUtil.isEmpty(pqScriptCheckData)){ -// throw new BusinessException(CommonResponseEnum.FAIL,"测试脚本项暂无配置"); + if (CollUtil.isEmpty(pqScriptCheckData)) { throw new BusinessException(DetectionResponseEnum.SCRIPT_CHECK_DATA_NOT_EXIST); } List valueTypeList = pqScriptCheckData.stream().map(PqScriptCheckData::getValueType).distinct().collect(Collectors.toList()); LambdaQueryWrapper dictTreeLambdaQueryWrapper = new LambdaQueryWrapper<>(); - dictTreeLambdaQueryWrapper.in(DictTree::getId,valueTypeList).eq(DictTree::getState,DataStateEnum.DELETED.getCode()); + dictTreeLambdaQueryWrapper.in(DictTree::getId, valueTypeList).eq(DictTree::getState, DataStateEnum.DELETED.getCode()); List dictTreeList = dictTreeMapper.selectList(dictTreeLambdaQueryWrapper); - Map map = dictTreeList.stream().collect(Collectors.toMap(DictTree::getCode,DictTree::getId)); + Map map = dictTreeList.stream().collect(Collectors.toMap(DictTree::getCode, DictTree::getId)); return map; } @@ -111,16 +116,16 @@ public class PqScriptCheckDataServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); queryWrapper .eq(PqScriptCheckData::getScriptId, param.getScriptId()) - .eq(ObjectUtil.isNotNull(param.getIndex()),PqScriptCheckData::getScriptIndex, param.getIndex()) + .eq(ObjectUtil.isNotNull(param.getIndex()), PqScriptCheckData::getScriptIndex, param.getIndex()) .eq(PqScriptCheckData::getValueType, param.getValueType()) .eq(PqScriptCheckData::getPhase, param.getPhase()) .eq(PqScriptCheckData::getEnable, DataStateEnum.ENABLE.getCode()); PqScriptCheckData data = this.getBaseMapper().selectOne(queryWrapper); - if(ObjectUtil.isNotNull(data)){ + if (ObjectUtil.isNotNull(data)) { return data.getValue(); } - return null; + return null; } @Override diff --git a/detection/src/main/java/com/njcn/gather/script/service/impl/PqScriptDtlsServiceImpl.java b/detection/src/main/java/com/njcn/gather/script/service/impl/PqScriptDtlsServiceImpl.java index 7881da5a..5dfa21c6 100644 --- a/detection/src/main/java/com/njcn/gather/script/service/impl/PqScriptDtlsServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/script/service/impl/PqScriptDtlsServiceImpl.java @@ -11,13 +11,12 @@ import com.github.yulichang.wrapper.MPJLambdaWrapper; import com.njcn.common.pojo.enums.common.DataStateEnum; import com.njcn.gather.detection.pojo.enums.DetectionCodeEnum; import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum; -import com.njcn.gather.detection.pojo.param.DevPhaseSequenceParam; import com.njcn.gather.detection.pojo.param.PreDetectionParam; import com.njcn.gather.device.pojo.enums.CommonEnum; import com.njcn.gather.device.pojo.po.PqDev; import com.njcn.gather.device.service.IPqDevService; -import com.njcn.gather.icd.pojo.po.PqIcdPath; -import com.njcn.gather.icd.service.IPqIcdPathService; +import com.njcn.gather.plan.mapper.AdPlanMapper; +import com.njcn.gather.plan.pojo.po.AdPlan; import com.njcn.gather.script.mapper.PqScriptCheckDataMapper; import com.njcn.gather.script.mapper.PqScriptDtlsMapper; import com.njcn.gather.script.mapper.PqScriptMapper; @@ -29,7 +28,6 @@ import com.njcn.gather.script.pojo.po.PqScript; import com.njcn.gather.script.pojo.po.PqScriptCheckData; import com.njcn.gather.script.pojo.po.PqScriptDtls; import com.njcn.gather.script.pojo.po.SourceIssue; -import com.njcn.gather.script.pojo.vo.PqScriptCheckDataVO; import com.njcn.gather.script.pojo.vo.PqScriptDtlDataVO; import com.njcn.gather.script.service.IPqScriptCheckDataService; import com.njcn.gather.script.service.IPqScriptDtlsService; @@ -91,7 +89,7 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl listSourceIssue(PqScriptIssueParam param) { + String dataType; + if (StrUtil.isNotBlank(param.getPlanId())) { + AdPlan plan = adPlanMapper.selectById(param.getPlanId()); + dataType = plan.getDatasourceId(); + } else { + dataType = "real"; + } List sourceIssues = new ArrayList<>(); Set voltSet = new HashSet<>(1); Set currSet = new HashSet<>(1); @@ -200,6 +205,13 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl info, PqScriptDtlsParam.CheckData checkData, PqScriptDtlsParam.CheckData channelListDTO, List checkArchive, PqScriptDtlsParam.ChannelListDTO listDTO) { checkData.setPhase(listDTO.getChannelType().substring(1, 2).toUpperCase()); - checkData.setDataType(channelListDTO.getDataType()); checkData.setValueType(channelListDTO.getValueType()); checkData.setPid(channelListDTO.getPid()); setCheckValue(checkArchive, checkData, listDTO); @@ -725,7 +732,6 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl channelA = list.stream().filter(x -> x.getChannelType().contains("a")).collect(Collectors.toList()); @@ -739,7 +745,6 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl collect = checkArchive.stream().filter(x -> x.getPhase().equals(listDTO.getChannelType().substring(1, 2).toUpperCase())).collect(Collectors.toList()); if (CollUtil.isNotEmpty(collect)) { checkData.setValue(collect.get(0).getValue()); - checkData.setDataType(collect.get(0).getDataType()); } else { if (flyDeltaV) { checkData.setValue(0.0); @@ -794,7 +797,6 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl collect = checkArchive.stream().filter(x -> x.getPhase().equals(listDTO.getChannelType().substring(1, 2).toUpperCase())).collect(Collectors.toList()); if (CollUtil.isNotEmpty(collect)) { checkData.setValue(collect.get(0).getValue()); - checkData.setDataType(collect.get(0).getDataType()); } checkData.setPhase(listDTO.getChannelType().substring(1, 2).toUpperCase()); } @@ -831,7 +832,6 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl