Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/master'

zero 1 anno fa
parent
commit
6ba5178ad2
44 ha cambiato i file con 2210 aggiunte e 291 eliminazioni
  1. 8 1
      src/main/java/cn/cslg/pas/common/dto/ExportTaskDTO.java
  2. 58 0
      src/main/java/cn/cslg/pas/common/dto/HightlightTemplateDTO.java
  3. 74 0
      src/main/java/cn/cslg/pas/common/dto/business/LitigationHistoryDTO.java
  4. 24 0
      src/main/java/cn/cslg/pas/common/dto/business/OtherReferencesDTO.java
  5. 63 0
      src/main/java/cn/cslg/pas/common/dto/business/PermissionRecordDTO.java
  6. 54 0
      src/main/java/cn/cslg/pas/common/dto/business/ReviewHistoryDTO.java
  7. 7 2
      src/main/java/cn/cslg/pas/common/utils/ParseByteToFileUtils.java
  8. 3 1
      src/main/java/cn/cslg/pas/common/utils/ResponseEnum.java
  9. 58 0
      src/main/java/cn/cslg/pas/common/vo/HightlightTemplateVO.java
  10. 4 4
      src/main/java/cn/cslg/pas/common/vo/WebSocketMessageVO.java
  11. 78 0
      src/main/java/cn/cslg/pas/common/vo/business/LitigationHistoryVO.java
  12. 71 0
      src/main/java/cn/cslg/pas/common/vo/business/PermissionRecordVO.java
  13. 51 0
      src/main/java/cn/cslg/pas/common/vo/business/ReviewHistoryVO.java
  14. 59 0
      src/main/java/cn/cslg/pas/controller/HightlightTemplateController.java
  15. 54 0
      src/main/java/cn/cslg/pas/controller/LitigationHistoryController.java
  16. 40 27
      src/main/java/cn/cslg/pas/controller/PatentController.java
  17. 54 0
      src/main/java/cn/cslg/pas/controller/PermissionRecordController.java
  18. 56 0
      src/main/java/cn/cslg/pas/controller/ReviewHistoryController.java
  19. 19 0
      src/main/java/cn/cslg/pas/domain/business/AssoOtherReferencesFile.java
  20. 72 0
      src/main/java/cn/cslg/pas/domain/business/HightlightTemplate.java
  21. 95 0
      src/main/java/cn/cslg/pas/domain/business/LitigationHistory.java
  22. 49 0
      src/main/java/cn/cslg/pas/domain/business/OtherReferences.java
  23. 84 0
      src/main/java/cn/cslg/pas/domain/business/PermissionRecord.java
  24. 75 0
      src/main/java/cn/cslg/pas/domain/business/ReviewHistory.java
  25. 28 0
      src/main/java/cn/cslg/pas/factorys/getSqlFactorys/GetComBoolSql.java
  26. 13 0
      src/main/java/cn/cslg/pas/mapper/AssoOtherReferencesFileMapper.java
  27. 13 0
      src/main/java/cn/cslg/pas/mapper/HightlightTemplateMapper.java
  28. 14 0
      src/main/java/cn/cslg/pas/mapper/LitigationHistoryMapper.java
  29. 13 0
      src/main/java/cn/cslg/pas/mapper/OtherReferencesMapper.java
  30. 13 0
      src/main/java/cn/cslg/pas/mapper/PermissionRecordMapper.java
  31. 13 0
      src/main/java/cn/cslg/pas/mapper/ReviewHistoryMapper.java
  32. 16 0
      src/main/java/cn/cslg/pas/service/business/AssoOtherReferencesFileService.java
  33. 184 0
      src/main/java/cn/cslg/pas/service/business/HightlightTemplateService.java
  34. 31 14
      src/main/java/cn/cslg/pas/service/business/ImportTaskService.java
  35. 127 0
      src/main/java/cn/cslg/pas/service/business/LitigationHistoryService.java
  36. 99 0
      src/main/java/cn/cslg/pas/service/business/OtherReferencesService.java
  37. 134 228
      src/main/java/cn/cslg/pas/service/business/PDFExportFirstPageService.java
  38. 2 0
      src/main/java/cn/cslg/pas/service/business/PatentDigProjectFilesService.java
  39. 18 14
      src/main/java/cn/cslg/pas/service/business/PatentExportService.java
  40. 127 0
      src/main/java/cn/cslg/pas/service/business/PermissionRecordService.java
  41. 127 0
      src/main/java/cn/cslg/pas/service/business/ReviewHistoryService.java
  42. 5 0
      src/main/java/cn/cslg/pas/service/business/ScratchWordsService.java
  43. 1 0
      src/main/java/cn/cslg/pas/service/business/TaskHandleResultService.java
  44. 22 0
      src/main/java/cn/cslg/pas/service/common/MessageService.java

+ 8 - 1
src/main/java/cn/cslg/pas/common/dto/ExportTaskDTO.java

@@ -1,6 +1,7 @@
 package cn.cslg.pas.common.dto;
 
 import cn.cslg.pas.common.dto.es.EsCustomFieldDTO;
+import cn.cslg.pas.common.vo.es.EsCustomFieldBatchVO;
 import com.baomidou.mybatisplus.annotation.TableField;
 import lombok.Data;
 import lombok.experimental.Accessors;
@@ -18,7 +19,7 @@ import java.util.List;
 @Data
 public class ExportTaskDTO {
     private Integer projectId;
-
+    private Integer taskId;
     /**
      * 1 Excel导入
      * 2 专利号导入
@@ -49,4 +50,10 @@ public class ExportTaskDTO {
      * 完成时间
      */
     private Date finishTime;
+
+    private EsCustomFieldBatchVO EsVO;
+    private Integer state;
+    private String createId;
+    private String createName;
+    private Integer doneNum;
 }

+ 58 - 0
src/main/java/cn/cslg/pas/common/dto/HightlightTemplateDTO.java

@@ -0,0 +1,58 @@
+package cn.cslg.pas.common.dto;
+
+import cn.cslg.pas.domain.BaseEntity;
+import cn.cslg.pas.domain.business.HightlightTemplate;
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 高亮
+ * @Author xiexiang
+ * @Date 2024/1/12
+ */
+@Data
+public class HightlightTemplateDTO {
+    private Integer id;
+
+    /**
+     * 模板名称
+     */
+    private String name;
+
+    /**
+     * 是否启用
+     */
+    private Boolean ifEnable;
+
+    /**
+     * 是否默认
+     */
+    private Boolean ifDefault;
+
+    /**
+     * description
+     */
+    private String description;
+
+    /**
+     * 创建人
+     */
+    private String createId;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * config
+     */
+    private String config;
+
+    private Integer projectId;
+
+    private List<HightlightTemplate.Config> configs;
+}

+ 74 - 0
src/main/java/cn/cslg/pas/common/dto/business/LitigationHistoryDTO.java

@@ -0,0 +1,74 @@
+package cn.cslg.pas.common.dto.business;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/1/15
+ */
+@Data
+public class LitigationHistoryDTO {
+    private Integer id;
+    /**
+     * 原告
+     */
+    private String plaintiff;
+
+    /**
+     * 被告
+     */
+    private String defendant;
+
+
+    /**
+     * 案由
+     */
+    private String causeOfAction;
+
+    /**
+     * 起诉时间
+     */
+    @JsonFormat(
+            pattern = "yyyy-MM-dd",
+            timezone = "GMT+8"
+    )
+    private Date indictTime;
+
+    /**
+     * 结果
+     */
+    private String result;
+
+    /**
+     * 案件详情
+     */
+    private String caseDetails;
+
+    /**
+     * 附件id
+     */
+    private String fileGuid;
+
+    /**
+     * projectId
+     */
+    private Integer projectId;
+
+    /**
+     * 专利号
+     */
+    private String patentNo;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 法院
+     */
+    private String court;
+}

+ 24 - 0
src/main/java/cn/cslg/pas/common/dto/business/OtherReferencesDTO.java

@@ -0,0 +1,24 @@
+package cn.cslg.pas.common.dto.business;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/1/17
+ */
+@Data
+public class OtherReferencesDTO {
+    private Integer id;
+
+    private Integer projectId;
+
+    private String remark;
+
+    private String referencesName;
+
+    private String referenceUrl;
+
+    private List<String> fileGuids;
+}

+ 63 - 0
src/main/java/cn/cslg/pas/common/dto/business/PermissionRecordDTO.java

@@ -0,0 +1,63 @@
+package cn.cslg.pas.common.dto.business;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 许可历史
+ * @Author xiexiang
+ * @Date 2024/1/16
+ */
+@Data
+public class PermissionRecordDTO {
+    private Integer id;
+    /**
+     * 专利号
+     */
+    private String patentNo;
+
+    /**
+     * 许可人 (默认为专利权利人)
+     */
+    private String licensor;
+
+    /**
+     * 被许可人
+     */
+    private String licensee;
+
+    /**
+     * 被许可人国家
+     */
+    private String licenseeCountry;
+
+    /**
+     * 许可时间
+     */
+    @JsonFormat(
+            pattern = "yyyy-MM-dd",
+            timezone = "GMT+8"
+    )
+    private Date licenseTime;
+
+    /**
+     * 许可费用(万元)
+     */
+    private Double licenseFee;
+
+    /**
+     * 截止时间
+     */
+    @JsonFormat(
+            pattern = "yyyy-MM-dd",
+            timezone = "GMT+8"
+    )
+    private Date licenseDeadLine;
+
+    /**
+     * 许可类型
+     */
+    private String licenseType;
+}

+ 54 - 0
src/main/java/cn/cslg/pas/common/dto/business/ReviewHistoryDTO.java

@@ -0,0 +1,54 @@
+package cn.cslg.pas.common.dto.business;
+
+import cn.cslg.pas.domain.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 审查历史
+ * @Author xiexiang
+ * @Date 2024/1/15
+ */
+@Data
+public class ReviewHistoryDTO {
+
+    private Integer id;
+
+    /**
+     * 时间
+     */
+    @JsonFormat(
+            pattern = "yyyy-MM-dd",
+            timezone = "GMT+8"
+    )
+    private Date reviewTime ;
+
+    /**
+     * 事件
+     */
+    private String reviewEvent;
+
+    /**
+     * 说明
+     */
+    private String reviewExplain;
+
+    /**
+     * 文件id
+     */
+    private String fileGuid;
+
+    /**
+     * 所属project
+     */
+    private Integer projectId;
+
+    /**
+     * 专利号
+     */
+    private String patentNo;
+
+}

+ 7 - 2
src/main/java/cn/cslg/pas/common/utils/ParseByteToFileUtils.java

@@ -33,10 +33,15 @@ public class ParseByteToFileUtils {
         return multipartFile;
     }
 
