Browse Source

三位小数

wangyangyang 4 years ago
parent
commit
86505668d0

+ 31 - 0
sms_water/src/main/java/com/huaxu/controller/DayMonthYearReportController.java

@@ -69,6 +69,15 @@ public class DayMonthYearReportController {
         IPage<DevicePressReportAttributeDto> iPage = new Page<>(pageNum, pageSize);
         iPage = reportService.getDevicePressReportByDeviceIds(iPage,ids,year,month,day,reportType,type);
         Pagination<DevicePressReportAttributeDto> pages = new Pagination<>(iPage);
+        for(DevicePressReportAttributeDto item : pages.getList())
+        {
+            item.setAvgValue((double)Math.round(item.getAvgValue()*1000)/1000);
+            item.setMinValue((double)Math.round(item.getMinValue()*1000)/1000);
+            item.setMaxValue((double)Math.round(item.getMaxValue()*1000)/1000);
+            item.setSumValue((double)Math.round(item.getSumValue()*1000)/1000);
+            item.setLatestValue((double)Math.round(item.getLatestValue()*1000)/1000);
+        }
+
         return new AjaxMessage<>(ResultStatus.OK,pages);
     }
 
@@ -87,6 +96,28 @@ public class DayMonthYearReportController {
         IPage<DeviceWaterReportAttributeDto> iPage = new Page<>(pageNum, pageSize);
         iPage = reportService.getDevicWaterReportByDeviceIds(iPage,ids,year,month,day,reportType);
         Pagination<DeviceWaterReportAttributeDto> pages = new Pagination<>(iPage);
+        for(DeviceWaterReportAttributeDto item : pages.getList())
+        {
+            item.setAvgCLValue((double)Math.round(item.getAvgCLValue()*1000)/1000);
+            item.setAvgPHValue((double)Math.round(item.getAvgPHValue()*1000)/1000);
+            item.setAvgQuValue((double)Math.round(item.getAvgQuValue()*1000)/1000);
+
+            item.setMinCLValue((double)Math.round(item.getMinCLValue()*1000)/1000);
+            item.setMinPHValue((double)Math.round(item.getMinPHValue()*1000)/1000);
+            item.setMinQuValue((double)Math.round(item.getMinQuValue()*1000)/1000);
+
+            item.setMaxCLValue((double)Math.round(item.getMaxCLValue()*1000)/1000);
+            item.setMaxPHValue((double)Math.round(item.getMaxPHValue()*1000)/1000);
+            item.setMaxQuValue((double)Math.round(item.getMaxQuValue()*1000)/1000);
+
+            item.setSumCLValue((double)Math.round(item.getSumCLValue()*1000)/1000);
+            item.setSumPHValue((double)Math.round(item.getSumPHValue()*1000)/1000);
+            item.setSumQuValue((double)Math.round(item.getSumQuValue()*1000)/1000);
+
+            item.setLatestCLValue((double)Math.round(item.getLatestCLValue()*1000)/1000);
+            item.setLatestPHValue((double)Math.round(item.getLatestPHValue()*1000)/1000);
+            item.setLatestQuValue((double)Math.round(item.getLatestQuValue()*1000)/1000);
+        }
         return new AjaxMessage<>(ResultStatus.OK,pages);
     }
 }