Prechádzať zdrojové kódy

查询专利号带筛选 2022/12/14

lwhhszx 2 rokov pred
rodič
commit
f687a5e5f8
57 zmenil súbory, kde vykonal 923 pridanie a 954 odobranie
  1. 1 2
      PAS/src/main/java/cn/cslg/pas/common/model/QueryPatentVO.java
  2. 0 23
      PAS/src/main/java/cn/cslg/pas/common/model/dto/AssoStructurePatentQueryDTO.java
  3. 0 40
      PAS/src/main/java/cn/cslg/pas/common/model/dto/AssoStructurePatentUpdateDTO.java
  4. 0 4
      PAS/src/main/java/cn/cslg/pas/common/model/dto/ProductAddNewDTO.java
  5. 47 0
      PAS/src/main/java/cn/cslg/pas/common/model/dto/ProductPatentDTO.java
  6. 0 26
      PAS/src/main/java/cn/cslg/pas/common/model/dto/QueryPathStructureNameDTO.java
  7. 2 6
      PAS/src/main/java/cn/cslg/pas/common/model/vo/PathStructureNameVO.java
  8. 1 1
      PAS/src/main/java/cn/cslg/pas/common/model/vo/ProductCategoryTrendVO.java
  9. 0 26
      PAS/src/main/java/cn/cslg/pas/common/model/vo/ProductPatentVO.java
  10. 0 13
      PAS/src/main/java/cn/cslg/pas/common/model/vo/ProductVO.java
  11. 0 35
      PAS/src/main/java/cn/cslg/pas/common/model/vo/StructurePatentVO.java
  12. 0 17
      PAS/src/main/java/cn/cslg/pas/common/model/vo/StructureVO.java
  13. 1 1
      PAS/src/main/java/cn/cslg/pas/common/model/vo/TaskParams.java
  14. 1 0
      PAS/src/main/java/cn/cslg/pas/common/model/vo/TaskVO.java
  15. 1 1
      PAS/src/main/java/cn/cslg/pas/controller/PatentController.java
  16. 2 2
      PAS/src/main/java/cn/cslg/pas/controller/ProductCategoryController.java
  17. 72 0
      PAS/src/main/java/cn/cslg/pas/controller/ProductPatentController.java
  18. 0 55
      PAS/src/main/java/cn/cslg/pas/controller/ProductStructurePatentIndexController.java
  19. 1 2
      PAS/src/main/java/cn/cslg/pas/controller/ProjectController.java
  20. 1 0
      PAS/src/main/java/cn/cslg/pas/controller/ProjectFieldOptionController.java
  21. 0 1
      PAS/src/main/java/cn/cslg/pas/controller/ProjectImportController.java
  22. 4 5
      PAS/src/main/java/cn/cslg/pas/controller/StructureController.java
  23. 3 3
      PAS/src/main/java/cn/cslg/pas/controller/TaskController.java
  24. 1 23
      PAS/src/main/java/cn/cslg/pas/domain/Project.java
  25. 0 17
      PAS/src/main/java/cn/cslg/pas/domain/Structure.java
  26. 2 0
      PAS/src/main/java/cn/cslg/pas/domain/Task.java
  27. 6 10
      PAS/src/main/java/cn/cslg/pas/common/model/vo/AssoStructurePatentVO.java
  28. 3 0
      PAS/src/main/java/cn/cslg/pas/domain/asso/AssoStructurePatent.java
  29. 0 22
      PAS/src/main/java/cn/cslg/pas/mapper/AssoProductPatentMapper.java
  30. 8 36
      PAS/src/main/java/cn/cslg/pas/mapper/AssoStructurePatentMapper.java
  31. 2 2
      PAS/src/main/java/cn/cslg/pas/mapper/AssoStructurePictureMapper.java
  32. 2 2
      PAS/src/main/java/cn/cslg/pas/mapper/PermissionRecordMapper.java
  33. 4 14
      PAS/src/main/java/cn/cslg/pas/mapper/ProductMapper.java
  34. 8 12
      PAS/src/main/java/cn/cslg/pas/mapper/StructureMapper.java
  35. 28 0
      PAS/src/main/java/cn/cslg/pas/mapper/asso/AssoProductPatentMapper.java
  36. 1 1
      PAS/src/main/java/cn/cslg/pas/service/IProductCategoryService.java
  37. 0 31
      PAS/src/main/java/cn/cslg/pas/service/IStructurePatentService.java
  38. 1 3
      PAS/src/main/java/cn/cslg/pas/service/IStructureService.java
  39. 2 0
      PAS/src/main/java/cn/cslg/pas/service/ProjectImportService.java
  40. 15 44
      PAS/src/main/java/cn/cslg/pas/service/ProjectService.java
  41. 14 5
      PAS/src/main/java/cn/cslg/pas/service/TaskService.java
  42. 78 1
      PAS/src/main/java/cn/cslg/pas/service/UploadPatentBatchService.java
  43. 175 0
      PAS/src/main/java/cn/cslg/pas/service/asso/AssoProductPatentService.java
  44. 41 0
      PAS/src/main/java/cn/cslg/pas/service/asso/AssoStructurePatentService.java
  45. 62 16
      PAS/src/main/java/cn/cslg/pas/service/impl/ProductCategoryServiceImpl.java
  46. 1 1
      PAS/src/main/java/cn/cslg/pas/service/impl/ProductMarketDataServiceImpl.java
  47. 3 27
      PAS/src/main/java/cn/cslg/pas/service/impl/ProductServiceImpl.java
  48. 0 80
      PAS/src/main/java/cn/cslg/pas/service/impl/StructurePatentServiceImpl.java
  49. 57 100
      PAS/src/main/java/cn/cslg/pas/service/impl/StructureServiceImpl.java
  50. 178 0
      PAS/src/main/resources/mapper/AssoProductPatentMapper.xml
  51. 0 56
      PAS/src/main/resources/mapper/AssoStructurePatentMapper.xml
  52. 2 4
      PAS/src/main/resources/mapper/AssoStructurePictureMapper.xml
  53. 53 60
      PAS/src/main/resources/mapper/PermissionRecordMapper.xml
  54. 1 51
      PAS/src/main/resources/mapper/ProductMapper.xml
  55. 12 13
      PAS/src/main/resources/mapper/ProjectMapper.xml
  56. 23 60
      PAS/src/main/resources/mapper/StructureMapper.xml
  57. 3 0
      PAS/src/main/resources/mapper/TaskMapper.xml

+ 1 - 2
PAS/src/main/java/cn/cslg/pas/common/model/QueryPatentVO.java

