|
@@ -6,20 +6,18 @@ import io.swagger.annotations.Api;
|
|
6
|
import io.swagger.annotations.ApiImplicitParam;
|
6
|
import io.swagger.annotations.ApiImplicitParam;
|
|
7
|
import io.swagger.annotations.ApiImplicitParams;
|
7
|
import io.swagger.annotations.ApiImplicitParams;
|
|
8
|
import io.swagger.annotations.ApiOperation;
|
8
|
import io.swagger.annotations.ApiOperation;
|
|
9
|
-import lombok.RequiredArgsConstructor;
|
|
|
|
|
|
9
|
+import org.apache.commons.lang3.StringUtils;
|
|
10
|
import org.springframework.beans.factory.annotation.Autowired;
|
10
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
11
|
import org.springframework.beans.factory.annotation.Value;
|
11
|
import org.springframework.beans.factory.annotation.Value;
|
|
12
|
-import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
|
|
13
|
import org.springframework.context.annotation.Bean;
|
12
|
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;
|
|
|
|
|
|
13
|
+import org.springframework.http.*;
|
|
18
|
import org.springframework.web.bind.annotation.RequestMapping;
|
14
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
19
|
import org.springframework.web.bind.annotation.RequestMethod;
|
15
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
20
|
import org.springframework.web.bind.annotation.RestController;
|
16
|
import org.springframework.web.bind.annotation.RestController;
|
|
21
|
import org.springframework.web.client.RestTemplate;
|
17
|
import org.springframework.web.client.RestTemplate;
|
|
22
|
|
18
|
|
|
|
|
19
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
|
20
|
+
|
|
23
|
/**
|
21
|
/**
|
|
24
|
*
|
22
|
*
|
|
25
|
* 法律规章信息库
|
23
|
* 法律规章信息库
|
|
@@ -47,7 +45,6 @@ public class LawsRegulationsInfoBaseController {
|
|
47
|
@ApiImplicitParam(name = "pageSize", value = "页面大小", defaultValue = "10", paramType = "query")
|
45
|
@ApiImplicitParam(name = "pageSize", value = "页面大小", defaultValue = "10", paramType = "query")
|
|
48
|
})
|
46
|
})
|
|
49
|
public com.chinaitop.depot.unissoft.model.ResponseEntity<Object> getLawRegulationInfo(Integer pageNum, Integer pageSize) {
|
47
|
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;
|
48
|
String url = "http://" + host + ":" + port + "/api/safety-app/prod_system/page_info/" + pageNum + "/" + pageSize;
|
|
52
|
|
49
|
|
|
53
|
HttpHeaders headers = new HttpHeaders();
|
50
|
HttpHeaders headers = new HttpHeaders();
|
|
@@ -60,6 +57,20 @@ public class LawsRegulationsInfoBaseController {
|
|
60
|
return com.chinaitop.depot.unissoft.model.ResponseEntity.ok(response.getData());
|
57
|
return com.chinaitop.depot.unissoft.model.ResponseEntity.ok(response.getData());
|
|
61
|
}
|
58
|
}
|
|
62
|
|
59
|
|
|
|
|
60
|
+ @RequestMapping(value = "/download", method = RequestMethod.GET)
|
|
|
|
61
|
+ @ApiOperation(value = "法律规章信息附件下载", notes = "下载法律规章信息附件")
|
|
|
|
62
|
+ @ApiImplicitParams({
|
|
|
|
63
|
+ @ApiImplicitParam(name = "fileId", value = "文件下载ID", paramType = "query")
|
|
|
|
64
|
+ })
|
|
|
|
65
|
+ public ResponseEntity<byte[]> downlaodFile(String fileId) {
|
|
|
|
66
|
+ if (StringUtils.isBlank(fileId)) {
|
|
|
|
67
|
+ return (ResponseEntity<byte[]>) ResponseEntity.notFound();
|
|
|
|
68
|
+ }
|
|
|
|
69
|
+ String url = "http://" + host + ":" + port + "/api/file/file/download?id=" + fileId;
|
|
|
|
70
|
+ HttpEntity<String> request = new HttpEntity<>("{}");
|
|
|
|
71
|
+ return restTemplate.exchange(url, HttpMethod.GET, request, byte[].class);
|
|
|
|
72
|
+ }
|
|
|
|
73
|
+
|
|
63
|
@Bean
|
74
|
@Bean
|
|
64
|
public RestTemplate restTemplate() {
|
75
|
public RestTemplate restTemplate() {
|
|
65
|
return new RestTemplate();
|
76
|
return new RestTemplate();
|