From 8e4adc58d4ea044e4a7fbeb23a1106be9918baf1 Mon Sep 17 00:00:00 2001 From: xy <748613696@qq.com> Date: Mon, 2 Dec 2024 19:04:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8E=A5=E7=BA=BF=E6=96=B9?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/njcn/csdevice/pojo/vo/CsLedgerVO.java | 3 ++ cs-device/cs-device-boot/pom.xml | 22 +++------- .../service/impl/CsLedgerServiceImpl.java | 5 +++ .../service/impl/DataServiceImpl.java | 44 ++++++++++++------- 4 files changed, 42 insertions(+), 32 deletions(-) diff --git a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/vo/CsLedgerVO.java b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/vo/CsLedgerVO.java index 95639e9..602747d 100644 --- a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/vo/CsLedgerVO.java +++ b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/vo/CsLedgerVO.java @@ -51,6 +51,9 @@ public class CsLedgerVO implements Serializable { @ApiModelProperty(name = "lineType",value = "监测点类型 0:治理监测点 1:电能质量监测点") private Integer lineType; + @ApiModelProperty(name = "conType",value = "接线方式 0-星型 1-角型 2-V型") + private Integer conType; + @ApiModelProperty(name = "children",value = "子节点") private List children = new ArrayList<>(); diff --git a/cs-device/cs-device-boot/pom.xml b/cs-device/cs-device-boot/pom.xml index c15fd07..d1d9027 100644 --- a/cs-device/cs-device-boot/pom.xml +++ b/cs-device/cs-device-boot/pom.xml @@ -76,8 +76,7 @@ com.njcn user-api - 1.0.0 - compile + ${project.version} com.baomidou @@ -92,8 +91,7 @@ com.njcn cs-warn-api - 1.0.0 - compile + ${project.version} @@ -107,9 +105,6 @@ com.njcn 1.0.0 - - - org.apache.poi poi @@ -139,8 +134,7 @@ com.njcn cs-harmonic-api - 1.0.0 - compile + ${project.version} com.njcn @@ -151,20 +145,14 @@ com.njcn cs-system-api - 1.0.0 - compile + ${project.version} com.njcn access-api - 1.0.0 - compile + ${project.version} - - - - diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsLedgerServiceImpl.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsLedgerServiceImpl.java index f373fb9..21257df 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsLedgerServiceImpl.java +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsLedgerServiceImpl.java @@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.IdUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.njcn.csdevice.constant.DataParam; @@ -99,6 +100,10 @@ public class CsLedgerServiceImpl extends ServiceImpl i } else { item.setLineType(1); } + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(CsLinePO::getLineId,item.getId()).eq(CsLinePO::getStatus,1); + CsLinePO po = csLinePOService.getOne(queryWrapper); + item.setConType(po.getConType()); } ) .collect(Collectors.toList()); diff --git a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/impl/DataServiceImpl.java b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/impl/DataServiceImpl.java index 0e12152..032b182 100644 --- a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/impl/DataServiceImpl.java +++ b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/impl/DataServiceImpl.java @@ -108,9 +108,7 @@ public class DataServiceImpl implements IDataService { vo.setId(item2.getId()); vo.setName(item2.getName()); StatisticalDataDTO statisticalDataDTO = commonService.getLineRtData(lineId,influxDbParamUtil.getTableNameByClassId(item2.getClassId()),item2.getName(),item2.getPhase(),"avg",influxDbParamUtil.getClDidByLineId(lineId)); - if (Objects.isNull(statisticalDataDTO)) { - vo.setAvgValue(3.14159); - } else { + if (Objects.nonNull(statisticalDataDTO)) { vo.setTime(statisticalDataDTO.getTime()); vo.setAvgValue(statisticalDataDTO.getValue()); } @@ -119,28 +117,36 @@ public class DataServiceImpl implements IDataService { vo.setSort(item2.getSort()); if (Objects.equals("Primary",dataLevel)) { if (Objects.equals("Primary",csDataSetLevel)) { - vo.setAvgValue(Double.valueOf(df.format(statisticalDataDTO.getValue()))); + vo.setAvgValue(Objects.isNull(statisticalDataDTO) ? 3.14159 : Double.parseDouble(df.format(statisticalDataDTO.getValue()))); unit = item2.getUnit(); } else { if (HarmonicConstant.POWER_LIST.contains(item2.getShowName())) { - re = DataChangeUtil.secondaryToPrimary(item2.getPrimaryFormula(), statisticalDataDTO.getValue(), pt, ct) / 1000; - vo.setAvgValue(Double.valueOf(df.format(re))); + if (Objects.isNull(statisticalDataDTO)) { + vo.setAvgValue(3.14159); + } else { + re = DataChangeUtil.secondaryToPrimary(item2.getPrimaryFormula(), statisticalDataDTO.getValue(), pt, ct) / 1000; + vo.setAvgValue(Double.valueOf(df.format(re))); + } unit = "k" + item2.getUnit(); } else { - vo.setAvgValue(Double.valueOf(df.format(statisticalDataDTO.getValue()))); + vo.setAvgValue(Objects.isNull(statisticalDataDTO) ? 3.14159 : Double.parseDouble(df.format(statisticalDataDTO.getValue()))); unit = item2.getUnit(); } } } else { if (Objects.equals("Primary",csDataSetLevel)) { if (HarmonicConstant.POWER_LIST.contains(item2.getShowName())) { - re = DataChangeUtil.primaryToSecondary(item2.getPrimaryFormula(), statisticalDataDTO.getValue(), pt, ct); - vo.setAvgValue(Double.valueOf(df.format(re))); + if (Objects.isNull(statisticalDataDTO)) { + vo.setAvgValue(3.14159); + } else { + re = DataChangeUtil.primaryToSecondary(item2.getPrimaryFormula(), statisticalDataDTO.getValue(), pt, ct); + vo.setAvgValue(Double.valueOf(df.format(re))); + } } else { - vo.setAvgValue(Double.valueOf(df.format(statisticalDataDTO.getValue()))); + vo.setAvgValue(Objects.isNull(statisticalDataDTO) ? 3.14159 : Double.parseDouble(df.format(statisticalDataDTO.getValue()))); } } else { - vo.setAvgValue(Double.valueOf(df.format(statisticalDataDTO.getValue()))); + vo.setAvgValue(Objects.isNull(statisticalDataDTO) ? 3.14159 : Double.parseDouble(df.format(statisticalDataDTO.getValue()))); } unit = item2.getUnit(); } @@ -159,8 +165,12 @@ public class DataServiceImpl implements IDataService { vo.setId(item2.getId()); vo.setName(item2.getName().concat("_").concat(Integer.toString(i))); StatisticalDataDTO statisticalDataDTO = commonService.getLineRtData(lineId,influxDbParamUtil.getTableNameByClassId(item2.getClassId()),item2.getName().concat("_").concat(Integer.toString(i)),item2.getPhase(),"avg",influxDbParamUtil.getClDidByLineId(lineId)); - vo.setTime(statisticalDataDTO.getTime()); - vo.setAvgValue(Double.valueOf(df.format(statisticalDataDTO.getValue()))); + if (Objects.isNull(statisticalDataDTO)) { + vo.setAvgValue(3.14159); + } else { + vo.setTime(statisticalDataDTO.getTime()); + vo.setAvgValue(Double.valueOf(df.format(statisticalDataDTO.getValue()))); + } vo.setPhase(item2.getPhase()); vo.setOtherName(i + "次" + "(" + item2.getUnit() + ")"); vo.setSort(item2.getSort()); @@ -178,8 +188,12 @@ public class DataServiceImpl implements IDataService { vo.setId(item2.getId()); vo.setName(item2.getName().concat("_").concat(Integer.toString(i))); StatisticalDataDTO statisticalDataDTO = commonService.getLineRtData(lineId,influxDbParamUtil.getTableNameByClassId(item2.getClassId()),item2.getName().concat("_").concat(Integer.toString(i)),item2.getPhase(),"avg",influxDbParamUtil.getClDidByLineId(lineId)); - vo.setTime(statisticalDataDTO.getTime()); - vo.setAvgValue(Double.valueOf(df.format(statisticalDataDTO.getValue()))); + if (Objects.isNull(statisticalDataDTO)) { + vo.setAvgValue(3.14159); + } else { + vo.setTime(statisticalDataDTO.getTime()); + vo.setAvgValue(Double.valueOf(df.format(statisticalDataDTO.getValue()))); + } vo.setPhase(item2.getPhase()); vo.setOtherName((i-0.5) + "次" + "(" + item2.getUnit() + ")"); vo.setSort(item2.getSort());