优化数据源问题,删除检测脚本中值类型,由绑定检测计划中数据源来,获取是实时数据还是分钟数据

This commit is contained in:
wr
2025-04-29 11:36:04 +08:00
parent 4b41e2edd1
commit 2bdaabac6e
20 changed files with 83 additions and 144 deletions

View File

@@ -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);
}
}

View File

@@ -1703,7 +1703,7 @@ public class SocketDevResponseService {
adNonHarmonicResult.setSort(sourceIssue.getIndex()); adNonHarmonicResult.setSort(sourceIssue.getIndex());
adNonHarmonicResult.setAdType(checkDataMap.get(sqlDataDTO.getDesc())); adNonHarmonicResult.setAdType(checkDataMap.get(sqlDataDTO.getDesc()));
adNonHarmonicResult.setDataType("avg"); adNonHarmonicResult.setDataType(sourceIssue.getDataType());
Double a = listDTO.getA(); Double a = listDTO.getA();
Double b = listDTO.getB(); Double b = listDTO.getB();
@@ -1735,7 +1735,7 @@ public class SocketDevResponseService {
adHarmonicResult.setScriptId(param.getScriptId()); adHarmonicResult.setScriptId(param.getScriptId());
adHarmonicResult.setSort(sourceIssue.getIndex()); adHarmonicResult.setSort(sourceIssue.getIndex());
adHarmonicResult.setAdType(checkDataMap.get(sqlDataDTO.getDesc())); 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 (!DicDataEnum.HSV.getCode().equals(sourceIssue.getType()) && !DicDataEnum.HSI.getCode().equals(sourceIssue.getType()) && !DicDataEnum.HP.getCode().equals(sourceIssue.getType())) {
if (CollUtil.isNotEmpty(data.getSqlData())) { if (CollUtil.isNotEmpty(data.getSqlData())) {

View File

@@ -357,14 +357,10 @@ public class SocketSourceResponseService {
socketMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue() + stepTag + sourceIssue.getType()); socketMsg.setRequestId(SourceOperateCodeEnum.FORMAL_REAL.getValue() + stepTag + sourceIssue.getType());
int ignoreCount; int ignoreCount;
int readData; int readData;
if (sourceIssue.getType().equals(DicDataEnum.F.getCode())) { if (DicDataEnum.F.getCode().equals(sourceIssue.getType())) {
ignoreCount = 1; ignoreCount = 1;
readData = 2; readData = 2;
socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_01.getValue()); 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())) { } else if (DicDataEnum.VOLTAGE.getCode().equals(sourceIssue.getType())) {
ignoreCount = 5; ignoreCount = 5;
readData = 1; readData = 1;
@@ -372,9 +368,13 @@ public class SocketSourceResponseService {
} else { } else {
ignoreCount = 5; ignoreCount = 5;
readData = 5; readData = 5;
//区分实时数据还是分钟数据
if ("real".equals(sourceIssue.getDataType())) {
socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_02.getValue()); socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_02.getValue());
} else {
socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_DATA_REQUEST_01.getValue());
}
} }
List<String> moniterIdList = devList.stream().flatMap(x -> x.getMonitorList().stream()).map(PreDetection.MonitorListDTO::getLineId).collect(Collectors.toList()); List<String> moniterIdList = devList.stream().flatMap(x -> x.getMonitorList().stream()).map(PreDetection.MonitorListDTO::getLineId).collect(Collectors.toList());
DevPhaseSequenceParam phaseSequenceParam = new DevPhaseSequenceParam(); DevPhaseSequenceParam phaseSequenceParam = new DevPhaseSequenceParam();
phaseSequenceParam.setMoniterIdList(moniterIdList); phaseSequenceParam.setMoniterIdList(moniterIdList);

View File

@@ -1,14 +0,0 @@
package com.njcn.gather.detection.service;
/**
* @Description: 守时检测流程
* @Author: wr
* @Date: 2024/12/10 14:23
*/
public interface PunctualityService {
/**
* 触发时间标识
*/
void triggerTimeMark();
}

View File

@@ -219,7 +219,7 @@ public class DetectionServiceImpl {
result.setMonitorId(devID + "_" + split[1]); result.setMonitorId(devID + "_" + split[1]);
result.setScriptId(sourceIssue.getScriptId()); result.setScriptId(sourceIssue.getScriptId());
result.setSort(sourceIssue.getIndex()); result.setSort(sourceIssue.getIndex());
result.setDataType("avg"); result.setDataType(sourceIssue.getDataType());
Integer isQualified; Integer isQualified;
List<ErrDtlsCheckDataVO> dtlsCheckData = errDtlsCheckData.stream().filter(x -> x.getValueTypeCode().equals(s.split("\\$")[1])).collect(Collectors.toList()); List<ErrDtlsCheckDataVO> dtlsCheckData = errDtlsCheckData.stream().filter(x -> x.getValueTypeCode().equals(s.split("\\$")[1])).collect(Collectors.toList());
if (CollUtil.isNotEmpty(dtlsCheckData)) { if (CollUtil.isNotEmpty(dtlsCheckData)) {
@@ -312,7 +312,7 @@ public class DetectionServiceImpl {
List<DetectionData> integerBooleanA = harmRangeComparison(isQualified, new ArrayList<>(), type, TYPE_A, sourceIssue, dataRule, devHarmMap.get(TYPE_A), fData, num); List<DetectionData> integerBooleanA = harmRangeComparison(isQualified, new ArrayList<>(), type, TYPE_A, sourceIssue, dataRule, devHarmMap.get(TYPE_A), fData, num);
List<DetectionData> integerBooleanB = harmRangeComparison(isQualified, new ArrayList<>(), type, TYPE_B, sourceIssue, dataRule, devHarmMap.get(TYPE_B), fData, num); List<DetectionData> integerBooleanB = harmRangeComparison(isQualified, new ArrayList<>(), type, TYPE_B, sourceIssue, dataRule, devHarmMap.get(TYPE_B), fData, num);
List<DetectionData> integerBooleanC = harmRangeComparison(isQualified, new ArrayList<>(), type, TYPE_C, sourceIssue, dataRule, devHarmMap.get(TYPE_C), fData, num); List<DetectionData> 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("a", integerBooleanA, harmonicResult, num);
reflectHarmonic("b", integerBooleanB, harmonicResult, num); reflectHarmonic("b", integerBooleanB, harmonicResult, num);
reflectHarmonic("c", integerBooleanC, harmonicResult, num); reflectHarmonic("c", integerBooleanC, harmonicResult, num);
@@ -375,7 +375,7 @@ public class DetectionServiceImpl {
result.setMonitorId(devID + "_" + split[1]); result.setMonitorId(devID + "_" + split[1]);
result.setScriptId(sourceIssue.getScriptId()); result.setScriptId(sourceIssue.getScriptId());
result.setSort(sourceIssue.getIndex()); result.setSort(sourceIssue.getIndex());
result.setDataType("avg"); result.setDataType(sourceIssue.getDataType());
List<PqErrSysDtls> pqErrSysDtls = new ArrayList<>(); List<PqErrSysDtls> pqErrSysDtls = new ArrayList<>();
Integer isQualified = 4; Integer isQualified = 4;
if (CollUtil.isNotEmpty(errDtlsCheckData)) { if (CollUtil.isNotEmpty(errDtlsCheckData)) {
@@ -498,7 +498,7 @@ public class DetectionServiceImpl {
List<DetectionData> integerBooleanA = harmRangeComparison(isQualified, pqErrSysDtls, type, TYPE_A, sourceIssue, dataRule, devMap.get(TYPE_A), fData, num); List<DetectionData> integerBooleanA = harmRangeComparison(isQualified, pqErrSysDtls, type, TYPE_A, sourceIssue, dataRule, devMap.get(TYPE_A), fData, num);
List<DetectionData> integerBooleanB = harmRangeComparison(isQualified, pqErrSysDtls, type, TYPE_B, sourceIssue, dataRule, devMap.get(TYPE_B), fData, num); List<DetectionData> integerBooleanB = harmRangeComparison(isQualified, pqErrSysDtls, type, TYPE_B, sourceIssue, dataRule, devMap.get(TYPE_B), fData, num);
List<DetectionData> integerBooleanC = harmRangeComparison(isQualified, pqErrSysDtls, type, TYPE_C, sourceIssue, dataRule, devMap.get(TYPE_C), fData, num); List<DetectionData> 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("a", integerBooleanA, harmonicResult, num);
reflectHarmonic("b", integerBooleanB, harmonicResult, num); reflectHarmonic("b", integerBooleanB, harmonicResult, num);
reflectHarmonic("c", integerBooleanC, harmonicResult, num); reflectHarmonic("c", integerBooleanC, harmonicResult, num);
@@ -558,7 +558,7 @@ public class DetectionServiceImpl {
pqErrSysDtls = errDtlsCheckData.get(0).getErrSysDtls(); pqErrSysDtls = errDtlsCheckData.get(0).getErrSysDtls();
} }
} }
result.setDataType("avg"); result.setDataType(sourceIssue.getDataType());
if (StrUtil.isBlank(type)) { if (StrUtil.isBlank(type)) {
//取出源所对应的相别信息 //取出源所对应的相别信息
List<PqScriptCheckData> channelTypeAList = checkData.stream() List<PqScriptCheckData> channelTypeAList = checkData.stream()
@@ -729,7 +729,7 @@ public class DetectionServiceImpl {
result.setMonitorId(devID + "_" + split[1]); result.setMonitorId(devID + "_" + split[1]);
result.setScriptId(sourceIssue.getScriptId()); result.setScriptId(sourceIssue.getScriptId());
result.setSort(sourceIssue.getIndex()); result.setSort(sourceIssue.getIndex());
result.setDataType("avg"); result.setDataType(sourceIssue.getDataType());
List<PqErrSysDtls> magErrList = new ArrayList<>(); List<PqErrSysDtls> magErrList = new ArrayList<>();
Integer isQualified = 4; Integer isQualified = 4;
if (CollUtil.isNotEmpty(errDtlsCheckData)) { if (CollUtil.isNotEmpty(errDtlsCheckData)) {

View File

@@ -24,7 +24,6 @@ import com.njcn.gather.system.dictionary.service.IDictTreeService;
import com.njcn.web.factory.PageFactory; import com.njcn.web.factory.PageFactory;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;

View File

@@ -3,7 +3,6 @@ package com.njcn.gather.monitor.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 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.mapper.PqMonitorMapper;
import com.njcn.gather.monitor.pojo.param.PqMonitorParam; import com.njcn.gather.monitor.pojo.param.PqMonitorParam;
import com.njcn.gather.monitor.pojo.po.PqMonitor; import com.njcn.gather.monitor.pojo.po.PqMonitor;

View File

@@ -4,7 +4,6 @@ import com.njcn.gather.storage.pojo.vo.RawDataVO;
import com.njcn.gather.storage.pojo.vo.RawResultDataVO; import com.njcn.gather.storage.pojo.vo.RawResultDataVO;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;

View File

@@ -20,6 +20,12 @@ public class PqScriptCheckDataParam {
@ApiModelProperty("相别,字典表") @ApiModelProperty("相别,字典表")
private String phase; private String phase;
/**
* pq_script_checkdata 里dataType 删除,由根据计划中的数据源,来进行配置脚本增加扩展性
*/
@ApiModelProperty("数据类型,来源于字典表,包括实时数据(3s)、分钟统计数据(1min/3min/5min/10min)等")
private String dataType;
@ApiModelProperty("检测指标类型(true:code(I$real) false展示id 默认false)") @ApiModelProperty("检测指标类型(true:code(I$real) false展示id 默认false)")
private Boolean isValueTypeName=false; private Boolean isValueTypeName=false;

View File

@@ -84,11 +84,6 @@ public class PqScriptDtlsParam {
*/ */
private String pid; private String pid;
/**
* 数据类型,来源于字典表,包括实时数据(3s)、分钟统计数据(1min/3min/5min/10min)等
*/
private String dataType;
/** /**
* 相别,字典表 * 相别,字典表
*/ */

View File

@@ -23,7 +23,7 @@ public class PqScriptIssueParam {
@ApiModelProperty("终端id集合") @ApiModelProperty("终端id集合")
private List<String> devIds; private List<String> devIds;
@ApiModelProperty() @ApiModelProperty("校验步骤")
private String isPhaseSequence; private String isPhaseSequence;
@ApiModelProperty("源id") @ApiModelProperty("源id")

View File

@@ -39,10 +39,6 @@ public class PqScriptCheckData implements Serializable {
@TableField(exist = false) @TableField(exist = false)
private String valueTypeCode; private String valueTypeCode;
/**
* 数据类型,来源于字典表,包括实时数据(3s)、分钟统计数据(1min/3min/5min/10min)等
*/
private String dataType;
/** /**
* 相别,字典表 * 相别,字典表

View File

@@ -50,6 +50,9 @@ public class SourceIssue {
@JSONField(serialize = false) @JSONField(serialize = false)
private List<String> devValueTypeList; private List<String> devValueTypeList;
@JSONField(serialize = false)
private String dataType;
@JSONField(serialize = false) @JSONField(serialize = false)
private String desc; private String desc;

View File

@@ -3,7 +3,6 @@ package com.njcn.gather.script.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.gather.script.pojo.param.PqScriptCheckDataParam; import com.njcn.gather.script.pojo.param.PqScriptCheckDataParam;
import com.njcn.gather.script.pojo.po.PqScriptCheckData; import com.njcn.gather.script.pojo.po.PqScriptCheckData;
import com.njcn.gather.script.pojo.vo.PqScriptCheckDataVO;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;

View File

@@ -1,7 +1,6 @@
package com.njcn.gather.script.service; package com.njcn.gather.script.service;
import com.baomidou.mybatisplus.extension.service.IService; 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.detection.pojo.param.PreDetectionParam;
import com.njcn.gather.script.pojo.param.PqScriptDtlsParam; import com.njcn.gather.script.pojo.param.PqScriptDtlsParam;
import com.njcn.gather.script.pojo.param.PqScriptIssueParam; 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.PqScriptCheckData;
import com.njcn.gather.script.pojo.po.PqScriptDtls; import com.njcn.gather.script.pojo.po.PqScriptDtls;
import com.njcn.gather.script.pojo.po.SourceIssue; 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.pojo.vo.PqScriptDtlDataVO;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @author caozehui * @author caozehui

View File

@@ -2,19 +2,17 @@ package com.njcn.gather.script.service.impl;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper; import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.njcn.common.pojo.enums.common.DataStateEnum; 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.common.pojo.exception.BusinessException;
import com.njcn.gather.detection.pojo.enums.DetectionCodeEnum; import com.njcn.gather.detection.pojo.enums.DetectionCodeEnum;
import com.njcn.gather.detection.pojo.enums.DetectionResponseEnum; import com.njcn.gather.detection.pojo.enums.DetectionResponseEnum;
import com.njcn.gather.script.mapper.PqScriptCheckDataMapper; import com.njcn.gather.script.mapper.PqScriptCheckDataMapper;
import com.njcn.gather.script.pojo.param.PqScriptCheckDataParam; import com.njcn.gather.script.pojo.param.PqScriptCheckDataParam;
import com.njcn.gather.script.pojo.po.PqScriptCheckData; 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.script.service.IPqScriptCheckDataService;
import com.njcn.gather.system.dictionary.mapper.DictTreeMapper; import com.njcn.gather.system.dictionary.mapper.DictTreeMapper;
import com.njcn.gather.system.dictionary.pojo.po.DictTree; import com.njcn.gather.system.dictionary.pojo.po.DictTree;
@@ -36,12 +34,18 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor @RequiredArgsConstructor
public class PqScriptCheckDataServiceImpl extends ServiceImpl<PqScriptCheckDataMapper, PqScriptCheckData> implements IPqScriptCheckDataService { public class PqScriptCheckDataServiceImpl extends ServiceImpl<PqScriptCheckDataMapper, PqScriptCheckData> implements IPqScriptCheckDataService {
private final String REAL="real$"; private final String SYMBOL="$";
private final DictTreeMapper dictTreeMapper; private final DictTreeMapper dictTreeMapper;
@Override @Override
public List<String> getValueType(PqScriptCheckDataParam param) { public List<String> getValueType(PqScriptCheckDataParam param) {
String dataType = param.getDataType();
if(StrUtil.isNotBlank(dataType)){
String[] split = dataType.split(",");
if (split.length > 1) {
dataType = split[0];
}
MPJLambdaWrapper<PqScriptCheckData> queryWrapper = new MPJLambdaWrapper<>(); MPJLambdaWrapper<PqScriptCheckData> queryWrapper = new MPJLambdaWrapper<>();
queryWrapper.selectAll(PqScriptCheckData.class) queryWrapper.selectAll(PqScriptCheckData.class)
.leftJoin(DictTree.class, DictTree::getId, PqScriptCheckData::getValueType) .leftJoin(DictTree.class, DictTree::getId, PqScriptCheckData::getValueType)
@@ -54,16 +58,17 @@ public class PqScriptCheckDataServiceImpl extends ServiceImpl<PqScriptCheckDataM
List<PqScriptCheckData> pqScriptCheckData = this.getBaseMapper().selectJoinList(PqScriptCheckData.class, queryWrapper); List<PqScriptCheckData> pqScriptCheckData = this.getBaseMapper().selectJoinList(PqScriptCheckData.class, queryWrapper);
if (CollUtil.isNotEmpty(pqScriptCheckData)) { if (CollUtil.isNotEmpty(pqScriptCheckData)) {
if (param.getIsValueTypeName()) { if (param.getIsValueTypeName()) {
List<String> checkData = pqScriptCheckData.stream().map(x -> x.getDataType() + "$" + x.getValueType()).distinct().collect(Collectors.toList()); final String finalDataType = dataType;
String U = REAL + DetectionCodeEnum.U1.getCode(); List<String> 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(U)) {
if(checkData.contains(REAL+DetectionCodeEnum.V2_50.getCode())){ if (checkData.contains(finalDataType + SYMBOL + DetectionCodeEnum.V2_50.getCode())) {
checkData.add(U); checkData.add(U);
} }
} }
String I = REAL + DetectionCodeEnum.I1.getCode(); String I = finalDataType + SYMBOL + DetectionCodeEnum.I1.getCode();
if (!checkData.contains(I)) { if (!checkData.contains(I)) {
if(checkData.contains(REAL+DetectionCodeEnum.I2_50.getCode())){ if (checkData.contains(finalDataType + SYMBOL + DetectionCodeEnum.I2_50.getCode())) {
checkData.add(I); checkData.add(I);
} }
} }
@@ -72,6 +77,7 @@ public class PqScriptCheckDataServiceImpl extends ServiceImpl<PqScriptCheckDataM
return pqScriptCheckData.stream().map(PqScriptCheckData::getValueType).distinct().collect(Collectors.toList()); return pqScriptCheckData.stream().map(PqScriptCheckData::getValueType).distinct().collect(Collectors.toList());
} }
} }
}
return new ArrayList<>(); return new ArrayList<>();
} }
@@ -83,7 +89,6 @@ public class PqScriptCheckDataServiceImpl extends ServiceImpl<PqScriptCheckDataM
.eq(PqScriptCheckData::getEnable, DataStateEnum.ENABLE.getCode()); .eq(PqScriptCheckData::getEnable, DataStateEnum.ENABLE.getCode());
List<PqScriptCheckData> pqScriptCheckData = this.baseMapper.selectList(queryWrapper); List<PqScriptCheckData> pqScriptCheckData = this.baseMapper.selectList(queryWrapper);
if (CollUtil.isEmpty(pqScriptCheckData)) { if (CollUtil.isEmpty(pqScriptCheckData)) {
// throw new BusinessException(CommonResponseEnum.FAIL,"测试脚本项暂无配置");
throw new BusinessException(DetectionResponseEnum.SCRIPT_CHECK_DATA_NOT_EXIST); throw new BusinessException(DetectionResponseEnum.SCRIPT_CHECK_DATA_NOT_EXIST);
} }
List<String> valueTypeList = pqScriptCheckData.stream().map(PqScriptCheckData::getValueType).distinct().collect(Collectors.toList()); List<String> valueTypeList = pqScriptCheckData.stream().map(PqScriptCheckData::getValueType).distinct().collect(Collectors.toList());

View File

@@ -11,13 +11,12 @@ import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.njcn.common.pojo.enums.common.DataStateEnum; import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.gather.detection.pojo.enums.DetectionCodeEnum; import com.njcn.gather.detection.pojo.enums.DetectionCodeEnum;
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum; 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.detection.pojo.param.PreDetectionParam;
import com.njcn.gather.device.pojo.enums.CommonEnum; import com.njcn.gather.device.pojo.enums.CommonEnum;
import com.njcn.gather.device.pojo.po.PqDev; import com.njcn.gather.device.pojo.po.PqDev;
import com.njcn.gather.device.service.IPqDevService; import com.njcn.gather.device.service.IPqDevService;
import com.njcn.gather.icd.pojo.po.PqIcdPath; import com.njcn.gather.plan.mapper.AdPlanMapper;
import com.njcn.gather.icd.service.IPqIcdPathService; import com.njcn.gather.plan.pojo.po.AdPlan;
import com.njcn.gather.script.mapper.PqScriptCheckDataMapper; import com.njcn.gather.script.mapper.PqScriptCheckDataMapper;
import com.njcn.gather.script.mapper.PqScriptDtlsMapper; import com.njcn.gather.script.mapper.PqScriptDtlsMapper;
import com.njcn.gather.script.mapper.PqScriptMapper; 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.PqScriptCheckData;
import com.njcn.gather.script.pojo.po.PqScriptDtls; import com.njcn.gather.script.pojo.po.PqScriptDtls;
import com.njcn.gather.script.pojo.po.SourceIssue; 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.pojo.vo.PqScriptDtlDataVO;
import com.njcn.gather.script.service.IPqScriptCheckDataService; import com.njcn.gather.script.service.IPqScriptCheckDataService;
import com.njcn.gather.script.service.IPqScriptDtlsService; import com.njcn.gather.script.service.IPqScriptDtlsService;
@@ -91,7 +89,7 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
private final PqScriptCheckDataMapper pqScriptCheckDataMapper; private final PqScriptCheckDataMapper pqScriptCheckDataMapper;
private final IDevTypeService devTypeService; private final IDevTypeService devTypeService;
private final IDictTreeService dictTreeService; private final IDictTreeService dictTreeService;
private final IPqIcdPathService pqIcdPathService; private final AdPlanMapper adPlanMapper;
@Override @Override
@Transactional @Transactional
@@ -134,6 +132,13 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
@Override @Override
public List<SourceIssue> listSourceIssue(PqScriptIssueParam param) { public List<SourceIssue> listSourceIssue(PqScriptIssueParam param) {
String dataType;
if (StrUtil.isNotBlank(param.getPlanId())) {
AdPlan plan = adPlanMapper.selectById(param.getPlanId());
dataType = plan.getDatasourceId();
} else {
dataType = "real";
}
List<SourceIssue> sourceIssues = new ArrayList<>(); List<SourceIssue> sourceIssues = new ArrayList<>();
Set<Double> voltSet = new HashSet<>(1); Set<Double> voltSet = new HashSet<>(1);
Set<Double> currSet = new HashSet<>(1); Set<Double> currSet = new HashSet<>(1);
@@ -200,6 +205,13 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
checkDataParam.setScriptId(freqDtls.getScriptId()); checkDataParam.setScriptId(freqDtls.getScriptId());
checkDataParam.setIndex(freqDtls.getScriptIndex()); checkDataParam.setIndex(freqDtls.getScriptIndex());
checkDataParam.setIsValueTypeName(true); checkDataParam.setIsValueTypeName(true);
if(DicDataEnum.F.getCode().equals(issue.getType())||DicDataEnum.VOLTAGE.getCode().equals(issue.getType())){
checkDataParam.setDataType("avg");
issue.setDataType("avg");
}else {
checkDataParam.setDataType(dataType);
issue.setDataType(dataType);
}
issue.setDevValueTypeList(pqScriptCheckDataService.getValueType(checkDataParam)); issue.setDevValueTypeList(pqScriptCheckDataService.getValueType(checkDataParam));
issue.setDesc(ScriptDtlsDesc.getStringBuffer(value, true, isValueType).toString()); issue.setDesc(ScriptDtlsDesc.getStringBuffer(value, true, isValueType).toString());
issue.setScriptId(freqDtls.getScriptId()); issue.setScriptId(freqDtls.getScriptId());
@@ -283,7 +295,6 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
data.setScriptId(sourceIssue.getScriptId()); data.setScriptId(sourceIssue.getScriptId());
data.setScriptIndex(i); data.setScriptIndex(i);
data.setValueType(checkData.getValueType()); data.setValueType(checkData.getValueType());
data.setDataType(checkData.getDataType());
data.setPhase(checkData.getPhase()); data.setPhase(checkData.getPhase());
data.setValue(checkData.getValue()); data.setValue(checkData.getValue());
data.setHarmNum(checkData.getHarmNum()); data.setHarmNum(checkData.getHarmNum());
@@ -439,10 +450,8 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
checkData.setErrorFlag(channelListDTO.getErrorFlag()); checkData.setErrorFlag(channelListDTO.getErrorFlag());
checkData.setEnable(channelListDTO.getEnable()); checkData.setEnable(channelListDTO.getEnable());
checkData.setPhase("T"); checkData.setPhase("T");
checkData.setDataType(channelListDTO.getDataType());
if (CollUtil.isNotEmpty(checkArchive)) { if (CollUtil.isNotEmpty(checkArchive)) {
checkData.setValue(checkArchive.get(0).getValue()); checkData.setValue(checkArchive.get(0).getValue());
checkData.setDataType(checkArchive.get(0).getDataType());
} else { } else {
checkData.setValue(sourceIssue.getFFreq()); checkData.setValue(sourceIssue.getFFreq());
} }
@@ -472,7 +481,6 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
checkData.setErrorFlag(channelListDTO.getErrorFlag()); checkData.setErrorFlag(channelListDTO.getErrorFlag());
checkData.setEnable(channelListDTO.getEnable()); checkData.setEnable(channelListDTO.getEnable());
checkData.setValue(listDTO.getFPhase()); checkData.setValue(listDTO.getFPhase());
checkData.setDataType(channelListDTO.getDataType());
checkData.setValueType(channelListDTO.getValueType()); checkData.setValueType(channelListDTO.getValueType());
checkData.setPid(channelListDTO.getPid()); checkData.setPid(channelListDTO.getPid());
setCheckValue(checkArchive, checkData, listDTO); setCheckValue(checkArchive, checkData, listDTO);
@@ -610,7 +618,6 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
private void setCheck(List<PqScriptDtlsParam.CheckData> info, PqScriptDtlsParam.CheckData checkData, PqScriptDtlsParam.CheckData channelListDTO, List<PqScriptCheckData> checkArchive, PqScriptDtlsParam.ChannelListDTO listDTO) { private void setCheck(List<PqScriptDtlsParam.CheckData> info, PqScriptDtlsParam.CheckData checkData, PqScriptDtlsParam.CheckData channelListDTO, List<PqScriptCheckData> checkArchive, PqScriptDtlsParam.ChannelListDTO listDTO) {
checkData.setPhase(listDTO.getChannelType().substring(1, 2).toUpperCase()); checkData.setPhase(listDTO.getChannelType().substring(1, 2).toUpperCase());
checkData.setDataType(channelListDTO.getDataType());
checkData.setValueType(channelListDTO.getValueType()); checkData.setValueType(channelListDTO.getValueType());
checkData.setPid(channelListDTO.getPid()); checkData.setPid(channelListDTO.getPid());
setCheckValue(checkArchive, checkData, listDTO); setCheckValue(checkArchive, checkData, listDTO);
@@ -725,7 +732,6 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
checkData.setErrorFlag(channelListDTO.getErrorFlag()); checkData.setErrorFlag(channelListDTO.getErrorFlag());
checkData.setEnable(channelListDTO.getEnable()); checkData.setEnable(channelListDTO.getEnable());
checkData.setPhase("T"); checkData.setPhase("T");
checkData.setDataType(channelListDTO.getDataType());
checkData.setValueType(channelListDTO.getValueType()); checkData.setValueType(channelListDTO.getValueType());
checkData.setPid(channelListDTO.getPid()); checkData.setPid(channelListDTO.getPid());
List<PqScriptDtlsParam.ChannelListDTO> channelA = list.stream().filter(x -> x.getChannelType().contains("a")).collect(Collectors.toList()); List<PqScriptDtlsParam.ChannelListDTO> channelA = list.stream().filter(x -> x.getChannelType().contains("a")).collect(Collectors.toList());
@@ -739,7 +745,6 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
} }
if (CollUtil.isNotEmpty(checkArchive)) { if (CollUtil.isNotEmpty(checkArchive)) {
checkData.setValue(checkArchive.get(0).getValue()); checkData.setValue(checkArchive.get(0).getValue());
checkData.setDataType(checkArchive.get(0).getDataType());
} }
info.add(checkData); info.add(checkData);
} }
@@ -758,13 +763,11 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
checkData.setErrorFlag(channelListDTO.getErrorFlag()); checkData.setErrorFlag(channelListDTO.getErrorFlag());
checkData.setEnable(channelListDTO.getEnable()); checkData.setEnable(channelListDTO.getEnable());
checkData.setPhase(listDTO.getChannelType().substring(1, 2).toUpperCase()); checkData.setPhase(listDTO.getChannelType().substring(1, 2).toUpperCase());
checkData.setDataType(channelListDTO.getDataType());
checkData.setValueType(channelListDTO.getValueType()); checkData.setValueType(channelListDTO.getValueType());
checkData.setPid(channelListDTO.getPid()); checkData.setPid(channelListDTO.getPid());
List<PqScriptCheckData> collect = checkArchive.stream().filter(x -> x.getPhase().equals(listDTO.getChannelType().substring(1, 2).toUpperCase())).collect(Collectors.toList()); List<PqScriptCheckData> collect = checkArchive.stream().filter(x -> x.getPhase().equals(listDTO.getChannelType().substring(1, 2).toUpperCase())).collect(Collectors.toList());
if (CollUtil.isNotEmpty(collect)) { if (CollUtil.isNotEmpty(collect)) {
checkData.setValue(collect.get(0).getValue()); checkData.setValue(collect.get(0).getValue());
checkData.setDataType(collect.get(0).getDataType());
} else { } else {
if (flyDeltaV) { if (flyDeltaV) {
checkData.setValue(0.0); checkData.setValue(0.0);
@@ -794,7 +797,6 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
checkData.setEnable(channelListDTO.getEnable()); checkData.setEnable(channelListDTO.getEnable());
checkData.setValue(inharmModel.getFAmp()); checkData.setValue(inharmModel.getFAmp());
checkData.setHarmNum(inharmModel.getInharm()); checkData.setHarmNum(inharmModel.getInharm());
checkData.setDataType(channelListDTO.getDataType());
checkData.setValueType(channelListDTO.getValueType()); checkData.setValueType(channelListDTO.getValueType());
checkData.setPid(channelListDTO.getPid()); checkData.setPid(channelListDTO.getPid());
setCheckValue(checkArchive, checkData, listDTO); setCheckValue(checkArchive, checkData, listDTO);
@@ -809,7 +811,6 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
List<PqScriptCheckData> collect = checkArchive.stream().filter(x -> x.getPhase().equals(listDTO.getChannelType().substring(1, 2).toUpperCase())).collect(Collectors.toList()); List<PqScriptCheckData> collect = checkArchive.stream().filter(x -> x.getPhase().equals(listDTO.getChannelType().substring(1, 2).toUpperCase())).collect(Collectors.toList());
if (CollUtil.isNotEmpty(collect)) { if (CollUtil.isNotEmpty(collect)) {
checkData.setValue(collect.get(0).getValue()); checkData.setValue(collect.get(0).getValue());
checkData.setDataType(collect.get(0).getDataType());
} }
checkData.setPhase(listDTO.getChannelType().substring(1, 2).toUpperCase()); checkData.setPhase(listDTO.getChannelType().substring(1, 2).toUpperCase());
} }
@@ -831,7 +832,6 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
checkData.setValue(harmModel.getFAmp()); checkData.setValue(harmModel.getFAmp());
checkData.setPhase(listDTO.getChannelType().substring(1, 2).toUpperCase()); checkData.setPhase(listDTO.getChannelType().substring(1, 2).toUpperCase());
checkData.setHarmNum(harmModel.getHarm()); checkData.setHarmNum(harmModel.getHarm());
checkData.setDataType(channelListDTO.getDataType());
checkData.setValueType(channelListDTO.getValueType()); checkData.setValueType(channelListDTO.getValueType());
checkData.setPid(channelListDTO.getPid()); checkData.setPid(channelListDTO.getPid());
setCheckValue(checkArchive, checkData, listDTO); setCheckValue(checkArchive, checkData, listDTO);

View File

@@ -8,7 +8,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.enums.common.DataStateEnum; import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.gather.plan.pojo.param.AdPlanParam;
import com.njcn.gather.pojo.enums.DetectionResponseEnum; import com.njcn.gather.pojo.enums.DetectionResponseEnum;
import com.njcn.gather.script.mapper.PqScriptMapper; import com.njcn.gather.script.mapper.PqScriptMapper;
import com.njcn.gather.script.pojo.param.PqScriptParam; import com.njcn.gather.script.pojo.param.PqScriptParam;

View File

@@ -14,7 +14,6 @@ import com.njcn.gather.storage.mapper.AdNonHarmonicMapper;
import com.njcn.gather.storage.pojo.param.SingleNonHarmParam; import com.njcn.gather.storage.pojo.param.SingleNonHarmParam;
import com.njcn.gather.storage.pojo.param.StorageParam; import com.njcn.gather.storage.pojo.param.StorageParam;
import com.njcn.gather.storage.pojo.po.AdBaseResult; import com.njcn.gather.storage.pojo.po.AdBaseResult;
import com.njcn.gather.storage.pojo.po.AdHarmonicResult;
import com.njcn.gather.storage.pojo.po.AdNonHarmonicResult; import com.njcn.gather.storage.pojo.po.AdNonHarmonicResult;
import com.njcn.gather.storage.pojo.vo.RawDataVO; import com.njcn.gather.storage.pojo.vo.RawDataVO;
import com.njcn.gather.storage.pojo.vo.RawResultDataVO; import com.njcn.gather.storage.pojo.vo.RawResultDataVO;

View File

@@ -1,10 +1,8 @@
package com.njcn.gather.storage.service.impl; package com.njcn.gather.storage.service.impl;
import cn.hutool.core.util.StrUtil;
import com.njcn.gather.storage.mapper.TableGenMapper; import com.njcn.gather.storage.mapper.TableGenMapper;
import com.njcn.gather.storage.service.TableGenService; import com.njcn.gather.storage.service.TableGenService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;