diff --git a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/HarmonicServiceImpl.java b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/HarmonicServiceImpl.java index 454982578..e1136600b 100644 --- a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/HarmonicServiceImpl.java +++ b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/HarmonicServiceImpl.java @@ -115,8 +115,8 @@ public class HarmonicServiceImpl implements IHarmonicService { pollutionVO.setChildren(childrenList.stream().sorted(Comparator.comparing(PollutionVO::getData).reversed().thenComparing(PollutionVO::getName)).collect(Collectors.toList())); } if (!CollectionUtils.isEmpty(dept.getLineIndexes())){ -// pollutionVO.setData(handleData(getLimitTarget(lineList, harmonicPublicParam.getSearchBeginTime(),harmonicPublicParam.getSearchEndTime()),harmonicPublicParam.getStatisticalType().getCode(),lineList, harmonicPublicParam.getSearchBeginTime(),harmonicPublicParam.getSearchEndTime()).getRatio()); - pollutionVO.setData(NumberUtil.round(childrenList.stream().mapToDouble(PollutionVO::getData).average().orElse(3.14159),2).doubleValue()); + double tem = childrenList.stream().mapToDouble(PollutionVO::getData).average().orElse(3.14159); + pollutionVO.setData(tem == 3.14159||tem<0?3.14159:NumberUtil.round(tem,2).doubleValue()); } list.add(pollutionVO); } @@ -436,12 +436,12 @@ public class HarmonicServiceImpl implements IHarmonicService { } //平均超标天数 if (CollectionUtils.isEmpty(list)){ - avgOverDay = -1.0; + avgOverDay = 0; } else { avgOverDay = overLineCount == 0?0.0:BigDecimal.valueOf(overCountByDay*1.0/overLineCount).setScale(2, RoundingMode.HALF_UP).doubleValue(); } //月监测点超标占比 - ratio = map.size() == 0?-1.0:BigDecimal.valueOf(ratio*100/map.size()).setScale(2, RoundingMode.HALF_UP).doubleValue(); + ratio = map.size() == 0?0:BigDecimal.valueOf(ratio*100/map.size()).setScale(2, RoundingMode.HALF_UP).doubleValue(); areaDTO.setOnlineCount(onlineCount); areaDTO.setOverLineCount(overLineCount); //平均超标天数 diff --git a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/HistoryResultServiceImpl.java b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/HistoryResultServiceImpl.java index 9ff7ac20a..bfd447fac 100644 --- a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/HistoryResultServiceImpl.java +++ b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/HistoryResultServiceImpl.java @@ -9,8 +9,10 @@ import com.njcn.common.pojo.constant.BizParamConstant; import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.pojo.param.StatisticsBizBaseParam; import com.njcn.common.utils.PubUtils; +import com.njcn.device.pq.api.DeviceUnitClient; import com.njcn.device.pq.api.LineFeignClient; import com.njcn.device.biz.pojo.po.Overlimit; +import com.njcn.device.pq.pojo.po.PqsDeviceUnit; import com.njcn.device.pq.pojo.vo.LineDetailDataVO; import com.njcn.event.api.EventDetailFeignClient; import com.njcn.event.pojo.po.EventDetail; @@ -83,13 +85,14 @@ public class HistoryResultServiceImpl implements HistoryResultService { private final DataHarmRateVMapper dataHarmRateVMapper; + private final DeviceUnitClient deviceUnitClient; + @Override public List getHistoryResult(HistoryParam historyParam) { List historyDataResultVOList = new ArrayList<>(); //获取监测点 String[] points = historyParam.getLineId(); - SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); Integer number = 0; for (int i = 0; i < points.length; i++) { HistoryDataResultVO historyDataResultVO; @@ -237,6 +240,8 @@ public class HistoryResultServiceImpl implements HistoryResultService { } private QueryResultLimitVO getQueryResult(String startTime, String endTime, String lineList, String contion, Integer number, Integer valueType, Integer ptType) { + PqsDeviceUnit pqsDeviceUnit = deviceUnitClient.lineUnitDetail(lineList).getData(); + QueryResultLimitVO queryResultLimitVO = new QueryResultLimitVO(); if (!lineList.isEmpty()) { Float topLimit = 0f; @@ -282,7 +287,7 @@ public class HistoryResultServiceImpl implements HistoryResultService { phasicType.add("A相"); phasicType.add("B相"); phasicType.add("C相"); - unit.add("kV"); + unit.add(pqsDeviceUnit.getPhaseVoltage()); targetName = "相电压有效值"; break; case 11: @@ -292,7 +297,7 @@ public class HistoryResultServiceImpl implements HistoryResultService { phasicType.add("AB相"); phasicType.add("BC相"); phasicType.add("CA相"); - unit.add("kV"); + unit.add(pqsDeviceUnit.getLineVoltage()); targetName = "线电压有效值"; break; case 12: @@ -329,9 +334,9 @@ public class HistoryResultServiceImpl implements HistoryResultService { phasicType.add("零序电压"); phasicType.add("正序电压"); phasicType.add("负序电压"); - unit.add("V"); - unit.add("kV"); - unit.add("V"); + unit.add(pqsDeviceUnit.getNoPositiveV()); + unit.add(pqsDeviceUnit.getPositiveV()); + unit.add(pqsDeviceUnit.getNoPositiveV()); targetName = "电压不平衡"; break; case 15: @@ -448,7 +453,7 @@ public class HistoryResultServiceImpl implements HistoryResultService { phasicType.add("CA相"); } if (number == 1) { - unit.add("kV"); + unit.add(pqsDeviceUnit.getVfundEffective()); } else { unit.add("V"); } @@ -549,7 +554,7 @@ public class HistoryResultServiceImpl implements HistoryResultService { phasicType.add("BC相"); phasicType.add("CA相"); } - unit.add("kV"); + unit.add(pqsDeviceUnit.getPhaseVoltage()); break; case 49: //间谐波电流幅值 @@ -569,7 +574,7 @@ public class HistoryResultServiceImpl implements HistoryResultService { phasicType.add("B相"); phasicType.add("C相"); if (number == 1) { - unit.add("kW"); + unit.add(pqsDeviceUnit.getFundActiveP()); } else { unit.add("W"); } @@ -583,7 +588,7 @@ public class HistoryResultServiceImpl implements HistoryResultService { phasicType.add("B相"); phasicType.add("C相"); if (number == 1) { - unit.add("kVar"); + unit.add(pqsDeviceUnit.getTotalNoP()); } else { unit.add("Var"); } @@ -597,7 +602,7 @@ public class HistoryResultServiceImpl implements HistoryResultService { phasicType.add("B相"); phasicType.add("C相"); if (number == 1) { - unit.add("kVA"); + unit.add(pqsDeviceUnit.getTotalViewP()); } else { unit.add("VA"); } @@ -610,7 +615,7 @@ public class HistoryResultServiceImpl implements HistoryResultService { phasicType.add("A相"); phasicType.add("B相"); phasicType.add("C相"); - unit.add("kW"); + unit.add(pqsDeviceUnit.getTotalActiveP()); targetName = "三相有功功率"; break; case 54: @@ -620,7 +625,7 @@ public class HistoryResultServiceImpl implements HistoryResultService { phasicType.add("A相"); phasicType.add("B相"); phasicType.add("C相"); - unit.add("kVar"); + unit.add(pqsDeviceUnit.getTotalNoP()); targetName = "三相无功功率"; break; case 55: @@ -630,7 +635,7 @@ public class HistoryResultServiceImpl implements HistoryResultService { phasicType.add("A相"); phasicType.add("B相"); phasicType.add("C相"); - unit.add("kVA"); + unit.add(pqsDeviceUnit.getTotalViewP()); targetName = "三相视在功率"; break; case 56: @@ -638,7 +643,7 @@ public class HistoryResultServiceImpl implements HistoryResultService { sql = "SELECT time as time, p as aValue ," + InfluxDBTableConstant.PHASIC_TYPE + " FROM data_harmpower_p WHERE " + stringBuilder + " and phasic_type ='T' order by time asc tz('Asia/Shanghai');"; phasicType.add("三相总有功功率"); - unit.add("kW"); + unit.add(pqsDeviceUnit.getTotalActiveP()); targetName = "三相总有功功率"; break; case 57: @@ -646,7 +651,7 @@ public class HistoryResultServiceImpl implements HistoryResultService { sql = "SELECT time as time, q as aValue ," + InfluxDBTableConstant.PHASIC_TYPE + " FROM data_harmpower_q WHERE " + stringBuilder + " and phasic_type ='T' order by time asc tz('Asia/Shanghai');"; phasicType.add("三相总无功功率"); - unit.add("kVar"); + unit.add(pqsDeviceUnit.getTotalNoP()); targetName = "三相总无功功率"; break; case 58: @@ -654,7 +659,7 @@ public class HistoryResultServiceImpl implements HistoryResultService { sql = "SELECT time as time, s as aValue ," + InfluxDBTableConstant.PHASIC_TYPE + " FROM data_harmpower_s WHERE " + stringBuilder + " and phasic_type ='T' order by time asc tz('Asia/Shanghai');"; phasicType.add("三相总视在功率"); - unit.add("kVA"); + unit.add(pqsDeviceUnit.getTotalViewP()); targetName = "三相总视在功率"; break; case 59: