|
@@ -30,12 +30,14 @@ import cn.cslg.pas.service.business.MergePersonService;
|
|
|
import cn.cslg.pas.service.business.es.EsCountService;
|
|
|
import cn.cslg.pas.service.business.es.EsPatentService;
|
|
|
import cn.cslg.pas.service.business.es.EsService;
|
|
|
+import cn.cslg.pas.service.common.FileManagerService;
|
|
|
import cn.cslg.pas.service.common.PatentStarApiService;
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.core.io.InputStreamResource;
|
|
|
import org.springframework.http.HttpHeaders;
|
|
|
+import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.http.MediaType;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -74,6 +76,8 @@ public class PatentController {
|
|
|
private PatentExportService patentExportService;
|
|
|
@Autowired
|
|
|
private PDFExportFirstPageService pdfExportFirstPageService;
|
|
|
+ @Autowired
|
|
|
+ private FileManagerService fileManagerService;
|
|
|
|
|
|
@Operation(summary = "查询专利")
|
|
|
@PostMapping("/queryPatent")
|
|
@@ -175,25 +179,8 @@ public class PatentController {
|
|
|
return Response.success(id);
|
|
|
}
|
|
|
|
|
|
-// @GetMapping("/pdf")
|
|
|
-// @Operation(summary = "导出专利")
|
|
|
-// public ResponseEntity<InputStreamResource> pdf(Integer projectId) throws IOException {
|
|
|
-// byte[] fileData = pdfExportFirstPageService.mergeAndExportPDFFirstPage(projectId);
|
|
|
-// //保存生成excel的地址
|
|
|
-// String fileName = "PDF.pdf";
|
|
|
-//// String fileName = IdUtil.simpleUUID() + ".xls";
|
|
|
-//// String directoryName = fileUtils.createDirectory();
|
|
|
-//// String savePath = fileUtils.getSavePath(directoryName);
|
|
|
-// //文件原始名中的中文字符可能会乱码,对文件名进行URL编码
|
|
|
-// String encodedFileName = URLEncoder.encode(fileName, StandardCharsets.UTF_8.toString());
|
|
|
-// return ResponseEntity.ok().contentLength(fileData.length)
|
|
|
-// .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + encodedFileName + "\"")
|
|
|
-// .contentType(MediaType.parseMediaType("application/octet-stream"))
|
|
|
-// .body(new InputStreamResource(new ByteArrayInputStream(fileData)));
|
|
|
-// }
|
|
|
-
|
|
|
@GetMapping("/exportPDFFirstPage")
|
|
|
- @Operation(summary = "导出专利")
|
|
|
+ @Operation(summary = "导出专利PDF")
|
|
|
public ResponseEntity<InputStreamResource> exportPDFFirstPage(Integer projectId) throws IOException {
|
|
|
byte[] fileData = pdfExportFirstPageService.mergeAndExportPDFFirstPage(projectId);
|
|
|
//保存生成excel的地址
|