From 9b40b93f37b90527358c4024108925eb0dc00c3c Mon Sep 17 00:00:00 2001 From: dearlin <1261008090@qq.com> Date: Thu, 22 Feb 2024 16:04:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=91=8A=E8=AD=A6=E7=AE=A1=E7=90=86=EF=BC=8C?= =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E8=AE=BE=E7=BD=AE=EF=BC=8C=E8=81=9A=E9=9B=86?= =?UTF-8?q?=E7=AE=A1=E7=90=86Api=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../positioning/MapSettingController.java | 83 ++++- .../positioning/PositAlarmController.java | 338 +++++++++++++++++- .../positioning/UserCardController.java | 2 +- src/main/java/com/zcloud/util/PLSUtil.java | 54 ++- 4 files changed, 448 insertions(+), 29 deletions(-) diff --git a/src/main/java/com/zcloud/controller/positioning/MapSettingController.java b/src/main/java/com/zcloud/controller/positioning/MapSettingController.java index ca570f9..875cf28 100644 --- a/src/main/java/com/zcloud/controller/positioning/MapSettingController.java +++ b/src/main/java/com/zcloud/controller/positioning/MapSettingController.java @@ -1,5 +1,6 @@ package com.zcloud.controller.positioning; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.zcloud.controller.base.BaseController; import com.zcloud.entity.Page; @@ -34,7 +35,7 @@ public class MapSettingController extends BaseController { PageData pageData = this.getPageData(); ReturnMap returnMap = new ReturnMap(); JSONObject body = PLSUtil.getLayerList( - Jurisdiction.getCORPINFO_ID(), page.getCurrentPage() + 1, page.getShowCount(), pageData.getString("keywords")); + Jurisdiction.getCORPINFO_ID(), Integer.parseInt(pageData.getString("currentPage")), Integer.parseInt(pageData.getString("showCount")), pageData.getString("KEYWORDS")); if (body != null) { List list = body.getJSONArray("rows").toJavaList(JSONObject.class); returnMap.put("varList", list); @@ -43,6 +44,7 @@ public class MapSettingController extends BaseController { } return returnMap; } + /** * @Description: 处理告警 * @Author: dearLin @@ -54,13 +56,16 @@ public class MapSettingController extends BaseController { @ResponseBody public ReturnMap save() throws Exception { PageData pageData = this.getPageData(); + JSONArray list = JSONObject.parseArray(pageData.getString("list")); + pageData.put("list", list); ReturnMap returnMap = new ReturnMap(); - JSONObject body = PLSUtil.GeneralPost("/region/layer",pageData, Jurisdiction.getCORPINFO_ID()); + JSONObject body = PLSUtil.GeneralPost("/region/layer", pageData, Jurisdiction.getCORPINFO_ID()); if (body != null) { - returnMap.putAll(body); + returnMap.putAll(body); } return returnMap; } + /** * @Description: 详情 * @Author: dearLin @@ -73,12 +78,13 @@ public class MapSettingController extends BaseController { public ReturnMap goEdit() throws Exception { PageData pageData = this.getPageData(); ReturnMap returnMap = new ReturnMap(); - JSONObject body = PLSUtil.GeneralGetById("/region/layer/",Integer.parseInt(pageData.getString("layId")), Jurisdiction.getCORPINFO_ID()); + JSONObject body = PLSUtil.GeneralGetById("/region/layer/", Integer.parseInt(pageData.getString("layId")), Jurisdiction.getCORPINFO_ID()); if (body != null) { returnMap.putAll(body); } return returnMap; } + /** * @Description: 修改 * @Author: dearLin @@ -90,13 +96,16 @@ public class MapSettingController extends BaseController { @ResponseBody public ReturnMap edit() throws Exception { PageData pageData = this.getPageData(); + JSONArray list = JSONObject.parseArray(pageData.getString("list")); + pageData.put("list", list); ReturnMap returnMap = new ReturnMap(); - JSONObject body = PLSUtil.GeneralPut("/region/layer",pageData, Jurisdiction.getCORPINFO_ID()); + JSONObject body = PLSUtil.GeneralPut("/region/layer", pageData, Jurisdiction.getCORPINFO_ID()); if (body != null) { returnMap.putAll(body); } return returnMap; } + /** * @Description: 修改 * @Author: dearLin @@ -109,11 +118,73 @@ public class MapSettingController extends BaseController { public ReturnMap remove() throws Exception { PageData pageData = this.getPageData(); ReturnMap returnMap = new ReturnMap(); - JSONObject body = PLSUtil.GeneralDelete("/region/layer/",Integer.parseInt(pageData.getString("layId")), Jurisdiction.getCORPINFO_ID()); + JSONObject body = PLSUtil.GeneralDelete("/region/layer/", pageData.getString("DATA_IDS"), Jurisdiction.getCORPINFO_ID()); if (body != null) { returnMap.putAll(body); } return returnMap; } + // 作业票区域 + @RequestMapping(value = "/region/list") + @ResponseBody + public ReturnMap getFenceList() throws Exception { + PageData pageData = this.getPageData(); + return ReturnMap.ok().put("data", PLSUtil.getRyRegionList(Jurisdiction.getCORPINFO_ID(), pageData.getString("KEYWORDS"), Integer.parseInt(pageData.getString("currentPage")), Integer.parseInt(pageData.getString("showCount")))); + } + + + // 路径规划 + @RequestMapping(value = "/coordinateLine/tree") + @ResponseBody + public ReturnMap coordinateLineTree() throws Exception { + PageData pageData = this.getPageData(); + ReturnMap returnMap = new ReturnMap(); + JSONObject body = PLSUtil.GeneralList("/location/coordinateLine/tree", pageData); + if (body != null) { + returnMap.putAll(body); + } + return returnMap; + } + + /** + * @Description: 新建路径规划 + * @Author: dearLin + * @Date: 2024/2/22/022 15:48 + * @Param: [] [] + * @Return: com.zcloud.util.ReturnMap + */ + @RequestMapping(value = "/coordinateLine/addCoordinateLine") + @ResponseBody + public ReturnMap addCoordinateLine() throws Exception { + PageData pageData = this.getPageData(); + JSONArray coordinateGroup = JSONObject.parseArray(pageData.getString("coordinateGroup")); + pageData.put("coordinateGroup", coordinateGroup); + ReturnMap returnMap = new ReturnMap(); + JSONObject body = PLSUtil.GeneralPost("/location/coordinateLine/addCoordinateLine", pageData,Jurisdiction.getCORPINFO_ID()); + if (body != null) { + returnMap.putAll(body); + } + return returnMap; + } + /** + * @Description: 路径规划批量删除 + * @Author: dearLin + * @Date: 2024/2/22/022 15:48 + * @Param: [] [] + * @Return: com.zcloud.util.ReturnMap + */ + @RequestMapping(value = "/coordinateLine/batchDelete") + @ResponseBody + public ReturnMap batchDelete() throws Exception { + PageData pageData = this.getPageData(); + JSONArray coordinateGroup = JSONObject.parseArray(pageData.getString("coordinateGroup")); + pageData.put("coordinateGroup", coordinateGroup); + ReturnMap returnMap = new ReturnMap(); + JSONObject body = PLSUtil.GeneralDelete("/location/coordinateLine/", pageData.getString("DATA_IDS"),Jurisdiction.getCORPINFO_ID()); + if (body != null) { + returnMap.putAll(body); + } + return returnMap; + } } diff --git a/src/main/java/com/zcloud/controller/positioning/PositAlarmController.java b/src/main/java/com/zcloud/controller/positioning/PositAlarmController.java index 2aa6cea..ed4f4d3 100644 --- a/src/main/java/com/zcloud/controller/positioning/PositAlarmController.java +++ b/src/main/java/com/zcloud/controller/positioning/PositAlarmController.java @@ -1,5 +1,6 @@ package com.zcloud.controller.positioning; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.zcloud.controller.base.BaseController; import com.zcloud.entity.Page; @@ -22,6 +23,7 @@ import java.util.List; @Controller @RequestMapping("/positAlarm") public class PositAlarmController extends BaseController { + /** * @Description: 告警数据 来自人员定位系统 * @Author: dearLin @@ -45,6 +47,7 @@ public class PositAlarmController extends BaseController { } return returnMap; } + /** * @Description: 处理告警 * @Author: dearLin @@ -56,24 +59,335 @@ public class PositAlarmController extends BaseController { @ResponseBody public ReturnMap alarmHandling() throws Exception { PageData pageData = this.getPageData(); + JSONArray list = JSONObject.parseArray(pageData.getString("ids")); + pageData.put("ids", list); ReturnMap returnMap = new ReturnMap(); - JSONObject body = PLSUtil.GeneralPost("/region/alarm/alarmHandling",pageData, Jurisdiction.getCORPINFO_ID()); - if (body != null) { - returnMap.putAll(body); - } - return returnMap; - } - @RequestMapping(value = "/alarmHandlingAll") - @ResponseBody - public ReturnMap alarmHandlingAll() throws Exception { - PageData pageData = this.getPageData(); - ReturnMap returnMap = new ReturnMap(); - JSONObject body = PLSUtil.GeneralPost("/region/alarm/alarmHandlingAll",pageData, Jurisdiction.getCORPINFO_ID()); + JSONObject body = PLSUtil.GeneralPost("/region/alarm/alarmHandling", pageData, Jurisdiction.getCORPINFO_ID()); if (body != null) { returnMap.putAll(body); } return returnMap; } + /** + * @Description: 一键处理 + * @Author: dearLin + * @Date: 2024/2/22/022 9:29 + * @Param: [] [] + * @Return: com.zcloud.util.ReturnMap + */ + @RequestMapping(value = "/alarmHandlingAll") + @ResponseBody + public ReturnMap alarmHandlingAll() throws Exception { + PageData pageData = this.getPageData(); + ReturnMap returnMap = new ReturnMap(); + JSONObject body = PLSUtil.GeneralPost("/region/alarm/alarmHandlingAll", pageData, Jurisdiction.getCORPINFO_ID()); + if (body != null) { + returnMap.putAll(body); + } + return returnMap; + } + /** + * @Description: 其他告警区域列表 + * @Author: dearLin + * @Date: 2024/2/22/022 9:29 + * @Param: [] [] + * @Return: com.zcloud.util.ReturnMap + */ + @RequestMapping(value = "/otherRegion/list") + @ResponseBody + public ReturnMap otherRegionList() throws Exception { + PageData pageData = this.getPageData(); + ReturnMap returnMap = new ReturnMap(); + JSONObject body = PLSUtil.getRyRegionList(Jurisdiction.getCORPINFO_ID(), pageData.getString("KEYWORDS"), Integer.parseInt(pageData.getString("currentPage")), Integer.parseInt(pageData.getString("showCount"))); + if (body != null) { + returnMap.putAll(body); + } + return returnMap; + } + + /** + * @Description: 其他告警区域禁、起用 + * @Author: dearLin + * @Date: 2024/2/22/022 9:29 + * @Param: [] [] + * @Return: com.zcloud.util.ReturnMap + */ + @RequestMapping(value = "/otherRegion/editStatus") + @ResponseBody + public ReturnMap editStatus() throws Exception { + PageData pageData = this.getPageData(); + ReturnMap returnMap = new ReturnMap(); + JSONObject body = PLSUtil.GeneralPut("/region/region", pageData, Jurisdiction.getCORPINFO_ID()); + if (body != null) { + returnMap.putAll(body); + } + return returnMap; + } + + /** + * @Description: 其他告警区域删除 + * @Author: dearLin + * @Date: 2024/2/22/022 9:29 + * @Param: [] [] + * @Return: com.zcloud.util.ReturnMap + */ + @RequestMapping(value = "/otherRegion/regionDelete") + @ResponseBody + public ReturnMap regionDelete() throws Exception { + PageData pageData = this.getPageData(); + ReturnMap returnMap = new ReturnMap(); + JSONObject body = PLSUtil.GeneralDelete("/region/region/", pageData.getString("DATA_IDS"), Jurisdiction.getCORPINFO_ID()); + if (body != null) { + returnMap.putAll(body); + } + return returnMap; + } + + /** + * @Description: 其他告警区域单个详情 + * @Author: dearLin + * @Date: 2024/2/22/022 9:29 + * @Param: [] [] + * @Return: com.zcloud.util.ReturnMap + */ + @RequestMapping(value = "/otherRegion/regionGoEdit") + @ResponseBody + public ReturnMap regionGoEdit() throws Exception { + PageData pageData = this.getPageData(); + ReturnMap returnMap = new ReturnMap(); + JSONObject body = PLSUtil.GeneralGetById("/region/region/", pageData.getString("id"), Jurisdiction.getCORPINFO_ID()); + if (body != null) { + returnMap.putAll(body); + } + return returnMap; + } + /** + * @Description: 确认选点 /region/region/redrawTheArea + * @Author: dearLin + * @Date: 2024/2/22/022 15:06 + * @Param: + * @Return: + */ + @RequestMapping(value = "/otherRegion/save") + @ResponseBody + public ReturnMap otherRegionSave() throws Exception { + PageData pageData = this.getPageData(); + JSONArray list = JSONObject.parseArray(pageData.getString("list")); + pageData.put("list", list); + ReturnMap returnMap = new ReturnMap(); + JSONObject body = PLSUtil.GeneralPost("/region/region", pageData, Jurisdiction.getCORPINFO_ID()); + if (body != null) { + returnMap.putAll(body); + } + return returnMap; + } + /** + * @Description: 确认选点 /region/region/redrawTheArea + * @Author: dearLin + * @Date: 2024/2/22/022 15:06 + * @Param: + * @Return: + */ + @RequestMapping(value = "/otherRegion/redrawTheArea") + @ResponseBody + public ReturnMap redrawTheArea() throws Exception { + PageData pageData = this.getPageData(); + JSONArray list = JSONObject.parseArray(pageData.getString("list")); + pageData.put("list", list); + ReturnMap returnMap = new ReturnMap(); + JSONObject body = PLSUtil.GeneralPost("/region/region/redrawTheArea", pageData, Jurisdiction.getCORPINFO_ID()); + if (body != null) { + returnMap.putAll(body); + } + return returnMap; + } + + /** + * @Description: 其他告警区域所属图层 + * @Author: dearLin + * @Date: 2024/2/22/022 9:29 + * @Param: [] [] + * @Return: com.zcloud.util.ReturnMap + */ + @RequestMapping(value = "/otherRegion/selectRegionTreeVo") + @ResponseBody + public ReturnMap selectRegionTreeVo() throws Exception { + PageData pageData = this.getPageData(); + ReturnMap returnMap = new ReturnMap(); + JSONObject body = PLSUtil.GetGeneral("/region/region/selectRegionTreeVo", Jurisdiction.getCORPINFO_ID()); + if (body != null) { + returnMap.putAll(body); + } + return returnMap; + } + + /** + * @Description: 其他告警区域修改 + * @Author: dearLin + * @Date: 2024/2/22/022 9:29 + * @Param: [] [] + * @Return: com.zcloud.util.ReturnMap + */ + @RequestMapping(value = "/otherRegion/regionEdit") + @ResponseBody + public ReturnMap regionEdit() throws Exception { + PageData pageData = this.getPageData(); + JSONArray list = JSONObject.parseArray(pageData.getString("list")); + pageData.put("list", list); + ReturnMap returnMap = new ReturnMap(); + JSONObject body = PLSUtil.GeneralPut("/region/region", pageData, Jurisdiction.getCORPINFO_ID()); + if (body != null) { + returnMap.putAll(body); + } + return returnMap; + } + + /** + * @Description: 其他告警区域配置列表 + * @Author: dearLin + * @Date: 2024/2/22/022 9:29 + * @Param: [] [] + * @Return: com.zcloud.util.ReturnMap + */ + @RequestMapping(value = "/electronicFence/list") + @ResponseBody + public ReturnMap electronicFenceList() throws Exception { + PageData pageData = this.getPageData(); + ReturnMap returnMap = new ReturnMap(); + JSONObject body = PLSUtil.GeneralList("/region/electronicFence/list", pageData); + if (body != null) { + returnMap.putAll(body); + } + return returnMap; + } + + /** + * @Description: 其他告警区域配置单个详情 + * @Author: dearLin + * @Date: 2024/2/22/022 9:29 + * @Param: [] [] + * @Return: com.zcloud.util.ReturnMap + */ + @RequestMapping(value = "/electronicFenceGoEdit") + @ResponseBody + public ReturnMap electronicFenceGoEdit() throws Exception { + PageData pageData = this.getPageData(); + ReturnMap returnMap = new ReturnMap(); + JSONObject body = PLSUtil.GeneralGetById("/region/electronicFence/", pageData.getString("id"), Jurisdiction.getCORPINFO_ID()); + if (body != null) { + returnMap.putAll(body); + } + return returnMap; + } + + /** + * @Description: 其他告警区域配置修改 + * @Author: dearLin + * @Date: 2024/2/22/022 9:29 + * @Param: [] [] + * @Return: com.zcloud.util.ReturnMap + */ + @RequestMapping(value = "/electronicFenceEdit") + @ResponseBody + public ReturnMap electronicFenceEdit() throws Exception { + PageData pageData = this.getPageData(); + JSONArray regGatherId = JSONObject.parseArray(pageData.getString("regGatherId")); + JSONArray gatherRegions = JSONObject.parseArray(pageData.getString("gatherRegions")); + JSONArray list = JSONObject.parseArray(pageData.getString("eleType")); + JSONArray eleDept = JSONObject.parseArray(pageData.getString("eleDept")); + JSONArray eleCrossed = JSONObject.parseArray(pageData.getString("eleCrossed")); + JSONArray regId = JSONObject.parseArray(pageData.getString("regId")); + JSONArray regions = JSONObject.parseArray(pageData.getString("regions")); + JSONArray regId1 = JSONObject.parseArray(pageData.getString("regId1")); + JSONArray doubles = JSONObject.parseArray(pageData.getString("doubles")); + pageData.put("regGatherId", regGatherId); + pageData.put("gatherRegions", gatherRegions); + pageData.put("eleType", list); + pageData.put("eleDept", eleDept); + pageData.put("eleCrossed", eleCrossed); + pageData.put("regions", regions); + pageData.put("regId", regId); + pageData.put("regId1", regId1); + pageData.put("doubles", doubles); + ReturnMap returnMap = new ReturnMap(); + JSONObject body = PLSUtil.GeneralPut("/region/electronicFence/", pageData, Jurisdiction.getCORPINFO_ID()); + if (body != null) { + returnMap.putAll(body); + } + return returnMap; + } + + /** + * @Description: 其他告警区域配置修改 + * @Author: dearLin + * @Date: 2024/2/22/022 9:29 + * @Param: [] [] + * @Return: com.zcloud.util.ReturnMap + */ + @RequestMapping(value = "/electronicFenceSave") + @ResponseBody + public ReturnMap electronicFenceSave() throws Exception { + PageData pageData = this.getPageData(); + JSONArray list = JSONObject.parseArray(pageData.getString("eleType")); + JSONArray eleDept = JSONObject.parseArray(pageData.getString("eleDept")); + JSONArray eleCrossed = JSONObject.parseArray(pageData.getString("eleCrossed")); + JSONArray regId = JSONObject.parseArray(pageData.getString("regId")); + JSONArray regions = JSONObject.parseArray(pageData.getString("regions")); + JSONArray regId1 = JSONObject.parseArray(pageData.getString("regId1")); + JSONArray doubles = JSONObject.parseArray(pageData.getString("doubles")); + pageData.put("eleType", list); + pageData.put("eleDept", eleDept); + pageData.put("eleCrossed", eleCrossed); + pageData.put("regions", regions); + pageData.put("regId", regId); + pageData.put("regId1", regId1); + pageData.put("doubles", doubles); + + ReturnMap returnMap = new ReturnMap(); + JSONObject body = PLSUtil.GeneralPost("/region/electronicFence/", pageData, Jurisdiction.getCORPINFO_ID()); + if (body != null) { + returnMap.putAll(body); + } + return returnMap; + } + + /** + * @Description: 其他告警区域配置停用启用 + * @Author: dearLin + * @Date: 2024/2/22/022 9:29 + * @Param: [] [] + * @Return: com.zcloud.util.ReturnMap + */ + @RequestMapping(value = "/electronicFenceStatus") + @ResponseBody + public ReturnMap electronicFenceStatus() throws Exception { + PageData pageData = this.getPageData(); + ReturnMap returnMap = new ReturnMap(); + JSONObject body = PLSUtil.GeneralPut("/region/electronicFence/", pageData, Jurisdiction.getCORPINFO_ID()); + if (body != null) { + returnMap.putAll(body); + } + return returnMap; + } + + /** + * @Description: 其他告警配置删除 + * @Author: dearLin + * @Date: 2024/2/22/022 9:29 + * @Param: [] [] + * @Return: com.zcloud.util.ReturnMap + */ + @RequestMapping(value = "/electronicFenceDelete") + @ResponseBody + public ReturnMap electronicFenceDelete() throws Exception { + PageData pageData = this.getPageData(); + ReturnMap returnMap = new ReturnMap(); + JSONObject body = PLSUtil.GeneralDelete("/region/electronicFence/", pageData.getString("DATA_IDS"), Jurisdiction.getCORPINFO_ID()); + if (body != null) { + returnMap.putAll(body); + } + return returnMap; + } } diff --git a/src/main/java/com/zcloud/controller/positioning/UserCardController.java b/src/main/java/com/zcloud/controller/positioning/UserCardController.java index 87b44ff..79f1aa6 100644 --- a/src/main/java/com/zcloud/controller/positioning/UserCardController.java +++ b/src/main/java/com/zcloud/controller/positioning/UserCardController.java @@ -136,7 +136,7 @@ public class UserCardController extends BaseController { ReturnMap returnMap = new ReturnMap(); JSONObject body = PLSUtil.GeneralDelete("/deploy/card/batchUnbinding/", pageData.getString("DATA_IDS"), Jurisdiction.getCORPINFO_ID()); if (body != null) { - if (!body.getString("code").equals("200")) return ReturnMap.error(body.getString("msg")); + if (!"200".equals(body.getString("code"))) return ReturnMap.error(body.getString("msg")); returnMap.putAll(body); } return returnMap; diff --git a/src/main/java/com/zcloud/util/PLSUtil.java b/src/main/java/com/zcloud/util/PLSUtil.java index 6eb331a..2f4f43a 100644 --- a/src/main/java/com/zcloud/util/PLSUtil.java +++ b/src/main/java/com/zcloud/util/PLSUtil.java @@ -20,6 +20,8 @@ import org.springframework.web.client.RestTemplate; import javax.annotation.PostConstruct; import java.io.IOException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; import java.util.*; @Component @@ -93,7 +95,7 @@ public class PLSUtil { return exchange.getBody(); } - public static JSONObject GeneralGetById(String Url, Integer id, String CORPINFO_ID) throws Exception { + public static JSONObject GeneralGetById(String Url, Object id, String CORPINFO_ID) throws Exception { HttpHeaders headers = new HttpHeaders(); headers.set("Authorization", getToken(CORPINFO_ID)); HttpEntity httpEntity = new HttpEntity<>(headers); @@ -103,27 +105,43 @@ public class PLSUtil { JSONObject.class); return exchange.getBody(); } + + public static JSONObject GeneralList(String Url, PageData pageData) throws Exception { + String params = buildGetParams(JSONObject.parseObject(JSON.toJSONString(pageData))); + String CORPINFO_ID = Jurisdiction.getCORPINFO_ID(); + HttpHeaders headers = new HttpHeaders(); + headers.set("Authorization", getToken(CORPINFO_ID)); + HttpEntity httpEntity = new HttpEntity<>(headers); + ResponseEntity exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + Url + params, + HttpMethod.GET, + httpEntity, + JSONObject.class); + return exchange.getBody(); + } + public static JSONObject GeneralPut(String Url, PageData pageData, String CORPINFO_ID) throws Exception { JSONObject uriVariables = JSONObject.parseObject(JSON.toJSONString(pageData)); HttpHeaders headers = new HttpHeaders(); headers.set("Authorization", getToken(CORPINFO_ID)); - HttpEntity httpEntity = new HttpEntity<>(uriVariables,headers); + HttpEntity httpEntity = new HttpEntity<>(uriVariables, headers); ResponseEntity exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + Url, HttpMethod.PUT, httpEntity, JSONObject.class); return exchange.getBody(); } + public static JSONObject GeneralDelete(String Url, Object id, String CORPINFO_ID) throws Exception { HttpHeaders headers = new HttpHeaders(); headers.set("Authorization", getToken(CORPINFO_ID)); HttpEntity httpEntity = new HttpEntity<>(headers); - ResponseEntity exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + Url+id, + ResponseEntity exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + Url + id, HttpMethod.DELETE, httpEntity, JSONObject.class); return exchange.getBody(); } + /** * @Description: 电子围栏列表 * @Author: dearLin @@ -188,8 +206,6 @@ public class PLSUtil { } - - /** * @Description: 查询摄像头 * @Author: dearLin @@ -288,13 +304,14 @@ public class PLSUtil { */ public static JSONObject getRyRegionList(String CORPINFO_ID, String keywords, Integer currentPage, Integer showCount) throws Exception { HttpHeaders headers = new HttpHeaders(); - + String url = "/region/region/list?pageNum=" + + currentPage + + "&pageSize=" + showCount + "&type=0" + + "&str="; + if (Tools.notEmpty(keywords)) url += keywords; headers.set("Authorization", getToken(CORPINFO_ID)); HttpEntity httpEntity = new HttpEntity<>(headers); - ResponseEntity exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + "/region/region/list?pageNum=" + - currentPage + - "&pageSize=" + showCount + - "&str=" + keywords + "&type=0", HttpMethod.GET, httpEntity, JSONObject.class); + ResponseEntity exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + url, HttpMethod.GET, httpEntity, JSONObject.class); return exchange.getBody(); } @@ -652,6 +669,23 @@ public class PLSUtil { return pageData; } + public static String buildGetParams(Map params) throws Exception { + StringBuilder sb = new StringBuilder(); + sb.append("?"); + for (Map.Entry entry : params.entrySet()) { + if (sb.length() > 1) { + sb.append("&"); + } + String key = entry.getKey(); + if ("currentPage".equals(entry.getKey())) key = "pageNum"; + if ("showCount".equals(entry.getKey())) key = "pageSize"; + sb.append(URLEncoder.encode(key, StandardCharsets.UTF_8.toString())); + sb.append("="); + sb.append(entry.getValue()); + } + return sb.toString(); + } + /** * 获取区域内随机坐标点 *