zero 10 månader sedan
förälder
incheckning
e1bfe19b77

+ 7 - 0
src/main/java/cn/cslg/wdc/dto/SelectCaseInfoDTO.java

@@ -0,0 +1,7 @@
+package cn.cslg.wdc.dto;
+
+import lombok.Data;
+
+@Data
+public class SelectCaseInfoDTO {
+}

+ 18 - 7
src/main/java/cn/cslg/wdc/service/CaseFileService.java

@@ -118,9 +118,10 @@ public class CaseFileService extends ServiceImpl<CaseFileMapper, CaseFile> {
      *
      * @return
      */
-//    @Scheduled(cron = "0 0 1 * * ?")
-    @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Throwable.class)
+    @Scheduled(cron = "0 0 1 * * ?")
+    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
     public void getCaseInfoByHanding() throws Exception {
+        System.out.println("新申请递交中类型的案件相关信息开始导入-----importBegin");
         //重试机制
         int retry = 0;
         int retrySum = 3;
@@ -268,6 +269,7 @@ public class CaseFileService extends ServiceImpl<CaseFileMapper, CaseFile> {
             this.addDiscrepancy(caseNo);
 
         }
+        System.out.println("新申请递交中类型的案件相关信息完成导入-----importEnd");
     }
 
     /**
@@ -276,9 +278,10 @@ public class CaseFileService extends ServiceImpl<CaseFileMapper, CaseFile> {
      *
      * @return
      */
