From c01f7c913d8788a78832524c7248908ee2a41e1f Mon Sep 17 00:00:00 2001 From: huangweixiong Date: Fri, 17 Jun 2022 11:31:11 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=9B=AE=E5=BD=95=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E8=BD=AC=E5=8F=91=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ResourceController.java | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java b/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java index 7d0143ac..7b251fc2 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java @@ -28,6 +28,8 @@ import org.springframework.web.bind.annotation.*; import org.springframework.web.client.RestTemplate; import springfox.documentation.annotations.ApiIgnore; +import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -236,6 +238,35 @@ public class ResourceController { } } + @GetMapping("ZywMessage/list") + @ApiOperation("资源列表转发") + public Result ZywMessageList(Integer page, Integer size) { + String url = "http://15.72.158.81/zyjk/ZywMessage.asmx"; + String parame = "\n" + + "\n" + + " \n" + + " \n" + + String.format("%d\n %d\n",page, size) + + " \n" + + " \n" + + ""; + HttpHeaders requestHeaders = new HttpHeaders(); + requestHeaders.set("SOAPAction", "http://tempuri.org/ZWCJ_mainPort"); + requestHeaders.setContentType(MediaType.TEXT_XML); + HttpEntity requestEntity = new HttpEntity(parame, requestHeaders); + try { + String body = restTemplate.postForEntity(url, requestEntity, String.class).getBody(); + String startTag = ""; + String endTag = ""; + String json = body.substring(body.indexOf(startTag) + startTag.length(), body.indexOf(endTag)); + HashMap map = JSONObject.parseObject(json, HashMap.class); + return new Result().ok(map); + } catch (Exception e) { + e.printStackTrace(); + return new Result().ok(new ArrayList(0)); + } + } + @GetMapping("qdyjjWeather") @ApiOperation("青岛应急局-查询青岛市地区天气信息") public Result qdyjjWeather(String cityName) { From 508047c9a4fb4754efb3d400250a324ba3c91302 Mon Sep 17 00:00:00 2001 From: huangweixiong Date: Fri, 17 Jun 2022 18:09:05 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=B5=84=E6=BA=90=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=A2=9E=E5=8A=A0=E5=88=86=E9=A1=B5=E6=80=BB?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resource/controller/ResourceController.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java b/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java index 2aa94c42..aefcdf6c 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java @@ -316,14 +316,18 @@ public class ResourceController { String startTag = ""; String endTag = ""; String json = body.substring(body.indexOf(startTag) + startTag.length(), body.indexOf(endTag)); - List results = JSONObject.parseObject(json, LinkedList.class); + HashMap result = JSONObject.parseObject(json, HashMap.class); - List objects = results.stream() + List rows = (List) result.get("data"); + + + List objects = rows.stream() .filter(item -> item.get("main") != null) .map(item -> item.get("main")) .collect(Collectors.toList()); + result.put("data", objects); - return new Result().ok(objects); + return new Result().ok(result); } catch (Exception e) { e.printStackTrace(); return new Result().ok(new ArrayList(0));