|
@@ -99,22 +99,21 @@ public class AppReportMonitorServiceImpl implements AppReportMonitorService {
|
|
LoginUser loginUser = UserUtil.getCurrentUser();
|
|
LoginUser loginUser = UserUtil.getCurrentUser();
|
|
String tenantId = loginUser.getTenantId();
|
|
String tenantId = loginUser.getTenantId();
|
|
|
|
|
|
- List<WaterSupplyData> waterSupplyDatas = homePageReportMapper.getWaterSupplyData(sceneId,"水源",tenantId,loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
|
|
|
|
|
|
+ List<WaterSupplyData> waterSupplyDatas = homePageReportMapper.getWaterSupplyData(sceneId, "水源", tenantId, loginUser.getType(), loginUser.getPermissonType(), loginUser.getProgramItemList());
|
|
|
|
|
|
LocalDate localDate = LocalDate.now();
|
|
LocalDate localDate = LocalDate.now();
|
|
//当天数据
|
|
//当天数据
|
|
- BigDecimal waterDataCountDay = monitorDataReportService.getAmountCount(null,sceneId, "水源", 4,1 );
|
|
|
|
- BigDecimal powerDataCountDay = monitorDataReportService.getAmountCount(null,sceneId, "水源", 5,1 );
|
|
|
|
|
|
+ BigDecimal waterDataCountDay = monitorDataReportService.getAmountCount(null, sceneId, "水源", 4, 1);
|
|
|
|
+ BigDecimal powerDataCountDay = monitorDataReportService.getAmountCount(null, sceneId, "水源", 5, 1);
|
|
// BigDecimal drugDataCountDay = monitorDataReportService.getAmountCount(null,sceneId, sceneType, 6,1 );
|
|
// BigDecimal drugDataCountDay = monitorDataReportService.getAmountCount(null,sceneId, sceneType, 6,1 );
|
|
WaterSupplyChart waterSupplyChartToday = new WaterSupplyChart();
|
|
WaterSupplyChart waterSupplyChartToday = new WaterSupplyChart();
|
|
waterSupplyChartToday.setSort(localDate.getDayOfMonth());
|
|
waterSupplyChartToday.setSort(localDate.getDayOfMonth());
|
|
waterSupplyChartToday.setDate(DateTimeFormatter.ofPattern("yyyy-MM-dd").format(localDate));
|
|
waterSupplyChartToday.setDate(DateTimeFormatter.ofPattern("yyyy-MM-dd").format(localDate));
|
|
- waterSupplyChartToday.setWaterData(waterDataCountDay.divide(new BigDecimal("10000"),3,BigDecimal.ROUND_HALF_UP));
|
|
|
|
- waterSupplyChartToday.setPowerData(powerDataCountDay.divide(new BigDecimal("10000"),3,BigDecimal.ROUND_HALF_UP));
|
|
|
|
|
|
+ waterSupplyChartToday.setWaterData(waterDataCountDay.divide(new BigDecimal("10000"), 3, BigDecimal.ROUND_HALF_UP));
|
|
|
|
+ waterSupplyChartToday.setPowerData(powerDataCountDay.divide(new BigDecimal("10000"), 3, BigDecimal.ROUND_HALF_UP));
|
|
// waterSupplyChartToday.setDrugData(drugDataCountDay);
|
|
// waterSupplyChartToday.setDrugData(drugDataCountDay);
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
List<WaterSupplyChart> waterSupplyCharts = new ArrayList<>();
|
|
List<WaterSupplyChart> waterSupplyCharts = new ArrayList<>();
|
|
waterSupplyDatas.stream()
|
|
waterSupplyDatas.stream()
|
|
.collect(Collectors.groupingBy(item -> item.getYear() + "-" + item.getMonth() + "-" + item.getDay()))
|
|
.collect(Collectors.groupingBy(item -> item.getYear() + "-" + item.getMonth() + "-" + item.getDay()))
|
|
@@ -124,10 +123,10 @@ public class AppReportMonitorServiceImpl implements AppReportMonitorService {
|
|
value.stream().forEach(waterSupplyData -> {
|
|
value.stream().forEach(waterSupplyData -> {
|
|
waterSupplyChart.setSort(waterSupplyData.getDay());
|
|
waterSupplyChart.setSort(waterSupplyData.getDay());
|
|
|
|
|
|
- if (waterSupplyData.getParmType() == 3&&waterSupplyData.getAmount()!=null) { //供水
|
|
|
|
- waterSupplyChart.setWaterData(waterSupplyData.getAmount().divide(new BigDecimal("10000"),3,BigDecimal.ROUND_HALF_UP));
|
|
|
|
- } else if (waterSupplyData.getParmType() == 5&&waterSupplyData.getAmount()!=null) {//电耗
|
|
|
|
- waterSupplyChart.setPowerData(waterSupplyData.getAmount().divide(new BigDecimal("10000"),3,BigDecimal.ROUND_HALF_UP));
|
|
|
|
|
|
+ if (waterSupplyData.getParmType() == 4 && waterSupplyData.getAmount() != null) { //供水
|
|
|
|
+ waterSupplyChart.setWaterData(waterSupplyData.getAmount().divide(new BigDecimal("10000"), 3, BigDecimal.ROUND_HALF_UP));
|
|
|
|
+ } else if (waterSupplyData.getParmType() == 5 && waterSupplyData.getAmount() != null) {//电耗
|
|
|
|
+ waterSupplyChart.setPowerData(waterSupplyData.getAmount().divide(new BigDecimal("10000"), 3, BigDecimal.ROUND_HALF_UP));
|
|
}
|
|
}
|
|
// else if (waterSupplyData.getParmType() == 6) {//药耗
|
|
// else if (waterSupplyData.getParmType() == 6) {//药耗
|
|
// waterSupplyChart.setDrugData(waterSupplyData.getAmount());
|
|
// waterSupplyChart.setDrugData(waterSupplyData.getAmount());
|
|
@@ -138,12 +137,12 @@ public class AppReportMonitorServiceImpl implements AppReportMonitorService {
|
|
|
|
|
|
waterSupplyCharts.sort(Comparator.comparing(WaterSupplyChart::getSort));
|
|
waterSupplyCharts.sort(Comparator.comparing(WaterSupplyChart::getSort));
|
|
|
|
|
|
- Integer maxDay = LocalDate.now().with(TemporalAdjusters.lastDayOfMonth()).getDayOfMonth();
|
|
|
|
- for(int i=0;i<maxDay;i++){
|
|
|
|
- if(i+1 == localDate.getDayOfMonth()){
|
|
|
|
- waterSupplyCharts.add(i,waterSupplyChartToday);
|
|
|
|
- }else if(i == waterSupplyCharts.size() || !waterSupplyCharts.get(i).getSort().equals(i+1)){
|
|
|
|
- waterSupplyCharts.add(i,new WaterSupplyChart(i+1, localDate.getYear()+"-"+localDate.getMonthValue()+"-"+(i+1)));
|
|
|
|
|
|
+ Integer maxDay = LocalDate.now().with(TemporalAdjusters.lastDayOfMonth()).getDayOfMonth();
|
|
|
|
+ for (int i = 0; i < maxDay; i++) {
|
|
|
|
+ if (i + 1 == localDate.getDayOfMonth()) {
|
|
|
|
+ waterSupplyCharts.add(i, waterSupplyChartToday);
|
|
|
|
+ } else if (i == waterSupplyCharts.size() || !waterSupplyCharts.get(i).getSort().equals(i + 1)) {
|
|
|
|
+ waterSupplyCharts.add(i, new WaterSupplyChart(i + 1, localDate.getYear() + "-" + localDate.getMonthValue() + "-" + (i + 1)));
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|