|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+package com.chinaitop.depot.risk.controller;
|
|
|
2
|
+
|
|
|
3
|
+import com.chinaitop.depot.common.Constants;
|
|
|
4
|
+import com.chinaitop.depot.risk.response.LawRegulationsResponse;
|
|
|
5
|
+import io.swagger.annotations.Api;
|
|
|
6
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
7
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
|
8
|
+import io.swagger.annotations.ApiOperation;
|
|
|
9
|
+import lombok.RequiredArgsConstructor;
|
|
|
10
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
11
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
12
|
+import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
|
13
|
+import org.springframework.context.annotation.Bean;
|
|
|
14
|
+import org.springframework.http.HttpEntity;
|
|
|
15
|
+import org.springframework.http.HttpHeaders;
|
|
|
16
|
+import org.springframework.http.MediaType;
|
|
|
17
|
+import org.springframework.http.ResponseEntity;
|
|
|
18
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
19
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
20
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
21
|
+import org.springframework.web.client.RestTemplate;
|
|
|
22
|
+
|
|
|
23
|
+/**
|
|
|
24
|
+ *
|
|
|
25
|
+ * 法律规章信息库
|
|
|
26
|
+ *
|
|
|
27
|
+ * @author aihua
|
|
|
28
|
+ * @date 2022-04-20 16:17
|
|
|
29
|
+ */
|
|
|
30
|
+@RestController
|
|
|
31
|
+@RequestMapping(value = "lawRegulationInfo")
|
|
|
32
|
+@Api(value = "lawsRegulationsInfoBaseController", description = "法律规章信息库-主页)")
|
|
|
33
|
+public class LawsRegulationsInfoBaseController {
|
|
|
34
|
+
|
|
|
35
|
+ @Value("${api.safety.host}")
|
|
|
36
|
+ private String host;
|
|
|
37
|
+ @Value("${api.safety.port}")
|
|
|
38
|
+ private String port;
|
|
|
39
|
+
|
|
|
40
|
+ @Autowired
|
|
|
41
|
+ private RestTemplate restTemplate;
|
|
|
42
|
+
|
|
|
43
|
+ @RequestMapping(value = "/getLawRegulationInfo", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.GET)
|
|
|
44
|
+ @ApiOperation(value = "法律规章信息库查询", notes = "查询法律规章信息库列表,支持分页")
|
|
|
45
|
+ @ApiImplicitParams({
|
|
|
46
|
+ @ApiImplicitParam(name = "pageNum", value = "起始页", defaultValue = "1", paramType = "query"),
|
|
|
47
|
+ @ApiImplicitParam(name = "pageSize", value = "页面大小", defaultValue = "10", paramType = "query")
|
|
|
48
|
+ })
|
|
|
49
|
+ public com.chinaitop.depot.unissoft.model.ResponseEntity<Object> getLawRegulationInfo(Integer pageNum, Integer pageSize) {
|
|
|
50
|
+ //
|
|
|
51
|
+ String url = "http://" + host + ":" + port + "/api/safety-app/prod_system/page_info/" + pageNum + "/" + pageSize;
|
|
|
52
|
+
|
|
|
53
|
+ HttpHeaders headers = new HttpHeaders();
|
|
|
54
|
+ headers.add("token", Constants.TOKEN);
|
|
|
55
|
+ headers.setContentType(MediaType.APPLICATION_JSON);
|
|
|
56
|
+
|
|
|
57
|
+ HttpEntity<String> request = new HttpEntity<>("{}", headers);
|
|
|
58
|
+ ResponseEntity<LawRegulationsResponse> responseEntity = restTemplate.postForEntity(url, request, LawRegulationsResponse.class);
|
|
|
59
|
+ LawRegulationsResponse response = responseEntity.getBody();
|
|
|
60
|
+ return com.chinaitop.depot.unissoft.model.ResponseEntity.ok(response.getData());
|
|
|
61
|
+ }
|
|
|
62
|
+
|
|
|
63
|
+ @Bean
|
|
|
64
|
+ public RestTemplate restTemplate() {
|
|
|
65
|
+ return new RestTemplate();
|
|
|
66
|
+ }
|
|
|
67
|
+}
|
|
|
68
|
+
|