|
@@ -970,20 +970,23 @@ public class MonitorDataReportServiceImpl implements MonitorDataReportService {
|
|
|
List<Long> sceneIds = sceneService.findByParentIdsLike(sceneId);
|
|
|
List<WaterSupplyData> waterSupplyDatas = monitorDataReportMapper.getWaterSupplyDataForCurrentMonth(tenantId, sceneTypeName, sceneIds, loginUser.getType(), loginUser.getPermissonType(), loginUser.getProgramItemList());
|
|
|
List<WaterSupplyChart> waterSupplyCharts = new ArrayList<>();
|
|
|
-
|
|
|
-
|
|
|
+ BigDecimal per = BigDecimal.valueOf(1);
|
|
|
+ if (!sceneTypeName.equals("泵站"))
|
|
|
+ per = BigDecimal.valueOf(10000);
|
|
|
+ BigDecimal finalPer = per;
|
|
|
waterSupplyDatas.stream()
|
|
|
.collect(Collectors.groupingBy(item -> item.getYear() + "-" + item.getMonth() + "-" + item.getDay()))
|
|
|
.forEach((key, value) -> {
|
|
|
WaterSupplyChart waterSupplyChart = new WaterSupplyChart();
|
|
|
waterSupplyChart.setDate(key);
|
|
|
value.stream().forEach(waterSupplyData -> {
|
|
|
- Period period = Period.between(LocalDate.of(waterSupplyData.getYear(), waterSupplyData.getMonth(), waterSupplyData.getDay()), LocalDate.now());
|
|
|
- waterSupplyChart.setSort(period.getDays());
|
|
|
+ //Period period = Period.between(LocalDate.of(waterSupplyData.getYear(), waterSupplyData.getMonth(), waterSupplyData.getDay()), LocalDate.now());
|
|
|
+ //waterSupplyChart.setSort(period.getDays());
|
|
|
+ waterSupplyChart.setSort(waterSupplyData.getDay());
|
|
|
if (waterSupplyData.getParmType() == 3 && waterSupplyData.getAmount() != null) { //供水
|
|
|
- waterSupplyChart.setWaterData(waterSupplyData.getAmount().divide(BigDecimal.valueOf(10000), 3, RoundingMode.HALF_UP));
|
|
|
+ waterSupplyChart.setWaterData(waterSupplyData.getAmount().divide(finalPer, 3, RoundingMode.HALF_UP));
|
|
|
} else if (waterSupplyData.getParmType() == 5 && waterSupplyData.getAmount() != null) {//电耗
|
|
|
- waterSupplyChart.setPowerData(waterSupplyData.getAmount().divide(BigDecimal.valueOf(10000), 3, RoundingMode.HALF_UP));
|
|
|
+ waterSupplyChart.setPowerData(waterSupplyData.getAmount().divide(finalPer, 3, RoundingMode.HALF_UP));
|
|
|
} else if (waterSupplyData.getParmType() == 6 && waterSupplyData.getAmount() != null) {//药耗
|
|
|
waterSupplyChart.setDrugData(waterSupplyData.getAmount());
|
|
|
}
|
|
@@ -992,17 +995,32 @@ public class MonitorDataReportServiceImpl implements MonitorDataReportService {
|
|
|
});
|
|
|
|
|
|
waterSupplyCharts.sort(Comparator.comparing(WaterSupplyChart::getSort));
|
|
|
- waterSupplyCharts.sort(Comparator.comparing(WaterSupplyChart::getSort).reversed());
|
|
|
+
|
|
|
//获取当日水量
|
|
|
BigDecimal waterDataAmountCountMonth = getAmountCount(null, sceneId.intValue(), sceneTypeName, 3, 1);
|
|
|
//获取当日电耗
|
|
|
BigDecimal powerDataAmountCountMonth = getAmountCount(null, sceneId.intValue(), sceneTypeName, 5, 1);
|
|
|
+ LocalDate localDate = LocalDate.now();
|
|
|
WaterSupplyChart waterSupplyChart = new WaterSupplyChart();
|
|
|
waterSupplyChart.setDate(LocalDate.now().getYear() + "-" + LocalDate.now().getMonthValue() + "-" + LocalDate.now().getDayOfMonth());
|
|
|
- waterSupplyChart.setWaterData(waterDataAmountCountMonth.divide(BigDecimal.valueOf(10000), 3, RoundingMode.HALF_UP));
|
|
|
- waterSupplyChart.setPowerData(powerDataAmountCountMonth.divide(BigDecimal.valueOf(10000), 3, RoundingMode.HALF_UP));
|
|
|
- waterSupplyChart.setSort(0);
|
|
|
- waterSupplyCharts.add(waterSupplyChart);
|
|
|
+ waterSupplyChart.setWaterData(waterDataAmountCountMonth.divide(finalPer, 3, RoundingMode.HALF_UP));
|
|
|
+ waterSupplyChart.setPowerData(powerDataAmountCountMonth.divide(finalPer, 3, RoundingMode.HALF_UP));
|
|
|
+ waterSupplyChart.setSort(localDate.getDayOfMonth());
|
|
|
+ //waterSupplyChart.setSort(0);
|
|
|
+ //waterSupplyCharts.add(waterSupplyChart);
|
|
|
+
|
|
|
+ Integer maxDay = LocalDate.now().getDayOfMonth();
|
|
|
+ for(int i=0;i<maxDay;i++) {
|
|
|
+ if (i + 1 == localDate.getDayOfMonth()) {
|
|
|
+ waterSupplyCharts.add(i, waterSupplyChart);
|
|
|
+ } else if (i == waterSupplyCharts.size() || !waterSupplyCharts.get(i).getSort().equals(i+1)) {
|
|
|
+ WaterSupplyChart temp= new WaterSupplyChart(i + 1, localDate.getYear() + "-" + localDate.getMonthValue() + "-" + (i + 1));
|
|
|
+ temp.setWaterData(BigDecimal.valueOf(0));
|
|
|
+ temp.setPowerData(BigDecimal.valueOf(0));
|
|
|
+ waterSupplyCharts.add(i, temp);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ waterSupplyCharts.sort(Comparator.comparing(WaterSupplyChart::getSort).reversed());
|
|
|
return waterSupplyCharts;
|
|
|
}
|
|
|
|