代码微调
This commit is contained in:
@@ -39,20 +39,20 @@ import java.util.stream.Collectors;
|
||||
@RequiredArgsConstructor
|
||||
public class DetectionServiceImpl {
|
||||
|
||||
public final IPqErrSysDtlsService pqErrSysDtlsService;
|
||||
public final IPqScriptCheckDataService pqScriptCheckDataService;
|
||||
public final DetectionDataDealService detectionDataDealService;
|
||||
private final IPqErrSysDtlsService pqErrSysDtlsService;
|
||||
private final IPqScriptCheckDataService pqScriptCheckDataService;
|
||||
private final DetectionDataDealService detectionDataDealService;
|
||||
|
||||
public final String TYPE_A = "A";
|
||||
public final String TYPE_B = "B";
|
||||
public final String TYPE_C = "C";
|
||||
public final String TYPE_T = "T";
|
||||
public final String U = "U";
|
||||
public final String I = "I";
|
||||
public final String F = "F";
|
||||
public final String P = "P";
|
||||
public final String MAG = "MAG";
|
||||
public final String DUR = "DUR";
|
||||
private final String TYPE_A = "A";
|
||||
private final String TYPE_B = "B";
|
||||
private final String TYPE_C = "C";
|
||||
private final String TYPE_T = "T";
|
||||
private final String U = "U";
|
||||
private final String I = "I";
|
||||
private final String F = "F";
|
||||
private final String P = "P";
|
||||
private final String MAG = "MAG";
|
||||
private final String DUR = "DUR";
|
||||
|
||||
|
||||
/**
|
||||
@@ -239,7 +239,7 @@ public class DetectionServiceImpl {
|
||||
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);
|
||||
result.setResultFlag(setResultFlag(numbers));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -289,7 +289,9 @@ public class DetectionServiceImpl {
|
||||
list.addAll(integerBooleanB.stream().map(DetectionData::getIsData).distinct().collect(Collectors.toList()));
|
||||
list.addAll(integerBooleanC.stream().map(DetectionData::getIsData).distinct().collect(Collectors.toList()));
|
||||
List<Integer> numbers = list.stream().distinct().collect(Collectors.toList());
|
||||
return getAdHarmonicResult(harmonicResult, numbers);
|
||||
harmonicResult.setResultFlag(setResultFlag(numbers));
|
||||
|
||||
return harmonicResult;
|
||||
}
|
||||
|
||||
|
||||
@@ -351,7 +353,7 @@ public class DetectionServiceImpl {
|
||||
result.setCValue(JSON.toJSONString(c));
|
||||
|
||||
List<Integer> numbers = Arrays.asList(a.getIsData(), b.getIsData(), c.getIsData());
|
||||
return getAdNonHarmonicResult(result, numbers);
|
||||
result.setResultFlag(setResultFlag(numbers));
|
||||
} else {
|
||||
List<PqScriptCheckData> channelTypeBList = checkData.stream()
|
||||
.filter(x -> TYPE_T.equals(x.getPhase()))
|
||||
@@ -359,8 +361,9 @@ public class DetectionServiceImpl {
|
||||
DetectionData t = rangeComparisonList(map.get(TYPE_B), pqErrSysDtls, fData, channelTypeBList.get(0).getValue(), dataRule);
|
||||
result.setBValue(JSON.toJSONString(t));
|
||||
List<Integer> numbers = Arrays.asList(t.getIsData());
|
||||
return getAdNonHarmonicResult(result, numbers);
|
||||
result.setResultFlag(setResultFlag(numbers));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -470,38 +473,21 @@ public class DetectionServiceImpl {
|
||||
result.setCValue(JSON.toJSONString(c));
|
||||
|
||||
List<Integer> numbers = Arrays.asList(a.getIsData(), b.getIsData(), c.getIsData()).stream().distinct().collect(Collectors.toList());
|
||||
result.setResultFlag(setResultFlag(numbers));
|
||||
|
||||
return getAdNonHarmonicResult(result, numbers);
|
||||
}
|
||||
|
||||
private AdNonHarmonicResult getAdNonHarmonicResult(AdNonHarmonicResult result, List<Integer> numbers) {
|
||||
if (numbers.size() > 2) {
|
||||
result.setResultFlag(4);
|
||||
} else if (numbers.size() > 1) {
|
||||
if (numbers.contains(4)) {
|
||||
result.setResultFlag(4);
|
||||
} else if (numbers.contains(2)) {
|
||||
result.setResultFlag(2);
|
||||
}
|
||||
} else {
|
||||
result.setResultFlag(numbers.get(0));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private AdHarmonicResult getAdHarmonicResult(AdHarmonicResult result, List<Integer> numbers) {
|
||||
if (numbers.size() > 2) {
|
||||
result.setResultFlag(4);
|
||||
} else if (numbers.size() > 1) {
|
||||
|
||||
private Integer setResultFlag(List<Integer> numbers) {
|
||||
if (numbers.size() > 1) {
|
||||
if (numbers.contains(4)) {
|
||||
result.setResultFlag(4);
|
||||
return 4;
|
||||
} else if (numbers.contains(2)) {
|
||||
result.setResultFlag(2);
|
||||
return 2;
|
||||
}
|
||||
} else {
|
||||
result.setResultFlag(numbers.get(0));
|
||||
}
|
||||
return result;
|
||||
return numbers.get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -683,6 +669,10 @@ public class DetectionServiceImpl {
|
||||
BigDecimal.valueOf(-errSysDtl.getMaxErrorValue()),
|
||||
BigDecimal.valueOf(errSysDtl.getMaxErrorValue()))).collect(Collectors.toList());
|
||||
data.setRadius(-errSysDtl.getMaxErrorValue() + "~" + errSysDtl.getMaxErrorValue());
|
||||
isData(dataRule, harmDataList, data, qualifiedList);
|
||||
}
|
||||
|
||||
private void isData(DictDataEnum dataRule, List<Double> harmDataList, DetectionData data, List<Double> qualifiedList) {
|
||||
if (CollUtil.isNotEmpty(qualifiedList)) {
|
||||
data.setData(qualifiedList.get(0));
|
||||
switch (dataRule) {
|
||||
@@ -793,30 +783,7 @@ public class DetectionServiceImpl {
|
||||
detectionData.setResultData(BigDecimal.valueOf(1.0 / data).doubleValue() * channelData);
|
||||
detectionData.setRadius(BigDecimal.valueOf(1.0 / data * (channelData - errSysDtl.getMaxErrorValue()))
|
||||
+ "~" + BigDecimal.valueOf(1.0 / data * (channelData + errSysDtl.getMaxErrorValue())));
|
||||
if (CollUtil.isNotEmpty(qualifiedList)) {
|
||||
detectionData.setData(qualifiedList.get(0));
|
||||
switch (dataRule) {
|
||||
case AT_WILL_VALUE:
|
||||
case CP95_VALUE:
|
||||
case AVG_VALUE:
|
||||
if (qualifiedList.size() > 0) {
|
||||
detectionData.setIsData(1);
|
||||
} else {
|
||||
detectionData.setIsData(2);
|
||||
}
|
||||
break;
|
||||
case SECTION_VALUE:
|
||||
case Own_value:
|
||||
if (qualifiedList.size() == qualifiedList.size()) {
|
||||
detectionData.setIsData(1);
|
||||
} else {
|
||||
detectionData.setIsData(2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
detectionData.setIsData(2);
|
||||
}
|
||||
isData(dataRule, qualifiedList, detectionData, qualifiedList);
|
||||
} else {
|
||||
if (0 == errSysDtl.getErrorValueType()) {
|
||||
errSysDtl.setMaxErrorValue(multiply(errSysDtl.getMaxErrorValue(), data, 0));
|
||||
@@ -963,14 +930,14 @@ public class DetectionServiceImpl {
|
||||
}
|
||||
}
|
||||
|
||||
public static List<Double> getAvgDoubles(List<Double> t) {
|
||||
public List<Double> getAvgDoubles(List<Double> t) {
|
||||
if (CollUtil.isNotEmpty(t)) {
|
||||
t = Arrays.asList(t.stream().mapToDouble(Double::doubleValue).average().orElse(0.0));
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
public static List<Double> getDoubles(List<Double> t, Integer start, Integer end) {
|
||||
public List<Double> getDoubles(List<Double> t, Integer start, Integer end) {
|
||||
if (CollUtil.isNotEmpty(t)) {
|
||||
t = t.subList(start, end);
|
||||
}
|
||||
|
||||
@@ -168,7 +168,6 @@ public class ResultServiceImpl implements IResultService {
|
||||
.sorted(Comparator.comparing(PqScriptDtls::getIndex))
|
||||
.collect(Collectors.groupingBy(PqScriptDtls::getIndex, LinkedHashMap::new, Collectors.toList()));
|
||||
List<TreeDataVO> subTypeList = new ArrayList<>();
|
||||
|
||||
indexMap.forEach((index, scriptDtlIndexList) -> {
|
||||
if (finalResultMap.containsKey(index)) {
|
||||
TreeDataVO dtlType = new TreeDataVO();
|
||||
@@ -179,8 +178,10 @@ public class ResultServiceImpl implements IResultService {
|
||||
subTypeList.add(dtlType);
|
||||
}
|
||||
});
|
||||
subType.setChildren(subTypeList);
|
||||
scriptSubList.add(subType);
|
||||
if (CollUtil.isNotEmpty(subTypeList)) {
|
||||
subType.setChildren(subTypeList);
|
||||
scriptSubList.add(subType);
|
||||
}
|
||||
} else {
|
||||
dipScriptTypeName(subValue, scriptSubList, finalResultMap, isValueType, "电压暂降测量准确度测试", 20, 85);
|
||||
dipScriptTypeName(subValue, scriptSubList, finalResultMap, isValueType, "电压暂升测量准确度测试", 110, 180);
|
||||
@@ -227,14 +228,20 @@ public class ResultServiceImpl implements IResultService {
|
||||
}
|
||||
|
||||
});
|
||||
treeDataVO.setChildren(subTypeList);
|
||||
subSingleList.add(treeDataVO);
|
||||
if (CollUtil.isNotEmpty(subTypeList)) {
|
||||
treeDataVO.setChildren(subTypeList);
|
||||
subSingleList.add(treeDataVO);
|
||||
}
|
||||
});
|
||||
subType.setChildren(subSingleList);
|
||||
scriptSubList.add(subType);
|
||||
if (CollUtil.isNotEmpty(subSingleList)) {
|
||||
subType.setChildren(subSingleList);
|
||||
scriptSubList.add(subType);
|
||||
}
|
||||
}
|
||||
if (CollUtil.isNotEmpty(scriptSubList)) {
|
||||
infoVO.setChildren(scriptSubList);
|
||||
infoVOS.add(infoVO);
|
||||
}
|
||||
infoVO.setChildren(scriptSubList);
|
||||
infoVOS.add(infoVO);
|
||||
}
|
||||
});
|
||||
return infoVOS;
|
||||
@@ -263,8 +270,10 @@ public class ResultServiceImpl implements IResultService {
|
||||
}
|
||||
|
||||
}
|
||||
vo.setChildren(info);
|
||||
subTypeList.add(vo);
|
||||
if (CollUtil.isNotEmpty(info)) {
|
||||
vo.setChildren(info);
|
||||
subTypeList.add(vo);
|
||||
}
|
||||
}
|
||||
|
||||
private void ratedScriptTypeName(List<PqScriptDtls> scriptDtlIndexList, Boolean isValueType, TreeDataVO dtlType, DictTree dictTree) {
|
||||
|
||||
Reference in New Issue
Block a user