瀏覽代碼

日期类型

zhaomiao 4 年之前
父節點
當前提交
f21f337a12
共有 1 個文件被更改,包括 62 次插入20 次删除
  1. 62 20
      src/main/java/com/gyee/frame/controller/powercompare/PowerCompareController.java

+ 62 - 20
src/main/java/com/gyee/frame/controller/powercompare/PowerCompareController.java

@@ -6,8 +6,10 @@ import com.gyee.frame.model.auto.Windpowerinfoday3;
 import com.gyee.frame.model.auto.Windturbineinfoday3;
 import com.gyee.frame.service.Windpowerinfoday3Service;
 import com.gyee.frame.service.Windturbineinfoday3Service;
+import com.gyee.frame.util.DateUtils;
 import com.gyee.frame.util.StringUtils;
 import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.CrossOrigin;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
@@ -30,11 +32,21 @@ public class PowerCompareController {
     /**查询风机图表数据结果**/
     @GetMapping("/queryPower")
     @ResponseBody
-    public AjaxResult queryPower(String wpIds, String pjIds, String lineIds, Date beginDate,
-                             Date endDate)  {
-
+    @CrossOrigin
+    public AjaxResult queryPower(String wpIds, String pjIds, String lineIds, String beginDate,
+                             String endDate)  {
+        Date beginDate_d=null;
+        Date endDate_d=null;
+        if (StringUtils.isNotEmpty(beginDate))
+        {
+            beginDate_d= DateUtils.parseDate(beginDate);
+        }
+        if (StringUtils.isNotEmpty(endDate))
+        {
+            endDate_d= DateUtils.parseDate(endDate);
+        }
         Map<String, List<String>> resultmap = new HashMap<String, List<String>>();
-        resultmap = windturbineinfoday3Service.getWindturbineinfoJson(wpIds, pjIds, lineIds, beginDate, endDate);
+        resultmap = windturbineinfoday3Service.getWindturbineinfoJson(wpIds, pjIds, lineIds, beginDate_d, endDate_d);
         if(resultmap !=null && !resultmap.isEmpty())
         {
             return	AjaxResult.successData(AjaxStatus.success.code,resultmap);
@@ -47,17 +59,27 @@ public class PowerCompareController {
     /**查询风场、项目、线路图表数据结果**/
     @GetMapping("/queryPowerAll")
     @ResponseBody
-    public AjaxResult queryPowerAll(String wpIds,  Date beginDate,
-                                 Date endDate,String  queryType)  {
-
+    @CrossOrigin
+    public AjaxResult queryPowerAll(String wpIds,  String beginDate,
+                                 String endDate,String  queryType)  {
+        Date beginDate_d=null;
+        Date endDate_d=null;
+        if (StringUtils.isNotEmpty(beginDate))
+        {
+            beginDate_d= DateUtils.parseDate(beginDate);
+        }
+        if (StringUtils.isNotEmpty(endDate))
+        {
+            endDate_d= DateUtils.parseDate(endDate);
+        }
         Map<String, List<String>> resultmap = new HashMap<String, List<String>>();
         if (StringUtils.notEmp(queryType)) {
             if (queryType.equals("fc")) {
-                resultmap = windpowerinfoday3Service.getWindturbineinfoAllJson(wpIds, beginDate, endDate, 0);
+                resultmap = windpowerinfoday3Service.getWindturbineinfoAllJson(wpIds, beginDate_d, endDate_d, 0);
             } else if (queryType.equals("pj")) {
-                resultmap = windpowerinfoday3Service.getWindturbineinfoAllJson(wpIds, beginDate, endDate, 1);
+                resultmap = windpowerinfoday3Service.getWindturbineinfoAllJson(wpIds, beginDate_d, endDate_d, 1);
             } else if (queryType.equals("xl")) {
-                resultmap = windpowerinfoday3Service.getWindturbineinfoAllJson(wpIds, beginDate, endDate, 2);
+                resultmap = windpowerinfoday3Service.getWindturbineinfoAllJson(wpIds, beginDate_d, endDate_d, 2);
             }
         }
         if(resultmap !=null && !resultmap.isEmpty())
@@ -72,10 +94,20 @@ public class PowerCompareController {
     /**查询风机列表数据结果**/
     @GetMapping("/powerAjax")
     @ResponseBody
-    public AjaxResult powerAjax(String wpIds, String pjIds, String lineIds, Date beginDate,
-                                Date endDate, String sortName, String sortOrder)  {
-
-        List<Windturbineinfoday3> vos = windturbineinfoday3Service.getWindturbineinfo(wpIds, pjIds, lineIds, beginDate, endDate, sortName,
+    @CrossOrigin
+    public AjaxResult powerAjax(String wpIds, String pjIds, String lineIds, String beginDate,
+                                String endDate, String sortName, String sortOrder)  {
+        Date beginDate_d=null;
+        Date endDate_d=null;
+        if (StringUtils.isNotEmpty(beginDate))
+        {
+            beginDate_d= DateUtils.parseDate(beginDate);
+        }
+        if (StringUtils.isNotEmpty(endDate))
+        {
+            endDate_d= DateUtils.parseDate(endDate);
+        }
+        List<Windturbineinfoday3> vos = windturbineinfoday3Service.getWindturbineinfo(wpIds, pjIds, lineIds, beginDate_d, endDate_d, sortName,
                 sortOrder);
         if(vos !=null && !vos.isEmpty())
         {
@@ -89,19 +121,29 @@ public class PowerCompareController {
     /**查询风场、项目、线路列表数据结果**/
     @GetMapping("/powerAjaxAll")
     @ResponseBody
-    public AjaxResult powerAjaxAll(String wpIds,  Date beginDate,
-                                    Date endDate,String  queryType, String sortName, String sortOrder)  {
-
+    @CrossOrigin
+    public AjaxResult powerAjaxAll(String wpIds,  String beginDate,
+                                    String endDate,String  queryType, String sortName, String sortOrder)  {
+        Date beginDate_d=null;
+        Date endDate_d=null;
+        if (StringUtils.isNotEmpty(beginDate))
+        {
+            beginDate_d= DateUtils.parseDate(beginDate);
+        }
+        if (StringUtils.isNotEmpty(endDate))
+        {
+            endDate_d= DateUtils.parseDate(endDate);
+        }
         List<Windpowerinfoday3>  vos=null;
 
         if (queryType.equals("fc")) {
-            vos = windpowerinfoday3Service.getWindturbineinfoAll(wpIds, beginDate, endDate, 0, sortName,
+            vos = windpowerinfoday3Service.getWindturbineinfoAll(wpIds, beginDate_d, endDate_d, 0, sortName,
                     sortOrder);
         } else if (queryType.equals("pj")) {
-            vos = windpowerinfoday3Service.getWindturbineinfoAll(wpIds, beginDate, endDate, 1, sortName,
+            vos = windpowerinfoday3Service.getWindturbineinfoAll(wpIds, beginDate_d, endDate_d, 1, sortName,
                     sortOrder);
         } else if (queryType.equals("xl")) {
-            vos = windpowerinfoday3Service.getWindturbineinfoAll(wpIds, beginDate, endDate, 2, sortName,
+            vos = windpowerinfoday3Service.getWindturbineinfoAll(wpIds, beginDate_d, endDate_d, 2, sortName,
                     sortOrder);
         }
         if(vos !=null && !vos.isEmpty())