1.正式检测代码详情检测表格代码提交

This commit is contained in:
wr
2025-01-05 13:57:38 +08:00
parent 949aa83539
commit ea8a2bd8e7
10 changed files with 210 additions and 44 deletions

View File

@@ -32,5 +32,9 @@ public class DetectionData {
*/
private Double resultData;
/**
* 误差范围
*/
private String radius;
}

View File

@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.njcn.gather.detection.pojo.po.DevData;
import com.njcn.gather.detection.pojo.vo.DetectionData;
@@ -60,9 +61,9 @@ public class DetectionServiceImpl {
public Map<String, Integer> text(List<DevData> dev, String errorSysId, Map<String, String> devIdMapComm, SourceIssue issue, DictDataEnum dataRule) {
Map<String, List<DevData>> devDataMap = dev.stream().collect(Collectors.groupingBy(DevData::getId));
Map<String, Integer> stringBooleanMap = new LinkedHashMap<>();
String code="1";
String code = "1";
devDataMap.forEach(((key, value) -> {
stringBooleanMap.put(key, DetectionIndexProcessing(value,code, errorSysId, devIdMapComm, dataRule, issue));
stringBooleanMap.put(key, DetectionIndexProcessing(value, code, errorSysId, devIdMapComm, dataRule, issue));
}));
return stringBooleanMap;
}
@@ -77,7 +78,7 @@ public class DetectionServiceImpl {
* @param sourceIssue 源下发的参数
* @return
*/
public Integer DetectionIndexProcessing(List<DevData> dev,String code, String errorSysId, Map<String, String> devIdMapComm, DictDataEnum dataRule, SourceIssue sourceIssue) {
public Integer DetectionIndexProcessing(List<DevData> dev, String code, String errorSysId, Map<String, String> devIdMapComm, DictDataEnum dataRule, SourceIssue sourceIssue) {
PqErrSysParam.DetectionParam param = new PqErrSysParam.DetectionParam();
param.setIndex(sourceIssue.getIndex());
param.setScriptId(sourceIssue.getScriptId());
@@ -89,70 +90,70 @@ public class DetectionServiceImpl {
*/
case "FREQ":
AdNonHarmonicResult freq = isQualified(dev, devIdMapComm, pqErrSysDtls, F, sourceIssue, dataRule, "FREQ");
detectionDataDealService.acceptAdNonResult(Arrays.asList(freq),code);
detectionDataDealService.acceptAdNonResult(Arrays.asList(freq), code);
return freq.getResultFlag();
/**
* 电压
*/
case "V":
AdNonHarmonicResult vrms = isQualified(dev, devIdMapComm, pqErrSysDtls, U, sourceIssue, dataRule, "VRMS");
detectionDataDealService.acceptAdNonResult(Arrays.asList(vrms),code);
detectionDataDealService.acceptAdNonResult(Arrays.asList(vrms), code);
return vrms.getResultFlag();
/**
* 电流
*/
case "I":
AdNonHarmonicResult irms = isQualified(dev, devIdMapComm, pqErrSysDtls, I, sourceIssue, dataRule, "IRMS");
detectionDataDealService.acceptAdNonResult(Arrays.asList(irms),code);
detectionDataDealService.acceptAdNonResult(Arrays.asList(irms), code);
return irms.getResultFlag();
/**
* 谐波电压
*/
case "HV":
AdHarmonicResult harmV = isHarmQualified(dev, devIdMapComm, pqErrSysDtls, U, sourceIssue, dataRule, 2);
detectionDataDealService.acceptAdResult(Arrays.asList(harmV),code);
detectionDataDealService.acceptAdResult(Arrays.asList(harmV), code);
return harmV.getResultFlag();
/**
* 谐波电流
*/
case "HI":
AdHarmonicResult harmI = isHarmQualified(dev, devIdMapComm, pqErrSysDtls, I, sourceIssue, dataRule, 2);
detectionDataDealService.acceptAdResult(Arrays.asList(harmI),code);
detectionDataDealService.acceptAdResult(Arrays.asList(harmI), code);
return harmI.getResultFlag();
/**
* 间谐波电压
*/
case "HSV":
AdHarmonicResult harmInV = isHarmQualified(dev, devIdMapComm, pqErrSysDtls, U, sourceIssue, dataRule, 1);
detectionDataDealService.acceptAdResult(Arrays.asList(harmInV),code);
detectionDataDealService.acceptAdResult(Arrays.asList(harmInV), code);
return harmInV.getResultFlag();
/**
* 间谐波电流
*/
case "HSI":
AdHarmonicResult harmInI = isHarmQualified(dev, devIdMapComm, pqErrSysDtls, I, sourceIssue, dataRule, 1);
detectionDataDealService.acceptAdResult(Arrays.asList(harmInI),code);
detectionDataDealService.acceptAdResult(Arrays.asList(harmInI), code);
return harmInI.getResultFlag();
/**
* 三相电压不平衡度
*/
case "IMBV":
AdNonHarmonicResult vUnban = isUnBalanceOrFlickerQualified(dev, devIdMapComm, pqErrSysDtls, U, sourceIssue, dataRule, "V_UNBAN");
detectionDataDealService.acceptAdNonResult(Arrays.asList(vUnban),code);
detectionDataDealService.acceptAdNonResult(Arrays.asList(vUnban), code);
return vUnban.getResultFlag();
/**
* 三相电流不平衡度
*/
case "IMBA":
AdNonHarmonicResult iUnban = isUnBalanceOrFlickerQualified(dev, devIdMapComm, pqErrSysDtls, I, sourceIssue, dataRule, "I_UNBAN");
detectionDataDealService.acceptAdNonResult(Arrays.asList(iUnban),code);
detectionDataDealService.acceptAdNonResult(Arrays.asList(iUnban), code);
return iUnban.getResultFlag();
/**
* 谐波有功功率
*/
case "HP":
AdHarmonicResult harmP = isHarmQualified(dev, devIdMapComm, pqErrSysDtls, P, sourceIssue, dataRule, 2);
detectionDataDealService.acceptAdResult(Arrays.asList(harmP),code);
detectionDataDealService.acceptAdResult(Arrays.asList(harmP), code);
return harmP.getResultFlag();
/**
* 功率
@@ -164,13 +165,13 @@ public class DetectionServiceImpl {
*/
case "F":
AdNonHarmonicResult pst = isUnBalanceOrFlickerQualified(dev, devIdMapComm, pqErrSysDtls, null, sourceIssue, dataRule, "PST");
detectionDataDealService.acceptAdNonResult(Arrays.asList(pst),code);
detectionDataDealService.acceptAdNonResult(Arrays.asList(pst), code);
return pst.getResultFlag();
/**
* 暂态
*/
case "VOLTAGE":
return isVoltageQualified(dev, devIdMapComm, pqErrSysDtls, sourceIssue, dataRule,code);
return isVoltageQualified(dev, devIdMapComm, pqErrSysDtls, sourceIssue, dataRule, code);
}
return null;
}
@@ -214,7 +215,7 @@ public class DetectionServiceImpl {
result.setDataType("avg");
if (map.containsKey(TYPE_T)) {
DetectionData t = rangeComparisonList(map.get(TYPE_T), pqErrSysDtls, fData, 1.0, dataRule);
result.setTValue(t.getData() + "_" + t.getIsData()+"_"+t.getResultData());
result.setTValue(JSON.toJSONString(t));
result.setResultFlag(t.getIsData());
} else {
//取出源所对应的相别信息
@@ -222,19 +223,19 @@ public class DetectionServiceImpl {
.filter(x -> (type + "a").equals(x.getChannelType()))
.collect(Collectors.toList());
DetectionData a = rangeComparisonList(map.get(TYPE_A), pqErrSysDtls, fData, channelTypeAList.get(0).getFAmp(), dataRule);
result.setAValue(a.getData() + "_" + a.getIsData()+"_"+a.getResultData());
result.setAValue(JSON.toJSONString(a));
List<SourceIssue.ChannelListDTO> channelTypeBList = sourceIssue.getChannelList().stream()
.filter(x -> (type + "b").equals(x.getChannelType()))
.collect(Collectors.toList());
DetectionData b = rangeComparisonList(map.get(TYPE_B), pqErrSysDtls, fData, channelTypeBList.get(0).getFAmp(), dataRule);
result.setBValue(b.getData() + "_" + b.getIsData()+"_"+b.getResultData());
result.setBValue(JSON.toJSONString(b));
List<SourceIssue.ChannelListDTO> channelTypeCList = sourceIssue.getChannelList().stream()
.filter(x -> (type + "c").equals(x.getChannelType()))
.collect(Collectors.toList());
DetectionData c = rangeComparisonList(map.get(TYPE_C), pqErrSysDtls, fData, channelTypeCList.get(0).getFAmp(), dataRule);
result.setCValue(c.getData() + "_" + c.getIsData()+"_"+c.getResultData());
result.setCValue(JSON.toJSONString(c));
List<Integer> numbers = Arrays.asList(a.getIsData(), b.getIsData(), c.getIsData()).stream().distinct().collect(Collectors.toList());
return getAdNonHarmonicResult(result, numbers);
@@ -328,34 +329,34 @@ public class DetectionServiceImpl {
result.setSort(sourceIssue.getIndex());
result.setAdType(pqErrSysDtls.get(0).getScriptType());
result.setDataType("avg");
if(StrUtil.isBlank(type)){
if (StrUtil.isBlank(type)) {
//取出源所对应的相别信息
List<PqScriptCheckData> channelTypeAList = checkData.stream()
.filter(x -> TYPE_A.equals(x.getPhase()))
.collect(Collectors.toList());
DetectionData a = rangeComparisonList(map.get(TYPE_A), pqErrSysDtls, fData, channelTypeAList.get(0).getValue(), dataRule);
result.setAValue(a.getData() + "_" + a.getIsData()+"_"+a.getResultData());
result.setAValue(JSON.toJSONString(a));
List<PqScriptCheckData> channelTypeBList = checkData.stream()
.filter(x -> TYPE_B.equals(x.getPhase()))
.collect(Collectors.toList());
DetectionData b = rangeComparisonList(map.get(TYPE_B), pqErrSysDtls, fData, channelTypeBList.get(0).getValue(), dataRule);
result.setBValue(b.getData() + "_" + b.getIsData()+"_"+b.getResultData());
result.setBValue(JSON.toJSONString(b));
List<PqScriptCheckData> channelTypeCList = checkData.stream()
.filter(x -> TYPE_C.equals(x.getPhase()))
.collect(Collectors.toList());
DetectionData c = rangeComparisonList(map.get(TYPE_C), pqErrSysDtls, fData, channelTypeCList.get(0).getValue(), dataRule);
result.setCValue(c.getData() + "_" + c.getIsData()+"_"+c.getResultData());
result.setCValue(JSON.toJSONString(c));
List<Integer> numbers = Arrays.asList(a.getIsData(), b.getIsData(), c.getIsData());
return getAdNonHarmonicResult(result, numbers);
}else{
} else {
List<PqScriptCheckData> channelTypeBList = checkData.stream()
.filter(x -> TYPE_T.equals(x.getPhase()))
.collect(Collectors.toList());
DetectionData t = rangeComparisonList(map.get(TYPE_B), pqErrSysDtls, fData, channelTypeBList.get(0).getValue(), dataRule);
result.setBValue(t.getData() + "_" + t.getIsData()+"_"+t.getResultData());
result.setBValue(JSON.toJSONString(t));
List<Integer> numbers = Arrays.asList(t.getIsData());
return getAdNonHarmonicResult(result, numbers);
}
@@ -369,7 +370,7 @@ public class DetectionServiceImpl {
* @param pqErrSysDtls 误差体系
* @param sourceIssue 源下发所对应的参数
* @param dataRule 数据处理原则
* @param code 计划code
* @param code 计划code
* @return
*/
public Integer isVoltageQualified(List<DevData> dev,
@@ -378,7 +379,7 @@ public class DetectionServiceImpl {
SourceIssue sourceIssue,
DictDataEnum dataRule,
String code
) {
) {
//电压幅值处理数据
Map<String, List<Double>> mag = devListMap(dev, dataRule, MAG);
//暂降时间处理数据
@@ -391,7 +392,7 @@ public class DetectionServiceImpl {
magResult.setAdType(magErrList.get(0).getScriptType());
AdNonHarmonicResult durResult = voltageResult(dev.get(0).getId(), devIdMapComm, sourceIssue, dataRule, dur, durErrList, sourceIssue.getFFreq(), DUR);
durResult.setAdType(durErrList.get(0).getScriptType());
detectionDataDealService.acceptAdNonResult(Arrays.asList(magResult,durResult),code);
detectionDataDealService.acceptAdNonResult(Arrays.asList(magResult, durResult), code);
List<Integer> numbers = Arrays.asList(magResult.getResultFlag(), durResult.getResultFlag()).stream().distinct().collect(Collectors.toList());
if (numbers.contains(4)) {
return 4;
@@ -441,7 +442,7 @@ public class DetectionServiceImpl {
retainATime = channelTypeAList.get(0).getFAmp();
}
DetectionData a = rangeComparisonList(mag.get(TYPE_A), magErrList, fData, retainATime, dataRule);
result.setAValue(a.getData() + "_" + a.getIsData()+"_"+a.getResultData());
result.setAValue(JSON.toJSONString(a));
List<SourceIssue.ChannelListDTO> channelTypeBList = sourceIssue.getChannelList().stream()
.filter(x -> ("Ub").equals(x.getChannelType()))
@@ -453,7 +454,7 @@ public class DetectionServiceImpl {
retainBTime = channelTypeBList.get(0).getFAmp();
}
DetectionData b = rangeComparisonList(mag.get(TYPE_B), magErrList, fData, retainBTime, dataRule);
result.setBValue(b.getData() + "_" + b.getIsData()+"_"+b.getResultData());
result.setBValue(JSON.toJSONString(b));
List<SourceIssue.ChannelListDTO> channelTypeCList = sourceIssue.getChannelList().stream()
.filter(x -> ("Uc").equals(x.getChannelType()))
@@ -465,7 +466,7 @@ public class DetectionServiceImpl {
retainCTime = channelTypeCList.get(0).getFAmp();
}
DetectionData c = rangeComparisonList(mag.get(TYPE_C), magErrList, fData, retainCTime, dataRule);
result.setCValue(c.getData() + "_" + c.getIsData()+"_"+c.getResultData());
result.setCValue(JSON.toJSONString(c));
List<Integer> numbers = Arrays.asList(a.getIsData(), b.getIsData(), c.getIsData()).stream().distinct().collect(Collectors.toList());
@@ -578,7 +579,7 @@ public class DetectionServiceImpl {
if (ObjectUtil.isNull(value.getIsData())) {
idField.set(harmonicResult, value.getData());
} else {
idField.set(harmonicResult, value.getData() + "_" + value.getIsData()+"_"+value.getResultData());
idField.set(harmonicResult,JSON.toJSONString(value));
}
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
@@ -645,7 +646,7 @@ public class DetectionServiceImpl {
}
});
devMap.forEach((harm, harmDataList) -> {
PqErrSysDtls errSysDtl = errSysDtlMap.get(num==1?harm+0.5:harm);
PqErrSysDtls errSysDtl = errSysDtlMap.get(num == 1 ? harm + 0.5 : harm);
DetectionData data = new DetectionData();
data.setIsData(4);
data.setNum(harm);
@@ -680,6 +681,7 @@ public class DetectionServiceImpl {
BigDecimal.valueOf(-errSysDtl.getMaxErrorValue()),
BigDecimal.valueOf(errSysDtl.getMaxErrorValue()))).collect(Collectors.toList());
if (CollUtil.isNotEmpty(qualifiedList)) {
data.setRadius(-errSysDtl.getMaxErrorValue()+"-"+errSysDtl.getMaxErrorValue());
data.setData(qualifiedList.get(0));
switch (dataRule) {
case AT_WILL_VALUE:
@@ -721,7 +723,7 @@ public class DetectionServiceImpl {
for (DevData devData : dev) {
Optional<DevData.SqlDataDTO> first = devData.getSqlData().stream().collect(Collectors.toList()).stream().findFirst();
DevData.SqlDataDTO fund = null;
if (first.isPresent()){
if (first.isPresent()) {
fund = devData.getSqlData().stream().collect(Collectors.toList()).stream().findFirst().get();
}
DevData.SqlDataHarmDTO harm = devData.getSqlDataHarm().stream().filter(x -> 49 == x.getNum()).collect(Collectors.toList()).stream().findFirst().get();
@@ -786,9 +788,11 @@ public class DetectionServiceImpl {
BigDecimal.valueOf(1.0 / data * (channelData - errSysDtl.getMaxErrorValue())),
BigDecimal.valueOf(1.0 / data * (channelData + errSysDtl.getMaxErrorValue())))
).collect(Collectors.toList());
detectionData.setResultData(BigDecimal.valueOf(1.0 / data).doubleValue());
detectionData.setResultData(BigDecimal.valueOf(1.0 / data).doubleValue() * channelData);
if (CollUtil.isNotEmpty(qualifiedList)) {
detectionData.setData(qualifiedList.get(0));
detectionData.setRadius(BigDecimal.valueOf(1.0 / data * (channelData - errSysDtl.getMaxErrorValue()))
+ "-" + BigDecimal.valueOf(1.0 / data * (channelData + errSysDtl.getMaxErrorValue())));
switch (dataRule) {
case AT_WILL_VALUE:
case CP95_VALUE:

View File

@@ -760,9 +760,9 @@ public class ResultServiceImpl implements IResultService {
if (CollUtil.isNotEmpty(cur)) {
String unit;
if (isValueType) {
unit = ResultUnitEnum.V_RELATIVE_UNIT.getUnit();
unit = ResultUnitEnum.I_RELATIVE_UNIT.getUnit();
} else {
unit = ResultUnitEnum.V_ABSOLUTELY_UNIT.getUnit();
unit = ResultUnitEnum.I_ABSOLUTELY_UNIT.getUnit();
}
for (PqScriptDtls dtls : cur) {
buffer.append("I" + dtls.getPhase().toLowerCase() + "=" + dtls.getValue() + unit + ",相角=" + dtls.getAngle() + "° ");