代码微调

This commit is contained in:
wr
2025-01-08 11:21:11 +08:00
parent be232d390f
commit a0a42f8fa3
2 changed files with 45 additions and 44 deletions

View File

@@ -502,36 +502,31 @@ public class DetectionServiceImpl {
* @param dataRule
*/
public Map<String, List<Double>> devListMap(List<DevData> dev, DictDataEnum dataRule, String code) {
//设置
Map<String, List<Double>> map = new HashMap<>(3);
List<Double> a = new ArrayList<>();
List<Double> b = new ArrayList<>();
List<Double> c = new ArrayList<>();
List<Double> t = new ArrayList<>();
List<DevData.SqlDataDTO> sqlDataDTOS = dev.stream().flatMap(x -> x.getSqlData().stream().filter(j -> code.equals(j.getDesc())))
.collect(Collectors.toList());
if (CollUtil.isNotEmpty(sqlDataDTOS)) {
List<DevData.SqlDataDTO.ListDTO> list = sqlDataDTOS.stream().map(DevData.SqlDataDTO::getList).collect(Collectors.toList());
a = list.stream()
List<Double> a = list.stream()
.filter(x -> ObjectUtil.isNotNull(x.getA()))
.map(DevData.SqlDataDTO.ListDTO::getA)
.sorted(Comparator.comparing(Double::doubleValue).reversed())
.collect(Collectors.toList());
b = list.stream()
List<Double> b = list.stream()
.filter(x -> ObjectUtil.isNotNull(x.getB()))
.map(DevData.SqlDataDTO.ListDTO::getB)
.sorted(Comparator.comparing(Double::doubleValue).reversed())
.collect(Collectors.toList());
c = list.stream()
List<Double> c = list.stream()
.filter(x -> ObjectUtil.isNotNull(x.getC()))
.map(DevData.SqlDataDTO.ListDTO::getC)
.sorted(Comparator.comparing(Double::doubleValue).reversed())
.collect(Collectors.toList());
t = list.stream().filter(x -> ObjectUtil.isNotNull(x.getT()))
List<Double> t = list.stream().filter(x -> ObjectUtil.isNotNull(x.getT()))
.map(DevData.SqlDataDTO.ListDTO::getT)
.sorted(Comparator.comparing(Double::doubleValue).reversed())
.collect(Collectors.toList());
}
switch (dataRule) {
case SECTION_VALUE:
a = getDoubles(a, 1, 19);
@@ -558,6 +553,7 @@ public class DetectionServiceImpl {
if (CollUtil.isNotEmpty(t)) {
map.put(TYPE_T, t);
}
}
return map;
}
@@ -722,7 +718,9 @@ public class DetectionServiceImpl {
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();
List<DevData.SqlDataHarmDTO> harmList = devData.getSqlDataHarm().stream().collect(Collectors.toList());
if (CollUtil.isNotEmpty(harmList)) {
DevData.SqlDataHarmDTO harm = harmList.get(0);
if (ObjectUtil.isNotNull(fund)) {
harmPut(TYPE_A, map, harmNum, harm, String.valueOf(fund.getList().getA()), num);
harmPut(TYPE_B, map, harmNum, harm, String.valueOf(fund.getList().getB()), num);
@@ -733,6 +731,8 @@ public class DetectionServiceImpl {
harmPut(TYPE_C, map, harmNum, harm, "1.0", num);
}
}
}
map.forEach((typeKey, typeValue) -> {
typeValue.forEach((key, value) -> {
value.sort(Comparator.comparing(Double::doubleValue).reversed());

View File

@@ -14,6 +14,7 @@ import java.util.List;
@NoArgsConstructor
@Data
public class SourceIssue {
/**
* 检测小项dtls Id
*/