Ver Fonte

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

lrj há 7 meses atrás
pai
commit
8e23ef80c3
61 ficheiros alterados com 4023 adições e 260 exclusões
  1. 4 4
      src/main/java/cn/cslg/pas/common/config/WebSocketConfig.java
  2. 1 0
      src/main/java/cn/cslg/pas/common/dto/business/PatentDigProjectDTO.java
  3. 9 0
      src/main/java/cn/cslg/pas/common/model/projectTask/AddFileExamineTaskDTO.java
  4. 12 0
      src/main/java/cn/cslg/pas/common/model/projectTask/FileDTO.java
  5. 12 0
      src/main/java/cn/cslg/pas/common/model/projectTask/FileFormDTO.java
  6. 11 0
      src/main/java/cn/cslg/pas/common/model/projectTask/GetExamineHistoryDTO.java
  7. 8 0
      src/main/java/cn/cslg/pas/common/model/projectTask/GetExamineMessageDTO.java
  8. 19 0
      src/main/java/cn/cslg/pas/common/model/projectTask/SubmitResultDTO.java
  9. 26 0
      src/main/java/cn/cslg/pas/common/model/projectTask/TaskFormDTO.java
  10. 53 0
      src/main/java/cn/cslg/pas/common/model/projectTask/TaskResultVO.java
  11. 339 0
      src/main/java/cn/cslg/pas/common/utils/CustomizeFileUtils.java
  12. 33 0
      src/main/java/cn/cslg/pas/common/utils/FileUtils.java
  13. 1 0
      src/main/java/cn/cslg/pas/common/vo/PersonSelfFieldVO.java
  14. 2 1
      src/main/java/cn/cslg/pas/common/vo/business/AssoTaskFileVO.java
  15. 5 3
      src/main/java/cn/cslg/pas/common/vo/business/PatentDigProjectFilesVO.java
  16. 1 0
      src/main/java/cn/cslg/pas/controller/PatentDigProjectController.java
  17. 1 2
      src/main/java/cn/cslg/pas/controller/PatentDigProjectFilesController.java
  18. 9 0
      src/main/java/cn/cslg/pas/controller/PersonFieldController.java
  19. 1 1
      src/main/java/cn/cslg/pas/controller/novelty/NoveltyReportReferenceController.java
  20. 74 0
      src/main/java/cn/cslg/pas/controller/projectTask/ExamineController.java
  21. 2 2
      src/main/java/cn/cslg/pas/controller/report/MatchCasePersonController.java
  22. 2 1
      src/main/java/cn/cslg/pas/domain/business/AssoHandleResultFile.java
  23. 2 0
      src/main/java/cn/cslg/pas/domain/business/AssoTaskFile.java
  24. 2 0
      src/main/java/cn/cslg/pas/domain/business/PatentDigProjectFiles.java
  25. 200 0
      src/main/java/cn/cslg/pas/factorys/noveltyTemplateFacotry/GetCommonTempalte.java
  26. 224 0
      src/main/java/cn/cslg/pas/factorys/noveltyTemplateFacotry/GetDahuaTempalte.java
  27. 228 0
      src/main/java/cn/cslg/pas/factorys/noveltyTemplateFacotry/GetShenNanTempalte.java
  28. 25 0
      src/main/java/cn/cslg/pas/factorys/noveltyTemplateFacotry/GetTemplateMapsImp.java
  29. 226 0
      src/main/java/cn/cslg/pas/factorys/noveltyTemplateFacotry/GetVisionoxTempalte.java
  30. 227 0
      src/main/java/cn/cslg/pas/factorys/noveltyTemplateFacotry/GetVisionoxcxTempalte.java
  31. 217 0
      src/main/java/cn/cslg/pas/factorys/noveltyTemplateFacotry/GetaiqijiTempalte.java
  32. 228 0
      src/main/java/cn/cslg/pas/factorys/noveltyTemplateFacotry/GetlingpaoTempalte.java
  33. 291 0
      src/main/java/cn/cslg/pas/factorys/noveltyTemplateFacotry/GetningdeTempalte.java
  34. 247 0
      src/main/java/cn/cslg/pas/factorys/noveltyTemplateFacotry/GetshidaixinganTempalte.java
  35. 27 0
      src/main/java/cn/cslg/pas/factorys/noveltyTemplateFacotry/NoveltyTempalteUtil.java
  36. 42 0
      src/main/java/cn/cslg/pas/factorys/noveltyTemplateFacotry/NoveltyTemplateFactory.java
  37. 84 9
      src/main/java/cn/cslg/pas/service/business/AssoTaskFileService.java
  38. 63 23
      src/main/java/cn/cslg/pas/service/business/PatentDigProjectFilesService.java
  39. 110 111
      src/main/java/cn/cslg/pas/service/business/PatentDigProjectService.java
  40. 306 36
      src/main/java/cn/cslg/pas/service/business/ProjectTaskService.java
  41. 249 6
      src/main/java/cn/cslg/pas/service/business/TaskHandleResultService.java
  42. 10 10
      src/main/java/cn/cslg/pas/service/business/TechnicalCaseService.java
  43. 6 4
      src/main/java/cn/cslg/pas/service/business/es/EsCustomFieldService.java
  44. 1 0
      src/main/java/cn/cslg/pas/service/business/es/EsPatentService.java
  45. 7 6
      src/main/java/cn/cslg/pas/service/business/es/EsService.java
  46. 42 2
      src/main/java/cn/cslg/pas/service/common/FileManagerService.java
  47. 94 0
      src/main/java/cn/cslg/pas/service/common/PersonFieldService.java
  48. 2 1
      src/main/java/cn/cslg/pas/service/novelty/NoveltyExportReportService.java
  49. 98 7
      src/main/java/cn/cslg/pas/service/novelty/NoveltyReportReferencesService.java
  50. 36 13
      src/main/java/cn/cslg/pas/service/novelty/NoveltySearchRecordService.java
  51. 17 13
      src/main/java/cn/cslg/pas/service/report/MatchCasePersonService.java
  52. 1 1
      src/main/resources/application-dev.yml
  53. BIN
      src/main/resources/file/reportTemple/noveltyTemplate-aiqiji.docx
  54. BIN
      src/main/resources/file/reportTemple/noveltyTemplate-dahua.docx
  55. BIN
      src/main/resources/file/reportTemple/noveltyTemplate-lingpao.docx
  56. BIN
      src/main/resources/file/reportTemple/noveltyTemplate-ningde.docx
  57. BIN
      src/main/resources/file/reportTemple/noveltyTemplate-shennan.docx
  58. BIN
      src/main/resources/file/reportTemple/noveltyTemplate-shidaixinan.docx
  59. 73 0
      src/main/resources/jsons/patent.json
  60. 1 1
      src/main/resources/mapper/AssoHandleResultFileMapper.xml
  61. 12 3
      src/test/java/cn/cslg/pas/test/PersonFiledTests.java

+ 4 - 4
src/main/java/cn/cslg/pas/common/config/WebSocketConfig.java

@@ -6,8 +6,8 @@ import org.springframework.web.socket.server.standard.ServerEndpointExporter;
 
 @Configuration
 public class WebSocketConfig {
-    @Bean
-    public ServerEndpointExporter serverEndpointExporter() {
-        return new ServerEndpointExporter();
-    }
+//    @Bean
+//    public ServerEndpointExporter serverEndpointExporter() {
+//        return new ServerEndpointExporter();
+//    }
 }

+ 1 - 0
src/main/java/cn/cslg/pas/common/dto/business/PatentDigProjectDTO.java