@@ -14,6 +14,7 @@ import java.util.List;
  */
 @Data
 public class QueryPatentVO extends BaseVO {
+    private Integer productId;
     //专题库ID
     private Integer projectId;
     //RMS导入ID
@@ -22,8 +23,6 @@ public class QueryPatentVO extends BaseVO {
     private List<String> patentNos;
     // 去除的专利号
     private List<String> notInPatentNos;
-    //条件专利号
-    private List<String> conPatentNos;
     //申请人名字
     private String applicationName;
     //权利人名字

+ 0 - 23
PAS/src/main/java/cn/cslg/pas/common/model/dto/AssoStructurePatentQueryDTO.java

@@ -1,23 +0,0 @@
-package cn.cslg.pas.common.model.dto;
-
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import java.io.Serializable;
-
-/**
- * 专题库产品架构专利号标引的查询DTO类
- */
-@Accessors(chain = true)
-@Data
-public class AssoStructurePatentQueryDTO implements Serializable {
-    /**
-     * 专利号
-     */
-    private String patentNo;
-    /**
-     * 专题库id
-     */
-    private Integer projectId;
-
-}

+ 0 - 40
PAS/src/main/java/cn/cslg/pas/common/model/dto/AssoStructurePatentUpdateDTO.java

@@ -1,40 +0,0 @@
-package cn.cslg.pas.common.model.dto;
-
-import lombok.Data;
-import lombok.experimental.Accessors;
-import org.apache.xpath.operations.Bool;
-
-import java.io.Serializable;
-
-/**
- * 专题库产品架构专利号标引的修改DTO类
- */
-@Accessors(chain = true)
-@Data
-public class AssoStructurePatentUpdateDTO implements Serializable {
-    /**
-     * ID
-     */
-    private Integer id;
-    /**
-     * 架构id
-     */
-    private Integer structureId;
-    /**
-     * 专利号
-     */
-    private String patentNo;
-    /**
-     * 产品id
-     */
-    private Integer productId;
-    /**
-     * 专题库id
-     */
-    private Integer projectId;
-    /**
-     * 更新类型(1新增 0删除)
-     */
-    private Boolean updateType;
-
-}

+ 0 - 4
PAS/src/main/java/cn/cslg/pas/common/model/dto/ProductAddNewDTO.java

@@ -40,9 +40,5 @@ public class ProductAddNewDTO implements Serializable {
      * 许可费率
      */
     private Double licenseRate;
-    /**
-     * 专利号
-     */
-    private String patentNo;
 
 }

+ 47 - 0
PAS/src/main/java/cn/cslg/pas/common/model/dto/ProductPatentDTO.java

@@ -0,0 +1,47 @@
+package cn.cslg.pas.common.model.dto;
+
+import cn.cslg.pas.common.model.vo.BaseVO;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class ProductPatentDTO extends BaseVO {
+
+    private Integer productId;
+    //专利号
+    private List<String> patentNos;
+    // 去除的专利号
+    private List<String> notInPatentNos;
+    //申请人名字
+    private String applicationName;
+    //权利人名字
+    private String obligeeName;
+
+    private Integer startNumber;
+
+    private Integer endNumber;
+
+    private String orderType;
+
+    private String orderItem;
+
+    @Schema(description = "专利号")
+    private String patentNo;
+
+    @Schema(description = "申请号")
+    private String applicationNo;
+
+    @Schema(description = "IPC分类号")
+    private String numberIpc;
+    @Schema(description = "CPC分类号")
+    private String numberCpc;
+    @Schema(description = "UPC分类号")
+    private String numberUpc;
+    @Schema(description = "摘要")
+    private String abstractStr;
+    @Schema(description = "标题")
+    private String patentName;
+    private Integer isIn;
+}

+ 0 - 26
PAS/src/main/java/cn/cslg/pas/common/model/dto/QueryPathStructureNameDTO.java

@@ -1,26 +0,0 @@
-package cn.cslg.pas.common.model.dto;
-
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import java.io.Serializable;
-
-/**
- * 查询所有架构的路径和路径拼接成的架构名称
- *
- * @Author chenyu
- * @Date 2023/3/16
- */
-@Accessors(chain = true)
-@Data
-public class QueryPathStructureNameDTO implements Serializable {
-    /**
-     * 产品id
-     */
-    private Integer productId;
-    /**
-     * 架构id
-     */
-    private Integer structureId;
-
-}

+ 2 - 6
PAS/src/main/java/cn/cslg/pas/common/model/vo/PathStructureNameVO.java

@@ -15,15 +15,11 @@ import java.io.Serializable;
 @Data
 public class PathStructureNameVO implements Serializable {
     /**
-     * 架构id
-     */
-    private Integer id;
-    /**
-     * 架构路径
+     * 路径
      */
     private String path;
     /**
-     * 架构路径拼接名称
+     * 路径对应的完整架构名称
      */
     private String pathStructureName;
 

+ 1 - 1
PAS/src/main/java/cn/cslg/pas/common/model/vo/ProductCategoryTrendVO.java

@@ -27,7 +27,7 @@ public class ProductCategoryTrendVO implements Serializable {
         /**
          * 时间(季度或者月份)
          */
-        private String marketData;
+        private String marketDate;
 
         /**
          * 销售额

+ 0 - 26
PAS/src/main/java/cn/cslg/pas/common/model/vo/ProductPatentVO.java

@@ -1,26 +0,0 @@
-package cn.cslg.pas.common.model.vo;
-
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import java.io.Serializable;
-
-/**
- * 产品和专利标准查询VO类
- */
-@Accessors(chain = true)
-@Data
-public class ProductPatentVO implements Serializable {
-    /**
-     * ID
-     */
-    private Integer id;
-    /**
-     * 专利号
-     */
-    private String patentNo;
-    /**
-     * 产品id
-     */
-    private Integer productId;
-}

+ 0 - 13
PAS/src/main/java/cn/cslg/pas/common/model/vo/ProductVO.java

@@ -1,6 +1,5 @@
 package cn.cslg.pas.common.model.vo;
 
-import cn.cslg.pas.domain.asso.AssoStructurePatent;
 import lombok.Data;
 import lombok.experimental.Accessors;
 
@@ -61,17 +60,5 @@ public class ProductVO implements Serializable {
      * 产品图片
      */
     private List<ProductPictureVO> pictures;
-    /**
-     * 产品的专利
-     */
-    private List<ProductPatentVO> productPatents;
-    /**
-     * 架构的专利
-     */
-    private List<StructurePatentVO> structurePatents;
-    /**
-     * 相关专利数量
-     */
-    private Integer patentNum;
 
 }

+ 0 - 35
PAS/src/main/java/cn/cslg/pas/common/model/vo/StructurePatentVO.java

@@ -1,35 +0,0 @@
-package cn.cslg.pas.common.model.vo;
-
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import java.io.Serializable;
-
-/**
- * 架构和专利标准查询VO类
- */
-@Accessors(chain = true)
-@Data
-public class StructurePatentVO implements Serializable {
-    /**
-     * ID
-     */
-    private Integer id;
-    /**
-     * 专利号
-     */
-    private String patentNo;
-    /**
-     * 架构id
-     */
-    private Integer structureId;
-    /**
-     * 产品id
-     */
-    private Integer productId;
-    /**
-     * 专题库id
-     */
-    private Integer projectId;
-
-}

+ 0 - 17
PAS/src/main/java/cn/cslg/pas/common/model/vo/StructureVO.java

@@ -4,7 +4,6 @@ import lombok.Data;
 import lombok.experimental.Accessors;
 
 import java.io.Serializable;
-import java.util.Date;
 import java.util.List;
 
 /**
@@ -30,10 +29,6 @@ public class StructureVO implements Serializable {
      */
     private String path;
     /**
-     * 路径名称
-     */
-    private String pathName;
-    /**
      * 说明
      */
     private String remark;
@@ -49,17 +44,5 @@ public class StructureVO implements Serializable {
      * 子架构集合
      */
     private List<StructureVO> children;
-    /**
-     * 相关专利数量
-     */
-    private Integer patentNum;
-    /**
-     * 创建人名称
-     */
-    private String createPersonName;
-    /**
-     * 创建时间
-     */
-    private Date createTime;
 
 }

+ 1 - 1
PAS/src/main/java/cn/cslg/pas/common/model/vo/TaskParams.java

@@ -23,7 +23,7 @@ public class TaskParams implements Serializable {
     private String oldName;
     private Integer total;
     private Integer index;
-
+    private Integer productId;
     public TaskParams() {
 
     }

+ 1 - 0
PAS/src/main/java/cn/cslg/pas/common/model/vo/TaskVO.java

@@ -9,4 +9,5 @@ public class TaskVO extends BaseVO {
     private Integer type;
     private String createName;
     private String projectName;
+    private Integer productId;
 }

+ 1 - 1
PAS/src/main/java/cn/cslg/pas/controller/PatentController.java

@@ -28,6 +28,7 @@ import org.springframework.web.multipart.commons.CommonsMultipartFile;
 import java.io.*;
 import java.net.HttpURLConnection;
 import java.net.URL;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
@@ -203,5 +204,4 @@ public class PatentController {
         return fileDTO;
     }
 
-
 }

+ 2 - 2
PAS/src/main/java/cn/cslg/pas/controller/ProductCategoryController.java

@@ -92,8 +92,8 @@ public class ProductCategoryController {
     }
     @Operation(summary = "获得架构的地区集合")
     @GetMapping("/getAreaList")
-    public String getAreaList(Integer id) {
-        return Response.success( productCategoryService.getAreaList(id));
+    public String getAreaList(Integer id,Integer productId) {
+        return Response.success( productCategoryService.getAreaList(id,productId));
     }
     @Operation(summary = "获得架构的公司集合")
     @GetMapping("/getCompanyList")

+ 72 - 0
PAS/src/main/java/cn/cslg/pas/controller/ProductPatentController.java

@@ -0,0 +1,72 @@
+package cn.cslg.pas.controller;
+
+import cn.cslg.pas.common.core.base.Constants;
+import cn.cslg.pas.common.model.QueryPatentVO;
+import cn.cslg.pas.common.model.dto.ProductPatentDTO;
+import cn.cslg.pas.common.model.vo.TaskParams;
+import cn.cslg.pas.common.model.vo.TaskVO;
+import cn.cslg.pas.common.utils.Response;
+import cn.cslg.pas.common.utils.StringUtils;
+import cn.cslg.pas.common.utils.auth.checkAuth;
+import cn.cslg.pas.domain.Task;
+import cn.cslg.pas.service.ProjectService;
+import cn.cslg.pas.service.TaskService;
+import cn.cslg.pas.service.UploadPatentBatchService;
+import cn.cslg.pas.service.asso.AssoProductPatentService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 任务 前端控制器
+ * </p>
+ *
+ * @author 王岩
+ * @since 2022-02-17
+ */
+@Tag(name = "产品相关专利管理")
+@RestController
+@RequestMapping(Constants.API_VERSION_V2 + "/proPatent")
+@RequiredArgsConstructor(onConstructor_ = {@Lazy})
+public class ProductPatentController {
+    private final AssoProductPatentService assoProductPatentService;
+    private final UploadPatentBatchService uploadPatentBatchService;
+    private final ProjectService projectService;
+    @PostMapping("/add")
+    @Operation(summary = "添加产品相关专利")
+    public String addPatents(@RequestBody ProductPatentDTO patentDTO) {
+        assoProductPatentService.addPatents(patentDTO);
+        return Response.success(true);
+    }
+
+    @PostMapping("/delete")
+    @Operation(summary = "删除产品相关专利")
+    public String deletePatents(@RequestBody ProductPatentDTO patentDTO) {
+      List<String> patentNos =  assoProductPatentService.deletePatents(patentDTO);
+        if(patentNos.size()==0){
+            return Response.success("删除成功");
+        }
+    return  Response.successBut(patentNos);
+    }
+
+    @PostMapping("/importPatents")
+    @Operation(summary = "导入专利")
+    public String importSysPatent(MultipartFile file, Integer productId) {
+        TaskParams taskParams = projectService.getImportPatentTaskParamsBro(file,productId);
+        uploadPatentBatchService.uploadPatentForProduct(taskParams,productId);
+        return Response.success();
+    }
+
+    @PostMapping("/queryPatents")
+    @Operation(summary = "查询产品相关专利")
+    public String queryPatents(@RequestBody QueryPatentVO params) {
+        return Response.success(assoProductPatentService.getPageList(params));
+    }
+}
+

+ 0 - 55
PAS/src/main/java/cn/cslg/pas/controller/ProductStructurePatentIndexController.java

@@ -1,55 +0,0 @@
-package cn.cslg.pas.controller;
-
-import cn.cslg.pas.common.core.base.Constants;
-import cn.cslg.pas.common.model.dto.AssoStructurePatentQueryDTO;
-import cn.cslg.pas.common.model.dto.AssoStructurePatentUpdateDTO;
-import cn.cslg.pas.common.model.vo.AssoStructurePatentVO;
-import cn.cslg.pas.common.utils.Response;
-import cn.cslg.pas.exception.XiaoShiException;
-import cn.cslg.pas.service.IStructurePatentService;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.List;
-
-/**
- * 产品架构专利号标引的Controller层
- *
- * @Author chenyu
- * @Date 2023/3/15
- */
-@Tag(name = "专题库标引管理模块")
-@RequiredArgsConstructor
-@Slf4j
-@RequestMapping(Constants.API_VERSION_V2 + "/productStructurePatentIndex")
-@RestController
-public class ProductStructurePatentIndexController {
-    private final IStructurePatentService structurePatentService;
-
-    @Operation(summary = "更新标引")
-    @PostMapping("/update")
-    public String update(@RequestBody AssoStructurePatentUpdateDTO assoStructurePatentUpdateDTO) {
-        log.info("开始处理【更新标引】的请求,请求参数为:{}", assoStructurePatentUpdateDTO);
-        try {
-            structurePatentService.update(assoStructurePatentUpdateDTO);
-        } catch (XiaoShiException e) {
-            return Response.error(e.getMessage());
-        }
-        return Response.success("更新标引");
-    }
-
-    @Operation(summary = "查询标引")
-    @PostMapping("/query")
-    public String query(@RequestBody AssoStructurePatentQueryDTO assoStructurePatentQueryDTO) {
-        log.info("开始处理【查询标引】的业务,参数为:{}", assoStructurePatentQueryDTO);
-        List<AssoStructurePatentVO> query = structurePatentService.query(assoStructurePatentQueryDTO);
-        return Response.success(query);
-    }
-
-}

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

@@ -46,10 +46,9 @@ ProjectController {
     public String getPageList(@RequestBody ProjectVO params) throws IOException {
         return Response.success(projectService.getPageList(params));
     }
-
     @GetMapping("getProjectById")
     @Operation(summary = "根据Id获得专题库")
-    public String getProject(Integer id) throws IOException {
+    public String getProject(Integer id ) throws IOException {
         return Response.success(projectService.getProjectByIds(Arrays.asList(id)));
     }
 

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

@@ -90,6 +90,7 @@ public class ProjectFieldOptionController {
     @Operation(summary = "删除选项")
     public String delete(Integer type, Integer id) {
         if (type == 6) {
+
             projectFieldTreeService.delete(id);
         } else {
             projectFieldOptionService.delete(id);

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

@@ -63,7 +63,6 @@ public class ProjectImportController {
     public String importSysPatent(@RequestBody TaskParams taskParams) {
         return uploadPatentBatchService.uploadPatentBatchBro(taskParams);
     }
-
     @GetMapping("list")
     @Operation(summary = "导入任务列表")
     public String getPageList(ProjectImportVO params) {

+ 4 - 5
PAS/src/main/java/cn/cslg/pas/controller/StructureController.java

@@ -1,7 +1,6 @@
 package cn.cslg.pas.controller;
 
 import cn.cslg.pas.common.core.base.Constants;
-import cn.cslg.pas.common.model.dto.QueryPathStructureNameDTO;
 import cn.cslg.pas.common.model.dto.StructureAddNewDTO;
 import cn.cslg.pas.common.model.dto.StructureQueryPageDTO;
 import cn.cslg.pas.common.model.dto.StructureUpdateDTO;
@@ -75,10 +74,10 @@ public class StructureController {
     }
 
     @Operation(summary = "查询拼接路径名")
-    @PostMapping("/queryPathStructureName")
-    public String queryPathStructureName(@RequestBody QueryPathStructureNameDTO queryPathStructureNameDTO) {
-        log.info("开始处理【查询所有架构路径和路径架构名称】的业务,参数为:{}", queryPathStructureNameDTO);
-        List<PathStructureNameVO> queryResults = structureService.queryPathStructureName(queryPathStructureNameDTO);
+    @GetMapping("/queryPathStructureName")
+    public String queryPathStructureName(Integer productId) {
+        log.info("开始处理【查询所有架构路径和路径架构名称】的业务,参数为:{}", productId);
+        List<PathStructureNameVO> queryResults = structureService.queryPathStructureName(productId);
         return Response.success(queryResults);
     }
 

+ 3 - 3
PAS/src/main/java/cn/cslg/pas/controller/TaskController.java

@@ -30,7 +30,7 @@ public class TaskController {
     @GetMapping("list")
     @Operation(summary = "任务列表")
     public String getPageList(TaskVO params) {
-        return Response.success(taskService.getPageList(params));
+      return Response.success(taskService.getPageList(params));
     }
 
     @PostMapping("delete")
@@ -41,8 +41,8 @@ public class TaskController {
 
     @GetMapping("queue")
     @Operation(summary = "获取进行中的任务")
-    public String getQueueList(Integer type, Integer projectId) {
-        return Response.success(taskService.getQueueList(type, projectId));
+    public String getQueueList(Integer type, Integer projectId,Integer productId) {
+        return Response.success(taskService.getQueueList(type, projectId,productId));
     }
 
     @PostMapping("update")

+ 1 - 23
PAS/src/main/java/cn/cslg/pas/domain/Project.java

@@ -1,7 +1,6 @@
 package cn.cslg.pas.domain;
 
 import cn.cslg.pas.common.model.BaseEntity;
-import com.baomidou.mybatisplus.annotation.FieldStrategy;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
@@ -19,6 +18,7 @@ import java.util.List;
 @Data
 @TableName("os_thematic")
 public class Project extends BaseEntity<Project> {
+
     /**
      * 标题
      */
@@ -143,26 +143,4 @@ public class Project extends BaseEntity<Project> {
 
     @TableField(exist = false)
     private String personnelName;
-
-    /**
-     * 产品id
-     */
-    @TableField(updateStrategy = FieldStrategy.IGNORED)
-    private Integer productId;
-    /**
-     * 架构id
-     */
-    @TableField(updateStrategy = FieldStrategy.IGNORED)
-    private Integer structureId;
-    /**
-     * 是否分类(1是 0否)
-     */
-    @TableField(updateStrategy = FieldStrategy.IGNORED)
-    private Integer isCategory;
-    /**
-     * 产品名称
-     */
-    @TableField(exist = false)
-    private String productName;
-
 }

+ 0 - 17
PAS/src/main/java/cn/cslg/pas/domain/Structure.java

@@ -8,7 +8,6 @@ import lombok.Data;
 import lombok.experimental.Accessors;
 
 import java.io.Serializable;
-import java.util.Date;
 
 /**
  * 元素表实体类
@@ -42,21 +41,5 @@ public class Structure implements Serializable {
      * 产品id
      */
     private Integer productId;
-    /**
-     * 创建人id
-     */
-    private Integer createPersonId;
-    /**
-     * 创建人名称
-     */
-    private String createPersonName;
-    /**
-     * 创建时间
-     */
-    private Date createTime;
-    /**
-     * 最后修改时间
-     */
-    private Date modifiedTime;
 
 }

+ 2 - 0
PAS/src/main/java/cn/cslg/pas/domain/Task.java

@@ -84,6 +84,8 @@ public class Task extends BaseEntity<Task> {
     @TableField("downexcel")
     private String url;
 
+    @TableField("product_id")
+    private Integer productId;
     private String oldName;
 
     @TableField(exist = false)

+ 6 - 10
PAS/src/main/java/cn/cslg/pas/common/model/vo/AssoStructurePatentVO.java

@@ -1,5 +1,6 @@
-package cn.cslg.pas.common.model.vo;
+package cn.cslg.pas.domain.asso;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 import lombok.experimental.Accessors;
@@ -7,11 +8,12 @@ import lombok.experimental.Accessors;
 import java.io.Serializable;
 
 /**
- * 专题库产品架构专利号标引的标准查询VO
+ * 专利架构关联表实体
  */
 @Accessors(chain = true)
 @Data
-public class AssoStructurePatentVO implements Serializable {
+@TableName(value = "asso_structure_patent")
+public class AssoPatentStructure implements Serializable {
     /**
      * ID
      */
@@ -24,13 +26,7 @@ public class AssoStructurePatentVO implements Serializable {
      * 专利号
      */
     private String patentNo;
-    /**
-     * 产品id
-     */
-    private Integer productId;
-    /**
-     * 专题库id
-     */
+    @TableField(value = "product_Id")
     private Integer projectId;
 
 }

+ 3 - 0
PAS/src/main/java/cn/cslg/pas/domain/asso/AssoStructurePatent.java

@@ -1,5 +1,6 @@
 package cn.cslg.pas.domain.asso;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 import lombok.experimental.Accessors;
@@ -25,6 +26,8 @@ public class AssoStructurePatent implements Serializable {
      * 专利号
      */
     private String patentNo;
+
+    @TableField(value = "product_Id")
     /**
      * 产品id
      */

+ 0 - 22
PAS/src/main/java/cn/cslg/pas/mapper/AssoProductPatentMapper.java

@@ -1,22 +0,0 @@
-package cn.cslg.pas.mapper;
-
-import cn.cslg.pas.domain.asso.AssoProductPatent;
-import org.springframework.stereotype.Repository;
-
-/**
- * 产品专利关联表的Mapper层接口
- *
- * @Author chenyu
- * @Date 2023/3/16
- */
-@Repository
-public interface AssoProductPatentMapper {
-    /**
-     * 插入数据
-     *
-     * @param assoProductPatent 数据对象
-     * @return 返回受影响的行数
-     */
-    int insert(AssoProductPatent assoProductPatent);
-
-}

+ 8 - 36
PAS/src/main/java/cn/cslg/pas/mapper/AssoStructurePatentMapper.java

@@ -1,8 +1,12 @@
 package cn.cslg.pas.mapper;
 
-import cn.cslg.pas.common.model.dto.AssoStructurePatentQueryDTO;
-import cn.cslg.pas.common.model.vo.AssoStructurePatentVO;
-import cn.cslg.pas.domain.asso.AssoStructurePatent;
+import cn.cslg.pas.common.model.QueryPatentVO;
+import cn.cslg.pas.domain.Patent;
+import cn.cslg.pas.domain.asso.AssoPatentStructure;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
@@ -14,31 +18,7 @@ import java.util.List;
  * @Date 2023/3/13
  */
 @Repository
-public interface AssoStructurePatentMapper {
-    /**
-     * 插入标引数据
-     *
-     * @param assoStructurePatent 数据对象
-     * @return 返回受影响的行数
-     */
-    int insert(AssoStructurePatent assoStructurePatent);
-
-    /**
-     * 删除标引数据
-     *
-     * @param assoStructurePatent 数据对象
-     * @return 返回受影响的行数
-     */
-    int delete(AssoStructurePatent assoStructurePatent);
-
-    /**
-     * 根据专题库id和专利号查询数据
-     *
-     * @param assoStructurePatentQueryDTO 专题库产品架构专利号标引的查询DTO类
-     * @return  返回查询到的数据
-     */
-    List<AssoStructurePatentVO> selectByProjectIdPatentNo(AssoStructurePatentQueryDTO assoStructurePatentQueryDTO);
-
+public interface AssoStructurePatentMapper extends BaseMapper<AssoPatentStructure> {
     /**
      * 根据架构id批量删除数据
      *
@@ -47,13 +27,5 @@ public interface AssoStructurePatentMapper {
      */
     int deleteByStructureIds(List<Integer> structureIds);
 
-    /**
-     * 根据专题库id删除数据
-     *
-     * @param projectId 专题库id
-     * @return 返回受影响的行数
-     */
-    int deleteByProjectId(Integer projectId);
-
 
 }

+ 2 - 2
PAS/src/main/java/cn/cslg/pas/mapper/AssoStructurePictureMapper.java

@@ -33,10 +33,10 @@ public interface AssoStructurePictureMapper {
     /**
      * 根据架构ids批量删除数据
      *
-     * @param structureIds 架构ids
+     * @param structures 架构ids
      * @return 返回受影响的行数
      */
-    int deleteByStructureIds(List<Integer> structureIds);
+    int deleteByStructureIds(List<Integer> structures);
 
     /**
      * 根据架构id查询数据

+ 2 - 2
PAS/src/main/java/cn/cslg/pas/mapper/PermissionRecordMapper.java

@@ -17,13 +17,13 @@ public interface PermissionRecordMapper {
     /**
      * 插入数据
      *
-     * @param permissionRecord 许可记录数据对象
+     * @param  permissionRecord 许可记录数据对象
      * @return 返回受影响的行数
      */
     int add(PermissionRecord permissionRecord);
 
     /**
-     * 根据id修改数据
+     *  根据id修改数据
      *
      * @param permissionRecord 许可记录数据对象
      * @return 返回受影响的行数

+ 4 - 14
PAS/src/main/java/cn/cslg/pas/mapper/ProductMapper.java

@@ -34,10 +34,9 @@ public interface ProductMapper extends BaseMapper<Product> {
     int deleteById(Integer id);
 
     /**
-     * 根据产品类别id删除数据
      *
-     * @param productCategoryId 产品类别id
-     * @return 返回受影响的行数
+     * @param productCategoryId
+     * @return
      */
     int deleteByProductCategoryId(Integer productCategoryId);
 
@@ -52,11 +51,10 @@ public interface ProductMapper extends BaseMapper<Product> {
     /**
      * 根据产品名称统计数量
      *
-     * @param productName       产品名称
-     * @param productCategoryId 产品类别id
+     * @param productName 产品名称
      * @return 返回统计到的数量
      */
-    int countByProductName(String productName, Integer productCategoryId);
+    int countByProductName(String productName);
 
     /**
      * 根据id统计数量
@@ -75,14 +73,6 @@ public interface ProductMapper extends BaseMapper<Product> {
     int countByProductCategoryId(Integer productCategoryId);
 
     /**
-     * 根据id查询数据
-     *
-     * @param id 产品id
-     * @return 返回查询到的数据
-     */
-    ProductVO getStandardById(Integer id);
-
-    /**
      * 分页查询数据
      *
      * @param productQueryPageDTO 分页信息

+ 8 - 12
PAS/src/main/java/cn/cslg/pas/mapper/StructureMapper.java

@@ -66,21 +66,13 @@ public interface StructureMapper extends BaseMapper<Structure> {
     Structure getStandardById(Integer id);
 
     /**
-     * 根据id查询数据和图片
-     *
-     * @param id 架构id
-     * @return 返回查询到的数据
-     */
-    StructureVO getStandardAndPictureById(Integer id);
-
-    /**
      * 根据父级id和产品id查询数据
      *
      * @param parentId  父级id
      * @param productId 产品id
      * @return 返回查询到的数据
      */
-    List<StructureVO> selectByParentIdAndProductId(Integer parentId, Integer productId, List<Integer> ids);
+    List<StructureVO> selectByParentIdAndProductId(Integer parentId, Integer productId,List<Integer> ids);
 
     /**
      * 根据模糊路径查询数据
@@ -90,6 +82,10 @@ public interface StructureMapper extends BaseMapper<Structure> {
      */
     List<StructureVO> selectByFindInSetPath(String findInSetPath);
 
+    /**/
+    /**/
+    List<StructureVO> selectByName(String name);
+
     /**
      * 根据产品id查询数据
      *
@@ -99,11 +95,11 @@ public interface StructureMapper extends BaseMapper<Structure> {
     List<StructureVO> selectAllByProductId(Integer productId);
 
     /**
-     * 根据架构id查询数据
+     * 根据产品名称模糊查询数据
      *
-     * @param structureId 架构id
+     * @param structureName
      * @return 返回查询到的数据
      */
-    List<StructureVO> selectAllByStructureId(Integer structureId);
+    //List<Structure> getStandardByStructureName(String structureName);
 
 }

+ 28 - 0
PAS/src/main/java/cn/cslg/pas/mapper/asso/AssoProductPatentMapper.java

@@ -0,0 +1,28 @@
+package cn.cslg.pas.mapper.asso;
+
+import cn.cslg.pas.common.model.QueryPatentVO;
+import cn.cslg.pas.common.model.dto.ProductPatentDTO;
+import cn.cslg.pas.domain.AdminUser;
+import cn.cslg.pas.domain.Patent;
+import cn.cslg.pas.domain.asso.AssoProductPatent;
+import cn.cslg.pas.domain.asso.AssoProductPicture;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 管理员表 Mapper 接口
+ * </p>
+ *
+ * @author 王岩
+ * @since 2022-03-25
+ */
+public interface AssoProductPatentMapper extends BaseMapper<AssoProductPatent> {
+    int insertBatch(List<String> patentNos, Integer productId);
+    IPage<Patent> getPageList(Page<Patent> page, @Param("params") QueryPatentVO params);
+    List<String> getPatentNos( @Param("params") ProductPatentDTO params);
+}

+ 1 - 1
PAS/src/main/java/cn/cslg/pas/service/IProductCategoryService.java

@@ -59,7 +59,7 @@ public interface IProductCategoryService {
     @Transactional
     List<ProductCategoryTrendVO> showTrend(ProductCategoryDTO dto);
 
-    List<String>  getAreaList(Integer id);
+    List<String>  getAreaList(Integer id,Integer productId);
 
     List<String> getCompanyList(Integer id);
 }

+ 0 - 31
PAS/src/main/java/cn/cslg/pas/service/IStructurePatentService.java

@@ -1,31 +0,0 @@
-package cn.cslg.pas.service;
-
-import cn.cslg.pas.common.model.dto.AssoStructurePatentQueryDTO;
-import cn.cslg.pas.common.model.dto.AssoStructurePatentUpdateDTO;
-import cn.cslg.pas.common.model.vo.AssoStructurePatentVO;
-
-import java.util.List;
-
-/**
- * 专题库产品架构专利号标引的Service层接口
- *
- * @Author chenyu
- * @Date 2023/3/15
- */
-public interface IStructurePatentService {
-    /**
-     * 更新标引(新增或删除)
-     *
-     * @param assoStructurePatentUpdateDTO 专题库产品架构专利号标引的修改DTO类对象
-     */
-    void update(AssoStructurePatentUpdateDTO assoStructurePatentUpdateDTO);
-
-    /**
-     * 查询标引
-     *
-     * @param assoStructurePatentQueryDTO 专题库产品架构专利号标引的查询DTO类
-     * @return 返回查询到的数据
-     */
-    List<AssoStructurePatentVO> query(AssoStructurePatentQueryDTO assoStructurePatentQueryDTO);
-
-}

+ 1 - 3
PAS/src/main/java/cn/cslg/pas/service/IStructureService.java

@@ -1,6 +1,5 @@
 package cn.cslg.pas.service;
 
-import cn.cslg.pas.common.model.dto.QueryPathStructureNameDTO;
 import cn.cslg.pas.common.model.dto.StructureAddNewDTO;
 import cn.cslg.pas.common.model.dto.StructureQueryPageDTO;
 import cn.cslg.pas.common.model.dto.StructureUpdateDTO;
@@ -49,10 +48,9 @@ public interface IStructureService {
     /**
      * 查询所有架构的路径和路径拼接成的架构名称
      *
-     * @param queryPathStructureNameDTO   数据DTO对象
      * @return 返回查询到的数据
      */
-    List<PathStructureNameVO> queryPathStructureName(QueryPathStructureNameDTO queryPathStructureNameDTO);
+    List<PathStructureNameVO> queryPathStructureName(Integer productId);
 
     /**
      * 删除架构

+ 2 - 0
PAS/src/main/java/cn/cslg/pas/service/ProjectImportService.java

@@ -60,4 +60,6 @@ public class ProjectImportService extends ServiceImpl<ProjectImportMapper, Proje
         projectImport.insert();
         return projectImport.getId();
     }
+
+
 }

+ 15 - 44
PAS/src/main/java/cn/cslg/pas/service/ProjectService.java

@@ -5,14 +5,15 @@ import cn.cslg.pas.common.core.exception.CustomException;
 import cn.cslg.pas.common.model.PersonnelVO;
 import cn.cslg.pas.common.model.dto.ClientDTO;
 import cn.cslg.pas.common.model.dto.UploadFileDTO;
-import cn.cslg.pas.common.model.vo.*;
+import cn.cslg.pas.common.model.vo.ProjectExportVO;
+import cn.cslg.pas.common.model.vo.ProjectImportVO;
+import cn.cslg.pas.common.model.vo.ProjectVO;
+import cn.cslg.pas.common.model.vo.TaskParams;
 import cn.cslg.pas.common.utils.*;
 import cn.cslg.pas.common.utils.SecurityUtils.LoginUtils;
 import cn.cslg.pas.common.utils.SecurityUtils.SecurityUtils;
 import cn.cslg.pas.common.utils.auth.checkAuth;
 import cn.cslg.pas.domain.*;
-import cn.cslg.pas.mapper.AssoStructurePatentMapper;
-import cn.cslg.pas.mapper.ProductMapper;
 import cn.cslg.pas.mapper.ProjectMapper;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.collection.IterUtil;
@@ -35,7 +36,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.scheduling.annotation.Async;
@@ -59,7 +59,6 @@ import java.util.stream.Collectors;
  * @author 王岩
  * @since 2022-01-24
  */
-@Slf4j
 @Service
 @RequiredArgsConstructor(onConstructor_ = {@Lazy})
 public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
@@ -102,14 +101,12 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
     private final UserService userService;
     private final LoginUtils loginUtils;
     private final RequestService requestService;
-    private final AssoStructurePatentMapper assoStructurePatentMapper;
-    private final ProductMapper productMapper;
 
     public Project getProjectByName(String name) {
         LambdaQueryWrapper<Project> queryWrapper = new LambdaQueryWrapper<>();
-        PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+        PersonnelVO personnelVO =cacheUtils.getLoginUser(loginUtils.getId());
         queryWrapper.eq(Project::getName, name);
-        queryWrapper.eq(Project::getTenantId, personnelVO.getTenantId());
+        queryWrapper.eq(Project::getTenantId,personnelVO.getTenantId());
         queryWrapper.last("limit 1");
         return this.getOne(queryWrapper);
     }
@@ -131,7 +128,6 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
                 params.setTenantId(personnelVO.getTenantId());
             }
         }
-        //分页查询专题库列表
         IPage<Project> pageList = baseMapper.getPageList(new Page<>(params.getCurrent(), params.getSize()), params);
 
         List<Project> dataList = pageList.getRecords();
@@ -143,12 +139,6 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
             JSONArray jsonArray1 = JSON.parseArray(jsonObject);
             List<ProjectVO.Department> departmentList = jsonArray1.toJavaList(ProjectVO.Department.class);
             for (Project project : dataList) {
-                Integer productId = project.getProductId();
-                if (productId != null) {
-                    ProductVO queryResult = productMapper.getStandardById(productId);
-                    String productName = queryResult.getProductName();
-                    project.setProductName(productName);
-                }
                 for (ProjectVO.Department department : departmentList) {
                     if (project.getDepartmentId() != null) {
                         if (project.getDepartmentId().equals(department.getId())) {
@@ -200,19 +190,7 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
         }
         LambdaQueryWrapper<Project> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.in(Project::getId, ids);
-        //根据ids查询专题库列表
         List<Project> dataList = this.list(queryWrapper);
-        //↓根据专题库id查询专题库时,查询到的就是一条,就将当前专题库的产品名字赋值(他妈的两个控制层方法调当前业务层,坑爹)
-        if (dataList.size() == 1) {
-            for (Project project : dataList) {
-                Integer productId = project.getProductId();
-                if (productId != null) {
-                    ProductVO queryResult = productMapper.getStandardById(productId);
-                    String productName = queryResult.getProductName();
-                    project.setProductName(productName);
-                }
-            }
-        }
         try {
             //获取所属部门对应信息
             String jsonObject = requestService.getDepartmentFromPCS(dataList);
@@ -282,7 +260,8 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
                 item.setTypeList(StringUtils.changeStringToInteger(item.getType(), ","));
                 item.setTypeName(systemDictList.stream().filter(systemDict -> systemDict.getType().equals(Constants.INVESTIGATION_TYPE) && item.getTypeList().contains(Integer.parseInt(systemDict.getValue()))).map(SystemDict::getLabel).collect(Collectors.toList()));
                 item.setType(null);
-            } else {
+            }
+            else{
                 item.setTypeList(new ArrayList<Integer>());
             }
         });
@@ -431,12 +410,11 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
     @Transactional
     public String add(Project project) throws IOException {
         PersonnelVO user = cacheUtils.getLoginUserPersonnel(loginUtils.getId());
-        //检查专题库名称是否被占用
         Project temp = this.getProjectByName(project.getName());
         if (temp != null) {
             return Response.error("专题库名称已存在");
         }
-        if (project.getClientId() == null || project.getClientId() == -1) {
+        if (project.getClientId()==null||project.getClientId() == -1) {
             ClientDTO clientDTO = new ClientDTO();
             clientDTO.setName(project.getClientName());
             clientDTO.setTenantId(user.getTenantId());
@@ -450,8 +428,6 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
         project.setCreateBy(loginUtils.getId());
         project.setCreateTime(DateUtils.getDateTime());
         project.setTenantId(user.getTenantId());
-        //专题库表新增数据
-        log.info("专题库表新增数据");
         project.insert();
         this.addProjectUser(project.getId());
         return Response.success(project.getId());
@@ -459,13 +435,11 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
 
     @Transactional
     public String edit(Project project) throws IOException {
-        System.out.println(project);
         Project temp = this.getProjectByName(project.getName());
-        //检查尝试修改的新专题库名称是否被占用
         if (temp != null && !temp.getId().equals(project.getId())) {
             return Response.error("专题库名称已存在");
         }
-        if (project.getClientId() == null || project.getClientId() == -1) {
+        if (project.getClientId()==null||project.getClientId() == -1) {
             ClientDTO clientDTO = new ClientDTO();
             clientDTO.setName(project.getClientName());
             clientDTO.setTenantId(project.getTenantId());
@@ -476,16 +450,12 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
         }
         project.setScenario(StringUtils.join(project.getScenarioList(), ","));
         project.setType(StringUtils.join(project.getTypeList(), ","));
-        //专题库表修改数据
-        log.info("专题库表修改数据");
         project.updateById();
         return Response.success();
     }
 
     @Transactional
     public String delete(Integer id) {
-        //专题库表删除数据
-        log.info("专题库表删除数据");
         this.removeById(id);
         this.deleteProjectUser(id, loginUtils.getId());
         projectPatentLinkService.deleteByProjectId(id);
@@ -494,8 +464,6 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
         projectUserService.deleteByProjectId(id);
         projectFileService.deleteByProjectId(id);
         patentApplicantMergeLinkService.deleteByProjectId(id);
-        //陈宇 ↓ 删除专题库id关联产品id关联架构id(asso_structure_patent表)数据
-        assoStructurePatentMapper.deleteByProjectId(id);
         return Response.success();
     }
 
@@ -607,7 +575,7 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
         for (int i = 1; i < rowList.size(); i++) {
             mapList.add(IterUtil.toMap(rowList.get(0), rowList.get(i)));
         }
-        Integer taskId = taskService.add(fileDTO, projectId, rowList.size() - 1, 1, 0, file.getOriginalFilename());
+        Integer taskId = taskService.add(fileDTO, projectId, null,rowList.size() - 1, 1, 0, file.getOriginalFilename());
         TaskParams taskParams = new TaskParams();
         taskParams.setTaskId(taskId);
         taskParams.setPath(path);
@@ -619,7 +587,7 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
     }
 
     //获得
-    public TaskParams getImportPatentTaskParamsBro(MultipartFile file) {
+    public TaskParams getImportPatentTaskParamsBro(MultipartFile file,Integer productId) {
         //上传文档
         UploadFileDTO fileDTO = fileUtils.uploadFile(file);
         //获得文档保存的路径
@@ -631,12 +599,15 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
         for (int i = 1; i < rowList.size(); i++) {
             mapList.add(IterUtil.toMap(rowList.get(0), rowList.get(i)));
         }
+        Integer taskId = taskService.add(fileDTO, null,productId, rowList.size() - 1, 1, 0, file.getOriginalFilename());
         TaskParams taskParams = new TaskParams();
         taskParams.setPath(path);
+        taskParams.setTaskId(taskId);
         taskParams.setTaskType(1);
         taskParams.setRowList(mapList);
         taskParams.setUserId(String.valueOf(loginUtils.getId()));
         taskParams.setOldName(file.getOriginalFilename());
+        taskParams.setProductId(productId);
         return taskParams;
     }
 

+ 14 - 5
PAS/src/main/java/cn/cslg/pas/service/TaskService.java

@@ -42,11 +42,16 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> {
         return fileUtils.getSystemPath() + task.getUrl();
     }
 
-    public Integer add(UploadFileDTO fileDTO, Integer projectId, Integer total, Integer type, Integer fieldNum, String oldName) {
+    public Integer add(UploadFileDTO fileDTO, Integer projectId,Integer productId, Integer total, Integer type, Integer fieldNum, String oldName) {
         Task task = new Task();
         task.setStartTime(DateUtils.getDateTime());
         task.setStatus(0);
-        task.setProjectId(projectId);
+        if(projectId!=null) {
+            task.setProjectId(projectId);
+        }
+        if(productId!=null){
+            task.setProductId(productId);
+        }
         task.setFileName(fileDTO.getFileName());
         task.setUrl(fileDTO.getPath());
         task.setTotal(total);
@@ -81,12 +86,16 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> {
         return pageList;
     }
 
-    public List<Task> getQueueList(Integer type, Integer projectId) {
+    public List<Task> getQueueList(Integer type, Integer projectId,Integer productId) {
         LambdaQueryWrapper<Task> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(Task::getCreateBy, loginUtils.getId());
         queryWrapper.eq(Task::getType, type);
-        queryWrapper.in(Task::getStatus, new ArrayList<Integer>() {{ add(0); add(1); }});
-        queryWrapper.eq(Task::getProjectId, projectId);
+        queryWrapper.in(Task::getStatus, new ArrayList<Integer>() {{ add(0); add(1);}});
+        if(projectId!=null){
+        queryWrapper.eq(Task::getProjectId, projectId);}
+        if(productId!=null){
+            queryWrapper.eq(Task::getProductId,productId);
+        }
         queryWrapper.orderByAsc(Task::getStartTime);
         return this.list(queryWrapper);
     }

+ 78 - 1
PAS/src/main/java/cn/cslg/pas/service/UploadPatentBatchService.java

@@ -10,6 +10,7 @@ import cn.cslg.pas.common.model.vo.UploadSettingVO;
 import cn.cslg.pas.common.utils.*;
 import cn.cslg.pas.domain.*;
 import cn.cslg.pas.mapper.ImportErrorLogMapper;
+import cn.cslg.pas.service.asso.AssoProductPatentService;
 import cn.hutool.extra.spring.SpringUtil;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import lombok.RequiredArgsConstructor;
@@ -48,6 +49,7 @@ public class UploadPatentBatchService {
     private final PatentClassNumberLinkService patentClassNumberLinkService;
     private final PatentAffairService patentAffairService;
     private final ImportErrorLogMapper importErrorLogMapper;
+    private final AssoProductPatentService assoProductPatentService;
     private static int FLAG = 0;
 
     @Async("singleThreadAsyncTaskExecutor")
@@ -323,7 +325,6 @@ public class UploadPatentBatchService {
                 patentApplicationBusiness(uploadParamsVO);
             //申请人地址 OS_PATENT_APPLICATION
             patentApplicationAddressBusiness(uploadParamsVO);
-
             //分类号关联 OS_PATENT_TYPENO
             patentTypeNoBusiness(uploadParamsVO);
             //事务信息 OS_PATENT_AFFAIR
@@ -580,4 +581,80 @@ public class UploadPatentBatchService {
         patentService.updatePatentCustomField(patentCustomFieldParams);
     }
 
+
+
+    @Async("singleThreadAsyncTaskExecutor")
+    public void uploadPatentForProduct(TaskParams params,Integer productId) {
+        Integer total = params.getRowList().size();
+        try {
+            //先解析Json文件 获得配置文件的Json串
+            String getSettingJson = fileUtils.analysisJsonFile();
+            //查找需求数据源的对应配置
+            List<UploadSettingVO.Column> jsonData = UploadPatentBatchUtil.parsingConfigurationFilesBro(getSettingJson);
+
+            Map<String, PictureData> pictureDataMap = ExcelUtils.getDataFromExcel(params.getPath());
+
+            //将数据进行装配并进行数据库操作
+            for (int i = 0; i < params.getRowList().size(); i++) {
+                //获取每一行的数据
+                Map<Object, Object> row = params.getRowList().get(i);
+                //基础数据装配
+                UploadParamsVO uploadParamsVO = UploadPatentBatchUtil.processData(row, jsonData);
+
+                //查询数据是否存在 如果存在 返回该条数据 如果不存在 新增一条数据
+                getOneOrInsertOne(uploadParamsVO);
+
+                //专利信息需要特殊处理部分
+                //专利信息(摘要附图)数据装配
+                PictureData pictureData = pictureDataMap.get(String.valueOf(i + 1));
+                if (uploadParamsVO.getPatent() != null) {
+                    if (uploadParamsVO.getPatent().getId() != null && pictureData != null) {
+                        uploadParamsVO.getPatent().setAbstractPath(patentImageService.updatePatentImage(uploadParamsVO.getPatent().getId(), pictureData));
+                    }
+                }
+                //专利信息(代理机构)数据装配
+                if (uploadParamsVO.getPatent() != null) {
+                    if (uploadParamsVO.getPatent().getAgencyId() != null) {
+                        uploadParamsVO.getPatent().setAgencyId(patentAgencyService.getAgencyStringIdByName(uploadParamsVO.getPatent().getAgencyId()));
+                    }
+
+                }
+                //将装配对象中的数据保存到数据库
+                dataToDBBro(params, uploadParamsVO);
+                //添加关联关系
+                assoProductPatentService.addPatents(Arrays.asList(uploadParamsVO.getPatent().getPatentNo()),productId);
+                //通过WebSocket 在每一次循环结束后 向前端发送完成进度
+                WebSocketServer.sendInfo(Response.websocket(new TaskWebSocketDTO()
+                        .setTaskId(params.getTaskId())
+                        .setComplete(false)
+                        .setIndex(i)
+                        .setTaskType(Constants.TASK_IMPORT_PATENT)
+                        .setPercentage(total == 0 ? 0 : Math.round((total.equals(i) ? (i * 1D) : (i + 1D)) / total * 100D))
+                        .setFileName("")
+                        .setOldName(params.getOldName())
+                        .setUrl("")
+                        .setTotal(total), ResponseEnum.PATENT_IMPORT_TASK_SUCCESS), params.getUserId());
+            }
+
+            SpringUtil.getBean(ProjectService.class).setImportPatentTaskStatus(2, params.getTaskId());
+            WebSocketServer.sendInfo(Response.websocket(new TaskWebSocketDTO()
+                    .setTaskId(params.getTaskId())
+                    .setComplete(true)
+                    .setIndex(total)
+                    .setTaskType(Constants.TASK_IMPORT_PATENT)
+                    .setPercentage(100L)
+                    .setFileName("")
+                    .setOldName(params.getOldName())
+                    .setUrl("")
+                    .setTotal(total), ResponseEnum.PATENT_IMPORT_TASK_SUCCESS), params.getUserId());
+        } catch (Exception e) {
+            e.printStackTrace();
+            SpringUtil.getBean(ProjectService.class).setImportPatentTaskStatus(3, params.getTaskId());
+            if (FLAG > 0) {
+                int successCount = total - FLAG;
+                WebSocketServer.sendInfo(Response.error("部分数据上传成功" + "\n" + "成功条数:" + successCount + "失败条数:" + FLAG), params.getUserId());
+            }
+            FLAG = 0;
+        }
+    }
 }

+ 175 - 0
PAS/src/main/java/cn/cslg/pas/service/asso/AssoProductPatentService.java

@@ -0,0 +1,175 @@
+package cn.cslg.pas.service.asso;
+
+import cn.cslg.pas.common.core.base.Constants;
+import cn.cslg.pas.common.model.QueryPatentVO;
+import cn.cslg.pas.common.model.dto.PatentDTO;
+import cn.cslg.pas.common.model.dto.ProductPatentDTO;
+import cn.cslg.pas.common.utils.*;
+import cn.cslg.pas.domain.*;
+import cn.cslg.pas.domain.asso.AssoPatentStructure;
+import cn.cslg.pas.domain.asso.AssoProductPatent;
+import cn.cslg.pas.mapper.DepartmentMapper;
+import cn.cslg.pas.mapper.PatentMapper;
+import cn.cslg.pas.mapper.asso.AssoProductPatentMapper;
+import cn.cslg.pas.service.*;
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.lang.tree.Tree;
+import cn.hutool.core.lang.tree.TreeNode;
+import cn.hutool.core.lang.tree.TreeNodeConfig;
+import cn.hutool.core.lang.tree.TreeUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.graphbuilder.math.func.Function;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.BeanUtils;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * <p>
+ * 后台部门表 服务类
+ * </p>
+ *
+ * @author 王岩
+ * @since 2022-03-25
+ */
+@Service
+@RequiredArgsConstructor(onConstructor_ = {@Lazy})
+public class AssoProductPatentService extends ServiceImpl<AssoProductPatentMapper, AssoProductPatent> {
+    private final PatentApplicantService patentApplicantService;
+    private final PatentAffairService patentAffairService;
+    private final PatentLabelService patentLabelService;
+    private final ProjectFieldService projectFieldService;
+    private final PatentInventorService patentInventorService;
+    private final PatentAgencyService patentAgencyService;
+    private final PatentAgentService patentAgentService;
+    private final PatentClassNumberLinkService patentClassNumberLinkService;
+    private final SystemDictService systemDictService;
+    private final PatentSimpleFamilyLinkService patentSimpleFamilyLinkService;
+    private final AssoStructurePatentService assoStructurePatentService;
+
+    /**
+     * 给产品添加相关专利
+     */
+    public int addPatents(ProductPatentDTO patentDTO) {
+        patentDTO.setIsIn(0);
+        List<String> patentNos = this.baseMapper.getPatentNos(patentDTO);
+        if (patentNos.size() == 0) {
+            return -1;
+        }
+        return this.baseMapper.insertBatch(patentNos, patentDTO.getProductId());
+    }
+
+
+    public int addPatents(List<String> patentNos, Integer productId) {
+        LambdaQueryWrapper<AssoProductPatent> wrapper = new LambdaQueryWrapper<>();
+        wrapper.select(AssoProductPatent::getPatentNo);
+        wrapper.eq(AssoProductPatent::getProductId, productId);
+        wrapper.in(AssoProductPatent::getPatentNo, patentNos);
+        List<String> patentNo = this.listObjs(wrapper, Object::toString);
+        patentNos.removeAll(patentNo);
+        if (patentNos.size() == 0) {
+            return -1;
+        }
+        return this.baseMapper.insertBatch(patentNos, productId);
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    public List<String> deletePatents(ProductPatentDTO patentDTO) {
+        patentDTO.setIsIn(1);
+        List<String> patentNos= new ArrayList<>();
+        if (patentDTO.getStartNumber() != null && patentDTO.getEndNumber() != null&&patentDTO.getEndNumber() >patentDTO.getStartNumber()) {
+            patentDTO.setEndNumber(patentDTO.getEndNumber() - patentDTO.getStartNumber()+1);
+            patentNos = this.baseMapper.getPatentNos(patentDTO);
+        }
+        if(patentDTO.getPatentNos()!=null&&patentDTO.getPatentNos().size()>0){
+          for(String item:patentDTO.getPatentNos()){
+                if(!patentNos.contains(item)){
+                    patentNos.add(item);
+                }
+            }
+        }
+        if(patentDTO.getNotInPatentNos()!=null) {
+            patentNos.removeAll(patentDTO.getNotInPatentNos());
+        }
+
+
+        List<String> assoPatents = new ArrayList<>();
+        if (patentNos.size() != 0) {
+            LambdaQueryWrapper<AssoPatentStructure> assoWrapper = new LambdaQueryWrapper<>();
+            assoWrapper.select(AssoPatentStructure::getPatentNo);
+            assoWrapper.eq(AssoPatentStructure::getProjectId, patentDTO.getProductId())
+                    .in(AssoPatentStructure::getPatentNo, patentNos);
+            assoPatents = assoStructurePatentService.listObjs(assoWrapper, Object::toString);
+            LambdaQueryWrapper<AssoProductPatent> wrapper = new LambdaQueryWrapper<>();
+            wrapper.eq(AssoProductPatent::getProductId, patentDTO.getProductId());
+            wrapper.in(AssoProductPatent::getPatentNo, patentNos);
+            this.remove(wrapper);
+            return assoPatents;
+        }
+        return assoPatents;
+    }
+
+    public IPage<PatentDTO> getPageList(QueryPatentVO params) {
+        IPage<Patent> dataPage = baseMapper.getPageList(new Page<>(params.getCurrent(), params.getSize()), params);
+        IPage<PatentDTO> pageList = new Page<>();
+        List<PatentDTO> records = new ArrayList<>();
+        List<Integer> patentIds = dataPage.getRecords().stream().map(Patent::getId).collect(Collectors.toList());
+        List<PatentApplicant> patentApplicantList = patentApplicantService.getPatentApplicantByPatentIds(patentIds);
+        List<PatentInventor> patentInventorList = patentInventorService.getPatentInventorByPatentIds(patentIds);
+        List<PatentLabel> patentLabelList = patentLabelService.getPatentLabelByPatentIdsAndProjectId(patentIds, params.getProjectId());
+        List<PatentClassNumberLink> patentClassNumberLinkList = patentClassNumberLinkService.getPatentClassNumberLinkByPatentIds(patentIds);
+        List<PatentAgent> patentAgentList = patentAgentService.getPatentAgentByPatentIds(patentIds);
+        List<PatentAgency> patentAgencyList = patentAgencyService.getPatentAgencyByIds(dataPage.getRecords().stream().filter(item -> StringUtils.isNotEmpty(item.getAgencyId())).map(item -> Integer.parseInt(item.getAgencyId())).distinct().collect(Collectors.toList()));
+        List<PatentSimpleFamilyLink> patentSimpleFamilyLinkList = patentSimpleFamilyLinkService.getPatentSimpleFamilyLinkByFamilyIds(dataPage.getRecords().stream().map(Patent::getSimpleFamily).collect(Collectors.toList()));
+        List<PatentSimpleFamilyLink> patentInpadocFamilyLinkList = patentSimpleFamilyLinkService.getPatentSimpleFamilyLinkByFamilyIds(dataPage.getRecords().stream().map(Patent::getInpadocFamily).collect(Collectors.toList()));
+        List<PatentSimpleFamilyLink> patentPatSnapFamilyLinkList = patentSimpleFamilyLinkService.getPatentSimpleFamilyLinkByFamilyIds(dataPage.getRecords().stream().map(Patent::getPatSnapFamily).collect(Collectors.toList()));
+        List<SystemDict> systemDictList = systemDictService.getSystemDictListByType(Arrays.asList(Constants.PATENT_TYPE, Constants.PATENT_SIMPLE_STATUS));
+        dataPage.getRecords().forEach(item -> {
+            PatentDTO patentDTO = new PatentDTO();
+            BeanUtils.copyProperties(item, patentDTO);
+            patentDTO.setApplicationDate(DateUtils.formatDate(item.getApplicationDate(), DateUtils.YYYY_MM_DD));
+            patentDTO.setPriorityDate(DateUtils.formatDate(item.getPriorityDate(), DateUtils.YYYY_MM_DD));
+            patentDTO.setPublicDate(DateUtils.formatDate(item.getPublicDate(), DateUtils.YYYY_MM_DD));
+            patentDTO.setPublicAccreditDate(DateUtils.formatDate(item.getPublicAccreditDate(), DateUtils.YYYY_MM_DD));
+            patentDTO.setFirstPublicDate(DateUtils.formatDate(item.getFirstPublicDate(), DateUtils.YYYY_MM_DD));
+            patentDTO.setSimpleStatus(systemDictList.stream().filter(systemDict -> systemDict.getType().equals(Constants.PATENT_SIMPLE_STATUS) && systemDict.getValue().equals(String.valueOf(item.getSimpleStatus()))).findFirst().orElse(new SystemDict()).getLabel());
+            patentDTO.setType(systemDictList.stream().filter(systemDict -> systemDict.getType().equals(Constants.PATENT_TYPE) && systemDict.getValue().equals(String.valueOf(item.getType()))).findFirst().orElse(new SystemDict()).getLabel());
+            patentDTO.setApplicant(patentApplicantList.stream().filter(patentApplicant -> patentApplicant.getPatentId().equals(item.getId())).collect(Collectors.toList()));
+            patentDTO.setInventor(patentInventorList.stream().filter(patentInventor -> patentInventor.getPatentId().equals(item.getId())).collect(Collectors.toList()));
+            patentDTO.setLabel(patentLabelList.stream().filter(patentLabel -> patentLabel.getPatentId().equals(item.getId())).collect(Collectors.toList()));
+            patentDTO.setIpcList(patentClassNumberLinkList.stream().filter(patentClassNumber -> patentClassNumber.getPatentId().equals(item.getId()) && patentClassNumber.getType().equals(Constants.PATENT_CLASS_NUMBER_IPC)).map(PatentClassNumberLink::getCode).distinct().collect(Collectors.toList()));
+            patentDTO.setCpcList(patentClassNumberLinkList.stream().filter(patentClassNumber -> patentClassNumber.getPatentId().equals(item.getId()) && patentClassNumber.getType().equals(Constants.PATENT_CLASS_NUMBER_CPC)).map(PatentClassNumberLink::getCode).distinct().collect(Collectors.toList()));
+            patentDTO.setUpcList(patentClassNumberLinkList.stream().filter(patentClassNumber -> patentClassNumber.getPatentId().equals(item.getId()) && patentClassNumber.getType().equals(Constants.PATENT_CLASS_NUMBER_UPC)).map(PatentClassNumberLink::getCode).distinct().collect(Collectors.toList()));
+            patentDTO.setLocList(patentClassNumberLinkList.stream().filter(patentClassNumber -> patentClassNumber.getPatentId().equals(item.getId()) && patentClassNumber.getType().equals(Constants.PATENT_CLASS_NUMBER_LOC)).map(PatentClassNumberLink::getCode).distinct().collect(Collectors.toList()));
+            patentDTO.setAffair(patentAffairService.getPatentAffairByPatentId(item.getId()));
+            if (StringUtils.isNotEmpty(item.getAgencyId())) {
+                patentDTO.setAgency(patentAgencyList.stream().filter(patentAgency -> patentAgency.getId().equals(Integer.parseInt(item.getAgencyId()))).findFirst().orElse(null));
+            }
+            PatentDTO.PatentFamily patentFamily = new PatentDTO.PatentFamily();
+            patentFamily.setSimple(patentSimpleFamilyLinkList.stream().filter(patentSimpleFamilyLink -> patentSimpleFamilyLink.getFamilyId().equals(item.getSimpleFamily())).map(PatentSimpleFamilyLink::getPatentNo).collect(Collectors.toList()));
+            patentFamily.setInpadoc(patentInpadocFamilyLinkList.stream().filter(patentSimpleFamilyLink -> patentSimpleFamilyLink.getFamilyId().equals(item.getInpadocFamily())).map(PatentSimpleFamilyLink::getPatentNo).collect(Collectors.toList()));
+            patentFamily.setPatSnap(patentPatSnapFamilyLinkList.stream().filter(patentSimpleFamilyLink -> patentSimpleFamilyLink.getFamilyId().equals(item.getPatSnapFamily())).map(PatentSimpleFamilyLink::getPatentNo).collect(Collectors.toList()));
+            patentDTO.setFamily(patentFamily);
+            patentDTO.setAgent(patentAgentList.stream().filter(patentAgent -> patentAgent.getPatentId().equals(item.getId())).collect(Collectors.toList()));
+            // TODO 性能优化
+            patentDTO.setField(projectFieldService.getPatentFieldByPatentIdAndProjectId(params.getProjectId(), item.getId()));
+            records.add(patentDTO);
+        });
+        pageList.setTotal(dataPage.getTotal());
+        pageList.setRecords(records);
+        pageList.setPages(dataPage.getPages());
+        pageList.setSize(dataPage.getSize());
+        pageList.setCurrent(dataPage.getCurrent());
+        Map<String, Object> map = new HashMap<>();
+        return pageList;
+    }
+
+
+}

+ 41 - 0
PAS/src/main/java/cn/cslg/pas/service/asso/AssoStructurePatentService.java

@@ -0,0 +1,41 @@
+package cn.cslg.pas.service.asso;
+
+import cn.cslg.pas.common.core.base.Constants;
+import cn.cslg.pas.common.model.QueryPatentVO;
+import cn.cslg.pas.common.model.dto.PatentDTO;
+import cn.cslg.pas.common.model.dto.ProductPatentDTO;
+import cn.cslg.pas.common.utils.DateUtils;
+import cn.cslg.pas.common.utils.StringUtils;
+import cn.cslg.pas.domain.*;
+import cn.cslg.pas.domain.asso.AssoPatentStructure;
+import cn.cslg.pas.domain.asso.AssoProductPatent;
+import cn.cslg.pas.mapper.AssoStructurePatentMapper;
+import cn.cslg.pas.mapper.asso.AssoProductPatentMapper;
+import cn.cslg.pas.service.*;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.BeanUtils;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * <p>
+ * 后台部门表 服务类
+ * </p>
+ *
+ * @author 王岩
+ * @since 2022-03-25
+ */
+@Service
+@RequiredArgsConstructor(onConstructor_ = {@Lazy})
+public class AssoStructurePatentService extends ServiceImpl<AssoStructurePatentMapper, AssoPatentStructure> {
+
+
+}

+ 62 - 16
PAS/src/main/java/cn/cslg/pas/service/impl/ProductCategoryServiceImpl.java

@@ -12,15 +12,19 @@ import cn.cslg.pas.common.utils.SecurityUtils.LoginUtils;
 import cn.cslg.pas.domain.Product;
 import cn.cslg.pas.domain.ProductCategory;
 import cn.cslg.pas.domain.ProductMarketData;
+import cn.cslg.pas.domain.Project;
 import cn.cslg.pas.domain.asso.AssoProductCategoryPicture;
 import cn.cslg.pas.exception.XiaoShiException;
 import cn.cslg.pas.mapper.AssoProductCategoryPictureMapper;
 import cn.cslg.pas.mapper.ProductCategoryMapper;
 import cn.cslg.pas.mapper.ProductMapper;
+import cn.cslg.pas.mapper.ProjectMapper;
 import cn.cslg.pas.service.IProductCategoryService;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import io.swagger.v3.oas.models.security.SecurityScheme;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
@@ -49,7 +53,7 @@ public class ProductCategoryServiceImpl implements IProductCategoryService {
     private final LoginUtils loginUtils;
     private final FileUtils fileUtils;
     private final ProductServiceImpl productService;
-    private final ProductMarketDataServiceImpl productMarketDataIService;
+    private final ProductMarketDataIServicempl productMarketDataIService;
 
     /**
      * 新增产品类别
@@ -256,9 +260,16 @@ public class ProductCategoryServiceImpl implements IProductCategoryService {
         List<ProductCategoryTrendVO> trendVOS = new ArrayList<>();
         //存储所有产品的营销数据
         List<ProductMarketData> marketData = new ArrayList<>();
+        //存储所有
+        ProductCategoryTrendVO trendAllVO = new ProductCategoryTrendVO();
+        trendAllVO.setProductId(0);
+        trendAllVO.setProductName("总产品");
+        Map<String, Object> allMarketDataMap = new HashMap<>();
         //根据产品类别ID获得产品id和产品名称
         LambdaQueryWrapper<Product> productWrapper = new LambdaQueryWrapper<>();
         productWrapper.eq(Product::getProductCategoryId, dto.getCategoryId());
+        if(dto.getCompanyName()!=null&&dto.getCompanyName()!=""){
+        productWrapper.eq(Product::getCompanyName,dto.getCompanyName());}
         List<Product> products = productService.list(productWrapper);
         if (products.size() != 0) {
             List<Integer> productIds = products.stream().map(Product::getId).collect(Collectors.toList());
@@ -286,58 +297,94 @@ public class ProductCategoryServiceImpl implements IProductCategoryService {
             temMarketData.forEach(item -> {
                         //获得营销数据的时间
                         String date = item.getSaleTime();
-                        double saleCount = item.getSaleCount() * item.getSaleMoney();
+                        double saleCount = item.getSaleMoney();
                         if (dto.getTimeUnit() == 1) {
                             try {
                                 Date dateForm = new SimpleDateFormat("yyyy-MM").parse(date);
-                                int month = dateForm.getMonth();
-                                int year = dateForm.getYear();
-                                int season = (month - 1) / 3;
+                                Calendar ca = Calendar.getInstance();
+                                ca.setTime(dateForm);
+                                int month = ca.get(Calendar.MONTH);//第几个月
+                                int year = ca.get(Calendar.YEAR);//年份数值
+                                int season = (month - 1) / 3+1;
                                 date = year + "-" + season;
                             } catch (ParseException e) {
                                 e.printStackTrace();
                             }
                         }
+                        else if(dto.getTimeUnit() == 2){
+                            try {
+                                Date dateForm = new SimpleDateFormat("yyyy-MM").parse(date);
+                                Calendar ca = Calendar.getInstance();
+                                ca.setTime(dateForm);
+                                int year = ca.get(Calendar.YEAR);//年份数值
+                                date = year+"";
+                            } catch (ParseException e) {
+                                e.printStackTrace();
+                            }
+                        }
                         //计算销售额
                         if (marketDataMap.get(date) != null) {
                             saleCount += Double.parseDouble(marketDataMap.get(date).toString());
                         }
                         marketDataMap.put(date, saleCount);
+
+                        //产品总体部分
+                if (allMarketDataMap.get(date) != null) {
+                    saleCount += Double.parseDouble(allMarketDataMap.get(date).toString());
+                }
+                allMarketDataMap.put(date, saleCount);
                     }
             );
             Set keyset = marketDataMap.keySet();
             List<ProductCategoryTrendVO.saleVO> saleVOS = new ArrayList<>();
             for (Object key : keyset) {
                 ProductCategoryTrendVO.saleVO saleVO = new ProductCategoryTrendVO.saleVO();
-                saleVO.setMarketData(key.toString());
+                saleVO.setMarketDate(key.toString());
                 saleVO.setSaleTotalMoney(Double.parseDouble(marketDataMap.get(key).toString()));
                 saleVOS.add(saleVO);
             }
             trendVO.setSaleVOS(saleVOS);
             trendVOS.add(trendVO);
         }
-
+        Set keyset = allMarketDataMap.keySet();
+        List<ProductCategoryTrendVO.saleVO> saleVOS = new ArrayList<>();
+        for (Object key : keyset) {
+            ProductCategoryTrendVO.saleVO saleVO = new ProductCategoryTrendVO.saleVO();
+            saleVO.setMarketDate(key.toString());
+            saleVO.setSaleTotalMoney(Double.parseDouble(allMarketDataMap.get(key).toString()));
+            saleVOS.add(saleVO);
+        }
+        trendAllVO.setSaleVOS(saleVOS);
+        trendVOS.add(trendAllVO);
         return trendVOS;
     }
 
     @Override
-    public List<String> getAreaList(Integer id) {
+    public List<String> getAreaList(Integer id,Integer productId) {
         //存储所有产品的营销数据
         List<ProductMarketData> marketData = new ArrayList<>();
         List<String> areaList = new ArrayList<>();
-        //根据架构id获得产品
-        LambdaQueryWrapper<Product> productWrapper = new LambdaQueryWrapper<>();
-        productWrapper.eq(Product::getProductCategoryId, id);
-        List<Product> products = productService.list(productWrapper);
-        if (products.size() != 0) {
-            List<Integer> productIds = products.stream().map(Product::getId).collect(Collectors.toList());
+        List<Integer> productIds = new ArrayList<>();
+        if(productId==null) {
+            //根据架构id获得产品
+            LambdaQueryWrapper<Product> productWrapper = new LambdaQueryWrapper<>();
+            productWrapper.eq(Product::getProductCategoryId, id);
+            List<Product> products = productService.list(productWrapper);
+
+            if (products.size() != 0) {
+                productIds = products.stream().map(Product::getId).collect(Collectors.toList());
+            }
+        }
+        else {
+            productIds=Arrays.asList(productId);
+        }
             if (productIds.size() > 0) {
                 //根据产品Id获得产品营销数据
                 LambdaQueryWrapper<ProductMarketData> market = new LambdaQueryWrapper<>();
                 market.in(ProductMarketData::getProductId, productIds);
                 marketData = productMarketDataIService.list(market);
             }
-        }
+
         marketData.forEach(
                 item -> {
                     if (!areaList.contains(item.getSaleArea())) {
@@ -350,7 +397,6 @@ public class ProductCategoryServiceImpl implements IProductCategoryService {
 
 
     public List<String> getCompanyList(Integer id) {
-
         List<String> areaList = new ArrayList<>();
         //根据架构id获得产品
         LambdaQueryWrapper<Product> productWrapper = new LambdaQueryWrapper<>();

+ 1 - 1
PAS/src/main/java/cn/cslg/pas/service/impl/ProductMarketDataServiceImpl.java

@@ -35,7 +35,7 @@ import java.util.regex.Pattern;
 @RequiredArgsConstructor
 @Slf4j
 @Service
-public class ProductMarketDataServiceImpl extends ServiceImpl<ProductMarketDataMapper, ProductMarketData> implements IProductMarketDataService {
+public class ProductMarketDataIServicempl extends ServiceImpl<ProductMarketDataMapper, ProductMarketData> implements IProductMarketDataService {
     private final ProductMarketDataMapper productMarketDataMapper;
     private final CacheUtils cacheUtils;
     private final LoginUtils loginUtils;

+ 3 - 27
PAS/src/main/java/cn/cslg/pas/service/impl/ProductServiceImpl.java

@@ -3,10 +3,8 @@ package cn.cslg.pas.service.impl;
 import cn.cslg.pas.common.JsonPage;
 import cn.cslg.pas.common.model.PersonnelVO;
 import cn.cslg.pas.common.model.dto.*;
-import cn.cslg.pas.common.model.vo.ProductPatentVO;
 import cn.cslg.pas.common.model.vo.ProductPictureVO;
 import cn.cslg.pas.common.model.vo.ProductVO;
-import cn.cslg.pas.common.model.vo.StructurePatentVO;
 import cn.cslg.pas.common.utils.CacheUtils;
 import cn.cslg.pas.common.utils.FileUtils;
 import cn.cslg.pas.common.utils.SecurityUtils.LoginUtils;
@@ -28,7 +26,6 @@ import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.util.ArrayList;
-import java.util.HashSet;
 import java.util.List;
 
 /**
@@ -40,7 +37,7 @@ import java.util.List;
 @RequiredArgsConstructor
 @Slf4j
 @Service
-public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> implements IProductService {
+public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product>  implements IProductService  {
     private final ProductMapper productMapper;
     private final AssoProductPictureMapper assoProductPictureMapper;
     private final CacheUtils cacheUtils;
@@ -59,9 +56,8 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
 
         //检查产品名称是否被占用
         String productName = productAddNewDTO.getProductName();
-        Integer productCategoryId = productAddNewDTO.getProductCategoryId();
         log.info("检查产品名称是否被占用");
-        int count = productMapper.countByProductName(productName, productCategoryId);
+        int count = productMapper.countByProductName(productName);
         if (count > 0) {
             String message = "新增产品失败,产品名称【" + productName + "】已存在,请尝试更换名称";
             log.info("{}", message);
@@ -69,7 +65,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
         }
 
         Double licenseRate = productAddNewDTO.getLicenseRate();
-        if (licenseRate != null && (licenseRate < 0 || licenseRate > 1)) {
+        if (licenseRate < 0 || licenseRate > 1) {
             String message = "新增产品失败,许可费率不合法,请填写正确数值";
             log.info("{}", message);
             throw new XiaoShiException(message);
@@ -92,9 +88,6 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
             throw new XiaoShiException(message);
         }
 
-        String patentNo = productAddNewDTO.getPatentNo();
-
-
         //如果有图片,图片文件上传至服务器,后获取图片文件的名称、后缀名、url地址,赋值给产品类别图片关联表实体类
         if (files != null && files.size() != 0) {
             ArrayList<AssoProductPicture> assoProductPictures = new ArrayList<>();
@@ -209,23 +202,6 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
             PageHelper.startPage(current, size);
         }
         List<ProductVO> productVOs = productMapper.query(productQueryPageDTO);
-        //遍历产品数据,计算出每一个产品的相关专利数量,赋值给patentNum
-        for (ProductVO productVO : productVOs) {
-            List<ProductPatentVO> productPatents = productVO.getProductPatents();
-            List<StructurePatentVO> structurePatents = productVO.getStructurePatents();
-            //ArrayList<String> patentNos = new ArrayList<>();
-            HashSet<String> patentNos = new HashSet<>();
-            for (ProductPatentVO productPatent : productPatents) {
-                String patentNo = productPatent.getPatentNo();
-                patentNos.add(patentNo);
-            }
-            for (StructurePatentVO structurePatent : structurePatents) {
-                String patentNo = structurePatent.getPatentNo();
-                patentNos.add(patentNo);
-            }
-            //相关专利数量赋值给patentNum
-            productVO.setPatentNum(patentNos.size());
-        }
         return JsonPage.restPage(new PageInfo<>(productVOs));
     }
 

+ 0 - 80
PAS/src/main/java/cn/cslg/pas/service/impl/StructurePatentServiceImpl.java

@@ -1,80 +0,0 @@
-package cn.cslg.pas.service.impl;
-
-import cn.cslg.pas.common.model.dto.AssoStructurePatentQueryDTO;
-import cn.cslg.pas.common.model.dto.AssoStructurePatentUpdateDTO;
-import cn.cslg.pas.common.model.vo.AssoStructurePatentVO;
-import cn.cslg.pas.domain.asso.AssoStructurePatent;
-import cn.cslg.pas.exception.XiaoShiException;
-import cn.cslg.pas.mapper.AssoStructurePatentMapper;
-import cn.cslg.pas.service.IStructurePatentService;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.BeanUtils;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-/**
- * 专题库产品架构专利号标引的Service层接口实现类
- *
- * @Author chenyu
- * @Date 2023/3/15
- */
-@RequiredArgsConstructor
-@Slf4j
-@Service
-public class StructurePatentServiceImpl implements IStructurePatentService {
-    private final AssoStructurePatentMapper assoStructurePatentMapper;
-
-    /**
-     * 更新标引(新增或删除)
-     *
-     * @param assoStructurePatentUpdateDTO 专题库产品架构专利号标引的修改DTO类对象
-     */
-    @Override
-    public void update(AssoStructurePatentUpdateDTO assoStructurePatentUpdateDTO) {
-        log.info("开始处理【更新标引】的业务,参数为:{}", assoStructurePatentUpdateDTO);
-
-        //获取DTO中的updateType类型,true则为新增标引,false则为删除标引
-        Boolean updateType = assoStructurePatentUpdateDTO.getUpdateType();
-        //DTO对象赋值给实体类
-        AssoStructurePatent assoStructurePatent = new AssoStructurePatent();
-        BeanUtils.copyProperties(assoStructurePatentUpdateDTO, assoStructurePatent);
-        //true则新增标引,false则删除标引
-        if (updateType) {
-            log.info("架构专利关联表新增数据");
-            int rows = assoStructurePatentMapper.insert(assoStructurePatent);
-            if (rows != 1) {
-                String message = "新增标引失败,服务器忙请稍后再次尝试";
-                log.info("{}", message);
-                throw new XiaoShiException(message);
-            }
-        } else {
-            log.info("架构专利关联表删除数据");
-            int rows = assoStructurePatentMapper.delete(assoStructurePatent);
-            if (rows != 1) {
-                String message = "删除标引失败,服务器忙请稍后再次尝试";
-                log.info("{}", message);
-                throw new XiaoShiException(message);
-            }
-        }
-
-        log.info("更新标引完成");
-
-    }
-
-    /**
-     * 查询标引
-     *
-     * @param assoStructurePatentQueryDTO 专题库产品架构专利号标引的查询DTO类
-     * @return 返回查询到的数据
-     */
-    @Override
-    public List<AssoStructurePatentVO> query(AssoStructurePatentQueryDTO assoStructurePatentQueryDTO) {
-        log.info("开始处理【查询标引】的业务,参数为:{}", assoStructurePatentQueryDTO);
-        List<AssoStructurePatentVO> queryResult = assoStructurePatentMapper.selectByProjectIdPatentNo(assoStructurePatentQueryDTO);
-        return queryResult;
-    }
-
-
-}

+ 57 - 100
PAS/src/main/java/cn/cslg/pas/service/impl/StructureServiceImpl.java

@@ -1,17 +1,13 @@
 package cn.cslg.pas.service.impl;
 
-import cn.cslg.pas.common.model.PersonnelVO;
 import cn.cslg.pas.common.model.dto.*;
 import cn.cslg.pas.common.model.vo.PathStructureNameVO;
 import cn.cslg.pas.common.model.vo.StructurePictureVO;
 import cn.cslg.pas.common.model.vo.StructureVO;
-import cn.cslg.pas.common.utils.CacheUtils;
 import cn.cslg.pas.common.utils.FileUtils;
-import cn.cslg.pas.common.utils.SecurityUtils.LoginUtils;
 import cn.cslg.pas.domain.Structure;
 import cn.cslg.pas.domain.asso.AssoStructurePicture;
 import cn.cslg.pas.exception.XiaoShiException;
-import cn.cslg.pas.mapper.AssoStructurePatentMapper;
 import cn.cslg.pas.mapper.AssoStructurePictureMapper;
 import cn.cslg.pas.mapper.StructureMapper;
 import cn.cslg.pas.service.IStructureService;
@@ -41,9 +37,6 @@ import java.util.stream.Collectors;
 public class StructureServiceImpl extends ServiceImpl<StructureMapper, Structure> implements IStructureService {
     private final StructureMapper structureMapper;
     private final AssoStructurePictureMapper assoStructurePictureMapper;
-    private final AssoStructurePatentMapper assoStructurePatentMapper;
-    private final CacheUtils cacheUtils;
-    private final LoginUtils loginUtils;
     private final FileUtils fileUtils;
 
     /**
@@ -56,6 +49,11 @@ public class StructureServiceImpl extends ServiceImpl<StructureMapper, Structure
     public void addNew(StructureAddNewDTO structureAddNewDTO, List<MultipartFile> files) {
         log.info("开始处理【新增架构】的业务,参数为:{}, {}", structureAddNewDTO, files);
 
+        //取出DTO中父级id,若父级id为null则表示该架构为第1级架构,手动给其父级id设为0
+        if (structureAddNewDTO.getParentId() == null) {
+            structureAddNewDTO.setParentId(0);
+        }
+
         Integer parentId = structureAddNewDTO.getParentId();
         String structureName = structureAddNewDTO.getStructureName();
         //检查名称是否被占用(检查当前架构父级下是否有同名架构)
@@ -70,12 +68,6 @@ public class StructureServiceImpl extends ServiceImpl<StructureMapper, Structure
         //DTO对象赋值给实体类
         Structure structure = new Structure();
         BeanUtils.copyProperties(structureAddNewDTO, structure);
-
-        PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
-        structure
-                .setCreatePersonId(personnelVO.getId())
-                .setCreatePersonName(personnelVO.getName());
-
         //数据入架构表(此时数据暂不含路径path)
         log.info("数据入架构表");
         int rows = structureMapper.insert(structure);
@@ -147,16 +139,10 @@ public class StructureServiceImpl extends ServiceImpl<StructureMapper, Structure
             throw new XiaoShiException(message);
         }
 
-        //获取该架构原父级id和原路径
         Integer oldParentId = queryResult.getParentId();
         String oldPath = queryResult.getPath();
-        //获取DTO中该架构当前父级id和父路径
         Integer newParentId = structureUpdateDTO.getParentId();
-        String parentPath = structureUpdateDTO.getParentPath();
-        String newPath = parentPath + "," + structureId;
-        //获取DTO中该架构当前名称
         String newStructureName = structureUpdateDTO.getStructureName();
-
         //检查名称是否被占用(检查当前尝试修改的架构父级下是否有同名架构)
         log.info("检查名称是否被占用(检查当前尝试修改的架构父级下是否有同名架构)");
         int count = structureMapper.countByparentIdAndStructureName(newParentId, newStructureName, structureId);
@@ -169,29 +155,42 @@ public class StructureServiceImpl extends ServiceImpl<StructureMapper, Structure
         //DTO对象赋值给实体类
         Structure structure = new Structure();
         BeanUtils.copyProperties(structureUpdateDTO, structure);
+        String parentPath = structureUpdateDTO.getParentPath();
+        if (parentPath == null) {
+            parentPath = "0";
+        }
 
+        //该架构新的path路径
+        String newPath = parentPath + "," + structureId;
         //如果新路径和原路径不一样,则表示架构更换了父级
         if (!oldParentId.equals(newParentId)) {
             structure.setParentId(newParentId);
             structure.setPath(newPath);
-            //还要将当前架构下所有子级架构的路径也都更新
+        }
+
+        //架构表修改数据
+        log.info("架构表修改数据");
+        int rows = structureMapper.update(structure);
+        if (rows != 1) {
+            String message = "修改架构失败,服务器忙请稍后再次尝试!";
+            log.info("{}", message);
+            throw new XiaoShiException(message);
+        }
+
+        //如果当前修改的架构更换了父级,则要将当前架构下所有子级架构的路径也都更新
+        if (!oldParentId.equals(newParentId)) {
             //根据当前架构原来的路径查询所有子级架构
-            log.info("根据当前架构原来的路径查询所有子级架构");
-            List<StructureVO> structures = structureMapper.selectByFindInSetPath(structureId + "");
+            List<StructureVO> structures = structureMapper.selectByFindInSetPath(oldPath);
             for (StructureVO n : structures) {
-                //如果是当前修改的架构则跳过当前遍历
-                if (n.getId().equals(structureId)) {
-                    continue;
-                }
                 String path = n.getPath();
-                //从它的父级架构路径(即当前修改的架构)的原来的路径的长度的位置处截取后面路径
+                //从当前架构(即它们的父级架构)的原来的路径的长度的位置处截取后面路径
                 String behindString = path.substring(oldPath.length());
                 path = newPath + behindString;
                 n.setPath(path);
                 Structure structure2 = new Structure();
                 BeanUtils.copyProperties(n, structure2);
                 log.info("修改当前已更换父级的架构的子级架构路径path");
-                int rows = structureMapper.update(structure2);
+                rows = structureMapper.update(structure2);
                 if (rows != 1) {
                     String message = "修改架构失败,修改当前已更换父级的架构的子级架构路径path失败,服务器忙请稍后再次尝试!";
                     log.info("{}", message);
@@ -200,15 +199,6 @@ public class StructureServiceImpl extends ServiceImpl<StructureMapper, Structure
             }
         }
 
-        //架构表修改数据
-        log.info("架构表修改数据");
-        int rows = structureMapper.update(structure);
-        if (rows != 1) {
-            String message = "修改架构失败,服务器忙请稍后再次尝试!";
-            log.info("{}", message);
-            throw new XiaoShiException(message);
-        }
-
         //架构图片关联表删除数据(若有原有图片被删除)
         //根据架构id查询出所有原有图片
         log.info("根据架构id查询出所有原有图片");
@@ -227,6 +217,7 @@ public class StructureServiceImpl extends ServiceImpl<StructureMapper, Structure
         }
         //图片id集合去重,保留下来的即被删除的图片id
         oldPictureIds.removeAll(newOldPictureIds);
+
         if (oldPictureIds.size() > 0) {
             log.info("架构图片关联表删除数据");
             rows = assoStructurePictureMapper.deleteByIds(oldPictureIds);
@@ -271,26 +262,17 @@ public class StructureServiceImpl extends ServiceImpl<StructureMapper, Structure
     @Override
     public StructureVO query(StructureQueryPageDTO structureQueryPageDTO) {
         log.info("开始处理【查询架构树】的业务,参数为:{}", structureQueryPageDTO);
+        StructureVO structureVO = new StructureVO();
         //从DTO中取出产品id、架构id
         Integer productId = structureQueryPageDTO.getProductId();
         Integer structureId = structureQueryPageDTO.getStructureId();
-        String structureName = structureQueryPageDTO.getStructureName();
-
-        //查询出当前架构信息
-        StructureVO structureVO = null;
-        if (structureId == 0) {
-            structureVO = new StructureVO();
-        } else {
-            structureVO = structureMapper.getStandardAndPictureById(structureId);
+        if (structureId == null) {
+            structureId = 0;
         }
-
-        //以下代码表示查询所有架构的路径和路径拼接成的架构名称并封装成map集合,从map集合中取值为后面给每一个架构的pathName中文路径赋值
-        HashMap<String, String> map = getStructureIdAndStructureNameMap(productId);
-
-        //以下代码表示若架构名称structureName有值则要根据架构名称模糊查询树,若架构名称structureName为null则表示查询了所有架构(不受影响)
+        String structureName = structureQueryPageDTO.getStructureName();
         LambdaQueryWrapper<Structure> wrapper = new LambdaQueryWrapper<>();
         if (structureName != null) {
-            wrapper.like(Structure::getStructureName, structureName);
+            wrapper.like(Structure::getStructureName, structureQueryPageDTO.getStructureName());
         }
         List<Structure> structures = this.list(wrapper);
         List<Integer> ids = structures.stream().map(Structure::getId).collect(Collectors.toList());
@@ -309,9 +291,8 @@ public class StructureServiceImpl extends ServiceImpl<StructureMapper, Structure
                     );
                 }
         );
-        //若ids.size == 0,则表示根据名称模糊查询不到数据,则直接返回空structureVO
         if (ids.size() != 0) {
-            diGui(structureVO, map, structureId, productId, ids);
+            diGui(structureVO, structureId, productId, ids);
         }
         return structureVO;
     }
@@ -319,28 +300,26 @@ public class StructureServiceImpl extends ServiceImpl<StructureMapper, Structure
     /**
      * 查询所有架构的路径和路径拼接成的架构名称
      *
-     * @param queryPathStructureNameDTO   数据DTO对象
      * @return 返回查询到的数据
      */
     @Override
-    public List<PathStructureNameVO> queryPathStructureName(QueryPathStructureNameDTO queryPathStructureNameDTO) {
-        log.info("开始处理【查询所有架构路径和路径架构名称】的业务,参数为:{}", queryPathStructureNameDTO);
-        Integer productId = queryPathStructureNameDTO.getProductId();
-        Integer structureId = queryPathStructureNameDTO.getStructureId();
+    public List<PathStructureNameVO> queryPathStructureName(Integer productId) {
+        log.info("开始处理【查询所有架构路径和路径架构名称】的业务,参数为:{}", productId);
 
         ArrayList<PathStructureNameVO> pathStructureNames = new ArrayList<>();
 
         log.info("根据产品id查询所有架构数据");
-        HashMap<String, String> map = getStructureIdAndStructureNameMap(productId);
-        List<StructureVO> structures;
-        //若有架构id则只查该架构底下的树,若没有架构id则查整棵产品的架构树
-        if (structureId == null) {
-            structures = structureMapper.selectAllByProductId(productId);
-        } else {
-            structures = structureMapper.selectAllByStructureId(structureId);
+        List<StructureVO> structures = structureMapper.selectAllByProductId(productId);
+        //map存储所有架构id(key)和架构名称(value)
+        HashMap<String, String> map = new HashMap<>();
+        for (StructureVO structure : structures) {
+            Integer structureId = structure.getId();
+            String structureStrId = structureId + "";
+            String structureName = structure.getStructureName();
+            map.put(structureStrId, structureName);
         }
+
         for (StructureVO structure : structures) {
-            Integer id = structure.getId();
             String path = structure.getPath();
             //path = path.substring(path.indexOf(",") + 1);
             String[] pathSplit = path.split(",");
@@ -352,7 +331,6 @@ public class StructureServiceImpl extends ServiceImpl<StructureMapper, Structure
                 builder.append(structureName).append("/");
             }
             PathStructureNameVO pathStructureNameVO = new PathStructureNameVO()
-                    .setId(id)
                     .setPath(path)
                     .setPathStructureName(builder + "");
             pathStructureNames.add(pathStructureNameVO);
@@ -379,17 +357,19 @@ public class StructureServiceImpl extends ServiceImpl<StructureMapper, Structure
         }
 
         ArrayList<Integer> structureIds = new ArrayList<>();
-        //根据架构id查询其包括其所有子级架构
-        log.info("根据架构id查询其包括其所有子级架构");
-        List<StructureVO> structures = structureMapper.selectByFindInSetPath(id + "");
+        structureIds.add(id);
+        //根据架构路径查询其所有子级架构
+        String path = queryResult.getPath();
+        log.info("根据架构路径查询其所有子级架构");
+        List<StructureVO> structures = structureMapper.selectByFindInSetPath(path);
         for (StructureVO structure : structures) {
-            Integer structureId = structure.getId();
-            structureIds.add(structureId);
+            Integer childStructureId = structure.getId();
+            structureIds.add(childStructureId);
         }
 
         //架构和专利关联表删除数据
         log.info("架构和专利关联表删除数据");
-        assoStructurePatentMapper.deleteByStructureIds(structureIds);
+        assoStructurePictureMapper.deleteByIds(structureIds);
 
         //架构和图片关联表删除数据
         log.info("架构和图片关联表删除数据");
@@ -397,46 +377,23 @@ public class StructureServiceImpl extends ServiceImpl<StructureMapper, Structure
 
         //架构表删除数据
         log.info("架构表删除数据");
-        structureMapper.deleteByIds(structureIds);
+        int rows = structureMapper.deleteByIds(structureIds);
 
         log.info("删除架构完成");
 
     }
 
     //递归组装架构树集合
-    private void diGui(StructureVO structureVO, HashMap<String, String> map, Integer structureId, Integer productId, List<Integer> ids) {
+    //递归组装架构树集合
+    private void diGui(StructureVO structureVO, Integer structureId, Integer productId, List<Integer> ids) {
         List<StructureVO> structureVOs = structureMapper.selectByParentIdAndProductId(structureId, productId, ids);
         if (structureVOs != null) {
             structureVO.setChildren(structureVOs);
-            //给架构的路径名称pathName进行拼接赋值
-            String path = structureVO.getPath();
-            if (path != null && !path.equals("")) {
-                String[] pathSplit = path.split(",");
-                StringBuilder builder = new StringBuilder();
-                for (int i = 1; i < pathSplit.length; i++) {
-                    String structureName = map.get(pathSplit[i]);
-                    builder.append(structureName).append("/");
-                }
-                structureVO.setPathName(builder + "");
-            }
             for (StructureVO n : structureVOs) {
                 structureId = n.getId();
-                diGui(n, map, structureId, productId, ids);
+                diGui(n, structureId, productId, ids);
             }
         }
     }
 
-    private HashMap<String, String> getStructureIdAndStructureNameMap(Integer productId) {
-        List<StructureVO> structures = structureMapper.selectAllByProductId(productId);
-        //map存储所有架构id(key)和架构名称(value)
-        HashMap<String, String> map = new HashMap<>();
-        for (StructureVO structure : structures) {
-            Integer structureId = structure.getId();
-            String structureStrId = structureId + "";
-            String structureName = structure.getStructureName();
-            map.put(structureStrId, structureName);
-        }
-        return map;
-    }
-
 }

+ 178 - 0
PAS/src/main/resources/mapper/AssoProductPatentMapper.xml

@@ -0,0 +1,178 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="cn.cslg.pas.mapper.asso.AssoProductPatentMapper">
+    <!--批量插入数据-->
+    <!--int insertBatch(List<AssoProductPicture> assoProductPictures);-->
+    <insert id="insertBatch">
+        insert into asso_product_patent (product_id,patent_no)
+        values
+        <foreach collection="patentNos" item="item" separator=",">
+            (#{productId},#{item})
+        </foreach>
+    </insert>
+
+
+    <select id="getPageList" parameterType="cn.cslg.pas.common.model.vo.PatentVO"
+            resultType="cn.cslg.pas.domain.Patent">
+        select DISTINCT a.id, a.`name` as name, a.nameout as name_out, a.patentno as patent_no, a.abstract_path,
+        a.abstract as
+        abstract_str, a.abstractout as abstract_out,
+        a.publicno as public_no, a.publicdate as public_date, a.simple_family, a.inpadoc_family, a.applicationno as
+        application_no, a.appdate as application_date,
+        a.`status` as simple_status, a.type, a.publictodate as public_accredit_date, a.fpublicdate as first_public_date,
+        a.prioritydate as priority_date,
+        a.agencyid as agency_id, a.num2 as right_num, a.quoteno as quote_num, a.quotedno as quoted_num,
+        a.patsnap_family as patSnapFamily, a.patsnapfamilynum as patSnapFamilyNum
+        from os_patent a
+        left join asso_product_patent i on i.patent_no=a.patentno
+            left join asso_structure_patent t on t.patent_no =a.patentno
+        <if test="params.applicationName !=null ">
+            left join os_applicant_attr b on a.id=b.pid and b.type =1
+            left join os_patent_applicant c on c.id=b.applicantid
+        </if>
+        <if test=" params.obligeeName !=null">
+            left join os_applicant_attr d on a.id=d.pid and d.type =2
+            left join os_patent_applicant e on e.id=d.applicantid
+        </if>
+        <if test="params.numberIpc!=null ">
+            left join os_patent_typeno f on f.pid =a.id and f.type =1
+        </if>
+        <if test=" params.numberCpc!=null ">
+            left join os_patent_typeno g on g.pid =a.id and g.type =2
+        </if>
+        <if test=" params.numberUpc!=null">
+            left join os_patent_typeno h on h.pid =a.id and h.type =3
+        </if>
+        <where>
+          ( i.product_id =#{params.productId}
+            or t.product_id =#{params.productId} )
+                    <if test="params.applicationName !=null and params.applicationName !=''  ">
+                        and c.name  REGEXP #{params.applicationName}
+                    </if>
+                    <if test="params.obligeeName !=null and params.obligeeName!=''">
+                        and e.name  REGEXP #{params.obligeeName}
+                    </if>
+                    <if test="params.numberIpc !=null and params.numberIpc!=''">
+                        and f.code like concat("%", #{params.numberIpc}, "%")
+                    </if>
+                    <if test="params.numberCpc !=null and params.numberCpc!=''">
+                        and g.code like concat("%", #{params.numberCpc}, "%")
+                    </if>
+                    <if test="params.numberUpc !=null and params.numberUpc!=''">
+                        and h.code like concat("%", #{params.numberUpc}, "%")
+                    </if>
+                    <if test="params.patentNo !=null and params.patentNo !=''">
+                        and a.patentNo REGEXP  #{params.patentNo}
+                    </if>
+                    <if test="params.applicationNo !=null and params.applicationNo !=''">
+                        and a.applicationNo like concat("%", #{params.applicationNo}, "%")
+                    </if>
+                    <if test="params.abstractStr !=null and params.abstractStr !=''">
+                        and a.abstract like concat("%", #{params.abstractStr}, "%")
+                    </if>
+                    <if test="params.patentName !=null and params.patentName !=''">
+                        and a.`name` like concat("%", #{params.patentName}, "%")
+                    </if>
+                    <if test="params.orderItem!=null and params.orderItem!='SysOrder'">
+                        order by #{params.orderItem}
+                        <if test="params.orderType!=null">
+                            #{params.orderType}
+                        </if>
+                    </if>
+                    <if test="params.orderItem==null">
+                        order by a.patentno
+                    </if>
+                    <if test="params.orderItem=='SysOrder' and params.patentNos != null and params.patentNos.size()!=0">
+                        order by field (a.patentno,
+                        <foreach item="item" collection="params.patentNos" index="index" open="" separator=","
+                                 close=")">
+                            #{item}
+                        </foreach>
+                    </if>
+
+        </where>
+    </select>
+
+    <select id="getPatentNos" resultType="java.lang.String">
+        select DISTINCT a.patentno as patent_no
+        from os_patent a
+        left join asso_product_patent i on i.patent_no=a.patentno
+        left join asso_structure_patent t on t.patent_no =a.patentno
+        <if test="params.applicationName !=null ">
+            left join os_applicant_attr b on a.id=b.pid and b.type =1
+            left join os_patent_applicant c on c.id=b.applicantid
+        </if>
+        <if test=" params.obligeeName !=null">
+            left join os_applicant_attr d on a.id=d.pid and d.type =2
+            left join os_patent_applicant e on e.id=d.applicantid
+        </if>
+        <if test="params.numberIpc!=null ">
+            left join os_patent_typeno f on f.pid =a.id and f.type =1
+        </if>
+        <if test=" params.numberCpc!=null ">
+            left join os_patent_typeno g on g.pid =a.id and g.type =2
+        </if>
+        <if test=" params.numberUpc!=null">
+            left join os_patent_typeno h on h.pid =a.id and h.type =3
+        </if>
+        <where>
+
+            <if test="params.applicationName !=null and params.applicationName !=''  ">
+                and c.name  REGEXP #{params.applicationName}
+            </if>
+            <if test="params.obligeeName !=null and params.obligeeName!=''">
+                and e.name  REGEXP #{params.obligeeName}
+            </if>
+            <if test="params.numberIpc !=null and params.numberIpc!=''">
+                and f.code like concat("%", #{params.numberIpc}, "%")
+            </if>
+            <if test="params.numberCpc !=null and params.numberCpc!=''">
+                and g.code like concat("%", #{params.numberCpc}, "%")
+            </if>
+            <if test="params.numberUpc !=null and params.numberUpc!=''">
+                and h.code like concat("%", #{params.numberUpc}, "%")
+            </if>
+            <if test="params.patentNo !=null and params.patentNo !=''">
+                and a.patentNo REGEXP  #{params.patentNo}
+            </if>
+            <if test="params.applicationNo !=null and params.applicationNo !=''">
+                and a.applicationNo like concat("%", #{params.applicationNo}, "%")
+            </if>
+            <if test="params.abstractStr !=null and params.abstractStr !=''">
+                and a.abstract like concat("%", #{params.abstractStr}, "%")
+            </if>
+            <if test="params.patentName !=null and params.patentName !=''">
+                and a.`name` like concat("%", #{params.patentName}, "%")
+            </if>
+            <if test="params.isIn ==0">
+             and   (i.product_id !=#{params.productId} or i.product_id is null)
+                and (t.product_id !=#{params.productId} or t.product_id is null)
+            </if>
+            <if test="params.isIn !=0">
+             and (i.product_id =#{params.productId} or t.product_id =#{params.productId})
+            </if>
+            <if test="params.orderItem!=null and params.orderItem!='SysOrder'">
+                order by #{params.orderItem}
+                <if test="params.orderType!=null">
+                    #{params.orderType}
+                </if>
+            </if>
+            <if test="params.orderItem==null">
+                order by a.patentno
+            </if>
+            <if test="params.orderItem=='SysOrder' and params.patentNos != null and params.patentNos.size()!=0">
+                order by field (a.patentno,
+                <foreach item="item" collection="params.patentNos" index="index" open="" separator=","
+                         close=")">
+                    #{item}
+                </foreach>
+            </if>
+            <if test=" params.endNumber &gt; 0">
+                limit #{params.startNumber},#{params.endNumber}
+            </if>
+        </where>
+
+    </select>
+
+</mapper>

+ 0 - 56
PAS/src/main/resources/mapper/AssoStructurePatentMapper.xml

@@ -2,55 +2,6 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 
 <mapper namespace="cn.cslg.pas.mapper.AssoStructurePatentMapper">
-    <!--插入数据-->
-    <!--int insert(AssoStructurePatent assoStructurePatent);-->
-    <insert id="insert" useGeneratedKeys="true" keyProperty="id">
-        insert into asso_structure_patent (structure_id, patent_no, product_Id, project_id)
-        values (#{structureId}, #{patentNo}, #{productId}, #{projectId});
-    </insert>
-
-    <!--删除标引数据-->
-    <!--int delete(AssoStructurePatent assoStructurePatent);-->
-    <delete id="delete">
-        delete
-        from asso_structure_patent
-        <where>
-            <if test="projectId != null">
-                and project_id = #{projectId}
-            </if>
-            <if test="patentNo != null">
-                and patent_no = #{patentNo}
-            </if>
-            <if test="structureId != null">
-                and structure_id = #{structureId}
-            </if>
-            <if test="productId != null">
-                and product_Id = #{productId}
-            </if>
-        </where>
-    </delete>
-
-    <!-- 根据专题库id和专利号查询数据-->
-    <!--List<AssoStructurePatentVO> selectByOsThematicIdPatentNo(AssoStructurePatentQueryDTO assoStructurePatentQueryDTO);-->
-    <select id="selectByProjectIdPatentNo" resultMap="selectByOsThematicIdPatentNoMap">
-        select id,
-               structure_id,
-               patent_no,
-               product_Id,
-               project_id
-        from asso_structure_patent
-        where project_id = #{projectId}
-          and patent_no = #{patentNo}
-    </select>
-
-    <resultMap id="selectByOsThematicIdPatentNoMap" type="cn.cslg.pas.common.model.vo.AssoStructurePatentVO">
-        <id column="id" property="id"/>
-        <result column="structure_id" property="structureId"/>
-        <result column="patent_no" property="patentNo"/>
-        <result column="product_Id" property="productId"/>
-        <result column="os_thematic_id" property="osThematicId"/>
-    </resultMap>
-
     <!--根据架构id批量删除数据-->
     <!--int deleteByStructureIds(List<Integer> structureIds);-->
     <delete id="deleteByStructureIds">
@@ -63,12 +14,5 @@
         )
     </delete>
 
-    <!--根据专题库id删除数据-->
-    <!--int deleteByOsThematicId(Integer osThematicId);-->
-    <delete id="deleteByProjectId">
-        delete
-        from asso_structure_patent
-        where project_id = #{projectId}
-    </delete>
 
 </mapper>

+ 2 - 4
PAS/src/main/resources/mapper/AssoStructurePictureMapper.xml

@@ -15,9 +15,7 @@
     <!--根据id批量删除数据-->
     <!--int deleteByIds(List<Integer> ids);-->
     <delete id="deleteByIds">
-        delete
-        from asso_structure_picture
-        where id in (
+        delete from asso_structure_picture where id in (
         <foreach collection="list" item="n" separator=",">
             #{n}
         </foreach>
@@ -25,7 +23,7 @@
     </delete>
 
     <!--根据架构ids批量删除数据-->
-    <!--int deleteByStructureIds(List<Integer> structureIds);-->
+    <!--int deleteByStructureIds(List<Integer> structures);-->
     <delete id="deleteByStructureIds">
         delete
         from asso_structure_picture

+ 53 - 60
PAS/src/main/resources/mapper/PermissionRecordMapper.xml

@@ -2,53 +2,53 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 
 <mapper namespace="cn.cslg.pas.mapper.PermissionRecordMapper">
-    <!--插入数据-->
-    <!--int add(PermissionRecord permissionRecord);-->
-    <insert id="add" useGeneratedKeys="true" keyProperty="id">
-        insert into permission_record(id, patent_no, licensor, licensee, licensee_country, license_time,
-                                      license_fee, license_dead_line, license_type, create_person_id,
-                                      create_person_name, create_time, modified_time)
-        values (#{id}, #{patentNo}, #{licensor}, #{licensee}, #{licenseeCountry},
-                #{licenseTime}, #{licenseFee}, #{licenseDeadLine}, #{licenseType}, #{createPersonId},
-                #{createPersonName}, #{createTime}, #{modifiedTime})
-    </insert>
+<!--插入数据-->
+<!--int add(PermissionRecord permissionRecord);-->
+<insert id="add" useGeneratedKeys="true" keyProperty="id">
+    insert into permission_record(id, patent_no, licensor, licensee, licensee_country, license_time,
+                                  license_fee, license_dead_line, license_type, create_person_id,
+                                  create_person_name, create_time, modified_time)
+    values (#{id}, #{patentNo}, #{licensor}, #{licensee}, #{licenseeCountry},
+            #{licenseTime}, #{licenseFee}, #{licenseDeadLine}, #{licenseType}, #{createPersonId},
+            #{createPersonName}, #{createTime}, #{modifiedTime})
+</insert>
 
     <!--根据id修改数据-->
-    <!--int update(PermissionRecordDTO permissionRecordDTO);-->
-    <update id="update">
-        update permission_record
-        <set>
-            <if test="patentNo != null">
-                patent_no = #{patentNo},
-            </if>
-            <if test="licensor != null">
-                licensor = #{licensor},
-            </if>
-            <if test="licensee != null">
-                licensee = #{licensee},
-            </if>
-            <if test="licenseeCountry != null">
-                licensee_country = #{licenseeCountry},
-            </if>
-            <if test="licenseTime != null">
-                license_time = #{licenseTime},
-            </if>
-            <if test="licenseFee != null">
-                license_fee = #{licenseFee},
-            </if>
-            <if test="licenseDeadLine != null">
-                license_dead_line = #{licenseDeadLine},
-            </if>
-            <if test="licenseType != null">
-                license_type = #{licenseType},
-            </if>
-        </set>
-        where ID = #{id}
-    </update>
+<!--int update(PermissionRecordDTO permissionRecordDTO);-->
+<update id="update">
+    update permission_record
+    <set>
+        <if test="patentNo != null">
+            patent_no = #{patentNo},
+        </if>
+        <if test="licensor != null">
+            licensor = #{licensor},
+        </if>
+        <if test="licensee != null">
+            licensee = #{licensee},
+        </if>
+        <if test="licenseeCountry != null">
+            licensee_country = #{licenseeCountry},
+        </if>
+        <if test="licenseTime != null">
+            license_time = #{licenseTime},
+        </if>
+        <if test="licenseFee != null">
+            license_fee = #{licenseFee},
+        </if>
+        <if test="licenseDeadLine != null">
+            license_dead_line = #{licenseDeadLine},
+        </if>
+        <if test="licenseType != null">
+            license_type = #{licenseType},
+        </if>
+    </set>
+    where ID = #{id}
+</update>
 
 
-    <!--根据patentNo专利号分页查询许可记录数据-->
-    <!--;-->
+<!--根据patentNo专利号分页查询许可记录数据-->
+<!--;-->
     <resultMap id="permissionRecordMap" type="cn.cslg.pas.domain.PermissionRecord">
         <id column="id" property="id"/>
         <result column="patent_no" property="patentNo"/>
@@ -78,17 +78,10 @@
         <result column="license_type" property="licenseType"/>
     </resultMap>
     <select id="queryAllInfo" resultMap="permissionRecordVOMap">
-        select id,
-               patent_no,
-               licensor,
-               licensee,
-               licensee_country,
-               license_time,
-               license_fee,
-               license_dead_line,
-               license_type
+        select id, patent_no, licensor, licensee, licensee_country, license_time,
+            license_fee, license_dead_line, license_type
         from permission_record
-        where patent_no = #{patentNo}
+        where patent_no= #{patentNo}
     </select>
 
     <!--根据许可id统计数量-->
@@ -99,12 +92,12 @@
     </select>
 
 
-    <!--根据许可id删除数据-->
-    <!--int delete(Integer id);-->
-    <delete id="delete">
-        delete
-        from permission_record
-        where id = #{id}
-    </delete>
+<!--根据许可id删除数据-->
+<!--int delete(Integer id);-->
+<delete id="delete">
+    delete
+    from permission_record
+    where id = #{id}
+</delete>
 
 </mapper>

+ 1 - 51
PAS/src/main/resources/mapper/ProductMapper.xml

@@ -50,12 +50,11 @@
     </update>
 
     <!--根据产品名称统计数量-->
-    <!--int countByProductName(String productName, Integer productCategoryId);-->
+    <!--int countByProductName(String productName);-->
     <select id="countByProductName" resultType="int">
         select count(*)
         from product
         where product_name = #{productName}
-          and product_category_id = #{productCategoryId}
     </select>
 
     <!--根据id统计数量-->
@@ -74,22 +73,6 @@
         where product_category_id = #{productCategoryId}
     </select>
 
-    <!--根据id查询数据-->
-    <!--ProductVO getStandardById(Integer id);-->
-    <select id="getStandardById" resultMap="queryMap">
-        select id,
-               product_name,
-               market_time,
-               company_name,
-               tenant_id,
-               product_explain,
-               product_category_id,
-               license_rate,
-               create_person_name
-        from product
-        where id = #{id}
-    </select>
-
     <!--分页查询数据-->
     <!--List<ProductVO> query(ProductQueryPageDTO productQueryPageDTO);-->
     <select id="query" resultMap="queryMap">
@@ -133,13 +116,6 @@
         <collection property="pictures" ofType="cn.cslg.pas.common.model.vo.ProductPictureVO"
                     select="query2" column="p_id">
         </collection>
-        <collection property="productPatents" ofType="cn.cslg.pas.common.model.vo.ProductPatentVO"
-                    select="query3" column="p_id">
-        </collection>
-        <collection property="structurePatents" ofType="cn.cslg.pas.common.model.vo.StructurePatentVO"
-                    select="query4" column="p_id">
-
-        </collection>
     </resultMap>
 
     <select id="query2" resultMap="query2Map">
@@ -156,30 +132,4 @@
         <result column="url" property="url"/>
     </resultMap>
 
-    <select id="query3" resultMap="query3Map">
-        select id, patent_no, product_id
-        from asso_product_patent
-        where product_id = #{p_id}
-    </select>
-
-    <resultMap id="query3Map" type="cn.cslg.pas.common.model.vo.ProductPatentVO">
-        <id column="id" property="id"/>
-        <result column="patent_no" property="patentNo"/>
-        <result column="product_id" property="productId"/>
-    </resultMap>
-
-    <select id="query4" resultMap="query4Map">
-        select id, structure_id, patent_no, product_Id, project_id
-        from asso_structure_patent
-        where product_Id = #{p_id}
-    </select>
-
-    <resultMap id="query4Map" type="cn.cslg.pas.common.model.vo.StructurePatentVO">
-        <id column="id" property="id"/>
-        <result column="patent_no" property="patentNo"/>
-        <result column="structure_id" property="structureId"/>
-        <result column="product_Id" property="productId"/>
-        <result column="project_id" property="projectId"/>
-    </resultMap>
-
 </mapper>

+ 12 - 13
PAS/src/main/resources/mapper/ProjectMapper.xml

@@ -7,9 +7,8 @@
         select a.id, a.`name`, a.creat_id as create_by, a.technical_theme,
         a.innerfile as inner_file, a.`update`, a.`status`, a.contract_no,
         a.`case` as case_date, a.update_time, a.sort, a.clientid as client_id,
-        a.scenarioid as scenario, a.typeid as type, a.remark,
-        a.create_time,a.department_id,a.personnel_id,a.product_id,a.structure_id,a.is_category,
-        u.`name` as create_name,
+        a.scenarioid as scenario, a.typeid as type, a.remark, a.create_time,a.department_id,a.personnel_id,
+       u.`name` as create_name,
         (select count(*) from os_thematic_file where zid = a.id and type = 1) as report_num
         from os_thematic a
         left join os_distribution u on u.id = a.creat_id
@@ -27,8 +26,8 @@
                 and a.department_id = #{params.departmentId}
             </if>
             <if test="params.personnelIds != null and params.personnelIds.size() != 0">
-                and a.creat_id in
-                <foreach item="item" collection="params.personnelIds" index="index" open="(" separator="," close=")">
+             and  a.creat_id in
+                <foreach  item="item" collection="params.personnelIds" index="index"  open="(" separator="," close=")">
                     #{item}
                 </foreach>
             </if>
@@ -48,12 +47,12 @@
                     FIND_IN_SET(#{item}, a.scenarioid)
                 </foreach>
             </if>
-            <if test="params.PersonnelId!=null">
-                and a.id in (select tid from os_distribution_doing where uid=#{params.PersonnelId} )
-                <if test="params.tenantId!=null">
-                    and a.tenantId = #{params.tenantId}
-                </if>
-            </if>
+        <if test="params.PersonnelId!=null">
+          and  a.id in (select tid from os_distribution_doing where uid=#{params.PersonnelId} )
+        <if test="params.tenantId!=null">
+            and a.tenantId = #{params.tenantId}
+        </if>
+        </if>
         </where>
         order by a.`${params.sort.prop}` ${params.sort.order}
     </select>
@@ -61,7 +60,7 @@
     <select id="getListForCount"
             resultType="cn.cslg.pas.domain.Project"
             parameterType="cn.cslg.pas.common.model.vo.ProjectVO">
-        select a.id, a.`name`, a.creat_id as create_by, a.technical_theme,
+        select  a.id, a.`name`, a.creat_id as create_by, a.technical_theme,
         a.innerfile as inner_file, a.`update`, a.`status`, a.contract_no,
         a.`case` as case_date, a.update_time, a.sort, a.clientid as client_id,
         a.scenarioid as scenario, a.typeid as type, a.remark, a.create_time,a.department_id,a.personnel_id
@@ -69,7 +68,7 @@
         from os_thematic a
         <where>
             <if test="params.PersonnelId!=null">
-                and a.id in (select tid from os_distribution_doing where uid=#{params.PersonnelId} )
+                and  a.id in (select tid from os_distribution_doing where uid=#{params.PersonnelId} )
                 <if test="params.tenantId!=null">
                     and a.tenantId = #{params.tenantId}
                 </if>

+ 23 - 60
PAS/src/main/resources/mapper/StructureMapper.xml

@@ -5,10 +5,8 @@
     <!--插入数据-->
     <!--int insert(Structure structure);-->
     <insert id="insert" useGeneratedKeys="true" keyProperty="id">
-        insert into structure (parent_id, structure_name, path, remark, product_id, create_person_id,
-                               create_person_name)
-        values (#{parentId}, #{structureName}, #{path}, #{remark}, #{productId}, #{createPersonId},
-                #{createPersonName});
+        insert into structure (parent_id, structure_name, path, remark, product_id)
+        values (#{parentId}, #{structureName}, #{path}, #{remark}, #{productId});
     </insert>
 
     <!--根据id删除数据-->
@@ -75,9 +73,7 @@
                structure_name,
                path,
                remark,
-               product_id,
-               create_person_name,
-               create_time
+               product_id
         from structure
         where id = #{id}
     </select>
@@ -89,45 +85,24 @@
         <result column="path" property="path"/>
         <result column="remark" property="remark"/>
         <result column="product_id" property="productId"/>
-        <result column="create_person_name" property="createPersonName"/>
-        <result column="create_time" property="createTime"/>
     </resultMap>
 
-    <!--根据id查询数据和图片-->
-    <!--StructureVO getStandAndPictureById(Integer id);-->
-    <select id="getStandardAndPictureById" resultMap="selectByParentIdMap">
-        select id s_id,
-               parent_id,
-               structure_name,
-               path,
-               remark,
-               product_id,
-               create_person_name,
-               create_time
-        from structure
-        where id = #{id}
-    </select>
-
     <!--根据父级id和产品id查询数据-->
-    <!--List<StructureVO> selectByParentIdAndProductId(Integer parentId, Integer productId, List<Integer> ids);-->
+    <!--List<StructureVO> selectByParentIdAndProductId(Integer parentId, Integer productId);-->
     <select id="selectByParentIdAndProductId" resultMap="selectByParentIdMap">
         select id s_id,
         parent_id,
         structure_name,
         path,
         remark,
-        product_id,
-        create_person_name,
-        create_time
+        product_id
         from structure
         where parent_id = #{parentId}
         and product_id = #{productId}
-        <if test="ids != null">
-            and id in
-            <foreach collection="ids" item="item" separator="," open="(" close=")">
-                #{item}
-            </foreach>
-        </if>
+        and id in
+        <foreach collection="ids" item="item" separator="," open="(" close=")">
+            #{item}
+        </foreach>
         order by s_id
     </select>
 
@@ -139,14 +114,9 @@
         <result column="path" property="path"/>
         <result column="remark" property="remark"/>
         <result column="product_id" property="productId"/>
-        <result column="create_person_name" property="createPersonName"/>
-        <result column="create_time" property="createTime"/>
         <collection property="pictures" ofType="cn.cslg.pas.common.model.vo.StructurePictureVO"
                     select="selectByParentId2" column="s_id">
         </collection>
-        <collection property="patentNum" ofType="integer"
-                    select="selectByParentId3" column="s_id">
-        </collection>
     </resultMap>
 
     <select id="selectByParentId2" resultMap="selectByParentIdMap2">
@@ -167,12 +137,6 @@
         <result column="url" property="url"/>
     </resultMap>
 
-    <select id="selectByParentId3" resultType="integer">
-        select count(*)
-        from asso_structure_patent
-        where structure_id = #{s_id}
-    </select>
-
     <!--根据模糊路径查询数据-->
     <!--List<StructureVO> selectByFindInSetPath(String findInSetPath);-->
     <select id="selectByFindInSetPath" resultMap="selectByFindInSetPathMap">
@@ -187,6 +151,19 @@
         order by id
     </select>
 
+    <!---->
+    <!---->
+    <select id="selectByName" resultMap="selectByFindInSetPathMap">
+        select id,
+               parent_id,
+               structure_name,
+               path,
+               remark,
+               product_id
+        from structure
+        where structure_name like concat('%', #{name}, '%')
+    </select>
+
     <resultMap id="selectByFindInSetPathMap" type="cn.cslg.pas.common.model.vo.StructureVO">
         <id column="id" property="id"/>
         <result column="parent_id" property="parentId"/>
@@ -208,21 +185,7 @@
                product_id
         from structure
         where product_id = #{productId}
-        order by path
-    </select>
-
-    <!--根据架构id查询数据-->
-    <!--List<StructureVO> selectAllByStructureId(Integer structureId);-->
-    <select id="selectAllByStructureId" resultMap="selectByFindInSetPathMap">
-        select id,
-               parent_id,
-               structure_name,
-               path,
-               remark,
-               product_id
-        from structure
-        where find_in_set(#{structureId}, path)
-        order by path
+        order by id
     </select>
 
 </mapper>

+ 3 - 0
PAS/src/main/resources/mapper/TaskMapper.xml

@@ -21,6 +21,9 @@
             <if test="params.projectId != null">
                 and a.tid = #{params.projectId}
             </if>
+            <if test="params.productId != null">
+                and a.product_id = #{params.productId}
+            </if>
             <if test="params.projectName != '' and params.projectName != null">
                 and c.name like concat('%', #{params.projectName}, '%')
             </if>