|
@@ -380,49 +380,57 @@ public class ResourceBusiness implements IResourceBusiness {
|
|
String url = resourceConfig.getResourceUrl();
|
|
String url = resourceConfig.getResourceUrl();
|
|
//获取应用资源
|
|
//获取应用资源
|
|
if(ResourceTypeEnum.TJ_APP.equals(resourceTypeEnum)){
|
|
if(ResourceTypeEnum.TJ_APP.equals(resourceTypeEnum)){
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
|
- map.put("page",pageNo);
|
|
|
|
- map.put("size",pageSize);
|
|
|
|
- String param = JSON.toJSONString(map);
|
|
|
|
- String busSraId = resourceConfig.getAppResource().getBusSraId();
|
|
|
|
- String busServiceId = resourceConfig.getAppResource().getBusServiceId();
|
|
|
|
- String busServiceFunc = resourceConfig.getAppResource().getBusServiceFunc();
|
|
|
|
- List<Header> headerList = getHeaders(busSraId,busServiceId,busServiceFunc);
|
|
|
|
- String response = HttpUtil.postForm(url, param, headerList, null);
|
|
|
|
- if(null == response){
|
|
|
|
- httpResult.setCode(ResponseStatus.FAIL_CODE);
|
|
|
|
- } else {
|
|
|
|
- JSONObject parse = JSONObject.parseObject(response);
|
|
|
|
- httpResult.setCode(ResponseStatus.SUCCESS_CODE);
|
|
|
|
- httpResult.setPages(parse.getInteger("totalPages"));
|
|
|
|
- httpResult.setTotals(parse.getInteger("total"));
|
|
|
|
- httpResult.setRecords(parse.getJSONArray("content"));
|
|
|
|
- }
|
|
|
|
|
|
+ getAppResource(pageNo, pageSize, httpResult, url);
|
|
}else if(ResourceTypeEnum.TJ_SERVICE.equals(resourceTypeEnum)){
|
|
}else if(ResourceTypeEnum.TJ_SERVICE.equals(resourceTypeEnum)){
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
|
- map.put("page",String.valueOf(pageNo));
|
|
|
|
- String param = JSON.toJSONString(map);
|
|
|
|
- //获取服务资源
|
|
|
|
- //服务资源提供方一次查询所有服务资源,未采用分页获取方式
|
|
|
|
- String busSraId = resourceConfig.getServiceResource().getBusSraId();
|
|
|
|
- String busServiceId = resourceConfig.getServiceResource().getBusServiceId();
|
|
|
|
- String busServiceFunc = resourceConfig.getServiceResource().getBusServiceFunc();
|
|
|
|
- List<Header> headerList = getHeaders(busSraId,busServiceId,busServiceFunc);
|
|
|
|
- String response = HttpUtil.postJSON(url, param,headerList,null);
|
|
|
|
- if(null == response){
|
|
|
|
- httpResult.setCode(ResponseStatus.FAIL_CODE);
|
|
|
|
- } else {
|
|
|
|
- JSONObject parse = JSONObject.parseObject(response);
|
|
|
|
- JSONObject data = parse.getJSONObject("data");
|
|
|
|
- httpResult.setRecords(data.getJSONArray("content"));
|
|
|
|
- httpResult.setCode(parse.getString("status"));
|
|
|
|
- httpResult.setPages(data.getInteger("totalPages"));
|
|
|
|
- httpResult.setTotals(data.getInteger("totalElements"));
|
|
|
|
- }
|
|
|
|
|
|
+ getServiceResource(pageNo, httpResult, url);
|
|
}
|
|
}
|
|
return httpResult;
|
|
return httpResult;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void getServiceResource(Integer pageNo, HttpResult httpResult, String url) {
|
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
|
+ map.put("page",String.valueOf(pageNo));
|
|
|
|
+ String param = JSON.toJSONString(map);
|
|
|
|
+ //获取服务资源
|
|
|
|
+ //服务资源提供方一次查询所有服务资源,未采用分页获取方式
|
|
|
|
+ String busSraId = resourceConfig.getServiceResource().getBusSraId();
|
|
|
|
+ String busServiceId = resourceConfig.getServiceResource().getBusServiceId();
|
|
|
|
+ String busServiceFunc = resourceConfig.getServiceResource().getBusServiceFunc();
|
|
|
|
+ List<Header> headerList = getHeaders(busSraId,busServiceId,busServiceFunc);
|
|
|
|
+ String response = HttpUtil.postJSON(url, param,headerList,null);
|
|
|
|
+ if(null == response){
|
|
|
|
+ httpResult.setCode(ResponseStatus.FAIL_CODE);
|
|
|
|
+ } else {
|
|
|
|
+ JSONObject parse = JSONObject.parseObject(response);
|
|
|
|
+ JSONObject data = parse.getJSONObject("data");
|
|
|
|
+ httpResult.setRecords(data.getJSONArray("content"));
|
|
|
|
+ httpResult.setCode(parse.getString("status"));
|
|
|
|
+ httpResult.setPages(data.getInteger("totalPages"));
|
|
|
|
+ httpResult.setTotals(data.getInteger("totalElements"));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void getAppResource(Integer pageNo, Integer pageSize, HttpResult httpResult, String url) {
|
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
|
+ map.put("page",pageNo);
|
|
|
|
+ map.put("size",pageSize);
|
|
|
|
+ String param = JSON.toJSONString(map);
|
|
|
|
+ String busSraId = resourceConfig.getAppResource().getBusSraId();
|
|
|
|
+ String busServiceId = resourceConfig.getAppResource().getBusServiceId();
|
|
|
|
+ String busServiceFunc = resourceConfig.getAppResource().getBusServiceFunc();
|
|
|
|
+ List<Header> headerList = getHeaders(busSraId,busServiceId,busServiceFunc);
|
|
|
|
+ String response = HttpUtil.postForm(url, param, headerList, null);
|
|
|
|
+ if(null == response){
|
|
|
|
+ httpResult.setCode(ResponseStatus.FAIL_CODE);
|
|
|
|
+ } else {
|
|
|
|
+ JSONObject parse = JSONObject.parseObject(response);
|
|
|
|
+ httpResult.setCode(ResponseStatus.SUCCESS_CODE);
|
|
|
|
+ httpResult.setPages(parse.getInteger("totalPages"));
|
|
|
|
+ httpResult.setTotals(parse.getInteger("total"));
|
|
|
|
+ httpResult.setRecords(parse.getJSONArray("content"));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
private List<Header> getHeaders(String busSraId,String busServiceId,String busServiceFunc) {
|
|
private List<Header> getHeaders(String busSraId,String busServiceId,String busServiceFunc) {
|
|
List<Header> heardList = new ArrayList<>();
|
|
List<Header> heardList = new ArrayList<>();
|
|
Header busSraIdHeader = new BasicHeader("bus_sra_id",busSraId);
|
|
Header busSraIdHeader = new BasicHeader("bus_sra_id",busSraId);
|