diff --git a/pom.xml b/pom.xml index 31ef9d76..235ecb1e 100644 --- a/pom.xml +++ b/pom.xml @@ -67,7 +67,7 @@ javax.servlet javax.servlet-api - 3.1.0 + 4.0.1 provided diff --git a/src/main/java/com/zcloud/controller/dw/DwController.java b/src/main/java/com/zcloud/controller/dw/DwController.java index a8428c27..b520591d 100644 --- a/src/main/java/com/zcloud/controller/dw/DwController.java +++ b/src/main/java/com/zcloud/controller/dw/DwController.java @@ -3,15 +3,16 @@ package com.zcloud.controller.dw; import com.alibaba.fastjson.JSONObject; import com.zcloud.controller.base.BaseController; import com.zcloud.entity.PageData; +import com.zcloud.entity.Page; import com.zcloud.service.dw.DwService; import com.zcloud.service.dw.dto.*; -import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; -@Controller -@RequestMapping(value = "/dw") +@RestController +@RequestMapping(value = "/dingWei") public class DwController extends BaseController { @Resource @@ -28,9 +29,11 @@ public class DwController extends BaseController { public Object getMapList(Page page) throws Exception { PageData pd = this.getPageData(); MapGet mapGet = JSONObject.parseObject(JSONObject.toJSONString(pd), MapGet.class); - mapGet.getPage().setPage(page.getPage()); - mapGet.getPage().setCurrent(page.getCurrent()); - mapGet.getPage().setSize(page.getSize()); + if (mapGet.getPage() == null){ + mapGet.setPage(new com.zcloud.service.dw.dto.Page()); + } + mapGet.getPage().setCurrent(String.valueOf(page.getCurrentPage())); + mapGet.getPage().setSize(String.valueOf(page.getShowCount())); return dwService.getMapList(mapGet); } @@ -45,9 +48,11 @@ public class DwController extends BaseController { public Object getAlarmList(Page page) throws Exception { PageData pd = this.getPageData(); AlarmGet mapGet = JSONObject.parseObject(JSONObject.toJSONString(pd), AlarmGet.class); - mapGet.getPage().setPage(page.getPage()); - mapGet.getPage().setCurrent(page.getCurrent()); - mapGet.getPage().setSize(page.getSize()); + if (mapGet.getPage() == null){ + mapGet.setPage(new com.zcloud.service.dw.dto.Page()); + } + mapGet.getPage().setCurrent(String.valueOf(page.getCurrentPage())); + mapGet.getPage().setSize(String.valueOf(page.getShowCount())); return dwService.getAlarmList(mapGet); } @@ -62,4 +67,5 @@ public class DwController extends BaseController { public Object getDictionary() throws Exception { return dwService.getDictionary(); } + } diff --git a/src/main/java/com/zcloud/util/HttpUtil.java b/src/main/java/com/zcloud/util/HttpUtil.java index 96527907..2cac2b63 100644 --- a/src/main/java/com/zcloud/util/HttpUtil.java +++ b/src/main/java/com/zcloud/util/HttpUtil.java @@ -41,4 +41,10 @@ public class HttpUtil { String result = restTemplate.postForEntity(url, info, String.class).getBody(); return JSONObject.parseObject(result, Map.class); } + + public static Object post(String url) { + RestTemplate restTemplate = new RestTemplate(); + String result = restTemplate.getForObject(url, String.class); + return JSONObject.parseObject(result, Map.class); + } }