@@ -21,6 +21,7 @@ import java.util.List;
 /*数据库中的表对应的类
  */
 public class PatentDigProjectDTO {
+    private Integer id;
     /**
      * 名称
      */

+ 9 - 0
src/main/java/cn/cslg/pas/common/model/projectTask/AddFileExamineTaskDTO.java

@@ -0,0 +1,9 @@
+package cn.cslg.pas.common.model.projectTask;
+
+import lombok.Data;
+
+@Data
+public class AddFileExamineTaskDTO {
+   private FileFormDTO fileForm;
+   private TaskFormDTO taskForm;
+}

+ 12 - 0
src/main/java/cn/cslg/pas/common/model/projectTask/FileDTO.java

@@ -0,0 +1,12 @@
+package cn.cslg.pas.common.model.projectTask;
+
+import lombok.Data;
+
+@Data
+public class FileDTO {
+     private String referencesName;
+     private String guid;
+     private String projectId;
+     private String fileType;
+     private String rootGuid;
+}

+ 12 - 0
src/main/java/cn/cslg/pas/common/model/projectTask/FileFormDTO.java

@@ -0,0 +1,12 @@
+package cn.cslg.pas.common.model.projectTask;
+
+import lombok.Data;
+
+import java.util.List;
+
+
+@Data
+public class FileFormDTO {
+    private Integer projectId;
+    private List<FileDTO> files;
+}

+ 11 - 0
src/main/java/cn/cslg/pas/common/model/projectTask/GetExamineHistoryDTO.java

@@ -0,0 +1,11 @@
+package cn.cslg.pas.common.model.projectTask;
+
+import lombok.Data;
+
+@Data
+public class GetExamineHistoryDTO {
+    private Integer taskId;
+    private String fileGuid;
+    private Boolean ifGetLast;
+
+}

+ 8 - 0
src/main/java/cn/cslg/pas/common/model/projectTask/GetExamineMessageDTO.java

@@ -0,0 +1,8 @@
+package cn.cslg.pas.common.model.projectTask;
+
+import lombok.Data;
+
+@Data
+public class GetExamineMessageDTO {
+    private Integer taskId;
+}

+ 19 - 0
src/main/java/cn/cslg/pas/common/model/projectTask/SubmitResultDTO.java

@@ -0,0 +1,19 @@
+package cn.cslg.pas.common.model.projectTask;
+
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+
+@Data
+public class SubmitResultDTO {
+    private Integer taskId;
+    private List<String> files;
+    private Integer projectId;
+    private String handler;
+    private Integer handlerType;
+    private String result;
+    private String description;
+    private Date deadLineTime;//截止日期
+}

+ 26 - 0
src/main/java/cn/cslg/pas/common/model/projectTask/TaskFormDTO.java

@@ -0,0 +1,26 @@
+package cn.cslg.pas.common.model.projectTask;
+
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class TaskFormDTO {
+    private String name;
+    private String handler;
+    /**
+     * 截止时间
+     */
+    private Date deadLineTime;
+    /**
+     * 0内部人员1外部人员
+     */
+    private Integer handlerType;
+    /**
+     * 备注
+     */
+    private String description;
+    private Integer lastTaskId;
+    private Integer taskType;
+    private Integer assoTaskId;
+}

+ 53 - 0
src/main/java/cn/cslg/pas/common/model/projectTask/TaskResultVO.java

@@ -0,0 +1,53 @@
+package cn.cslg.pas.common.model.projectTask;
+
+import cn.cslg.pas.common.model.cronModel.SystemFile;
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class TaskResultVO {
+    private Integer status;
+    /**
+     * 任务处理结果
+     */
+    private String handleResult;
+
+    /**
+     * 描述/说明
+     */
+    private String description;
+
+    /**
+     * 下一个审核人
+     */
+    private String nextAuditor;
+
+    /**
+     * 是否内部人员
+     */
+    private Boolean ifInner;
+
+
+    /**
+     * 任务id
+     */
+    private Integer taskId;
+
+    /**
+     * 创建人
+     */
+    private String createId;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+    /**
+     * 创建人
+     */
+    private String createName;
+    private List<SystemFile> files;
+}

+ 339 - 0
src/main/java/cn/cslg/pas/common/utils/CustomizeFileUtils.java

@@ -0,0 +1,339 @@
+package cn.cslg.pas.common.utils;
+
+
+import cn.cslg.pas.Application;
+import cn.hutool.core.util.IdUtil;
+import com.alibaba.fastjson.JSON;
+import org.springframework.boot.system.ApplicationHome;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.*;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+
+@Service
+public class CustomizeFileUtils {
+
+    public static final String FILE_SEPARATOR = System.getProperty("file.separator");
+    public static final String COMMON_FILE = "file";
+    public static final String BACKUP_FILE = "backup";
+
+    public static String getStaticPath(String fileName) {
+        //ApplicationHome类 返回target目录层级
+        ApplicationHome ah = new ApplicationHome(Application.class);
+        //获取 applicationHome 内的路径 ...\target\classes 到这一层级下
+        File file = ah.getSource();
+        //获取 file的parentFile 即最后一级之前的所有层级路径(包括盘符) 这里能获得到的最终层级为  ...\target 后续用FILE_SEPARATOR(系统路径分割通配符 即 "\") 以及fileName拼接生成存放文件的目录层级 即为根目录 root
+        String rootPath = null;
+
+        if (fileName != null && !fileName.equals("")) {
+            rootPath = file.getParentFile().toString() + FILE_SEPARATOR + fileName;
+        } else {
+            rootPath = file.getParentFile().toString();
+        }
+        //根据上方生成的根目录路径 生成对应文件夹 没有就新建
+        File root = new File(rootPath);
+        if (!root.exists()) {
+            root.mkdir();
+        }
+        //返回的最终形式为 盘符:\项目层级\target\file
+        return rootPath;
+    }
+
+    public String analysisJsonFile() {
+        ApplicationHome ah = new ApplicationHome(BackupUtils.class);
+        File file = ah.getSource();
+//        String settingFilePath = file.getParentFile().toString() + FileUtils.FILE_SEPARATOR + "\\jsons\\" + "uploadSetting.json";
+        String settingFilePath = file.getParentFile().toString() + CustomizeFileUtils.FILE_SEPARATOR + "uploadSetting.json";
+        BufferedReader reader = null;
+        StringBuilder last = new StringBuilder();
+        InputStreamReader inputStreamReader;
+        try (FileInputStream fileInputStream = new FileInputStream(settingFilePath)) {
+            inputStreamReader = new InputStreamReader(fileInputStream, StandardCharsets.UTF_8);
+
+            reader = new BufferedReader(inputStreamReader);
+            String tempString;
+            while ((tempString = reader.readLine()) != null) {
+                last.append(tempString);
+            }
+            reader.close();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            if (reader != null) {
+                try {
+                    reader.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return last.toString();
+    }
+
+    public static File getFileByBytes(byte[] bytes, String prefix, String suffix) {
+        BufferedOutputStream bos = null;
+        FileOutputStream fos = null;
+        File file = null;
+        try {
+
+            file = File.createTempFile(prefix, suffix);
+
+            //输出流
+            fos = new FileOutputStream(file);
+
+            //缓冲流
+            bos = new BufferedOutputStream(fos);
+
+            //将字节数组写出
+            bos.write(bytes);
+            return file;
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if (bos != null) {
+                try {
+                    bos.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+            if (fos != null) {
+                try {
+                    fos.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+            return file;
+        }
+    }
+
+
+    public static File getFileByUrl(String dataUrl) throws IOException {
+
+        URL url = new URL(dataUrl);  //想要读取的url地址
+        InputStream in = url.openStream();
+        File file = File.createTempFile("new_url", ".pdf");  //创建文件
+        OutputStream os = new FileOutputStream(file);  //创建文件输出流
+        int bytesRead;
+        byte[] buffer = new byte[8192];
+        int len = 8192;
+        while ((bytesRead = in.read(buffer, 0, len)) != -1) {
+            os.write(buffer, 0, bytesRead);
+        }
+        //关闭释放流
+        os.close();
+        in.close();
+        return file;
+    }
+
+    public static File getPictureFileByUrl(String dataUrl) throws IOException {
+
+        URL url = new URL(dataUrl);  //想要读取的url地址
+        InputStream in = url.openStream();
+        File file = File.createTempFile("new_url", ".jpg");  //创建文件
+        OutputStream os = new FileOutputStream(file);  //创建文件输出流
+        int bytesRead;
+        byte[] buffer = new byte[8192];
+        int len = 8192;
+        while ((bytesRead = in.read(buffer, 0, len)) != -1) {
+            os.write(buffer, 0, bytesRead);
+        }
+        //关闭释放流
+        os.close();
+        in.close();
+        return file;
+    }
+
+    public String getPath(String url) {
+        return getStaticPath(COMMON_FILE) + url;
+    }
+
+    public String getDirectoryName() {
+        return DateUtils.getNowTimeFormat("yyyyMMdd");
+    }
+
+    public String getSavePath(String directoryName) {
+        return getStaticPath(COMMON_FILE) + FILE_SEPARATOR + directoryName + FILE_SEPARATOR;
+    }
+
+    public String createDirectory() {
+        String directoryName = this.getDirectoryName();
+        String savePath = this.getSavePath(directoryName);
+        File directory = new File(savePath);
+        if (!directory.exists()) {
+            directory.mkdir();
+        }
+        return directoryName;
+    }
+
+    public String createRandomDirectory() {
+        String directoryName = IdUtil.simpleUUID();
+        String savePath = this.getSavePath(directoryName);
+        File directory = new File(savePath);
+        if (!directory.exists()) {
+            directory.mkdir();
+        }
+        return directoryName;
+    }
+
+    public static FileInputStream byteToFile(byte[] bytes) {
+        String fileName = IdUtil.simpleUUID() + ".png";
+        File file = new File(fileName);
+        FileInputStream fileInputStream = null;
+        try {
+            OutputStream output = new FileOutputStream(file);
+            BufferedOutputStream bufferedOutput = new BufferedOutputStream(output);
+            bufferedOutput.write(bytes);
+            fileInputStream = new FileInputStream(file);
+            file.deleteOnExit();
+            return fileInputStream;
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return fileInputStream;
+    }
+
+    public String getTempPath(String fileName) {
+        String tempPath = getStaticPath(COMMON_FILE) + FILE_SEPARATOR + "temp";
+        File file = new File(tempPath);
+        if (!file.exists()) {
+            file.mkdir();
+        }
+        return tempPath + FILE_SEPARATOR + fileName;
+    }
+
+    public String getDirectory(String fileName) {
+        return FILE_SEPARATOR + this.createDirectory() + FILE_SEPARATOR + fileName;
+    }
+
+    public String getSystemPath(String url) {
+        return getStaticPath(COMMON_FILE) + FILE_SEPARATOR + url;
+    }
+
+    public static String getSystemPath2(String url) {
+        return getStaticPath(COMMON_FILE) + FILE_SEPARATOR + url;
+    }
+
+    public static void writeFile(String json, String FilePath) {
+
+        try {
+            File file = new File(FilePath);
+
+            // if file doesnt exists, then create it
+            if (!file.exists()) {
+                file.createNewFile();
+            } else {
+                file.delete();
+                file.createNewFile();
+            }
+
+            // true = append file
+            FileWriter fileWritter = new FileWriter(file, false);
+            BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
+            bufferWritter.write(json);
+            bufferWritter.close();
+
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static File getFileByName(File file, String name) {
+        for (File file1 : file.listFiles()) {
+            if (file1.getName().equals(name)) {
+                return file1;
+            }
+        }
+        return null;
+    }
+
+
+    public static void writeFile(Object object, File file) {
+        String json = JSON.toJSONString(object);
+        try {
+            // if file doesnt exists, then create it
+            if (!file.exists()) {
+                file.createNewFile();
+            } else {
+                file.delete();
+                file.createNewFile();
+            }
+            // true = append file
+            FileWriter fileWritter = new FileWriter(file, false);
+            BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
+            bufferWritter.write(json);
+            bufferWritter.close();
+
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static File multipartFileToFile(MultipartFile file) throws Exception {
+        File toFile = null;
+        if (file == null || file.equals("") || file.getSize() <= 0) {
+            file = null;
+        } else {
+            InputStream ins = null;
+            ins = file.getInputStream();
+            toFile = new File(file.getOriginalFilename());
+            inputStreamToFile(ins, toFile);
+            ins.close();
+        }
+        return toFile;
+    }
+
+    //获取流文件
+    private static void inputStreamToFile(InputStream ins, File file) {
+        try {
+            OutputStream os = new FileOutputStream(file);
+            int bytesRead = 0;
+            byte[] buffer = new byte[8192];
+            while ((bytesRead = ins.read(buffer, 0, 8192)) != -1) {
+                os.write(buffer, 0, bytesRead);
+            }
+            os.close();
+            ins.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static File createTempFileByName(String fileName) {
+        // 选择目标目录(这里使用系统临时目录)
+        String tempDir = System.getProperty("java.io.tmpdir");
+
+        // 拼接完整的文件路径
+        File tempFile = new File(tempDir, fileName);
+
+        try {
+            // 尝试创建文件(如果文件已存在,则创建失败并抛出异常)
+            boolean created = tempFile.createNewFile();
+
+            if (created) {
+                // 文件创建成功
+                System.out.println("File created at: " + tempFile.getAbsolutePath());
+
+                // ... 在这里可以对文件进行读写操作 ...
+
+                // 注意:通常你不会希望立即删除这个文件,因为它可能是你需要的临时数据
+                // 但如果你确实想要在某个时刻删除它,可以调用 tempFile.delete()
+            } else {
+                // 文件创建失败(可能已经存在)
+                System.out.println("File already exists: " + tempFile.getAbsolutePath());
+
+                // 处理文件已存在的情况(例如,生成一个新的唯一名称或覆盖现有文件)
+                // 注意:覆盖现有文件可能会导致数据丢失,因此请谨慎操作
+            }
+        } catch (IOException e) {
+            // 处理文件创建过程中的异常(例如,权限问题)
+            e.printStackTrace();
+        }
+        return tempFile;
+    }
+}

+ 33 - 0
src/main/java/cn/cslg/pas/common/utils/FileUtils.java

@@ -303,4 +303,37 @@ public class FileUtils {
             e.printStackTrace();
         }
     }
+
+    public static File createTempFileByName(String fileName) {
+        // 选择目标目录(这里使用系统临时目录)
+        String tempDir = System.getProperty("java.io.tmpdir");
+
+        // 拼接完整的文件路径
+        File tempFile = new File(tempDir, fileName);
+
+        try {
+            // 尝试创建文件(如果文件已存在,则创建失败并抛出异常)
+            boolean created = tempFile.createNewFile();
+
+            if (created) {
+                // 文件创建成功
+                System.out.println("File created at: " + tempFile.getAbsolutePath());
+
+                // ... 在这里可以对文件进行读写操作 ...
+
+                // 注意:通常你不会希望立即删除这个文件,因为它可能是你需要的临时数据
+                // 但如果你确实想要在某个时刻删除它,可以调用 tempFile.delete()
+            } else {
+                // 文件创建失败(可能已经存在)
+                System.out.println("File already exists: " + tempFile.getAbsolutePath());
+
+                // 处理文件已存在的情况(例如,生成一个新的唯一名称或覆盖现有文件)
+                // 注意:覆盖现有文件可能会导致数据丢失,因此请谨慎操作
+            }
+        } catch (IOException e) {
+            // 处理文件创建过程中的异常(例如,权限问题)
+            e.printStackTrace();
+        }
+        return tempFile;
+    }
 }

+ 1 - 0
src/main/java/cn/cslg/pas/common/vo/PersonSelfFieldVO.java

@@ -36,5 +36,6 @@ public class PersonSelfFieldVO {
     private Boolean ifSort=true;
     private Boolean ifNotOrder;
     private Boolean editable;
+    private Boolean isExport;
 
 }

+ 2 - 1
src/main/java/cn/cslg/pas/common/vo/business/AssoTaskFileVO.java

@@ -25,7 +25,7 @@ public class AssoTaskFileVO {
      */
     private String fileGuid;
 
-    private String fileName;
+    private String originalName;
 
     private String fileType;
 
@@ -44,4 +44,5 @@ public class AssoTaskFileVO {
      * 创建时间
      */
     private Date createTime;
+    private String createName;
 }

+ 5 - 3
src/main/java/cn/cslg/pas/common/vo/business/PatentDigProjectFilesVO.java

@@ -85,9 +85,11 @@ public class PatentDigProjectFilesVO {
 
     /**
      * 来源:1 PatentDigProjectFiles
-     *      2 AssoHandleResultFile
-     *      3 AssoProjectFile
-     *      4 AssoTaskFile
+     * 2 AssoHandleResultFile
+     * 3 AssoProjectFile
+     * 4 AssoTaskFile
      */
     private Integer source;
+    private String handleResult;
+    private Integer status;
 }

+ 1 - 0
src/main/java/cn/cslg/pas/controller/PatentDigProjectController.java

@@ -40,6 +40,7 @@ public class PatentDigProjectController {
     @Autowired
     private BusinessFactory businessFactory;
 
+
     @Operation(summary = "查询专利挖掘项目")
     @PostMapping("/queryPatentDigProject")
     public Response queryPatentDigProject(@RequestBody StringRequest stringRequest) throws Exception {

+ 1 - 2
src/main/java/cn/cslg/pas/controller/PatentDigProjectFilesController.java

@@ -33,7 +33,6 @@ import java.util.Map;
 public class PatentDigProjectFilesController {
     @Autowired
     private BusinessFactory businessFactory;
-
     @Autowired
     private PatentDigProjectFilesService patentDigProjectFilesService;
 
@@ -72,7 +71,7 @@ public class PatentDigProjectFilesController {
 
     @Operation(summary = "上传文件后的提交审核")
     @PostMapping("/addPDProjectFilesTask")
-    public Response addPDProjectFilesTask(@RequestBody PatentDigProjectFilesDTO patentDigProjectFilesDTO){
+    public Response addPDProjectFilesTask(@RequestBody PatentDigProjectFilesDTO patentDigProjectFilesDTO) throws Exception{
         Integer taskId = patentDigProjectFilesService.addPDProjectFilesTask(patentDigProjectFilesDTO);
         return Response.success(taskId);
     }

+ 9 - 0
src/main/java/cn/cslg/pas/controller/PersonFieldController.java

@@ -63,6 +63,15 @@ public class PersonFieldController {
         return Response.success(records);
     }
 
+    @Operation(summary = "获得表格导出栏位")
+    @PostMapping("/getTableExportColumns")
+    public Response getTableExportColumns(@RequestBody GetTabelColumDTO getTabelColumDTO) throws Exception {
+        List<PersonSelfFieldVO> personSelfFieldVOS = personFieldService.getTableExportColumns(getTabelColumDTO);
+        Records records = new Records();
+        records.setData(personSelfFieldVOS);
+        return Response.success(records);
+    }
+
     @Operation(summary = "获得所有统计栏位")
     @PostMapping("/getAllCountColumns")
     public Response getAllCountColumns(@RequestBody GetAllPatentCountDTO getAllPatentCountDTO) throws Exception {

+ 1 - 1
src/main/java/cn/cslg/pas/controller/novelty/NoveltyReportReferenceController.java

@@ -35,7 +35,7 @@ public class NoveltyReportReferenceController {
     @Operation(summary = "添加或编辑查新报告文档")
     @PostMapping("/edit")
     public Response edit(@RequestBody NoveltyReportReferenceDTO noveltyCompareRecordDTO)throws Exception{
-      Integer id=  noveltyReportReferencesService.addOrUpdate(noveltyCompareRecordDTO);
+      Integer id=  noveltyReportReferencesService.addOrUpdate2(noveltyCompareRecordDTO);
         return Response.success(id);
     }
 

+ 74 - 0
src/main/java/cn/cslg/pas/controller/projectTask/ExamineController.java

@@ -0,0 +1,74 @@
+package cn.cslg.pas.controller.projectTask;
+
+import cn.cslg.pas.common.core.base.Constants;
+import cn.cslg.pas.common.dto.business.*;
+import cn.cslg.pas.common.model.cronModel.Records;
+import cn.cslg.pas.common.model.projectTask.*;
+import cn.cslg.pas.common.model.request.StringRequest;
+import cn.cslg.pas.common.utils.Response;
+import cn.cslg.pas.common.vo.business.AssoTaskFileVO;
+import cn.cslg.pas.common.vo.business.GetHandleResultFileVO;
+import cn.cslg.pas.common.vo.business.TaskDetailsVO;
+import cn.cslg.pas.factorys.businessFactory.Business;
+import cn.cslg.pas.factorys.businessFactory.BusinessFactory;
+import cn.cslg.pas.service.business.AssoTaskFileService;
+import cn.cslg.pas.service.business.ProjectTaskService;
+import cn.cslg.pas.service.business.TaskHandleResultService;
+import io.swagger.v3.oas.annotations.Operation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * 项目任务的Controller层
+ *
+ * @Author xiexiang
+ * @Date 2023/11/22
+ */
+@Slf4j
+@RequestMapping(Constants.API_XiaoSHI + "/examine")
+@RestController
+public class ExamineController {
+    @Autowired
+    private ProjectTaskService projectTaskService;
+
+    @Autowired
+    private AssoTaskFileService assoTaskFileService;
+    @Autowired
+    private TaskHandleResultService taskHandleResultService;
+
+    @Operation(summary = "添加文件审核任务")
+    @PostMapping("/addFileExamineTask")
+    public Response addFileExamineTask(@RequestBody AddFileExamineTaskDTO addFileExamineTaskDTO) {
+         addFileExamineTaskDTO.getTaskForm().setTaskType(7);
+        Integer id = projectTaskService.addFileExamineTask(addFileExamineTaskDTO);
+        return Response.success(id);
+    }
+
+    @Operation(summary = "获取审核信息")
+    @PostMapping("/getExamineMessage")
+    public Response getExamineMessage(@RequestBody GetExamineMessageDTO getExamineMessageDTO) throws IOException {
+        Integer taskId = getExamineMessageDTO.getTaskId();
+        List<AssoTaskFileVO> assoTaskFiles = assoTaskFileService.getAssoTaskFile(taskId);
+        return Response.success(assoTaskFiles);
+    }
+
+    @Operation(summary = "获取审核历史")
+    @PostMapping("/getExamineHistory")
+    public Response getExamineHistory(@RequestBody GetExamineHistoryDTO getExamineHistoryDTO) throws IOException {
+        List<TaskResultVO> taskResultVOs = projectTaskService.getExamineHistory(getExamineHistoryDTO);
+        return Response.success(taskResultVOs);
+    }
+
+    @Operation(summary = "提交结果")
+    @PostMapping("/submitResult")
+    public Response submitResult(@RequestBody SubmitResultDTO submitResultDTO) throws Exception {
+        Integer id = taskHandleResultService.addTaskAuditResult(submitResultDTO);
+        return Response.success(id);
+    }
+
+
+}

+ 2 - 2
src/main/java/cn/cslg/pas/controller/report/MatchCasePersonController.java

@@ -55,8 +55,8 @@ public class MatchCasePersonController {
     @Operation(summary = "查询配案人员信息")
     @PostMapping("/query")
     public Response query(@RequestBody QueryMatchCasePersonDTO queryMatchCasePersonDTO) {
-        QueryMatchCasePersonVO queryMatchCasePersonVO = matchCasePersonService.getReportMatchCasePerson(queryMatchCasePersonDTO.getReportId());
-        return Response.success(queryMatchCasePersonVO);
+        List<QueryMatchCasePersonVO> queryMatchCasePersonVOS = matchCasePersonService.getReportMatchCasePerson(queryMatchCasePersonDTO.getReportId());
+        return Response.success(queryMatchCasePersonVOS);
 
     }
 }

+ 2 - 1
src/main/java/cn/cslg/pas/domain/business/AssoHandleResultFile.java

@@ -39,5 +39,6 @@ public class AssoHandleResultFile extends BaseEntity<AssoHandleResultFile> {
      */
     @TableField(value = "create_time")
     private Date createTime;
-
+    @TableField(value = "root_file_guid")
+    private String rootFileGuid;
 }

+ 2 - 0
src/main/java/cn/cslg/pas/domain/business/AssoTaskFile.java

@@ -26,6 +26,8 @@ public class AssoTaskFile extends BaseEntity<AssoTaskFile> {
      */
     @TableField(value = "file_guid")
     private String fileGuid;
+    @TableField(value = "root_file_guid")
+    private String rootFileGuid;
 
     /**
      * 说明

+ 2 - 0
src/main/java/cn/cslg/pas/domain/business/PatentDigProjectFiles.java

@@ -85,5 +85,7 @@ public class PatentDigProjectFiles extends BaseEntity<PatentDigProjectFiles> {
      */
     @TableField(value = "create_time")
     private Date createTime;
+    @TableField(value = "handle_result")
+    private String handleResult;
 
 }

+ 200 - 0
src/main/java/cn/cslg/pas/factorys/noveltyTemplateFacotry/GetCommonTempalte.java

@@ -0,0 +1,200 @@
+package cn.cslg.pas.factorys.noveltyTemplateFacotry;
+
+import cn.cslg.pas.common.model.cronModel.PersonnelVO;
+import cn.cslg.pas.common.model.cronModel.SystemFile;
+import cn.cslg.pas.common.utils.DateUtils;
+import cn.cslg.pas.common.utils.StringUtils;
+import cn.cslg.pas.common.vo.CompareLiteratureVO;
+import cn.cslg.pas.common.vo.NoveltyProjectVO.NoveltyCompareRecordQueryVO;
+import cn.cslg.pas.common.vo.NoveltyProjectVO.NoveltyCompareRecordVO;
+import cn.cslg.pas.common.vo.NoveltyProjectVO.RetrieveRecordVO;
+import cn.cslg.pas.common.vo.QueryNoveltyProjectVO;
+import cn.cslg.pas.common.vo.TechnicalCaseVO;
+import cn.cslg.pas.domain.es.PatentClassify;
+import cn.cslg.pas.domain.es.PatentPerson;
+import cn.cslg.pas.factorys.PatentExportFactory.GetValueImp;
+import cn.cslg.pas.service.novelty.NoveltySearchRecordService;
+import com.alibaba.fastjson.JSONObject;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.lang.reflect.Field;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * @Author lrj
+ * @Date 2025/02/20
+ */
+@Component
+public class GetCommonTempalte implements GetTemplateMapsImp {
+    public Map<String, Object> getMap(List<QueryNoveltyProjectVO> queryNoveltyProjectVOs, TechnicalCaseVO technicalCaseVO, List<CompareLiteratureVO> compareLiteratureVOS, List<NoveltyCompareRecordQueryVO> noveltyCompareRecordQueryVOS, List<RetrieveRecordVO> retrieveRecordVOS, PersonnelVO personnelVO) {
+        Map<String, Object> map = new HashMap<>();
+        Map<String, Object> baseMap = this.getBaseMap(queryNoveltyProjectVOs, retrieveRecordVOS, personnelVO);
+        Map<String, Object> technicalCaseMap = this.getTechnicalCaseMap(technicalCaseVO);
+        List<Map<String, Object>> compareLiteratureMap = this.getCompareLiteratureMap(compareLiteratureVOS);
+        List<Map<String, Object>> compareRecordMap = this.getCompareRecordMap(noveltyCompareRecordQueryVOS, compareLiteratureVOS);
+        List<Map<String, Object>> searchRecordMap = this.getSearchRecordMap(retrieveRecordVOS);
+        map.put("baseMessage", baseMap);
+        map.put("technicalCase", technicalCaseMap);
+        map.put("compareLiterature", compareLiteratureMap);
+        map.put("compareRecord", compareRecordMap);
+        map.put("searchRecord", searchRecordMap);
+        return map;
+    }
+
+    @Override
+    public Map<String, Object> getTechnicalCaseMap(TechnicalCaseVO technicalCaseVO) {
+        Map<String, Object> technicalMap = new HashMap<>();
+        technicalMap.put("inventionPoint", technicalCaseVO.getInventionPoint());
+        List<SystemFile> systemFileList = technicalCaseVO.getSystemFileList();
+        if (systemFileList != null && systemFileList.size() != 0) {
+            List<String> fileGuids = systemFileList.stream().map(SystemFile::getGuid).collect(Collectors.toList());
+            technicalMap.put("picture", fileGuids);
+        }
+        return technicalMap;
+    }
+
+    @Override
+    public Map<String, Object> getBaseMap(List<QueryNoveltyProjectVO> queryNoveltyProjectVOs, List<RetrieveRecordVO> retrieveRecordVOS, PersonnelVO personnelVO) {
+        Map<String, Object> baseMap = new HashMap<>();
+        if (queryNoveltyProjectVOs == null || queryNoveltyProjectVOs.size() == 0) {
+            return baseMap;
+        }
+        QueryNoveltyProjectVO queryNoveltyProjectVO = queryNoveltyProjectVOs.get(0);
+        baseMap.put("searchUnitContact", queryNoveltyProjectVO.getSearchUnitContact());
+        baseMap.put("applicants", queryNoveltyProjectVO.getApplicants());
+        baseMap.put("customCaseNumber", queryNoveltyProjectVO.getCustomCaseNumber());
+        baseMap.put("caseName", queryNoveltyProjectVO.getCaseName());
+        baseMap.put("technicalContact", queryNoveltyProjectVO.getTechnicalContact());
+        baseMap.put("searchUnit", queryNoveltyProjectVO.getSearchUnit());
+
+        baseMap.put("inventor", queryNoveltyProjectVO.getInventor());
+        baseMap.put("inventorContact", "");
+        baseMap.put("distinguishTechnical", "");
+        baseMap.put("remark", queryNoveltyProjectVO.getRemark());
+        baseMap.put("analyse", "");
+        baseMap.put("preliminaryConclusions", queryNoveltyProjectVO.getPreliminaryConclusions());
+        baseMap.put("applicationAdvice", queryNoveltyProjectVO.getApplicationAdvice());
+        baseMap.put("finalConclusions", NoveltyTempalteUtil.reFinalConclusions(Arrays.asList(queryNoveltyProjectVO.getPreliminaryConclusions(), queryNoveltyProjectVO.getApplicationAdvice())));
+        if (retrieveRecordVOS != null && retrieveRecordVOS.size() > 0) {
+            RetrieveRecordVO retrieveRecordVO = retrieveRecordVOS.get(retrieveRecordVOS.size() - 1);
+            Date date = retrieveRecordVO.getRetrieveTime();
+            if (date != null) {
+                String dateStr = DateUtils.formatDate(date, "yyyy-MM-dd");
+                baseMap.put("searchTime", dateStr);
+            }
+            if (queryNoveltyProjectVO.getSearchUnit() == null || queryNoveltyProjectVO.getSearchUnit().trim().equals("")) {
+                baseMap.put("searchUnit", personnelVO.getTenantName());
+            }
+        }
+        return baseMap;
+    }
+
+    @Override
+    public List<Map<String, Object>> getCompareLiteratureMap(List<CompareLiteratureVO> compareLiteratureVOS) {
+        List<Map<String, Object>> maps = new ArrayList<>();
+        if (compareLiteratureVOS != null) {
+            List<String> patentNos = compareLiteratureVOS.stream().map(CompareLiteratureVO::getLiteratureNo).collect(Collectors.toList());
+            patentNos.forEach(item -> {
+                Map<String, Object> map = new HashMap<>();
+                map.put("patentNo", item);
+                maps.add(map);
+            });
+        }
+        return maps;
+    }
+
+    @Override
+    public List<Map<String, Object>> getCompareRecordMap(List<NoveltyCompareRecordQueryVO> noveltyCompareRecordQueryVOs, List<CompareLiteratureVO> compareLiteratureVOS) {
+        List<Map<String, Object>> maps = new ArrayList<>();
+
+        if (compareLiteratureVOS == null || compareLiteratureVOS.size() == 0) {
+            return maps;
+        }
+        Integer index = 1;
+        for (CompareLiteratureVO compareLiteratureVO : compareLiteratureVOS) {
+            String patentNo = compareLiteratureVO.getLiteratureNo();
+            Map<String, Object> map = new HashMap<>();
+            map.put("index", index);
+            map.put("publicNo", compareLiteratureVO.getPublicNo());
+            List<PatentPerson> patentPeople = compareLiteratureVO.getApplicant();
+
+            if (patentPeople != null && patentPeople.size() > 0) {
+                List<String> names = patentPeople.stream().map(PatentPerson::getName).collect(Collectors.toList());
+                String nameStr = StringUtils.join(names, "、");
+                map.put("applicant", nameStr);
+            }
+
+            Integer temIndex = 1;
+            List<String> contentList = new ArrayList<>();
+            List<NoveltyCompareRecordVO> noveltyCompareRecordVOS = compareLiteratureVO.getNoveltyCompareRecordVOS();
+            if (noveltyCompareRecordVOS != null) {
+                for (NoveltyCompareRecordVO item : noveltyCompareRecordVOS) {
+                    String markText = item.getMarkNoteText();
+                    if (markText != null && !markText.trim().equals("")) {
+                        markText = (temIndex) + "、" + markText;
+                        contentList.add(markText);
+                        temIndex++;
+                    }
+                }
+            }
+
+            List<NoveltyCompareRecordQueryVO> tempRecordVos = noveltyCompareRecordQueryVOs.stream().filter(item -> item.getPatentNo().equals(patentNo)).collect(Collectors.toList());
+            if (tempRecordVos != null && tempRecordVos.size() != 0) {
+                for (int i = 0; i < tempRecordVos.size(); i++) {
+                    NoveltyCompareRecordQueryVO vo = tempRecordVos.get(i);
+                    String markSelectField = vo.getMarkSelectField();
+                    String markSelectText = vo.getMarkSelectText();
+                    String technicalFeature = vo.getTechnicalFeature();
+                    String markNoteText = vo.getMarkNoteText();
+                    StringBuilder stringBuilder = new StringBuilder();
+                    stringBuilder.append(temIndex + "、");
+                    stringBuilder.append(markSelectField);
+                    stringBuilder.append(markSelectText);
+                    if (technicalFeature != null && !technicalFeature.trim().equals("")) {
+                        stringBuilder.append("揭示了" + technicalFeature);
+                    }
+                    stringBuilder.append(markNoteText);
+                    contentList.add(stringBuilder.toString());
+                    temIndex++;
+                }
+
+            }
+            if (contentList.size() > 0) {
+                String content = StringUtils.join(contentList, "<br>");
+                map.put("content", content);
+            }
+            maps.add(map);
+            index++;
+        }
+
+
+        return maps;
+    }
+
+    @Override
+    public List<Map<String, Object>> getSearchRecordMap(List<RetrieveRecordVO> retrieveRecordVOS) {
+        List<Map<String, Object>> maps = new ArrayList<>();
+        if (retrieveRecordVOS != null) {
+            retrieveRecordVOS.forEach(item -> {
+                Map<String, Object> map = new HashMap<>();
+                map.put("conditions", item.getConditions());
+                String dbType = item.getDbType();
+                if (dbType == null || dbType.trim().equals("")) {
+                    dbType = "小世系统";
+                }
+                String re = NoveltyTempalteUtil.getDbTypes(dbType);
+                if (re == null) {
+                    re = "";
+                }
+                map.put("area", re);
+                map.put("dbType", dbType);
+                map.put("totalNum", item.getTotalNum());
+
+                maps.add(map);
+            });
+        }
+        return maps;
+    }
+}

+ 224 - 0
src/main/java/cn/cslg/pas/factorys/noveltyTemplateFacotry/GetDahuaTempalte.java

@@ -0,0 +1,224 @@
+package cn.cslg.pas.factorys.noveltyTemplateFacotry;
+
+import cn.cslg.pas.common.model.cronModel.PersonnelVO;
+import cn.cslg.pas.common.model.cronModel.SystemFile;
+import cn.cslg.pas.common.utils.DateUtils;
+import cn.cslg.pas.common.utils.StringUtils;
+import cn.cslg.pas.common.vo.CompareLiteratureVO;
+import cn.cslg.pas.common.vo.NoveltyProjectVO.NoveltyCompareRecordQueryVO;
+import cn.cslg.pas.common.vo.NoveltyProjectVO.NoveltyCompareRecordVO;
+import cn.cslg.pas.common.vo.NoveltyProjectVO.RetrieveRecordVO;
+import cn.cslg.pas.common.vo.QueryNoveltyProjectVO;
+import cn.cslg.pas.common.vo.TechnicalCaseVO;
+import cn.cslg.pas.domain.es.Patent;
+import cn.cslg.pas.domain.es.PatentPerson;
+import cn.cslg.pas.service.business.es.EsPatentService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * @Author lrj
+ * @Date 2025/02/20
+ */
+@Component
+public class GetDahuaTempalte implements GetTemplateMapsImp {
+    @Autowired
+    private EsPatentService esPatentService;
+
+    @Override
+    public Map<String, Object> getMap(List<QueryNoveltyProjectVO> queryNoveltyProjectVOs, TechnicalCaseVO technicalCaseVO, List<CompareLiteratureVO> compareLiteratureVOS, List<NoveltyCompareRecordQueryVO> noveltyCompareRecordQueryVOS, List<RetrieveRecordVO> retrieveRecordVOS, PersonnelVO personnelVO) {
+        Map<String, Object> map = new HashMap<>();
+        Map<String, Object> baseMap = this.getBaseMap(queryNoveltyProjectVOs, retrieveRecordVOS,personnelVO);
+        Map<String, Object> technicalCaseMap = this.getTechnicalCaseMap(technicalCaseVO);
+        List<Map<String, Object>> compareLiteratureMap = this.getCompareLiteratureMap(compareLiteratureVOS);
+        List<Map<String, Object>> compareRecordMap = this.getCompareRecordMap(noveltyCompareRecordQueryVOS, compareLiteratureVOS);
+        List<Map<String, Object>> searchRecordMap = this.getSearchRecordMap(retrieveRecordVOS);
+        map.put("baseMessage", baseMap);
+        map.put("technicalCase", technicalCaseMap);
+        map.put("compareLiterature", compareLiteratureMap);
+        map.put("compareRecord", compareRecordMap);
+        map.put("searchRecord", searchRecordMap);
+        return map;
+    }
+
+    @Override
+    public Map<String, Object> getTechnicalCaseMap(TechnicalCaseVO technicalCaseVO) {
+        Map<String, Object> technicalMap = new HashMap<>();
+        technicalMap.put("inventionPoint", technicalCaseVO.getInventionPoint());
+        List<SystemFile> systemFileList = technicalCaseVO.getSystemFileList();
+        if (systemFileList != null && systemFileList.size() != 0) {
+            List<String> fileGuids = systemFileList.stream().map(SystemFile::getGuid).collect(Collectors.toList());
+            technicalMap.put("picture", fileGuids);
+        }
+        technicalMap.put("remark", technicalCaseVO.getRemark());
+        return technicalMap;
+    }
+
+    @Override
+    public Map<String, Object> getBaseMap(List<QueryNoveltyProjectVO> queryNoveltyProjectVOs,List<RetrieveRecordVO> retrieveRecordVOS,PersonnelVO personnelVO) {
+        Map<String, Object> baseMap = new HashMap<>();
+        if (queryNoveltyProjectVOs == null || queryNoveltyProjectVOs.size() == 0) {
+            return baseMap;
+        }
+        QueryNoveltyProjectVO queryNoveltyProjectVO = queryNoveltyProjectVOs.get(0);
+        baseMap.put("searchUnitContact", queryNoveltyProjectVO.getSearchUnitContact());
+        baseMap.put("applicants", queryNoveltyProjectVO.getApplicants());
+        baseMap.put("customCaseNumber", queryNoveltyProjectVO.getCustomCaseNumber());
+        baseMap.put("caseName", queryNoveltyProjectVO.getCaseName());
+        baseMap.put("technicalContact", queryNoveltyProjectVO.getTechnicalContact());
+        baseMap.put("searchUnit", queryNoveltyProjectVO.getSearchUnit());
+
+        baseMap.put("inventor", queryNoveltyProjectVO.getInventor());
+        baseMap.put("inventorContact", "");
+        baseMap.put("distinguishTechnical", "");
+        baseMap.put("remark", queryNoveltyProjectVO.getRemark());
+        baseMap.put("analyse", "");
+        baseMap.put("preliminaryConclusions", queryNoveltyProjectVO.getPreliminaryConclusions());
+        baseMap.put("applicationAdvice", queryNoveltyProjectVO.getApplicationAdvice());
+        baseMap.put("finalConclusions", NoveltyTempalteUtil.reFinalConclusions(Arrays.asList(queryNoveltyProjectVO.getPreliminaryConclusions(), queryNoveltyProjectVO.getApplicationAdvice())));
+        baseMap.put("ifPatentability", "是");
+        baseMap.put("ipr", queryNoveltyProjectVO.getIpr());
+        if (queryNoveltyProjectVO.getHeadName() != null) {
+            baseMap.put("searchName", queryNoveltyProjectVO.getHeadName());
+        } else if (queryNoveltyProjectVO.getCreateName() != null) {
+            baseMap.put("searchName", queryNoveltyProjectVO.getCreateName());
+        }
+        if (retrieveRecordVOS != null && retrieveRecordVOS.size() > 0) {
+            RetrieveRecordVO retrieveRecordVO = retrieveRecordVOS.get(retrieveRecordVOS.size() - 1);
+            Date date = retrieveRecordVO.getRetrieveTime();
+            if (date != null) {
+                String dateStr = DateUtils.formatDate(date, "yyyy-MM-dd");
+                baseMap.put("searchTime", dateStr);
+            }
+            if (queryNoveltyProjectVO.getSearchUnit() == null || queryNoveltyProjectVO.getSearchUnit().trim().equals("")) {
+                baseMap.put("searchUnit", personnelVO.getTenantName());
+            }
+        }
+        return baseMap;
+    }
+
+    @Override
+    public List<Map<String, Object>> getCompareLiteratureMap(List<CompareLiteratureVO> compareLiteratureVOS) {
+        List<Map<String, Object>> maps = new ArrayList<>();
+
+        if (compareLiteratureVOS != null) {
+
+            int index = 1;
+            for (CompareLiteratureVO compareLiteratureVO : compareLiteratureVOS) {
+                String no = compareLiteratureVO.getLiteratureNo();
+                String name = compareLiteratureVO.getName();
+                String content = "对比文件" + index + ":" + no + "-" + name;
+                Map<String, Object> map = new HashMap<>();
+                map.put("content", content);
+                maps.add(map);
+                index++;
+            }
+        }
+        return maps;
+    }
+
+    @Override
+    public List<Map<String, Object>> getCompareRecordMap(List<NoveltyCompareRecordQueryVO> noveltyCompareRecordQueryVOs, List<CompareLiteratureVO> compareLiteratureVOS) {
+        List<Map<String, Object>> maps = new ArrayList<>();
+
+        if (compareLiteratureVOS == null || compareLiteratureVOS.size() == 0) {
+            return maps;
+        }
+        List<String> patentNos = compareLiteratureVOS.stream().map(CompareLiteratureVO::getLiteratureNo).collect(Collectors.toList());
+        List<Patent> patents = new ArrayList<>();
+        try {
+            patents = esPatentService.getPatentsByNo(patentNos, false, null, null);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        Integer index = 1;
+        for (CompareLiteratureVO compareLiteratureVO : compareLiteratureVOS) {
+            String patentNo = compareLiteratureVO.getLiteratureNo();
+            Patent patent = patents.stream().filter(item -> item.getPatentNo().equals(patentNo)).findFirst().orElse(null);
+
+            Map<String, Object> map = new HashMap<>();
+            String name = compareLiteratureVO.getName();
+            String fileName = "对比文件" + index + ":" + patentNo + "-" + name + ":";
+            map.put("compareFile", fileName);
+
+            List<Map<String, Object>> compareMaps = new ArrayList<>();
+            List<NoveltyCompareRecordVO> noveltyCompareRecordVOS = compareLiteratureVO.getNoveltyCompareRecordVOS();
+
+            if (noveltyCompareRecordVOS != null) {
+
+                for (NoveltyCompareRecordVO item : noveltyCompareRecordVOS) {
+                    Map<String, Object> compareMap = new HashMap<>();
+                    String compareText = "";
+                    if (patent != null && patent.getAbstractStr() != null && patent.getAbstractStr().size() > 0) {
+                        compareText = "[摘要原文]" + patent.getAbstractStr().get(0).getTextContent();
+                    }
+                    compareMap.put("compareText", compareText);
+
+                    String markText = item.getMarkNoteText();
+                    if (markText != null && !markText.trim().equals("")) {
+                        compareMap.put("compareDescription", markText);
+                    }
+                    compareMaps.add(compareMap);
+                }
+            }
+
+            List<NoveltyCompareRecordQueryVO> tempRecordVos = noveltyCompareRecordQueryVOs.stream().filter(item -> item.getPatentNo().equals(patentNo)).collect(Collectors.toList());
+            if (tempRecordVos != null && tempRecordVos.size() != 0) {
+                for (int i = 0; i < tempRecordVos.size(); i++) {
+                    Map<String, Object> compareMap = new HashMap<>();
+                    NoveltyCompareRecordQueryVO vo = tempRecordVos.get(i);
+                    String markSelectField = vo.getMarkSelectField();
+                    String markSelectText = vo.getMarkSelectText();
+                    String technicalFeature = vo.getTechnicalFeature();
+                    String markNoteText = vo.getMarkNoteText();
+                    String compareText = "";
+                    compareText = "[" + markSelectField + "]" + markSelectText;
+                    compareMap.put("compareText", compareText);
+                    String compareDescription = markNoteText;
+                    if (technicalFeature != null && !technicalFeature.trim().equals("")) {
+                        compareDescription = compareDescription + "揭示了" + technicalFeature;
+                    }
+                    compareMap.put("compareDescription", compareDescription);
+                    compareMaps.add(compareMap);
+                }
+
+            }
+
+            map.put("compareRecord", compareMaps);
+            maps.add(map);
+            index++;
+        }
+
+
+        return maps;
+    }
+
+    @Override
+    public List<Map<String, Object>> getSearchRecordMap(List<RetrieveRecordVO> retrieveRecordVOS) {
+        List<Map<String, Object>> maps = new ArrayList<>();
+        if (retrieveRecordVOS != null) {
+            retrieveRecordVOS.forEach(item -> {
+                Map<String, Object> map = new HashMap<>();
+                map.put("searchCondition", item.getConditions());
+                String dbType = item.getDbType();
+                if (dbType == null || dbType.trim().equals("")) {
+                    dbType = "小世系统";
+                }
+                String re = NoveltyTempalteUtil.getDbTypes(dbType);
+                if (re == null) {
+                    re = "";
+                }
+                map.put("area", re);
+                map.put("dbType", dbType);
+                map.put("totalNum", item.getTotalNum());
+
+                maps.add(map);
+            });
+        }
+        return maps;
+    }
+}

+ 228 - 0
src/main/java/cn/cslg/pas/factorys/noveltyTemplateFacotry/GetShenNanTempalte.java

@@ -0,0 +1,228 @@
+package cn.cslg.pas.factorys.noveltyTemplateFacotry;
+
+import cn.cslg.pas.common.model.cronModel.PersonnelVO;
+import cn.cslg.pas.common.model.cronModel.SystemFile;
+import cn.cslg.pas.common.utils.DateUtils;
+import cn.cslg.pas.common.utils.StringUtils;
+import cn.cslg.pas.common.vo.CompareLiteratureVO;
+import cn.cslg.pas.common.vo.NoveltyProjectVO.NoveltyCompareRecordQueryVO;
+import cn.cslg.pas.common.vo.NoveltyProjectVO.NoveltyCompareRecordVO;
+import cn.cslg.pas.common.vo.NoveltyProjectVO.RetrieveRecordVO;
+import cn.cslg.pas.common.vo.QueryNoveltyProjectVO;
+import cn.cslg.pas.common.vo.TechnicalCaseVO;
+import cn.cslg.pas.domain.es.Patent;
+import cn.cslg.pas.domain.es.PatentPerson;
+import cn.cslg.pas.service.business.es.EsPatentService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * @Author lrj
+ * @Date 2025/02/20
+ */
+@Component
+public class GetShenNanTempalte implements GetTemplateMapsImp {
+    @Autowired
+    private EsPatentService esPatentService;
+    @Override
+    public  Map<String,Object> getMap(List<QueryNoveltyProjectVO> queryNoveltyProjectVOs,TechnicalCaseVO technicalCaseVO,List<CompareLiteratureVO> compareLiteratureVOS,List<NoveltyCompareRecordQueryVO> noveltyCompareRecordQueryVOS,List<RetrieveRecordVO> retrieveRecordVOS, PersonnelVO personnelVO){
+        Map<String,Object> map =new HashMap<>();
+        Map<String, Object> baseMap = this.getBaseMap(queryNoveltyProjectVOs, retrieveRecordVOS,personnelVO);
+        Map<String, Object> technicalCaseMap = this.getTechnicalCaseMap(technicalCaseVO);
+        List<Map<String, Object>> compareLiteratureMap = this.getCompareLiteratureMap(compareLiteratureVOS);
+        List<Map<String, Object>> compareRecordMap = this.getCompareRecordMap(noveltyCompareRecordQueryVOS, compareLiteratureVOS);
+        List<Map<String, Object>> searchRecordMap = this.getSearchRecordMap(retrieveRecordVOS);
+        map.put("baseMessage", baseMap);
+        map.put("technicalCase", technicalCaseMap);
+        map.put("compareLiterature", compareLiteratureMap);
+        map.put("compareRecord", compareRecordMap);
+        map.put("searchRecord", searchRecordMap);
+        return map;
+    }
+    @Override
+    public Map<String, Object> getTechnicalCaseMap(TechnicalCaseVO technicalCaseVO) {
+        Map<String, Object> technicalMap = new HashMap<>();
+        technicalMap.put("inventionPoint", technicalCaseVO.getInventionPoint());
+        List<SystemFile> systemFileList = technicalCaseVO.getSystemFileList();
+        if (systemFileList != null && systemFileList.size() != 0) {
+            List<String> fileGuids = systemFileList.stream().map(SystemFile::getGuid).collect(Collectors.toList());
+            technicalMap.put("picture", fileGuids);
+        }
+        return technicalMap;
+    }
+
+    @Override
+    public Map<String, Object> getBaseMap(List<QueryNoveltyProjectVO> queryNoveltyProjectVOs,List<RetrieveRecordVO> retrieveRecordVOS,PersonnelVO personnelVO) {
+        Map<String, Object> baseMap = new HashMap<>();
+        if (queryNoveltyProjectVOs == null || queryNoveltyProjectVOs.size() == 0) {
+            return baseMap;
+        }
+        QueryNoveltyProjectVO queryNoveltyProjectVO = queryNoveltyProjectVOs.get(0);
+        baseMap.put("searchUnitContact", queryNoveltyProjectVO.getSearchUnitContact());
+        baseMap.put("applicants", queryNoveltyProjectVO.getApplicants());
+        baseMap.put("customCaseNumber", queryNoveltyProjectVO.getCustomCaseNumber());
+        baseMap.put("caseName", queryNoveltyProjectVO.getCaseName());
+        baseMap.put("technicalContact", queryNoveltyProjectVO.getTechnicalContact());
+        baseMap.put("searchUnit", queryNoveltyProjectVO.getSearchUnit());
+
+        baseMap.put("inventor", queryNoveltyProjectVO.getInventor());
+        baseMap.put("inventorContact", "");
+        baseMap.put("distinguishTechnical", "");
+        baseMap.put("remark", queryNoveltyProjectVO.getRemark());
+        baseMap.put("analyse", "");
+        baseMap.put("preliminaryConclusions", queryNoveltyProjectVO.getPreliminaryConclusions());
+        baseMap.put("applicationAdvice", queryNoveltyProjectVO.getApplicationAdvice());
+        baseMap.put("conclusions", NoveltyTempalteUtil.reFinalConclusions(Arrays.asList(queryNoveltyProjectVO.getPreliminaryConclusions(), queryNoveltyProjectVO.getApplicationAdvice())));
+        baseMap.put("ifPatentability", "是");
+        baseMap.put("ipr", queryNoveltyProjectVO.getIpr());
+        if (queryNoveltyProjectVO.getHeadName() != null) {
+            baseMap.put("searchName", queryNoveltyProjectVO.getHeadName());
+        } else if (queryNoveltyProjectVO.getCreateName() != null) {
+            baseMap.put("searchName", queryNoveltyProjectVO.getCreateName());
+        }
+        if (retrieveRecordVOS != null && retrieveRecordVOS.size() > 0) {
+            RetrieveRecordVO retrieveRecordVO = retrieveRecordVOS.get(retrieveRecordVOS.size() - 1);
+            Date date = retrieveRecordVO.getRetrieveTime();
+            if (date != null) {
+                String dateStr = DateUtils.formatDate(date, "yyyy-MM-dd");
+                baseMap.put("searchTime", dateStr);
+            }
+            if (queryNoveltyProjectVO.getSearchUnit() == null || queryNoveltyProjectVO.getSearchUnit().trim().equals("")) {
+                baseMap.put("searchUnit", personnelVO.getTenantName());
+            }
+        }
+        return baseMap;
+    }
+
+    @Override
+    public List<Map<String, Object>> getCompareLiteratureMap(List<CompareLiteratureVO> compareLiteratureVOS) {
+        List<Map<String, Object>> maps = new ArrayList<>();
+
+        if (compareLiteratureVOS != null) {
+
+
+            int index = 1;
+            for (CompareLiteratureVO compareLiteratureVO : compareLiteratureVOS) {
+                String no = compareLiteratureVO.getLiteratureNo();
+                String name = compareLiteratureVO.getName();
+                String content = "对比文件" + index + ":" + no + "-" + name;
+                Map<String, Object> map = new HashMap<>();
+                map.put("content", content);
+                maps.add(map);
+                index++;
+            }
+        }
+        return maps;
+    }
+
+    @Override
+    public List<Map<String, Object>> getCompareRecordMap(List<NoveltyCompareRecordQueryVO> noveltyCompareRecordQueryVOs, List<CompareLiteratureVO> compareLiteratureVOS) {
+        List<Map<String, Object>> maps = new ArrayList<>();
+
+        if (compareLiteratureVOS == null || compareLiteratureVOS.size() == 0) {
+            return maps;
+        }
+        List<String> patentNos = compareLiteratureVOS.stream().map(CompareLiteratureVO::getLiteratureNo).collect(Collectors.toList());
+        List<Patent> patents = new ArrayList<>();
+        try {
+            patents = esPatentService.getPatentsByNo(patentNos, false, null, null);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        Integer index = 1;
+        for (CompareLiteratureVO compareLiteratureVO : compareLiteratureVOS) {
+            Map<String, Object> map = new HashMap<>();
+            String patentNo = compareLiteratureVO.getLiteratureNo();
+            StringBuilder str = new StringBuilder("对比文件");
+            str.append(index);
+            str.append(":");
+            str.append(patentNo);
+            String abstr = "";
+            Patent patent = patents.stream().filter(item -> item.getPatentNo().equals(patentNo)).findFirst().orElse(null);
+            if (patent != null && patent.getTitle() != null && patent.getTitle().size() != 0) {
+                str.append(patent.getTitle().get(0).getTextContent());
+            }
+            str.append("<br>");
+            if (patent != null && patent.getAbstractStr() != null && patent.getAbstractStr().size() > 0) {
+                abstr = "[摘要原文]" + patent.getAbstractStr().get(0).getTextContent();
+            }
+
+
+            List<String> contentList = new ArrayList<>();
+            List<NoveltyCompareRecordVO> noveltyCompareRecordVOS = compareLiteratureVO.getNoveltyCompareRecordVOS();
+            if (noveltyCompareRecordVOS != null) {
+                for (NoveltyCompareRecordVO item : noveltyCompareRecordVOS) {
+                    String markText = item.getMarkNoteText();
+                    String finText = abstr + "(" + markText + ")";
+                    contentList.add(finText);
+                }
+            }
+
+            List<NoveltyCompareRecordQueryVO> tempRecordVos = noveltyCompareRecordQueryVOs.stream().filter(item -> item.getPatentNo().equals(patentNo)).collect(Collectors.toList());
+            if (tempRecordVos != null && tempRecordVos.size() != 0) {
+                for (int i = 0; i < tempRecordVos.size(); i++) {
+                    NoveltyCompareRecordQueryVO vo = tempRecordVos.get(i);
+                    String markSelectField = vo.getMarkSelectField();
+                    String markSelectText = vo.getMarkSelectText();
+                    String technicalFeature = vo.getTechnicalFeature();
+                    String markNoteText = vo.getMarkNoteText();
+                    StringBuilder stringBuilder = new StringBuilder();
+
+                    stringBuilder.append("[" + markSelectField + "]");
+                    stringBuilder.append(markSelectText);
+                    if (technicalFeature != null && !technicalFeature.trim().equals("")) {
+                        stringBuilder.append("(揭示了" + technicalFeature+")");
+                    }
+                    stringBuilder.append(markNoteText);
+                    contentList.add(stringBuilder.toString());
+                }
+
+            }
+            String content = "";
+            if (contentList.size() > 0) {
+                content = StringUtils.join(contentList, "<br>");
+
+            }
+            str.append(content);
+            map.put("content", str);
+            maps.add(map);
+            index++;
+        }
+
+
+        return maps;
+    }
+
+    @Override
+    public List<Map<String, Object>> getSearchRecordMap(List<RetrieveRecordVO> retrieveRecordVOS) {
+        List<Map<String, Object>> maps = new ArrayList<>();
+        if (retrieveRecordVOS != null) {
+            retrieveRecordVOS.forEach(item -> {
+                Map<String, Object> map = new HashMap<>();
+                map.put("searchCondition", item.getConditions());
+                String dbType = item.getDbType();
+                if (dbType == null || dbType.trim().equals("")) {
+                    dbType = "小世系统";
+                }
+                String re = NoveltyTempalteUtil.getDbTypes(dbType);
+                if (re == null) {
+                    re = "";
+                }
+                map.put("area", re);
+                map.put("dbType", dbType);
+                map.put("totalNum", item.getTotalNum());
+                Date retrieveTime = item.getRetrieveTime();
+                if (retrieveTime != null) {
+                    String dateStr = DateUtils.formatDate(retrieveTime, "yyyy-MM-dd");
+                    map.put("retrieveTime", dateStr);
+                }
+                maps.add(map);
+            });
+        }
+        return maps;
+    }
+}

+ 25 - 0
src/main/java/cn/cslg/pas/factorys/noveltyTemplateFacotry/GetTemplateMapsImp.java

@@ -0,0 +1,25 @@
+package cn.cslg.pas.factorys.noveltyTemplateFacotry;
+
+
+import cn.cslg.pas.common.model.cronModel.PersonnelVO;
+import cn.cslg.pas.common.vo.CompareLiteratureVO;
+import cn.cslg.pas.common.vo.NoveltyProjectVO.NoveltyCompareRecordQueryVO;
+import cn.cslg.pas.common.vo.NoveltyProjectVO.RetrieveRecordVO;
+import cn.cslg.pas.common.vo.QueryNoveltyProjectVO;
+import cn.cslg.pas.common.vo.TechnicalCaseVO;
+
+import java.util.List;
+import java.util.Map;
+
+public interface GetTemplateMapsImp {
+    public  Map<String,Object> getMap(List<QueryNoveltyProjectVO> queryNoveltyProjectVOs, TechnicalCaseVO technicalCaseVO, List<CompareLiteratureVO> compareLiteratureVOS, List<NoveltyCompareRecordQueryVO> noveltyCompareRecordQueryVOS, List<RetrieveRecordVO> retrieveRecordVOS, PersonnelVO personnelVO);
+    public Map<String, Object> getTechnicalCaseMap(TechnicalCaseVO technicalCaseVO);
+
+    public Map<String, Object> getBaseMap(List<QueryNoveltyProjectVO> queryNoveltyProjectVOs,List<RetrieveRecordVO> retrieveRecordVOS,PersonnelVO personnelVO);
+
+    public List<Map<String, Object>> getCompareLiteratureMap(List<CompareLiteratureVO> compareLiteratureVOS);
+
+    public List<Map<String, Object>> getCompareRecordMap(List<NoveltyCompareRecordQueryVO> noveltyCompareRecordQueryVOs, List<CompareLiteratureVO> compareLiteratureVOS);
+
+    public List<Map<String, Object>> getSearchRecordMap(List<RetrieveRecordVO> retrieveRecordVOS);
+}

+ 226 - 0
src/main/java/cn/cslg/pas/factorys/noveltyTemplateFacotry/GetVisionoxTempalte.java

@@ -0,0 +1,226 @@
+package cn.cslg.pas.factorys.noveltyTemplateFacotry;
+
+import cn.cslg.pas.common.model.cronModel.PersonnelVO;
+import cn.cslg.pas.common.model.cronModel.SystemFile;
+import cn.cslg.pas.common.utils.DateUtils;
+import cn.cslg.pas.common.utils.StringUtils;
+import cn.cslg.pas.common.vo.CompareLiteratureVO;
+import cn.cslg.pas.common.vo.NoveltyProjectVO.NoveltyCompareRecordQueryVO;
+import cn.cslg.pas.common.vo.NoveltyProjectVO.NoveltyCompareRecordVO;
+import cn.cslg.pas.common.vo.NoveltyProjectVO.RetrieveRecordVO;
+import cn.cslg.pas.common.vo.QueryNoveltyProjectVO;
+import cn.cslg.pas.common.vo.TechnicalCaseVO;
+import cn.cslg.pas.domain.es.Patent;
+import cn.cslg.pas.domain.es.PatentPerson;
+import cn.cslg.pas.service.business.es.EsPatentService;
+import org.checkerframework.checker.units.qual.A;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * @Author lrj
+ * @Date 2025/02/20
+ */
+@Component
+public class GetVisionoxTempalte implements GetTemplateMapsImp {
+    @Autowired
+    private EsPatentService esPatentService;
+    @Override
+    public  Map<String,Object> getMap(List<QueryNoveltyProjectVO> queryNoveltyProjectVOs,TechnicalCaseVO technicalCaseVO,List<CompareLiteratureVO> compareLiteratureVOS,List<NoveltyCompareRecordQueryVO> noveltyCompareRecordQueryVOS,List<RetrieveRecordVO> retrieveRecordVOS, PersonnelVO personnelVO){
+        Map<String,Object> map =new HashMap<>();
+        Map<String, Object> baseMap = this.getBaseMap(queryNoveltyProjectVOs, retrieveRecordVOS,personnelVO);
+        Map<String, Object> technicalCaseMap = this.getTechnicalCaseMap(technicalCaseVO);
+        List<Map<String, Object>> compareLiteratureMap = this.getCompareLiteratureMap(compareLiteratureVOS);
+        List<Map<String, Object>> compareRecordMap = this.getCompareRecordMap(noveltyCompareRecordQueryVOS, compareLiteratureVOS);
+        List<Map<String, Object>> searchRecordMap = this.getSearchRecordMap(retrieveRecordVOS);
+        map.put("baseMessage", baseMap);
+        map.put("technicalCase", technicalCaseMap);
+        map.put("compareLiterature", compareLiteratureMap);
+        map.put("compareRecord", compareRecordMap);
+        map.put("searchRecord", searchRecordMap);
+        return map;
+    }
+    @Override
+    public Map<String, Object> getTechnicalCaseMap(TechnicalCaseVO technicalCaseVO) {
+        Map<String, Object> technicalMap = new HashMap<>();
+        technicalMap.put("inventionPoint", technicalCaseVO.getInventionPoint());
+        List<SystemFile> systemFileList = technicalCaseVO.getSystemFileList();
+        if (systemFileList != null && systemFileList.size() != 0) {
+            List<String> fileGuids = systemFileList.stream().map(SystemFile::getGuid).collect(Collectors.toList());
+            technicalMap.put("picture", fileGuids);
+        }
+        return technicalMap;
+    }
+
+    @Override
+    public Map<String, Object> getBaseMap(List<QueryNoveltyProjectVO> queryNoveltyProjectVOs,List<RetrieveRecordVO> retrieveRecordVOS,PersonnelVO personnelVO) {
+        Map<String, Object> baseMap = new HashMap<>();
+        if (queryNoveltyProjectVOs == null || queryNoveltyProjectVOs.size() == 0) {
+            return baseMap;
+        }
+        QueryNoveltyProjectVO queryNoveltyProjectVO = queryNoveltyProjectVOs.get(0);
+        baseMap.put("searchUnitContact", queryNoveltyProjectVO.getSearchUnitContact());
+        baseMap.put("applicants", queryNoveltyProjectVO.getApplicants());
+        baseMap.put("customCaseNumber", queryNoveltyProjectVO.getCustomCaseNumber());
+        baseMap.put("caseName", queryNoveltyProjectVO.getCaseName());
+        baseMap.put("technicalContact", queryNoveltyProjectVO.getTechnicalContact());
+        String searchUnit = queryNoveltyProjectVO.getSearchUnit();
+        if (searchUnit == null || searchUnit.trim().equals("")) {
+            baseMap.put("searchUnit", "广东君龙律师事务所");
+        } else {
+            baseMap.put("searchUnit", queryNoveltyProjectVO.getSearchUnit());
+        }
+        baseMap.put("inventor", queryNoveltyProjectVO.getInventor());
+        baseMap.put("inventorContact", "");
+        baseMap.put("distinguishTechnical", "");
+        baseMap.put("remark", queryNoveltyProjectVO.getRemark());
+        baseMap.put("analyse", "");
+        baseMap.put("preliminaryConclusions", queryNoveltyProjectVO.getPreliminaryConclusions());
+        baseMap.put("applicationAdvice", queryNoveltyProjectVO.getApplicationAdvice());
+        baseMap.put("finalConclusions", NoveltyTempalteUtil.reFinalConclusions(Arrays.asList(queryNoveltyProjectVO.getPreliminaryConclusions(), queryNoveltyProjectVO.getApplicationAdvice())));
+        baseMap.put("ifPatentability", queryNoveltyProjectVO.getIfPatentability());
+        baseMap.put("ipr", queryNoveltyProjectVO.getIpr());
+        if (queryNoveltyProjectVO.getHeadName() != null) {
+            baseMap.put("searchName", queryNoveltyProjectVO.getHeadName());
+        } else if (queryNoveltyProjectVO.getCreateName() != null) {
+            baseMap.put("searchName", queryNoveltyProjectVO.getCreateName());
+        }
+        if (retrieveRecordVOS != null && retrieveRecordVOS.size() > 0) {
+            RetrieveRecordVO retrieveRecordVO = retrieveRecordVOS.get(retrieveRecordVOS.size() - 1);
+            Date date = retrieveRecordVO.getRetrieveTime();
+            if (date != null) {
+                String dateStr = DateUtils.formatDate(date, "yyyy-MM-dd");
+                baseMap.put("searchTime", dateStr);
+            }
+        }
+        return baseMap;
+    }
+
+    @Override
+    public List<Map<String, Object>> getCompareLiteratureMap(List<CompareLiteratureVO> compareLiteratureVOS) {
+        List<Map<String, Object>> maps = new ArrayList<>();
+        if (compareLiteratureVOS != null) {
+            List<String> patentNos = compareLiteratureVOS.stream().map(CompareLiteratureVO::getLiteratureNo).collect(Collectors.toList());
+            patentNos.forEach(item -> {
+                Map<String, Object> map = new HashMap<>();
+                map.put("patentNo", item);
+                maps.add(map);
+            });
+        }
+        return maps;
+    }
+
+    @Override
+    public List<Map<String, Object>> getCompareRecordMap(List<NoveltyCompareRecordQueryVO> noveltyCompareRecordQueryVOs, List<CompareLiteratureVO> compareLiteratureVOS) {
+        List<Map<String, Object>> maps = new ArrayList<>();
+
+        if (compareLiteratureVOS == null || compareLiteratureVOS.size() == 0) {
+            return maps;
+        }
+        List<String> patentNos = compareLiteratureVOS.stream().map(CompareLiteratureVO::getLiteratureNo).collect(Collectors.toList());
+        List<Patent> patents = new ArrayList<>();
+        try {
+            patents = esPatentService.getPatentsByNo(patentNos, true, null, null);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        Integer index = 1;
+        for (CompareLiteratureVO compareLiteratureVO : compareLiteratureVOS) {
+            String patentNo = compareLiteratureVO.getLiteratureNo();
+            Map<String, Object> map = new HashMap<>();
+            map.put("index", index);
+            map.put("publicNo", compareLiteratureVO.getPublicNo());
+
+            Patent patent = patents.stream().filter(item -> item.getPatentNo().equals(patentNo)).findFirst().orElse(null);
+            if (patent != null) {
+                List<PatentPerson> patentPeople = patent.getRightHolder();
+
+                if (patentPeople != null && patentPeople.size() > 0) {
+                    List<String> names = patentPeople.stream().map(PatentPerson::getName).collect(Collectors.toList());
+                    String nameStr = StringUtils.join(names, "、");
+                    map.put("rightHolder", nameStr);
+                }
+            }
+
+            Integer temIndex = 1;
+            List<String> contentList = new ArrayList<>();
+            List<NoveltyCompareRecordVO> noveltyCompareRecordVOS = compareLiteratureVO.getNoveltyCompareRecordVOS();
+            if (noveltyCompareRecordVOS != null) {
+                for (NoveltyCompareRecordVO item : noveltyCompareRecordVOS) {
+                    String markText = item.getMarkNoteText();
+                    if (markText != null && !markText.trim().equals("")) {
+                        markText = (temIndex) + "、" + markText;
+                        contentList.add(markText);
+                        temIndex++;
+                    }
+                }
+            }
+
+            List<NoveltyCompareRecordQueryVO> tempRecordVos = noveltyCompareRecordQueryVOs.stream().filter(item -> item.getPatentNo().equals(patentNo)).collect(Collectors.toList());
+            if (tempRecordVos != null && tempRecordVos.size() != 0) {
+                for (int i = 0; i < tempRecordVos.size(); i++) {
+                    NoveltyCompareRecordQueryVO vo = tempRecordVos.get(i);
+                    String markSelectField = vo.getMarkSelectField();
+                    String markSelectText = vo.getMarkSelectText();
+                    String technicalFeature = vo.getTechnicalFeature();
+                    String markNoteText = vo.getMarkNoteText();
+                    StringBuilder stringBuilder = new StringBuilder();
+                    stringBuilder.append(temIndex + "、");
+                    stringBuilder.append(markSelectField);
+                    stringBuilder.append(markSelectText);
+                    if (technicalFeature != null && !technicalFeature.trim().equals("")) {
+                        stringBuilder.append("揭示了" + technicalFeature);
+                    }
+                    stringBuilder.append(markNoteText);
+                    contentList.add(stringBuilder.toString());
+                    temIndex++;
+                }
+
+            }
+            String content = "";
+            if (contentList.size() > 0) {
+                content = StringUtils.join(contentList, "<br>");
+
+            }
+            String tpoint = compareLiteratureVO.getTechnicalPoints();
+            if (tpoint != null) {
+                content = content + "<br>" + tpoint;
+            }
+            map.put("technicalPoints", content);
+            maps.add(map);
+            index++;
+        }
+
+
+        return maps;
+    }
+
+    @Override
+    public List<Map<String, Object>> getSearchRecordMap(List<RetrieveRecordVO> retrieveRecordVOS) {
+        List<Map<String, Object>> maps = new ArrayList<>();
+        if (retrieveRecordVOS != null) {
+            retrieveRecordVOS.forEach(item -> {
+                Map<String, Object> map = new HashMap<>();
+                map.put("conditions", item.getConditions());
+                String dbType = item.getDbType();
+                if (dbType == null || dbType.trim().equals("")) {
+                    dbType = "小世系统";
+                }
+                String re = NoveltyTempalteUtil.getDbTypes(dbType);
+                if (re == null) {
+                    re = "";
+                }
+                map.put("area", re);
+                map.put("dbType", dbType);
+                map.put("totalNum", item.getTotalNum());
+
+                maps.add(map);
+            });
+        }
+        return maps;
+    }
+}

+ 227 - 0
src/main/java/cn/cslg/pas/factorys/noveltyTemplateFacotry/GetVisionoxcxTempalte.java

@@ -0,0 +1,227 @@
+package cn.cslg.pas.factorys.noveltyTemplateFacotry;
+
+import cn.cslg.pas.common.model.cronModel.PersonnelVO;
+import cn.cslg.pas.common.model.cronModel.SystemFile;
+import cn.cslg.pas.common.utils.DateUtils;
+import cn.cslg.pas.common.utils.StringUtils;
+import cn.cslg.pas.common.vo.CompareLiteratureVO;
+import cn.cslg.pas.common.vo.NoveltyProjectVO.NoveltyCompareRecordQueryVO;
+import cn.cslg.pas.common.vo.NoveltyProjectVO.NoveltyCompareRecordVO;
+import cn.cslg.pas.common.vo.NoveltyProjectVO.RetrieveRecordVO;
+import cn.cslg.pas.common.vo.QueryNoveltyProjectVO;
+import cn.cslg.pas.common.vo.TechnicalCaseVO;
+import cn.cslg.pas.domain.es.Patent;
+import cn.cslg.pas.domain.es.PatentPerson;
+import cn.cslg.pas.service.business.es.EsPatentService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * @Author lrj
+ * @Date 2025/02/20
+ */
+@Component
+public class GetVisionoxcxTempalte implements GetTemplateMapsImp {
+    @Autowired
+    private EsPatentService esPatentService;
+
+    @Override
+    public Map<String, Object> getMap(List<QueryNoveltyProjectVO> queryNoveltyProjectVOs, TechnicalCaseVO technicalCaseVO, List<CompareLiteratureVO> compareLiteratureVOS, List<NoveltyCompareRecordQueryVO> noveltyCompareRecordQueryVOS, List<RetrieveRecordVO> retrieveRecordVOS, PersonnelVO personnelVO) {
+        Map<String, Object> map = new HashMap<>();
+        Map<String, Object> baseMap = this.getBaseMap(queryNoveltyProjectVOs, retrieveRecordVOS, personnelVO);
+        Map<String, Object> technicalCaseMap = this.getTechnicalCaseMap(technicalCaseVO);
+        List<Map<String, Object>> compareLiteratureMap = this.getCompareLiteratureMap(compareLiteratureVOS);
+        List<Map<String, Object>> compareRecordMap = this.getCompareRecordMap(noveltyCompareRecordQueryVOS, compareLiteratureVOS);
+        List<Map<String, Object>> searchRecordMap = this.getSearchRecordMap(retrieveRecordVOS);
+        map.put("baseMessage", baseMap);
+        map.put("technicalCase", technicalCaseMap);
+        map.put("compareLiterature", compareLiteratureMap);
+        map.put("compareRecord", compareRecordMap);
+        map.put("searchRecord", searchRecordMap);
+        return map;
+    }
+
+    @Override
+    public Map<String, Object> getTechnicalCaseMap(TechnicalCaseVO technicalCaseVO) {
+        Map<String, Object> technicalMap = new HashMap<>();
+        technicalMap.put("inventionPoint", technicalCaseVO.getInventionPoint());
+        List<SystemFile> systemFileList = technicalCaseVO.getSystemFileList();
+        if (systemFileList != null && systemFileList.size() != 0) {
+            List<String> fileGuids = systemFileList.stream().map(SystemFile::getGuid).collect(Collectors.toList());
+            technicalMap.put("picture", fileGuids);
+        }
+        return technicalMap;
+    }
+
+    @Override
+    public Map<String, Object> getBaseMap(List<QueryNoveltyProjectVO> queryNoveltyProjectVOs, List<RetrieveRecordVO> retrieveRecordVOS, PersonnelVO personnelVO) {
+        Map<String, Object> baseMap = new HashMap<>();
+        if (queryNoveltyProjectVOs == null || queryNoveltyProjectVOs.size() == 0) {
+            return baseMap;
+        }
+        QueryNoveltyProjectVO queryNoveltyProjectVO = queryNoveltyProjectVOs.get(0);
+        baseMap.put("searchUnitContact", queryNoveltyProjectVO.getSearchUnitContact());
+        baseMap.put("applicants", queryNoveltyProjectVO.getApplicants());
+        baseMap.put("customCaseNumber", queryNoveltyProjectVO.getCustomCaseNumber());
+        baseMap.put("caseName", queryNoveltyProjectVO.getCaseName());
+        baseMap.put("technicalContact", queryNoveltyProjectVO.getTechnicalContact());
+        String searchUnit = queryNoveltyProjectVO.getSearchUnit();
+        if (searchUnit == null || searchUnit.trim().equals("")) {
+            baseMap.put("searchUnit", "广东君龙律师事务所");
+        } else {
+            baseMap.put("searchUnit", queryNoveltyProjectVO.getSearchUnit());
+        }
+        baseMap.put("inventor", queryNoveltyProjectVO.getInventor());
+        baseMap.put("inventorContact", "");
+        baseMap.put("distinguishTechnical", "");
+        baseMap.put("remark", queryNoveltyProjectVO.getRemark());
+        baseMap.put("analyse", "");
+        baseMap.put("preliminaryConclusions", queryNoveltyProjectVO.getPreliminaryConclusions());
+        baseMap.put("applicationAdvice", queryNoveltyProjectVO.getApplicationAdvice());
+        baseMap.put("finalConclusions", NoveltyTempalteUtil.reFinalConclusions(Arrays.asList(queryNoveltyProjectVO.getPreliminaryConclusions(), queryNoveltyProjectVO.getApplicationAdvice())));
+        baseMap.put("ifPatentability", queryNoveltyProjectVO.getIfPatentability());
+        baseMap.put("ipr", queryNoveltyProjectVO.getIpr());
+        if (queryNoveltyProjectVO.getHeadName() != null) {
+            baseMap.put("searchName", queryNoveltyProjectVO.getHeadName());
+        } else if (queryNoveltyProjectVO.getCreateName() != null) {
+            baseMap.put("searchName", queryNoveltyProjectVO.getCreateName());
+        }
+        if (retrieveRecordVOS != null && retrieveRecordVOS.size() > 0) {
+            RetrieveRecordVO retrieveRecordVO = retrieveRecordVOS.get(retrieveRecordVOS.size() - 1);
+            Date date = retrieveRecordVO.getRetrieveTime();
+            if (date != null) {
+                String dateStr = DateUtils.formatDate(date, "yyyy-MM-dd");
+                baseMap.put("searchTime", dateStr);
+            }
+        }
+        return baseMap;
+    }
+
+    @Override
+    public List<Map<String, Object>> getCompareLiteratureMap(List<CompareLiteratureVO> compareLiteratureVOS) {
+        List<Map<String, Object>> maps = new ArrayList<>();
+        if (compareLiteratureVOS != null) {
+            List<String> patentNos = compareLiteratureVOS.stream().map(CompareLiteratureVO::getLiteratureNo).collect(Collectors.toList());
+            patentNos.forEach(item -> {
+                Map<String, Object> map = new HashMap<>();
+                map.put("patentNo", item);
+                maps.add(map);
+            });
+        }
+        return maps;
+    }
+
+    @Override
+    public List<Map<String, Object>> getCompareRecordMap(List<NoveltyCompareRecordQueryVO> noveltyCompareRecordQueryVOs, List<CompareLiteratureVO> compareLiteratureVOS) {
+        List<Map<String, Object>> maps = new ArrayList<>();
+
+        if (compareLiteratureVOS == null || compareLiteratureVOS.size() == 0) {
+            return maps;
+        }
+        List<String> patentNos = compareLiteratureVOS.stream().map(CompareLiteratureVO::getLiteratureNo).collect(Collectors.toList());
+        List<Patent> patents = new ArrayList<>();
+        try {
+            patents = esPatentService.getPatentsByNo(patentNos, true, null, null);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        Integer index = 1;
+        for (CompareLiteratureVO compareLiteratureVO : compareLiteratureVOS) {
+            String patentNo = compareLiteratureVO.getLiteratureNo();
+            Map<String, Object> map = new HashMap<>();
+            map.put("index", index);
+            map.put("publicNo", compareLiteratureVO.getPublicNo());
+
+            Patent patent = patents.stream().filter(item -> item.getPatentNo().equals(patentNo)).findFirst().orElse(null);
+            if (patent != null) {
+                List<PatentPerson> patentPeople = patent.getRightHolder();
+
+                if (patentPeople != null && patentPeople.size() > 0) {
+                    List<String> names = patentPeople.stream().map(PatentPerson::getName).collect(Collectors.toList());
+                    String nameStr = StringUtils.join(names, "、");
+                    map.put("rightHolder", nameStr);
+                }
+            }
+
+            Integer temIndex = 1;
+            List<String> contentList = new ArrayList<>();
+            List<NoveltyCompareRecordVO> noveltyCompareRecordVOS = compareLiteratureVO.getNoveltyCompareRecordVOS();
+            if (noveltyCompareRecordVOS != null) {
+                for (NoveltyCompareRecordVO item : noveltyCompareRecordVOS) {
+                    String markText = item.getMarkNoteText();
+                    if (markText != null && !markText.trim().equals("")) {
+                        markText = (temIndex) + "、" + markText;
+                        contentList.add(markText);
+                        temIndex++;
+                    }
+                }
+            }
+
+            List<NoveltyCompareRecordQueryVO> tempRecordVos = noveltyCompareRecordQueryVOs.stream().filter(item -> item.getPatentNo().equals(patentNo)).collect(Collectors.toList());
+            if (tempRecordVos != null && tempRecordVos.size() != 0) {
+                for (int i = 0; i < tempRecordVos.size(); i++) {
+                    NoveltyCompareRecordQueryVO vo = tempRecordVos.get(i);
+                    String markSelectField = vo.getMarkSelectField();
+                    String markSelectText = vo.getMarkSelectText();
+                    String technicalFeature = vo.getTechnicalFeature();
+                    String markNoteText = vo.getMarkNoteText();
+                    StringBuilder stringBuilder = new StringBuilder();
+                    stringBuilder.append(temIndex + "、");
+                    stringBuilder.append(markSelectField);
+                    stringBuilder.append(markSelectText);
+                    if (technicalFeature != null && !technicalFeature.trim().equals("")) {
+                        stringBuilder.append("揭示了" + technicalFeature);
+                    }
+                    stringBuilder.append(markNoteText);
+                    contentList.add(stringBuilder.toString());
+                    temIndex++;
+                }
+
+            }
+            String content = "";
+            if (contentList.size() > 0) {
+                content = StringUtils.join(contentList, "<br>");
+
+            }
+            String tpoint = compareLiteratureVO.getTechnicalPoints();
+            if (tpoint != null) {
+                content = content + "<br>" + tpoint;
+            }
+            map.put("technicalPoints", content);
+            maps.add(map);
+            index++;
+        }
+
+
+        return maps;
+    }
+
+    @Override
+    public List<Map<String, Object>> getSearchRecordMap(List<RetrieveRecordVO> retrieveRecordVOS) {
+        List<Map<String, Object>> maps = new ArrayList<>();
+        if (retrieveRecordVOS != null) {
+            retrieveRecordVOS.forEach(item -> {
+                Map<String, Object> map = new HashMap<>();
+                map.put("conditions", item.getConditions());
+                String dbType = item.getDbType();
+                if (dbType == null || dbType.trim().equals("")) {
+                    dbType = "小世系统";
+                }
+                String re = NoveltyTempalteUtil.getDbTypes(dbType);
+                if (re == null) {
+                    re = "";
+                }
+                map.put("area", re);
+                map.put("dbType", dbType);
+                map.put("totalNum", item.getTotalNum());
+
+                maps.add(map);
+            });
+        }
+        return maps;
+    }
+}

+ 217 - 0
src/main/java/cn/cslg/pas/factorys/noveltyTemplateFacotry/GetaiqijiTempalte.java

@@ -0,0 +1,217 @@
+package cn.cslg.pas.factorys.noveltyTemplateFacotry;
+
+import cn.cslg.pas.common.model.cronModel.PersonnelVO;
+import cn.cslg.pas.common.model.cronModel.SystemFile;
+import cn.cslg.pas.common.utils.DateUtils;
+import cn.cslg.pas.common.utils.StringUtils;
+import cn.cslg.pas.common.vo.CompareLiteratureVO;
+import cn.cslg.pas.common.vo.NoveltyProjectVO.NoveltyCompareRecordQueryVO;
+import cn.cslg.pas.common.vo.NoveltyProjectVO.NoveltyCompareRecordVO;
+import cn.cslg.pas.common.vo.NoveltyProjectVO.RetrieveRecordVO;
+import cn.cslg.pas.common.vo.QueryNoveltyProjectVO;
+import cn.cslg.pas.common.vo.TechnicalCaseVO;
+import cn.cslg.pas.domain.es.Patent;
+import cn.cslg.pas.service.business.es.EsPatentService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * @Author lrj
+ * @Date 2025/02/20
+ */
+@Component
+public class GetaiqijiTempalte implements GetTemplateMapsImp {
+
+    @Autowired
+    private EsPatentService esPatentService;
+    public  Map<String,Object> getMap(List<QueryNoveltyProjectVO> queryNoveltyProjectVOs,TechnicalCaseVO technicalCaseVO,List<CompareLiteratureVO> compareLiteratureVOS,List<NoveltyCompareRecordQueryVO> noveltyCompareRecordQueryVOS,List<RetrieveRecordVO> retrieveRecordVOS,PersonnelVO personnelVO){
+        Map<String,Object> map =new HashMap<>();
+        Map<String, Object> baseMap = this.getBaseMap(queryNoveltyProjectVOs, retrieveRecordVOS,personnelVO);
+        Map<String, Object> technicalCaseMap = this.getTechnicalCaseMap(technicalCaseVO);
+        List<Map<String, Object>> compareLiteratureMap = this.getCompareLiteratureMap(compareLiteratureVOS);
+        List<Map<String, Object>> compareRecordMap = this.getCompareRecordMap(noveltyCompareRecordQueryVOS, compareLiteratureVOS);
+        List<Map<String, Object>> searchRecordMap = this.getSearchRecordMap(retrieveRecordVOS);
+        map.put("baseMessage", baseMap);
+        map.put("technicalCase", technicalCaseMap);
+        map.put("compareLiterature", compareLiteratureMap);
+        map.put("compareRecord", compareRecordMap);
+        map.put("searchRecord", searchRecordMap);
+        return map;
+    }
+
+    @Override
+    public Map<String, Object> getTechnicalCaseMap(TechnicalCaseVO technicalCaseVO) {
+        Map<String, Object> technicalMap = new HashMap<>();
+        technicalMap.put("inventionPoint", technicalCaseVO.getInventionPoint());
+        List<SystemFile> systemFileList = technicalCaseVO.getSystemFileList();
+        if (systemFileList != null && systemFileList.size() != 0) {
+            List<String> fileGuids = systemFileList.stream().map(SystemFile::getGuid).collect(Collectors.toList());
+            technicalMap.put("picture", fileGuids);
+        }
+        return technicalMap;
+    }
+
+    @Override
+    public Map<String, Object> getBaseMap(List<QueryNoveltyProjectVO> queryNoveltyProjectVOs,List<RetrieveRecordVO> retrieveRecordVOS,PersonnelVO personnelVO) {
+        Map<String, Object> baseMap = new HashMap<>();
+        if (queryNoveltyProjectVOs == null || queryNoveltyProjectVOs.size() == 0) {
+            return baseMap;
+        }
+        QueryNoveltyProjectVO queryNoveltyProjectVO = queryNoveltyProjectVOs.get(0);
+        baseMap.put("searchUnitContact", queryNoveltyProjectVO.getSearchUnitContact());
+        baseMap.put("applicants", queryNoveltyProjectVO.getApplicants());
+        baseMap.put("customCaseNumber", queryNoveltyProjectVO.getCustomCaseNumber());
+        baseMap.put("caseName", queryNoveltyProjectVO.getCaseName());
+        baseMap.put("technicalContact", queryNoveltyProjectVO.getTechnicalContact());
+        baseMap.put("searchUnit", queryNoveltyProjectVO.getSearchUnit());
+
+        baseMap.put("inventor", queryNoveltyProjectVO.getInventor());
+        baseMap.put("inventorContact", "");
+        baseMap.put("distinguishTechnical", "");
+        baseMap.put("remark", queryNoveltyProjectVO.getRemark());
+        baseMap.put("analyse", "");
+        baseMap.put("preliminaryConclusions", queryNoveltyProjectVO.getPreliminaryConclusions());
+        baseMap.put("applicationAdvice", queryNoveltyProjectVO.getApplicationAdvice());
+        baseMap.put("conclusions", NoveltyTempalteUtil.reFinalConclusions(Arrays.asList(queryNoveltyProjectVO.getPreliminaryConclusions(), queryNoveltyProjectVO.getApplicationAdvice())));
+        baseMap.put("ifPatentability", "是");
+        baseMap.put("ipr", queryNoveltyProjectVO.getIpr());
+        if (queryNoveltyProjectVO.getHeadName() != null) {
+            baseMap.put("searchName", queryNoveltyProjectVO.getHeadName());
+        } else if (queryNoveltyProjectVO.getCaseName() != null) {
+            baseMap.put("searchName", queryNoveltyProjectVO.getCreateName());
+        }
+        return baseMap;
+    }
+
+    @Override
+    public List<Map<String, Object>> getCompareLiteratureMap(List<CompareLiteratureVO> compareLiteratureVOS) {
+        List<Map<String, Object>> maps = new ArrayList<>();
+
+        if (compareLiteratureVOS != null) {
+
+
+            int index = 1;
+            for (CompareLiteratureVO compareLiteratureVO : compareLiteratureVOS) {
+                String no = compareLiteratureVO.getLiteratureNo();
+                String name = compareLiteratureVO.getName();
+                String content = "对比文件" + index + ":" + no + "-" + name;
+                Map<String, Object> map = new HashMap<>();
+                map.put("content", content);
+                maps.add(map);
+                index++;
+            }
+        }
+        return maps;
+    }
+
+    @Override
+    public List<Map<String, Object>> getCompareRecordMap(List<NoveltyCompareRecordQueryVO> noveltyCompareRecordQueryVOs, List<CompareLiteratureVO> compareLiteratureVOS) {
+        List<Map<String, Object>> maps = new ArrayList<>();
+
+        if (compareLiteratureVOS == null || compareLiteratureVOS.size() == 0) {
+            return maps;
+        }
+        List<String> patentNos = compareLiteratureVOS.stream().map(CompareLiteratureVO::getLiteratureNo).collect(Collectors.toList());
+        List<Patent> patents = new ArrayList<>();
+        try {
+            patents = esPatentService.getPatentsByNo(patentNos, false, null, null);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        Integer index = 1;
+        for (CompareLiteratureVO compareLiteratureVO : compareLiteratureVOS) {
+            Map<String, Object> map = new HashMap<>();
+            String patentNo = compareLiteratureVO.getLiteratureNo();
+            StringBuilder str = new StringBuilder("对比文件");
+            str.append(index);
+            str.append(":");
+            str.append(patentNo);
+            String abstr = "";
+            Patent patent = patents.stream().filter(item -> item.getPatentNo().equals(patentNo)).findFirst().orElse(null);
+            if (patent != null && patent.getTitle() != null && patent.getTitle().size() != 0) {
+                str.append(patent.getTitle().get(0).getTextContent());
+            }
+            str.append("<br>");
+            if (patent != null && patent.getAbstractStr() != null && patent.getAbstractStr().size() > 0) {
+                abstr = "[摘要原文]" + patent.getAbstractStr().get(0).getTextContent();
+            }
+
+
+            List<String> contentList = new ArrayList<>();
+            List<NoveltyCompareRecordVO> noveltyCompareRecordVOS = compareLiteratureVO.getNoveltyCompareRecordVOS();
+            if (noveltyCompareRecordVOS != null) {
+                for (NoveltyCompareRecordVO item : noveltyCompareRecordVOS) {
+                    String markText = item.getMarkNoteText();
+                    String finText = abstr + "(" + markText + ")";
+                    contentList.add(finText);
+                }
+            }
+
+            List<NoveltyCompareRecordQueryVO> tempRecordVos = noveltyCompareRecordQueryVOs.stream().filter(item -> item.getPatentNo().equals(patentNo)).collect(Collectors.toList());
+            if (tempRecordVos != null && tempRecordVos.size() != 0) {
+                for (int i = 0; i < tempRecordVos.size(); i++) {
+                    NoveltyCompareRecordQueryVO vo = tempRecordVos.get(i);
+                    String markSelectField = vo.getMarkSelectField();
+                    String markSelectText = vo.getMarkSelectText();
+                    String technicalFeature = vo.getTechnicalFeature();
+                    String markNoteText = vo.getMarkNoteText();
+                    StringBuilder stringBuilder = new StringBuilder();
+
+                    stringBuilder.append("[" + markSelectField + "]");
+                    stringBuilder.append(markSelectText);
+                    if (technicalFeature != null && !technicalFeature.trim().equals("")) {
+                        stringBuilder.append("揭示了" + technicalFeature);
+                    }
+                    stringBuilder.append(markNoteText);
+                    contentList.add(stringBuilder.toString());
+                }
+
+            }
+            String content = "";
+            if (contentList.size() > 0) {
+                content = StringUtils.join(contentList, "<br>");
+
+            }
+            str.append(content);
+            map.put("content", str);
+            maps.add(map);
+            index++;
+        }
+
+
+        return maps;
+    }
+
+    @Override
+    public List<Map<String, Object>> getSearchRecordMap(List<RetrieveRecordVO> retrieveRecordVOS) {
+        List<Map<String, Object>> maps = new ArrayList<>();
+        if (retrieveRecordVOS != null) {
+            retrieveRecordVOS.forEach(item -> {
+                Map<String, Object> map = new HashMap<>();
+                map.put("searchCondition", item.getConditions());
+                String dbType = item.getDbType();
+                if (dbType == null || dbType.trim().equals("")) {
+                    dbType = "小世系统";
+                }
+                String re = NoveltyTempalteUtil.getDbTypes(dbType);
+                if (re == null) {
+                    re = "";
+                }
+                map.put("area", re);
+                map.put("dbType", dbType);
+                map.put("totalNum", item.getTotalNum());
+                Date retrieveTime = item.getRetrieveTime();
+                if (retrieveTime != null) {
+                    String dateStr = DateUtils.formatDate(retrieveTime, "yyyy-MM-dd");
+                    map.put("retrieveTime", dateStr);
+                }
+                maps.add(map);
+            });
+        }
+        return maps;
+    }
+}

+ 228 - 0
src/main/java/cn/cslg/pas/factorys/noveltyTemplateFacotry/GetlingpaoTempalte.java

@@ -0,0 +1,228 @@
+package cn.cslg.pas.factorys.noveltyTemplateFacotry;
+
+import cn.cslg.pas.common.model.cronModel.PersonnelVO;
+import cn.cslg.pas.common.model.cronModel.SystemFile;
+import cn.cslg.pas.common.utils.DateUtils;
+import cn.cslg.pas.common.utils.StringUtils;
+import cn.cslg.pas.common.vo.CompareLiteratureVO;
+import cn.cslg.pas.common.vo.NoveltyProjectVO.NoveltyCompareRecordQueryVO;
+import cn.cslg.pas.common.vo.NoveltyProjectVO.NoveltyCompareRecordVO;
+import cn.cslg.pas.common.vo.NoveltyProjectVO.RetrieveRecordVO;
+import cn.cslg.pas.common.vo.QueryNoveltyProjectVO;
+import cn.cslg.pas.common.vo.TechnicalCaseVO;
+import cn.cslg.pas.domain.es.Patent;
+import cn.cslg.pas.service.business.es.EsPatentService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * @Author lrj
+ * @Date 2025/02/20
+ */
+@Component
+public class GetlingpaoTempalte implements GetTemplateMapsImp {
+    @Autowired
+    private EsPatentService esPatentService;
+
+    @Override
+    public Map<String, Object> getMap(List<QueryNoveltyProjectVO> queryNoveltyProjectVOs, TechnicalCaseVO technicalCaseVO, List<CompareLiteratureVO> compareLiteratureVOS, List<NoveltyCompareRecordQueryVO> noveltyCompareRecordQueryVOS, List<RetrieveRecordVO> retrieveRecordVOS, PersonnelVO personnelVO) {
+        Map<String, Object> map = new HashMap<>();
+        Map<String, Object> baseMap = this.getBaseMap(queryNoveltyProjectVOs, retrieveRecordVOS,personnelVO);
+        Map<String, Object> technicalCaseMap = this.getTechnicalCaseMap(technicalCaseVO);
+        List<Map<String, Object>> compareLiteratureMap = this.getCompareLiteratureMap(compareLiteratureVOS);
+        List<Map<String, Object>> compareRecordMap = this.getCompareRecordMap(noveltyCompareRecordQueryVOS, compareLiteratureVOS);
+        List<Map<String, Object>> searchRecordMap = this.getSearchRecordMap(retrieveRecordVOS);
+        map.put("baseMessage", baseMap);
+        map.put("technicalCase", technicalCaseMap);
+        map.put("compareLiterature", compareLiteratureMap);
+        map.put("compareRecord", compareRecordMap);
+        map.put("searchRecord", searchRecordMap);
+        return map;
+    }
+    @Override
+    public Map<String, Object> getTechnicalCaseMap(TechnicalCaseVO technicalCaseVO) {
+        Map<String, Object> technicalMap = new HashMap<>();
+        technicalMap.put("inventionPoint", technicalCaseVO.getInventionPoint());
+        List<SystemFile> systemFileList = technicalCaseVO.getSystemFileList();
+        if (systemFileList != null && systemFileList.size() != 0) {
+            List<String> fileGuids = systemFileList.stream().map(SystemFile::getGuid).collect(Collectors.toList());
+            technicalMap.put("picture", fileGuids);
+        }
+        return technicalMap;
+    }
+
+    @Override
+    public Map<String, Object> getBaseMap(List<QueryNoveltyProjectVO> queryNoveltyProjectVOs,List<RetrieveRecordVO> retrieveRecordVOS,PersonnelVO personnelVO) {
+        Map<String, Object> baseMap = new HashMap<>();
+        if (queryNoveltyProjectVOs == null || queryNoveltyProjectVOs.size() == 0) {
+            return baseMap;
+        }
+        QueryNoveltyProjectVO queryNoveltyProjectVO = queryNoveltyProjectVOs.get(0);
+        baseMap.put("searchUnitContact", queryNoveltyProjectVO.getSearchUnitContact());
+        baseMap.put("applicants", queryNoveltyProjectVO.getApplicants());
+        baseMap.put("customCaseNumber", queryNoveltyProjectVO.getCustomCaseNumber());
+        baseMap.put("caseName", queryNoveltyProjectVO.getCaseName());
+        baseMap.put("technicalContact", queryNoveltyProjectVO.getTechnicalContact());
+        baseMap.put("searchUnit", queryNoveltyProjectVO.getSearchUnit());
+
+        baseMap.put("inventor", queryNoveltyProjectVO.getInventor());
+        baseMap.put("inventorContact", "");
+        baseMap.put("distinguishTechnical", "");
+        baseMap.put("remark", queryNoveltyProjectVO.getRemark());
+        baseMap.put("analyse", "");
+        baseMap.put("preliminaryConclusions", queryNoveltyProjectVO.getPreliminaryConclusions());
+        baseMap.put("applicationAdvice", queryNoveltyProjectVO.getApplicationAdvice());
+        baseMap.put("conclusions", NoveltyTempalteUtil.reFinalConclusions(Arrays.asList(queryNoveltyProjectVO.getPreliminaryConclusions(), queryNoveltyProjectVO.getApplicationAdvice())));
+        baseMap.put("ifPatentability", "是");
+        baseMap.put("ipr", queryNoveltyProjectVO.getIpr());
+        if (queryNoveltyProjectVO.getHeadName() != null) {
+            baseMap.put("searchName", queryNoveltyProjectVO.getHeadName());
+        } else if (queryNoveltyProjectVO.getCreateName() != null) {
+            baseMap.put("searchName", queryNoveltyProjectVO.getCreateName());
+        }
+        if (retrieveRecordVOS != null && retrieveRecordVOS.size() > 0) {
+            RetrieveRecordVO retrieveRecordVO = retrieveRecordVOS.get(retrieveRecordVOS.size() - 1);
+            Date date = retrieveRecordVO.getRetrieveTime();
+            if (date != null) {
+                String dateStr = DateUtils.formatDate(date, "yyyy-MM-dd");
+                baseMap.put("searchTime", dateStr);
+            }
+            if (queryNoveltyProjectVO.getSearchUnit() == null || queryNoveltyProjectVO.getSearchUnit().trim().equals("")) {
+                baseMap.put("searchUnit", personnelVO.getTenantName());
+            }
+        }
+        return baseMap;
+    }
+
+    @Override
+    public List<Map<String, Object>> getCompareLiteratureMap(List<CompareLiteratureVO> compareLiteratureVOS) {
+        List<Map<String, Object>> maps = new ArrayList<>();
+
+        if (compareLiteratureVOS != null) {
+
+
+            int index = 1;
+            for (CompareLiteratureVO compareLiteratureVO : compareLiteratureVOS) {
+                String no = compareLiteratureVO.getLiteratureNo();
+                String name = compareLiteratureVO.getName();
+                String content = "对比文件" + index + ":" + no + "-" + name;
+                Map<String, Object> map = new HashMap<>();
+                map.put("content", content);
+                maps.add(map);
+                index++;
+            }
+        }
+        return maps;
+    }
+
+    @Override
+    public List<Map<String, Object>> getCompareRecordMap(List<NoveltyCompareRecordQueryVO> noveltyCompareRecordQueryVOs, List<CompareLiteratureVO> compareLiteratureVOS) {
+        List<Map<String, Object>> maps = new ArrayList<>();
+
+        if (compareLiteratureVOS == null || compareLiteratureVOS.size() == 0) {
+            return maps;
+        }
+        List<String> patentNos = compareLiteratureVOS.stream().map(CompareLiteratureVO::getLiteratureNo).collect(Collectors.toList());
+        List<Patent> patents = new ArrayList<>();
+        try {
+            patents = esPatentService.getPatentsByNo(patentNos, false, null, null);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        Integer index = 1;
+        for (CompareLiteratureVO compareLiteratureVO : compareLiteratureVOS) {
+            Map<String, Object> map = new HashMap<>();
+            String patentNo = compareLiteratureVO.getLiteratureNo();
+            StringBuilder str = new StringBuilder("对比文件");
+            str.append(index);
+            str.append(":");
+            str.append(patentNo);
+            String abstr = "";
+            Patent patent = patents.stream().filter(item -> item.getPatentNo().equals(patentNo)).findFirst().orElse(null);
+            if (patent != null && patent.getTitle() != null && patent.getTitle().size() != 0) {
+                str.append(patent.getTitle().get(0).getTextContent());
+            }
+            str.append("<br>");
+            if (patent != null && patent.getAbstractStr() != null && patent.getAbstractStr().size() > 0) {
+                abstr = "[摘要原文]" + patent.getAbstractStr().get(0).getTextContent();
+            }
+
+
+            List<String> contentList = new ArrayList<>();
+            List<NoveltyCompareRecordVO> noveltyCompareRecordVOS = compareLiteratureVO.getNoveltyCompareRecordVOS();
+            if (noveltyCompareRecordVOS != null) {
+                for (NoveltyCompareRecordVO item : noveltyCompareRecordVOS) {
+                    String markText = item.getMarkNoteText();
+                    String finText = abstr + "(" + markText + ")";
+                    contentList.add(finText);
+                }
+            }
+
+            List<NoveltyCompareRecordQueryVO> tempRecordVos = noveltyCompareRecordQueryVOs.stream().filter(item -> item.getPatentNo().equals(patentNo)).collect(Collectors.toList());
+            if (tempRecordVos != null && tempRecordVos.size() != 0) {
+                for (int i = 0; i < tempRecordVos.size(); i++) {
+                    NoveltyCompareRecordQueryVO vo = tempRecordVos.get(i);
+                    String markSelectField = vo.getMarkSelectField();
+                    String markSelectText = vo.getMarkSelectText();
+                    String technicalFeature = vo.getTechnicalFeature();
+                    String markNoteText = vo.getMarkNoteText();
+                    StringBuilder stringBuilder = new StringBuilder();
+
+                    stringBuilder.append("[" + markSelectField + "]");
+                    stringBuilder.append(markSelectText);
+                    if (technicalFeature != null && !technicalFeature.trim().equals("")) {
+                        stringBuilder.append("揭示了" + technicalFeature);
+                    }
+                    stringBuilder.append(markNoteText);
+                    contentList.add(stringBuilder.toString());
+                }
+
+            }
+            String content = "";
+            if (contentList.size() > 0) {
+                content = StringUtils.join(contentList, "<br>");
+
+            }
+            str.append(content);
+            map.put("content", str);
+            maps.add(map);
+            index++;
+        }
+
+
+        return maps;
+    }
+
+    @Override
+    public List<Map<String, Object>> getSearchRecordMap(List<RetrieveRecordVO> retrieveRecordVOS) {
+        List<Map<String, Object>> maps = new ArrayList<>();
+        if (retrieveRecordVOS != null) {
+            retrieveRecordVOS.forEach(item -> {
+                Map<String, Object> map = new HashMap<>();
+                map.put("searchCondition", item.getConditions());
+                String dbType = item.getDbType();
+                if (dbType == null || dbType.trim().equals("")) {
+                    dbType = "小世系统";
+                }
+                String re = NoveltyTempalteUtil.getDbTypes(dbType);
+                if (re == null) {
+                    re = "";
+                }
+                map.put("area", re);
+                map.put("dbType", dbType);
+                map.put("totalNum", item.getTotalNum());
+                Date retrieveTime = item.getRetrieveTime();
+                if (retrieveTime != null) {
+                    String dateStr = DateUtils.formatDate(retrieveTime, "yyyy-MM-dd");
+                    map.put("retrieveTime", dateStr);
+                }
+                maps.add(map);
+            });
+        }
+        return maps;
+    }
+}

+ 291 - 0
src/main/java/cn/cslg/pas/factorys/noveltyTemplateFacotry/GetningdeTempalte.java

@@ -0,0 +1,291 @@
+package cn.cslg.pas.factorys.noveltyTemplateFacotry;
+
+import cn.cslg.pas.common.model.cronModel.PersonnelVO;
+import cn.cslg.pas.common.model.cronModel.SystemFile;
+import cn.cslg.pas.common.utils.DateUtils;
+import cn.cslg.pas.common.utils.StringUtils;
+import cn.cslg.pas.common.vo.CompareLiteratureVO;
+import cn.cslg.pas.common.vo.NoveltyProjectVO.NoveltyCompareRecordQueryVO;
+import cn.cslg.pas.common.vo.NoveltyProjectVO.NoveltyCompareRecordVO;
+import cn.cslg.pas.common.vo.NoveltyProjectVO.RetrieveRecordVO;
+import cn.cslg.pas.common.vo.QueryNoveltyProjectVO;
+import cn.cslg.pas.common.vo.TechnicalCaseVO;
+import cn.cslg.pas.domain.es.Patent;
+import cn.cslg.pas.domain.es.PatentPerson;
+import cn.cslg.pas.service.business.es.EsPatentService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * @Author lrj
+ * @Date 2025/02/20
+ */
+@Component
+public class GetningdeTempalte implements GetTemplateMapsImp {
+
+    @Autowired
+    private EsPatentService esPatentService;
+    @Override
+    public Map<String, Object> getMap(List<QueryNoveltyProjectVO> queryNoveltyProjectVOs, TechnicalCaseVO technicalCaseVO, List<CompareLiteratureVO> compareLiteratureVOS, List<NoveltyCompareRecordQueryVO> noveltyCompareRecordQueryVOS, List<RetrieveRecordVO> retrieveRecordVOS,PersonnelVO personnelVO) {
+        Map<String, Object> map = new HashMap<>();
+        Map<String, Object> baseMap = this.getBaseMap(queryNoveltyProjectVOs, retrieveRecordVOS,personnelVO);
+        Map<String, Object> technicalCaseMap = this.getTechnicalCaseMap(technicalCaseVO);
+        List<Map<String, Object>> compareLiteratureMap = this.getCompareLiteratureMap(compareLiteratureVOS);
+        List<Map<String, Object>> compareRecordMap = this.getCompareRecordMap(noveltyCompareRecordQueryVOS, compareLiteratureVOS);
+        List<Map<String, Object>> searchRecordMap = this.getSearchRecordMap(retrieveRecordVOS);
+        map.put("baseMessage", baseMap);
+        map.put("technicalCase", technicalCaseMap);
+        map.put("compareLiterature", compareLiteratureMap);
+        map.put("compareRecord", compareRecordMap);
+        map.put("searchRecord", searchRecordMap);
+        return map;
+    }
+
+    @Override
+    public Map<String, Object> getTechnicalCaseMap(TechnicalCaseVO technicalCaseVO) {
+        Map<String, Object> technicalMap = new HashMap<>();
+        technicalMap.put("inventionPoint", technicalCaseVO.getInventionPoint());
+        technicalMap.put("solvedProblem", technicalCaseVO.getSolvedProblem());
+        List<SystemFile> systemFileList = technicalCaseVO.getSystemFileList();
+        if (systemFileList != null && systemFileList.size() != 0) {
+            List<String> fileGuids = systemFileList.stream().map(SystemFile::getGuid).collect(Collectors.toList());
+            technicalMap.put("picture", fileGuids);
+        }
+        return technicalMap;
+    }
+
+    @Override
+    public Map<String, Object> getBaseMap(List<QueryNoveltyProjectVO> queryNoveltyProjectVOs,List<RetrieveRecordVO> retrieveRecordVOS,PersonnelVO personnelVO) {
+        Map<String, Object> baseMap = new HashMap<>();
+        if (queryNoveltyProjectVOs == null || queryNoveltyProjectVOs.size() == 0) {
+            return baseMap;
+        }
+        QueryNoveltyProjectVO queryNoveltyProjectVO = queryNoveltyProjectVOs.get(0);
+        baseMap.put("searchUnitContact", queryNoveltyProjectVO.getSearchUnitContact());
+        baseMap.put("applicants", queryNoveltyProjectVO.getApplicants());
+        baseMap.put("customCaseNumber", queryNoveltyProjectVO.getCustomCaseNumber());
+        baseMap.put("caseName", queryNoveltyProjectVO.getCaseName());
+        baseMap.put("technicalContact", queryNoveltyProjectVO.getTechnicalContact());
+        baseMap.put("searchUnit", queryNoveltyProjectVO.getSearchUnit());
+
+        baseMap.put("inventor", queryNoveltyProjectVO.getInventor());
+        baseMap.put("inventorContact", "");
+        baseMap.put("distinguishTechnical", "");
+        baseMap.put("remark", queryNoveltyProjectVO.getRemark());
+        baseMap.put("analyse", "");
+        baseMap.put("preliminaryConclusions", queryNoveltyProjectVO.getPreliminaryConclusions());
+        baseMap.put("applicationAdvice", queryNoveltyProjectVO.getApplicationAdvice());
+        baseMap.put("conclusions", NoveltyTempalteUtil.reFinalConclusions(Arrays.asList(queryNoveltyProjectVO.getPreliminaryConclusions(), queryNoveltyProjectVO.getApplicationAdvice())));
+        baseMap.put("ifPatentability", "是");
+        baseMap.put("ipr", queryNoveltyProjectVO.getIpr());
+        if (queryNoveltyProjectVO.getHeadName() != null) {
+            baseMap.put("searchName", queryNoveltyProjectVO.getHeadName());
+        } else if (queryNoveltyProjectVO.getCreateName() != null) {
+            baseMap.put("searchName", queryNoveltyProjectVO.getCreateName());
+        }
+        if (retrieveRecordVOS != null && retrieveRecordVOS.size() > 0) {
+            RetrieveRecordVO retrieveRecordVO = retrieveRecordVOS.get(retrieveRecordVOS.size() - 1);
+            Date date = retrieveRecordVO.getRetrieveTime();
+            if (date != null) {
+                String dateStr = DateUtils.formatDate(date, "yyyy-MM-dd");
+                baseMap.put("searchTime", dateStr);
+            }
+            if (queryNoveltyProjectVO.getSearchUnit() == null || queryNoveltyProjectVO.getSearchUnit().trim().equals("")) {
+                baseMap.put("searchUnit", personnelVO.getTenantName());
+            }
+        }
+        return baseMap;
+    }
+
+    @Override
+    public List<Map<String, Object>> getCompareLiteratureMap(List<CompareLiteratureVO> compareLiteratureVOS) {
+        List<Map<String, Object>> maps = new ArrayList<>();
+        List<Patent> patents = new ArrayList<>();
+        if (compareLiteratureVOS == null || compareLiteratureVOS.size() == 0) {
+            return maps;
+        }
+        try {
+            List<String> patentNos = compareLiteratureVOS.stream().map(CompareLiteratureVO::getLiteratureNo).collect(Collectors.toList());
+            patents = esPatentService.getPatentsByNo(patentNos, false, null, null);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        if (compareLiteratureVOS != null) {
+            int index = 1;
+            for (CompareLiteratureVO compareLiteratureVO : compareLiteratureVOS) {
+                String no = compareLiteratureVO.getLiteratureNo();
+                Patent patent = patents.stream().filter(item -> item.getPatentNo().equals(no)).findFirst().orElse(null);
+                String pubilcNo = patent.getGrantNo();
+                if (pubilcNo == null) {
+                    pubilcNo = patent.getPublicNo();
+                }
+                Date publicDate = patent.getGrantDate();
+                if (publicDate == null) {
+                    publicDate = patent.getPublicDate();
+                }
+
+                Map<String, Object> map = new HashMap<>();
+                map.put("index", "D" + index);
+                map.put("publicNo", pubilcNo);
+                if (patent != null && patent.getTitle() != null && patent.getTitle().size() > 0) {
+                    String content = patent.getTitle().get(0).getTextContent();
+                    map.put("title", content);
+                }
+                if (publicDate != null) {
+                    String dateStr = DateUtils.formatDate(publicDate, "yyyy-MM-dd");
+                    map.put("publicDate", dateStr);
+                }
+                if (patent != null && patent.getApplicant() != null && patent.getApplicant().size() > 0) {
+                    List<String> names = patent.getApplicant().stream().map(PatentPerson::getName).collect(Collectors.toList());
+                    String nameStr = StringUtils.join(names, "、");
+                    map.put("applicant", nameStr);
+                }
+                maps.add(map);
+                index++;
+            }
+        }
+        return maps;
+    }
+
+    @Override
+    public List<Map<String, Object>> getCompareRecordMap(List<NoveltyCompareRecordQueryVO> noveltyCompareRecordQueryVOs, List<CompareLiteratureVO> compareLiteratureVOS) {
+        List<Map<String, Object>> maps = new ArrayList<>();
+
+        if (compareLiteratureVOS == null || compareLiteratureVOS.size() == 0) {
+            return maps;
+        }
+        List<String> patentNos = compareLiteratureVOS.stream().map(CompareLiteratureVO::getLiteratureNo).collect(Collectors.toList());
+        List<Patent> patents = new ArrayList<>();
+        try {
+            patents = esPatentService.getPatentsByNo(patentNos, false, null, null);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        Integer index = 1;
+        for (CompareLiteratureVO compareLiteratureVO : compareLiteratureVOS) {
+            Map<String, Object> map = new HashMap<>();
+            String patentNo = compareLiteratureVO.getLiteratureNo();
+            StringBuilder str = new StringBuilder("对比文件");
+            str.append(index);
+            str.append(":");
+            str.append(patentNo);
+            String abstr = "";
+            Patent patent = patents.stream().filter(item -> item.getPatentNo().equals(patentNo)).findFirst().orElse(null);
+            if (patent != null && patent.getTitle() != null && patent.getTitle().size() != 0) {
+                str.append(patent.getTitle().get(0).getTextContent());
+            }
+            str.append("<br>");
+            if (patent != null && patent.getAbstractStr() != null && patent.getAbstractStr().size() > 0) {
+                abstr = "[摘要原文]" + patent.getAbstractStr().get(0).getTextContent();
+            }
+
+
+            List<String> contentList = new ArrayList<>();
+            List<NoveltyCompareRecordVO> noveltyCompareRecordVOS = compareLiteratureVO.getNoveltyCompareRecordVOS();
+            if (noveltyCompareRecordVOS != null) {
+                for (NoveltyCompareRecordVO item : noveltyCompareRecordVOS) {
+                    String markText = item.getMarkNoteText();
+                    String finText = abstr + "(" + markText + ")";
+                    contentList.add(finText);
+                }
+            }
+
+            List<NoveltyCompareRecordQueryVO> tempRecordVos = noveltyCompareRecordQueryVOs.stream().filter(item -> item.getPatentNo().equals(patentNo)).collect(Collectors.toList());
+            if (tempRecordVos != null && tempRecordVos.size() != 0) {
+                for (int i = 0; i < tempRecordVos.size(); i++) {
+                    NoveltyCompareRecordQueryVO vo = tempRecordVos.get(i);
+                    String markSelectField = vo.getMarkSelectField();
+                    String markSelectText = vo.getMarkSelectText();
+                    String technicalFeature = vo.getTechnicalFeature();
+                    String markNoteText = vo.getMarkNoteText();
+                    StringBuilder stringBuilder = new StringBuilder();
+
+                    stringBuilder.append("[" + markSelectField + "]");
+                    stringBuilder.append(markSelectText);
+                    if (technicalFeature != null && !technicalFeature.trim().equals("")) {
+                        stringBuilder.append("揭示了" + technicalFeature);
+                    }
+                    stringBuilder.append(markNoteText);
+                    contentList.add(stringBuilder.toString());
+                }
+
+            }
+            String content = "";
+            if (contentList.size() > 0) {
+                content = StringUtils.join(contentList, "<br>");
+
+            }
+            str.append(content);
+            map.put("content", str);
+            maps.add(map);
+            index++;
+        }
+
+
+        return maps;
+    }
+
+    @Override
+    public List<Map<String, Object>> getSearchRecordMap(List<RetrieveRecordVO> retrieveRecordVOS) {
+        List<Map<String, Object>> maps = new ArrayList<>();
+        if (retrieveRecordVOS != null) {
+            retrieveRecordVOS.forEach(item -> {
+                Map<String, Object> map = new HashMap<>();
+
+                map.put("conditions", item.getConditions());
+
+                maps.add(map);
+            });
+        }
+        return maps;
+    }
+
+
+    public Map<String, Object> getBaseMap(List<QueryNoveltyProjectVO> queryNoveltyProjectVOs, List<RetrieveRecordVO> retrieveRecordVOS) {
+        Map<String, Object> baseMap = new HashMap<>();
+        if (queryNoveltyProjectVOs == null || queryNoveltyProjectVOs.size() == 0) {
+            return baseMap;
+        }
+        if (retrieveRecordVOS != null && retrieveRecordVOS.size() > 0) {
+            List<String> tools = Arrays.asList("智慧芽", "Patentics", "IncoPat", "DI(科睿唯安)", "obrit", "万象云");
+            List<String> dbTypes = new ArrayList<>();
+            retrieveRecordVOS.forEach(item -> {
+                if (tools.contains(item.getDbType())) {
+                    dbTypes.add(item.getDbType());
+                }
+            });
+            if (dbTypes.size() == 0) {
+                dbTypes.add("其他");
+            }
+            baseMap.put("searchTool", dbTypes);
+        }
+        QueryNoveltyProjectVO queryNoveltyProjectVO = queryNoveltyProjectVOs.get(0);
+        baseMap.put("searchUnitContact", queryNoveltyProjectVO.getSearchUnitContact());
+        baseMap.put("applicants", queryNoveltyProjectVO.getApplicants());
+        baseMap.put("customCaseNumber", queryNoveltyProjectVO.getCustomCaseNumber());
+        baseMap.put("caseName", queryNoveltyProjectVO.getCaseName());
+        baseMap.put("technicalContact", queryNoveltyProjectVO.getTechnicalContact());
+        baseMap.put("searchUnit", queryNoveltyProjectVO.getSearchUnit());
+        baseMap.put("inventor", queryNoveltyProjectVO.getInventor());
+        baseMap.put("inventorContact", "");
+        baseMap.put("distinguishTechnical", "");
+        baseMap.put("remark", queryNoveltyProjectVO.getRemark());
+        baseMap.put("analyse", "");
+        baseMap.put("preliminaryConclusions", queryNoveltyProjectVO.getPreliminaryConclusions());
+        baseMap.put("applicationAdvice", queryNoveltyProjectVO.getApplicationAdvice());
+        baseMap.put("conclusions", NoveltyTempalteUtil.reFinalConclusions(Arrays.asList(queryNoveltyProjectVO.getPreliminaryConclusions(), queryNoveltyProjectVO.getApplicationAdvice())));
+        baseMap.put("ifPatentability", "是");
+        baseMap.put("ipr", queryNoveltyProjectVO.getIpr());
+        if (queryNoveltyProjectVO.getHeadName() != null) {
+            baseMap.put("searchName", queryNoveltyProjectVO.getHeadName());
+        } else if (queryNoveltyProjectVO.getCaseName() != null) {
+            baseMap.put("searchName", queryNoveltyProjectVO.getCreateName());
+        }
+        return baseMap;
+    }
+
+}

+ 247 - 0
src/main/java/cn/cslg/pas/factorys/noveltyTemplateFacotry/GetshidaixinganTempalte.java

@@ -0,0 +1,247 @@
+package cn.cslg.pas.factorys.noveltyTemplateFacotry;
+
+import cn.cslg.pas.common.model.cronModel.PersonnelVO;
+import cn.cslg.pas.common.model.cronModel.SystemFile;
+import cn.cslg.pas.common.utils.DateUtils;
+import cn.cslg.pas.common.utils.StringUtils;
+import cn.cslg.pas.common.vo.CompareLiteratureVO;
+import cn.cslg.pas.common.vo.NoveltyProjectVO.NoveltyCompareRecordQueryVO;
+import cn.cslg.pas.common.vo.NoveltyProjectVO.NoveltyCompareRecordVO;
+import cn.cslg.pas.common.vo.NoveltyProjectVO.RetrieveRecordVO;
+import cn.cslg.pas.common.vo.QueryNoveltyProjectVO;
+import cn.cslg.pas.common.vo.TechnicalCaseVO;
+import cn.cslg.pas.domain.es.Patent;
+import cn.cslg.pas.domain.es.PatentPerson;
+import cn.cslg.pas.service.business.es.EsPatentService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * @Author lrj
+ * @Date 2025/02/20
+ */
+@Component
+public class GetshidaixinganTempalte implements GetTemplateMapsImp {
+    @Autowired
+    private EsPatentService esPatentService;
+    @Override
+    public  Map<String,Object> getMap(List<QueryNoveltyProjectVO> queryNoveltyProjectVOs,TechnicalCaseVO technicalCaseVO,List<CompareLiteratureVO> compareLiteratureVOS,List<NoveltyCompareRecordQueryVO> noveltyCompareRecordQueryVOS,List<RetrieveRecordVO> retrieveRecordVOS, PersonnelVO personnelVO){
+        Map<String,Object> map =new HashMap<>();
+        Map<String, Object> baseMap = this.getBaseMap(queryNoveltyProjectVOs, retrieveRecordVOS,personnelVO);
+        Map<String, Object> technicalCaseMap = this.getTechnicalCaseMap(technicalCaseVO);
+        List<Map<String, Object>> compareLiteratureMap = this.getCompareLiteratureMap(compareLiteratureVOS);
+        List<Map<String, Object>> compareRecordMap = this.getCompareRecordMap(noveltyCompareRecordQueryVOS, compareLiteratureVOS);
+        List<Map<String, Object>> searchRecordMap = this.getSearchRecordMap(retrieveRecordVOS);
+        map.put("baseMessage", baseMap);
+        map.put("technicalCase", technicalCaseMap);
+        map.put("compareLiterature", compareLiteratureMap);
+        map.put("compareRecord", compareRecordMap);
+        map.put("searchRecord", searchRecordMap);
+        return map;
+    }
+    @Override
+    public Map<String, Object> getTechnicalCaseMap(TechnicalCaseVO technicalCaseVO) {
+        Map<String, Object> technicalMap = new HashMap<>();
+        technicalMap.put("inventionPoint", technicalCaseVO.getInventionPoint());
+        technicalMap.put("solvedProblem", technicalCaseVO.getSolvedProblem());
+        List<SystemFile> systemFileList = technicalCaseVO.getSystemFileList();
+        if (systemFileList != null && systemFileList.size() != 0) {
+            List<String> fileGuids = systemFileList.stream().map(SystemFile::getGuid).collect(Collectors.toList());
+            technicalMap.put("picture", fileGuids);
+        }
+        return technicalMap;
+    }
+
+    @Override
+    public Map<String, Object> getBaseMap(List<QueryNoveltyProjectVO> queryNoveltyProjectVOs,List<RetrieveRecordVO> retrieveRecordVOS,PersonnelVO personnelVO) {
+        Map<String, Object> baseMap = new HashMap<>();
+        if (queryNoveltyProjectVOs == null || queryNoveltyProjectVOs.size() == 0) {
+            return baseMap;
+        }
+        QueryNoveltyProjectVO queryNoveltyProjectVO = queryNoveltyProjectVOs.get(0);
+        baseMap.put("searchUnitContact", queryNoveltyProjectVO.getSearchUnitContact());
+        baseMap.put("applicants", queryNoveltyProjectVO.getApplicants());
+        baseMap.put("customCaseNumber", queryNoveltyProjectVO.getCustomCaseNumber());
+        baseMap.put("caseName", queryNoveltyProjectVO.getCaseName());
+        baseMap.put("technicalContact", queryNoveltyProjectVO.getTechnicalContact());
+        baseMap.put("searchUnit", queryNoveltyProjectVO.getSearchUnit());
+
+        baseMap.put("inventor", queryNoveltyProjectVO.getInventor());
+        baseMap.put("inventorContact", "");
+        baseMap.put("distinguishTechnical", "");
+        baseMap.put("remark", queryNoveltyProjectVO.getRemark());
+        baseMap.put("analyse", "");
+        baseMap.put("preliminaryConclusions", queryNoveltyProjectVO.getPreliminaryConclusions());
+        baseMap.put("applicationAdvice", queryNoveltyProjectVO.getApplicationAdvice());
+        baseMap.put("conclusions", NoveltyTempalteUtil.reFinalConclusions(Arrays.asList(queryNoveltyProjectVO.getPreliminaryConclusions(), queryNoveltyProjectVO.getApplicationAdvice())));
+        baseMap.put("ifPatentability", "是");
+        baseMap.put("ipr", queryNoveltyProjectVO.getIpr());
+        if (queryNoveltyProjectVO.getHeadName() != null) {
+            baseMap.put("searchName", queryNoveltyProjectVO.getHeadName());
+        } else if (queryNoveltyProjectVO.getCaseName() != null) {
+            baseMap.put("searchName", queryNoveltyProjectVO.getCreateName());
+        }
+        return baseMap;
+    }
+
+    @Override
+    public List<Map<String, Object>> getCompareLiteratureMap(List<CompareLiteratureVO> compareLiteratureVOS) {
+        List<Map<String, Object>> maps = new ArrayList<>();
+        List<Patent> patents = new ArrayList<>();
+        if (compareLiteratureVOS == null || compareLiteratureVOS.size() == 0) {
+            return maps;
+        }
+        try {
+            List<String> patentNos = compareLiteratureVOS.stream().map(CompareLiteratureVO::getLiteratureNo).collect(Collectors.toList());
+            patents = esPatentService.getPatentsByNo(patentNos, false, null, null);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        if (compareLiteratureVOS != null) {
+            int index = 1;
+            for (CompareLiteratureVO compareLiteratureVO : compareLiteratureVOS) {
+                String no = compareLiteratureVO.getLiteratureNo();
+                Patent patent = patents.stream().filter(item -> item.getPatentNo().equals(no)).findFirst().orElse(null);
+                String pubilcNo = patent.getGrantNo();
+                if (pubilcNo == null) {
+                    pubilcNo = patent.getPublicNo();
+                }
+                Date publicDate = patent.getGrantDate();
+                if (publicDate == null) {
+                    publicDate = patent.getPublicDate();
+                }
+
+                Map<String, Object> map = new HashMap<>();
+
+                map.put("publicNo", pubilcNo);
+                if(patent!=null&&patent.getTitle()!=null&&patent.getTitle().size()>0){
+                    String content=patent.getTitle().get(0).getTextContent();
+                    map.put("title", content);
+                }
+                if (publicDate != null) {
+                    String dateStr = DateUtils.formatDate(publicDate, "yyyy-MM-dd");
+                    map.put("publicDate", dateStr);
+                }
+                if(patent!=null&&patent.getApplicant()!=null&&patent.getApplicant().size()>0){
+                    List<String> names =patent.getApplicant().stream().map(PatentPerson::getName).collect(Collectors.toList());
+                    String nameStr=StringUtils.join(names,"、");
+                    map.put("applicant",nameStr);
+                }
+                maps.add(map);
+                index++;
+            }
+        }
+        return maps;
+    }
+
+    @Override
+    public List<Map<String, Object>> getCompareRecordMap(List<NoveltyCompareRecordQueryVO> noveltyCompareRecordQueryVOs, List<CompareLiteratureVO> compareLiteratureVOS) {
+        List<Map<String, Object>> maps = new ArrayList<>();
+
+        if (compareLiteratureVOS == null || compareLiteratureVOS.size() == 0) {
+            return maps;
+        }
+        List<String> patentNos = compareLiteratureVOS.stream().map(CompareLiteratureVO::getLiteratureNo).collect(Collectors.toList());
+        List<Patent> patents = new ArrayList<>();
+        try {
+            patents = esPatentService.getPatentsByNo(patentNos, false, null, null);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        Integer index = 1;
+        for (CompareLiteratureVO compareLiteratureVO : compareLiteratureVOS) {
+            Map<String, Object> map = new HashMap<>();
+            String patentNo = compareLiteratureVO.getLiteratureNo();
+            StringBuilder str = new StringBuilder("对比文件");
+            str.append(index);
+            str.append(":");
+            str.append(patentNo);
+            String abstr = "";
+            Patent patent = patents.stream().filter(item -> item.getPatentNo().equals(patentNo)).findFirst().orElse(null);
+            if (patent != null && patent.getTitle() != null && patent.getTitle().size() != 0) {
+                str.append(patent.getTitle().get(0).getTextContent());
+            }
+            str.append("<br>");
+            if (patent != null && patent.getAbstractStr() != null && patent.getAbstractStr().size() > 0) {
+                abstr = "[摘要原文]" + patent.getAbstractStr().get(0).getTextContent();
+            }
+
+
+            List<String> contentList = new ArrayList<>();
+            List<NoveltyCompareRecordVO> noveltyCompareRecordVOS = compareLiteratureVO.getNoveltyCompareRecordVOS();
+            if (noveltyCompareRecordVOS != null) {
+                for (NoveltyCompareRecordVO item : noveltyCompareRecordVOS) {
+                    String markText = item.getMarkNoteText();
+                    String finText = abstr + "(" + markText + ")";
+                    contentList.add(finText);
+                }
+            }
+
+            List<NoveltyCompareRecordQueryVO> tempRecordVos = noveltyCompareRecordQueryVOs.stream().filter(item -> item.getPatentNo().equals(patentNo)).collect(Collectors.toList());
+            if (tempRecordVos != null && tempRecordVos.size() != 0) {
+                for (int i = 0; i < tempRecordVos.size(); i++) {
+                    NoveltyCompareRecordQueryVO vo = tempRecordVos.get(i);
+                    String markSelectField = vo.getMarkSelectField();
+                    String markSelectText = vo.getMarkSelectText();
+                    String technicalFeature = vo.getTechnicalFeature();
+                    String markNoteText = vo.getMarkNoteText();
+                    StringBuilder stringBuilder = new StringBuilder();
+
+                    stringBuilder.append("[" + markSelectField + "]");
+                    stringBuilder.append(markSelectText);
+                    if (technicalFeature != null && !technicalFeature.trim().equals("")) {
+                        stringBuilder.append("揭示了" + technicalFeature);
+                    }
+                    stringBuilder.append(markNoteText);
+                    contentList.add(stringBuilder.toString());
+                }
+
+            }
+            String content = "";
+            if (contentList.size() > 0) {
+                content = StringUtils.join(contentList, "<br>");
+
+            }
+            str.append(content);
+            map.put("content", str);
+            maps.add(map);
+            index++;
+        }
+
+
+        return maps;
+    }
+
+    @Override
+    public List<Map<String, Object>> getSearchRecordMap(List<RetrieveRecordVO> retrieveRecordVOS) {
+        List<Map<String, Object>> maps = new ArrayList<>();
+        if (retrieveRecordVOS != null) {
+            retrieveRecordVOS.forEach(item -> {
+                Map<String, Object> map = new HashMap<>();
+                map.put("searchCondition", item.getConditions());
+                String dbType = item.getDbType();
+                if (dbType == null || dbType.trim().equals("")) {
+                    dbType = "小世系统";
+                }
+                String re = NoveltyTempalteUtil.getDbTypes(dbType);
+                if (re == null) {
+                    re = "";
+                }
+                map.put("area", re);
+                map.put("dbType", dbType);
+                map.put("totalNum", item.getTotalNum());
+                Date retrieveTime = item.getRetrieveTime();
+                if (retrieveTime != null) {
+                    String dateStr = DateUtils.formatDate(retrieveTime, "yyyy-MM-dd");
+                    map.put("retrieveTime", dateStr);
+                }
+                maps.add(map);
+            });
+        }
+        return maps;
+    }
+}

+ 27 - 0
src/main/java/cn/cslg/pas/factorys/noveltyTemplateFacotry/NoveltyTempalteUtil.java

@@ -0,0 +1,27 @@
+package cn.cslg.pas.factorys.noveltyTemplateFacotry;
+
+import cn.cslg.pas.common.utils.StringUtils;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+public class NoveltyTempalteUtil {
+    public static String reFinalConclusions(List<String> strs) {
+        String reStr = "";
+        strs = strs.stream().filter(item -> item != null && !item.trim().equals("")).collect(Collectors.toList());
+        if (strs.size() > 0) {
+            reStr = StringUtils.join(strs, ",") + "。";
+        }
+        return reStr;
+
+    }
+    public static String getDbTypes(String db){
+        Map<String,String> map =new HashMap<>();
+        map.put("CN","中国数据库");
+        map.put("WD","全球数据库");
+      String re=  map.get(db);
+      return  re;
+    }
+}

+ 42 - 0
src/main/java/cn/cslg/pas/factorys/noveltyTemplateFacotry/NoveltyTemplateFactory.java

@@ -0,0 +1,42 @@
+package cn.cslg.pas.factorys.noveltyTemplateFacotry;
+
+import cn.cslg.pas.factorys.PatentExportFactory.GetValueImp;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationContext;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/1/11
+ */
+@Component
+public class NoveltyTemplateFactory {
+    @Autowired
+    private ApplicationContext applicationContext;
+
+    public GetTemplateMapsImp getClass(Integer templateId) {
+        switch (templateId) {
+            case 1:
+                return applicationContext.getBean(GetCommonTempalte.class);
+            case 2:
+                return applicationContext.getBean(GetVisionoxTempalte.class);
+            case 4:
+                return applicationContext.getBean(GetVisionoxcxTempalte.class);
+            case 5:
+                return applicationContext.getBean(GetShenNanTempalte.class);
+            case 6:
+                return applicationContext.getBean(GetaiqijiTempalte.class);
+            case 7:
+                return applicationContext.getBean(GetshidaixinganTempalte.class);
+            case 8:
+                return applicationContext.getBean(GetlingpaoTempalte.class);
+            case 9:
+                return applicationContext.getBean(GetningdeTempalte.class);
+            case 10:
+                return applicationContext.getBean(GetDahuaTempalte.class);
+        }
+        return null;
+    }
+}

+ 84 - 9
src/main/java/cn/cslg/pas/service/business/AssoTaskFileService.java

@@ -1,19 +1,21 @@
 package cn.cslg.pas.service.business;
 
 import cn.cslg.pas.common.dto.business.AssoTaskFileDTO;
+import cn.cslg.pas.common.model.cronModel.Personnel;
 import cn.cslg.pas.common.model.cronModel.PersonnelVO;
 import cn.cslg.pas.common.model.cronModel.SystemFile;
+import cn.cslg.pas.common.model.projectTask.FileDTO;
 import cn.cslg.pas.common.utils.CacheUtils;
 import cn.cslg.pas.common.utils.LoginUtils;
 import cn.cslg.pas.common.vo.business.AssoTaskFileVO;
-import cn.cslg.pas.domain.business.AssoHandleResultFile;
-import cn.cslg.pas.domain.business.AssoTaskFile;
-import cn.cslg.pas.domain.business.ProjectTask;
-import cn.cslg.pas.domain.business.TaskHandleResult;
+import cn.cslg.pas.common.vo.business.ProjectTaskVO;
+import cn.cslg.pas.domain.business.*;
+import cn.cslg.pas.exception.ExceptionEnum;
 import cn.cslg.pas.exception.UnLoginException;
 import cn.cslg.pas.exception.XiaoShiException;
 import cn.cslg.pas.mapper.AssoTaskFileMapper;
 import cn.cslg.pas.service.common.FileManagerService;
+import cn.cslg.pas.service.permissions.PermissionService;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -28,6 +30,7 @@ import java.util.stream.Collectors;
 
 /**
  * 任务与文件关联表的Service
+ *
  * @Author xiexiang
  * @Date 2023/11/24
  */
@@ -41,14 +44,16 @@ public class AssoTaskFileService extends ServiceImpl<AssoTaskFileMapper, AssoTas
 
     @Autowired
     private FileManagerService fileManagerService;
-
+    @Autowired
+    private PermissionService permissionService;
 
     /**
      * 添加任务与文件关联
+     *
      * @param assoTaskFileDTO
      * @return
      */
-    public List<Integer> addTaskFile(AssoTaskFileDTO assoTaskFileDTO){
+    public List<Integer> addTaskFile(AssoTaskFileDTO assoTaskFileDTO) {
         if (assoTaskFileDTO.getTaskId() == null) {
             throw new XiaoShiException("任务id不能为空");
         }
@@ -57,7 +62,7 @@ public class AssoTaskFileService extends ServiceImpl<AssoTaskFileMapper, AssoTas
         }
         //获取登陆人信息 用于设置创建人
         PersonnelVO personnelVO = new PersonnelVO();
-            personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+        personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
 
         List<String> fileGuids = assoTaskFileDTO.getFileGuids();
         List<AssoTaskFile> assoTaskFiles = new ArrayList<>();
@@ -75,6 +80,7 @@ public class AssoTaskFileService extends ServiceImpl<AssoTaskFileMapper, AssoTas
 
     /**
      * 查询文件与任务关联
+     *
      * @param taskId
      * @return
      */
@@ -99,23 +105,92 @@ public class AssoTaskFileService extends ServiceImpl<AssoTaskFileMapper, AssoTas
                 if (systemFile != null) {
                     BeanUtils.copyProperties(assoTaskFile, assoTaskFileVO);
                     assoTaskFileVO.setFileType(systemFile.getType());
-                    assoTaskFileVO.setFileName(systemFile.getOriginalName());
+                    assoTaskFileVO.setOriginalName(systemFile.getOriginalName());
                     assoTaskFileVOS.add(assoTaskFileVO);
                 }
             }
         }
+        this.loadProjectTaskFiles(assoTaskFileVOS);
         return assoTaskFileVOS;
     }
 
     /**
      * 删除任务与文件关联表
+     *
      * @param ids
      */
-    public void deleteAssoTaskFile(List<Integer> ids){
+    public void deleteAssoTaskFile(List<Integer> ids) {
         if (ids.size() != 0) {
             this.removeBatchByIds(ids);
         } else {
             throw new XiaoShiException("需要删除的ids不为空");
         }
     }
+
+    public void loadProjectTaskFiles(List<AssoTaskFileVO> assoTaskFileVOS) throws IOException {
+        List<String> createIds = new ArrayList<>();
+
+        assoTaskFileVOS.forEach(
+                item -> {
+                    if (item.getCreateId() != null) {
+                        createIds.add(item.getCreateId());
+                    }
+
+                }
+        );
+        List<Personnel> personnels = new ArrayList<>();
+
+        //查询发起人名称
+        if (createIds.size() != 0) {
+            String res = permissionService.getPersonnelByIdsFromPCS(createIds);
+            JSONObject jsonObject = JSONObject.parseObject(res);
+            personnels = JSONObject.parseArray(jsonObject.getString("data"), Personnel.class);
+        }
+
+        //装载信息
+        for (AssoTaskFileVO assoTaskFileVO : assoTaskFileVOS) {
+            String createId = assoTaskFileVO.getCreateId();
+            //装载人员信息
+            Personnel personnel = personnels.stream().filter(item -> item.getId().equals(createId)).findFirst().orElse(null);
+            if (personnel != null) {
+                assoTaskFileVO.setCreateName(personnel.getPersonnelName());
+            }
+
+
+        }
+    }
+
+    public AssoTaskFile getAssoTaskFileByGuid(String guid) {
+        LambdaQueryWrapper<AssoTaskFile> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(AssoTaskFile::getFileGuid, guid).or().eq(AssoTaskFile::getRootFileGuid,guid);
+        AssoTaskFile assoTaskFile = this.getOne(queryWrapper,false);
+        return assoTaskFile;
+
+
+    }
+
+    public List<Integer> addTaskFile(List<FileDTO> fileDTOS ,Integer taskId) {
+        if (taskId == null) {
+            throw new XiaoShiException("任务id不能为空");
+        }
+        if (fileDTOS == null || fileDTOS.size()== 0) {
+            throw new XiaoShiException("文件ids不能为空");
+        }
+        //获取登陆人信息 用于设置创建人
+        PersonnelVO personnelVO = new PersonnelVO();
+        personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+
+        List<AssoTaskFile> assoTaskFiles = new ArrayList<>();
+        for (FileDTO item : fileDTOS) {
+            AssoTaskFile assoTaskFile = new AssoTaskFile();
+            assoTaskFile.setRootFileGuid(item.getRootGuid());
+            assoTaskFile.setFileGuid(item.getGuid());
+            assoTaskFile.setTaskId(taskId);
+            assoTaskFile.setCreateId(personnelVO.getId());
+            assoTaskFiles.add(assoTaskFile);
+        }
+        this.saveBatch(assoTaskFiles);
+        List<Integer> ids = assoTaskFiles.stream().map(AssoTaskFile::getId).collect(Collectors.toList());
+        return ids;
+    }
 }

+ 63 - 23
src/main/java/cn/cslg/pas/service/business/PatentDigProjectFilesService.java

@@ -6,12 +6,14 @@ import cn.cslg.pas.common.model.cronModel.Personnel;
 import cn.cslg.pas.common.model.cronModel.PersonnelVO;
 import cn.cslg.pas.common.model.cronModel.Records;
 import cn.cslg.pas.common.model.cronModel.SystemFile;
+import cn.cslg.pas.common.model.projectTask.FileDTO;
 import cn.cslg.pas.common.model.request.GroupRequest;
 import cn.cslg.pas.common.model.request.QueryRequest;
 import cn.cslg.pas.common.utils.CacheUtils;
 import cn.cslg.pas.common.utils.LoginUtils;
 import cn.cslg.pas.common.vo.business.PatentDigProjectFilesVO;
 import cn.cslg.pas.domain.business.*;
+import cn.cslg.pas.exception.ExceptionEnum;
 import cn.cslg.pas.exception.UnLoginException;
 import cn.cslg.pas.exception.XiaoShiException;
 import cn.cslg.pas.factorys.businessFactory.Business;
@@ -26,14 +28,13 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.io.File;
 import java.io.IOException;
 import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -140,7 +141,7 @@ public class PatentDigProjectFilesService extends ServiceImpl<PatentDigProjectFi
         }
         //获取登陆人信息 用于设置创建人
         PersonnelVO personnelVO = new PersonnelVO();
-            personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+        personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
         List<Integer> ids = new ArrayList<>();
 
         if (patentDigProjectFilesDTO.getFileGuids() != null && !patentDigProjectFilesDTO.getFileGuids().isEmpty()) {
@@ -263,15 +264,17 @@ public class PatentDigProjectFilesService extends ServiceImpl<PatentDigProjectFi
      * @param patentDigProjectFilesDTO
      * @return
      */
-    public Integer addPDProjectFilesTask(PatentDigProjectFilesDTO patentDigProjectFilesDTO) {
+    @Transactional(rollbackFor = Exception.class)
+    public Integer addPDProjectFilesTask(PatentDigProjectFilesDTO patentDigProjectFilesDTO) throws Exception {
         //首先调用新增文件接口
         List<Integer> ids = (List<Integer>) this.addMessage(patentDigProjectFilesDTO);
         //其次调用新增任务接口
         patentDigProjectFilesDTO.getProjectTaskDTO().setProjectId(patentDigProjectFilesDTO.getProjectId());
         patentDigProjectFilesDTO.getProjectTaskDTO().setProcessId(patentDigProjectFilesDTO.getProcessId());
-        Integer taskType = 7;
+        Integer taskType = 5;
         patentDigProjectFilesDTO.getProjectTaskDTO().setType(taskType);
         Integer taskId = projectTaskService.addTask(patentDigProjectFilesDTO.getProjectTaskDTO());
+
         if (!ids.isEmpty()) {
             LambdaQueryWrapper<PatentDigProjectFiles> queryWrapper = new LambdaQueryWrapper<>();
             queryWrapper.in(PatentDigProjectFiles::getId, ids);
@@ -281,7 +284,11 @@ public class PatentDigProjectFilesService extends ServiceImpl<PatentDigProjectFi
                     item.setTaskId(taskId);
                 });
                 this.updateBatchById(patentDigProjectFiles);
+
             }
+            List<FileDTO> fileDTOS = new ArrayList<>();
+            this.getFileDTOs(patentDigProjectFiles, taskId, fileDTOS);
+            assoTaskFileService.addTaskFile(fileDTOS, taskId);
         }
         return taskId;
     }
@@ -314,9 +321,9 @@ public class PatentDigProjectFilesService extends ServiceImpl<PatentDigProjectFi
     /**
      * 查询专利挖掘项目所有文件
      * 来源:1 PatentDigProjectFiles
-     *      2 AssoHandleResultFile
-     *      3 AssoProjectFile
-     *      4 AssoTaskFile
+     * 2 AssoHandleResultFile
+     * 3 AssoProjectFile
+     * 4 AssoTaskFile
      *
      * @param queryPatentDigProjectFilesDTO
      */
@@ -354,6 +361,7 @@ public class PatentDigProjectFilesService extends ServiceImpl<PatentDigProjectFi
         //查询项目下所有任务的文件
         LambdaQueryWrapper<ProjectTask> queryWrapper1 = new LambdaQueryWrapper<>();
         queryWrapper1.eq(ProjectTask::getProjectId, projectId);
+        queryWrapper1.ne(ProjectTask::getType, 5);
         if (processId != null) {
             queryWrapper1.eq(ProjectTask::getProcessId, processId);
         }
@@ -393,16 +401,25 @@ public class PatentDigProjectFilesService extends ServiceImpl<PatentDigProjectFi
                 LambdaQueryWrapper<AssoHandleResultFile> queryWrapper4 = new LambdaQueryWrapper<>();
                 queryWrapper4.in(AssoHandleResultFile::getTaskHandleResultId, resultIds);
                 List<AssoHandleResultFile> assoHandleResultFiles = assoHandleResultFileService.list(queryWrapper4);
-                assoHandleResultFiles.forEach(item -> {
-                    PatentDigProjectFilesVO patentDigProjectFilesVO = new PatentDigProjectFilesVO();
-                    patentDigProjectFilesVO.setProjectId(projectId);
-                    patentDigProjectFilesVO.setFileGuid(item.getFileGuid());
-                    patentDigProjectFilesVO.setCreateId(item.getCreateId());
-                    patentDigProjectFilesVO.setProcessId(processId);
-                    patentDigProjectFilesVO.setCreateTime(item.getCreateTime());
-                    patentDigProjectFilesVO.setSource(2);
-                    patentDigProjectFilesVOS.add(patentDigProjectFilesVO);
-                });
+                for (TaskHandleResult taskHandleResult : taskHandleResults) {
+                    ProjectTask projectTask = projectTasks.stream().filter(item -> item.getId().equals(taskHandleResult.getTaskId())).findFirst().orElse(null);
+                    Integer resultId = taskHandleResult.getId();
+                    List<AssoHandleResultFile> assoHandleResultFiletemps = assoHandleResultFiles.stream().filter(item -> item.getTaskHandleResultId().equals(resultId)).collect(Collectors.toList());
+                    assoHandleResultFiletemps.forEach(item -> {
+                        PatentDigProjectFilesVO patentDigProjectFilesVO = new PatentDigProjectFilesVO();
+                        patentDigProjectFilesVO.setHandleResult(taskHandleResult.getHandleResult());
+                        patentDigProjectFilesVO.setProjectId(projectId);
+                        patentDigProjectFilesVO.setFileGuid(item.getFileGuid());
+                        patentDigProjectFilesVO.setCreateId(item.getCreateId());
+                        if (projectTask != null) {
+                            patentDigProjectFilesVO.setProcessId(projectTask.getProcessId());
+                        }
+                        patentDigProjectFilesVO.setCreateTime(item.getCreateTime());
+                        patentDigProjectFilesVO.setSource(2);
+                        patentDigProjectFilesVOS.add(patentDigProjectFilesVO);
+                    });
+                }
+
             }
         }
         //查询项目下的文件
@@ -433,9 +450,10 @@ public class PatentDigProjectFilesService extends ServiceImpl<PatentDigProjectFi
     /**
      * 删除
      * 来源:1 PatentDigProjectFiles
-     *      2 AssoHandleResultFile
-     *      3 AssoProjectFile
-     *      4 AssoTaskFile
+     * 2 AssoHandleResultFile
+     * 3 AssoProjectFile
+     * 4 AssoTaskFile
+     *
      * @param source
      * @param fileGuid
      */
@@ -462,4 +480,26 @@ public class PatentDigProjectFilesService extends ServiceImpl<PatentDigProjectFi
             }
         }
     }
+
+    public void getFileDTOs(List<PatentDigProjectFiles> patentDigProjectFiles, Integer taskId, List<FileDTO> fileDTOS) {
+        List<File> files = new ArrayList<>();
+        patentDigProjectFiles.forEach(item -> {
+            if (fileDTOS != null) {
+                try {
+                    File file = fileManagerService.getOrgTempFileByGuid(item.getFileGuid());
+                    List<String> guids = fileManagerService.uploadFileGetGuid2(Arrays.asList(file));
+                    if (guids != null && guids.size() > 0) {
+                        FileDTO fileDTO = new FileDTO();
+                        fileDTO.setGuid(guids.get(0));
+                        fileDTO.setRootGuid(item.getFileGuid());
+                        fileDTOS.add(fileDTO);
+                    }
+                    files.add(file);
+                } catch (Exception e) {
+                    throw new XiaoShiException(ExceptionEnum.BUSINESS_ERROR, "上传文件失败");
+                }
+            }
+        });
+        files.forEach(item -> item.delete());
+    }
 }

+ 110 - 111
src/main/java/cn/cslg/pas/service/business/PatentDigProjectService.java

@@ -92,13 +92,13 @@ public class PatentDigProjectService extends ServiceImpl<PatentDigProjectMapper,
     private QueryGroupFactory queryGroupFactory;
 
     @Autowired
-    private  SystemDictService systemDictService;
+    private SystemDictService systemDictService;
 
     @Override
     public Object queryMessage(QueryRequest queryRequest) throws Exception {
         List<String> sqls = formatQueryService.reSqls(queryRequest, "patentDigProject");
         //根据sql查询专题库信息
-       sqls = this.loadSearchSql(sqls);
+        sqls = this.loadSearchSql(sqls);
         List<PatentDigProjectVO> patentProjectVOS = patentDigProjectMapper.getPatentDigProject(sqls.get(0), sqls.get(1), sqls.get(2));
         Long total = patentDigProjectMapper.getPatentDigCount(sqls.get(0));
         //装载专利数据库信息
@@ -161,13 +161,13 @@ public class PatentDigProjectService extends ServiceImpl<PatentDigProjectMapper,
         }
 
         tableName = "( select p.id as id ,p.create_id as createId,p.tenant_id as tenantId,p.head_id as headId,asps.scenario_id as scenarioId,aspm.matter_id as matterId,p.create_time as createTime ,entrust_id as entrustId,entrust_type as entrustType ,aspe.event_id as eventId from patent_dig_project as dp left join project as p on dp.project_id =p.id left join rd_project rp on dp.rd_project_id =rp.id ";
-        tableName+=  "left join (select * from asso_project_event where scenario_id is not null ) as asps on p.id = asps.project_id " +
+        tableName += "left join (select * from asso_project_event where scenario_id is not null ) as asps on p.id = asps.project_id " +
                 "left join (select * from asso_project_event where event_id is not null ) as aspe on p.id = aspe.project_id " +
                 "left join (select * from asso_project_event where matter_id is not null ) as aspm on p.id = aspm.project_id) as t";
         //返回分组数据
         QueryGroupImp queryGroupImp = queryGroupFactory.getClass(groupConfig.getGroupClass());
-        String countFiled="distinct t.id";
-        ReGroupDataVO reGroupDataVO = queryGroupImp.getGroup(sqls, tableName, groupConfig.getSqlField(),countFiled);
+        String countFiled = "distinct t.id";
+        ReGroupDataVO reGroupDataVO = queryGroupImp.getGroup(sqls, tableName, groupConfig.getSqlField(), countFiled);
 
         //装载数据
         GroupVO groupVO = new GroupVO();
@@ -187,10 +187,11 @@ public class PatentDigProjectService extends ServiceImpl<PatentDigProjectMapper,
     public Object addMessage(Object object) {
         //获取登陆人信息 用于设置创建人
         PersonnelVO personnelVO = new PersonnelVO();
-            personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+        personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
 
         String userId = personnelVO.getId();
         PatentDigProjectDTO patentDigProjectDTO = (PatentDigProjectDTO) object;
+        Integer id = patentDigProjectDTO.getId();
         PatentDigProject patentDigProject = new PatentDigProject();
         BeanUtils.copyProperties(patentDigProjectDTO, patentDigProject);
         Project project = new Project();
@@ -235,8 +236,12 @@ public class PatentDigProjectService extends ServiceImpl<PatentDigProjectMapper,
             }
         }
 
-
-        project.insert();
+        if (id != null) {
+            project.setId(id);
+            project.updateById();
+        } else {
+            project.insert();
+        }
         patentDigProject.setProjectId(project.getId());
 
 
@@ -248,8 +253,7 @@ public class PatentDigProjectService extends ServiceImpl<PatentDigProjectMapper,
             LambdaQueryWrapper<RdProject> queryWrapper = new LambdaQueryWrapper<>();
             queryWrapper.eq(RdProject::getNumber, patentDigProjectDTO.getRdnumber());
             rdProjects = rdProjectService.list(queryWrapper);
-        }
-        else if (patentDigProjectDTO.getRdName() != null && rdProjects.size() == 0) {
+        } else if (patentDigProjectDTO.getRdName() != null && rdProjects.size() == 0) {
             //根据研发项目编号查询研发项目
             LambdaQueryWrapper<RdProject> queryWrapper = new LambdaQueryWrapper<>();
             queryWrapper.eq(RdProject::getName, patentDigProjectDTO.getRdName());
@@ -274,7 +278,7 @@ public class PatentDigProjectService extends ServiceImpl<PatentDigProjectMapper,
                 rdProject.insert();
             }
         }
-        if (rdProject.getId()!=null) {
+        if (rdProject.getId() != null) {
             patentDigProject.setRdProjectId(rdProject.getId());
         }
         patentDigProject.setState(2);
@@ -307,7 +311,7 @@ public class PatentDigProjectService extends ServiceImpl<PatentDigProjectMapper,
         if (events != null && events.size() != 0) {
             //遍历传入的事件集合
             if (events != null && events.size() != 0) {
-                assoProjectEventService.addAssoEventProject(events,project.getId(),2);
+                assoProjectEventService.addAssoEventProject(events, project.getId(), 2);
             }
         }
 
@@ -337,7 +341,7 @@ public class PatentDigProjectService extends ServiceImpl<PatentDigProjectMapper,
     public Object updateMessage(Object object) {
         //获取登陆人信息 用于设置创建人
         PersonnelVO personnelVO = new PersonnelVO();
-            personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+        personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
         String userId = personnelVO.getId();
         PatentDigProjectUpdateDTO projectUpdateDTO = (PatentDigProjectUpdateDTO) object;
         PatentDigProject patentDigProject = new PatentDigProject();
@@ -348,8 +352,7 @@ public class PatentDigProjectService extends ServiceImpl<PatentDigProjectMapper,
         //当委托方id不为空时
         if (StringUtils.isNotEmpty(projectUpdateDTO.getEntrustId()) && !StringUtils.equals(projectUpdateDTO.getEntrustId(), "-1")) {
             project.setEntrustId(projectUpdateDTO.getEntrustId());
-        }
-        else {//若且租户类型为代理机构,并且委托方id为空,委托方名称不为空时,新增委托方
+        } else {//若且租户类型为代理机构,并且委托方id为空,委托方名称不为空时,新增委托方
             if (projectUpdateDTO.getEntrustName() != null && projectUpdateDTO.getEntrustName().trim() != "") {
                 ClientDTO clientDTO = new ClientDTO();
                 clientDTO.setName(projectUpdateDTO.getEntrustName());
@@ -387,107 +390,105 @@ public class PatentDigProjectService extends ServiceImpl<PatentDigProjectMapper,
             }
         }
 
-            RdProject rdProject = new RdProject();
-            List<RdProject> rdProjects = new ArrayList<>();
-            if (projectUpdateDTO.getRdnumber() != null) {
-                //根据研发项目编号查询研发项目
-                LambdaQueryWrapper<RdProject> queryWrappera = new LambdaQueryWrapper<>();
-                queryWrappera.eq(RdProject::getNumber, projectUpdateDTO.getRdnumber());
-                rdProjects = rdProjectService.list(queryWrappera);
-            } else if (projectUpdateDTO.getRdName() != null && rdProjects.size() == 0) {
-                //根据研发项目编号查询研发项目
-                LambdaQueryWrapper<RdProject> queryWrappera = new LambdaQueryWrapper<>();
-                queryWrappera.eq(RdProject::getName, projectUpdateDTO.getRdName());
-                rdProjects = rdProjectService.list(queryWrappera);
+        RdProject rdProject = new RdProject();
+        List<RdProject> rdProjects = new ArrayList<>();
+        if (projectUpdateDTO.getRdnumber() != null) {
+            //根据研发项目编号查询研发项目
+            LambdaQueryWrapper<RdProject> queryWrappera = new LambdaQueryWrapper<>();
+            queryWrappera.eq(RdProject::getNumber, projectUpdateDTO.getRdnumber());
+            rdProjects = rdProjectService.list(queryWrappera);
+        } else if (projectUpdateDTO.getRdName() != null && rdProjects.size() == 0) {
+            //根据研发项目编号查询研发项目
+            LambdaQueryWrapper<RdProject> queryWrappera = new LambdaQueryWrapper<>();
+            queryWrappera.eq(RdProject::getName, projectUpdateDTO.getRdName());
+            rdProjects = rdProjectService.list(queryWrappera);
+
+        }
 
-            }
+        if (rdProjects.size() != 0) {
+            rdProject = rdProjects.get(0);
+            rdProject.setProductPhase(projectUpdateDTO.getProductPhase());
+            rdProject.setProduct(projectUpdateDTO.getProduct());
+            rdProject.updateById();
 
-            if (rdProjects.size() != 0) {
-                rdProject = rdProjects.get(0);
+        } else {
+            if (projectUpdateDTO.getRdName() != null || projectUpdateDTO.getRdnumber() != null || projectUpdateDTO.getProduct() != null || projectUpdateDTO.getProductPhase() != null) {
+                rdProject.setName(projectUpdateDTO.getRdName());
+                rdProject.setCreateId(userId);
+                rdProject.setTenantId(personnelVO.getTenantId());
+                rdProject.setNumber(projectUpdateDTO.getRdnumber());
                 rdProject.setProductPhase(projectUpdateDTO.getProductPhase());
                 rdProject.setProduct(projectUpdateDTO.getProduct());
-                rdProject.updateById();
-
-            } else {
-                if (projectUpdateDTO.getRdName() != null || projectUpdateDTO.getRdnumber() != null || projectUpdateDTO.getProduct() != null || projectUpdateDTO.getProductPhase() != null) {
-                    rdProject.setName(projectUpdateDTO.getRdName());
-                    rdProject.setCreateId(userId);
-                    rdProject.setTenantId(personnelVO.getTenantId());
-                    rdProject.setNumber(projectUpdateDTO.getRdnumber());
-                    rdProject.setProductPhase(projectUpdateDTO.getProductPhase());
-                    rdProject.setProduct(projectUpdateDTO.getProduct());
-                    rdProject.insert();
-                }
-            }
-            if (rdProject.getId() != null) {
-                patentDigProject.setRdProjectId(rdProject.getId());
+                rdProject.insert();
             }
+        }
+        if (rdProject.getId() != null) {
+            patentDigProject.setRdProjectId(rdProject.getId());
+        }
 
 
-            //更新专利挖掘项目
+        //更新专利挖掘项目
         patentDigProject.updateById();
-            //移除和附件关联
-            LambdaQueryWrapper<AssoProjectFile> assoQueryWrapper = new LambdaQueryWrapper<>();
-            assoQueryWrapper.eq(AssoProjectFile::getProjectId, projectUpdateDTO.getId());
-            assoProjectFileService.remove(assoQueryWrapper);
-
-            /**
-             * 装载和附件关联
-             */
-            List<AssoProjectFile> assoProjectFiles = new ArrayList<>();
-            List<String> fileGuids = projectUpdateDTO.getFileGuids();
-            if (fileGuids != null && fileGuids.size() != 0) {
-                for (String fileGuid : fileGuids) {
-                    AssoProjectFile assoProjectFile = new AssoProjectFile();
-                    assoProjectFile.setProjectId(project.getId());
-                    assoProjectFile.setFileGuid(fileGuid);
-                    assoProjectFile.setCreateId(personnelVO.getId());
-                    assoProjectFiles.add(assoProjectFile);
-                }
-                if (assoProjectFiles != null && assoProjectFiles.size() != 0) {
-                    assoProjectFileService.saveBatch(assoProjectFiles);
-                }
-            }
+        //移除和附件关联
+        LambdaQueryWrapper<AssoProjectFile> assoQueryWrapper = new LambdaQueryWrapper<>();
+        assoQueryWrapper.eq(AssoProjectFile::getProjectId, projectUpdateDTO.getId());
+        assoProjectFileService.remove(assoQueryWrapper);
 
-            //删除和事件关联
-            LambdaQueryWrapper<AssoProjectEvent> assoEventQueryWrapper = new LambdaQueryWrapper<>();
-            assoEventQueryWrapper.eq(AssoProjectEvent::getProjectId, projectUpdateDTO.getId());
-            assoProjectEventService.remove(assoEventQueryWrapper);
-            /**
-             * 装载事件与project关联
-             */
-            List<ProjectEventDTO> events = projectUpdateDTO.getEvents();
-                if (events != null && events.size() != 0) {
-                    assoProjectEventService.addAssoEventProject(events,project.getId(),2);
-                }
+        /**
+         * 装载和附件关联
+         */
+        List<AssoProjectFile> assoProjectFiles = new ArrayList<>();
+        List<String> fileGuids = projectUpdateDTO.getFileGuids();
+        if (fileGuids != null && fileGuids.size() != 0) {
+            for (String fileGuid : fileGuids) {
+                AssoProjectFile assoProjectFile = new AssoProjectFile();
+                assoProjectFile.setProjectId(project.getId());
+                assoProjectFile.setFileGuid(fileGuid);
+                assoProjectFile.setCreateId(personnelVO.getId());
+                assoProjectFiles.add(assoProjectFile);
+            }
+            if (assoProjectFiles != null && assoProjectFiles.size() != 0) {
+                assoProjectFileService.saveBatch(assoProjectFiles);
+            }
+        }
 
+        //删除和事件关联
+        LambdaQueryWrapper<AssoProjectEvent> assoEventQueryWrapper = new LambdaQueryWrapper<>();
+        assoEventQueryWrapper.eq(AssoProjectEvent::getProjectId, projectUpdateDTO.getId());
+        assoProjectEventService.remove(assoEventQueryWrapper);
+        /**
+         * 装载事件与project关联
+         */
+        List<ProjectEventDTO> events = projectUpdateDTO.getEvents();
+        if (events != null && events.size() != 0) {
+            assoProjectEventService.addAssoEventProject(events, project.getId(), 2);
+        }
 
 
-            LambdaQueryWrapper<AssoProjectPerson> assoProjectPersonLambdaQueryWrapper = new LambdaQueryWrapper<>();
-            assoProjectPersonLambdaQueryWrapper.eq(AssoProjectPerson::getProjectId, projectUpdateDTO.getId());
-            assoProjectPersonService.remove(assoProjectPersonLambdaQueryWrapper);
+        LambdaQueryWrapper<AssoProjectPerson> assoProjectPersonLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        assoProjectPersonLambdaQueryWrapper.eq(AssoProjectPerson::getProjectId, projectUpdateDTO.getId());
+        assoProjectPersonService.remove(assoProjectPersonLambdaQueryWrapper);
 
-            /**
-             *装载参与人
-             */
-            if (projectUpdateDTO.getInvolvedPersonIds() != null && projectUpdateDTO.getInvolvedPersonIds().size() != 0) {
-                List<AssoProjectPerson> assoProjectPersonList = new ArrayList<>();
-                projectUpdateDTO.getInvolvedPersonIds().forEach(item -> {
-                    AssoProjectPerson assoProjectPerson = new AssoProjectPerson();
-                    assoProjectPerson.setPersonId(item);
-                    assoProjectPerson.setRole(1);
-                    assoProjectPerson.setProjectId(project.getId());
-                    assoProjectPerson.setCreateId(userId);
-                    assoProjectPersonList.add(assoProjectPerson);
-                });
-                assoProjectPersonService.saveBatch(assoProjectPersonList);
-            }
-            return projectUpdateDTO.getId();
+        /**
+         *装载参与人
+         */
+        if (projectUpdateDTO.getInvolvedPersonIds() != null && projectUpdateDTO.getInvolvedPersonIds().size() != 0) {
+            List<AssoProjectPerson> assoProjectPersonList = new ArrayList<>();
+            projectUpdateDTO.getInvolvedPersonIds().forEach(item -> {
+                AssoProjectPerson assoProjectPerson = new AssoProjectPerson();
+                assoProjectPerson.setPersonId(item);
+                assoProjectPerson.setRole(1);
+                assoProjectPerson.setProjectId(project.getId());
+                assoProjectPerson.setCreateId(userId);
+                assoProjectPersonList.add(assoProjectPerson);
+            });
+            assoProjectPersonService.saveBatch(assoProjectPersonList);
         }
+        return projectUpdateDTO.getId();
+    }
 
 
-
-    public Records getRdProjectByNumber(@RequestBody StringRequest stringRequest ) {
+    public Records getRdProjectByNumber(@RequestBody StringRequest stringRequest) {
 
         List<String> sqls = formatQueryService.reSqls(stringRequest, "rdProject");
         //根据sql查询专题库信息
@@ -651,7 +652,7 @@ public class PatentDigProjectService extends ServiceImpl<PatentDigProjectMapper,
             List<AssoProjectFile> assoProjectFileTemp = assoProjectFiles.stream().filter(item -> item.getProjectId().equals(patentDigProjectVO.getId())).collect(Collectors.toList());
             if (assoProjectFileTemp.size() != 0) {
                 List<String> guidTemp = assoProjectFileTemp.stream().map(AssoProjectFile::getFileGuid).collect(Collectors.toList());
-                if (guidTemp.size() != 0&&systemFiles!=null) {
+                if (guidTemp.size() != 0 && systemFiles != null) {
                     List<SystemFile> systemFileTemp = systemFiles.stream().filter(item -> guidTemp.contains(item.getGuid())).collect(Collectors.toList());
                     if (systemFileTemp.size() != 0) {
                         patentDigProjectVO.setSystemFileList(systemFileTemp);
@@ -720,7 +721,7 @@ public class PatentDigProjectService extends ServiceImpl<PatentDigProjectMapper,
             }
 
             //装载报告状态
-            SystemDict systemDictStatus = systemDictList.stream().filter(item -> patentDigProjectVO.getState().equals(Integer.parseInt(item.getValue()))&&item.getType().equals("REPORT_STATE")).findFirst().orElse(null);
+            SystemDict systemDictStatus = systemDictList.stream().filter(item -> patentDigProjectVO.getState().equals(Integer.parseInt(item.getValue())) && item.getType().equals("REPORT_STATE")).findFirst().orElse(null);
             if (systemDictStatus != null) {
                 patentDigProjectVO.setStateName(systemDictStatus.getLabel());
             }
@@ -731,19 +732,17 @@ public class PatentDigProjectService extends ServiceImpl<PatentDigProjectMapper,
 
 
     //装载查询语句
-    private List<String> loadSearchSql(List<String> sqls){
-        PersonnelVO personnelVO =cacheUtils.getLoginUser(loginUtils.getId());
-        String id =personnelVO.getId();
-        Integer tenantId= personnelVO.getTenantId();
+    private List<String> loadSearchSql(List<String> sqls) {
+        PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+        String id = personnelVO.getId();
+        Integer tenantId = personnelVO.getTenantId();
         Integer roleType = personnelVO.getRoleType();
         String rootSql = "";
         if (roleType == null || roleType.equals(0)) {
-            rootSql ="(t.createId ="+id+" or t.headId="+id+" or t.id in (select project_id from asso_project_person where person_id ="+id+"))";
+            rootSql = "(t.createId =" + id + " or t.headId=" + id + " or t.id in (select project_id from asso_project_person where person_id =" + id + "))";
 
-        }
-        else if(roleType.equals(2))
-        {
-            rootSql="t.tenantId="+tenantId;
+        } else if (roleType.equals(2)) {
+            rootSql = "t.tenantId=" + tenantId;
         }
         if (sqls.get(0) != null && !sqls.get(0).equals("") && !rootSql.equals("")) {
             sqls.set(0, rootSql + " and" + "(" + sqls.get(0) + ")");

+ 306 - 36
src/main/java/cn/cslg/pas/service/business/ProjectTaskService.java

@@ -5,6 +5,7 @@ import cn.cslg.pas.common.model.cronModel.Personnel;
 import cn.cslg.pas.common.model.cronModel.PersonnelVO;
 import cn.cslg.pas.common.model.cronModel.Records;
 import cn.cslg.pas.common.model.cronModel.SystemFile;
+import cn.cslg.pas.common.model.projectTask.*;
 import cn.cslg.pas.common.model.request.GroupRequest;
 import cn.cslg.pas.common.model.request.QueryRequest;
 import cn.cslg.pas.common.model.request.StringRequest;
@@ -30,6 +31,8 @@ import cn.cslg.pas.service.permissions.PermissionService;
 import cn.cslg.pas.service.query.FormatQueryService;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -39,6 +42,7 @@ import org.springframework.transaction.annotation.Transactional;
 
 import org.springframework.web.multipart.MultipartFile;
 
+import java.io.File;
 import java.io.IOException;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -133,23 +137,23 @@ public class ProjectTaskService extends ServiceImpl<ProjectTaskMapper, ProjectTa
     public Object addProjectOpenAuditTask(PatentDigProjectTaskDTO patentDigProjectTaskDTO) {
         PatentDigProjectDTO patentDigProjectDTO = patentDigProjectTaskDTO.getPatentDigProjectDTO();
         ProjectTaskDTO projectTaskDTO = patentDigProjectTaskDTO.getProjectTaskDTO();
+        TaskFormDTO taskFormDTO = toTaskFormDTO(projectTaskDTO);
+
         //如果专利挖掘项目DTO不为空,则需要先建立专利挖掘项目
         if (patentDigProjectDTO != null) {
+            patentDigProjectDTO.setId(null);
             Integer projectId = (Integer) patentDigProjectService.addMessage(patentDigProjectDTO);
             if (projectId != null) {
                 projectTaskDTO.setProjectId(projectId);
                 projectTaskDTO.setType(1);
-                Integer projectTaskId = this.addTask(projectTaskDTO);
+                ProjectTask projectTask = this.addTaskByTaskFormDTO(taskFormDTO, projectId);
+                Integer projectTaskId = projectTask.getId();
                 if (projectTaskId != null) {
                     //将专利挖掘项目状态置为开卷审核
-                    LambdaQueryWrapper<PatentDigProject> queryWrapper = new LambdaQueryWrapper<>();
+                    LambdaUpdateWrapper<PatentDigProject> queryWrapper = new LambdaUpdateWrapper<>();
                     queryWrapper.eq(PatentDigProject::getProjectId, projectId);
-                    List<PatentDigProject> patentDigProjects = patentDigProjectService.list(queryWrapper);
-                    if (!patentDigProjects.isEmpty()) {
-                        PatentDigProject patentDigProject = patentDigProjects.get(0);
-                        patentDigProject.setState(0);
-                        patentDigProject.updateById();
-                    }
+                    queryWrapper.set(PatentDigProject::getState, 0);
+                    patentDigProjectService.update(queryWrapper);
                 }
                 return projectTaskId;
             } else {
@@ -166,7 +170,7 @@ public class ProjectTaskService extends ServiceImpl<ProjectTaskMapper, ProjectTa
      * @param projectTaskDTO
      * @return
      */
-    public Integer addTask(ProjectTaskDTO projectTaskDTO) {
+    public Integer addTask(ProjectTaskDTO projectTaskDTO) throws Exception {
         //判断专题库id不为空
         if (projectTaskDTO.getProjectId() == null) {
             throw new XiaoShiException("专题库id不能为空!");
@@ -192,16 +196,9 @@ public class ProjectTaskService extends ServiceImpl<ProjectTaskMapper, ProjectTa
             }
         }
 
-        if (projectTaskDTO.getLastTaskId() != null) {
-            ProjectTask projectTask = this.getById(projectTaskDTO.getLastTaskId());
-            if (projectTask.getTaskPath() == null) {
-                projectTaskDTO.setTaskPath(projectTask.getId().toString());
-            } else {
-                projectTaskDTO.setTaskPath(projectTask.getTaskPath() + "/" + projectTask.getId().toString());
-            }
-        }
         ProjectTask projectTask = new ProjectTask();
         BeanUtils.copyProperties(projectTaskDTO, projectTask);
+        projectTask.setLastTaskId(null);
         //任务状态置为处理中
         projectTask.setStatus(2);
         //获取登录人信息
@@ -212,13 +209,7 @@ public class ProjectTaskService extends ServiceImpl<ProjectTaskMapper, ProjectTa
         //设置任务的发起人
         projectTask.setCreateId(personnelVO.getId());
         projectTask.insert();
-        //如果assoTaskId为空,就设置
-        if (projectTask.getAssoTaskId() == null) {
-            if (projectTask.getType() == 1 || projectTask.getType() == 6 || projectTask.getType() == 7) {
-                projectTask.setAssoTaskId(projectTask.getId());
-                projectTask.updateById();
-            }
-        }
+        Integer taskId = projectTask.getId();
         //新增任务可能会上传附件,如果附件不为空,则添加任务与附件关联
         if (projectTaskDTO.getFileGuids() != null) {
             AssoTaskFileDTO assoTaskFileDTO = new AssoTaskFileDTO();
@@ -226,16 +217,29 @@ public class ProjectTaskService extends ServiceImpl<ProjectTaskMapper, ProjectTa
             assoTaskFileDTO.setFileGuids(projectTaskDTO.getFileGuids());
             assoTaskFileService.addTaskFile(assoTaskFileDTO);
         }
+
+        if (projectTaskDTO.getLastTaskId() != null) {
+            LambdaQueryWrapper<TaskHandleResult> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(TaskHandleResult::getTaskId, projectTaskDTO.getLastTaskId());
+            TaskHandleResult taskHandleResult = taskHandleResultService.getOne(queryWrapper, false);
+            if (taskHandleResult != null) {
+                Integer resultId = taskHandleResult.getId();
+                LambdaQueryWrapper<AssoHandleResultFile> queryWrapper1 = new LambdaQueryWrapper<>();
+                queryWrapper1.eq(AssoHandleResultFile::getTaskHandleResultId, resultId);
+                List<AssoHandleResultFile> assoHandleResultFiles = assoHandleResultFileService.list(queryWrapper1);
+                List<FileDTO> fileDTOS = new ArrayList<>();
+                this.getCopyFileDTOs(assoHandleResultFiles, fileDTOS);
+                FileFormDTO fileFormDTO = new FileFormDTO();
+                fileFormDTO.setFiles(fileDTOS);
+                this.addProjectTaskFileByFormDTO(fileFormDTO, taskId);
+            }
+        }
         //根据新增的审核任务的lastTaskId,将上一级任务状态改为审核中
         if (projectTask.getLastTaskId() != null && projectTask.getType().equals(5)) {
-            LambdaQueryWrapper<ProjectTask> queryWrapper = new LambdaQueryWrapper<>();
+            LambdaUpdateWrapper<ProjectTask> queryWrapper = new LambdaUpdateWrapper<>();
             queryWrapper.eq(ProjectTask::getId, projectTask.getLastTaskId());
-            List<ProjectTask> projectTasks = this.list(queryWrapper);
-            if (projectTasks != null && projectTasks.size() != 0) {
-                ProjectTask projectTask1 = projectTasks.get(0);
-                projectTask1.setStatus(1);
-                projectTask1.updateById();
-            }
+            queryWrapper.set(ProjectTask::getStatus, 1);
+            this.update(queryWrapper);
         }
         //项目可见人检验
         //如果是内部人员
@@ -968,19 +972,22 @@ public class ProjectTaskService extends ServiceImpl<ProjectTaskMapper, ProjectTa
     public Object addReportOpenAuditTask(ReportAuditTaskDTO reportAuditTaskDTO) {
         ReportProjectDTO reportProjectDTO = reportAuditTaskDTO.getReportProjectDTO();
         ProjectTaskDTO projectTaskDTO = reportAuditTaskDTO.getProjectTaskDTO();
+        TaskFormDTO taskFormDTO = toTaskFormDTO(projectTaskDTO);
+
         //如果报告DTO不为空,则需要先建立报告
         if (reportProjectDTO != null) {
             Integer projectId = (Integer) reportProjectService.addMessage(reportProjectDTO);
             if (projectId != null) {
                 projectTaskDTO.setProjectId(projectId);
-                Integer projectTaskId = this.addTask(projectTaskDTO);
+                ProjectTask projectTask = this.addTaskByTaskFormDTO(taskFormDTO, projectId);
+                Integer projectTaskId = projectTask.getId();
                 if (projectTaskId != null) {
                     //将侵权分析报告置为开卷审核
-                    LambdaQueryWrapper<ReportProject> queryWrapper = new LambdaQueryWrapper<>();
+                    LambdaUpdateWrapper<ReportProject> queryWrapper = new LambdaUpdateWrapper<>();
                     queryWrapper.eq(ReportProject::getProjectId, projectId);
-                    ReportProject reportProject = reportProjectService.getOne(queryWrapper, false);
-                    reportProject.setStatus(0);
-                    reportProject.updateById();
+                    queryWrapper.set(ReportProject::getStatus, 0);
+                    reportProjectService.update(queryWrapper);
+
                 }
                 return projectTaskId;
             } else {
@@ -1352,4 +1359,267 @@ public class ProjectTaskService extends ServiceImpl<ProjectTaskMapper, ProjectTa
         }
     }
 
+    public ProjectTask addTaskByTaskFormDTO(TaskFormDTO taskFormDTO, Integer projectId) {
+        String name = taskFormDTO.getName();
+        Integer handleType = taskFormDTO.getHandlerType();
+        String handleName = taskFormDTO.getHandler();
+        Date deadLineTime = taskFormDTO.getDeadLineTime();
+        Integer lastTaskId = taskFormDTO.getLastTaskId();
+        Integer assoTaskId = taskFormDTO.getAssoTaskId();
+        ProjectTask projectTask = new ProjectTask();
+        projectTask.setName(name);
+        projectTask.setHandlerType(handleType);
+        projectTask.setHandler(handleName);
+        projectTask.setDeadLineTime(deadLineTime);
+        projectTask.setProjectId(projectId);
+        projectTask.setType(taskFormDTO.getTaskType());
+        projectTask.setAssoTaskId(assoTaskId);
+
+        //任务状态置为处理中
+        projectTask.setStatus(2);
+        //获取登录人信息
+        PersonnelVO personnelVO = new PersonnelVO();
+        personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+        if (lastTaskId != null) {
+            ProjectTask projectTask1 = this.getById(lastTaskId);
+            String lastName = projectTask1.getName();
+            projectTask.setLastTaskId(lastTaskId);
+            projectTask.setProjectId(projectTask1.getProjectId());
+            projectTask.setProcessId(projectTask1.getProcessId());
+            projectTask.setType(projectTask1.getType());
+            String lastPath = projectTask1.getTaskPath();
+            if (lastPath == null) {
+                lastPath = projectTask1.getId() + "";
+            } else {
+                lastPath += "/" + projectTask1.getId();
+            }
+            projectTask.setTaskPath(lastPath);
+            Integer b = 1;
+            if (!lastPath.equals("")) {
+                String[] a = lastPath.split("/");
+                b = a.length + 1;
+            }
+
+            String newName = lastName + "-" + b + "级审核";
+            projectTask.setName(newName);
+
+        }
+
+        //设置任务的发起人
+        projectTask.setCreateId(personnelVO.getId());
+        projectTask.insert();
+        return projectTask;
+    }
+
+    public void addProjectTaskFileByFormDTO(FileFormDTO fileFormDTO, Integer taskId) {
+        List<FileDTO> fileDTOS = fileFormDTO.getFiles();
+        List<String> fileGuids = fileDTOS.stream().map(FileDTO::getGuid).collect(Collectors.toList());
+
+        if (fileGuids != null && fileGuids.size() > 0) {
+            AssoTaskFileDTO assoTaskFileDTO = new AssoTaskFileDTO();
+            assoTaskFileDTO.setTaskId(taskId);
+            assoTaskFileDTO.setFileGuids(fileGuids);
+            assoTaskFileService.addTaskFile(fileDTOS, taskId);
+        }
+    }
+
+    public Integer addFileExamineTask(AddFileExamineTaskDTO addFileExamineTaskDTO) {
+        FileFormDTO fileFormDTO = addFileExamineTaskDTO.getFileForm();
+        TaskFormDTO taskFormDTO = addFileExamineTaskDTO.getTaskForm();
+        taskFormDTO.setTaskType(taskFormDTO.getTaskType());
+        Integer projectId = fileFormDTO.getProjectId();
+        ProjectTask projectTask = this.addTaskByTaskFormDTO(taskFormDTO, projectId);
+        Integer taskId = projectTask.getId();
+        this.addProjectTaskFileByFormDTO(fileFormDTO, taskId);
+
+        //如果是内部人员
+//        if (projectTask.getHandlerType().equals(0)) {
+//            this.checkProjectPerson(1, projectTask.getHandler(), projectTask.getProjectId(), projectTask.getId());
+//        }
+        return projectTask.getId();
+    }
+
+    /**
+     * 根据任务id查询任务详情以及处理结果以及审核历史
+     *
+     * @param getExamineHistoryDTO
+     * @return
+     */
+    public List<TaskResultVO> getExamineHistory(GetExamineHistoryDTO getExamineHistoryDTO) throws IOException {
+        List<TaskResultVO> taskDetailsVOs = new ArrayList<>();
+        Integer taskId = getExamineHistoryDTO.getTaskId();
+        String fileGuid = getExamineHistoryDTO.getFileGuid();
+        Boolean ifGetLast = getExamineHistoryDTO.getIfGetLast();
+        String rootGuid = fileGuid;
+        if (fileGuid != null && !fileGuid.equals("")) {
+            AssoTaskFile assoTaskFile = assoTaskFileService.getAssoTaskFileByGuid(fileGuid);
+            if (assoTaskFile == null) {
+                return new ArrayList<>();
+            }
+            if (taskId == null) {
+                taskId = assoTaskFile.getTaskId();
+            }
+            if (assoTaskFile.getRootFileGuid() != null) {
+                rootGuid = assoTaskFile.getRootFileGuid();
+            }
+        }
+        //根据taskId 查询任务
+
+        LambdaQueryWrapper<ProjectTask> queryWrapper = new LambdaQueryWrapper<>();
+        ProjectTask projectTask = this.getById(taskId);
+        Integer rootTaskId = projectTask.getAssoTaskId();
+        if (rootTaskId == null) {
+            String path = projectTask.getTaskPath();
+            String key = null;
+            if (path == null) {
+                key = projectTask.getId() + "";
+            } else {
+                String[] paths = path.split("/");
+                key = paths[0];
+            }
+
+            queryWrapper.apply("id=" + key + " or find_in_set(" + key + ",REPLACE(task_path, '/', ',')) ");
+        } else {
+            queryWrapper.eq(ProjectTask::getAssoTaskId, rootTaskId);
+        }
+        List<ProjectTask> projectTasks = new ArrayList<>();
+        if (ifGetLast != null && ifGetLast) {
+            queryWrapper.orderByDesc(ProjectTask::getCreateTime);
+            ProjectTask projectTask1 = this.getOne(queryWrapper, false);
+            if (projectTask1 != null) {
+                projectTasks.add(projectTask1);
+            }
+        } else {
+            queryWrapper.orderByAsc(ProjectTask::getCreateTime);
+            projectTasks = this.list(queryWrapper);
+        }
+
+
+        List<Integer> taskIds = projectTasks.stream().map(ProjectTask::getId).collect(Collectors.toList());
+
+        if (taskIds == null || taskIds.size() == 0) {
+            return taskDetailsVOs;
+        }
+        LambdaQueryWrapper<TaskHandleResult> resultLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        resultLambdaQueryWrapper.in(TaskHandleResult::getTaskId, taskIds);
+        List<TaskHandleResult> taskHandleResults = taskHandleResultService.list(resultLambdaQueryWrapper);
+        List<AssoHandleResultFile> resultFiles = new ArrayList<>();
+        List<Integer> resultIds = taskHandleResults.stream().map(TaskHandleResult::getId).collect(Collectors.toList());
+        if (resultIds != null && resultIds.size() > 0) {
+            LambdaQueryWrapper<AssoHandleResultFile> resultFileWrapper = new LambdaQueryWrapper<>();
+            resultFileWrapper.in(AssoHandleResultFile::getTaskHandleResultId, resultIds);
+            if (fileGuid != null && !fileGuid.equals("")) {
+                resultFileWrapper.eq(AssoHandleResultFile::getRootFileGuid, rootGuid);
+            }
+            resultFiles = assoHandleResultFileService.list(resultFileWrapper);
+        }
+
+
+        List<String> fileGuids = resultFiles.stream().map(AssoHandleResultFile::getFileGuid).collect(Collectors.toList());
+        List<SystemFile> systemFiles = new ArrayList<>();
+        if (!fileGuids.isEmpty()) {
+            String res = fileManagerService.getSystemFileFromFMS(fileGuids);
+            systemFiles = JSONObject.parseArray(res, SystemFile.class);
+        }
+
+        for (ProjectTask projectTask1 : projectTasks) {
+            TaskResultVO taskResultVO = new TaskResultVO();
+            Integer status = projectTask1.getStatus();
+            Integer taskId1 = projectTask1.getId();
+            Integer handleType = projectTask1.getHandlerType();
+            String handler = projectTask1.getHandler();
+            TaskHandleResult taskHandleResult = taskHandleResults.stream().filter(item -> item.getTaskId().equals(taskId1)).findFirst().orElse(null);
+            if (taskHandleResult != null) {
+                BeanUtils.copyProperties(taskHandleResult, taskResultVO);
+                List<String> temGuids = resultFiles.stream().filter(item -> item.getTaskHandleResultId().equals(taskHandleResult.getId())).map(AssoHandleResultFile::getFileGuid).collect(Collectors.toList());
+                if (temGuids != null && temGuids.size() > 0) {
+                    List<SystemFile> systemFileList = systemFiles.stream().filter(item -> temGuids.contains(item.getGuid())).collect(Collectors.toList());
+                    taskResultVO.setFiles(systemFileList);
+                }
+            } else {
+                taskResultVO.setNextAuditor(projectTask1.getCreateId());
+            }
+            if (handleType.equals(0)) {
+                taskResultVO.setCreateId(handler);
+            } else {
+                taskResultVO.setCreateName(handler);
+            }
+            taskResultVO.setStatus(status);
+            taskDetailsVOs.add(taskResultVO);
+        }
+
+
+        //装载名称
+        this.loadTaskResultVos(taskDetailsVOs);
+        return taskDetailsVOs;
+    }
+
+    /**
+     * 装载任务详情的集合
+     *
+     * @param taskResultVOs
+     * @throws IOException
+     */
+    public void loadTaskResultVos(List<TaskResultVO> taskResultVOs) throws IOException {
+        //装载项目名称
+        List<String> createIds = taskResultVOs.stream().map(TaskResultVO::getCreateId).collect(Collectors.toList());
+
+        List<Personnel> personnels = new ArrayList<>();
+        //查询创建人名称
+        if (createIds.size() != 0) {
+            String res = permissionService.getPersonnelByIdsFromPCS(createIds);
+            JSONObject jsonObject = JSONObject.parseObject(res);
+            personnels = JSONObject.parseArray(jsonObject.getString("data"), Personnel.class);
+        }
+
+        //装载所有审查历史中的人员name
+        for (TaskResultVO taskResultVO : taskResultVOs) {
+            if (taskResultVO.getCreateName() == null) {
+                Personnel personnel = personnels.stream().filter(item -> item.getId().equals(taskResultVO.getCreateId())).findFirst().orElse(null);
+                if (personnel != null) {
+                    taskResultVO.setCreateName(personnel.getPersonnelName());
+                } else {
+                    throw new XiaoShiException("未获取到分配任务的负责人id信息");
+                }
+            }
+        }
+        return;
+    }
+
+    public TaskFormDTO toTaskFormDTO(ProjectTaskDTO projectTaskDTO) {
+        TaskFormDTO taskFormDTO = new TaskFormDTO();
+        taskFormDTO.setTaskType(1);
+        taskFormDTO.setHandlerType(projectTaskDTO.getHandlerType());
+        taskFormDTO.setHandler(projectTaskDTO.getHandler());
+        taskFormDTO.setDeadLineTime(projectTaskDTO.getDeadLineTime());
+        taskFormDTO.setName(projectTaskDTO.getName());
+        taskFormDTO.setDescription(projectTaskDTO.getDescription());
+        return taskFormDTO;
+    }
+
+    /**
+     * 从审核结果文件中,复制文件
+     *
+     * @param assoHandleResultFiles
+     * @param fileDTOS
+     * @throws Exception
+     */
+    public void getCopyFileDTOs(List<AssoHandleResultFile> assoHandleResultFiles, List<FileDTO> fileDTOS) throws Exception {
+        List<File> files = new ArrayList<>();
+        for (AssoHandleResultFile assoHandleResultFile : assoHandleResultFiles) {
+            String rootFileGuid = assoHandleResultFile.getFileGuid();
+            File file = fileManagerService.getOrgTempFileByGuid(assoHandleResultFile.getFileGuid());
+            files.add(file);
+            if (fileDTOS != null) {
+                List<String> guid2s = fileManagerService.uploadFileGetGuid2(Arrays.asList(file));
+                if (guid2s != null && guid2s.size() > 0) {
+                    FileDTO fileDTO = new FileDTO();
+                    fileDTO.setGuid(guid2s.get(0));
+                    fileDTO.setRootGuid(rootFileGuid);
+                    fileDTOS.add(fileDTO);
+                }
+            }
+        }
+        files.forEach(item -> item.delete());
+    }
 }

+ 249 - 6
src/main/java/cn/cslg/pas/service/business/TaskHandleResultService.java

@@ -4,29 +4,33 @@ import cn.cslg.pas.common.dto.business.ProjectTaskDTO;
 import cn.cslg.pas.common.dto.business.TaskHandleResultDTO;
 import cn.cslg.pas.common.model.cronModel.PersonnelVO;
 import cn.cslg.pas.common.model.cronModel.SystemFile;
+import cn.cslg.pas.common.model.projectTask.*;
 import cn.cslg.pas.common.utils.CacheUtils;
 import cn.cslg.pas.common.utils.LoginUtils;
 import cn.cslg.pas.common.utils.StringUtils;
 import cn.cslg.pas.common.vo.business.GetHandleResultFileVO;
 import cn.cslg.pas.common.vo.business.HandleResultFileVO;
 import cn.cslg.pas.domain.business.*;
+import cn.cslg.pas.exception.ExceptionEnum;
 import cn.cslg.pas.exception.UnLoginException;
 import cn.cslg.pas.exception.XiaoShiException;
 import cn.cslg.pas.mapper.TaskHandleResultMapper;
 import cn.cslg.pas.service.common.FileManagerService;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.RequiredArgsConstructor;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
+import java.io.File;
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Optional;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -60,6 +64,10 @@ public class TaskHandleResultService extends ServiceImpl<TaskHandleResultMapper,
     @Autowired
     private ReportProjectService reportProjectService;
     @Autowired
+    private AssoTaskFileService assoTaskFileService;
+    @Autowired
+    private PatentDigProjectService patentDigProjectService;
+    @Autowired
     private PatentDigProjectFilesService patentDigProjectFilesService;
 
     /**
@@ -68,7 +76,7 @@ public class TaskHandleResultService extends ServiceImpl<TaskHandleResultMapper,
      * @param taskHandleResultDTO
      * @return
      */
-    public Integer addTaskAuditResult(TaskHandleResultDTO taskHandleResultDTO) {
+    public Integer addTaskAuditResult(TaskHandleResultDTO taskHandleResultDTO) throws Exception {
         //判断任务id是否为空
         if (taskHandleResultDTO.getTaskId() == null) {
             throw new XiaoShiException("任务id不能为空");
@@ -102,7 +110,7 @@ public class TaskHandleResultService extends ServiceImpl<TaskHandleResultMapper,
         ProjectTask currentProjectTask = projectTaskService.getById(currentTaskId);
         //如果当前处理的是审核任务或者项目开卷审核任务,进入以下流程
         Integer taskType = currentProjectTask.getType();
-        if (taskType == 5 || taskType == 1||taskType==7) {
+        if (taskType == 5 || taskType == 1 || taskType == 7) {
             //判断下一个审核人
             String nextAuditor = taskHandleResult.getNextAuditor();
             if (StringUtils.isNotEmpty(nextAuditor)) {
@@ -248,4 +256,239 @@ public class TaskHandleResultService extends ServiceImpl<TaskHandleResultMapper,
         return getHandleResultFileVO;
     }
 
+    public TaskHandleResult addResult(SubmitResultDTO submitResultDTO) {
+        Integer handlerType = submitResultDTO.getHandlerType();
+        PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+        TaskHandleResult taskHandleResult = new TaskHandleResult();
+        BeanUtils.copyProperties(submitResultDTO, taskHandleResult);
+        taskHandleResult.setNextAuditor(submitResultDTO.getHandler());
+        taskHandleResult.setHandleResult(submitResultDTO.getResult());
+        if (handlerType != null && handlerType.equals(0)) {
+            taskHandleResult.setIfInner(true);
+        } else {
+            taskHandleResult.setIfInner(false);
+        }
+        taskHandleResult.setCreateId(personnelVO.getId());
+        //任务处理结果入库
+        taskHandleResult.insert();
+        return taskHandleResult;
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    public Integer addTaskAuditResult(SubmitResultDTO submitResultDTO) throws Exception {
+        Integer taskId = submitResultDTO.getTaskId();
+        Integer handlerType = submitResultDTO.getHandlerType();
+        String result = submitResultDTO.getResult();
+        String handler = submitResultDTO.getHandler();
+        Date deadLineTime = submitResultDTO.getDeadLineTime();
+        List<String> extraFiles = submitResultDTO.getFiles();
+        Integer createId = loginUtils.getId();
+        TaskHandleResult taskHandleResult = this.addResult(submitResultDTO);
+        Integer resultId = taskHandleResult.getId();
+        List<AssoHandleResultFile> assoHandleResultFiles = new ArrayList<>();
+
+        List<FileDTO> fileDTOS = new ArrayList<>();
+        if (handler == null || handler.equals("")) {
+            fileDTOS = null;
+        }
+        this.getCopyFiles(taskId, resultId, createId, assoHandleResultFiles, fileDTOS);
+        this.getExtraCopyFile(extraFiles, resultId, createId, assoHandleResultFiles, fileDTOS);
+        if (assoHandleResultFiles.size() > 0) {
+            assoHandleResultFileService.saveBatch(assoHandleResultFiles);
+        }
+
+        //添加下一个审核任务
+        if (handler != null) {
+            ProjectTask projectTask = projectTaskService.getById(taskId);
+            FileFormDTO fileFormDTO = new FileFormDTO();
+            fileFormDTO.setFiles(fileDTOS);
+            TaskFormDTO taskFormDTO = new TaskFormDTO();
+            taskFormDTO.setTaskType(projectTask.getType());
+            taskFormDTO.setLastTaskId(taskId);
+            taskFormDTO.setHandler(handler);
+            taskFormDTO.setAssoTaskId(projectTask.getAssoTaskId());
+            taskFormDTO.setHandlerType(handlerType);
+            taskFormDTO.setDeadLineTime(deadLineTime);
+            AddFileExamineTaskDTO addFileExamineTaskDTO = new AddFileExamineTaskDTO();
+            addFileExamineTaskDTO.setTaskForm(taskFormDTO);
+            addFileExamineTaskDTO.setFileForm(fileFormDTO);
+            projectTaskService.addFileExamineTask(addFileExamineTaskDTO);
+            LambdaUpdateWrapper<ProjectTask> updateWrapper = new LambdaUpdateWrapper<>();
+            updateWrapper.eq(ProjectTask::getId, taskId);
+            updateWrapper.set(ProjectTask::getStatus, 3);
+            projectTaskService.update(updateWrapper);
+        } else {
+            ProjectTask projectTask = projectTaskService.getById(taskId);
+            //开卷审核任务结束逻辑
+            if (projectTask.getType().equals(1)) {
+                this.updateProjectStauts(projectTask.getProjectId(), taskId, result);
+            }
+            //专利挖掘审核任务结束逻辑
+            if (projectTask.getType().equals(5)) {
+                if (projectTask.getAssoTaskId() == null) {
+                    LambdaUpdateWrapper<ProjectTask> updateWrapper = new LambdaUpdateWrapper<>();
+                    updateWrapper.eq(ProjectTask::getId, taskId);
+                    updateWrapper.set(ProjectTask::getStatus, 3);
+                    projectTaskService.update(updateWrapper);
+                    //查询所有审核结果文件
+                    List<String> rootGuids = assoHandleResultFiles.stream().map(AssoHandleResultFile::getRootFileGuid).collect(Collectors.toList());
+                    LambdaUpdateWrapper<PatentDigProjectFiles> filesUpdateWrapper = new LambdaUpdateWrapper<>();
+                    filesUpdateWrapper.in(PatentDigProjectFiles::getFileGuid, rootGuids);
+                    filesUpdateWrapper.set(PatentDigProjectFiles::getHandleResult, result);
+                    patentDigProjectFilesService.update(filesUpdateWrapper);
+                } else {
+                    LambdaUpdateWrapper<ProjectTask> updateWrapper = new LambdaUpdateWrapper<>();
+                    updateWrapper.in(ProjectTask::getId, Arrays.asList(taskId, projectTask.getAssoTaskId()));
+                    updateWrapper.set(ProjectTask::getStatus, 3);
+                    projectTaskService.update(updateWrapper);
+                    LambdaUpdateWrapper<TaskHandleResult> resultWrapper = new LambdaUpdateWrapper<>();
+                    resultWrapper.eq(TaskHandleResult::getTaskId, projectTask.getAssoTaskId());
+                    resultWrapper.set(TaskHandleResult::getHandleResult, result);
+                    this.update(resultWrapper);
+                }
+            }
+            else {
+                LambdaUpdateWrapper<ProjectTask> updateWrapper = new LambdaUpdateWrapper<>();
+                updateWrapper.eq(ProjectTask::getId, taskId);
+                updateWrapper.set(ProjectTask::getStatus, 3);
+                projectTaskService.update(updateWrapper);
+            }
+
+        }
+
+        return taskHandleResult.getId();
+    }
+
+    /**
+     * 复制任务的待审核文件到审核结果以及下一个审核任务中去
+     *
+     * @param taskId
+     * @param resultId
+     * @param createId
+     * @param assoHandleResultFiles
+     * @param fileDTOS
+     * @throws Exception
+     */
+    public void getCopyFiles(Integer taskId, Integer resultId, Integer createId, List<AssoHandleResultFile> assoHandleResultFiles, List<FileDTO> fileDTOS) throws Exception {
+        List<File> files = new ArrayList<>();
+        List<AssoTaskFile> assoTaskFiles = new ArrayList<>();
+        LambdaQueryWrapper<AssoTaskFile> taskFileQueryWrapper = new LambdaQueryWrapper<>();
+        taskFileQueryWrapper.eq(AssoTaskFile::getTaskId, taskId);
+        assoTaskFiles = assoTaskFileService.list(taskFileQueryWrapper);
+
+        for (AssoTaskFile assoTaskFile : assoTaskFiles) {
+            String rootFileGuid = assoTaskFile.getRootFileGuid();
+            if (rootFileGuid == null) {
+                rootFileGuid = assoTaskFile.getFileGuid();
+            }
+            File file = fileManagerService.getOrgTempFileByGuid(assoTaskFile.getFileGuid());
+            files.add(file);
+            List<String> guids = fileManagerService.uploadFileGetGuid2(Arrays.asList(file));
+            if (guids != null && guids.size() > 0) {
+                AssoHandleResultFile assoHandleResultFile = new AssoHandleResultFile();
+                assoHandleResultFile.setRootFileGuid(rootFileGuid);
+                assoHandleResultFile.setFileGuid(guids.get(0));
+                assoHandleResultFile.setTaskHandleResultId(resultId);
+                assoHandleResultFile.setCreateId(createId + "");
+                assoHandleResultFiles.add(assoHandleResultFile);
+
+            }
+            if (fileDTOS != null) {
+                List<String> guid2s = fileManagerService.uploadFileGetGuid2(Arrays.asList(file));
+                if (guid2s != null && guid2s.size() > 0) {
+                    FileDTO fileDTO = new FileDTO();
+                    fileDTO.setGuid(guid2s.get(0));
+                    fileDTO.setRootGuid(rootFileGuid);
+                    fileDTOS.add(fileDTO);
+                }
+            }
+
+        }
+        files.forEach(item -> item.delete());
+    }
+
+    /**
+     * 复制附件到审核结果和下一个审核任务中去
+     *
+     * @param extraFiles
+     * @param resultId
+     * @param createId
+     * @param assoHandleResultFiles
+     * @param fileDTOS
+     */
+    public void getExtraCopyFile(List<String> extraFiles, Integer resultId, Integer createId, List<AssoHandleResultFile> assoHandleResultFiles, List<FileDTO> fileDTOS) {
+
+        if (extraFiles != null && extraFiles.size() > 0) {
+            extraFiles.forEach(item -> {
+                AssoHandleResultFile assoHandleResultFile = new AssoHandleResultFile();
+                assoHandleResultFile.setFileGuid(item);
+                assoHandleResultFile.setTaskHandleResultId(resultId);
+                assoHandleResultFile.setCreateId(createId + "");
+                assoHandleResultFiles.add(assoHandleResultFile);
+                if (fileDTOS != null) {
+                    try {
+                        File file = fileManagerService.getOrgTempFileByGuid(item);
+                        List<String> guids = fileManagerService.uploadFileGetGuid2(Arrays.asList(file));
+                        if (guids != null && guids.size() > 0) {
+                            FileDTO fileDTO = new FileDTO();
+                            fileDTO.setGuid(guids.get(0));
+                            fileDTOS.add(fileDTO);
+                        }
+                        file.delete();
+                    } catch (Exception e) {
+                        throw new XiaoShiException(ExceptionEnum.BUSINESS_ERROR, "上传文件失败");
+                    }
+                }
+            });
+        }
+    }
+
+    public void upProjectTask(Integer taskId, Integer taskStatus) {
+        LambdaUpdateWrapper<ProjectTask> query = new LambdaUpdateWrapper<>();
+        query.eq(ProjectTask::getId, taskId);
+        query.set(ProjectTask::getStatus, taskStatus);
+        projectTaskService.update(query);
+    }
+
+    /**
+     * 更新项目状态
+     *
+     * @param projectId
+     * @param taskId
+     * @param result
+     */
+    public void updateProjectStauts(Integer projectId, Integer taskId, String result) {
+        Integer type = 0;
+        if (result.equals("通过")) {
+            type = 0;
+        } else if (result.equals("不通过")) {
+            type = 1;
+        }
+        //根据projectId查询类型
+        Project project = projectService.getById(projectId);
+        Integer projectType = project.getType();
+        Integer taskStatus = 3;
+        Integer projectStatus = 2;
+        if (type.equals(0)) {
+            taskStatus = 3;
+            projectStatus = 2;
+        } else if (type.equals(1)) {
+            taskStatus = 3;
+            projectStatus = 4;
+        }
+
+        //挖掘项目
+        if (projectType != null && projectType.equals(3)) {
+            LambdaUpdateWrapper<PatentDigProject> queryWrapper1 = new LambdaUpdateWrapper<>();
+            queryWrapper1.eq(PatentDigProject::getProjectId, projectId);
+            queryWrapper1.set(PatentDigProject::getState, projectStatus);
+            patentDigProjectService.update(queryWrapper1);
+        } else if (projectType != null && projectType.equals(2)) {//报告
+            LambdaUpdateWrapper<ReportProject> queryWrapper1 = new LambdaUpdateWrapper<>();
+            queryWrapper1.eq(ReportProject::getProjectId, projectId);
+            queryWrapper1.set(ReportProject::getStatus, projectStatus);
+            reportProjectService.update(queryWrapper1);
+        }
+        this.upProjectTask(taskId, taskStatus);
+    }
 }

+ 10 - 10
src/main/java/cn/cslg/pas/service/business/TechnicalCaseService.java

@@ -113,16 +113,16 @@ public class TechnicalCaseService extends ServiceImpl<TechnicalCaseMapper, Techn
             caseIdDTO.setProjectId(technicalCase.getProjectId());
 
             //保存es
-            EditInventionPointVO pointVO = this.selectTechnicalCasePatent(technicalCase.getProjectId());
-            if (!StringUtils.equals(vo.getInventionPoint(), pointVO.getInventionPoint())) {
-                TechnicalCasePatent casePatent = new TechnicalCasePatent();
-//            casePatent.setProjectId(vo.getProjectId());
-                casePatent.setInventionPoint(vo.getInventionPoint());
-                Integer count = this.updateTechnicalCasePatent(casePatent, pointVO.getPatentId());
-                if (count < 1) {
-                    throw new XiaoShiException("发明点更新Es失败");
-                }
-            }
+//            EditInventionPointVO pointVO = this.selectTechnicalCasePatent(technicalCase.getProjectId());
+//            if (!StringUtils.equals(vo.getInventionPoint(), pointVO.getInventionPoint())) {
+//                TechnicalCasePatent casePatent = new TechnicalCasePatent();
+////            casePatent.setProjectId(vo.getProjectId());
+//                casePatent.setInventionPoint(vo.getInventionPoint());
+//                Integer count = this.updateTechnicalCasePatent(casePatent, pointVO.getPatentId());
+//                if (count < 1) {
+//                    throw new XiaoShiException("发明点更新Es失败");
+//                }
+//            }
         }
 
         List<AssoTechnicalCaseFile> technicalCaseFiles = assoTechnicalCaseFileMapper.selectList(new LambdaQueryWrapper<AssoTechnicalCaseFile>()

+ 6 - 4
src/main/java/cn/cslg/pas/service/business/es/EsCustomFieldService.java

@@ -386,15 +386,17 @@ public class EsCustomFieldService {
 
         Query q4 = QueryBuilders.term(t -> t.field("custom_field.field_type").value(esCustomFieldDTO.getFieldType()));
 
-        Query parentQ1 = QueryBuilders.term(t -> t.field("app_no.keyword").value(patentNo));
+        Query parentQ1 = QueryBuilders.term(t -> t.field("patent_no.keyword").value(patentNo));
+//        Query parentQ1 = QueryBuilders.term(t -> t.field("app_no.keyword").value(patentNo));
 
         //公开号
-        Query parentQ2 = QueryBuilders.term(t -> t.field("public_no.keyword").value(patentNo));
+//        Query parentQ2 = QueryBuilders.term(t -> t.field("public_no.keyword").value(patentNo));
 
         //授权号
-        Query parentQ3 = QueryBuilders.term(t -> t.field("grant_no.keyword").value(patentNo));
+//        Query parentQ3 = QueryBuilders.term(t -> t.field("grant_no.keyword").value(patentNo));
 
-        Query parentQ = QueryBuilders.bool(i -> i.should(parentQ1, parentQ2, parentQ3));
+//        Query parentQ = QueryBuilders.bool(i -> i.should(parentQ1, parentQ2, parentQ3));
+        Query parentQ = QueryBuilders.bool(i -> i.should(parentQ1));
 
         Query q3 = QueryBuilders.hasParent(t -> t.parentType("patent").query(parentQ));
 

+ 1 - 0
src/main/java/cn/cslg/pas/service/business/es/EsPatentService.java

@@ -676,6 +676,7 @@ public class EsPatentService {
         rePatentSource.add("title");
         rePatentSource.add("project_id");
         rePatentSource.add("applicant");
+        rePatentSource.add("abstract_str");
         return rePatentSource;
     }
 

+ 7 - 6
src/main/java/cn/cslg/pas/service/business/es/EsService.java

@@ -116,12 +116,13 @@ public class EsService {
         builder.index("patent");
         PatentWithIdVO patentWithIdVO = null;
         String id = null;
-        Query q1 = QueryBuilders.term(t -> t.field("app_no.keyword").value(patentNo));
-        //公开号
-        Query q2 = QueryBuilders.term(t -> t.field("public_no.keyword").value(patentNo));
-        //授权号
-        Query q3 = QueryBuilders.term(t -> t.field("grant_no.keyword").value(patentNo));
-        Query query = QueryBuilders.bool(i -> i.should(q1, q2, q3));
+//        Query q1 = QueryBuilders.term(t -> t.field("app_no.keyword").value(patentNo));
+//        //公开号
+//        Query q2 = QueryBuilders.term(t -> t.field("public_no.keyword").value(patentNo));
+//        //授权号
+//        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));
         builder.query(query);
         SearchResponse<Patent> response = null;
         try {

+ 42 - 2
src/main/java/cn/cslg/pas/service/common/FileManagerService.java

@@ -1,21 +1,25 @@
 package cn.cslg.pas.service.common;
 
 import cn.cslg.pas.common.dto.FMSDeleteFileDTO;
+import cn.cslg.pas.common.model.cronModel.SystemFile;
+import cn.cslg.pas.common.utils.CustomizeFileUtils;
+import cn.hutool.core.io.FileUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.google.gson.Gson;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import okhttp3.*;
+import org.apache.commons.compress.utils.IOUtils;
 import org.apache.commons.io.FileUtils;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.util.FileCopyUtils;
 import org.springframework.web.multipart.MultipartFile;
 
-import java.io.File;
-import java.io.IOException;
+import java.io.*;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 import java.util.Objects;
 import java.util.concurrent.TimeUnit;
@@ -228,4 +232,40 @@ public class FileManagerService {
                 .build();
         return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
     }
+
+    public  File getTempFileByGuid(String guid)throws IOException{
+        String res = this.getSystemFileFromFMS(Arrays.asList(guid));
+        List<SystemFile> systemFiles = JSONArray.parseArray(res, SystemFile.class);
+        SystemFile systemFile = systemFiles.get(0);
+        String suffix = systemFile.getFileName().substring(systemFile.getFileName().lastIndexOf("."));
+        //调用文件系统取出文件接口,获得文件流
+        byte[] bytes = this.downloadSystemFileFromFMS(guid);
+        //创建临时文件tempFile,并将文件读取到tempFile
+        File tempFile = File.createTempFile(systemFile.getFileName() + "temp", suffix);
+        try (
+                InputStream inputStream = new ByteArrayInputStream(bytes);
+                FileOutputStream outputStream = new FileOutputStream(tempFile);
+        ) {
+            IOUtils.copy(inputStream, outputStream); // 将输入流复制到临时文件
+        }
+        return  tempFile;
+    }
+    public  File getOrgTempFileByGuid(String guid)throws IOException{
+        String res = this.getSystemFileFromFMS(Arrays.asList(guid));
+        List<SystemFile> systemFiles = JSONArray.parseArray(res, SystemFile.class);
+        SystemFile systemFile = systemFiles.get(0);
+        String suffix = systemFile.getFileName().substring(systemFile.getFileName().lastIndexOf("."));
+        //调用文件系统取出文件接口,获得文件流
+        byte[] bytes = this.downloadSystemFileFromFMS(guid);
+        //创建临时文件tempFile,并将文件读取到tempFile
+
+        File tempFile = CustomizeFileUtils.createTempFileByName(systemFile.getOriginalName());
+        try (
+                InputStream inputStream = new ByteArrayInputStream(bytes);
+                FileOutputStream outputStream = new FileOutputStream(tempFile);
+        ) {
+            IOUtils.copy(inputStream, outputStream); // 将输入流复制到临时文件
+        }
+        return  tempFile;
+    }
 }

+ 94 - 0
src/main/java/cn/cslg/pas/service/common/PersonFieldService.java

@@ -343,6 +343,100 @@ public class PersonFieldService {
         return reFieldVos;
     }
 
+    /**
+     * 获得表格导出栏位
+     * @param getTabelColumDTO
+     * @return
+     */
+    public List<PersonSelfFieldVO> getTableExportColumns(GetTabelColumDTO getTabelColumDTO) {
+        Integer projectId = getTabelColumDTO.getProjectId();
+        String tableName = getTabelColumDTO.getTableName();
+        Integer productId = getTabelColumDTO.getProductId();
+        //根据登录人id和type查询
+        PersonnelVO personnelVO = new PersonnelVO();
+        personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+
+        String userId = personnelVO.getId();
+        String key = "";
+
+        if (projectId == null) {
+            if (productId != null) {
+                key = SecureUtil.md5(tableName + RedisConf.SYMBOL_COLON + userId + RedisConf.SYMBOL_COLON + RedisConf.PRODUCT + RedisConf.SYMBOL_COLON + productId);
+            } else {
+                key = SecureUtil.md5(tableName + RedisConf.SYMBOL_COLON + userId);
+            }
+        } else {
+            key = SecureUtil.md5(tableName + RedisConf.SYMBOL_COLON + userId + RedisConf.SYMBOL_COLON + RedisConf.PROJECT + RedisConf.SYMBOL_COLON + projectId);
+        }
+        String redisKey = RedisConf.USER_FIELD + RedisConf.SYMBOL_COLON + key;
+        String json = redisUtil.get(redisKey);
+
+        String fieldJson = "";
+        //如果查到
+        List<PersonSelfFieldVO> reFieldVos = new ArrayList<>();
+        if (StringUtils.isNotEmpty(json)) {
+            reFieldVos = JsonUtils.jsonToList(json, PersonSelfFieldVO.class);
+        }
+        try {
+            fieldJson = CommonService.readJsonFile(tableName + ".json");
+        } catch (Exception e) {
+            throw new XiaoShiException("不存在此表");
+        }
+        List<PersonSelfFieldVO> fieldVOS = JSON.parseArray(fieldJson, PersonSelfFieldVO.class);
+        if (fieldVOS == null) {
+            throw new XiaoShiException("不存在此表");
+        }
+        Boolean flag = true;
+        fieldVOS = fieldVOS.stream().filter(item -> flag.equals(item.getIsExport())).collect(Collectors.toList());
+        if (CollectionUtils.isEmpty(fieldVOS)) {
+            throw new XiaoShiException("表中无字段");
+        }
+
+
+        //当tableName是patent时
+        if (PatentDictionary.NAME.equals(tableName) && projectId != null && projectId != 0) {
+            //获得所有自定义字段
+            List<AllCustomFieldVO> allCustomFieldVOS = customFieldService.getAllProjectCustomField(projectId);
+            AllCustomFieldVO allCustomFieldVO = new AllCustomFieldVO();
+            allCustomFieldVO.setName("标签");
+            allCustomFieldVO.setId(0);
+            allCustomFieldVO.setType(10);
+            allCustomFieldVOS.add(allCustomFieldVO);
+            if (!CollectionUtils.isEmpty(allCustomFieldVOS)) {
+                for (AllCustomFieldVO item : allCustomFieldVOS) {
+                    PersonSelfFieldVO personSelfFieldVO = new PersonSelfFieldVO();
+                    personSelfFieldVO.setIfHidden(true);
+                    personSelfFieldVO.setName(item.getName());
+                    personSelfFieldVO.setType(item.getType().toString());
+                    personSelfFieldVO.setValue(item.getId().toString());
+                    personSelfFieldVO.setIfPersonal(true);
+                    personSelfFieldVO.setIfSort(false);
+                    personSelfFieldVO.setDefaultHidden(true);
+                    fieldVOS.add(personSelfFieldVO);
+                }
+            }
+
+        }
+        //装载顺序
+        for (PersonSelfFieldVO item : fieldVOS) {
+            PersonSelfFieldVO personSelfFieldVO = reFieldVos.stream().filter(t -> t.getValue().equals(item.getValue()) && t.getType().equals(item.getType())).findFirst().orElse(null);
+
+            if (personSelfFieldVO == null) {
+                if (StringUtils.isNotEmpty(json)) {
+                    item.setIfHidden(true);
+                } else {
+                    if (item.getDefaultHidden() != null && item.getDefaultHidden().equals(true)) {
+                        item.setIfHidden(true);
+                    } else {
+                        item.setIfHidden(false);
+                    }
+                }
+                reFieldVos.add(item);
+            }
+        }
+        return reFieldVos;
+    }
+
     public List<PersonSelfFieldVO> setTableColumns(AddSelfFieldDTO addSelfFieldDTO) {
         PersonnelVO personnelVO = new PersonnelVO();
 

+ 2 - 1
src/main/java/cn/cslg/pas/service/novelty/NoveltyExportReportService.java

@@ -36,6 +36,7 @@ import lombok.RequiredArgsConstructor;
 import org.ddr.poi.html.HtmlRenderPolicy;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 
 import java.io.File;
@@ -43,7 +44,7 @@ import java.util.*;
 import java.util.stream.Collectors;
 
 @Service
-@RequiredArgsConstructor
+@RequiredArgsConstructor(onConstructor_ = {@Lazy})
 public class NoveltyExportReportService {
     private final NoveltyReportTemplateService noveltyReportTemplateService;
     private final NoveltyReportReferencesService noveltyReportReferencesService;

+ 98 - 7
src/main/java/cn/cslg/pas/service/novelty/NoveltyReportReferencesService.java

@@ -2,17 +2,36 @@ package cn.cslg.pas.service.novelty;
 
 import cn.cslg.pas.common.dto.NoveltyProjectDTO.NoveltyReportReferenceDTO;
 import cn.cslg.pas.common.dto.NoveltyProjectDTO.NoveltyReportReferenceQueryDTO;
+import cn.cslg.pas.common.dto.NoveltyProjectDTO.QueryNoveltyCompareRecordDTO;
+import cn.cslg.pas.common.dto.QuerySearchRecordDTO;
+import cn.cslg.pas.common.dto.TechnicalCaseIdDTO;
 import cn.cslg.pas.common.dto.business.GetReferencesDTO;
+import cn.cslg.pas.common.dto.business.LiteratureQueryDTO;
 import cn.cslg.pas.common.model.cronModel.PersonnelVO;
 import cn.cslg.pas.common.model.cronModel.Records;
-import cn.cslg.pas.common.utils.CacheUtils;
-import cn.cslg.pas.common.utils.LoginUtils;
+import cn.cslg.pas.common.model.cronModel.SystemFile;
+import cn.cslg.pas.common.model.request.QueryRequest;
+import cn.cslg.pas.common.model.request.StringRequest;
+import cn.cslg.pas.common.utils.*;
+import cn.cslg.pas.common.vo.CompareLiteratureVO;
+import cn.cslg.pas.common.vo.NoveltyProjectVO.NoveltyCompareRecordQueryVO;
+import cn.cslg.pas.common.vo.NoveltyProjectVO.NoveltyCompareRecordVO;
 import cn.cslg.pas.common.vo.NoveltyProjectVO.NoveltyReferencesVO;
+import cn.cslg.pas.common.vo.NoveltyProjectVO.RetrieveRecordVO;
+import cn.cslg.pas.common.vo.QueryNoveltyProjectVO;
+import cn.cslg.pas.common.vo.TechnicalCaseVO;
 import cn.cslg.pas.common.vo.business.ReferencesVO;
 import cn.cslg.pas.domain.business.References;
 import cn.cslg.pas.domain.business.ReportTemple;
 import cn.cslg.pas.domain.business.novelty.NoveltyReportTemplate;
+import cn.cslg.pas.domain.es.Patent;
+import cn.cslg.pas.domain.es.PatentPerson;
+import cn.cslg.pas.factorys.noveltyTemplateFacotry.GetTemplateMapsImp;
+import cn.cslg.pas.factorys.noveltyTemplateFacotry.NoveltyTemplateFactory;
+import cn.cslg.pas.service.business.NoveltyProjectService;
 import cn.cslg.pas.service.business.ReferencesService;
+import cn.cslg.pas.service.business.TechnicalCaseService;
+import cn.cslg.pas.service.business.es.EsPatentService;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import cn.cslg.pas.domain.business.novelty.NoveltyReportReferences;
@@ -21,12 +40,10 @@ import lombok.RequiredArgsConstructor;
 import org.apache.poi.hslf.record.Record;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -35,10 +52,18 @@ import java.util.stream.Collectors;
  * @createDate 2024-09-30 15:33:57
  */
 @Service
-@RequiredArgsConstructor
+@RequiredArgsConstructor(onConstructor_={@Lazy})
 public class NoveltyReportReferencesService extends ServiceImpl<NoveltyReportReferencesMapper, NoveltyReportReferences> {
     private final NoveltyReportTemplateService noveltyReportTemplateService;
     private final ReferencesService referencesService;
+    private final NoveltyProjectService noveltyProjectService;
+    private final TechnicalCaseService technicalCaseService;
+    private final NoveltyCompareLiteratureService noveltyCompareLiteratureService;
+    private final NoveltyCompareRecordService noveltyCompareRecordService;
+    private final NoveltySearchRecordService noveltySearchRecordService;
+    private final EsPatentService esPatentService;
+    private final NoveltyTemplateFactory noveltyTemplateFactory;
+    private final NoveltyExportReportService noveltyExportReportService;
     @Autowired
     private CacheUtils cacheUtils;
 
@@ -146,4 +171,70 @@ public class NoveltyReportReferencesService extends ServiceImpl<NoveltyReportRef
 
         return ids;
     }
+
+    public Integer addOrUpdate2(NoveltyReportReferenceDTO noveltyReportReferenceDTO) throws Exception {
+        Integer id = noveltyReportReferenceDTO.getId();
+        Integer projectId = noveltyReportReferenceDTO.getProjectId();
+        Integer templateId = noveltyReportReferenceDTO.getTemplateId();
+        GetTemplateMapsImp getTemplateMapsImp = noveltyTemplateFactory.getClass(templateId);
+
+
+        List<QueryNoveltyProjectVO> queryNoveltyProjectVOs = this.getQueryNoveltyProjectVOs(projectId);
+        String searchTime = noveltySearchRecordService.getLastRecordTime(projectId);
+//        baseMap.put("searchTime", searchTime);
+        TechnicalCaseVO technicalCaseVO = this.getTechnicalCaseVO(projectId);
+        List<CompareLiteratureVO> compareLiteratureVOS = this.getCompareCompareLiteratureVO(projectId);
+        List<NoveltyCompareRecordQueryVO> noveltyCompareRecordQueryVOS = this.getNoveltyCompareRecordQueryVOs(projectId);
+        List<RetrieveRecordVO> retrieveRecordVOS = this.getRetrieveRecordVOs(projectId);
+        PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+        Map<String, Object> map = getTemplateMapsImp.getMap(queryNoveltyProjectVOs, technicalCaseVO, compareLiteratureVOS, noveltyCompareRecordQueryVOS, retrieveRecordVOS,personnelVO);
+        String json = JsonUtils.objectToJson(map);
+        noveltyReportReferenceDTO.setDataSource(json);
+        id = this.addOrUpdate(noveltyReportReferenceDTO);
+        noveltyExportReportService.exportReport(id);
+        return id;
+    }
+
+    public TechnicalCaseVO getTechnicalCaseVO(Integer projectId) {
+        TechnicalCaseIdDTO technicalCaseIdDTO = new TechnicalCaseIdDTO();
+        technicalCaseIdDTO.setProjectId(projectId);
+        TechnicalCaseVO technicalCaseVO = technicalCaseService.queryTechnicalCase(technicalCaseIdDTO);
+        return technicalCaseVO;
+    }
+
+
+    public List<QueryNoveltyProjectVO> getQueryNoveltyProjectVOs(Integer projectId) throws Exception {
+        StringRequest queryRequest = new StringRequest();
+        queryRequest.setProjectId(projectId);
+        Object projectRecordsObject = noveltyProjectService.queryMessage(queryRequest);
+        Records projectRecords = (Records) projectRecordsObject;
+        List<QueryNoveltyProjectVO> queryNoveltyProjectVOs = (List<QueryNoveltyProjectVO>) projectRecords.getData();
+        return queryNoveltyProjectVOs;
+    }
+
+
+    public List<CompareLiteratureVO> getCompareCompareLiteratureVO(Integer projectId) throws Exception {
+        LiteratureQueryDTO literatureQueryDTO = new LiteratureQueryDTO();
+        literatureQueryDTO.setProjectId(projectId);
+        Records records = noveltyCompareLiteratureService.queryNoveltyCompareLiterature(literatureQueryDTO);
+        List<CompareLiteratureVO> compareLiteratureVOS1 = (List<CompareLiteratureVO>) records.getData();
+        return compareLiteratureVOS1;
+    }
+
+    public List<NoveltyCompareRecordQueryVO> getNoveltyCompareRecordQueryVOs(Integer projectId) throws Exception {
+        QueryNoveltyCompareRecordDTO queryNoveltyCompareRecordDTO = new QueryNoveltyCompareRecordDTO();
+        queryNoveltyCompareRecordDTO.setProjectId(projectId);
+        List<NoveltyCompareRecordQueryVO> noveltyCompareRecordQueryVOs = noveltyCompareRecordService.queryCompareRecord(queryNoveltyCompareRecordDTO);
+        return noveltyCompareRecordQueryVOs;
+    }
+
+    public List<RetrieveRecordVO> getRetrieveRecordVOs(Integer projectId) throws Exception {
+        cn.cslg.pas.common.dto.QuerySearchRecordDTO querySearchRecordDTO = new QuerySearchRecordDTO();
+        querySearchRecordDTO.setProjectId(projectId);
+        Records records = noveltySearchRecordService.querySearchRecord(querySearchRecordDTO);
+        List<RetrieveRecordVO> retrieveRecordVOS = (List<RetrieveRecordVO>) records.getData();
+        return retrieveRecordVOS;
+    }
+
+
 }

+ 36 - 13
src/main/java/cn/cslg/pas/service/novelty/NoveltySearchRecordService.java

@@ -8,6 +8,7 @@ import cn.cslg.pas.common.model.cronModel.PersonnelVO;
 import cn.cslg.pas.common.model.cronModel.Records;
 import cn.cslg.pas.common.model.request.OrderDTO;
 import cn.cslg.pas.common.utils.CacheUtils;
+import cn.cslg.pas.common.utils.DateUtils;
 import cn.cslg.pas.common.utils.LoginUtils;
 import cn.cslg.pas.common.vo.NoveltyProjectVO.NoveltyCompareLiteratureVO;
 import cn.cslg.pas.common.vo.NoveltyProjectVO.QueryTemplateVO;
@@ -243,7 +244,7 @@ public class NoveltySearchRecordService extends ServiceImpl<RetrieveRecordMapper
             queryWrapper.in(AssoRetrieveRecordProject::getRetrieveRecordId, retrieveIds);
             queryWrapper.eq(projectId != null, AssoRetrieveRecordProject::getProjectId, projectId);
             assoRetrieveRecordProjectService.remove(queryWrapper);
-            }
+        }
         return retrieveIds;
     }
 
@@ -256,7 +257,7 @@ public class NoveltySearchRecordService extends ServiceImpl<RetrieveRecordMapper
         List<RetrieveRecord> retrieveRecords = this.list(queryWrapper);
 
         for (RetrieveRecord retrieveRecord : retrieveRecords) {
-            if(retrieveRecord.getIfBySystem()!=null&&retrieveRecord.getIfBySystem().equals(false)){
+            if (retrieveRecord.getIfBySystem() != null && retrieveRecord.getIfBySystem().equals(false)) {
                 retrieveRecord.setId(null);
             }
         }
@@ -275,20 +276,42 @@ public class NoveltySearchRecordService extends ServiceImpl<RetrieveRecordMapper
     }
 
 
-    public String getColumns(String column){
+    public String getColumns(String column) {
         Map<String, String> map = new HashMap<>();
-        map.put("conditions","conditions");
-        map.put("dbType","db_type");
-        map.put("searchType","search_type");
-        map.put("totalNum","total_num");
-        map.put("retrieveTime","retrieve_time");
-        map.put("createName","create_id");
-        map.put("createTime","create_time");
-        map.put("updateTime","update_time");
-        map.put("ifBySystem","if_by_system");
-        map.put("searchSetting","search_setting");
+        map.put("conditions", "conditions");
+        map.put("dbType", "db_type");
+        map.put("searchType", "search_type");
+        map.put("totalNum", "total_num");
+        map.put("retrieveTime", "retrieve_time");
+        map.put("createName", "create_id");
+        map.put("createTime", "create_time");
+        map.put("updateTime", "update_time");
+        map.put("ifBySystem", "if_by_system");
+        map.put("searchSetting", "search_setting");
         String reStr = map.get(column);
         return reStr;
     }
 
+    public String getLastRecordTime(Integer projectId) {
+        LambdaQueryWrapper<AssoRetrieveRecordProject> assoQueryWrapper = new LambdaQueryWrapper<>();
+        assoQueryWrapper.eq(AssoRetrieveRecordProject::getProjectId, projectId);
+        List<AssoRetrieveRecordProject> assoRetrieveRecordProjects = assoRetrieveRecordProjectService.list(assoQueryWrapper);
+        if (!assoRetrieveRecordProjects.isEmpty()) {
+            List<Integer> retrieveIds = assoRetrieveRecordProjects.stream()
+                    .map(AssoRetrieveRecordProject::getRetrieveRecordId)
+                    .collect(Collectors.toList());
+            LambdaQueryWrapper<RetrieveRecord> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.in(RetrieveRecord::getId, retrieveIds)
+                    .orderByDesc(RetrieveRecord::getCreateTime);
+            RetrieveRecord retrieveRecord = this.getOne(queryWrapper, false);
+            if (retrieveRecord != null) {
+                Date date = retrieveRecord.getRetrieveTime();
+                if (date != null) {
+                    String dateStr = DateUtils.formatDate(date, "yyyy-MM-dd");
+                    return dateStr;
+                }
+            }
+        }
+        return "";
+    }
 }

+ 17 - 13
src/main/java/cn/cslg/pas/service/report/MatchCasePersonService.java

@@ -96,18 +96,18 @@ public class MatchCasePersonService extends ServiceImpl<MatchCasePersonMapper, M
 
     public MatchCasePerson addMatchCasePersonDB(UpdateMatchCasePersonDTO updateMatchCasePersonDTO) {
         MatchCasePerson matchCasePerson = new MatchCasePerson();
+        Integer id = updateMatchCasePersonDTO.getId();
 
         LambdaQueryWrapper<MatchCasePerson> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(MatchCasePerson::getProjectId, updateMatchCasePersonDTO.getReportId());
-        if (this.count(queryWrapper) > 1) {
-            throw new XiaoShiException(ExceptionEnum.BUSINESS_ERROR, "该报告已有多个配案人员,错误!");
-        } else if (this.count(queryWrapper) == 1) {
-            matchCasePerson = this.getOne(queryWrapper, false);
+
+        if (id != null) {
+            matchCasePerson = this.getById(id);
             if (matchCasePerson != null) {
                 matchCasePerson.setIprPersonId(updateMatchCasePersonDTO.getIprPersonId());
                 matchCasePerson.updateById();
             }
-        } else if (this.count(queryWrapper) == 0) {
+        } else {
             PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
             String personId = personnelVO.getId();
             Integer tenantId = personnelVO.getTenantId();
@@ -121,16 +121,21 @@ public class MatchCasePersonService extends ServiceImpl<MatchCasePersonMapper, M
         return matchCasePerson;
     }
 
-    public QueryMatchCasePersonVO getReportMatchCasePerson(Integer reportId) {
-        QueryMatchCasePersonVO queryMatchCasePersonVO = new QueryMatchCasePersonVO();
+    public List<QueryMatchCasePersonVO> getReportMatchCasePerson(Integer reportId) {
+        List<QueryMatchCasePersonVO> queryMatchCasePersonVOS = new ArrayList<>();
+
         LambdaQueryWrapper<MatchCasePerson> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(MatchCasePerson::getProjectId, reportId);
-        MatchCasePerson matchCasePerson = this.getOne(queryWrapper, false);
-        if (matchCasePerson != null) {
-            BeanUtils.copyProperties(matchCasePerson, queryMatchCasePersonVO);
-            this.loadQueryMatchCasePersonVO(queryMatchCasePersonVO);
+        List<MatchCasePerson> matchCasePersons = this.list(queryWrapper);
+        if (matchCasePersons != null && !matchCasePersons.isEmpty()) {
+            for (MatchCasePerson matchCasePerson : matchCasePersons) {
+                QueryMatchCasePersonVO queryMatchCasePersonVO = new QueryMatchCasePersonVO();
+                BeanUtils.copyProperties(matchCasePerson, queryMatchCasePersonVO);
+                this.loadQueryMatchCasePersonVO(queryMatchCasePersonVO);
+                queryMatchCasePersonVOS.add(queryMatchCasePersonVO);
+            }
         }
-        return queryMatchCasePersonVO;
+        return queryMatchCasePersonVOS;
     }
 
     public void loadQueryMatchCasePersonVO(QueryMatchCasePersonVO queryMatchCasePersonVO) {
@@ -141,7 +146,6 @@ public class MatchCasePersonService extends ServiceImpl<MatchCasePersonMapper, M
             queryMatchCasePersonVO.setEmail(iprPerson.getEmail());
         }
         // 人员信息装载
-
     }
 
 

+ 1 - 1
src/main/resources/application-dev.yml

@@ -65,7 +65,7 @@ PCSUrl: http://192.168.2.24:8871
 #OPSUrl: http://192.168.2.24:5001
 OPSUrl: http://139.224.24.90:5001
 PASUrl: http://localhost:8879
-FMSUrl: http://192.168.2.24:8803
+FMSUrl: http://127.0.0.1:8803
 WDUrl: http://1.116.113.26:81
 PythonUrl: http://192.168.2.24:8001
 FileSource: 1

BIN
src/main/resources/file/reportTemple/noveltyTemplate-aiqiji.docx


BIN
src/main/resources/file/reportTemple/noveltyTemplate-dahua.docx


BIN
src/main/resources/file/reportTemple/noveltyTemplate-lingpao.docx


BIN
src/main/resources/file/reportTemple/noveltyTemplate-ningde.docx


BIN
src/main/resources/file/reportTemple/noveltyTemplate-shennan.docx


BIN
src/main/resources/file/reportTemple/noveltyTemplate-shidaixinan.docx


+ 73 - 0
src/main/resources/jsons/patent.json

@@ -13,6 +13,7 @@
     "ifStats": "false",
     "groupBy": "number",
     "ifSort": "true",
+    "isExport": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -29,6 +30,7 @@
     "ifStats": "false",
     "groupBy": "text",
     "ifSort": "false",
+    "isExport": "true",
     "exportClass": "getTextContentValue"
   },
   {
@@ -58,6 +60,7 @@
     "ifStats": "false",
     "groupBy": "number",
     "ifSort": "true",
+    "isExport": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -74,6 +77,7 @@
     "ifStats": "false",
     "groupBy": "number",
     "ifSort": "true",
+    "isExport": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -90,6 +94,7 @@
     "ifStats": "false",
     "groupBy": "number",
     "ifSort": "true",
+    "isExport": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -106,6 +111,7 @@
     "ifStats": "true",
     "groupBy": "dateType",
     "ifSort": "true",
+    "isExport": "true",
     "exportClass": "getDateValue"
   },
   {
@@ -122,6 +128,7 @@
     "ifStats": "true",
     "groupBy": "dateType",
     "ifSort": "true",
+    "isExport": "true",
     "exportClass": "getDateValue"
   },
   {
@@ -138,6 +145,7 @@
     "ifStats": "true",
     "groupBy": "dateType",
     "ifSort": "true",
+    "isExport": "true",
     "exportClass": "getDateValue"
   },
   {
@@ -181,6 +189,7 @@
     "ifStats": "false",
     "groupBy": "text",
     "ifSort": "false",
+    "isExport": "true",
     "exportClass": "getTextContentValue"
   },
   {
@@ -198,6 +207,7 @@
     "defaultShowStats": "true",
     "groupBy": "company",
     "ifSort": "false",
+    "isExport": "true",
     "exportClass": "getNameValue"
   },
   {
@@ -214,6 +224,7 @@
     "ifAsCondition": "true",
     "groupBy": "company",
     "ifSort": "false",
+    "isExport": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -230,6 +241,7 @@
     "ifAsCondition": "true",
     "groupBy": "company",
     "ifSort": "false",
+    "isExport": "true",
     "exportClass": "getNameValue"
   },
   {
@@ -261,6 +273,7 @@
     "ifAsCondition": "true",
     "groupBy": "company",
     "ifSort": "false",
+    "isExport": "true",
     "exportClass": "getNameValue"
   },
   {
@@ -277,6 +290,7 @@
     "ifAsCondition": "true",
     "groupBy": "company",
     "ifSort": "false",
+    "isExport": "true",
     "exportClass": "getNameValue"
   },
   {
@@ -308,6 +322,7 @@
     "ifAsCondition": "true",
     "groupBy": "company",
     "ifSort": "false",
+    "isExport": "true",
     "exportClass": "getNameValue"
   },
   {
@@ -324,6 +339,7 @@
     "ifAsCondition": "true",
     "groupBy": "company",
     "ifSort": "false",
+    "isExport": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -340,6 +356,7 @@
     "ifAsCondition": "true",
     "groupBy": "company",
     "ifSort": "false",
+    "isExport": "true",
     "exportClass": "getNameValue"
   },
   {
@@ -370,6 +387,7 @@
     "ifStats": "false",
     "ifAsCondition": "true",
     "groupBy": "text",
+    "isExport": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -385,6 +403,7 @@
     "ifStats": "false",
     "ifAsCondition": "true",
     "groupBy": "text",
+    "isExport": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -401,6 +420,7 @@
     "ifAsCondition": "true",
     "groupBy": "company",
     "ifSort": "true",
+    "isExport": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -417,6 +437,7 @@
     "ifAsCondition": "true",
     "groupBy": "company",
     "ifSort": "true",
+    "isExport": "true",
     "exportClass": "getNameValue"
   },
   {
@@ -432,6 +453,7 @@
     "ifAsCondition": "true",
     "groupBy": "amount",
     "ifSort": "true",
+    "isExport": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -447,6 +469,7 @@
     "ifAsCondition": "true",
     "groupBy": "amount",
     "ifSort": "true",
+    "isExport": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -462,6 +485,7 @@
     "ifAsCondition": "true",
     "groupBy": "amount",
     "ifSort": "true",
+    "isExport": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -477,6 +501,7 @@
     "ifAsCondition": "true",
     "groupBy": "amount",
     "ifSort": "true",
+    "isExport": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -492,6 +517,7 @@
     "ifAsCondition": "true",
     "groupBy": "amount",
     "ifSort": "true",
+    "isExport": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -508,6 +534,7 @@
     "ifAsCondition": "true",
     "groupBy": "address",
     "ifSort": "false",
+    "isExport": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -524,6 +551,7 @@
     "ifAsCondition": "true",
     "groupBy": "nation",
     "ifSort": "true",
+    "isExport": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -540,6 +568,7 @@
     "ifAsCondition": "true",
     "groupBy": "nation",
     "ifSort": "false",
+    "isExport": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -556,6 +585,7 @@
     "ifAsCondition": "true",
     "groupBy": "nation",
     "ifSort": "false",
+    "isExport": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -572,6 +602,7 @@
     "ifAsCondition": "true",
     "groupBy": "nation",
     "ifSort": "false",
+    "isExport": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -588,6 +619,7 @@
     "ifAsCondition": "true",
     "groupBy": "nation",
     "ifSort": "false",
+    "isExport": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -604,6 +636,7 @@
     "ifAsCondition": "true",
     "groupBy": "address",
     "ifSort": "false",
+    "isExport": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -620,6 +653,7 @@
     "ifAsCondition": "true",
     "groupBy": "nation",
     "ifSort": "false",
+    "isExport": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -636,6 +670,7 @@
     "ifAsCondition": "true",
     "groupBy": "nation",
     "ifSort": "false",
+    "isExport": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -652,6 +687,7 @@
     "ifAsCondition": "true",
     "groupBy": "nation",
     "ifSort": "false",
+    "isExport": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -667,6 +703,7 @@
     "ifAsCondition": "true",
     "groupBy": "nation",
     "ifSort": "false",
+    "isExport": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -683,6 +720,7 @@
     "ifAsCondition": "true",
     "groupBy": "classify",
     "ifSort": "false",
+    "isExport": "true",
     "exportClass": "getClassifyValue",
     "children": [
       {
@@ -729,6 +767,7 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
+    "isExport": "false",
     "exportClass": "getCommonValue"
   },
   {
@@ -743,6 +782,7 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
+    "isExport": "false",
     "exportClass": "getCommonValue"
   },
   {
@@ -757,6 +797,7 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
+    "isExport": "false",
     "exportClass": "getCommonValue"
   },
   {
@@ -771,6 +812,7 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
+    "isExport": "false",
     "exportClass": "getCommonValue"
   },
   {
@@ -785,6 +827,7 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
+    "isExport": "false",
     "exportClass": "getCommonValue"
   },
   {
@@ -801,6 +844,7 @@
     "ifAsCondition": "true",
     "groupBy": "classify",
     "ifSort": "false",
+    "isExport": "true",
     "exportClass": "getClassifyValue",
     "children": [
       {
@@ -847,6 +891,7 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
+    "isExport": "false",
     "exportClass": "getCommonValue"
   },
   {
@@ -861,6 +906,7 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
+    "isExport": "false",
     "exportClass": "getCommonValue"
   },
   {
@@ -875,6 +921,7 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
+    "isExport": "false",
     "exportClass": "getCommonValue"
   },
   {
@@ -889,6 +936,7 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
+    "isExport": "false",
     "exportClass": "getCommonValue"
   },
   {
@@ -903,6 +951,7 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
+    "isExport": "false",
     "exportClass": "getCommonValue"
   },
   {
@@ -919,6 +968,7 @@
     "ifAsCondition": "true",
     "groupBy": "classify",
     "ifSort": "false",
+    "isExport": "true",
     "exportClass": "getClassifyValue",
     "children": [
       {
@@ -947,6 +997,7 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
+    "isExport": "false",
     "exportClass": "getCommonValue"
   },
   {
@@ -961,6 +1012,7 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
+    "isExport": "false",
     "exportClass": "getCommonValue"
   },
   {
@@ -977,6 +1029,7 @@
     "ifAsCondition": "true",
     "groupBy": "classify",
     "ifSort": "false",
+    "isExport": "true",
     "exportClass": "getClassifyValue",
     "children": [
       {
@@ -1005,6 +1058,7 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
+    "isExport": "false",
     "exportClass": "getCommonValue"
   },
   {
@@ -1019,6 +1073,7 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
+    "isExport": "false",
     "exportClass": "getCommonValue"
   },
   {
@@ -1034,6 +1089,7 @@
     "ifAsCondition": "true",
     "groupBy": "text",
     "ifSort": "false",
+    "isExport": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -1051,6 +1107,7 @@
     "fieldOptionQueryParam": "PATENT_SIMPLE_STATUS",
     "groupBy": "typeStatus",
     "ifSort": "true",
+    "isExport": "true",
     "exportClass": "getSimpleStatusValue",
     "optionValue": [
       {
@@ -1082,6 +1139,7 @@
     "fieldOptionQueryParam": "PATENT_TYPE",
     "groupBy": "typeStatus",
     "ifSort": "true",
+    "isExport": "true",
     "exportClass": "getPatentTypeValue",
     "optionValue": [
       {
@@ -1112,6 +1170,7 @@
     "ifAsCondition": "true",
     "groupBy": "company",
     "ifSort": "true",
+    "isExport": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -1128,6 +1187,7 @@
     "ifAsCondition": "true",
     "groupBy": "company",
     "ifSort": "true",
+    "isExport": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -1144,6 +1204,7 @@
     "ifAsCondition": "true",
     "groupBy": "nation",
     "ifSort": "false",
+    "isExport": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -1160,6 +1221,7 @@
     "ifAsCondition": "true",
     "groupBy": "dateType",
     "ifSort": "false",
+    "isExport": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -1176,6 +1238,7 @@
     "ifAsCondition": "true",
     "groupBy": "number",
     "ifSort": "false",
+    "isExport": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -1192,6 +1255,7 @@
     "ifAsCondition": "true",
     "groupBy": "number",
     "ifSort": "true",
+    "isExport": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -1208,6 +1272,7 @@
     "ifAsCondition": "true",
     "groupBy": "dateType",
     "ifSort": "true",
+    "isExport": "true",
     "exportClass": "getDateValue"
   },
   {
@@ -1224,6 +1289,7 @@
     "ifAsCondition": "true",
     "groupBy": "dateType",
     "ifSort": "true",
+    "isExport": "true",
     "exportClass": "getDateValue"
   },
   {
@@ -1240,6 +1306,7 @@
     "ifAsCondition": "true",
     "groupBy": "number",
     "ifSort": "true",
+    "isExport": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -1256,6 +1323,7 @@
     "ifAsCondition": "true",
     "groupBy": "dateType",
     "ifSort": "true",
+    "isExport": "true",
     "exportClass": "getDateValue"
   },
   {
@@ -1272,6 +1340,7 @@
     "ifAsCondition": "true",
     "groupBy": "dateType",
     "ifSort": "true",
+    "isExport": "true",
     "exportClass": "getDateValue"
   },
   {
@@ -1288,6 +1357,7 @@
     "ifAsCondition": "true",
     "groupBy": "nation",
     "ifSort": "true",
+    "isExport": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -1304,6 +1374,7 @@
     "ifAsCondition": "true",
     "groupBy": "number",
     "ifSort": "true",
+    "isExport": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -1320,6 +1391,7 @@
     "ifAsCondition": "true",
     "groupBy": "nation",
     "ifSort": "true",
+    "isExport": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -1336,6 +1408,7 @@
     "ifAsCondition": "true",
     "groupBy": "dateType",
     "ifSort": "true",
+    "isExport": "true",
     "exportClass": "getDateValue"
   },
   {

+ 1 - 1
src/main/resources/mapper/AssoHandleResultFileMapper.xml

@@ -5,7 +5,7 @@
         select count(*)  from
         asso_handle_result_file where
     task_handle_result_id in (select id from task_handle_result where task_id in (select id from
-          project_task where  project_id =#{projectId} and process_id =#{processId}
+          project_task where  project_id =#{projectId} and process_id =#{processId} and type!=5
 
         ))
     </select>

+ 12 - 3
src/test/java/cn/cslg/pas/test/PersonFiledTests.java

@@ -1,5 +1,6 @@
 package cn.cslg.pas.test;
 
+import cn.cslg.pas.common.vo.CompareLiteratureVO;
 import cn.cslg.pas.common.vo.business.AllCustomFieldVO;
 import cn.cslg.pas.service.business.CustomFieldService;
 import org.junit.Test;
@@ -8,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringRunner;
 
+import java.util.ArrayList;
 import java.util.List;
 
 @SpringBootTest
@@ -18,8 +20,15 @@ public class PersonFiledTests {
 
 @Test
     public  void tet1(){
-
-    List<AllCustomFieldVO> allCustomFieldVOS = customFieldService.getAllProjectCustomField(5495);
-System.out.println(allCustomFieldVOS);
+    List<CompareLiteratureVO> compareLiteratureVOS = new ArrayList<>();
+    this.aaa(compareLiteratureVOS);
+    System.out.println(compareLiteratureVOS);
+}
+public  void aaa(List<CompareLiteratureVO> compareLiteratureVOS){
+    List<CompareLiteratureVO> compareLiteratureVOS1 =new ArrayList<>();
+    CompareLiteratureVO compareLiteratureVO =new CompareLiteratureVO();
+    compareLiteratureVO.setLiteratureNo("1");
+    compareLiteratureVOS1.add(compareLiteratureVO);
+    compareLiteratureVOS= compareLiteratureVOS1;
 }
 }