-    @Scheduled(cron = "0 30 14 * * ?")
+    @Scheduled(cron = "0 0 3 * * ?")
     @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Throwable.class)
     public void getCaseInfoByFinish() throws Exception {
+        System.out.println("新申请完成类型的案件相关信息开始导入-----importBegin");
         int retry = 0;
         int retrySum = 3;
         //初始化谷歌浏览器
@@ -439,6 +442,7 @@ public class CaseFileService extends ServiceImpl<CaseFileMapper, CaseFile> {
             this.getCaseFile(caseNo);
             this.addDiscrepancy(caseNo);
         }
+        System.out.println("新申请完成类型的案件相关信息完成导入-----importEnd");
     }
 
     /**
@@ -508,9 +512,12 @@ public class CaseFileService extends ServiceImpl<CaseFileMapper, CaseFile> {
     /**
      * 根据案号获取该案件的文件信息
      * 初稿、内部定稿、定稿分别进行保存到文件关联表中
+     *
      * @param caseNo
      */
     public void getCaseFile(String caseNo) {
+        int retry = 0;
+        int retrySum = 3;
         ChromeOptions options = new ChromeOptions();
         options.addArguments("user-data-dir=" + strFileSavePath);
         options.addArguments("--lang=nl");
@@ -633,8 +640,10 @@ public class CaseFileService extends ServiceImpl<CaseFileMapper, CaseFile> {
                 }
             }
         } catch (Exception e) {
-            e.printStackTrace();
-            throw new RuntimeException("An error occurred while retrieving case info", e);
+            retry += 1;
+            if (retry < retrySum) {
+                this.getCaseFile(caseNo);
+            }
         } finally {
             if (driver != null) {
                 driver.quit();
@@ -794,7 +803,9 @@ public class CaseFileService extends ServiceImpl<CaseFileMapper, CaseFile> {
         if (ObjectUtils.isNotEmpty(caseFile)) {
             List<AssoCaseFile> assoCaseFiles = assoCaseFileMapper.selectList(new LambdaQueryWrapper<AssoCaseFile>()
                     .eq(AssoCaseFile::getCaseId, caseFile.getId()));
-            if (assoCaseFiles.size() != 3) {
+            if (assoCaseFiles.size() < 3) {
+                assoCaseFileMapper.delete(new LambdaQueryWrapper<AssoCaseFile>()
+                        .eq(AssoCaseFile::getCaseId, caseFile.getId()));
                 caseFileMapper.deleteById(caseFile.getId());
             } else {
                 AssoCaseFile assoCaseFile1 = assoCaseFiles.stream().filter(i -> i.getFileType() == 1).findFirst().orElse(null);
@@ -1064,7 +1075,7 @@ public class CaseFileService extends ServiceImpl<CaseFileMapper, CaseFile> {
             detail.setDiffContent(html3);
             detail.setRate(diff.toString());
             detail.setSimilarity(String.format("%.6f", similarity));
-            detail.insert();
+            detail. insert();
         }
 
         // 关闭文档

+ 7 - 0
src/main/java/cn/cslg/wdc/vo/SelectCaseInfoVO.java

@@ -0,0 +1,7 @@
+package cn.cslg.wdc.vo;
+
+import lombok.Data;
+
+@Data
+public class SelectCaseInfoVO {
+}

+ 20 - 9
src/test/java/cn/cslg/wdc/WdcApplicationTests.java

@@ -7,6 +7,7 @@ import cn.cslg.wdc.entity.CaseFile;
 import cn.cslg.wdc.entity.Discrepancy;
 import cn.cslg.wdc.mapper.AssoCaseFileMapper;
 import cn.cslg.wdc.mapper.CaseFileMapper;
+import cn.cslg.wdc.service.CaseFileService;
 import cn.cslg.wdc.service.DiscrepancyService;
 import cn.cslg.wdc.service.common.CosineSimilarityService;
 import cn.cslg.wdc.service.common.FileManagerService;
@@ -37,7 +38,6 @@ import java.io.*;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.util.*;
-import java.util.stream.Collectors;
 
 @SpringBootTest
 class WdcApplicationTests {
@@ -57,11 +57,22 @@ class WdcApplicationTests {
     @Autowired
     private FileManagerService fileManagerService;
 
-    @Test
-    void contextLoads() {
+    @Autowired
+    private CaseFileService caseFileService;
 
-        final Long count = discrepancyService.getBaseMapper().selectCount(new LambdaQueryWrapper<Discrepancy>());
-        System.out.println(count);
+    @Test
+    void contextLoads() throws IOException {
+
+        String s1 = "46283d7fdae3413491da50dfd3b92364";
+        String s2 = "f8d77ae1ce2f4d298064ecaecf5ff301";
+        Integer s = 8;
+        String s3 = "241023-P20241102-PACN2417839-翻译方法、翻译装置、电子设备以及计算机可读存储介质-专利申请文件-v1F.docx";
+        String s4 = "241024-S2435631-测试卷-压缩包-语音翻译方法及装置、电子设备以及计算机可读存储介质-新申请文档-定稿.docx";
+        caseFileService.getFile(s1, s2, s, s3, s4);
+        System.out.println("AAAAAA");
+
+//        final Long count = discrepancyService.getBaseMapper().selectCount(new LambdaQueryWrapper<Discrepancy>());
+//        System.out.println(count);
 //        Discrepancy discrepancy = new Discrepancy();
 //        discrepancy.setCaseNo("sajdsak");
 //        discrepancy.setFirstDiscrepancy("0.36");
@@ -318,11 +329,11 @@ class WdcApplicationTests {
     //最终方法
     @Test
     public void test118() {
-        String path = "F:\\file\\测试\\word对比\\240722-S2418519-测试卷-PACN2414802-一种用于降低GIDL的混合型Gate结构及制备-申请全文-v1F.docx";
-//        String path = "F:\\file\\测试\\word对比\\S2418519-测试卷-PACN2414802-一种用于降低GIDL的混合型Gate结构及制备-权利要求书-v1r01-sq.docx";
+//        String path = "F:\\file\\测试\\word对比\\240722-S2418519-测试卷-PACN2414802-一种用于降低GIDL的混合型Gate结构及制备-申请全文-v1F.docx";
+        String path = "F:\\file\\测试\\word对比\\S2418519-测试卷-PACN2414802-一种用于降低GIDL的混合型Gate结构及制备-权利要求书-v1r01-sq.docx";
 //        String path = "F:\\file\\测试\\word对比\\AAA.docx";
-        String path1 = "F:\\file\\测试\\word对比\\240805-S2418519-测试卷-PACN2414802-一种用于降低GIDL的混合型Gate结构及制备-申请全文-v3F-清洁版.docx";
-//        String path1 = "F:\\file\\测试\\word对比\\240722-S2418519-测试卷-PACN2414802-一种用于降低GIDL的混合型Gate结构及制备-申请全文-v1F.docx";
+//        String path1 = "F:\\file\\测试\\word对比\\240805-S2418519-测试卷-PACN2414802-一种用于降低GIDL的混合型Gate结构及制备-申请全文-v3F-清洁版.docx";
+        String path1 = "F:\\file\\测试\\word对比\\240722-S2418519-测试卷-PACN2414802-一种用于降低GIDL的混合型Gate结构及制备-申请全文-v1F.docx";
         try {
 //            String text = "";
 //            String text1 = "";