告警管理,地图设置,聚集管理Api完成

pull/4/head
dearlin 2024-02-22 16:04:48 +08:00
parent cbad06c6dc
commit 9b40b93f37
4 changed files with 448 additions and 29 deletions

View File

@ -1,5 +1,6 @@
package com.zcloud.controller.positioning; package com.zcloud.controller.positioning;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.zcloud.controller.base.BaseController; import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.Page; import com.zcloud.entity.Page;
@ -34,7 +35,7 @@ public class MapSettingController extends BaseController {
PageData pageData = this.getPageData(); PageData pageData = this.getPageData();
ReturnMap returnMap = new ReturnMap(); ReturnMap returnMap = new ReturnMap();
JSONObject body = PLSUtil.getLayerList( 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) { if (body != null) {
List<JSONObject> list = body.getJSONArray("rows").toJavaList(JSONObject.class); List<JSONObject> list = body.getJSONArray("rows").toJavaList(JSONObject.class);
returnMap.put("varList", list); returnMap.put("varList", list);
@ -43,6 +44,7 @@ public class MapSettingController extends BaseController {
} }
return returnMap; return returnMap;
} }
/** /**
* @Description: * @Description:
* @Author: dearLin * @Author: dearLin
@ -54,13 +56,16 @@ public class MapSettingController extends BaseController {
@ResponseBody @ResponseBody
public ReturnMap save() throws Exception { public ReturnMap save() throws Exception {
PageData pageData = this.getPageData(); PageData pageData = this.getPageData();
JSONArray list = JSONObject.parseArray(pageData.getString("list"));
pageData.put("list", list);
ReturnMap returnMap = new ReturnMap(); 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) { if (body != null) {
returnMap.putAll(body); returnMap.putAll(body);
} }
return returnMap; return returnMap;
} }
/** /**
* @Description: * @Description:
* @Author: dearLin * @Author: dearLin
@ -73,12 +78,13 @@ public class MapSettingController extends BaseController {
public ReturnMap goEdit() throws Exception { public ReturnMap goEdit() throws Exception {
PageData pageData = this.getPageData(); PageData pageData = this.getPageData();
ReturnMap returnMap = new ReturnMap(); 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) { if (body != null) {
returnMap.putAll(body); returnMap.putAll(body);
} }
return returnMap; return returnMap;
} }
/** /**
* @Description: * @Description:
* @Author: dearLin * @Author: dearLin
@ -90,13 +96,16 @@ public class MapSettingController extends BaseController {
@ResponseBody @ResponseBody
public ReturnMap edit() throws Exception { public ReturnMap edit() throws Exception {
PageData pageData = this.getPageData(); PageData pageData = this.getPageData();
JSONArray list = JSONObject.parseArray(pageData.getString("list"));
pageData.put("list", list);
ReturnMap returnMap = new ReturnMap(); 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) { if (body != null) {
returnMap.putAll(body); returnMap.putAll(body);
} }
return returnMap; return returnMap;
} }
/** /**
* @Description: * @Description:
* @Author: dearLin * @Author: dearLin
@ -109,11 +118,73 @@ public class MapSettingController extends BaseController {
public ReturnMap remove() throws Exception { public ReturnMap remove() throws Exception {
PageData pageData = this.getPageData(); PageData pageData = this.getPageData();
ReturnMap returnMap = new ReturnMap(); 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) { if (body != null) {
returnMap.putAll(body); returnMap.putAll(body);
} }
return returnMap; 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;
}
} }

View File

@ -1,5 +1,6 @@
package com.zcloud.controller.positioning; package com.zcloud.controller.positioning;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.zcloud.controller.base.BaseController; import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.Page; import com.zcloud.entity.Page;
@ -22,6 +23,7 @@ import java.util.List;
@Controller @Controller
@RequestMapping("/positAlarm") @RequestMapping("/positAlarm")
public class PositAlarmController extends BaseController { public class PositAlarmController extends BaseController {
/** /**
* @Description: * @Description:
* @Author: dearLin * @Author: dearLin
@ -45,6 +47,7 @@ public class PositAlarmController extends BaseController {
} }
return returnMap; return returnMap;
} }
/** /**
* @Description: * @Description:
* @Author: dearLin * @Author: dearLin
@ -56,24 +59,335 @@ public class PositAlarmController extends BaseController {
@ResponseBody @ResponseBody
public ReturnMap alarmHandling() throws Exception { public ReturnMap alarmHandling() throws Exception {
PageData pageData = this.getPageData(); PageData pageData = this.getPageData();
JSONArray list = JSONObject.parseArray(pageData.getString("ids"));
pageData.put("ids", list);
ReturnMap returnMap = new ReturnMap(); ReturnMap returnMap = new ReturnMap();
JSONObject body = PLSUtil.GeneralPost("/region/alarm/alarmHandling",pageData, Jurisdiction.getCORPINFO_ID()); 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());
if (body != null) { if (body != null) {
returnMap.putAll(body); returnMap.putAll(body);
} }
return returnMap; 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;
}
} }

View File

@ -136,7 +136,7 @@ public class UserCardController extends BaseController {
ReturnMap returnMap = new ReturnMap(); ReturnMap returnMap = new ReturnMap();
JSONObject body = PLSUtil.GeneralDelete("/deploy/card/batchUnbinding/", pageData.getString("DATA_IDS"), Jurisdiction.getCORPINFO_ID()); JSONObject body = PLSUtil.GeneralDelete("/deploy/card/batchUnbinding/", pageData.getString("DATA_IDS"), Jurisdiction.getCORPINFO_ID());
if (body != null) { 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); returnMap.putAll(body);
} }
return returnMap; return returnMap;

View File

@ -20,6 +20,8 @@ import org.springframework.web.client.RestTemplate;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import java.io.IOException; import java.io.IOException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.*; import java.util.*;
@Component @Component
@ -93,7 +95,7 @@ public class PLSUtil {
return exchange.getBody(); 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(); HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", getToken(CORPINFO_ID)); headers.set("Authorization", getToken(CORPINFO_ID));
HttpEntity<JSONObject> httpEntity = new HttpEntity<>(headers); HttpEntity<JSONObject> httpEntity = new HttpEntity<>(headers);
@ -103,27 +105,43 @@ public class PLSUtil {
JSONObject.class); JSONObject.class);
return exchange.getBody(); 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<JSONObject> httpEntity = new HttpEntity<>(headers);
ResponseEntity<JSONObject> 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 { public static JSONObject GeneralPut(String Url, PageData pageData, String CORPINFO_ID) throws Exception {
JSONObject uriVariables = JSONObject.parseObject(JSON.toJSONString(pageData)); JSONObject uriVariables = JSONObject.parseObject(JSON.toJSONString(pageData));
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", getToken(CORPINFO_ID)); headers.set("Authorization", getToken(CORPINFO_ID));
HttpEntity<JSONObject> httpEntity = new HttpEntity<>(uriVariables,headers); HttpEntity<JSONObject> httpEntity = new HttpEntity<>(uriVariables, headers);
ResponseEntity<JSONObject> exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + Url, ResponseEntity<JSONObject> exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + Url,
HttpMethod.PUT, HttpMethod.PUT,
httpEntity, httpEntity,
JSONObject.class); JSONObject.class);
return exchange.getBody(); return exchange.getBody();
} }
public static JSONObject GeneralDelete(String Url, Object id, String CORPINFO_ID) throws Exception { public static JSONObject GeneralDelete(String Url, Object id, String CORPINFO_ID) throws Exception {
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", getToken(CORPINFO_ID)); headers.set("Authorization", getToken(CORPINFO_ID));
HttpEntity<JSONObject> httpEntity = new HttpEntity<>(headers); HttpEntity<JSONObject> httpEntity = new HttpEntity<>(headers);
ResponseEntity<JSONObject> exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + Url+id, ResponseEntity<JSONObject> exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + Url + id,
HttpMethod.DELETE, HttpMethod.DELETE,
httpEntity, httpEntity,
JSONObject.class); JSONObject.class);
return exchange.getBody(); return exchange.getBody();
} }
/** /**
* @Description: * @Description:
* @Author: dearLin * @Author: dearLin
@ -188,8 +206,6 @@ public class PLSUtil {
} }
/** /**
* @Description: * @Description:
* @Author: dearLin * @Author: dearLin
@ -288,13 +304,14 @@ public class PLSUtil {
*/ */
public static JSONObject getRyRegionList(String CORPINFO_ID, String keywords, Integer currentPage, Integer showCount) throws Exception { public static JSONObject getRyRegionList(String CORPINFO_ID, String keywords, Integer currentPage, Integer showCount) throws Exception {
HttpHeaders headers = new HttpHeaders(); 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)); headers.set("Authorization", getToken(CORPINFO_ID));
HttpEntity<JSONObject> httpEntity = new HttpEntity<>(headers); HttpEntity<JSONObject> httpEntity = new HttpEntity<>(headers);
ResponseEntity<JSONObject> exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + "/region/region/list?pageNum=" + ResponseEntity<JSONObject> exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + url, HttpMethod.GET, httpEntity, JSONObject.class);
currentPage +
"&pageSize=" + showCount +
"&str=" + keywords + "&type=0", HttpMethod.GET, httpEntity, JSONObject.class);
return exchange.getBody(); return exchange.getBody();
} }
@ -652,6 +669,23 @@ public class PLSUtil {
return pageData; return pageData;
} }
public static String buildGetParams(Map<String, Object> params) throws Exception {
StringBuilder sb = new StringBuilder();
sb.append("?");
for (Map.Entry<String, Object> 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();
}
/** /**
* *
* *