Browse Source

能耗曲线修改

wangli 4 năm trước cách đây
mục cha
commit
f4b6a3476d

+ 23 - 8
sms_water/src/main/java/com/huaxu/service/impl/HomePageReportServiceImpl.java

@@ -21,6 +21,7 @@ import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
 import java.time.temporal.TemporalAdjusters;
 import java.util.ArrayList;
 import java.util.Comparator;
@@ -226,10 +227,10 @@ public class HomePageReportServiceImpl implements HomePageReportService {
 
         LocalDate localDate = LocalDate.now();
         //当天数据
-        BigDecimal AmountCountDay = MonitorDataReportService.getAmountCount(null,sceneId, sceneType, parmType,1 );
+        BigDecimal amountCount = MonitorDataReportService.getAmountCount(null,sceneId, sceneType, parmType,1 );
         DeviceWaterSupply deviceWaterSupplyToday = new DeviceWaterSupply();
         deviceWaterSupplyToday.setOrderNo(1);
-        deviceWaterSupplyToday.setAmount(AmountCountDay != null?AmountCountDay:BigDecimal.ZERO);
+        deviceWaterSupplyToday.setAmount(amountCount != null?amountCount:BigDecimal.ZERO);
         deviceWaterSupplyToday.setYear(localDate.getYear());
         deviceWaterSupplyToday.setMonth(localDate.getMonthValue());
         deviceWaterSupplyToday.setDay(localDate.getDayOfMonth());
@@ -350,6 +351,21 @@ public class HomePageReportServiceImpl implements HomePageReportService {
         String tenantId = loginUser.getTenantId();
 
         List<WaterSupplyData> waterSupplyDatas = homePageReportMapper.getWaterSupplyData(sceneId,sceneType,tenantId,loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
+
+        LocalDate localDate = LocalDate.now();
+        //当天数据
+        BigDecimal waterDataCountDay = MonitorDataReportService.getAmountCount(null,sceneId, sceneType, 3,1 );
+        BigDecimal powerDataCountDay = MonitorDataReportService.getAmountCount(null,sceneId, sceneType, 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);
+        waterSupplyChartToday.setPowerData(powerDataCountDay);
+        waterSupplyChartToday.setDrugData(drugDataCountDay);
+
+
+
         List<WaterSupplyChart> waterSupplyCharts = new ArrayList<>();
         waterSupplyDatas.stream()
                 .collect(Collectors.groupingBy(item -> item.getYear() + "-" + item.getMonth() + "-" + item.getDay()))
@@ -374,15 +390,14 @@ public class HomePageReportServiceImpl implements HomePageReportService {
 
         Integer maxDay =  LocalDate.now().with(TemporalAdjusters.lastDayOfMonth()).getDayOfMonth();
         for(int i=0;i<maxDay;i++){
-
-            if(i == waterSupplyCharts.size() || !waterSupplyCharts.get(i).getSort().equals(i+1)){
-                waterSupplyCharts.add(i,new WaterSupplyChart(i+1, LocalDate.now().getYear()+"-"+LocalDate.now().getMonthValue()+"-"+(i+1)));
+            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)));
             }
+
         }
 //        waterSupplyCharts.sort(Comparator.comparing(WaterSupplyChart::getSort).reversed());
         return waterSupplyCharts;
     }
-
-
-
 }