Parcourir la source

图表报表时间格式修改

wangli il y a 4 ans
Parent
commit
c60a200052

+ 12 - 2
sms_water/src/main/java/com/huaxu/controller/MonitorDataReportController.java

@@ -27,8 +27,6 @@ import java.util.List;
 @RequestMapping("/MonitorDataReport")
 @Api(tags = "统计分析")
 public class MonitorDataReportController {
-    @Autowired
-    private MonitorDataService monitorDataService;
 
     @Autowired
     private MonitorDataReportService monitorDataReportService;
@@ -41,6 +39,12 @@ public class MonitorDataReportController {
             @ApiParam(value = "类型,1年2月3日", required = true) @RequestParam Integer reportType
     ){
         LocalDate localDate =LocalDate.now();
+        if(reportType !=null && reportType ==1){
+            reportDate = reportDate+"-01-01";
+        }else
+        if(reportType !=null && reportType ==2){
+            reportDate = reportDate+"-01";
+        }
         if(null != reportDate){
             localDate = LocalDate.parse(reportDate,DateTimeFormatter.ofPattern("yyyy-MM-dd"));
         }
@@ -66,6 +70,12 @@ public class MonitorDataReportController {
             @ApiParam(value = "类型,1年2月3日", required = true) @RequestParam Integer reportType
     ){
         LocalDate localDate =LocalDate.now();
+        if(reportType !=null && reportType ==1){
+            reportDate = reportDate+"-01-01";
+        }else
+        if(reportType !=null && reportType ==2){
+            reportDate = reportDate+"-01";
+        }
         if(null != reportDate){
             localDate = LocalDate.parse(reportDate,DateTimeFormatter.ofPattern("yyyy-MM-dd"));
         }