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 44404738..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 @@ -38,8 +38,8 @@ import java.io.IOException; import java.text.SimpleDateFormat; import java.time.LocalDateTime; import java.util.*; +import java.util.stream.Collectors; import java.util.concurrent.CompletableFuture; - /** * 资源表 * @@ -295,6 +295,45 @@ 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 result = JSONObject.parseObject(json, HashMap.class); + + 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(result); + } catch (Exception e) { + e.printStackTrace(); + return new Result().ok(new ArrayList(0)); + } + } + @GetMapping("qdyjjWeather") @ApiOperation("青岛应急局-查询青岛市地区天气信息") public Result qdyjjWeather(String cityName) {