|
@@ -30,26 +30,25 @@ import java.util.List;
|
|
@Slf4j
|
|
@Slf4j
|
|
@Service
|
|
@Service
|
|
public class PatentPDFService extends ServiceImpl<PatentInstructionMapper, PatentInstruction> {
|
|
public class PatentPDFService extends ServiceImpl<PatentInstructionMapper, PatentInstruction> {
|
|
- //private final PatentInstructionService patentInstructionService;
|
|
|
|
private final FileUtils fileUtils;
|
|
private final FileUtils fileUtils;
|
|
|
|
|
|
public void queryPatentPdfFirstPages(List<String> patentNos) throws IOException {
|
|
public void queryPatentPdfFirstPages(List<String> patentNos) throws IOException {
|
|
log.info("开始处理【导出多件专利pdf首页】的业务,业务参数为patentNos:{}", patentNos);
|
|
log.info("开始处理【导出多件专利pdf首页】的业务,业务参数为patentNos:{}", patentNos);
|
|
|
|
|
|
//根据专利号patentNos查询出所有pdf文档数据
|
|
//根据专利号patentNos查询出所有pdf文档数据
|
|
-// List<PatentInstruction> patentInstructions = patentInstructionService.list(new LambdaQueryWrapper<PatentInstruction>().in(PatentInstruction::getPatentNo, patentNos));
|
|
|
|
-//
|
|
|
|
-// for (PatentInstruction patentInstruction : patentInstructions) {
|
|
|
|
-// String filePath = fileUtils.getSystemPath() + patentInstruction.getUrl();
|
|
|
|
-// PDDocument doc = PDDocument.load(new File(filePath));
|
|
|
|
-// Splitter splitter = new Splitter();
|
|
|
|
-// splitter.setStartPage(1);
|
|
|
|
-// splitter.setEndPage(1);
|
|
|
|
-// PDDocument neededDoc = splitter.split(doc).get(0);
|
|
|
|
-// File pdfFirstPageFile = new File("合并多件专利的pdf首页.pdf");
|
|
|
|
-// neededDoc.save(pdfFirstPageFile);
|
|
|
|
-//
|
|
|
|
-// }
|
|
|
|
|
|
+ List<PatentInstruction> patentInstructions = this.list(new LambdaQueryWrapper<PatentInstruction>().in(PatentInstruction::getPatentNo, patentNos));
|
|
|
|
+
|
|
|
|
+ for (PatentInstruction patentInstruction : patentInstructions) {
|
|
|
|
+ String filePath = fileUtils.getSystemPath() + patentInstruction.getUrl();
|
|
|
|
+ PDDocument doc = PDDocument.load(new File(filePath));
|
|
|
|
+ Splitter splitter = new Splitter();
|
|
|
|
+ splitter.setStartPage(1);
|
|
|
|
+ splitter.setEndPage(1);
|
|
|
|
+ PDDocument neededDoc = splitter.split(doc).get(0);
|
|
|
|
+ File pdfFirstPageFile = new File("合并多件专利的pdf首页.pdf");
|
|
|
|
+ neededDoc.save(pdfFirstPageFile);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|