From c3d87eca34646db03cc7e802f2a76de845a54beb Mon Sep 17 00:00:00 2001 From: xy <748613696@qq.com> Date: Thu, 31 Oct 2024 15:44:14 +0800 Subject: [PATCH] =?UTF-8?q?bug=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/CsGroupServiceImpl.java | 9 +++++++-- .../service/impl/WlRecordServiceImpl.java | 16 +++++++++------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsGroupServiceImpl.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsGroupServiceImpl.java index 68ddc04..278cd85 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsGroupServiceImpl.java +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsGroupServiceImpl.java @@ -331,7 +331,6 @@ public class CsGroupServiceImpl extends ServiceImpl impl vo.setTime(temp.getTime()); vo.setStatMethod(temp.getValueType()); vo.setStatisticalData(Double.valueOf(df.format(temp.getValue()))); - vo.setUnit(epdPqd.getUnit()); if(temp.getValue()!=null) { double re; if (Objects.equals("Primary",commonStatisticalQueryParam.getDataLevel())) { @@ -343,6 +342,9 @@ public class CsGroupServiceImpl extends ServiceImpl impl re = DataChangeUtil.secondaryToPrimary(epdPqd.getPrimaryFormula(), temp.getValue(), pt, ct) / 1000; vo.setStatisticalData(Double.valueOf(df.format(re))); vo.setUnit("k" + epdPqd.getUnit()); + } else { + vo.setStatisticalData(Double.valueOf(df.format(temp.getValue()))); + vo.setUnit(epdPqd.getUnit()); } } } else { @@ -350,13 +352,16 @@ public class CsGroupServiceImpl extends ServiceImpl impl if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) { re = DataChangeUtil.primaryToSecondary(epdPqd.getPrimaryFormula(), temp.getValue(), pt, ct); vo.setStatisticalData(Double.valueOf(df.format(re))); + } else { + vo.setStatisticalData(Double.valueOf(df.format(temp.getValue()))); + vo.setUnit(epdPqd.getUnit()); } } else { vo.setStatisticalData(Double.valueOf(df.format(temp.getValue()))); } vo.setUnit(epdPqd.getUnit()); } - }else { + } else { vo.setStatisticalData(null); } vo.setStatisticalIndex(epdPqd.getId()); diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/WlRecordServiceImpl.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/WlRecordServiceImpl.java index 351830d..22a89bb 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/WlRecordServiceImpl.java +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/WlRecordServiceImpl.java @@ -407,23 +407,21 @@ public class WlRecordServiceImpl extends ServiceImpl i } //格式化前端参数 formatQueryParamList(commonStatisticalQueryParam); - if(commonStatisticalQueryParam.getList() != null && commonStatisticalQueryParam.getList().size() > 0){ + if(commonStatisticalQueryParam.getList() != null && !commonStatisticalQueryParam.getList().isEmpty()){ for (CommonStatisticalQueryParam param : commonStatisticalQueryParam.getList()){ if(param.getStatisticalId() == null){ continue; } List eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(param.getStatisticalId()).getData(); - for(WlRecord wl : data){ List finalCsLinePOList = csLineFeignClient.queryLineById(Arrays.asList(wl.getLineId())).getData(); CsDataSet csDataSet = csDataSetMapper.selectOne(new LambdaQueryWrapper().eq(CsDataSet::getId,finalCsLinePOList.get(0).getDataSetId())); - if(Objects.isNull(csDataSet) || StrUtil.isBlank(csDataSet.getDataLevel())){ + if(StrUtil.isBlank(csDataSet.getDataLevel())){ throw new BusinessException("当前测点数据集主要信息缺失,请联系管理员排查(测点表里面数据集id缺失)"); } Double ct = Double.valueOf(wlRecord.getCt())/wlRecord.getCt1(); Double pt =Double.valueOf(wlRecord.getPt())/wlRecord.getPt1(); - List data1 = equipmentFeignClient.queryDeviceById(Stream.of(wl.getDevId()).collect(Collectors.toList())).getData(); eleEpdPqds.forEach(epdPqd->{ List commonQueryParams = finalCsLinePOList.stream().map(temp -> { @@ -443,7 +441,6 @@ public class WlRecordServiceImpl extends ServiceImpl i //此处设空时为了有多段时将线条断开前端显示 if(!CollectionUtils.isEmpty(deviceRtData)){ deviceRtData.get(deviceRtData.size()-1).setValue(null); - } List collect1 = deviceRtData.stream().map(temp -> { ThdDataVO vo = new ThdDataVO(); @@ -453,7 +450,6 @@ public class WlRecordServiceImpl extends ServiceImpl i vo.setPosition(position); vo.setTime(temp.getTime()); vo.setStatMethod(temp.getValueType()); - vo.setUnit(epdPqd.getUnit()); if(temp.getValue()!=null) { double re; if (Objects.equals("Primary",commonStatisticalQueryParam.getDataLevel())) { @@ -465,6 +461,9 @@ public class WlRecordServiceImpl extends ServiceImpl i re = DataChangeUtil.secondaryToPrimary(epdPqd.getPrimaryFormula(), temp.getValue(), pt, ct) / 1000; vo.setStatisticalData(Double.valueOf(df.format(re))); vo.setUnit("k" + epdPqd.getUnit()); + } else { + vo.setStatisticalData(Double.valueOf(df.format(temp.getValue()))); + vo.setUnit(epdPqd.getUnit()); } } } else { @@ -472,13 +471,16 @@ public class WlRecordServiceImpl extends ServiceImpl i if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) { re = DataChangeUtil.primaryToSecondary(epdPqd.getPrimaryFormula(), temp.getValue(), pt, ct); vo.setStatisticalData(Double.valueOf(df.format(re))); + } else { + vo.setStatisticalData(Double.valueOf(df.format(temp.getValue()))); + vo.setUnit(epdPqd.getUnit()); } } else { vo.setStatisticalData(Double.valueOf(df.format(temp.getValue()))); } vo.setUnit(epdPqd.getUnit()); } - }else { + } else { vo.setStatisticalData(null); } vo.setStatisticalIndex(epdPqd.getId());