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