forked from integrated_whb/integrated_whb
电子围栏封装到工具类
parent
84b0151796
commit
6065abcbad
|
@ -65,8 +65,6 @@ public class IdentificationPartsController extends BaseController {
|
|||
@Autowired
|
||||
private UsersService usersService;
|
||||
|
||||
@Autowired
|
||||
private RestTemplate restTemplate;
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
|
@ -236,21 +234,16 @@ public class IdentificationPartsController extends BaseController {
|
|||
@ResponseBody
|
||||
public Object ryRegionList(Page page) throws Exception {
|
||||
ReturnMap returnMap = new ReturnMap();
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.set("Authorization", PLSUtil.getToken());
|
||||
HttpEntity<JSONObject> httpEntity = new HttpEntity<>(headers);
|
||||
PageData pageData = this.getPageData();
|
||||
String KEYWORDS = (String) pageData.getOrDefault("KEYWORDS","");
|
||||
ResponseEntity<JSONObject> exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(Jurisdiction.getCORPINFO_ID()) + "/region/region/list?pageNum=" +
|
||||
Integer.parseInt(pageData.getString("currentPage")) +
|
||||
"&pageSize=" + Integer.parseInt(pageData.getString("showCount")) +
|
||||
"&str=" + KEYWORDS + "&type=0", HttpMethod.GET, httpEntity, JSONObject.class);
|
||||
JSONObject body = exchange.getBody();
|
||||
String KEYWORDS = (String) pageData.getOrDefault("KEYWORDS", "");
|
||||
|
||||
JSONObject body = PLSUtil.getRyRegionList(KEYWORDS,Integer.parseInt(pageData.getString("currentPage")),Integer.parseInt(pageData.getString("showCount")));
|
||||
|
||||
if (body != null) {
|
||||
List<JSONObject> list = body.getJSONArray("rows").toJavaList(JSONObject.class);
|
||||
returnMap.put("varList",list);
|
||||
returnMap.put("varList", list);
|
||||
page.setTotalPage(body.getIntValue("total"));
|
||||
returnMap.put("page",page);
|
||||
returnMap.put("page", page);
|
||||
return returnMap;
|
||||
}
|
||||
return ReturnMap.error("查询失败");
|
||||
|
|
|
@ -13,7 +13,12 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.io.IOException;
|
||||
|
@ -28,13 +33,34 @@ public class PLSUtil {
|
|||
private static UsersService usersService;
|
||||
// 后台地址
|
||||
public static HashMap<String, String> BAKEADDR = new HashMap<>();
|
||||
|
||||
|
||||
private static RestTemplate restTemplate;
|
||||
@Autowired
|
||||
public void setCorpplsinfoService(CorpPlsInfoService corpplsinfoServicebean, UsersService usersServicebean) {
|
||||
public void setCorpplsinfoService(CorpPlsInfoService corpplsinfoServicebean, UsersService usersServicebean,RestTemplate restTemplatebean) {
|
||||
corpplsinfoService = corpplsinfoServicebean;
|
||||
usersService = usersServicebean;
|
||||
restTemplate = restTemplatebean;
|
||||
}
|
||||
/**
|
||||
* @Description: 电子围栏列表
|
||||
* @Author: dearLin
|
||||
* @Date: 2024/1/25/025 14:37
|
||||
* @Param: [java.lang.String, java.lang.Integer, java.lang.Integer] [keywords, currentPage, showCount]
|
||||
* @Return: com.alibaba.fastjson.JSONObject
|
||||
*/
|
||||
public static JSONObject getRyRegionList(String keywords,Integer currentPage,Integer showCount) throws Exception {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
|
||||
headers.set("Authorization", getToken());
|
||||
HttpEntity<JSONObject> httpEntity = new HttpEntity<>(headers);
|
||||
ResponseEntity<JSONObject> exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(Jurisdiction.getCORPINFO_ID()) + "/region/region/list?pageNum=" +
|
||||
currentPage +
|
||||
"&pageSize=" + showCount +
|
||||
"&str=" + keywords + "&type=0", HttpMethod.GET, httpEntity, JSONObject.class);
|
||||
return exchange.getBody();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@PostConstruct
|
||||
private void initBakeAddr() throws Exception {
|
||||
|
|
Loading…
Reference in New Issue