zero 10 mesi fa
parent
commit
3141536cfe

+ 0 - 2
src/main/java/cn/cslg/wdc/entity/AssoCaseFile.java

@@ -20,8 +20,6 @@ public class AssoCaseFile extends BaseEntity<AssoCaseFile> {
      * 1初稿
      * 2内部定稿
      * 3定稿
-     * 4初稿与内部定稿
-     * 5内部定稿与定稿
      */
     @TableField(value = "file_type")
     private Integer fileType;

+ 57 - 44
src/main/java/cn/cslg/wdc/service/CaseFileService.java

@@ -57,6 +57,8 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
 import java.io.*;
@@ -117,6 +119,7 @@ public class CaseFileService extends ServiceImpl<CaseFileMapper, CaseFile> {
      * @return
      */
 //    @Scheduled(cron = "0 0 1 * * ?")
+    @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Throwable.class)
     public void getCaseInfoByHanding() throws Exception {
         //重试机制
         int retry = 0;
@@ -269,11 +272,12 @@ public class CaseFileService extends ServiceImpl<CaseFileMapper, CaseFile> {
 
     /**
      * 根据新申请类型,状态为递交中条件去查询当前时间的案件
-     * 每日定时02:00启动方法
+     * 每日定时03:00启动方法
      *
      * @return
      */
-//    @Scheduled(cron = "0 0 3 * * ?")
+    @Scheduled(cron = "0 30 14 * * ?")
+    @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Throwable.class)
     public void getCaseInfoByFinish() throws Exception {
         int retry = 0;
         int retrySum = 3;
@@ -446,6 +450,7 @@ public class CaseFileService extends ServiceImpl<CaseFileMapper, CaseFile> {
      * @return
      * @throws IOException
      */
+    @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Throwable.class)
     public List<String> getCaseInfo(String cookie, String uuid, String number) throws Exception {
         byte[] bytes = getReportInfoFromWDService.exportFileFromWD(cookie, uuid, number);
         //创建临时文件tempFile,并将文件读取到tempFile
@@ -612,7 +617,7 @@ public class CaseFileService extends ServiceImpl<CaseFileMapper, CaseFile> {
             JSONObject jsonObject1 = JSONObject.parseObject(caseInfo);
             List<GetCaseInfoByWDVO> caseInfoRows = JSONArray.parseArray(jsonObject1.getString("TableRows"), GetCaseInfoByWDVO.class);
             if (!CollectionUtils.isEmpty(caseInfoRows)) {
-                GetCaseInfoByWDVO caseInfoByWDVO = caseInfoRows.stream().filter(i -> i.getCtrl_proc().equals("新申请")).findFirst().orElse(new GetCaseInfoByWDVO());
+                GetCaseInfoByWDVO caseInfoByWDVO = caseInfoRows.stream().filter(i -> i.getCtrl_proc().equals("新申请")).findFirst().orElse(null);
                 if (ObjectUtils.isNotEmpty(caseInfoByWDVO)) {
                     String procId = caseInfoByWDVO.getProc_id();
                     GetPatentActionByWDDTO vo = new GetPatentActionByWDDTO();
@@ -648,7 +653,7 @@ public class CaseFileService extends ServiceImpl<CaseFileMapper, CaseFile> {
         JSONObject jsonObject = JSONObject.parseObject(result);
         List<TableRowsVO> rowsVOS = JSON.parseArray(jsonObject.getString("TableRows"), TableRowsVO.class);
         if (!CollectionUtils.isEmpty(rowsVOS)) {
-            TableRowsVO rowsVO = rowsVOS.stream().filter(i -> i.getFile_desc().equals("新申请第一次内审")).findFirst().orElse(new TableRowsVO());
+            TableRowsVO rowsVO = rowsVOS.stream().filter(i -> i.getFile_desc().equals("新申请第一次内审")).findFirst().orElse(null);
             if (ObjectUtils.isNotEmpty(rowsVO)) {
                 GetBaseInfoByWDDTO getBaseInfoByWDDTO = new GetBaseInfoByWDDTO();
                 getBaseInfoByWDDTO.setFile_no(rowsVO.getFile_no());
@@ -658,7 +663,7 @@ public class CaseFileService extends ServiceImpl<CaseFileMapper, CaseFile> {
                 this.uploadCaseFile(cookieStr, baseInfoByWDVO.getFile_guid(), baseInfoByWDVO.getFile_size(),
                         rowsVO.getFile_name(), caseNo, 1);
             }
-            TableRowsVO rowsVO1 = rowsVOS.stream().filter(i -> i.getFile_desc().equals("新申请第一次返稿")).findFirst().orElse(new TableRowsVO());
+            TableRowsVO rowsVO1 = rowsVOS.stream().filter(i -> i.getFile_desc().equals("新申请第一次返稿")).findFirst().orElse(null);
             if (ObjectUtils.isNotEmpty(rowsVO1)) {
                 GetBaseInfoByWDDTO getBaseInfoByWDDTO = new GetBaseInfoByWDDTO();
                 getBaseInfoByWDDTO.setFile_no(rowsVO1.getFile_no());
@@ -668,7 +673,7 @@ public class CaseFileService extends ServiceImpl<CaseFileMapper, CaseFile> {
                 this.uploadCaseFile(cookieStr, baseInfoByWDVO.getFile_guid(), baseInfoByWDVO.getFile_size(),
                         rowsVO1.getFile_name(), caseNo, 2);
             }
-            TableRowsVO rowsVO2 = rowsVOS.stream().filter(i -> i.getFile_desc().equals("新申请文档")).findFirst().orElse(new TableRowsVO());
+            TableRowsVO rowsVO2 = rowsVOS.stream().filter(i -> i.getFile_desc().equals("新申请文档")).findFirst().orElse(null);
             if (ObjectUtils.isNotEmpty(rowsVO2)) {
                 GetBaseInfoByWDDTO getBaseInfoByWDDTO = new GetBaseInfoByWDDTO();
                 getBaseInfoByWDDTO.setFile_no(rowsVO2.getFile_no());
@@ -692,6 +697,7 @@ public class CaseFileService extends ServiceImpl<CaseFileMapper, CaseFile> {
      * @param type
      * @throws Exception
      */
+    @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Throwable.class)
     public void uploadCaseFile(String cookie, String guid, String number, String fileName, String caseNo, Integer type) throws Exception {
         CaseFile caseFile = caseFileMapper.selectOne(new LambdaQueryWrapper<CaseFile>()
                 .eq(CaseFile::getCaseNo, caseNo));
@@ -702,12 +708,12 @@ public class CaseFileService extends ServiceImpl<CaseFileMapper, CaseFile> {
             if (ObjectUtils.isEmpty(assoCaseFile1)) {
                 byte[] bytes = getReportInfoFromWDService.exportFileFromWD(cookie, guid, number);//创建临时文件tempFile,并将文件读取到tempFile
                 File tempFile = null;
-                if (fileName.endsWith(".docx")) {
-                    tempFile = File.createTempFile("temp_", ".docx");
-                } else if (fileName.endsWith(".doc")) {
+                if (fileName.endsWith(".doc")) {
                     tempFile = File.createTempFile("temp_", ".doc");
                 } else if (fileName.endsWith(".zip")) {
                     tempFile = File.createTempFile("temp_", ".zip");
+                } else {
+                    tempFile = File.createTempFile("temp_", ".docx");
                 }
                 List<String> ids = new ArrayList<>();
                 try (
@@ -715,7 +721,7 @@ public class CaseFileService extends ServiceImpl<CaseFileMapper, CaseFile> {
                         FileOutputStream outputStream = new FileOutputStream(tempFile)
                 ) {
                     IOUtils.copy(inputStream, outputStream); // 将输入流复制到临时文件
-                    if (fileName.endsWith(".docx") || fileName.equals(".doc")) {
+                    if (fileName.endsWith(".docx") || fileName.endsWith(".doc")) {
                         ids = fileManagerService.uploadFileGetGuid2(Collections.singletonList(tempFile));
                     } else if (fileName.endsWith(".zip")) {
                         String tempDirectoryName = IdUtil.simpleUUID();
@@ -781,45 +787,51 @@ public class CaseFileService extends ServiceImpl<CaseFileMapper, CaseFile> {
      * @param caseNo
      * @throws Exception
      */
+    @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Throwable.class)
     public void addDiscrepancy(String caseNo) throws Exception {
         CaseFile caseFile = caseFileMapper.selectOne(new LambdaQueryWrapper<CaseFile>()
                 .eq(CaseFile::getCaseNo, caseNo));
         if (ObjectUtils.isNotEmpty(caseFile)) {
             List<AssoCaseFile> assoCaseFiles = assoCaseFileMapper.selectList(new LambdaQueryWrapper<AssoCaseFile>()
                     .eq(AssoCaseFile::getCaseId, caseFile.getId()));
-            AssoCaseFile assoCaseFile1 = assoCaseFiles.stream().filter(i -> i.getFileType() == 1).findFirst().orElse(new AssoCaseFile());
-            AssoCaseFile assoCaseFile2 = assoCaseFiles.stream().filter(i -> i.getFileType() == 2).findFirst().orElse(new AssoCaseFile());
-            AssoCaseFile assoCaseFile3 = assoCaseFiles.stream().filter(i -> i.getFileType() == 3).findFirst().orElse(new AssoCaseFile());
-            if (ObjectUtils.isNotEmpty(assoCaseFile1) && ObjectUtils.isNotEmpty(assoCaseFile2)) {
-                Discrepancy discrepancy1 = discrepancyMapper.selectOne(new LambdaQueryWrapper<Discrepancy>()
-                        .eq(Discrepancy::getCaseFileId1, assoCaseFile1.getId())
-                        .eq(Discrepancy::getCaseFileId2, assoCaseFile2.getId()));
-                if (ObjectUtils.isEmpty(discrepancy1)) {
-                    Discrepancy discrepancy = new Discrepancy();
-                    discrepancy.setCaseId(caseFile.getId());
-                    discrepancy.setCaseFileId1(assoCaseFile1.getId());
-                    discrepancy.setCaseFileId2(assoCaseFile2.getId());
-                    discrepancy.setDiscrepancyType(1);
-                    discrepancy.insert();
+            if (assoCaseFiles.size() != 3) {
+                caseFileMapper.deleteById(caseFile.getId());
+            } else {
+                AssoCaseFile assoCaseFile1 = assoCaseFiles.stream().filter(i -> i.getFileType() == 1).findFirst().orElse(null);
+                AssoCaseFile assoCaseFile2 = assoCaseFiles.stream().filter(i -> i.getFileType() == 2).findFirst().orElse(null);
+                AssoCaseFile assoCaseFile3 = assoCaseFiles.stream().filter(i -> i.getFileType() == 3).findFirst().orElse(null);
+                if (ObjectUtils.isNotEmpty(assoCaseFile1) && ObjectUtils.isNotEmpty(assoCaseFile2)) {
+                    Discrepancy discrepancy1 = discrepancyMapper.selectOne(new LambdaQueryWrapper<Discrepancy>()
+                            .eq(Discrepancy::getCaseFileId1, assoCaseFile1.getId())
+                            .eq(Discrepancy::getCaseFileId2, assoCaseFile2.getId()));
+                    if (ObjectUtils.isEmpty(discrepancy1)) {
+                        Discrepancy discrepancy = new Discrepancy();
+                        discrepancy.setCaseId(caseFile.getId());
+                        discrepancy.setCaseFileId1(assoCaseFile1.getId());
+                        discrepancy.setCaseFileId2(assoCaseFile2.getId());
+                        discrepancy.setDiscrepancyType(1);
+                        discrepancy.insert();
 
-                    this.getFile(assoCaseFile1.getFileGuid(), assoCaseFile2.getFileGuid(), discrepancy.getId(), assoCaseFile1.getFileName(), assoCaseFile2.getFileName());
+                        this.getFile(assoCaseFile1.getFileGuid(), assoCaseFile2.getFileGuid(), discrepancy.getId(), assoCaseFile1.getFileName(), assoCaseFile2.getFileName());
+                    }
                 }
-            }
-            if (ObjectUtils.isNotEmpty(assoCaseFile2) && ObjectUtils.isNotEmpty(assoCaseFile3)) {
-                Discrepancy discrepancy2 = discrepancyMapper.selectOne(new LambdaQueryWrapper<Discrepancy>()
-                        .eq(Discrepancy::getCaseFileId1, assoCaseFile2.getId())
-                        .eq(Discrepancy::getCaseFileId2, assoCaseFile3.getId()));
-                if (ObjectUtils.isEmpty(discrepancy2)) {
-                    Discrepancy discrepancy = new Discrepancy();
-                    discrepancy.setCaseId(caseFile.getId());
-                    discrepancy.setCaseFileId1(assoCaseFile2.getId());
-                    discrepancy.setCaseFileId2(assoCaseFile3.getId());
-                    discrepancy.setDiscrepancyType(2);
-                    discrepancy.insert();
+                if (ObjectUtils.isNotEmpty(assoCaseFile2) && ObjectUtils.isNotEmpty(assoCaseFile3)) {
+                    Discrepancy discrepancy2 = discrepancyMapper.selectOne(new LambdaQueryWrapper<Discrepancy>()
+                            .eq(Discrepancy::getCaseFileId1, assoCaseFile2.getId())
+                            .eq(Discrepancy::getCaseFileId2, assoCaseFile3.getId()));
+                    if (ObjectUtils.isEmpty(discrepancy2)) {
+                        Discrepancy discrepancy = new Discrepancy();
+                        discrepancy.setCaseId(caseFile.getId());
+                        discrepancy.setCaseFileId1(assoCaseFile2.getId());
+                        discrepancy.setCaseFileId2(assoCaseFile3.getId());
+                        discrepancy.setDiscrepancyType(2);
+                        discrepancy.insert();
 
-                    this.getFile(assoCaseFile2.getFileGuid(), assoCaseFile3.getFileGuid(), discrepancy.getId(), assoCaseFile2.getFileName(), assoCaseFile3.getFileName());
+                        this.getFile(assoCaseFile2.getFileGuid(), assoCaseFile3.getFileGuid(), discrepancy.getId(), assoCaseFile2.getFileName(), assoCaseFile3.getFileName());
+                    }
                 }
             }
+
         }
 
     }
@@ -836,10 +848,10 @@ public class CaseFileService extends ServiceImpl<CaseFileMapper, CaseFile> {
     public void getFile(String guid1, String guid2, Integer discrepancyId, String fileName1, String fileName2) throws IOException {
         byte[] bytes = fileManagerService.downloadSystemFileFromFMS(guid1);
         File tempFile = null;
-        if (fileName1.endsWith(".docx")) {
-            tempFile = File.createTempFile("temp1_", ".docx");
-        } else if (fileName1.endsWith(".doc")) {
+        if (fileName1.endsWith(".doc")) {
             tempFile = File.createTempFile("temp1_", ".doc");
+        } else {
+            tempFile = File.createTempFile("temp1_", ".docx");
         }
         try (
                 InputStream inputStream = new ByteArrayInputStream(bytes);
@@ -849,10 +861,10 @@ public class CaseFileService extends ServiceImpl<CaseFileMapper, CaseFile> {
         }
         byte[] bytes1 = fileManagerService.downloadSystemFileFromFMS(guid2);
         File tempFile1 = null;
-        if (fileName2.endsWith(".docx")) {
-            tempFile1 = File.createTempFile("temp2_", ".docx");
-        } else if (fileName2.endsWith(".doc")) {
+        if (fileName2.endsWith(".doc")) {
             tempFile1 = File.createTempFile("temp2_", ".doc");
+        } else {
+            tempFile1 = File.createTempFile("temp2_", ".docx");
         }
         try (
                 InputStream inputStream = new ByteArrayInputStream(bytes1);
@@ -974,6 +986,7 @@ public class CaseFileService extends ServiceImpl<CaseFileMapper, CaseFile> {
      * @param type
      * @param discrepancyId
      */
+    @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Throwable.class)
     public void compareText(String text, String text1, Integer type, Integer discrepancyId) {
         double similarity = cosineSimilarityService.calculateCosineSimilarity(text, text1);
         int total = text.length();

+ 79 - 61
src/test/java/cn/cslg/wdc/GetReportInfoFromWDTest.java

@@ -8,6 +8,7 @@ import cn.cslg.wdc.dto.common.GetCaseInfoByWDDTO;
 import cn.cslg.wdc.dto.common.GetPatentActionByWDDTO;
 import cn.cslg.wdc.entity.AssoCaseFile;
 import cn.cslg.wdc.entity.CaseFile;
+import cn.cslg.wdc.mapper.AssoCaseFileMapper;
 import cn.cslg.wdc.vo.common.GetCaseInfoByWDVO;
 import cn.cslg.wdc.vo.common.GetReportInfoFromWDVO;
 import cn.cslg.wdc.entity.common.PatentData;
@@ -63,6 +64,8 @@ public class GetReportInfoFromWDTest {
     @Autowired
     private  FileUtils fileUtils;
     @Autowired
+    private AssoCaseFileMapper assoCaseFileMapper;
+    @Autowired
     private FileManagerService fileManagerService;
 
     @Test
@@ -83,16 +86,19 @@ public class GetReportInfoFromWDTest {
     }
 
     public Map<String, String> dynamicCaseInfo() throws Exception {
+        //重试机制
+        int retry = 0;
+        int retrySum = 3;
         ChromeOptions options = new ChromeOptions();
         options.addArguments("user-data-dir=" + strFileSavePath);
         options.addArguments("--lang=nl");
         options.addArguments("--disable-popup-blocking");
         options.addArguments("--disable-images");
         options.addArguments("--remote-allow-origins=*");
-//        options.addArguments("--headless");
-        if (isHeadless) {
+        options.addArguments("--headless");
+//        if (isHeadless) {
 //            options.addArguments("--headless");
-        }
+//        }
 
         WebDriver driver = null;
         Map<String, String> retObject = new HashMap<>();
@@ -215,7 +221,7 @@ public class GetReportInfoFromWDTest {
                         System.out.println(str);
                         if (StringUtils.isNotEmpty(uuid) && StringUtils.isNotEmpty(number) && StringUtils.isNotEmpty(str.toString())) {
                             List<String> caseNos = this.getCaseInfo(str.toString(), uuid, number);
-                            System.out.println(StringUtils.join(caseNos,","));
+                            System.out.println(StringUtils.join(caseNos, ","));
                             caseNoList.addAll(caseNos);
                         }
                         if (StringUtils.equals(btnDownText, "下载")) {
@@ -230,8 +236,10 @@ public class GetReportInfoFromWDTest {
                 return null;
             });
         } catch (Exception e) {
-            e.printStackTrace();
-            throw new RuntimeException("An error occurred while retrieving case info", e);
+            retry += 1;
+            if (retry < retrySum) {
+                this.dynamicCaseInfo();
+            }
         } finally {
             if (driver != null) {
                 driver.quit();
@@ -242,12 +250,15 @@ public class GetReportInfoFromWDTest {
             try {
                 Thread.sleep(1000);
             } catch (InterruptedException e) {
-                e.printStackTrace();
+                retry += 1;
+                if (retry < retrySum) {
+                    this.dynamicCaseInfo();
+                }
             }
             this.getCaseFile(caseNo);
             i++;
         }
-        System.out.println(i);
+        System.out.println("AAAAAAA:" + i);
         return retObject;
     }
 
@@ -400,7 +411,7 @@ public class GetReportInfoFromWDTest {
             try {
                 caseLink = driver.findElement(By.linkText(caseNo));
             } catch (Exception e) {
-                throw new XiaoShiException("未查询到案件基本信息");
+
             }
             caseLink.click();
             try {
@@ -537,61 +548,68 @@ public class GetReportInfoFromWDTest {
     }
 
     public void uploadCaseFile(String cookie, String guid, String number, String fileName, String caseNo, Integer type) throws Exception {
-        byte[] bytes = getReportInfoFromWDService.exportFileFromWD(cookie, guid, number);//创建临时文件tempFile,并将文件读取到tempFile
-        File tempFile = null;
-        if (fileName.endsWith(".docx")) {
-            tempFile = File.createTempFile("temp_", ".docx");
-        } else if (fileName.endsWith(".zip")) {
-            tempFile = File.createTempFile("temp_", ".zip");
-        }
-        List<String> ids = new ArrayList<>();
-        try (
-                InputStream inputStream = new ByteArrayInputStream(bytes);
-                FileOutputStream outputStream = new FileOutputStream(tempFile)
-        ) {
-            IOUtils.copy(inputStream, outputStream); // 将输入流复制到临时文件
-            if (fileName.endsWith(".docx")) {
-//                ids = fileManagerService.uploadFileGetGuid2(Arrays.asList(tempFile));
-                System.out.println("ssssssssssssssssssss");
-            } else if (fileName.endsWith(".zip")) {
-                String tempDirectoryName = IdUtil.simpleUUID();
-                String tempPath = null;
-                try {
-                    tempPath = FileUtils.getSystemPath2(tempDirectoryName);
-                } catch (Exception e) {
-                    tempPath = "F:\\file\\" + tempDirectoryName;
-                }
-                File tempDirectory = new File(tempPath);
-                if (!tempDirectory.exists()) {
-                    tempDirectory.mkdir();
+        CaseFile caseFile = caseFileMapper.selectOne(new LambdaQueryWrapper<CaseFile>()
+                .eq(CaseFile::getCaseNo, caseNo));
+        if (ObjectUtils.isNotEmpty(caseFile)) {
+            AssoCaseFile assoCaseFile1 = assoCaseFileMapper.selectOne(new LambdaQueryWrapper<AssoCaseFile>()
+                    .eq(AssoCaseFile::getCaseId, caseFile.getId())
+                    .eq(AssoCaseFile::getFileType, type));
+            if (ObjectUtils.isEmpty(assoCaseFile1)) {
+                byte[] bytes = getReportInfoFromWDService.exportFileFromWD(cookie, guid, number);//创建临时文件tempFile,并将文件读取到tempFile
+                File tempFile = null;
+                if (fileName.endsWith(".doc")) {
+                    tempFile = File.createTempFile("temp_", ".doc");
+                } else if (fileName.endsWith(".zip")) {
+                    tempFile = File.createTempFile("temp_", ".zip");
+                } else {
+                    tempFile = File.createTempFile("temp_", ".docx");
                 }
-                ZipFile zipFile = new ZipFile(tempFile, Charset.forName("GBK"));
-                ZipUtil.unzip(zipFile, tempDirectory);
-                List<File> fileList = FileUtil.loopFiles(tempPath).stream().filter(item -> item.getName().endsWith(".docx")).collect(Collectors.toList());
-                if (!CollectionUtils.isEmpty(fileList)) {
-                    File file = fileList.get(0);
-                    fileName = file.getName();
-                    System.out.println(fileName);
-//                    ids = fileManagerService.uploadFileGetGuid2(Arrays.asList(file));
+                List<String> ids = new ArrayList<>();
+                try (
+                        InputStream inputStream = new ByteArrayInputStream(bytes);
+                        FileOutputStream outputStream = new FileOutputStream(tempFile)
+                ) {
+                    IOUtils.copy(inputStream, outputStream); // 将输入流复制到临时文件
+                    if (fileName.endsWith(".docx") || fileName.endsWith(".doc")) {
+//                        ids = fileManagerService.uploadFileGetGuid2(Collections.singletonList(tempFile));
+                    } else if (fileName.endsWith(".zip")) {
+                        String tempDirectoryName = IdUtil.simpleUUID();
+                        String tempPath = null;
+                        try {
+                            tempPath = FileUtils.getSystemPath2(tempDirectoryName);
+                        } catch (Exception e) {
+                            //todo
+                            tempPath = "F:\\file\\" + tempDirectoryName;
+                        }
+                        File tempDirectory = new File(tempPath);
+                        if (!tempDirectory.exists()) {
+                            tempDirectory.mkdir();
+                        }
+                        ZipFile zipFile = new ZipFile(tempFile, Charset.forName("GBK"));
+                        ZipUtil.unzip(zipFile, tempDirectory);
+                        List<File> fileList = FileUtil.loopFiles(tempPath).stream().filter(item -> item.getName().endsWith(".docx") || item.getName().endsWith(".doc")).collect(Collectors.toList());
+                        if (!CollectionUtils.isEmpty(fileList)) {
+                            File file = fileList.get(0);
+                            fileName = file.getName();
+//                            ids = fileManagerService.uploadFileGetGuid2(Collections.singletonList(file));
+                        }
+                        this.deleteDirectory(Paths.get(tempPath));
+                    }
+                } finally {
+                    tempFile.delete();
                 }
-                this.deleteDirectory(Paths.get(tempPath));
+                //添加案件文件关联表
+//                if (!CollectionUtils.isEmpty(ids)) {
+//                    Integer caseFileId = caseFile.getId();
+//                    String fileGuid = ids.get(0);
+//                    AssoCaseFile assoCaseFile = new AssoCaseFile();
+//                    assoCaseFile.setCaseId(caseFileId);
+//                    assoCaseFile.setFileName(fileName);
+//                    assoCaseFile.setFileType(type);
+//                    assoCaseFile.setFileGuid(fileGuid);
+//                    assoCaseFile.insert();
+//                }
             }
-        } finally {
-            tempFile.delete();
-        }
-
-        CaseFile caseFile = caseFileMapper.selectOne(new LambdaQueryWrapper<CaseFile>()
-                .eq(CaseFile::getCaseNo, caseNo));
-        String nameStr = fileName.substring(0, fileName.lastIndexOf("."));
-        if (ObjectUtils.isNotEmpty(caseFile) && !CollectionUtils.isEmpty(ids)) {
-            Integer caseFileId = caseFile.getId();
-            String fileGuid = ids.get(0);
-            AssoCaseFile assoCaseFile = new AssoCaseFile();
-            assoCaseFile.setCaseId(caseFileId);
-            assoCaseFile.setFileName(nameStr);
-            assoCaseFile.setFileType(type);
-            assoCaseFile.setFileGuid(fileGuid);
-            assoCaseFile.insert();
         }
     }
 

+ 0 - 3
src/test/java/cn/cslg/wdc/WdcApplicationTests.java

@@ -1,18 +1,15 @@
 package cn.cslg.wdc;
 
 import cn.cslg.wdc.common.exception.XiaoShiException;
-import cn.cslg.wdc.common.utils.SimilarityUtils;
 import cn.cslg.wdc.dto.common.SectionDiffCommandVisitor;
 import cn.cslg.wdc.entity.AssoCaseFile;
 import cn.cslg.wdc.entity.CaseFile;
 import cn.cslg.wdc.entity.Discrepancy;
-import cn.cslg.wdc.entity.DiscrepancyDetail;
 import cn.cslg.wdc.mapper.AssoCaseFileMapper;
 import cn.cslg.wdc.mapper.CaseFileMapper;
 import cn.cslg.wdc.service.DiscrepancyService;
 import cn.cslg.wdc.service.common.CosineSimilarityService;
 import cn.cslg.wdc.service.common.FileManagerService;
-import cn.cslg.wdc.service.common.GetReportInfoFromWDService;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import org.apache.commons.compress.utils.IOUtils;
 import org.apache.commons.lang3.ObjectUtils;