wangyangyang 4 éve
szülő
commit
0c0195b871

+ 15 - 16
sms_water/src/main/java/com/huaxu/service/impl/AppReportMonitorServiceImpl.java

@@ -99,22 +99,21 @@ public class AppReportMonitorServiceImpl  implements AppReportMonitorService {
         LoginUser loginUser = UserUtil.getCurrentUser();
         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();
         //当天数据
-        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 );
         WaterSupplyChart waterSupplyChartToday = new WaterSupplyChart();
         waterSupplyChartToday.setSort(localDate.getDayOfMonth());
         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);
 
 
-
         List<WaterSupplyChart> waterSupplyCharts = new ArrayList<>();
         waterSupplyDatas.stream()
                 .collect(Collectors.groupingBy(item -> item.getYear() + "-" + item.getMonth() + "-" + item.getDay()))
@@ -124,10 +123,10 @@ public class AppReportMonitorServiceImpl  implements AppReportMonitorService {
                     value.stream().forEach(waterSupplyData -> {
                         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) {//药耗
 //                            waterSupplyChart.setDrugData(waterSupplyData.getAmount());
@@ -138,12 +137,12 @@ public class AppReportMonitorServiceImpl  implements AppReportMonitorService {
 
         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)));
             }
 
         }

+ 1 - 1
sms_water/src/main/resources/mapper/HomePageReportMapper.xml

@@ -397,7 +397,7 @@
         left join sms_month_report r on r.DEVICE_ID =dp.DEVICE_ID and r.ATTRIBUTE_ID = dp.ATTRIBUTE_ID
         where  dp.`STATUS`=1  and st.`STATUS`=1 and s.`STATUS`=1 and s.ENABLE_STATE = 1
         and r.COLLECT_DATE >= date_add(curdate(), interval - day(curdate()) + 1 day)
-        and dp.PARM_TYPE in (3,5,6,12)
+        and dp.PARM_TYPE in (3,4,5,6,12)
         and s.id= #{sceneId}
         and st.SCENE_TYPE_NAME = #{sceneType}
         and dp.TENANT_ID=#{tenantId}