目录资源转发对接
This commit is contained in:
parent
84014eb3fa
commit
c01f7c913d
|
@ -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 = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
|
||||
"<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" +
|
||||
" <soap:Body>\n" +
|
||||
" <ZWCJ_mainPort xmlns=\"http://tempuri.org/\">\n" +
|
||||
String.format("<pagenum>%d</pagenum>\n <pagesize>%d</pagesize>\n",page, size) +
|
||||
" </ZWCJ_mainPort>\n" +
|
||||
" </soap:Body>\n" +
|
||||
"</soap:Envelope>";
|
||||
HttpHeaders requestHeaders = new HttpHeaders();
|
||||
requestHeaders.set("SOAPAction", "http://tempuri.org/ZWCJ_mainPort");
|
||||
requestHeaders.setContentType(MediaType.TEXT_XML);
|
||||
HttpEntity<String> requestEntity = new HttpEntity(parame, requestHeaders);
|
||||
try {
|
||||
String body = restTemplate.postForEntity(url, requestEntity, String.class).getBody();
|
||||
String startTag = "<ZWCJ_mainPortResult>";
|
||||
String endTag = "</ZWCJ_mainPortResult>";
|
||||
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) {
|
||||
|
|
Loading…
Reference in New Issue