发送录波指令、调用录波算法、解析录波数据
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,18 @@
|
||||
package com.njcn.gather.detection.pojo.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2025-09-01
|
||||
*/
|
||||
@Data
|
||||
public class WaveCommandDTO {
|
||||
private String ip;
|
||||
|
||||
private Integer port;
|
||||
|
||||
private String oper;
|
||||
|
||||
private Integer line;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.njcn.gather.detection.pojo.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2025-09-01
|
||||
*/
|
||||
@Data
|
||||
public class WaveResultDTO {
|
||||
private String id;
|
||||
|
||||
private String path;
|
||||
}
|
||||
@@ -51,7 +51,8 @@ public enum SourceOperateCodeEnum {
|
||||
YJC_ALIGN("yjc_align","实时数据对齐校验"),
|
||||
YJC_MXYZXJY("yjc_mxyzxjy", "模型一致性校验"),
|
||||
FORMAL_REAL("formal_real","正式检测"),
|
||||
RECORD_WAVE("record_wave","启动录波"),
|
||||
RECORD_WAVE_STEP1("record_wave_step1","启动录波_step1"),
|
||||
RECORD_WAVE_STEP2("record_wave_step2","启动录波_step2"),
|
||||
// SIMULATE_REAL("simulate_real","模拟检测"),
|
||||
Coefficient_Check("Coefficient_Check","系数校验"),
|
||||
QUITE("quit","关闭设备通讯初始化"),
|
||||
@@ -101,7 +102,8 @@ public enum SourceOperateCodeEnum {
|
||||
/**
|
||||
* ftp文件传送指令
|
||||
*/
|
||||
FTP_SEND_01("FTP_SEND$01", "发送文件"),;
|
||||
FTP_SEND_01("FTP_SEND$01", "发送文件"),
|
||||
RDRE$01("RDRE$01", "启动录波");
|
||||
|
||||
private final String value;
|
||||
private final String msg;
|
||||
|
||||
@@ -41,7 +41,8 @@ public enum SourceResponseCodeEnum {
|
||||
ALL_SUCCESS(25001,"校验成功"),
|
||||
FAIL(25002,"失败"),
|
||||
ALL_FAIL(25003,"校验失败"),
|
||||
RECEIVE_DATA_TIME_OUT(25004,"接收数据超时")
|
||||
RECEIVE_DATA_TIME_OUT(25004,"接收数据超时"),
|
||||
REAL_DATA_CHECK_FAIL(25005,"实时数据校验失败")
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -838,7 +838,7 @@ public class DetectionServiceImpl {
|
||||
return getInteger(isData);
|
||||
}
|
||||
|
||||
private static Integer getInteger(List<Integer> isData) {
|
||||
public Integer getInteger(List<Integer> isData) {
|
||||
if (CollUtil.isNotEmpty(isData)) {
|
||||
List<Integer> isQualified = isData.stream().filter(x -> ResultEnum.QUALIFIED.getValue() == x || ResultEnum.NOT_QUALIFIED.getValue() == x).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(isQualified)) {
|
||||
@@ -1524,9 +1524,10 @@ public class DetectionServiceImpl {
|
||||
* @param dataRule 数据处理原则
|
||||
* @param numMap 第几次检测 key为设备id_通道号,value为第几次检测
|
||||
* @param code 结果表code
|
||||
* @param waveNum 第几次录波
|
||||
* @return key为被检设备ip_通道号、value为是否合格(1合格 2不合格 4无法处理)
|
||||
*/
|
||||
public List<DevLineTestResult> processing(List<DevData> devDataList, List<DevData> standardDevDataList, Map<String, String> parsIp, Map<String, String> devIdMapComm, List<String> testItemCodeList, String errorSysId, DictDataEnum dataRule, Map<String, Integer> numMap, String code) {
|
||||
public List<DevLineTestResult> processing(List<DevData> devDataList, List<DevData> standardDevDataList, Map<String, String> parsIp, Map<String, String> devIdMapComm, List<String> testItemCodeList, String errorSysId, DictDataEnum dataRule, Map<String, Integer> numMap, String code, Integer waveNum) {
|
||||
Map<String, List<DevData>> devDataMap = devDataList.stream().collect(Collectors.groupingBy(obj -> obj.getId().split("_")[0]));
|
||||
Map<String, List<DevData>> standardDevDataMap = standardDevDataList.stream().collect(Collectors.groupingBy(DevData::getId));
|
||||
|
||||
@@ -1541,7 +1542,7 @@ public class DetectionServiceImpl {
|
||||
Map<String, List<Integer>> chnResultMap = new HashMap<>();
|
||||
devMonitorMap.forEach((devMoniterId, devData) -> {
|
||||
String[] split = devMoniterId.split(CnSocketUtil.SPLIT_TAG);
|
||||
Map<String, Integer> map = singleMonitorProcessing(devData, standardDevDataMap.get(parsIp.get(devMoniterId)), devIdMapComm, testItemCodeList, errorSysId, dataRule, numMap.get(devId + CnSocketUtil.SPLIT_TAG + split[1]), code);
|
||||
Map<String, Integer> map = singleMonitorProcessing(devData, standardDevDataMap.get(parsIp.get(devMoniterId)), devIdMapComm, testItemCodeList, errorSysId, dataRule, numMap.get(devId + CnSocketUtil.SPLIT_TAG + split[1]), code, waveNum);
|
||||
map.forEach((key, value) -> {
|
||||
DevLineTestResult devLineTestResult = new DevLineTestResult();
|
||||
devLineTestResult.setDeviceId(devId);
|
||||
@@ -1575,9 +1576,10 @@ public class DetectionServiceImpl {
|
||||
* @param dataRule 数据处理原则
|
||||
* @param num 第几次检测
|
||||
* @param code 结果表code
|
||||
* @param waveNum 第几次录波
|
||||
* @return
|
||||
*/
|
||||
private Map<String, Integer> singleMonitorProcessing(List<DevData> devDataList, List<DevData> standardDevDataList, Map<String, String> devIdMapComm, List<String> testItemCodeList, String errorSysId, DictDataEnum dataRule, Integer num, String code) {
|
||||
private Map<String, Integer> singleMonitorProcessing(List<DevData> devDataList, List<DevData> standardDevDataList, Map<String, String> devIdMapComm, List<String> testItemCodeList, String errorSysId, DictDataEnum dataRule, Integer num, String code, Integer waveNum) {
|
||||
Map<String, Integer> resultMap = new HashMap<>();
|
||||
if (CollUtil.isNotEmpty(devDataList) && CollUtil.isNotEmpty(standardDevDataList) && CollUtil.isNotEmpty(testItemCodeList)) {
|
||||
SysTestConfig oneConfig = sysTestConfigService.getOneConfig();
|
||||
@@ -1618,41 +1620,38 @@ public class DetectionServiceImpl {
|
||||
|
||||
switch (anEnum) {
|
||||
case FREQ:
|
||||
resultMap.put(PowerIndexEnum.FREQ.getKey(), isQualified(devDataList, standardDevDataList, devIdMapComm, pqErrSysDtls, true, fHz, DetectionCodeEnum.FREQ.getCode(), dataRule, num, code, oneConfig.getScale()));
|
||||
resultMap.put(PowerIndexEnum.FREQ.getKey(), isQualified(devDataList, standardDevDataList, devIdMapComm, pqErrSysDtls, true, fHz, DetectionCodeEnum.FREQ.getCode(), dataRule, num, code, oneConfig.getScale(), waveNum));
|
||||
break;
|
||||
case VRMS:
|
||||
case PVRMS:
|
||||
// 如果是角型接法且存在角型接法的一些指标,则不进行使用角型接线的指标。反之,则使用相别的指标。
|
||||
resultMap.put(PowerIndexEnum.V.getKey(), isQualified(devDataList, standardDevDataList, devIdMapComm, pqErrSysDtls, true, fUn, (isDelta && isExitDelta ? DetectionCodeEnum.PVRMS.getCode() : DetectionCodeEnum.VRMS.getCode()), dataRule, num, code, oneConfig.getScale()));
|
||||
resultMap.put(PowerIndexEnum.V.getKey(), isQualified(devDataList, standardDevDataList, devIdMapComm, pqErrSysDtls, true, fUn, (isDelta && isExitDelta ? DetectionCodeEnum.PVRMS.getCode() : DetectionCodeEnum.VRMS.getCode()), dataRule, num, code, oneConfig.getScale(), waveNum));
|
||||
break;
|
||||
case IRMS:
|
||||
resultMap.put(PowerIndexEnum.I.getKey(), isQualified(devDataList, standardDevDataList, devIdMapComm, pqErrSysDtls, true, fIn, DetectionCodeEnum.IRMS.getCode(), dataRule, num, code, oneConfig.getScale()));
|
||||
resultMap.put(PowerIndexEnum.I.getKey(), isQualified(devDataList, standardDevDataList, devIdMapComm, pqErrSysDtls, true, fIn, DetectionCodeEnum.IRMS.getCode(), dataRule, num, code, oneConfig.getScale(), waveNum));
|
||||
break;
|
||||
// case P_FUND:
|
||||
// resultMap.put(PowerIndexEnum.P.getKey(), isQualified(devDataList, standardDevDataList, devIdMapComm, pqErrSysDtls, true, fUn * fIn, DetectionCodeEnum.P_FUND.getCode(), dataRule, num, code, oneConfig.getScale()));
|
||||
// break;
|
||||
case V_UNBAN:
|
||||
resultMap.put(PowerIndexEnum.IMBV.getKey(), isQualified(devDataList, standardDevDataList, devIdMapComm, pqErrSysDtls, false, fUn, DetectionCodeEnum.V_UNBAN.getCode(), dataRule, num, code, oneConfig.getScale()));
|
||||
resultMap.put(PowerIndexEnum.IMBV.getKey(), isQualified(devDataList, standardDevDataList, devIdMapComm, pqErrSysDtls, false, fUn, DetectionCodeEnum.V_UNBAN.getCode(), dataRule, num, code, oneConfig.getScale(), waveNum));
|
||||
break;
|
||||
case I_UNBAN:
|
||||
resultMap.put(PowerIndexEnum.IMBA.getKey(), isQualified(devDataList, standardDevDataList, devIdMapComm, pqErrSysDtls, false, fIn, DetectionCodeEnum.I_UNBAN.getCode(), dataRule, num, code, oneConfig.getScale()));
|
||||
resultMap.put(PowerIndexEnum.IMBA.getKey(), isQualified(devDataList, standardDevDataList, devIdMapComm, pqErrSysDtls, false, fIn, DetectionCodeEnum.I_UNBAN.getCode(), dataRule, num, code, oneConfig.getScale(), waveNum));
|
||||
break;
|
||||
case V2_50:
|
||||
case PV2_50:
|
||||
resultMap.put(PowerIndexEnum.HV.getKey(), isHarmQualified(devDataList, standardDevDataList, devIdMapComm, pqErrSysDtls, U, fUn, HARMONIC_FLAG, isDelta && isExitDelta, dataRule, num, code, oneConfig.getScale()));
|
||||
resultMap.put(PowerIndexEnum.HV.getKey(), isHarmQualified(devDataList, standardDevDataList, devIdMapComm, pqErrSysDtls, U, fUn, HARMONIC_FLAG, isDelta && isExitDelta, dataRule, num, code, oneConfig.getScale(), waveNum));
|
||||
break;
|
||||
case I2_50:
|
||||
resultMap.put(PowerIndexEnum.HI.getKey(), isHarmQualified(devDataList, standardDevDataList, devIdMapComm, pqErrSysDtls, I, fIn, HARMONIC_FLAG, isDelta && isExitDelta, dataRule, num, code, oneConfig.getScale()));
|
||||
resultMap.put(PowerIndexEnum.HI.getKey(), isHarmQualified(devDataList, standardDevDataList, devIdMapComm, pqErrSysDtls, I, fIn, HARMONIC_FLAG, isDelta && isExitDelta, dataRule, num, code, oneConfig.getScale(), waveNum));
|
||||
break;
|
||||
case P2_50:
|
||||
resultMap.put(PowerIndexEnum.HP.getKey(), isHarmQualified(devDataList, standardDevDataList, devIdMapComm, pqErrSysDtls, HP, fUn * fIn, HARMONIC_FLAG, isDelta && isExitDelta, dataRule, num, code, oneConfig.getScale()));
|
||||
resultMap.put(PowerIndexEnum.HP.getKey(), isHarmQualified(devDataList, standardDevDataList, devIdMapComm, pqErrSysDtls, HP, fUn * fIn, HARMONIC_FLAG, isDelta && isExitDelta, dataRule, num, code, oneConfig.getScale(), waveNum));
|
||||
break;
|
||||
case SV_1_49:
|
||||
case PSV_1_49:
|
||||
resultMap.put(PowerIndexEnum.HSV.getKey(), isHarmQualified(devDataList, standardDevDataList, devIdMapComm, pqErrSysDtls, U, fUn, INHARMONIC_FLAG, isDelta && isExitDelta, dataRule, num, code, oneConfig.getScale()));
|
||||
resultMap.put(PowerIndexEnum.HSV.getKey(), isHarmQualified(devDataList, standardDevDataList, devIdMapComm, pqErrSysDtls, U, fUn, INHARMONIC_FLAG, isDelta && isExitDelta, dataRule, num, code, oneConfig.getScale(), waveNum));
|
||||
break;
|
||||
case SI_1_49:
|
||||
resultMap.put(PowerIndexEnum.HSI.getKey(), isHarmQualified(devDataList, standardDevDataList, devIdMapComm, pqErrSysDtls, I, fIn, INHARMONIC_FLAG, isDelta && isExitDelta, dataRule, num, code, oneConfig.getScale()));
|
||||
resultMap.put(PowerIndexEnum.HSI.getKey(), isHarmQualified(devDataList, standardDevDataList, devIdMapComm, pqErrSysDtls, I, fIn, INHARMONIC_FLAG, isDelta && isExitDelta, dataRule, num, code, oneConfig.getScale(), waveNum));
|
||||
break;
|
||||
case UNKNOWN_ERROR:
|
||||
break;
|
||||
@@ -1669,7 +1668,7 @@ public class DetectionServiceImpl {
|
||||
* @param devDataList 监测点数据
|
||||
* @return
|
||||
*/
|
||||
private boolean isExitDeltaIndex(String devId, List<DevData> devDataList) {
|
||||
public boolean isExitDeltaIndex(String devId, List<DevData> devDataList) {
|
||||
if (CollUtil.isNotEmpty(devDataList)) {
|
||||
List<String> deltaIndex = Arrays.asList(DetectionCodeEnum.PVRMS.getCode(),
|
||||
DetectionCodeEnum.PV2_50.getCode(),
|
||||
@@ -1710,6 +1709,7 @@ public class DetectionServiceImpl {
|
||||
* @param num 第几次检测
|
||||
* @param code 结果表code
|
||||
* @param scale 小数点位数
|
||||
* @param waveNum 第几次录波
|
||||
* @return
|
||||
*/
|
||||
private Integer isQualified(List<DevData> devDataList,
|
||||
@@ -1722,12 +1722,14 @@ public class DetectionServiceImpl {
|
||||
DictDataEnum dataRule,
|
||||
Integer num,
|
||||
String code,
|
||||
Integer scale) {
|
||||
Integer scale,
|
||||
Integer waveNum) {
|
||||
List<ContrastNonHarmonicResult> info = new ArrayList<>();
|
||||
if (CollUtil.isNotEmpty(devDataList) && CollUtil.isNotEmpty(standardDevDataList) && CollUtil.isNotEmpty(errSysDtls)) {
|
||||
|
||||
Map<String, List<List<Double>>> map = devListMap(devDataList, standardDevDataList, desc, dataRule);
|
||||
ContrastNonHarmonicResult result = new ContrastNonHarmonicResult();
|
||||
result.setWaveNum(waveNum);
|
||||
|
||||
String[] split1 = devDataList.get(0).getId().split(CnSocketUtil.SPLIT_TAG);
|
||||
String[] split2 = standardDevDataList.get(0).getId().split(CnSocketUtil.SPLIT_TAG);
|
||||
@@ -1738,7 +1740,7 @@ public class DetectionServiceImpl {
|
||||
result.setDataType(DataSourceEnum.REAL_DATA.getValue());
|
||||
|
||||
if (map.containsKey(TYPE_T)) {
|
||||
List<DetectionData> tList = rangeComparisonList(map.get(TYPE_T).get(0), map.get(TYPE_T).get(1), errSysDtls, fData, scale);
|
||||
List<DetectionData> tList = rangeComparisonList(map.get(TYPE_T).get(0), map.get(TYPE_T).get(1), errSysDtls, fData, scale, dataRule);
|
||||
result.setTValue(JSON.toJSONString(tList));
|
||||
result.setResultFlag(setResultFlag(tList));
|
||||
} else {
|
||||
@@ -1755,7 +1757,7 @@ public class DetectionServiceImpl {
|
||||
phases.add(TYPE_B);
|
||||
|
||||
for (String phase : phases) {
|
||||
List<DetectionData> phaseList = rangeComparisonList(map.get(phase).get(0), map.get(phase).get(1), errSysDtls, fData, scale);
|
||||
List<DetectionData> phaseList = rangeComparisonList(map.get(phase).get(0), map.get(phase).get(1), errSysDtls, fData, scale, dataRule);
|
||||
resultFlag.addAll(phaseList);
|
||||
BiConsumer<ContrastNonHarmonicResult, List<DetectionData>> setter = setters.get(phase);
|
||||
setter.accept(result, phaseList);
|
||||
@@ -1786,6 +1788,7 @@ public class DetectionServiceImpl {
|
||||
* @param num 第几次检测
|
||||
* @param code 结果表code
|
||||
* @param scale 小数点位数
|
||||
* @param waveNum 第几次录波
|
||||
* @return
|
||||
*/
|
||||
public Integer isHarmQualified(List<DevData> devDataList,
|
||||
@@ -1799,7 +1802,8 @@ public class DetectionServiceImpl {
|
||||
DictDataEnum dataRule,
|
||||
Integer num,
|
||||
String code,
|
||||
Integer scale) {
|
||||
Integer scale,
|
||||
Integer waveNum) {
|
||||
List<ContrastHarmonicResult> info = new ArrayList<>();
|
||||
if (CollUtil.isNotEmpty(devDataList) && CollUtil.isNotEmpty(standardDevDataList) && CollUtil.isNotEmpty(errSysDtls)) {
|
||||
String fundCode = "";
|
||||
@@ -1836,6 +1840,7 @@ public class DetectionServiceImpl {
|
||||
|
||||
Map<String, List<Map<Double, List<Double>>>> devMap = devHarmListMap(devDataList, standardDevDataList, fundCode, harmCode, harmonicFlag, dataRule);
|
||||
ContrastHarmonicResult result = new ContrastHarmonicResult();
|
||||
result.setWaveNum(waveNum);
|
||||
|
||||
String[] split1 = devDataList.get(0).getId().split("_");
|
||||
String[] split2 = standardDevDataList.get(0).getId().split("_");
|
||||
@@ -1845,9 +1850,9 @@ public class DetectionServiceImpl {
|
||||
result.setAdType(errSysDtls.get(0).getScriptType());
|
||||
result.setDataType(DataSourceEnum.REAL_DATA.getValue());
|
||||
|
||||
List<DetectionData> integerBooleanA = harmRangeComparison(devMap.get(TYPE_A).get(0), devMap.get(TYPE_A).get(1), errSysDtls, type, fData, scale);
|
||||
List<DetectionData> integerBooleanB = harmRangeComparison(devMap.get(TYPE_B).get(0), devMap.get(TYPE_A).get(1), errSysDtls, type, fData, scale);
|
||||
List<DetectionData> integerBooleanC = harmRangeComparison(devMap.get(TYPE_C).get(0), devMap.get(TYPE_A).get(1), errSysDtls, type, fData, scale);
|
||||
List<DetectionData> integerBooleanA = harmRangeComparison(devMap.get(TYPE_A).get(0), devMap.get(TYPE_A).get(1), errSysDtls, type, fData, scale, dataRule);
|
||||
List<DetectionData> integerBooleanB = harmRangeComparison(devMap.get(TYPE_B).get(0), devMap.get(TYPE_A).get(1), errSysDtls, type, fData, scale, dataRule);
|
||||
List<DetectionData> integerBooleanC = harmRangeComparison(devMap.get(TYPE_C).get(0), devMap.get(TYPE_A).get(1), errSysDtls, type, fData, scale, dataRule);
|
||||
reflectHarmonic(true, "a", integerBooleanA, result, harmonicFlag);
|
||||
reflectHarmonic(true, "b", integerBooleanB, result, harmonicFlag);
|
||||
reflectHarmonic(true, "c", integerBooleanC, result, harmonicFlag);
|
||||
@@ -1963,21 +1968,29 @@ public class DetectionServiceImpl {
|
||||
}
|
||||
break;
|
||||
case CP95_VALUE:
|
||||
int cp95Idx = DetectionUtil.getCP95Idx(aDev);
|
||||
aDev = Collections.singletonList(aDev.get(cp95Idx));
|
||||
aStandardDev = Collections.singletonList(aStandardDev.get(cp95Idx));
|
||||
if (CollUtil.isNotEmpty(aDev)) {
|
||||
int cp95Idx = DetectionUtil.getCP95Idx(aDev);
|
||||
aDev = Collections.singletonList(aDev.get(cp95Idx));
|
||||
aStandardDev = Collections.singletonList(aStandardDev.get(cp95Idx));
|
||||
}
|
||||
if (CollUtil.isNotEmpty(bDev)) {
|
||||
int cp95Idx = DetectionUtil.getCP95Idx(bDev);
|
||||
bDev = Collections.singletonList(bDev.get(cp95Idx));
|
||||
bStandardDev = Collections.singletonList(bStandardDev.get(cp95Idx));
|
||||
}
|
||||
|
||||
cp95Idx = DetectionUtil.getCP95Idx(bDev);
|
||||
bDev = Collections.singletonList(bDev.get(cp95Idx));
|
||||
bStandardDev = Collections.singletonList(bStandardDev.get(cp95Idx));
|
||||
if (CollUtil.isNotEmpty(cDev)) {
|
||||
int cp95Idx = DetectionUtil.getCP95Idx(cDev);
|
||||
cDev = Collections.singletonList(cDev.get(cp95Idx));
|
||||
cStandardDev = Collections.singletonList(cStandardDev.get(cp95Idx));
|
||||
}
|
||||
|
||||
cp95Idx = DetectionUtil.getCP95Idx(cDev);
|
||||
cDev = Collections.singletonList(cDev.get(cp95Idx));
|
||||
cStandardDev = Collections.singletonList(cStandardDev.get(cp95Idx));
|
||||
if (CollUtil.isNotEmpty(tDev)) {
|
||||
int cp95Idx = DetectionUtil.getCP95Idx(tDev);
|
||||
tDev = Collections.singletonList(tDev.get(cp95Idx));
|
||||
tStandardDev = Collections.singletonList(tStandardDev.get(cp95Idx));
|
||||
}
|
||||
|
||||
cp95Idx = DetectionUtil.getCP95Idx(tDev);
|
||||
tDev = Collections.singletonList(tDev.get(cp95Idx));
|
||||
tStandardDev = Collections.singletonList(tStandardDev.get(cp95Idx));
|
||||
break;
|
||||
case AVG_VALUE:
|
||||
aDev = DetectionUtil.getAvgDoubles(aDev);
|
||||
@@ -2129,12 +2142,15 @@ public class DetectionServiceImpl {
|
||||
}
|
||||
break;
|
||||
case CP95_VALUE:
|
||||
int cp95Idx = DetectionUtil.getCP95Idx(value);
|
||||
value.clear();
|
||||
value.addAll(Collections.singletonList(value.get(cp95Idx)));
|
||||
Double standardCP95Data = standardDevMap.get(typeKey).get(key).get(cp95Idx);
|
||||
standardDevMap.get(typeKey).get(key).clear();
|
||||
standardDevMap.get(typeKey).get(key).add(standardCP95Data);
|
||||
if (CollUtil.isNotEmpty(value)) {
|
||||
int cp95Idx = DetectionUtil.getCP95Idx(value);
|
||||
List<Double> newValue = Collections.singletonList(value.get(cp95Idx));
|
||||
value.clear();
|
||||
value.addAll(newValue);
|
||||
Double standardCP95Data = standardDevMap.get(typeKey).get(key).get(cp95Idx);
|
||||
standardDevMap.get(typeKey).get(key).clear();
|
||||
standardDevMap.get(typeKey).get(key).add(standardCP95Data);
|
||||
}
|
||||
break;
|
||||
case AVG_VALUE:
|
||||
List<Double> avgDoubles = DetectionUtil.getAvgDoubles(value);
|
||||
@@ -2163,14 +2179,16 @@ public class DetectionServiceImpl {
|
||||
* @param pqErrSysDtls 误差体系
|
||||
* @param fData 额定值
|
||||
* @param scale 小数点精度
|
||||
* @param dataRule 数据处理原则
|
||||
* @return
|
||||
*/
|
||||
public List<DetectionData> rangeComparisonList(List<Double> devDataList,
|
||||
List<Double> standardDevDataList,
|
||||
List<PqErrSysDtls> pqErrSysDtls,
|
||||
Double fData,
|
||||
Integer scale) {
|
||||
return this.getDetectionDataList(devDataList, standardDevDataList, null, pqErrSysDtls, fData, null, scale);
|
||||
Integer scale,
|
||||
DictDataEnum dataRule) {
|
||||
return this.getDetectionDataList(devDataList, standardDevDataList, null, pqErrSysDtls, fData, null, scale, dataRule);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2182,6 +2200,7 @@ public class DetectionServiceImpl {
|
||||
* @param type U或者I或者HP
|
||||
* @param fData 额定值
|
||||
* @param scale 小数点精度
|
||||
* @param dataRule 数据处理原则
|
||||
* @return
|
||||
*/
|
||||
public List<DetectionData> harmRangeComparison(Map<Double, List<Double>> devMap,
|
||||
@@ -2189,7 +2208,8 @@ public class DetectionServiceImpl {
|
||||
List<PqErrSysDtls> pqErrSysDtls,
|
||||
String type,
|
||||
Double fData,
|
||||
Integer scale) {
|
||||
Integer scale,
|
||||
DictDataEnum dataRule) {
|
||||
List<DetectionData> detectionDataList = new ArrayList<>();
|
||||
List<Double> U1List = new ArrayList<>();
|
||||
if (U.equals(type)) {
|
||||
@@ -2197,7 +2217,7 @@ public class DetectionServiceImpl {
|
||||
}
|
||||
standardDevMap.forEach((harmonicNum, stdDataList) -> {
|
||||
if (harmonicNum != 0.0) {
|
||||
detectionDataList.addAll(this.getDetectionDataList(devMap.get(harmonicNum), stdDataList, U1List, pqErrSysDtls, fData, harmonicNum, scale));
|
||||
detectionDataList.addAll(this.getDetectionDataList(devMap.get(harmonicNum), stdDataList, U1List, pqErrSysDtls, fData, harmonicNum, scale, dataRule));
|
||||
}
|
||||
});
|
||||
return detectionDataList;
|
||||
@@ -2213,10 +2233,12 @@ public class DetectionServiceImpl {
|
||||
* @param fData 额定值
|
||||
* @param harmonicNum (间)谐波次数
|
||||
* @param scale 小数点精度
|
||||
* @param dataRule 数据处理原则
|
||||
* @return
|
||||
*/
|
||||
private List<DetectionData> getDetectionDataList(List<Double> devDataList, List<Double> standardDevDataList, List<Double> U1List, List<PqErrSysDtls> pqErrSysDtls, Double fData, Double harmonicNum, Integer scale) {
|
||||
private List<DetectionData> getDetectionDataList(List<Double> devDataList, List<Double> standardDevDataList, List<Double> U1List, List<PqErrSysDtls> pqErrSysDtls, Double fData, Double harmonicNum, Integer scale, DictDataEnum dataRule) {
|
||||
List<DetectionData> detectionDataList = new ArrayList<>();
|
||||
boolean flag = false;
|
||||
for (int i = 0; i < standardDevDataList.size(); i++) {
|
||||
Double U1 = CollUtil.isNotEmpty(U1List) ? U1List.get(i) : null;
|
||||
Double stdDevData = BigDecimal.valueOf(standardDevDataList.get(i)).setScale(scale, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
@@ -2249,12 +2271,22 @@ public class DetectionServiceImpl {
|
||||
|
||||
if (in) {
|
||||
detectionData.setIsData(ResultEnum.QUALIFIED.getValue());
|
||||
if (dataRule == DictDataEnum.AT_WILL_VALUE) {
|
||||
flag = true;
|
||||
}
|
||||
} else {
|
||||
detectionData.setIsData(ResultEnum.NOT_QUALIFIED.getValue());
|
||||
}
|
||||
}
|
||||
if (dataRule == DictDataEnum.AT_WILL_VALUE) {
|
||||
detectionDataList.clear();
|
||||
}
|
||||
detectionDataList.add(detectionData);
|
||||
if (flag) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return detectionDataList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.njcn.gather.detection.pojo.po.DevData;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.io.File;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDateTime;
|
||||
@@ -407,4 +408,18 @@ public class DetectionUtil {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查文件是否存在
|
||||
*/
|
||||
public static void checkFileExists(String filePath, String description) {
|
||||
File file = new File(filePath);
|
||||
if (!file.exists()) {
|
||||
System.err.println("警告: " + description + " 不存在: " + filePath);
|
||||
System.err.println("请确保文件路径正确,或修改测试中的文件路径");
|
||||
} else {
|
||||
System.out.println(description + " 存在: " + filePath);
|
||||
System.out.println(" 文件大小: " + file.length() + " bytes");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,11 +57,11 @@ public class CnSocketUtil {
|
||||
/**
|
||||
* 比对式-退出检测
|
||||
*/
|
||||
public static void contrastSendquit(String loginName,boolean isRemoveSocket) {
|
||||
public static void contrastSendquit(String loginName, SourceOperateCodeEnum operateCode, boolean isRemoveSocket) {
|
||||
System.out.println("比对式-发送关闭备通讯模块指令。。。。。。。。");
|
||||
SocketMsg<String> socketMsg = new SocketMsg<>();
|
||||
socketMsg.setRequestId(SourceOperateCodeEnum.QUITE.getValue());
|
||||
socketMsg.setOperateCode(SourceOperateCodeEnum.QUIT_INIT_02.getValue());
|
||||
socketMsg.setOperateCode(operateCode.getValue());
|
||||
SocketManager.sendMsg(loginName + CONTRAST_DEV_TAG, JSON.toJSONString(socketMsg));
|
||||
// WebServiceManager.removePreDetectionParam();
|
||||
FormalTestManager.isRemoveSocket = isRemoveSocket;
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package com.njcn.gather.detection.util.socket;
|
||||
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.njcn.gather.detection.pojo.dto.WaveResultDTO;
|
||||
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
|
||||
import com.njcn.gather.detection.pojo.po.DevData;
|
||||
import com.njcn.gather.detection.pojo.vo.DevLineTestResult;
|
||||
import com.njcn.gather.device.pojo.enums.PatternEnum;
|
||||
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||
import com.njcn.gather.plan.pojo.po.AdPlanTestConfig;
|
||||
import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -45,7 +48,7 @@ public class FormalTestManager {
|
||||
public static List<String> monitorIdListComm = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 所有参与检测的监测点。key:监测点id(ip_通道号),value:检测点实体
|
||||
* 所有参与检测的监测点。key:监测点(ip_通道号),value:检测点实体
|
||||
*/
|
||||
public static Map<String, PreDetection.MonitorListDTO> monitorMap = new HashMap<>();
|
||||
|
||||
@@ -84,6 +87,8 @@ public class FormalTestManager {
|
||||
*/
|
||||
public static AdPlan currentTestPlan;
|
||||
|
||||
public static AdPlanTestConfig curretntTestPlanConfig;
|
||||
|
||||
/**
|
||||
* 当前正在检测的模式
|
||||
*/
|
||||
@@ -128,4 +133,19 @@ public class FormalTestManager {
|
||||
* 第几次监测 key为设备监测点id,value为第几次监测
|
||||
*/
|
||||
public static Map<String, Integer> numMap = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 存放录波相关数据。key:设备ip_通道号,value:WaveResultDTO数据
|
||||
*/
|
||||
public static Map<String, WaveResultDTO> waveResultDTOMap = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 录波组数
|
||||
*/
|
||||
public static Integer waveNum;
|
||||
|
||||
/**
|
||||
* 每次录波检测结果
|
||||
*/
|
||||
public static List<DevLineTestResult> preNumTestResultList = new ArrayList<>();
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||
import com.njcn.gather.detection.pojo.vo.SocketDataMsg;
|
||||
import com.njcn.gather.detection.pojo.vo.SocketMsg;
|
||||
import com.njcn.gather.detection.util.socket.CnSocketUtil;
|
||||
import com.njcn.gather.detection.util.socket.FormalTestManager;
|
||||
import com.njcn.gather.detection.util.socket.MsgUtil;
|
||||
import com.njcn.gather.detection.util.socket.SocketManager;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
@@ -192,7 +193,11 @@ public class HeartbeatHandler extends SimpleChannelInboundHandler<String> {
|
||||
} else if (CnSocketUtil.SOURCE_TAG.equals(handlerType)) {
|
||||
CnSocketUtil.quitSendSource(param);
|
||||
} else {
|
||||
CnSocketUtil.contrastSendquit(param.getUserPageId(), true);
|
||||
if(FormalTestManager.currentStep==SourceOperateCodeEnum.RECORD_WAVE_STEP1 || FormalTestManager.currentStep==SourceOperateCodeEnum.RECORD_WAVE_STEP2){
|
||||
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, true);
|
||||
}else{
|
||||
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_02, true);
|
||||
}
|
||||
}
|
||||
log.debug("退出指令已发送,等待3秒后清理连接 - 设备类型: {}", handlerType);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -264,8 +264,8 @@ public class NettyClient {
|
||||
private static void setupPipeline(ChannelPipeline pipeline,
|
||||
PreDetectionParam param, SimpleChannelInboundHandler<String> handler) {
|
||||
// 基础编解码器:处理数据格式转换和粘包拆包
|
||||
// 按行分割,最大10KB
|
||||
pipeline.addLast(new LineBasedFrameDecoder(10240))
|
||||
// 按行分割,最大20KB
|
||||
pipeline.addLast(new LineBasedFrameDecoder(10240*2))
|
||||
// 字节转字符串
|
||||
.addLast(new StringDecoder(CharsetUtil.UTF_8))
|
||||
// 字符串转字节
|
||||
|
||||
@@ -5,9 +5,7 @@ import com.njcn.gather.detection.handler.SocketContrastResponseService;
|
||||
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
|
||||
import com.njcn.gather.detection.pojo.enums.SourceResponseCodeEnum;
|
||||
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||
import com.njcn.gather.detection.pojo.vo.DevLineTestResult;
|
||||
import com.njcn.gather.detection.pojo.vo.SocketDataMsg;
|
||||
import com.njcn.gather.detection.pojo.vo.WebSocketVO;
|
||||
import com.njcn.gather.detection.util.socket.CnSocketUtil;
|
||||
import com.njcn.gather.detection.util.socket.FormalTestManager;
|
||||
import com.njcn.gather.detection.util.socket.MsgUtil;
|
||||
@@ -27,9 +25,7 @@ import java.io.IOException;
|
||||
import java.net.ConnectException;
|
||||
import java.net.ProtocolException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
@@ -64,7 +60,11 @@ public class NettyContrastClientHandler extends SimpleChannelInboundHandler<Stri
|
||||
socketContrastResponseService.deal(param, msg);
|
||||
} catch (Exception e) {
|
||||
log.error("处理服务端消息异常", e);
|
||||
CnSocketUtil.contrastSendquit(param.getUserPageId(), true);
|
||||
if (FormalTestManager.currentStep == SourceOperateCodeEnum.RECORD_WAVE_STEP1 || FormalTestManager.currentStep == SourceOperateCodeEnum.RECORD_WAVE_STEP2) {
|
||||
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_03, true);
|
||||
} else {
|
||||
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_02, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ public class NettyContrastClientHandler extends SimpleChannelInboundHandler<Stri
|
||||
if (FormalTestManager.isRemoveSocket) {
|
||||
//实时数据
|
||||
if (SocketManager.contrastClockMap.get(DataSourceEnum.REAL_DATA) >= 60) {
|
||||
CnSocketUtil.contrastSendquit(param.getUserPageId(), false);
|
||||
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_02, false);
|
||||
System.out.println("超时处理-----》" + "实时数据已超时----------------关闭");
|
||||
timeoutSend();
|
||||
}
|
||||
@@ -126,7 +126,7 @@ public class NettyContrastClientHandler extends SimpleChannelInboundHandler<Stri
|
||||
System.out.println("Unknown exception caught: " + cause.getMessage());
|
||||
WebServiceManager.sendDetectionErrorMessage(param.getUserPageId(), SourceOperateCodeEnum.DEVICE_ERROR);
|
||||
}
|
||||
CnSocketUtil.contrastSendquit(param.getUserPageId(),true);
|
||||
CnSocketUtil.contrastSendquit(param.getUserPageId(), SourceOperateCodeEnum.QUIT_INIT_02, true);
|
||||
// socketContrastResponseService.backCheckState(param);
|
||||
ctx.close();
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public class NettyServer {
|
||||
ch.pipeline()
|
||||
//空闲状态的handler
|
||||
// 添加LineBasedFrameDecoder来按行分割数据
|
||||
.addLast(new LineBasedFrameDecoder(10240))
|
||||
.addLast(new LineBasedFrameDecoder(10240*2))
|
||||
.addLast(new StringDecoder(CharsetUtil.UTF_8))
|
||||
.addLast(new StringEncoder(CharsetUtil.UTF_8))
|
||||
.addLast(new DevNettyServerHandler());
|
||||
@@ -107,7 +107,7 @@ public class NettyServer {
|
||||
ch.pipeline()
|
||||
//空闲状态的handler
|
||||
// 添加LineBasedFrameDecoder来按行分割数据
|
||||
.addLast(new LineBasedFrameDecoder(10240))
|
||||
.addLast(new LineBasedFrameDecoder(10240*2))
|
||||
.addLast(new StringDecoder(CharsetUtil.UTF_8))
|
||||
.addLast(new StringEncoder(CharsetUtil.UTF_8))
|
||||
.addLast(new SourceNettyServerHandler());
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.gather.detection.util.socket.websocket;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
|
||||
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||
import com.njcn.gather.detection.util.socket.CnSocketUtil;
|
||||
import com.njcn.gather.detection.util.socket.FormalTestManager;
|
||||
@@ -371,8 +372,12 @@ public class WebSocketHandler extends SimpleChannelInboundHandler<TextWebSocketF
|
||||
// 使用该用户的检测参数关闭Socket连接
|
||||
log.info("使用用户检测参数关闭Socket连接,userId: {}", userId);
|
||||
if (FormalTestManager.patternEnum.equals(PatternEnum.CONTRAST)) {
|
||||
if (FormalTestManager.isRemoveSocket) {
|
||||
CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), true);
|
||||
if (!FormalTestManager.isRemoveSocket) {
|
||||
if (FormalTestManager.currentStep == SourceOperateCodeEnum.RECORD_WAVE_STEP1 || FormalTestManager.currentStep == SourceOperateCodeEnum.RECORD_WAVE_STEP2) {
|
||||
CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.DEV_INIT_GATHER_03, true);
|
||||
} else if (FormalTestManager.currentStep != SourceOperateCodeEnum.QUITE) {
|
||||
CnSocketUtil.contrastSendquit(preDetectionParam.getUserPageId(), SourceOperateCodeEnum.DEV_INIT_GATHER_02, true);
|
||||
}
|
||||
} else {
|
||||
boolean channelActive = SocketManager.isChannelActive(preDetectionParam.getUserPageId() + CnSocketUtil.CONTRAST_DEV_TAG);
|
||||
if (channelActive) {
|
||||
|
||||
@@ -57,13 +57,13 @@ public class PreDetection {
|
||||
/**
|
||||
* 是否支持相角。0:不支持,1:支持
|
||||
*/
|
||||
@JSONField(name = "angle")
|
||||
@JSONField(serialize = false)
|
||||
private Integer angle;
|
||||
|
||||
/**
|
||||
* 角型接线时是否使用相别的指标来进行检测,0表示否,1表示是
|
||||
*/
|
||||
@JSONField(name = "usePhaseIndex")
|
||||
@JSONField(serialize = false)
|
||||
private Integer usePhaseIndex;
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.njcn.gather.device.pojo.enums.TimeCheckResultEnum;
|
||||
import com.njcn.gather.device.pojo.param.PqDevParam;
|
||||
import com.njcn.gather.device.pojo.po.PqDev;
|
||||
import com.njcn.gather.device.pojo.vo.*;
|
||||
import com.njcn.gather.monitor.pojo.po.PqMonitor;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@@ -118,7 +117,7 @@ public interface IPqDevService extends IService<PqDev> {
|
||||
* @param humidity
|
||||
* @return
|
||||
*/
|
||||
boolean updateResult(boolean isContrast,List<String> ids, List<String> adType, String code,String userId, Float temperature, Float humidity);
|
||||
boolean updateResult(boolean isContrast, List<String> ids, List<String> adType, String code, String userId, Float temperature, Float humidity);
|
||||
|
||||
void updatePqDevReportState(String devId, int i);
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.poi.PullDown;
|
||||
import com.njcn.common.utils.EncryptionUtil;
|
||||
import com.njcn.common.utils.JwtUtil;
|
||||
import com.njcn.db.mybatisplus.constant.DbConstant;
|
||||
import com.njcn.gather.device.mapper.PqDevMapper;
|
||||
import com.njcn.gather.device.pojo.enums.*;
|
||||
@@ -49,7 +48,6 @@ import com.njcn.gather.user.user.service.ISysUserService;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import com.njcn.web.utils.ExcelUtil;
|
||||
import com.njcn.web.utils.PoiUtil;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
@@ -436,7 +434,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
|
||||
|
||||
@Override
|
||||
public boolean updateResult(boolean isContrast, List<String> ids, List<String> adType, String code,String userId, Float temperature, Float humidity) {
|
||||
public boolean updateResult(boolean isContrast, List<String> ids, List<String> adType, String code, String userId, Float temperature, Float humidity) {
|
||||
if (CollUtil.isNotEmpty(ids)) {
|
||||
|
||||
SysTestConfig config = sysTestConfigService.getOneConfig();
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
</foreach>
|
||||
</where>
|
||||
</if>
|
||||
and State = 1
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ public enum DataSourceEnum {
|
||||
MINUTE_STATISTICS_MIN("min", "分钟统计数据-最小"),
|
||||
MINUTE_STATISTICS_AVG("avg", "分钟统计数据-平均"),
|
||||
MINUTE_STATISTICS_CP95("cp95", "分钟统计数据-CP95"),
|
||||
WAVE_DATA("wave_data", "录播数据");
|
||||
WAVE_DATA("wave_data", "录波");
|
||||
|
||||
private String value;
|
||||
private String msg;
|
||||
|
||||
@@ -8,5 +8,12 @@ import com.njcn.gather.plan.pojo.po.AdPlanTestConfig;
|
||||
* @date 2025-08-25
|
||||
*/
|
||||
public interface IAdPlanTestConfigService extends IService<AdPlanTestConfig> {
|
||||
/**
|
||||
* 根据计划id获取测试配置
|
||||
*
|
||||
* @param planId 计划id
|
||||
* @return
|
||||
*/
|
||||
AdPlanTestConfig getByPlanId(String planId);
|
||||
|
||||
}
|
||||
|
||||
@@ -574,6 +574,14 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
map.put("scriptName", dictTree.getName());
|
||||
result.add(map);
|
||||
}
|
||||
if (adPlan.getDatasourceId().contains(DataSourceEnum.WAVE_DATA.getValue())) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("id", "wave_data");
|
||||
map.put("code", DataSourceEnum.WAVE_DATA.getValue());
|
||||
map.put("scriptName", DataSourceEnum.WAVE_DATA.getMsg());
|
||||
result.add(map);
|
||||
}
|
||||
|
||||
} else {
|
||||
String scriptId = adPlan.getScriptId();
|
||||
List<PqScriptDtls> scriptDtlsList = pqScriptDtlsService.listPqScriptDtlByScriptId(scriptId);
|
||||
|
||||
@@ -12,8 +12,12 @@ import org.springframework.stereotype.Service;
|
||||
*/
|
||||
@Service
|
||||
public class AdPlanTestConfigServiceImpl extends ServiceImpl<AdPlanTestConfigMapper, AdPlanTestConfig>
|
||||
implements IAdPlanTestConfigService {
|
||||
implements IAdPlanTestConfigService {
|
||||
|
||||
@Override
|
||||
public AdPlanTestConfig getByPlanId(String planId) {
|
||||
return this.lambdaQuery().eq(AdPlanTestConfig::getPlanId, planId).last("LIMIT 1").one();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2046,7 +2046,7 @@ public class ResultServiceImpl implements IResultService {
|
||||
List<DevData> devData = contrastToList(devNonHarmonicRawDataList, devHarmonicRawDataList, testItemMap);
|
||||
List<DevData> standardDevData = contrastToList(stdDevNonHarmonicRawDataList, stdDevHarmonicRawDataList, testItemMap);
|
||||
|
||||
detectionServiceImpl.processing(devData, standardDevData, parsIp, devIdMapComm, testItemMap.keySet().stream().collect(Collectors.toList()), errorSysId, dataRule, numMap, code);
|
||||
detectionServiceImpl.processing(devData, standardDevData, parsIp, devIdMapComm, testItemMap.keySet().stream().collect(Collectors.toList()), errorSysId, dataRule, numMap, code, null);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
A_Value_0 float NULL COMMENT 'A相基波有效值',
|
||||
B_Value_0 float NULL COMMENT 'B相基波有效值',
|
||||
C_Value_0 float NULL COMMENT 'B相基波有效值',
|
||||
Wave_Num tinyint(1) unsigned DEFAULT null COMMENT '录波数据第几组',
|
||||
PRIMARY KEY (Id)
|
||||
</when>
|
||||
<otherwise>
|
||||
@@ -59,6 +60,7 @@
|
||||
A_Value_0 json NULL COMMENT 'A相基波有效值',
|
||||
B_Value_0 json NULL COMMENT 'B相基波有效值',
|
||||
C_Value_0 json NULL COMMENT 'B相基波有效值',
|
||||
Wave_Num tinyint(1) unsigned DEFAULT null COMMENT '录波数据第几组',
|
||||
PRIMARY KEY (Id)
|
||||
</when>
|
||||
<otherwise>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.gather.storage.pojo.po;
|
||||
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@@ -23,7 +24,12 @@ public class ContrastBaseResult extends BaseResult {
|
||||
private String stdDevMonitorId;
|
||||
|
||||
/**
|
||||
* 0表示被检设备数据,1表示标准设备数据
|
||||
* 0表示被检设备数据,1表示标准设备数据
|
||||
*/
|
||||
private Integer flag;
|
||||
|
||||
/**
|
||||
* 录波数据第几组
|
||||
*/
|
||||
private Integer waveNum;
|
||||
}
|
||||
|
||||
@@ -12,10 +12,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -157,7 +154,13 @@ public class DetectionDataServiceImpl extends ReplenishMybatisServiceImpl<Detect
|
||||
for (String id : ids) {
|
||||
wrapper1.like(ContrastNonHarmonicResult::getDevMonitorId, id);
|
||||
}
|
||||
noHarm.addAll(contrastNonHarmonicService.list(wrapper1));
|
||||
List<ContrastNonHarmonicResult> nonHarmonicResultList = contrastNonHarmonicService.list(wrapper1);
|
||||
Map<String, List<ContrastNonHarmonicResult>> chnMap1 = nonHarmonicResultList.stream().collect(Collectors.groupingBy(x -> x.getDevMonitorId().split("_")[1], Collectors.toList()));
|
||||
chnMap1.forEach((chn, vList) -> {
|
||||
ContrastNonHarmonicResult contrastNonHarmonicResult = vList.stream().max(Comparator.comparing(ContrastNonHarmonicResult::getNum)).get();
|
||||
List<ContrastNonHarmonicResult> maxList = vList.stream().filter(x -> x.getNum() == contrastNonHarmonicResult.getNum()).collect(Collectors.toList());
|
||||
noHarm.addAll(maxList);
|
||||
});
|
||||
DynamicTableNameHandler.remove();
|
||||
|
||||
DynamicTableNameHandler.setTableName("ad_harmonic_result_" + code);
|
||||
@@ -166,7 +169,13 @@ public class DetectionDataServiceImpl extends ReplenishMybatisServiceImpl<Detect
|
||||
for (String id : ids) {
|
||||
wrapper2.like(ContrastHarmonicResult::getDevMonitorId, id);
|
||||
}
|
||||
harm.addAll(contrastHarmonicService.list(wrapper2));
|
||||
List<ContrastHarmonicResult> harmonicResultList = contrastHarmonicService.list(wrapper2);
|
||||
Map<String, List<ContrastHarmonicResult>> chnMap2 = harmonicResultList.stream().collect(Collectors.groupingBy(x -> x.getDevMonitorId().split("_")[1], Collectors.toList()));
|
||||
chnMap2.forEach((chn, vList) -> {
|
||||
ContrastHarmonicResult contrastHarmonicResult = vList.stream().max(Comparator.comparing(ContrastHarmonicResult::getNum)).get();
|
||||
List<ContrastHarmonicResult> maxList = vList.stream().filter(x -> x.getNum() == contrastHarmonicResult.getNum()).collect(Collectors.toList());
|
||||
harm.addAll(maxList);
|
||||
});
|
||||
DynamicTableNameHandler.remove();
|
||||
} else {
|
||||
List<Integer> disabledScriptDtlIndexs = detectionDataDealMapper.listDisabledScriptDtlIndexs(ids.get(0));
|
||||
|
||||
@@ -49,6 +49,7 @@ public class TableGenServiceImpl implements TableGenService {
|
||||
"A_Value_0 float NULL COMMENT 'A相基波有效值',\n" +
|
||||
"C_Value_0 float NULL COMMENT 'B相基波有效值',\n" +
|
||||
"B_Value_0 float NULL COMMENT 'B相基波有效值',\n" +
|
||||
"Wave_Num tinyint(1) unsigned DEFAULT null COMMENT '录波数据第几组',\n" +
|
||||
"PRIMARY KEY (Id)\n"
|
||||
:
|
||||
" Script_Id CHAR(32) NOT NULL COMMENT '检测脚本表Id',\n" +
|
||||
@@ -75,6 +76,7 @@ public class TableGenServiceImpl implements TableGenService {
|
||||
"A_Value_0 json NULL COMMENT 'A相基波有效值',\n" +
|
||||
"B_Value_0 json NULL COMMENT 'B相基波有效值',\n" +
|
||||
"C_Value_0 json NULL COMMENT 'B相基波有效值',\n" +
|
||||
"Wave_Num tinyint(1) unsigned DEFAULT null COMMENT '录波数据第几组',\n" +
|
||||
"PRIMARY KEY (Id)\n"
|
||||
:
|
||||
" Script_Id CHAR(32) NOT NULL COMMENT '检测脚本表Id',\n" +
|
||||
|
||||
@@ -26,8 +26,8 @@ public class ClockStruct {
|
||||
* 格式化时间字符串
|
||||
*/
|
||||
public String format() {
|
||||
return String.format("%04d-%02d-%02d %02d:%02d:%02d.%06d",
|
||||
year, month, day, hour, minute, second, microSecond);
|
||||
return String.format("%04d-%02d-%02dT%02d:%02d:%02d.%03d",
|
||||
year, month, day, hour, minute, second, microSecond/1000);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.gather.tools.comtrade.comparewave.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.njcn.gather.tools.comtrade.comparewave.config.PowerQualityConfig;
|
||||
import com.njcn.gather.tools.comtrade.comparewave.core.algorithm.PowerQualityCalculator;
|
||||
import com.njcn.gather.tools.comtrade.comparewave.core.algorithm.WaveformAligner;
|
||||
|
||||
Reference in New Issue
Block a user