Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/master' into prod_test

zero 3 mesi fa
parent
commit
749ab3fd5d

+ 3 - 1
src/main/java/cn/cslg/pas/service/business/CompareLiteratureService.java

@@ -510,7 +510,9 @@ public class CompareLiteratureService extends ServiceImpl<CompareLiteratureMappe
         //报告id
         compareLiterature.setProjectId(projectId);
         if (patentWithIdVO != null) {
-            literatureNo = patent.getPatentNo();
+            if(patent.getPatentNo() != null){
+                literatureNo = patent.getPatentNo();
+            }
         }
 
         //判断该专利是否已经作为文献

+ 1 - 1
src/main/java/cn/cslg/pas/service/business/ReportProjectService.java

@@ -349,7 +349,7 @@ public class ReportProjectService extends ServiceImpl<ReportProjectMapper, Repor
          */
         ReportProject reportProject = new ReportProject();
         BeanUtils.copyProperties(reportProjectDTO, reportProject);
-        if (reportProject.getSignPatentNo() != null) {
+        if (reportProject.getSignPatentNo() != null&&!reportProject.getReportType().equals(3)) {
             try {
                 PatentWithIdVO patentWithIdVO = esService.getIdByPatentNo(reportProject.getSignPatentNo());
                 if (patentWithIdVO != null && patentWithIdVO.getPatent() != null) {

+ 2 - 1
src/main/java/cn/cslg/pas/service/business/es/EsService.java

@@ -111,6 +111,7 @@ public class EsService {
      * @throws Exception
      */
     public PatentWithIdVO getIdByPatentNo(String patentNo) throws Exception {
+         String patentNo1 = patentNo.replace(" ", "");
         SearchRequest.Builder builder = new SearchRequest.Builder();
         //设置查询索引
         builder.index("patent");
@@ -122,7 +123,7 @@ public class EsService {
 //        //授权号
 //        Query q3 = QueryBuilders.term(t -> t.field("grant_no.keyword").value(patentNo));
 //        Query query = QueryBuilders.bool(i -> i.should(q1, q2, q3));
-        Query query = QueryBuilders.term(t -> t.field("patent_no.keyword").value(patentNo));
+        Query query = QueryBuilders.term(t -> t.field("patent_no.keyword").value(patentNo1));
         builder.query(query);
         SearchResponse<Patent> response = null;
         try {

+ 42 - 26
src/main/java/cn/cslg/pas/service/common/PatentStarApiService.java

@@ -1124,8 +1124,8 @@ public class PatentStarApiService {
             pubText.setTextContent(fullText);
             pubText.setIfOrigin(true);
             claimList.add(pubText);
-        } catch (DocumentException e) {
-            e.printStackTrace();
+        } catch (Exception e) {
+//            e.printStackTrace();
         }
         SelectClaimDTO dto = new SelectClaimDTO();
         if (!CollectionUtils.isEmpty(claimList)) {
@@ -1235,8 +1235,8 @@ public class PatentStarApiService {
             pubText.setTextContent(fullText);
             pubText.setIfOrigin(true);
             pubTextList.add(pubText);
-        } catch (DocumentException e) {
-            e.printStackTrace();
+        } catch (Exception e) {
+//            e.printStackTrace();
         }
         return pubTextList;
     }
@@ -1289,20 +1289,23 @@ public class PatentStarApiService {
                         list.add(dto);
                     }
                 } else {  //若只有一个
-                    pdfUrl1 = pdfUrlStr.substring(pdfUrlStr.indexOf("http"));
-                    if (pdfUrl1.contains("0A_CN_0.pdf")) {
-
-                        InnerPatentPdfDTO dto = new InnerPatentPdfDTO();
-                        dto.setPdfGuid(pdfUrl1);
-                        dto.setType(0);
-                        list.add(dto);
-
-                    } else {
-                        InnerPatentPdfDTO dto = new InnerPatentPdfDTO();
-                        dto.setPdfGuid(pdfUrl1);
-                        dto.setType(1);
-                        list.add(dto);
-
+                    int i = pdfUrlStr.indexOf("http");
+                    if (i != -1) {
+                        pdfUrl1 = pdfUrlStr.substring(i);
+                        if (pdfUrl1.contains("0A_CN_0.pdf")) {
+
+                            InnerPatentPdfDTO dto = new InnerPatentPdfDTO();
+                            dto.setPdfGuid(pdfUrl1);
+                            dto.setType(0);
+                            list.add(dto);
+
+                        } else {
+                            InnerPatentPdfDTO dto = new InnerPatentPdfDTO();
+                            dto.setPdfGuid(pdfUrl1);
+                            dto.setType(1);
+                            list.add(dto);
+
+                        }
                     }
                 }
             }
@@ -1489,11 +1492,20 @@ public class PatentStarApiService {
                 BeanUtils.copyProperties(columnDTO, dto);
             }
         }
+        String txtGuid = "";
         if (StringUtils.isNotEmpty(dto.getRowApplicationNo())) {
-            String txtGuid = this.getTxtGuid(dto.getRowApplicationNo(), patentNo);
-            dto.setTxtGuid(txtGuid);
+            try {
+                txtGuid = this.getTxtGuid(dto.getRowApplicationNo(), patentNo);
+            } catch (Exception ignored) {
+            }
+        }
+        dto.setTxtGuid(txtGuid);
+        List<InnerPatentPdfDTO> pdfList = null;
+        try {
+            pdfList = this.getExternalTextPdf(dto.getAppNo(), dto.getRowApplicationNo(), dto.getPublicNo(), dto.getGrantNo());
+        } catch (Exception e) {
+            pdfList = new ArrayList<>();
         }
-        List<InnerPatentPdfDTO> pdfList = this.getExternalTextPdf(dto.getAppNo(), dto.getRowApplicationNo(), dto.getPublicNo(), dto.getGrantNo());
         if (!CollectionUtils.isEmpty(pdfList)) {
             List<InnerPatentPdfDTO> pdfDTOS = new ArrayList<>();
             for (InnerPatentPdfDTO innerPatentPdfDTO : pdfList) {
@@ -1509,6 +1521,8 @@ public class PatentStarApiService {
                 }
             }
             dto.setPdfDTOS(pdfDTOS);
+        } else {
+            dto.setPdfDTOS(new ArrayList<>());
         }
         return dto;
     }
@@ -1543,11 +1557,13 @@ public class PatentStarApiService {
             }
         }
         String result = builder.toString();
-        byte[] bytes = result.getBytes();
-        MultipartFile multipartFile = FileUtils.convertBytesToMultipartFile(bytes, patentNo + "-" + "文本文档.txt");
-        List<String> list = fileManagerService.uploadFileGetGuid(Collections.singletonList(multipartFile));
-        if (!CollectionUtils.isEmpty(list)) {
-            return list.get(0);
+        if (StringUtils.isNotEmpty(result)) {
+            byte[] bytes = result.getBytes();
+            MultipartFile multipartFile = FileUtils.convertBytesToMultipartFile(bytes, patentNo + "-" + "文本文档.txt");
+            List<String> list = fileManagerService.uploadFileGetGuid(Collections.singletonList(multipartFile));
+            if (!CollectionUtils.isEmpty(list)) {
+                return list.get(0);
+            }
         }
         return "";
     }

+ 1 - 1
src/main/java/cn/cslg/pas/service/dify/GenerateInstructionService.java

@@ -91,7 +91,7 @@ public class GenerateInstructionService {
         claim= claim.replaceAll("所述","");
         // 正则表达式模式(注意 Java 中需要双反斜杠转义)
         claim= claim.replaceAll("^(\\d+[.、]|\\[[0-9]+])","");
-        claim =claim.replaceAll("其特征在于[,。;!?、]","");
+        claim =claim.replaceAll("其特征在于[,。;!?、::]+(.+)","");
         return claim; // 未找到匹配时返回空字符串
 
 

+ 1 - 0
src/main/java/cn/cslg/pas/service/importPatent/ImportSinglePatentService.java

@@ -116,6 +116,7 @@ public class ImportSinglePatentService {
 
 
     public PatentWithIdVO addSinglePatent(String patentNo) {
+        patentNo = patentNo.replace(" ", "");
         PatentWithIdVO patentWithIdVO = new PatentWithIdVO();
 
         try {