2 Комити 527e67d88b ... 00eb051eaf

Аутор SHA1 Порука Датум
  aihua 00eb051eaf Merge remote-tracking branch 'origin/master' пре 3 година
  aihua e3b45bc91c feat:新增法律法规信息库接口 пре 3 година

+ 14 - 0
src/main/java/com/chinaitop/depot/common/Constants.java

@@ -0,0 +1,14 @@
1
+package com.chinaitop.depot.common;
2
+
3
+/**
4
+ * 静态常量
5
+ *
6
+ * @author aihua
7
+ * @date 2022-04-20 16:20
8
+ */
9
+public class Constants {
10
+    /**
11
+     * 法律法规信息功能访问市平台服务token
12
+     */
13
+    public static final String TOKEN = "eyJhbGciOiJIUzI1NiJ9.eyJlZmZlY3RpdmVSZWZyZXNoVGltZSI6MTk3OTg1MTYwMTQ1NCwidXNlck5hbWUiOiLlupPnuqflubPlj7DlronlhajnlJ_kuqfliLbluqbmn6Xor6IiLCJleHAiOjM2Mzg1NDcxNzksImlhdCI6MTY1MDQyNTU4MCwiYWNjb3VudCI6ImNvbXBhbnkiLCJqdGkiOiJkMWQ1ZTczZi1mYzczLTQyOWItYmViYy05ZjI1ODdjNThhZTkifQ.9tumbK0aCLrCx6G0-dX9WG3xXaxOI5Li14AsTd_5MKY";
14
+}

+ 68 - 0
src/main/java/com/chinaitop/depot/risk/controller/LawsRegulationsInfoBaseController.java

@@ -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
+

+ 18 - 0
src/main/java/com/chinaitop/depot/risk/response/LawRegulationsResponse.java

@@ -0,0 +1,18 @@
1
+package com.chinaitop.depot.risk.response;
2
+
3
+import lombok.Data;
4
+
5
+/**
6
+ * class
7
+ *
8
+ * @author aihua
9
+ * @date 2022-04-20 16:49
10
+ */
11
+@Data
12
+public class LawRegulationsResponse<R> {
13
+    private String status;
14
+    private String infoCode;
15
+    private String msg;
16
+    private R data;
17
+    private Boolean success;
18
+}