From 8cf4d04c658619f8a5f28fdcf01ddce4c27f230a Mon Sep 17 00:00:00 2001 From: wr <1754607820@qq.com> Date: Mon, 6 Jan 2025 09:59:34 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=BE=AE=E8=B0=83=E6=AD=A3=E5=BC=8F=E6=A3=80?= =?UTF-8?q?=E6=B5=8B-=E6=A3=80=E6=B5=8B=E8=AF=A6=E6=83=85=E8=A1=A8?= =?UTF-8?q?=E6=A0=BC=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../njcn/gather/result/pojo/vo/ResultVO.java | 2 +- .../service/impl/ResultServiceImpl.java | 4 +- .../gather/storage/pojo/vo/RawDataVO.java | 5 + .../storage/pojo/vo/RawResultDataVO.java | 6 ++ .../service/impl/AdHarmonicServiceImpl.java | 2 + .../impl/AdNonHarmonicServiceImpl.java | 94 +++++++++++++++++-- 6 files changed, 104 insertions(+), 9 deletions(-) diff --git a/detection/src/main/java/com/njcn/gather/result/pojo/vo/ResultVO.java b/detection/src/main/java/com/njcn/gather/result/pojo/vo/ResultVO.java index 89f69f41..78ccabf6 100644 --- a/detection/src/main/java/com/njcn/gather/result/pojo/vo/ResultVO.java +++ b/detection/src/main/java/com/njcn/gather/result/pojo/vo/ResultVO.java @@ -24,6 +24,6 @@ public class ResultVO { /** * 原始数据 */ - private Map> rawData; + private Map> rawData; } diff --git a/detection/src/main/java/com/njcn/gather/result/service/impl/ResultServiceImpl.java b/detection/src/main/java/com/njcn/gather/result/service/impl/ResultServiceImpl.java index e4380d47..c3a08c17 100644 --- a/detection/src/main/java/com/njcn/gather/result/service/impl/ResultServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/result/service/impl/ResultServiceImpl.java @@ -792,11 +792,11 @@ public class ResultServiceImpl implements IResultService { ); List harmNum = list.stream().map(PqScriptCheckData::getHarmNum).collect(Collectors.toList()); ResultVO resultVO=new ResultVO(); - if(CollUtil.isNotEmpty(harmNum)){ - storage.setHarmNum(harmNum); + if(CollUtil.isEmpty(harmNum)){ resultVO.setRawData(adNonHarmonicService.listNonHarmData(storage)); resultVO.setResultData(adNonHarmonicService.listNonHarmResultData(storage)); }else{ + storage.setHarmNum(harmNum); resultVO.setRawData(adHarmonicService.listHarmData(storage)); resultVO.setResultData(adHarmonicService.listHarmResultData(storage)); } diff --git a/storage/src/main/java/com/njcn/gather/storage/pojo/vo/RawDataVO.java b/storage/src/main/java/com/njcn/gather/storage/pojo/vo/RawDataVO.java index 84f90b40..f363823c 100644 --- a/storage/src/main/java/com/njcn/gather/storage/pojo/vo/RawDataVO.java +++ b/storage/src/main/java/com/njcn/gather/storage/pojo/vo/RawDataVO.java @@ -41,4 +41,9 @@ public class RawDataVO { * T相数据 */ private String dataT; + + /** + * 单位 + */ + private String unit; } diff --git a/storage/src/main/java/com/njcn/gather/storage/pojo/vo/RawResultDataVO.java b/storage/src/main/java/com/njcn/gather/storage/pojo/vo/RawResultDataVO.java index 11b47746..0ccdec94 100644 --- a/storage/src/main/java/com/njcn/gather/storage/pojo/vo/RawResultDataVO.java +++ b/storage/src/main/java/com/njcn/gather/storage/pojo/vo/RawResultDataVO.java @@ -48,6 +48,12 @@ public class RawResultDataVO { */ private DetectionData dataT; + /** + * 单位 + */ + private String unit; + + @Data public static class DetectionData { diff --git a/storage/src/main/java/com/njcn/gather/storage/service/impl/AdHarmonicServiceImpl.java b/storage/src/main/java/com/njcn/gather/storage/service/impl/AdHarmonicServiceImpl.java index 99319297..c5a30719 100644 --- a/storage/src/main/java/com/njcn/gather/storage/service/impl/AdHarmonicServiceImpl.java +++ b/storage/src/main/java/com/njcn/gather/storage/service/impl/AdHarmonicServiceImpl.java @@ -66,6 +66,7 @@ public class AdHarmonicServiceImpl extends ServiceImpl> info = new HashMap<>(2); Map> adTypeMap = adHarmonicResults.stream().collect(Collectors.groupingBy(AdNonHarmonicResult::getAdType)); List dictTreeById = dictTreeService.getDictTreeById(new ArrayList<>(adTypeMap.keySet())); - Map dictTreeByName = dictTreeById.stream().collect(Collectors.toMap(DictTree::getId, DictTree::getName)); + Map dictTreeByName = dictTreeById.stream().collect(Collectors.toMap(DictTree::getId,Function.identity())); adTypeMap.forEach((key, value) -> { if (dictTreeByName.containsKey(key)) { - String treeName = dictTreeByName.get(key); + DictTree dictTree = dictTreeByName.get(key); List rawDataVOS = new ArrayList<>(); for (AdNonHarmonicResult result : value) { RawDataVO dataVO = new RawDataVO(); + dataVO.setUnit(unit(dictTree.getCode())); dataVO.setTime(result.getTimeId().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN))); dataVO.setDataA(ObjectUtil.isNotNull(result.getAValue()) ? new BigDecimal(result.getAValue()).toPlainString() : null); dataVO.setDataB(ObjectUtil.isNotNull(result.getBValue()) ? new BigDecimal(result.getBValue()).toPlainString() : null); @@ -79,7 +80,7 @@ public class AdNonHarmonicServiceImpl extends ServiceImpl adTypeMap = adHarmonicResults.stream().collect(Collectors.toMap(AdNonHarmonicResult::getAdType, Function.identity())); List dictTreeById = dictTreeService.getDictTreeById(new ArrayList<>(adTypeMap.keySet())); - Map dictTreeByName = dictTreeById.stream().collect(Collectors.toMap(DictTree::getId, DictTree::getName)); + Map dictTreeByName = dictTreeById.stream().collect(Collectors.toMap(DictTree::getId,Function.identity())); adTypeMap.forEach((key, result) -> { if (dictTreeByName.containsKey(key)) { - String treeName = dictTreeByName.get(key); + DictTree treeName = dictTreeByName.get(key); RawResultDataVO dataVO = new RawResultDataVO(); dataVO.setIsData(result.getResultFlag()); + dataVO.setUnit(unit(treeName.getCode())); RawResultDataVO.DetectionData a = JSON.parseObject(result.getAValue(), RawResultDataVO.DetectionData.class); RawResultDataVO.DetectionData b = JSON.parseObject(result.getBValue(), RawResultDataVO.DetectionData.class); RawResultDataVO.DetectionData c = JSON.parseObject(result.getCValue(), RawResultDataVO.DetectionData.class); @@ -122,10 +124,90 @@ public class AdNonHarmonicServiceImpl extends ServiceImpl