-    public String uploadFile(byte[] fileData) throws IOException {
+    public String uploadFile(byte[] fileData, Integer type) throws IOException {
         List<MultipartFile> multipartFiles = new ArrayList<>();
         //保存生成地址
-        String fileName = IdUtil.simpleUUID() + ".xls";
+        String fileName = "";
+        if (type.equals(1)) {
+            fileName = IdUtil.simpleUUID() + ".xls";
+        } else if (type.equals(2)) {
+            fileName = IdUtil.simpleUUID() + ".pdf";
+        }
         //文件原始名中的中文字符可能会乱码,对文件名进行URL编码
         String encodedFileName = URLEncoder.encode(fileName, StandardCharsets.UTF_8.toString());
         MultipartFile multipartFile = this.convertBytesToMultipartFile(fileData, encodedFileName);

+ 3 - 1
src/main/java/cn/cslg/pas/common/utils/ResponseEnum.java

@@ -16,7 +16,9 @@ public enum ResponseEnum {
     COMPARE_LITERATURE_BATCH(600,"批量上传对比文献"),
     COMPARE_LITERATURE_BATCH_DONE(601,"批量上传对比文献完成"),
     PATENT_EXPORT_TASK(602,"导出专利信息"),
-    PATENT_EXPORT_TASK_DONE(603,"导出专利信息完成") ;
+    PATENT_EXPORT_TASK_DONE(603,"导出专利信息完成"),
+    PATENT_PDF_EXPORT_TASK(604,"导出PDF首页"),
+    PATENT_PDF_EXPORT_TASK_DONE(605,"导出PDF首页完成");
 
     private Integer code;
     private String message;

+ 58 - 0
src/main/java/cn/cslg/pas/common/vo/HightlightTemplateVO.java

@@ -0,0 +1,58 @@
+package cn.cslg.pas.common.vo;
+
+import cn.cslg.pas.domain.business.HightlightTemplate;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 高亮
+ * @Author xiexiang
+ * @Date 2024/1/12
+ */
+@Data
+public class HightlightTemplateVO {
+    private Integer id;
+
+    /**
+     * 模板名称
+     */
+    private String name;
+
+    /**
+     * 是否启用
+     */
+    private Boolean ifEnable;
+
+    /**
+     * 是否默认
+     */
+    private Boolean ifDefault;
+
+    /**
+     * description
+     */
+    private String description;
+
+    /**
+     * 创建人
+     */
+    private String createId;
+
+    private String createName;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * config
+     */
+    private String config;
+
+    private Integer projectId;
+
+    private List<HightlightTemplate.Config> configs;
+}

+ 4 - 4
src/main/java/cn/cslg/pas/common/vo/WebSocketMessageVO.java

@@ -9,11 +9,11 @@ import lombok.experimental.Accessors;
 @Data
 @Accessors(chain = true)
 public class WebSocketMessageVO {
-    private  Integer projectId;
-   private  Integer allNum;
-    private Integer   currentNum;
+    private Integer projectId;
+    private Integer allNum;
+    private Integer currentNum;
     private Integer code;
     private Integer state;
     private String createId;
-
+    private Integer taskId;
 }

+ 78 - 0
src/main/java/cn/cslg/pas/common/vo/business/LitigationHistoryVO.java

@@ -0,0 +1,78 @@
+package cn.cslg.pas.common.vo.business;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/1/15
+ */
+@Data
+public class LitigationHistoryVO {
+    /**
+     * 原告
+     */
+    private String plaintiff;
+
+    /**
+     * 被告
+     */
+    private String defendant;
+
+
+    /**
+     * 案由
+     */
+    private String causeOfAction;
+
+    /**
+     * 起诉时间
+     */
+    private Date indictTime;
+
+    /**
+     * 结果
+     */
+    private String result;
+
+    /**
+     * 案件详情
+     */
+    private String caseDetails;
+
+    /**
+     * 附件id
+     */
+    private String fileGuid;
+
+    /**
+     * projectId
+     */
+    private Integer projectId;
+
+    /**
+     * 专利号
+     */
+    private String patentNo;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 法院
+     */
+    private String court;
+
+    /**
+     * 创建人id
+     */
+    private String createId;
+
+    private String createName;
+
+    private Date createTime;
+}

+ 71 - 0
src/main/java/cn/cslg/pas/common/vo/business/PermissionRecordVO.java

@@ -0,0 +1,71 @@
+package cn.cslg.pas.common.vo.business;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 许可历史
+ * @Author xiexiang
+ * @Date 2024/1/16
+ */
+@Data
+public class PermissionRecordVO {
+    /**
+     * 专利号
+     */
+    private String patentNo;
+
+    /**
+     * 许可人 (默认为专利权利人)
+     */
+    private String licensor;
+
+    /**
+     * 被许可人
+     */
+    private String licensee;
+
+    /**
+     * 被许可人国家
+     */
+    private String licenseeCountry;
+
+    /**
+     * 许可时间
+     */
+    private Date licenseTime;
+
+    /**
+     * 许可费用(万元)
+     */
+    private Double licenseFee;
+
+    /**
+     * 截止时间
+     */
+    private Date licenseDeadLine;
+
+    /**
+     * 许可类型
+     */
+    private String licenseType;
+
+    /**
+     * 租户id
+     */
+    private Integer tenantId;
+
+    /**
+     * 创建人id
+     */
+    private String createId;
+
+    private String createName;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+}

+ 51 - 0
src/main/java/cn/cslg/pas/common/vo/business/ReviewHistoryVO.java

@@ -0,0 +1,51 @@
+package cn.cslg.pas.common.vo.business;
+
+import lombok.Data;
+import org.apache.poi.hssf.record.DateWindow1904Record;
+
+import java.util.Date;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/1/15
+ */
+@Data
+public class ReviewHistoryVO {
+    private Integer id;
+
+    /**
+     * 时间
+     */
+    private Date reviewTime ;
+
+    /**
+     * 事件
+     */
+    private String reviewEvent;
+
+    /**
+     * 说明
+     */
+    private String reviewExplain;
+
+    /**
+     * 文件id
+     */
+    private String fileGuid;
+
+    /**
+     * 所属project
+     */
+    private Integer projectId;
+
+    /**
+     * 专利号
+     */
+    private String patentNo;
+
+    private String createId;
+
+    private String createName;
+
+    private Date createTime;
+}

+ 59 - 0
src/main/java/cn/cslg/pas/controller/HightlightTemplateController.java

@@ -0,0 +1,59 @@
+package cn.cslg.pas.controller;
+
+import cn.cslg.pas.common.core.base.Constants;
+import cn.cslg.pas.common.dto.HightlightTemplateDTO;
+import cn.cslg.pas.common.dto.ImportTaskDTO;
+import cn.cslg.pas.common.model.cronModel.Records;
+import cn.cslg.pas.common.utils.Response;
+import cn.cslg.pas.common.vo.HightlightTemplateVO;
+import cn.cslg.pas.domain.business.HightlightTemplate;
+import cn.cslg.pas.factorys.businessFactory.Business;
+import cn.cslg.pas.service.business.HightlightTemplateService;
+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.util.List;
+
+/**
+ * 高亮
+ * @Author xiexiang
+ * @Date 2024/1/12
+ */
+@Slf4j
+@RequestMapping(Constants.API_XiaoSHI + "/hightlightTemplate")
+@RestController
+public class HightlightTemplateController {
+    @Autowired
+    private HightlightTemplateService hightlightTemplateService;
+
+    @Operation(summary = "添加高亮")
+    @PostMapping("/saveOrUpdate")
+    public Response saveOrUpdate(@RequestBody HightlightTemplateDTO hightlightTemplateDTO) throws Exception {
+        HightlightTemplate hightlightTemplate = hightlightTemplateService.saveOrUpdate(hightlightTemplateDTO);
+        Records records = new Records();
+        records.setData(hightlightTemplate);
+        return Response.success(records);
+    }
+
+    @Operation(summary = "查询高亮")
+    @GetMapping("/query")
+    public Response queryHightlight(Integer projectId) throws Exception {
+       List<HightlightTemplateVO> hightlightTemplateVOS = hightlightTemplateService.getHightlight(projectId);
+        Records records = new Records();
+        records.setData(hightlightTemplateVOS);
+        return Response.success(records);
+    }
+
+    @Operation(summary = "删除高亮")
+    @PostMapping("/delete")
+    public Response delete(@RequestBody List<Integer> ids) throws Exception {
+        List<Integer> deleteIds = hightlightTemplateService.deleteHightlight(ids);
+        Records records = new Records();
+        records.setData(deleteIds);
+        return Response.success(records);
+    }
+
+
+}

+ 54 - 0
src/main/java/cn/cslg/pas/controller/LitigationHistoryController.java

@@ -0,0 +1,54 @@
+package cn.cslg.pas.controller;
+
+import cn.cslg.pas.common.core.base.Constants;
+import cn.cslg.pas.common.dto.business.LitigationHistoryDTO;
+import cn.cslg.pas.common.model.cronModel.Records;
+import cn.cslg.pas.common.utils.Response;
+import cn.cslg.pas.common.vo.business.LitigationHistoryVO;
+import cn.cslg.pas.service.business.LitigationHistoryService;
+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.util.List;
+
+/**
+ * 诉讼历史
+ * @Author xiexiang
+ * @Date 2024/1/15
+ */
+@Slf4j
+@RequestMapping(Constants.API_XiaoSHI + "/litigationHistory")
+@RestController
+public class LitigationHistoryController {
+    @Autowired
+    private LitigationHistoryService litigationHistoryService;
+
+    @Operation(summary = "添加or更新诉讼历史")
+    @PostMapping("/saveOrUpdate")
+    public Response saveOrUpdate(@RequestBody LitigationHistoryDTO litigationHistoryDTO){
+        Integer id = litigationHistoryService.saveOrUpdate(litigationHistoryDTO);
+        Records records = new Records();
+        records.setData(id);
+        return Response.success(records);
+    }
+
+    @Operation(summary = "查询诉讼历史")
+    @GetMapping("/query")
+    public Response queryLitigationHistory(String patentNo) throws Exception {
+        List<LitigationHistoryVO> litigationHistoryVOS = litigationHistoryService.getLitigationHistory(patentNo);
+        Records records = new Records();
+        records.setData(litigationHistoryVOS);
+        return Response.success(records);
+    }
+
+    @Operation(summary = "删除诉讼历史")
+    @PostMapping("/delete")
+    public Response delete(@RequestBody List<Integer> ids) throws Exception {
+        List<Integer> deleteIds = litigationHistoryService.deleteLitigationHistory(ids);
+        Records records = new Records();
+        records.setData(deleteIds);
+        return Response.success(records);
+    }
+}

+ 40 - 27
src/main/java/cn/cslg/pas/controller/PatentController.java

@@ -7,6 +7,7 @@ import cn.cslg.pas.common.dto.PatentExport.TaskParams;
 import cn.cslg.pas.common.dto.business.EsCountDTO;
 import cn.cslg.pas.common.dto.business.SelectClaimDTO;
 import cn.cslg.pas.common.dto.es.EsDateRangeDTO;
+import cn.cslg.pas.common.model.cronModel.PersonnelVO;
 import cn.cslg.pas.common.model.cronModel.Records;
 import cn.cslg.pas.common.model.request.StringRequest;
 import cn.cslg.pas.common.utils.*;
@@ -19,9 +20,12 @@ import cn.cslg.pas.common.vo.business.PatentKinVO;
 import cn.cslg.pas.common.vo.business.PatentNoVO;
 import cn.cslg.pas.common.vo.es.EsCustomFieldBatchVO;
 import cn.cslg.pas.common.vo.es.EsDateRangeVO;
+import cn.cslg.pas.domain.business.ImportTask;
+import cn.cslg.pas.exception.XiaoShiException;
 import cn.cslg.pas.factorys.businessFactory.Business;
 import cn.cslg.pas.factorys.businessFactory.BusinessFactory;
 import cn.cslg.pas.service.business.CustomAnalyseService;
+import cn.cslg.pas.service.business.ImportTaskService;
 import cn.cslg.pas.service.business.PDFExportFirstPageService;
 import cn.cslg.pas.service.business.PatentExportService;
 import cn.cslg.pas.service.business.MergePersonService;
@@ -32,6 +36,7 @@ import cn.cslg.pas.service.common.FileManagerService;
 import cn.cslg.pas.service.common.PatentStarApiService;
 import cn.hutool.core.util.IdUtil;
 import io.swagger.v3.oas.annotations.Operation;
+import org.apache.commons.io.input.XmlStreamReaderException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.io.InputStreamResource;
 import org.springframework.http.HttpHeaders;
@@ -74,6 +79,11 @@ public class PatentController {
     private PatentExportService patentExportService;
     @Autowired
     private PDFExportFirstPageService pdfExportFirstPageService;
+    @Autowired
+    private ImportTaskService importTaskService;
+    @Autowired
+    private LoginUtils loginUtils;
+
 
     @Operation(summary = "查询专利")
     @PostMapping("/queryPatent")
@@ -237,38 +247,41 @@ public class PatentController {
     //--------------------导出-----------------------
     @PostMapping("/exportPDFFirstPage")
     @Operation(summary = "导出专利PDF")
-    public ResponseEntity<InputStreamResource> exportPDFFirstPage(@RequestBody EsCustomFieldBatchVO EsVO) throws IOException {
-        byte[] fileData = pdfExportFirstPageService.mergePdfFirstPage(EsVO);
-        //保存生成excel的地址
-        String fileName = IdUtil.simpleUUID() + ".pdf";
-        //文件原始名中的中文字符可能会乱码,对文件名进行URL编码
-        String encodedFileName = URLEncoder.encode(fileName, StandardCharsets.UTF_8.toString());
-        return ResponseEntity.ok().contentLength(fileData.length)
-                .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + encodedFileName + "\"")
-                .contentType(MediaType.parseMediaType("application/octet-stream"))
-                .body(new InputStreamResource(new ByteArrayInputStream(fileData)));
+    public Response exportPDFFirstPage(@RequestBody EsCustomFieldBatchVO EsVO) throws IOException {
+        ExportTaskDTO exportTaskDTO = new ExportTaskDTO();
+        exportTaskDTO.setProjectId(EsVO.getProjectId());
+        exportTaskDTO.setType(7);
+        PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+        exportTaskDTO.setCreateId(personnelVO.getId());
+        exportTaskDTO.setCreateName(personnelVO.getName());
+        Integer taskId = importTaskService.addExportTask(exportTaskDTO);
+        exportTaskDTO.setEsVO(EsVO);
+        exportTaskDTO.setTaskId(taskId);
+        try {
+            pdfExportFirstPageService.mergePdfFirstPage(exportTaskDTO);
+        } catch (Exception e) {
+            throw new XiaoShiException("导出失败");
+        }
+        Records records = new Records();
+        records.setData("正在导出PDF首页");
+        return Response.success(records);
     }
 
-//    @PostMapping("/exportPatentExcel")
-//    @Operation(summary = "导出专利")
-//    public ResponseEntity<InputStreamResource> export(@RequestBody EsCustomFieldBatchVO EsVO) throws IOException {
-//        byte[] fileData = patentExportService.exportPatent(EsVO);
-//        //保存生成excel的地址
-//        String fileName = IdUtil.simpleUUID() + ".xls";
-//        //文件原始名中的中文字符可能会乱码,对文件名进行URL编码
-//        String encodedFileName = URLEncoder.encode(fileName, StandardCharsets.UTF_8.toString());
-//        return ResponseEntity.ok().contentLength(fileData.length)
-//                .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + encodedFileName + "\"")
-//                .contentType(MediaType.parseMediaType("application/octet-stream"))
-//                .body(new InputStreamResource(new ByteArrayInputStream(fileData)));
-//    }
-
     @PostMapping("/exportPatentExcel")
     @Operation(summary = "导出专利")
-    public Response export(@RequestBody EsCustomFieldBatchVO EsVO) throws IOException {
-        patentExportService.exportPatent(EsVO);
+    public Response exportPatentExcel(@RequestBody EsCustomFieldBatchVO EsVO) throws IOException {
+        ExportTaskDTO exportTaskDTO = new ExportTaskDTO();
+        exportTaskDTO.setProjectId(EsVO.getProjectId());
+        exportTaskDTO.setType(6);
+        PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+        exportTaskDTO.setCreateId(personnelVO.getId());
+        exportTaskDTO.setCreateName(personnelVO.getName());
+        Integer taskId = importTaskService.addExportTask(exportTaskDTO);
+        exportTaskDTO.setEsVO(EsVO);
+        exportTaskDTO.setTaskId(taskId);
+        patentExportService.exportPatent(exportTaskDTO);
         Records records = new Records();
-        records.setData("导出成功");
+        records.setData("导出专利");
         return Response.success(records);
     }
 }

+ 54 - 0
src/main/java/cn/cslg/pas/controller/PermissionRecordController.java

@@ -0,0 +1,54 @@
+package cn.cslg.pas.controller;
+
+import cn.cslg.pas.common.core.base.Constants;
+import cn.cslg.pas.common.dto.business.PermissionRecordDTO;
+import cn.cslg.pas.common.model.cronModel.Records;
+import cn.cslg.pas.common.utils.Response;
+import cn.cslg.pas.common.vo.business.PermissionRecordVO;
+import cn.cslg.pas.service.business.PermissionRecordService;
+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.util.List;
+
+/**
+ * 许可历史
+ * @Author xiexiang
+ * @Date 2024/1/15
+ */
+@Slf4j
+@RequestMapping(Constants.API_XiaoSHI + "/permissionRecord")
+@RestController
+public class PermissionRecordController {
+    @Autowired
+    private PermissionRecordService permissionRecordService;
+
+    @Operation(summary = "添加or更新许可历史")
+    @PostMapping("/saveOrUpdate")
+    public Response saveOrUpdate(@RequestBody PermissionRecordDTO permissionRecordDTO){
+        Integer id = permissionRecordService.saveOrUpdate(permissionRecordDTO);
+        Records records = new Records();
+        records.setData(id);
+        return Response.success(records);
+    }
+
+    @Operation(summary = "查询许可历史")
+    @GetMapping("/query")
+    public Response queryLitigationHistory(String patentNo) throws Exception {
+        List<PermissionRecordVO> permissionRecordVOS = permissionRecordService.getPermissionRecord(patentNo);
+        Records records = new Records();
+        records.setData(permissionRecordVOS);
+        return Response.success(records);
+    }
+
+    @Operation(summary = "删除许可历史")
+    @PostMapping("/delete")
+    public Response delete(@RequestBody List<Integer> ids) throws Exception {
+        List<Integer> deleteIds = permissionRecordService.deletePermissionRecord(ids);
+        Records records = new Records();
+        records.setData(deleteIds);
+        return Response.success(records);
+    }
+}

+ 56 - 0
src/main/java/cn/cslg/pas/controller/ReviewHistoryController.java

@@ -0,0 +1,56 @@
+package cn.cslg.pas.controller;
+
+import cn.cslg.pas.common.core.base.Constants;
+import cn.cslg.pas.common.dto.business.ReviewHistoryDTO;
+import cn.cslg.pas.common.model.cronModel.Records;
+import cn.cslg.pas.common.utils.Response;
+import cn.cslg.pas.common.vo.HightlightTemplateVO;
+import cn.cslg.pas.common.vo.business.ReviewHistoryVO;
+import cn.cslg.pas.service.business.ReviewHistoryService;
+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.util.List;
+
+/**
+ * 审查历史
+ * @Author xiexiang
+ * @Date 2024/1/15
+ */
+@Slf4j
+@RequestMapping(Constants.API_XiaoSHI + "/reviewHistory")
+@RestController
+public class ReviewHistoryController {
+    @Autowired
+    private ReviewHistoryService reviewHistoryService;
+
+    @Operation(summary = "添加or更新审查历史")
+    @PostMapping("/saveOrUpdate")
+    public Response saveOrUpdate(@RequestBody ReviewHistoryDTO reviewHistoryDTO){
+        Integer id = reviewHistoryService.saveOrUpdate(reviewHistoryDTO);
+        Records records = new Records();
+        records.setData(id);
+        return Response.success(records);
+    }
+
+    @Operation(summary = "查询审查历史")
+    @GetMapping("/query")
+    public Response queryReviewHistory(String patentNo) throws Exception {
+        List<ReviewHistoryVO> reviewHistoryVOS = reviewHistoryService.getReviewHistory(patentNo);
+        Records records = new Records();
+        records.setData(reviewHistoryVOS);
+        return Response.success(records);
+    }
+
+    @Operation(summary = "删除审查历史")
+    @PostMapping("/delete")
+    public Response delete(@RequestBody List<Integer> ids) throws Exception {
+        List<Integer> deleteIds = reviewHistoryService.deleteReviewHistory(ids);
+        Records records = new Records();
+        records.setData(deleteIds);
+        return Response.success(records);
+    }
+
+}

+ 19 - 0
src/main/java/cn/cslg/pas/domain/business/AssoOtherReferencesFile.java

@@ -0,0 +1,19 @@
+package cn.cslg.pas.domain.business;
+
+import cn.cslg.pas.domain.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/1/17
+ */
+@Data
+@TableName("asso_other_references_file")
+public class AssoOtherReferencesFile extends BaseEntity<AssoOtherReferencesFile> {
+    @TableField(value = "file_guid")
+    private String fileGuid;
+    @TableField(value = "other_references_id")
+    private Integer otherReferencesId;
+}

+ 72 - 0
src/main/java/cn/cslg/pas/domain/business/HightlightTemplate.java

@@ -0,0 +1,72 @@
+package cn.cslg.pas.domain.business;
+
+import cn.cslg.pas.domain.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 高亮
+ * @Author xiexiang
+ * @Date 2024/1/12
+ */
+@Data
+@TableName("hightlight_template")
+public class HightlightTemplate extends BaseEntity<HightlightTemplate> {
+    /**
+     * 模板名称
+     */
+    @TableField(value = "name")
+    private String name;
+
+    /**
+     * 是否启用
+     */
+    @TableField(value = "if_enable")
+    private Boolean ifEnable;
+
+    /**
+     * 是否默认
+     */
+    @TableField(value = "if_default")
+    private Boolean ifDefault;
+
+    /**
+     * description
+     */
+    @TableField(value = "description")
+    private String description;
+
+    /**
+     * 创建人
+     */
+    @TableField(value = "create_id")
+    private String createId;
+
+    /**
+     * 创建时间
+     */
+    @TableField(value = "create_time")
+    private Date createTime;
+
+    /**
+     * config
+     */
+    @TableField(value = "config")
+    private String config;
+
+    @TableField(value = "project_id")
+    private Integer projectId;
+
+    @TableField(exist = false)
+    private List<Config> configs;
+
+    @Data
+    public static class Config {
+        private String color;
+        private String keywords;
+    }
+}

+ 95 - 0
src/main/java/cn/cslg/pas/domain/business/LitigationHistory.java

@@ -0,0 +1,95 @@
+package cn.cslg.pas.domain.business;
+
+import cn.cslg.pas.domain.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/1/15
+ */
+@Data
+@TableName("litigation_history")
+public class LitigationHistory extends BaseEntity<LitigationHistory> {
+    /**
+     * 原告
+     */
+    @TableField(value = "plaintiff")
+    private String plaintiff;
+
+    /**
+     * 被告
+     */
+    @TableField(value = "defendant")
+    private String defendant;
+
+
+    /**
+     * 案由
+     */
+    @TableField(value = "cause_of_action")
+    private String causeOfAction;
+
+    /**
+     * 起诉时间
+     */
+    @TableField(value = "indict_time")
+    private Date indictTime;
+
+    /**
+     * 结果
+     */
+    @TableField(value = "result")
+    private String result;
+
+    /**
+     * 案件详情
+     */
+    @TableField(value = "case_details")
+    private String caseDetails;
+
+    /**
+     * 附件id
+     */
+    @TableField(value = "file_guid")
+    private String fileGuid;
+
+    /**
+     * projectId
+     */
+    @TableField(value = "project_id")
+    private Integer projectId;
+
+    /**
+     * 专利号
+     */
+    @TableField(value = "patent_no")
+    private String patentNo;
+
+    /**
+     * 备注
+     */
+    @TableField(value = "remark")
+    private String remark;
+
+    /**
+     * 法院
+     */
+    @TableField(value = "court")
+    private String court;
+
+    /**
+     * 创建人id
+     */
+    @TableField(value = "create_id")
+    private String createId;
+
+    /**
+     * 创建时间
+     */
+    @TableField(value = "create_time")
+    private Date createTime;
+}

+ 49 - 0
src/main/java/cn/cslg/pas/domain/business/OtherReferences.java

@@ -0,0 +1,49 @@
+package cn.cslg.pas.domain.business;
+
+import cn.cslg.pas.domain.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/1/17
+ */
+@Data
+@TableName("other_references")
+public class OtherReferences extends BaseEntity<OtherReferences> {
+    /**
+     * 报告/专题库id
+     */
+    @TableField(value = "project_id")
+    private Integer projectId;
+
+    /**
+     * 说明
+     */
+    @TableField(value = "remark")
+    private String remark;
+
+    /**
+     * 其他参考资料名称
+     */
+    @TableField(value = "references_name")
+    private String referencesName;
+
+    @TableField(value = "reference_url")
+    private String referenceUrl;
+
+    /**
+     * 创建人id
+     */
+    @TableField(value = "create_id")
+    private String createId;
+
+    /**
+     * 创建时间
+     */
+    @TableField(value = "create_time")
+    private Date createTime;
+}

+ 84 - 0
src/main/java/cn/cslg/pas/domain/business/PermissionRecord.java

@@ -0,0 +1,84 @@
+package cn.cslg.pas.domain.business;
+
+import cn.cslg.pas.common.dto.business.PermissionRecordDTO;
+import cn.cslg.pas.domain.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 许可历史
+ * @Author xiexiang
+ * @Date 2024/1/16
+ */
+@Data
+@TableName("permission_record")
+public class PermissionRecord extends BaseEntity<PermissionRecord> {
+    /**
+     * 专利号
+     */
+    @TableField(value = "patent_no")
+    private String patentNo;
+
+    /**
+     * 许可人 (默认为专利权利人)
+     */
+    @TableField(value = "licensor")
+    private String licensor;
+
+    /**
+     * 被许可人
+     */
+    @TableField(value = "licensee")
+    private String licensee;
+
+    /**
+     * 被许可人国家
+     */
+    @TableField(value = "licensee_country")
+    private String licenseeCountry;
+
+    /**
+     * 许可时间
+     */
+    @TableField(value = "license_time")
+    private Date licenseTime;
+
+    /**
+     * 许可费用(万元)
+     */
+    @TableField(value = "license_fee")
+    private Double licenseFee;
+
+    /**
+     * 截止时间
+     */
+    @TableField(value = "license_dead_line")
+    private Date licenseDeadLine;
+
+    /**
+     * 许可类型
+     */
+    @TableField(value = "license_type")
+    private String licenseType;
+
+    /**
+     * 租户id
+     */
+    @TableField(value = "tenant_id")
+    private Integer tenantId;
+
+    /**
+     * 创建人id
+     */
+    @TableField(value = "create_id")
+    private String createId;
+
+    /**
+     * 创建时间
+     */
+    @TableField(value = "create_time")
+    private Date createTime;
+}

+ 75 - 0
src/main/java/cn/cslg/pas/domain/business/ReviewHistory.java

@@ -0,0 +1,75 @@
+package cn.cslg.pas.domain.business;
+
+import cn.cslg.pas.domain.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * 审查历史
+ * @Author xiexiang
+ * @Date 2024/1/15
+ */
+@Data
+@TableName("review_history")
+public class ReviewHistory extends BaseEntity<ReviewHistory> {
+    /**
+     * 时间
+     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
+    @TableField(value = "review_time")
+    private Date reviewTime;
+
+    /**
+     * 事件
+     */
+    @TableField(value = "review_event")
+    private String reviewEvent;
+
+    /**
+     * 说明
+     */
+    @TableField(value = "review_explain")
+    private String reviewExplain;
+
+    /**
+     * 文件id
+     */
+    @TableField(value = "file_guid")
+    private String fileGuid;
+
+    /**
+     * 所属project
+     */
+    @TableField(value = "project_id")
+    private Integer projectId;
+
+    /**
+     * 专利号
+     */
+    @TableField(value = "patent_no")
+    private String patentNo;
+
+    /**
+     * 租户id
+     */
+    @TableField(value = "tenant_id")
+    private Integer tenantId;
+
+    /**
+     * 创建人id
+     */
+    @TableField(value = "create_id")
+    private String createId;
+
+    /**
+     * 创建时间
+     */
+    @TableField(value = "create_time")
+    private Date createTime;
+}

+ 28 - 0
src/main/java/cn/cslg/pas/factorys/getSqlFactorys/GetComBoolSql.java

@@ -0,0 +1,28 @@
+package cn.cslg.pas.factorys.getSqlFactorys;
+
+import cn.cslg.pas.common.model.cronModel.SqlObject;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+
+@Slf4j
+@Component
+public class GetComBoolSql implements GetSqlObject{
+
+ private SqlObject sqlObject;
+    @Override
+    public String getSql(String value) {
+      String filed= sqlObject.getSqlField();
+      String option =sqlObject.getOption();
+       return  filed+option+ " " +value + " ";
+    }
+
+    public void setSqlObject(SqlObject sqlObject)
+    {
+        this.sqlObject=sqlObject;
+    }
+
+    public SqlObject getSqlObject(){
+        return sqlObject;
+    }
+}

+ 13 - 0
src/main/java/cn/cslg/pas/mapper/AssoOtherReferencesFileMapper.java

@@ -0,0 +1,13 @@
+package cn.cslg.pas.mapper;
+
+import cn.cslg.pas.domain.business.AssoOtherReferencesFile;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springframework.stereotype.Repository;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/1/17
+ */
+@Repository
+public interface AssoOtherReferencesFileMapper extends BaseMapper<AssoOtherReferencesFile> {
+}

+ 13 - 0
src/main/java/cn/cslg/pas/mapper/HightlightTemplateMapper.java

@@ -0,0 +1,13 @@
+package cn.cslg.pas.mapper;
+
+import cn.cslg.pas.domain.business.HightlightTemplate;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springframework.stereotype.Repository;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/1/12
+ */
+@Repository
+public interface HightlightTemplateMapper extends BaseMapper<HightlightTemplate> {
+}

+ 14 - 0
src/main/java/cn/cslg/pas/mapper/LitigationHistoryMapper.java

@@ -0,0 +1,14 @@
+package cn.cslg.pas.mapper;
+
+import cn.cslg.pas.domain.business.LitigationHistory;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springframework.stereotype.Repository;
+import org.springframework.web.bind.annotation.RequestBody;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/1/15
+ */
+@Repository
+public interface LitigationHistoryMapper extends BaseMapper<LitigationHistory> {
+}

+ 13 - 0
src/main/java/cn/cslg/pas/mapper/OtherReferencesMapper.java

@@ -0,0 +1,13 @@
+package cn.cslg.pas.mapper;
+
+import cn.cslg.pas.domain.business.OtherReferences;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springframework.stereotype.Repository;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/1/17
+ */
+@Repository
+public interface OtherReferencesMapper extends BaseMapper<OtherReferences> {
+}

+ 13 - 0
src/main/java/cn/cslg/pas/mapper/PermissionRecordMapper.java

@@ -0,0 +1,13 @@
+package cn.cslg.pas.mapper;
+
+import cn.cslg.pas.domain.business.PermissionRecord;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springframework.stereotype.Repository;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/1/16
+ */
+@Repository
+public interface PermissionRecordMapper extends BaseMapper<PermissionRecord> {
+}

+ 13 - 0
src/main/java/cn/cslg/pas/mapper/ReviewHistoryMapper.java

@@ -0,0 +1,13 @@
+package cn.cslg.pas.mapper;
+
+import cn.cslg.pas.domain.business.ReviewHistory;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springframework.stereotype.Repository;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/1/15
+ */
+@Repository
+public interface ReviewHistoryMapper extends BaseMapper<ReviewHistory> {
+}

+ 16 - 0
src/main/java/cn/cslg/pas/service/business/AssoOtherReferencesFileService.java

@@ -0,0 +1,16 @@
+package cn.cslg.pas.service.business;
+
+import cn.cslg.pas.domain.business.AssoOtherReferencesFile;
+import cn.cslg.pas.mapper.AssoOtherReferencesFileMapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/1/17
+ */
+@Slf4j
+@Service
+public class AssoOtherReferencesFileService extends ServiceImpl<AssoOtherReferencesFileMapper, AssoOtherReferencesFile> {
+}

+ 184 - 0
src/main/java/cn/cslg/pas/service/business/HightlightTemplateService.java

@@ -0,0 +1,184 @@
+package cn.cslg.pas.service.business;
+
+import cn.cslg.pas.common.dto.HightlightTemplateDTO;
+import cn.cslg.pas.common.model.cronModel.Personnel;
+import cn.cslg.pas.common.model.cronModel.PersonnelVO;
+import cn.cslg.pas.common.utils.CacheUtils;
+import cn.cslg.pas.common.utils.JsonUtils;
+import cn.cslg.pas.common.utils.LoginUtils;
+import cn.cslg.pas.common.utils.StringUtils;
+import cn.cslg.pas.common.vo.HightlightTemplateVO;
+import cn.cslg.pas.common.vo.business.ProjectTaskVO;
+import cn.cslg.pas.domain.business.HightlightTemplate;
+import cn.cslg.pas.exception.XiaoShiException;
+import cn.cslg.pas.mapper.HightlightTemplateMapper;
+import cn.cslg.pas.service.permissions.PermissionService;
+import cn.cslg.pas.service.query.Query;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/1/12
+ */
+@Slf4j
+@Service
+public class HightlightTemplateService extends ServiceImpl<HightlightTemplateMapper, HightlightTemplate> {
+    @Autowired
+    private LoginUtils loginUtils;
+
+    @Autowired
+    private CacheUtils cacheUtils;
+
+    @Autowired
+    private PermissionService permissionService;
+
+    /**
+     * 添加or更新
+     * @param hightlightTemplateDTO
+     * @return
+     */
+    public HightlightTemplate saveOrUpdate(HightlightTemplateDTO hightlightTemplateDTO){
+        if (hightlightTemplateDTO == null) {
+            throw new XiaoShiException("入参为空");
+        }
+        PersonnelVO personnelVO = new PersonnelVO();
+        try {
+            personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+        } catch (Exception e) {
+            throw new XiaoShiException("未查询到当前登陆人");
+        }
+        Integer id = hightlightTemplateDTO.getId();
+        HightlightTemplate hightlightTemplate = new HightlightTemplate();
+        if (id != null) {
+            //update
+            hightlightTemplate = this.getById(id);
+            BeanUtils.copyProperties(hightlightTemplateDTO, hightlightTemplate);
+            hightlightTemplate.setConfig(JsonUtils.objectToJson(hightlightTemplateDTO.getConfigs()));
+            hightlightTemplate.updateById();
+        } else {
+            String name = hightlightTemplateDTO.getName();
+            if (name == null || StringUtils.isEmpty(name)) {
+                name = "新模板";
+                hightlightTemplateDTO.setName(name);
+            }
+            BeanUtils.copyProperties(hightlightTemplateDTO, hightlightTemplate);
+            this.setConfigs(hightlightTemplate);
+            if (hightlightTemplate.getCreateId() == null) {
+                hightlightTemplate.setCreateId(personnelVO.getId());
+            }
+            hightlightTemplate.insert();
+        }
+        return hightlightTemplate;
+    }
+
+    /**
+     * 查询
+     * @param projectId
+     * @return
+     * @throws IOException
+     */
+    public List<HightlightTemplateVO> getHightlight(Integer projectId) throws IOException {
+        if (projectId == null) {
+            throw new XiaoShiException("入参为空");
+        }
+        PersonnelVO personnelVO = new PersonnelVO();
+        try {
+            personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+        } catch (Exception e) {
+            throw new XiaoShiException("未查询到当前登陆人");
+        }
+
+        List<HightlightTemplateVO> hightlightTemplateVOS = new ArrayList<>();
+        LambdaQueryWrapper<HightlightTemplate> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(HightlightTemplate::getProjectId, projectId)
+                .eq(HightlightTemplate::getCreateId, personnelVO.getId());
+        List<HightlightTemplate> hightlightTemplates = this.list(queryWrapper);
+
+        if (!hightlightTemplates.isEmpty()) {
+            hightlightTemplates.forEach(item -> {
+                HightlightTemplateVO hightlightTemplateVO = new HightlightTemplateVO();
+                BeanUtils.copyProperties(item, hightlightTemplateVO);
+                hightlightTemplateVOS.add(hightlightTemplateVO);
+            });
+        } else {
+            HightlightTemplateVO hightlightTemplateVO = new HightlightTemplateVO();
+            HightlightTemplateDTO hightlightDTO = new HightlightTemplateDTO();
+            hightlightDTO.setName("默认模板");
+            hightlightDTO.setIfEnable(true);
+            hightlightDTO.setProjectId(projectId);
+            hightlightDTO.setCreateId(personnelVO.getId());
+            hightlightDTO.setIfEnable(true);
+            hightlightDTO.setIfDefault(true);
+            Integer id = this.saveOrUpdate(hightlightDTO).getId();
+            HightlightTemplate hightlightTemplate = this.getById(id);
+            BeanUtils.copyProperties(hightlightTemplate, hightlightTemplateVO);
+            hightlightTemplateVOS.add(hightlightTemplateVO);
+        }
+        this.loadHightlightVOS(hightlightTemplateVOS);
+        return hightlightTemplateVOS;
+    }
+
+    public void loadHightlightVOS(List<HightlightTemplateVO> hightlightTemplateVOS) throws IOException {
+        List<String> createIds = new ArrayList<>();
+        hightlightTemplateVOS.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 (HightlightTemplateVO hightlightTemplateVO : hightlightTemplateVOS) {
+            //装载人员信息
+            Personnel personnel = personnels.stream().filter(item -> item.getId().equals(hightlightTemplateVO.getCreateId())).findFirst().orElse(null);
+            if (personnel != null) {
+                hightlightTemplateVO.setCreateName(personnel.getPersonnelName());
+            }
+            hightlightTemplateVO.setConfigs(JsonUtils.jsonToList(hightlightTemplateVO.getConfig(), HightlightTemplate.Config.class));
+            hightlightTemplateVO.setConfig(null);
+        }
+    }
+
+    public List<Integer> deleteHightlight(List<Integer> ids) {
+        if (!ids.isEmpty()) {
+            this.removeBatchByIds(ids);
+        }
+        return ids;
+    }
+
+
+    public void setConfigs(HightlightTemplate hightlightTemplate) {
+        List<HightlightTemplate.Config> configs = new ArrayList<>();
+        List<String> colors = new ArrayList<String>() {{
+            add("#5470c6");
+            add("#91cc75");
+            add("#fac858");
+            add("#ee6666");
+            add("#73c0de");
+        }};
+        for (String color : colors) {
+            HightlightTemplate.Config config = new HightlightTemplate.Config();
+            config.setKeywords("");
+            config.setColor(color);
+            configs.add(config);
+        }
+        hightlightTemplate.setConfig(JsonUtils.objectToJson(configs));
+        hightlightTemplate.setConfigs(configs);
+    }
+}

+ 31 - 14
src/main/java/cn/cslg/pas/service/business/ImportTaskService.java

@@ -76,6 +76,8 @@ public class ImportTaskService extends ServiceImpl<ImportTaskMapper, ImportTask>
     private ProductService productService;
     @Autowired
     private ProjectService projectService;
+    @Autowired
+    private ImportTaskConditionService importTaskConditionService;
 
     @Override
     public Object queryMessage(QueryRequest queryRequest) throws Exception {
@@ -386,43 +388,35 @@ public class ImportTaskService extends ServiceImpl<ImportTaskMapper, ImportTask>
 
     }
 
-    public Integer addExportExcel(ExportTaskDTO exportTaskDTO){
+    public Integer addExportTask(ExportTaskDTO exportTaskDTO){
         if (exportTaskDTO == null) {
             throw new XiaoShiException("入参不能为空");
         }
-//        PersonnelVO personnelVO = new PersonnelVO();
-//        try {
-//            personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
-//        } catch (Exception e) {
-//            throw new UnLoginException("未登录");
-//        }
         ImportTaskCondition importTaskCondition = new ImportTaskCondition();
-        importTaskCondition.setFileGuid(exportTaskDTO.getFileGuid());
         if (exportTaskDTO.getProjectId() != null) {
             importTaskCondition.setProjectId(exportTaskDTO.getProjectId());
         }
         importTaskCondition.setIfUpdate(false);
         importTaskCondition.setType(exportTaskDTO.getType());
-//        importTaskCondition.setCreateId(personnelVO.getId());
-        importTaskCondition.setCreateId("328");
+        importTaskCondition.setCreateId(exportTaskDTO.getCreateId());
         importTaskCondition.insert();
+
         Integer importTaskConditionId = importTaskCondition.getId();
         if (importTaskConditionId != null) {
             ImportTask importTask = new ImportTask();
             importTask.setImportTaskConditionId(importTaskConditionId);
             importTask.setType(exportTaskDTO.getType());
             importTask.setAllNum(exportTaskDTO.getAllNum());
-            importTask.setDefaultNum(exportTaskDTO.getDefaultNum());
             importTask.setFinishTime(exportTaskDTO.getFinishTime());
-            importTask.setCreateId("328");
+            importTask.setState(0);
+            importTask.setCreateId(exportTaskDTO.getCreateId());
             String name = "";
             if (exportTaskDTO.getType().equals(6)) {
                 name = "【专利】";
             } else if (exportTaskDTO.getType().equals(7)){
                 name = "【PDF首页】";
             }
-//            String importTaskName = "导出" + name + "-" + personnelVO.getName();
-            String importTaskName = "导出" + name + "-" + "朱豪";
+            String importTaskName = "导出" + name + "-" + exportTaskDTO.getCreateName();
             importTask.setName(importTaskName);
             importTask.insert();
             return importTask.getId();
@@ -430,4 +424,27 @@ public class ImportTaskService extends ServiceImpl<ImportTaskMapper, ImportTask>
             throw new XiaoShiException("导出任务记录失败");
         }
     }
+
+
+    public Integer updateExportTask(ExportTaskDTO exportTaskDTO){
+        if (exportTaskDTO == null) {
+            throw new XiaoShiException("入参不能为空");
+        }
+        ImportTask importTask = this.getById(exportTaskDTO.getTaskId());
+        if (importTask != null) {
+            Integer importTaskConditionId = importTask.getImportTaskConditionId();
+
+            ImportTaskCondition importTaskCondition = importTaskConditionService.getById(importTaskConditionId);
+            importTaskCondition.setFileGuid(exportTaskDTO.getFileGuid());
+            importTaskCondition.updateById();
+
+            importTask.setState(exportTaskDTO.getState());
+            importTask.setAllNum(exportTaskDTO.getAllNum());
+            importTask.setDoneNum(exportTaskDTO.getDoneNum());
+            importTask.setDefaultNum(exportTaskDTO.getDefaultNum());
+            importTask.setFinishTime(exportTaskDTO.getFinishTime());
+            importTask.updateById();
+        }
+        return importTask.getId();
+    }
 }

+ 127 - 0
src/main/java/cn/cslg/pas/service/business/LitigationHistoryService.java

@@ -0,0 +1,127 @@
+package cn.cslg.pas.service.business;
+
+import cn.cslg.pas.common.dto.business.LitigationHistoryDTO;
+import cn.cslg.pas.common.dto.business.ReviewHistoryDTO;
+import cn.cslg.pas.common.model.cronModel.Personnel;
+import cn.cslg.pas.common.model.cronModel.PersonnelVO;
+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.LitigationHistoryVO;
+import cn.cslg.pas.common.vo.business.ReviewHistoryVO;
+import cn.cslg.pas.domain.business.LitigationHistory;
+import cn.cslg.pas.domain.business.ReviewHistory;
+import cn.cslg.pas.exception.XiaoShiException;
+import cn.cslg.pas.mapper.LitigationHistoryMapper;
+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;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/1/15
+ */
+@Slf4j
+@Service
+public class LitigationHistoryService extends ServiceImpl<LitigationHistoryMapper, LitigationHistory> {
+    @Autowired
+    private LoginUtils loginUtils;
+
+    @Autowired
+    private CacheUtils cacheUtils;
+
+    @Autowired
+    private PermissionService permissionService;
+
+    /**
+     * 新增or更新
+     * @param litigationHistoryDTO
+     * @return
+     */
+    public Integer saveOrUpdate(LitigationHistoryDTO litigationHistoryDTO){
+        if (litigationHistoryDTO == null) {
+            throw new XiaoShiException("入参为空");
+        }
+        Integer id = litigationHistoryDTO.getId();
+        LitigationHistory litigationHistory = new LitigationHistory();
+        if (id != null) {
+            //update
+            litigationHistory = this.getById(id);
+            BeanUtils.copyProperties(litigationHistoryDTO, litigationHistory);
+            litigationHistory.updateById();
+        } else {
+            BeanUtils.copyProperties(litigationHistoryDTO, litigationHistory);
+            PersonnelVO personnelVO = new PersonnelVO();
+            try {
+                personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+            } catch (Exception e) {
+                throw new XiaoShiException("未查询到当前登陆人");
+            }
+            litigationHistory.setCreateId(personnelVO.getId());
+            litigationHistory.insert();
+        }
+        return litigationHistory.getId();
+    }
+
+    public List<LitigationHistoryVO> getLitigationHistory(String patentNo) throws IOException {
+        if (patentNo == null || StringUtils.isEmpty(patentNo)) {
+            throw new XiaoShiException("入参为空");
+        }
+        List<LitigationHistoryVO> litigationHistoryVOS = new ArrayList<>();
+        LambdaQueryWrapper<LitigationHistory> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(LitigationHistory::getPatentNo, patentNo);
+        List<LitigationHistory> litigationHistories = this.list(queryWrapper);
+
+        if (!litigationHistories.isEmpty()) {
+            litigationHistories.forEach(item -> {
+                LitigationHistoryVO litigationHistoryVO = new LitigationHistoryVO();
+                BeanUtils.copyProperties(item, litigationHistoryVO);
+                litigationHistoryVOS.add(litigationHistoryVO);
+            });
+            this.loadLitigationHistoryVOS(litigationHistoryVOS);
+        }
+        return litigationHistoryVOS;
+    }
+
+    public void loadLitigationHistoryVOS(List<LitigationHistoryVO> litigationHistoryVOS) throws IOException {
+        List<String> createIds = new ArrayList<>();
+        litigationHistoryVOS.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 (LitigationHistoryVO litigationHistoryVO : litigationHistoryVOS) {
+            //装载人员信息
+            Personnel personnel = personnels.stream().filter(item -> item.getId().equals(litigationHistoryVO.getCreateId())).findFirst().orElse(null);
+            if (personnel != null) {
+                litigationHistoryVO.setCreateName(personnel.getPersonnelName());
+            }
+        }
+
+    }
+
+    public List<Integer> deleteLitigationHistory(List<Integer> ids) {
+        if (!ids.isEmpty()) {
+            this.removeBatchByIds(ids);
+        }
+        return ids;
+    }
+
+}

+ 99 - 0
src/main/java/cn/cslg/pas/service/business/OtherReferencesService.java

@@ -0,0 +1,99 @@
+package cn.cslg.pas.service.business;
+
+import cn.cslg.pas.common.dto.business.OtherReferencesDTO;
+import cn.cslg.pas.common.model.cronModel.PersonnelVO;
+import cn.cslg.pas.common.utils.CacheUtils;
+import cn.cslg.pas.common.utils.LoginUtils;
+import cn.cslg.pas.domain.business.AssoOtherReferencesFile;
+import cn.cslg.pas.domain.business.LitigationHistory;
+import cn.cslg.pas.domain.business.OtherReferences;
+import cn.cslg.pas.exception.XiaoShiException;
+import cn.cslg.pas.mapper.OtherReferencesMapper;
+import cn.cslg.pas.service.permissions.PermissionService;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 其他参考资料
+ * @Author xiexiang
+ * @Date 2024/1/17
+ */
+@Slf4j
+@Service
+public class OtherReferencesService extends ServiceImpl<OtherReferencesMapper, OtherReferences> {
+    @Autowired
+    private LoginUtils loginUtils;
+
+    @Autowired
+    private CacheUtils cacheUtils;
+
+    @Autowired
+    private PermissionService permissionService;
+
+    @Autowired
+    private AssoOtherReferencesFileService assoReferencesFileService;
+
+    /**
+     * 新增or更新其他参考资料
+     * @param otherReferencesDTO
+     * @return
+     */
+    public Integer saveOrUpdate(OtherReferencesDTO otherReferencesDTO){
+        if (otherReferencesDTO == null) {
+            throw new XiaoShiException("入参为空");
+        }
+        Integer id = otherReferencesDTO.getId();
+        List<String> fileGuids = otherReferencesDTO.getFileGuids();
+        OtherReferences otherReferences = new OtherReferences();
+        if (id != null) {
+            //update
+            otherReferences = this.getById(id);
+            BeanUtils.copyProperties(otherReferencesDTO, otherReferences);
+            otherReferences.updateById();
+            if (!fileGuids.isEmpty()) {
+                //先删除 后添加
+                LambdaQueryWrapper<AssoOtherReferencesFile> queryWrapper = new LambdaQueryWrapper<>();
+                queryWrapper.eq(AssoOtherReferencesFile::getOtherReferencesId, id);
+                assoReferencesFileService.remove(queryWrapper);
+                List<Integer> fileIds = this.addFile(otherReferences.getId(), fileGuids);
+            }
+        } else {
+            BeanUtils.copyProperties(otherReferencesDTO, otherReferences);
+            PersonnelVO personnelVO = new PersonnelVO();
+            try {
+                personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+            } catch (Exception e) {
+                throw new XiaoShiException("未查询到当前登陆人");
+            }
+            otherReferences.setCreateId(personnelVO.getId());
+            otherReferences.insert();
+            if (!fileGuids.isEmpty()) {
+                //先删除 后添加
+                List<Integer> fileIds = this.addFile(otherReferences.getId(), fileGuids);
+            }
+        }
+        return otherReferences.getId();
+    }
+
+    public List<Integer> addFile(Integer id, List<String> fileGuids){
+        List<Integer> ids = new ArrayList<>();
+        if (!fileGuids.isEmpty()) {
+            List<AssoOtherReferencesFile> assoOtherReferencesFiles = new ArrayList<>();
+            fileGuids.forEach(item -> {
+                AssoOtherReferencesFile assoOtherReferencesFile = new AssoOtherReferencesFile();
+                assoOtherReferencesFile.setOtherReferencesId(id);
+                assoOtherReferencesFile.setFileGuid(item);
+                assoOtherReferencesFiles.add(assoOtherReferencesFile);
+            });
+            assoReferencesFileService.saveBatch(assoOtherReferencesFiles);
+        }
+        return ids;
+    }
+}

+ 134 - 228
src/main/java/cn/cslg/pas/service/business/PDFExportFirstPageService.java

@@ -1,10 +1,13 @@
 package cn.cslg.pas.service.business;
 
+import cn.cslg.pas.common.dto.ExportTaskDTO;
 import cn.cslg.pas.common.dto.PatentColumnDTO;
 import cn.cslg.pas.common.dto.PatentDTO;
 import cn.cslg.pas.common.dto.es.EsCustomFieldDTO;
 import cn.cslg.pas.common.model.request.QueryRequest;
 import cn.cslg.pas.common.utils.FormatUtil;
+import cn.cslg.pas.common.utils.ParseByteToFileUtils;
+import cn.cslg.pas.common.vo.WebSocketMessageVO;
 import cn.cslg.pas.common.vo.business.PatentNoVO;
 import cn.cslg.pas.common.vo.es.EsCustomFieldBatchVO;
 import cn.cslg.pas.exception.XiaoShiException;
@@ -12,6 +15,7 @@ import cn.cslg.pas.service.business.es.EsCustomFieldService;
 import cn.cslg.pas.service.business.es.EsPatentService;
 import cn.cslg.pas.service.business.es.EsService;
 import cn.cslg.pas.service.common.FileManagerService;
+import cn.cslg.pas.service.common.MessageService;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.io.input.XmlStreamReaderException;
 import org.apache.pdfbox.multipdf.PDFMergerUtility;
@@ -20,6 +24,7 @@ import org.apache.pdfbox.pdmodel.PDDocument;
 import org.apache.pdfbox.pdmodel.PDPage;
 import org.apache.pdfbox.rendering.PDFRenderer;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
@@ -40,20 +45,139 @@ public class PDFExportFirstPageService {
     @Autowired
     private FileManagerService fileManagerService;
     @Autowired
-    private EsService esService;
-    @Autowired
     private EsCustomFieldService esCustomFieldService;
     @Autowired
     private EsPatentService patentService;
 
+    @Autowired
+    private ParseByteToFileUtils parseByteToFileUtils;
 
-    public byte[] mergePdfFirstPage(EsCustomFieldBatchVO EsVO){
-        try {
-            List<String> patentNos = this.getPatentNo(EsVO);
-            byte[] result = this.mergePerPatentPDF(patentNos);
-            return result;
-        } catch (Exception e) {
-            throw new XiaoShiException("合并错误");
+    @Autowired
+    private ImportTaskService importTaskService;
+
+    @Autowired
+    private MessageService messageService;
+
+
+    @Async
+    public void mergePdfFirstPage(ExportTaskDTO exportTask) throws IOException {
+        EsCustomFieldBatchVO EsVO = exportTask.getEsVO();
+        List<String> patentNos = this.getPatentNo(EsVO);
+        Integer total = patentNos.size();
+        Integer defaultNum = 0;
+        PDFMergerUtility merger = new PDFMergerUtility();
+        PDDocument resultDocument = new PDDocument();
+        for (int i = 0; i < patentNos.size(); i++) {
+            PatentNoVO patentNoVO = new PatentNoVO();
+            patentNoVO.setPatentNo(patentNos.get(i));
+            PatentColumnDTO patentColumnDTO = new PatentColumnDTO();
+            try {
+                patentColumnDTO = patentService.selectPatentDetail(patentNoVO);
+            } catch (Exception e) {
+                defaultNum++;
+                continue;
+            }
+            if (patentColumnDTO != null) {
+                //判断申请号是否为空
+                if (patentColumnDTO.getAppNo() != null) {
+                    String appNo = patentColumnDTO.getAppNo();
+                    Integer type = 1;
+                    //获取公告专利pdf文档guid
+                    String pdfGuid = FormatUtil.getPDFFormat(appNo, type);
+                    byte[] pdfData = new byte[0];
+                    try {
+                        pdfData = fileManagerService.downloadSystemFileFromFMS(pdfGuid);
+                        if (pdfData == null || pdfData.length == 0) {
+                            //获取公开专利pdf文档guid
+                            Integer type2 = 0;
+                            String pdfGuid2 = FormatUtil.getPDFFormat(appNo, type2);
+                            pdfData = fileManagerService.downloadSystemFileFromFMS(pdfGuid2);
+                            if (pdfData == null || pdfData.length == 0) {
+                                defaultNum++;
+                                continue;
+                            } else {
+                                // 加载输入的PDF文档
+                                PDDocument document = PDDocument.load(pdfData);
+                                // 获取第一页
+                                PDPage firstPage = document.getPage(0);
+                                // 创建一个新的文档用于保存第一页
+                                PDDocument firstPageDocument = new PDDocument();
+                                firstPageDocument.addPage(firstPage);
+                                // 将第一页添加到合并器中
+                                merger.appendDocument(resultDocument, firstPageDocument);
+                                // 关闭当前处理的文档
+                                document.close();
+                                firstPageDocument.close();
+                                WebSocketMessageVO webSocketMessageVO =new WebSocketMessageVO();
+                                webSocketMessageVO.setProjectId(EsVO.getProjectId());
+                                webSocketMessageVO.setCreateId("328");
+                                webSocketMessageVO.setCode(604);
+                                webSocketMessageVO.setAllNum(total);
+                                webSocketMessageVO.setCurrentNum(i+1);
+                                webSocketMessageVO.setState(1);
+                                messageService.sendPatentExportMessage(webSocketMessageVO);
+                            }
+                        } else {
+                            // 加载每个输入的PDF文档
+                            PDDocument document = PDDocument.load(pdfData);
+                            // 获取第一页
+                            PDPage firstPage = document.getPage(0);
+                            // 创建一个新的文档用于保存第一页
+                            PDDocument firstPageDocument = new PDDocument();
+                            firstPageDocument.addPage(firstPage);
+                            // 将第一页添加到合并器中
+                            merger.appendDocument(resultDocument, firstPageDocument);
+                            // 关闭当前处理的文档
+                            document.close();
+                            firstPageDocument.close();
+                            WebSocketMessageVO webSocketMessageVO = new WebSocketMessageVO();
+                            webSocketMessageVO.setProjectId(EsVO.getProjectId());
+                            webSocketMessageVO.setCreateId(exportTask.getCreateId());
+                            webSocketMessageVO.setCode(604);
+                            webSocketMessageVO.setAllNum(total);
+                            webSocketMessageVO.setCurrentNum(i+1);
+                            webSocketMessageVO.setState(1);
+                            webSocketMessageVO.setTaskId(exportTask.getTaskId());
+                            messageService.sendPDFExportMessage(webSocketMessageVO);
+                        }
+                    } catch (IOException e) {
+                        e.printStackTrace();
+                        defaultNum++;
+                        continue;//继续处理下一件专利
+                    }
+                } else {
+                    defaultNum++;
+                    continue;
+                }
+            } else {
+                defaultNum++;
+                continue;
+            }
+        }
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        resultDocument.save(out);
+        resultDocument.close();
+        WebSocketMessageVO webSocketMessageVO = new WebSocketMessageVO();
+        webSocketMessageVO.setProjectId(EsVO.getProjectId());
+        webSocketMessageVO.setCreateId(exportTask.getCreateId());
+        webSocketMessageVO.setCode(605);
+        webSocketMessageVO.setAllNum(total);
+        webSocketMessageVO.setCurrentNum(total);
+        webSocketMessageVO.setTaskId(exportTask.getTaskId());
+        webSocketMessageVO.setState(2);
+        messageService.sendPDFExportMessage(webSocketMessageVO);
+        String fileGuid = "";
+        if (out.toByteArray() != null && out.toByteArray().length != 0) {
+            fileGuid = parseByteToFileUtils.uploadFile(out.toByteArray(), 2);
+        }
+        exportTask.setFileGuid(fileGuid);
+        exportTask.setAllNum(total);
+        exportTask.setDefaultNum(defaultNum);
+        exportTask.setState(2);
+        exportTask.setDoneNum(total - defaultNum);
+        Integer taskId = importTaskService.updateExportTask(exportTask);
+        if (taskId == null) {
+            throw new XiaoShiException("导出记录失败");
         }
     }
 
@@ -74,7 +198,7 @@ public class PDFExportFirstPageService {
                 isAdd.removeAll(isDel);
                 //创建一个输出流
                 return isAdd;
-            } else if (startNum > 1 && endNum > 0){
+            } else if (startNum >= 1 && endNum > 0){
                 List<String> patentNos = new ArrayList<>();
                 try {
                     patentNos = esCustomFieldService.getPatentNos(EsVO);
@@ -90,224 +214,6 @@ public class PDFExportFirstPageService {
         }
     }
 
-//    public byte[] mergePDFFirstPage(EsCustomFieldBatchVO EsVO) throws IOException {
-//        //初始化
-//        Integer startNum = EsVO.getStartNumber();
-//        Integer endNum = EsVO.getEndNumber();
-//        List<String> isAdd = EsVO.getIsAdd();
-//        List<String> isDel = EsVO.getIsDelete();
-//        try {
-//            if (!CollectionUtils.isEmpty(isAdd) && startNum <= 1 && endNum < 1) {
-//                isAdd.removeAll(isDel);
-//                //创建一个输出流
-//                byte[] result = this.mergePerPatentPDF(isAdd);
-//                return result;
-//            } else if (startNum > 1 && endNum > 0){
-//                List<String> patentNos = new ArrayList<>();
-//                try {
-//                    patentNos = esCustomFieldService.getPatentNos(EsVO);
-//                    byte[] result = this.mergePerPatentPDF(patentNos);
-//                    return result;
-//                } catch (Exception e) {
-//                    throw new XiaoShiException("");
-//                }
-//            } else {
-//                throw new XiaoShiException("入参错误");
-//            }
-//        } catch (FileNotFoundException e) {
-//            throw new FileNotFoundException();
-//        }
-//    }
-
-
-
-//    /**
-//     * 1
-//     * @param EsVO
-//     * @return
-//     * @throws IOException
-//     */
-//    public byte[] mergeAndExportPDFFirstPage(EsCustomFieldBatchVO EsVO) throws IOException {
-//        //根据projectId查询专利信息
-//        QueryRequest queryRequest = new QueryRequest();
-//        queryRequest.setProjectId(projectId);
-//        PatentDTO patentDTO;
-//        try {
-//            patentDTO = esService.esSearch(queryRequest);
-//        } catch (Exception e) {
-//            throw new XiaoShiException("检索专利错误");
-//        }
-//        List<PatentColumnDTO> patents = patentDTO.getPatents();
-//        byte[][] pdfDocuments = this.getPDFByteByAppNo(patents);
-//        byte[] pdfData = new byte[0];
-//        // 判断 byte[][] 数组是否为空
-//        if (!this.isByteEmpty(pdfDocuments)) {
-//            pdfData = this.mergeFirstPage(pdfDocuments);
-//        }
-//        return pdfData;
-//    }
-
-//    /**
-//     * 判断文件数组是否为空
-//     * @param pdfDocuments
-//     * @return
-//     */
-//    private boolean isByteEmpty(byte[][] pdfDocuments) {
-//        return pdfDocuments == null || pdfDocuments.length == 0 || Arrays.stream(pdfDocuments).allMatch(array -> array == null || array.length == 0);
-//    }
-
-//    /**
-//     * 3
-//     * @param pdfDatas
-//     * @return
-//     * @throws IOException
-//     */
-//    public byte[] mergeFirstPage(byte[][] pdfDatas) throws IOException{
-//        //创建一个输出流
-//        try {
-//            // 创建一个PDFMergerUtility实例
-//            PDFMergerUtility merger = new PDFMergerUtility();
-//            PDDocument resultDocument = new PDDocument();
-//            //逐个处理每个pdf文件
-//            for (byte[] pdfData : pdfDatas) {
-//                // 加载每个输入的PDF文档
-//                PDDocument document = PDDocument.load(pdfData);
-//                // 获取第一页
-//                PDPage firstPage = document.getPage(0);
-//                // 创建一个新的文档用于保存第一页
-//                PDDocument firstPageDocument = new PDDocument();
-//                firstPageDocument.addPage(firstPage);
-//                // 将第一页添加到合并器中
-//                merger.appendDocument(resultDocument, firstPageDocument);
-//                // 关闭当前处理的文档
-//                document.close();
-//                firstPageDocument.close();
-//            }
-//            ByteArrayOutputStream out = new ByteArrayOutputStream();
-//            resultDocument.save(out);
-//            resultDocument.close();
-//            return out.toByteArray();
-//        } catch (FileNotFoundException e) {
-//            throw new FileNotFoundException();
-//        }
-//    }
-
-//    /**
-//     * 2
-//     * 根据查询到的专利信息获取它公告或公开专利的pdf文档数据流
-//     * @param patents
-//     * @return
-//     */
-//    public byte[][] getPDFByteByAppNo(List<PatentColumnDTO> patents){
-//        List<byte[]> pdfDatas = new ArrayList<>();
-//        //遍历传入专利集合
-//        for (PatentColumnDTO item : patents) {
-//            //判断申请号是否为空
-//            if (item.getAppNo() != null) {
-//                String appNo = item.getAppNo();
-//                Integer type = 1;
-//                //获取公告专利pdf文档guid
-//                String pdfGuid = FormatUtil.getPDFFormat(appNo, type);
-//
-//                byte[] pdfData = new byte[0];
-//                try {
-//                    pdfData = fileManagerService.downloadSystemFileFromFMS(pdfGuid);
-//                    if (pdfData == null  || pdfData.length == 0) {
-//                        //获取公开专利pdf文档guid
-//                        Integer type2 = 0;
-//                        String pdfGuid2 = FormatUtil.getPDFFormat(appNo, type2);
-//                        pdfData = fileManagerService.downloadSystemFileFromFMS(pdfGuid2);
-//                        if (pdfData == null  || pdfData.length == 0) {
-//                            continue;
-//                        } else {
-//                            pdfDatas.add(pdfData);
-//                        }
-//                    } else {
-//                        pdfDatas.add(pdfData);
-//                    }
-//                } catch (IOException e) {
-//                    e.printStackTrace();
-//                    continue;//继续处理下一件专利
-//                }
-//            }
-//        }
-//        byte[][] pdfDataArray = new byte[pdfDatas.size()][];
-//        return pdfDatas.toArray(pdfDataArray);
-//    }
-
-    public byte[] mergePerPatentPDF(List<String> patentNos) throws IOException {
-        PDFMergerUtility merger = new PDFMergerUtility();
-        PDDocument resultDocument = new PDDocument();
-        for (String patentNo : patentNos) {
-            PatentNoVO patentNoVO = new PatentNoVO();
-            patentNoVO.setPatentNo(patentNo);
-            try {
-                PatentColumnDTO patentColumnDTO = patentService.selectPatentDetail(patentNoVO);
-                if (patentColumnDTO != null) {
-                    //判断申请号是否为空
-                    if (patentColumnDTO.getAppNo() != null) {
-                        String appNo = patentColumnDTO.getAppNo();
-                        Integer type = 1;
-                        //获取公告专利pdf文档guid
-                        String pdfGuid = FormatUtil.getPDFFormat(appNo, type);
-
-                        byte[] pdfData = new byte[0];
-                        try {
-                            pdfData = fileManagerService.downloadSystemFileFromFMS(pdfGuid);
-                            if (pdfData == null || pdfData.length == 0) {
-                                //获取公开专利pdf文档guid
-                                Integer type2 = 0;
-                                String pdfGuid2 = FormatUtil.getPDFFormat(appNo, type2);
-                                pdfData = fileManagerService.downloadSystemFileFromFMS(pdfGuid2);
-                                if (pdfData == null || pdfData.length == 0) {
-                                    continue;
-                                } else {
-                                    // 加载输入的PDF文档
-                                    PDDocument document = PDDocument.load(pdfData);
-                                    // 获取第一页
-                                    PDPage firstPage = document.getPage(0);
-                                    // 创建一个新的文档用于保存第一页
-                                    PDDocument firstPageDocument = new PDDocument();
-                                    firstPageDocument.addPage(firstPage);
-                                    // 将第一页添加到合并器中
-                                    merger.appendDocument(resultDocument, firstPageDocument);
-                                    // 关闭当前处理的文档
-                                    document.close();
-                                    firstPageDocument.close();
-                                }
-                            } else {
-                                // 加载每个输入的PDF文档
-                                PDDocument document = PDDocument.load(pdfData);
-                                // 获取第一页
-                                PDPage firstPage = document.getPage(0);
-                                // 创建一个新的文档用于保存第一页
-                                PDDocument firstPageDocument = new PDDocument();
-                                firstPageDocument.addPage(firstPage);
-                                // 将第一页添加到合并器中
-                                merger.appendDocument(resultDocument, firstPageDocument);
-                                // 关闭当前处理的文档
-                                document.close();
-                                firstPageDocument.close();
-                            }
-                        } catch (IOException e) {
-                            e.printStackTrace();
-                            continue;//继续处理下一件专利
-                        }
-                    } else {
-                        continue;
-                    }
-                } else {
-                    continue;
-                }
-            } catch (Exception e) {
-                continue;
-            }
-        }
-        ByteArrayOutputStream out = new ByteArrayOutputStream();
-        resultDocument.save(out);
-        resultDocument.close();
-        return out.toByteArray();
-    }
 
 
 }

+ 2 - 0
src/main/java/cn/cslg/pas/service/business/PatentDigProjectFilesService.java

@@ -236,6 +236,8 @@ public class PatentDigProjectFilesService extends ServiceImpl<PatentDigProjectFi
         //其次调用新增任务接口
         patentDigProjectFilesDTO.getProjectTaskDTO().setProjectId(patentDigProjectFilesDTO.getProjectId());
         patentDigProjectFilesDTO.getProjectTaskDTO().setProcessId(patentDigProjectFilesDTO.getProcessId());
+        Integer taskType = 7;
+        patentDigProjectFilesDTO.getProjectTaskDTO().setType(taskType);
         Integer taskId = projectTaskService.addTask(patentDigProjectFilesDTO.getProjectTaskDTO());
         if (!ids.isEmpty()) {
             LambdaQueryWrapper<PatentDigProjectFiles> queryWrapper = new LambdaQueryWrapper<>();

+ 18 - 14
src/main/java/cn/cslg/pas/service/business/PatentExportService.java

@@ -8,6 +8,7 @@ import cn.cslg.pas.common.vo.ConfigVOS.PatentConfigVO;
 import cn.cslg.pas.common.vo.WebSocketMessageVO;
 import cn.cslg.pas.common.vo.business.PatentNoVO;
 import cn.cslg.pas.common.vo.es.EsCustomFieldBatchVO;
+import cn.cslg.pas.domain.business.ImportTask;
 import cn.cslg.pas.exception.XiaoShiException;
 import cn.cslg.pas.factorys.PatentExportFactory.GetValueImp;
 import cn.cslg.pas.factorys.PatentExportFactory.PatentExportFactory;
@@ -60,12 +61,13 @@ public class PatentExportService {
     /**
      * 导出专利
      *
-     * @param EsVO
+     * @param exportTask
      * @return
      * @throws IOException
      */
     @Async
-    public void exportPatent(EsCustomFieldBatchVO EsVO) throws IOException {
+    public void exportPatent(ExportTaskDTO exportTask) throws IOException {
+        EsCustomFieldBatchVO EsVO = exportTask.getEsVO();
         try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
             String esSelected = JsonUtils.objectToJson(EsVO.getSelected());
             //selected字符串转PatentExportVO集合
@@ -154,34 +156,36 @@ public class PatentExportService {
                         }
                     }
                 }
-                WebSocketMessageVO webSocketMessageVO =new WebSocketMessageVO();
+                WebSocketMessageVO webSocketMessageVO = new WebSocketMessageVO();
                 webSocketMessageVO.setProjectId(EsVO.getProjectId());
-                webSocketMessageVO.setCreateId("328");
+                webSocketMessageVO.setCreateId(exportTask.getCreateId());
                 webSocketMessageVO.setCode(602);
                 webSocketMessageVO.setAllNum(total);
                 webSocketMessageVO.setCurrentNum(i+1);
+                webSocketMessageVO.setTaskId(exportTask.getTaskId());
                 webSocketMessageVO.setState(1);
                 messageService.sendPatentExportMessage(webSocketMessageVO);
             }
             hssfWorkbook.write(out);
-            WebSocketMessageVO webSocketMessageVO =new WebSocketMessageVO();
+            WebSocketMessageVO webSocketMessageVO = new WebSocketMessageVO();
             webSocketMessageVO.setProjectId(EsVO.getProjectId());
-            webSocketMessageVO.setCreateId("328");
+            webSocketMessageVO.setCreateId(exportTask.getCreateId());
+            webSocketMessageVO.setCode(603);
             webSocketMessageVO.setAllNum(total);
             webSocketMessageVO.setCurrentNum(total);
+            webSocketMessageVO.setTaskId(exportTask.getTaskId());
             webSocketMessageVO.setState(2);
             messageService.sendPatentExportMessage(webSocketMessageVO);
             String fileGuid = "";
             if (out.toByteArray() != null && out.toByteArray().length != 0) {
-                fileGuid = parseByteToFileUtils.uploadFile(out.toByteArray());
+                fileGuid = parseByteToFileUtils.uploadFile(out.toByteArray(), 1);
             }
-            ExportTaskDTO exportTaskDTO = new ExportTaskDTO();
-            exportTaskDTO.setProjectId(EsVO.getProjectId());
-            exportTaskDTO.setType(6);
-            exportTaskDTO.setFileGuid(fileGuid);
-            exportTaskDTO.setAllNum(total);
-            exportTaskDTO.setDefaultNum(defaultNum);
-            Integer taskId = importTaskService.addExportExcel(exportTaskDTO);
+            exportTask.setFileGuid(fileGuid);
+            exportTask.setAllNum(total);
+            exportTask.setDefaultNum(defaultNum);
+            exportTask.setDoneNum(total - defaultNum);
+            exportTask.setState(2);
+            Integer taskId = importTaskService.updateExportTask(exportTask);
             if (taskId == null) {
                 throw new XiaoShiException("导出记录失败");
             }

+ 127 - 0
src/main/java/cn/cslg/pas/service/business/PermissionRecordService.java

@@ -0,0 +1,127 @@
+package cn.cslg.pas.service.business;
+
+import cn.cslg.pas.common.dto.business.LitigationHistoryDTO;
+import cn.cslg.pas.common.dto.business.PermissionRecordDTO;
+import cn.cslg.pas.common.model.cronModel.Personnel;
+import cn.cslg.pas.common.model.cronModel.PersonnelVO;
+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.LitigationHistoryVO;
+import cn.cslg.pas.common.vo.business.PermissionRecordVO;
+import cn.cslg.pas.domain.business.LitigationHistory;
+import cn.cslg.pas.domain.business.PermissionRecord;
+import cn.cslg.pas.exception.XiaoShiException;
+import cn.cslg.pas.mapper.PermissionRecordMapper;
+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;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/1/16
+ */
+@Service
+@Slf4j
+public class PermissionRecordService extends ServiceImpl<PermissionRecordMapper, PermissionRecord> {
+    @Autowired
+    private LoginUtils loginUtils;
+
+    @Autowired
+    private CacheUtils cacheUtils;
+
+    @Autowired
+    private PermissionService permissionService;
+
+    /**
+     * 新增or更新
+     * @param permissionRecordDTO
+     * @return
+     */
+    public Integer saveOrUpdate(PermissionRecordDTO permissionRecordDTO){
+        if (permissionRecordDTO == null) {
+            throw new XiaoShiException("入参为空");
+        }
+        Integer id = permissionRecordDTO.getId();
+        PermissionRecord permissionRecord = new PermissionRecord();
+        if (id != null) {
+            //update
+            permissionRecord = this.getById(id);
+            BeanUtils.copyProperties(permissionRecordDTO, permissionRecord);
+            permissionRecord.updateById();
+        } else {
+            BeanUtils.copyProperties(permissionRecordDTO, permissionRecord);
+            PersonnelVO personnelVO = new PersonnelVO();
+            try {
+                personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+            } catch (Exception e) {
+                throw new XiaoShiException("未查询到当前登陆人");
+            }
+            permissionRecord.setCreateId(personnelVO.getId());
+            permissionRecord.insert();
+        }
+        return permissionRecord.getId();
+    }
+
+    public List<PermissionRecordVO> getPermissionRecord(String patentNo) throws IOException {
+        if (patentNo == null || StringUtils.isEmpty(patentNo)) {
+            throw new XiaoShiException("入参为空");
+        }
+        List<PermissionRecordVO> permissionRecordVOS = new ArrayList<>();
+        LambdaQueryWrapper<PermissionRecord> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(PermissionRecord::getPatentNo, patentNo);
+        List<PermissionRecord> permissionRecords = this.list(queryWrapper);
+
+        if (!permissionRecords.isEmpty()) {
+            permissionRecords.forEach(item -> {
+                PermissionRecordVO permissionRecordVO = new PermissionRecordVO();
+                BeanUtils.copyProperties(item, permissionRecordVO);
+                permissionRecordVOS.add(permissionRecordVO);
+            });
+            this.loadPermissionRecordVOS(permissionRecordVOS);
+        }
+        return permissionRecordVOS;
+    }
+
+    public void loadPermissionRecordVOS(List<PermissionRecordVO> permissionRecordVOS) throws IOException {
+        List<String> createIds = new ArrayList<>();
+        permissionRecordVOS.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 (PermissionRecordVO permissionRecordVO : permissionRecordVOS) {
+            //装载人员信息
+            Personnel personnel = personnels.stream().filter(item -> item.getId().equals(permissionRecordVO.getCreateId())).findFirst().orElse(null);
+            if (personnel != null) {
+                permissionRecordVO.setCreateName(personnel.getPersonnelName());
+            }
+        }
+
+    }
+
+    public List<Integer> deletePermissionRecord(List<Integer> ids) {
+        if (!ids.isEmpty()) {
+            this.removeBatchByIds(ids);
+        }
+        return ids;
+    }
+
+}

+ 127 - 0
src/main/java/cn/cslg/pas/service/business/ReviewHistoryService.java

@@ -0,0 +1,127 @@
+package cn.cslg.pas.service.business;
+
+import cn.cslg.pas.common.dto.business.ReviewHistoryDTO;
+import cn.cslg.pas.common.model.cronModel.Personnel;
+import cn.cslg.pas.common.model.cronModel.PersonnelVO;
+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.HightlightTemplateVO;
+import cn.cslg.pas.common.vo.business.ReviewHistoryVO;
+import cn.cslg.pas.domain.business.HightlightTemplate;
+import cn.cslg.pas.domain.business.ReviewHistory;
+import cn.cslg.pas.exception.XiaoShiException;
+import cn.cslg.pas.mapper.ReviewHistoryMapper;
+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;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/1/15
+ */
+@Service
+@Slf4j
+public class ReviewHistoryService extends ServiceImpl<ReviewHistoryMapper, ReviewHistory> {
+    @Autowired
+    private LoginUtils loginUtils;
+
+    @Autowired
+    private CacheUtils cacheUtils;
+
+    @Autowired
+    private PermissionService permissionService;
+
+    /**
+     * 新增or更新
+     * @param reviewHistoryDTO
+     * @return
+     */
+    public Integer saveOrUpdate(ReviewHistoryDTO reviewHistoryDTO){
+        if (reviewHistoryDTO == null) {
+            throw new XiaoShiException("入参为空");
+        }
+        Integer id = reviewHistoryDTO.getId();
+        ReviewHistory reviewHistory = new ReviewHistory();
+        if (id != null) {
+            //update
+            reviewHistory = this.getById(id);
+            BeanUtils.copyProperties(reviewHistoryDTO, reviewHistory);
+            reviewHistory.updateById();
+        } else {
+            BeanUtils.copyProperties(reviewHistoryDTO, reviewHistory);
+            PersonnelVO personnelVO = new PersonnelVO();
+            try {
+                personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+            } catch (Exception e) {
+                throw new XiaoShiException("未查询到当前登陆人");
+            }
+            reviewHistory.setCreateId(personnelVO.getId());
+            reviewHistory.setTenantId(personnelVO.getTenantId());
+            reviewHistory.insert();
+        }
+        return reviewHistory.getId();
+    }
+
+    public List<ReviewHistoryVO> getReviewHistory(String patentNo) throws IOException {
+        if (patentNo == null || StringUtils.isEmpty(patentNo)) {
+            throw new XiaoShiException("入参为空");
+        }
+        List<ReviewHistoryVO> reviewHistoryVOS = new ArrayList<>();
+        LambdaQueryWrapper<ReviewHistory> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(ReviewHistory::getPatentNo, patentNo);
+        List<ReviewHistory> reviewHistories = this.list(queryWrapper);
+
+        if (!reviewHistories.isEmpty()) {
+            reviewHistories.forEach(item -> {
+                ReviewHistoryVO reviewHistoryVO = new ReviewHistoryVO();
+                BeanUtils.copyProperties(item, reviewHistoryVO);
+                reviewHistoryVOS.add(reviewHistoryVO);
+            });
+            this.loadReviewHistoryVOS(reviewHistoryVOS);
+        }
+        return reviewHistoryVOS;
+    }
+
+    public void loadReviewHistoryVOS(List<ReviewHistoryVO> reviewHistoryVOS) throws IOException {
+        List<String> createIds = new ArrayList<>();
+        reviewHistoryVOS.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 (ReviewHistoryVO reviewHistoryVO : reviewHistoryVOS) {
+            //装载人员信息
+            Personnel personnel = personnels.stream().filter(item -> item.getId().equals(reviewHistoryVO.getCreateId())).findFirst().orElse(null);
+            if (personnel != null) {
+                reviewHistoryVO.setCreateName(personnel.getPersonnelName());
+            }
+        }
+
+    }
+
+    public List<Integer> deleteReviewHistory(List<Integer> ids) {
+        if (!ids.isEmpty()) {
+            this.removeBatchByIds(ids);
+        }
+        return ids;
+    }
+
+}

+ 5 - 0
src/main/java/cn/cslg/pas/service/business/ScratchWordsService.java

@@ -25,7 +25,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
+import org.springframework.data.annotation.AccessType;
 import org.springframework.stereotype.Service;
 
 import java.util.ArrayList;
@@ -41,6 +43,9 @@ import java.util.stream.Collectors;
 @Service
 @RequiredArgsConstructor(onConstructor_ = {@Lazy})
 public class ScratchWordsService extends ServiceImpl<ScratchWordsMapper, ScratchWords> {
+    @Autowired
+    private ScratchWordsMapper scratchWordsMapper;
+
     private final CacheUtils cacheUtils;
     private final LoginUtils loginUtils;
     private final EsScratchWordsService esScratchWordsService;

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

@@ -243,6 +243,7 @@ public class TaskHandleResultService extends ServiceImpl<TaskHandleResultMapper,
                     SystemFile systemFile = systemFiles.stream().filter(item -> item.getGuid().equals(assoHandleResultFile.getFileGuid())).findFirst().orElse(null);
                     if (systemFile != null) {
                         BeanUtils.copyProperties(assoHandleResultFile, handleResultFileVO);
+                        handleResultFileVO.setGuid(assoHandleResultFile.getFileGuid());
                         handleResultFileVO.setType(systemFile.getType());
                         handleResultFileVO.setOriginalName(systemFile.getOriginalName());
                         handleResultFileVOS.add(handleResultFileVO);

+ 22 - 0
src/main/java/cn/cslg/pas/service/common/MessageService.java

@@ -100,12 +100,34 @@ public class MessageService {
         taskWebSocketDTO.setComplete(flag);
         taskWebSocketDTO.setIndex(webSocketMessageVO.getCurrentNum());
         taskWebSocketDTO.setPercentage(percentage);
+        taskWebSocketDTO.setTaskId(webSocketMessageVO.getTaskId());
+        taskWebSocketDTO.setTaskStatus(webSocketMessageVO.getState());
         if(flag) {
             WebSocketServer.sendInfo(Response.websocket(taskWebSocketDTO, ResponseEnum.PATENT_EXPORT_TASK_DONE), webSocketMessageVO.getCreateId());
         return;
         }
         WebSocketServer.sendInfo(Response.websocket(taskWebSocketDTO, ResponseEnum.PATENT_EXPORT_TASK), webSocketMessageVO.getCreateId());
+    }
+
+
+    //发送导出PDF首页消息
+    public void sendPDFExportMessage(WebSocketMessageVO webSocketMessageVO) {
+        //通过WebSocket 在每一次循环结束后 向前端发送完成进度
+        //当任务状态为完成时,flag为true
+        long percentage = (long) Math.floor((webSocketMessageVO.getCurrentNum() + 0D) / webSocketMessageVO.getAllNum() * 100D);
+        boolean flag = webSocketMessageVO.getState().equals(2);
 
+        TaskWebSocketDTO taskWebSocketDTO = new TaskWebSocketDTO();
+        taskWebSocketDTO.setComplete(flag);
+        taskWebSocketDTO.setIndex(webSocketMessageVO.getCurrentNum());
+        taskWebSocketDTO.setPercentage(percentage);
+        taskWebSocketDTO.setTaskId(webSocketMessageVO.getTaskId());
+        taskWebSocketDTO.setTaskStatus(webSocketMessageVO.getState());
+        if(flag) {
+            WebSocketServer.sendInfo(Response.websocket(taskWebSocketDTO, ResponseEnum.PATENT_PDF_EXPORT_TASK_DONE), webSocketMessageVO.getCreateId());
+            return;
+        }
+        WebSocketServer.sendInfo(Response.websocket(taskWebSocketDTO, ResponseEnum.PATENT_PDF_EXPORT_TASK), webSocketMessageVO.getCreateId());
     }
 
 }