Explorar o código

Merge remote-tracking branch 'origin/master'

lwhhszx hai 1 ano
pai
achega
e0142e856f
Modificáronse 41 ficheiros con 750 adicións e 116 borrados
  1. 15 0
      src/main/java/cn/cslg/pas/common/dto/GetUnselectedDTO.java
  2. 0 1
      src/main/java/cn/cslg/pas/common/dto/business/OtherPatentInfoDTO.java
  3. 27 0
      src/main/java/cn/cslg/pas/common/dto/invalidDTO/AddOtherDocumentsDTO.java
  4. 28 0
      src/main/java/cn/cslg/pas/common/dto/invalidDTO/UpdateOtherDocumentsDTO.java
  5. 8 0
      src/main/java/cn/cslg/pas/common/utils/parseQueryToTree/expressManager.java
  6. 3 0
      src/main/java/cn/cslg/pas/common/vo/business/InvalidRecordVO.java
  7. 30 0
      src/main/java/cn/cslg/pas/common/vo/business/ReportVO.java
  8. 23 0
      src/main/java/cn/cslg/pas/common/vo/invalidVO/OtherDocumentsVO.java
  9. 7 1
      src/main/java/cn/cslg/pas/common/vo/invalidVO/ReportAffairVO.java
  10. 20 0
      src/main/java/cn/cslg/pas/controller/ReportAffairController.java
  11. 6 0
      src/main/java/cn/cslg/pas/domain/business/InvalidRecord.java
  12. 6 0
      src/main/java/cn/cslg/pas/domain/business/LitigationHistory.java
  13. 27 0
      src/main/java/cn/cslg/pas/domain/business/OtherDocuments.java
  14. 6 0
      src/main/java/cn/cslg/pas/domain/business/OtherReferences.java
  15. 3 3
      src/main/java/cn/cslg/pas/factorys/EsBuilderFactory/DateQueryBuilder.java
  16. 10 4
      src/main/java/cn/cslg/pas/factorys/EsBuilderFactory/NestedPersonQueryBuilder.java
  17. 14 6
      src/main/java/cn/cslg/pas/factorys/EsBuilderFactory/NestedQueryBuilder.java
  18. 60 0
      src/main/java/cn/cslg/pas/factorys/EsBuilderFactory/TermOrWildcardQueryBuilder.java
  19. 6 6
      src/main/java/cn/cslg/pas/factorys/EsCountAnalyseBuilderFactory/DateCountAnalyssBuilder.java
  20. 13 0
      src/main/java/cn/cslg/pas/mapper/OtherDocumentsMapper.java
  21. 3 3
      src/main/java/cn/cslg/pas/mapper/PermissionRecordMapper.java
  22. 1 1
      src/main/java/cn/cslg/pas/service/business/AdminProceedService.java
  23. 7 1
      src/main/java/cn/cslg/pas/service/business/AsInvalidReasonHistoryService.java
  24. 18 2
      src/main/java/cn/cslg/pas/service/business/InvalidRecordService.java
  25. 10 3
      src/main/java/cn/cslg/pas/service/business/LitigationHistoryService.java
  26. 4 1
      src/main/java/cn/cslg/pas/service/business/MergePersonService.java
  27. 148 0
      src/main/java/cn/cslg/pas/service/business/OtherDocumentsService.java
  28. 10 2
      src/main/java/cn/cslg/pas/service/business/OtherReferencesService.java
  29. 1 1
      src/main/java/cn/cslg/pas/service/business/ProductCategoryService.java
  30. 1 2
      src/main/java/cn/cslg/pas/service/business/ProductService.java
  31. 19 0
      src/main/java/cn/cslg/pas/service/business/ReportAffairService.java
  32. 8 1
      src/main/java/cn/cslg/pas/service/business/ReviewHistoryService.java
  33. 67 43
      src/main/java/cn/cslg/pas/service/business/es/EsCountService.java
  34. 1 1
      src/main/java/cn/cslg/pas/service/business/es/EsCustomFieldService.java
  35. 3 0
      src/main/java/cn/cslg/pas/service/business/es/EsPatentService.java
  36. 72 9
      src/main/java/cn/cslg/pas/service/business/es/EsService.java
  37. 43 13
      src/main/java/cn/cslg/pas/service/business/es/EsValueCurveService.java
  38. 2 2
      src/main/resources/jsons/patent.json
  39. 3 3
      src/main/resources/mapper/PermissionRecordMapper.xml
  40. 5 2
      src/main/resources/mapper/ProductMarketDataMapper.xml
  41. 12 5
      src/test/java/cn/cslg/pas/service/EventServiceTests.java

+ 15 - 0
src/main/java/cn/cslg/pas/common/dto/GetUnselectedDTO.java

@@ -0,0 +1,15 @@
+package cn.cslg.pas.common.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class GetUnselectedDTO {
+
+    private Integer number;
+
+    private List<String> existChildIds;
+
+    private List<String> beinglessChildIds;
+}

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

@@ -12,5 +12,4 @@ public class OtherPatentInfoDTO {
     private Integer projectId;
     private Integer current;
     private Integer size;
-
 }

+ 27 - 0
src/main/java/cn/cslg/pas/common/dto/invalidDTO/AddOtherDocumentsDTO.java

@@ -0,0 +1,27 @@
+package cn.cslg.pas.common.dto.invalidDTO;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 其他文档
+ * @Author xiexiang
+ * @Date 2023/12/29
+ */
+@Data
+public class AddOtherDocumentsDTO {
+    private String documentName;
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+    private Date documentTime;
+
+    private Integer projectId;
+
+    private List<String> fileGuids;
+
+    private String description;
+}

+ 28 - 0
src/main/java/cn/cslg/pas/common/dto/invalidDTO/UpdateOtherDocumentsDTO.java

@@ -0,0 +1,28 @@
+package cn.cslg.pas.common.dto.invalidDTO;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 其他文档
+ * @Author xiexiang
+ * @Date 2023/12/29
+ */
+@Data
+public class UpdateOtherDocumentsDTO {
+    private Integer documentId;
+    private String documentName;
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+    private Date documentTime;
+
+    private Integer projectId;
+
+    private List<String> fileGuids;
+
+    private String description;
+}

+ 8 - 0
src/main/java/cn/cslg/pas/common/utils/parseQueryToTree/expressManager.java

@@ -99,6 +99,14 @@ public class expressManager {
         oOR.priorityVale = 20;
         oOR.operateValue = 2;
         hSymbols.put(oOR.Code, oOR);
+
+        oOR = new operate();
+        oOR.Code = "≡";
+        oOR.ShowName = " LIKE ";
+        oOR.type = enuType.Assignment;
+        oOR.priorityVale = 20;
+        oOR.operateValue = 2;
+        hSymbols.put(oOR.Code, oOR);
         //#endregion
 
         //#region 添加成对出现的符号

+ 3 - 0
src/main/java/cn/cslg/pas/common/vo/business/InvalidRecordVO.java

@@ -8,6 +8,7 @@ import java.util.Date;
 import java.util.List;
 
 /**
+ * 被无效历史VO
  * @Author xiexiang
  * @Date 2024/1/19
  */
@@ -68,4 +69,6 @@ public class InvalidRecordVO {
     private List<SystemFile> systemFileList;
 
     private Boolean ifAdd;
+
+    private ReportVO reportVO;
 }

+ 30 - 0
src/main/java/cn/cslg/pas/common/vo/business/ReportVO.java

@@ -0,0 +1,30 @@
+package cn.cslg.pas.common.vo.business;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/2/23
+ */
+@Data
+public class ReportVO {
+    /**
+     * 项目id
+     */
+    private Integer projectId;
+
+    /**
+     *标的专利号
+     */
+    private String signPatentNo;
+
+    /**
+     *类型
+     */
+    private Integer reportType;
+    /**
+     * 状态
+     */
+    private Integer status;
+}

+ 23 - 0
src/main/java/cn/cslg/pas/common/vo/invalidVO/OtherDocumentsVO.java

@@ -0,0 +1,23 @@
+package cn.cslg.pas.common.vo.invalidVO;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * 其他文档VO
+ * @Author xiexiang
+ * @Date 2023/12/28
+ */
+@Data
+public class OtherDocumentsVO {
+    private Integer documentId;
+    private String documentName;
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+    private Date documentTime;
+    private Integer projectId;
+    private String description;
+}

+ 7 - 1
src/main/java/cn/cslg/pas/common/vo/invalidVO/ReportAffairVO.java

@@ -17,7 +17,8 @@ import java.util.List;
 public class ReportAffairVO {
     private Integer id;
     /**
-     * 事务类型(0为口审记录,1为无效请求书,2为陈述意见书,3为无效决定书,4为行政诉讼书)
+     * 事务类型(0为口审记录,1为无效请求书,2为陈述意见书,3为无效决定书,4为行政诉讼书,5为行政诉讼判决书
+     * 6为权要修改记录,7为补充证据及理由,8为其他文档)
      */
     private Integer affairType;
 
@@ -94,4 +95,9 @@ public class ReportAffairVO {
      * 补充证据及理由返回VO
      */
     private SupplyEvidenceVO supplyEvidenceVO;
+
+    /**
+     * 其他文档返回VO
+     */
+    private OtherDocumentsVO otherDocumentsVO;
 }

+ 20 - 0
src/main/java/cn/cslg/pas/controller/ReportAffairController.java

@@ -34,6 +34,8 @@ public class ReportAffairController {
     private InvalidDecisionFileService invalidDecisionFileService;
     @Autowired
     private AdminProceedService adminProceedService;
+    @Autowired
+    private OtherDocumentsService otherDocumentsService;
 
     @Operation(summary = "上传无效请求书")
     @PostMapping("/addInvalidRequestFile")
@@ -200,4 +202,22 @@ public class ReportAffairController {
         records.setData(id);
         return Response.success(records);
     }
+
+    @Operation(summary = "上传其他文档")
+    @PostMapping("/addOtherDocuments")
+    public Response addOtherDocuments(@RequestBody AddOtherDocumentsDTO addOtherDocumentsDTO) throws Exception {
+        Integer id = otherDocumentsService.add(addOtherDocumentsDTO);
+        Records records = new Records();
+        records.setData(id);
+        return Response.success(records);
+    }
+
+    @Operation(summary = "修改其他文档")
+    @PostMapping("/updateOtherDocuments")
+    public Response updateOtherDocuments(@RequestBody UpdateOtherDocumentsDTO updateOtherDocumentsDTO) throws Exception {
+        Integer id = otherDocumentsService.update(updateOtherDocumentsDTO);
+        Records records = new Records();
+        records.setData(id);
+        return Response.success(records);
+    }
 }

+ 6 - 0
src/main/java/cn/cslg/pas/domain/business/InvalidRecord.java

@@ -62,4 +62,10 @@ public class InvalidRecord extends BaseEntity<InvalidRecord> {
      */
     @TableField(value = "create_time")
     private Date createTime;
+
+    /**
+     * 租户id
+     */
+    @TableField(value = "tenant_id")
+    private Integer tenantId;
 }

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

@@ -93,4 +93,10 @@ public class LitigationHistory extends BaseEntity<LitigationHistory> {
      */
     @TableField(value = "create_time")
     private Date createTime;
+
+    /**
+     * 租户id
+     */
+    @TableField(value = "tenant_id")
+    private Integer tenantId;
 }

+ 27 - 0
src/main/java/cn/cslg/pas/domain/business/OtherDocuments.java

@@ -0,0 +1,27 @@
+package cn.cslg.pas.domain.business;
+
+import cn.cslg.pas.domain.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+/**
+ * 其他文档
+ * @Author xiexiang
+ * @Date 2024/2/23
+ */
+@Data
+@TableName("other_documents")
+public class OtherDocuments extends BaseEntity<OtherDocuments> {
+    /**
+     * 文档名称
+     */
+    @TableField(value = "document_name")
+    private String documentName;
+
+    /**
+     * 报告事务id
+     */
+    @TableField(value = "report_affair_id")
+    private Integer reportAffairId;
+}

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

@@ -50,4 +50,10 @@ public class OtherReferences extends BaseEntity<OtherReferences> {
      */
     @TableField(value = "create_time")
     private Date createTime;
+
+    /**
+     * 租户id
+     */
+    @TableField(value = "tenant_id")
+    private Integer tenantId;
 }

+ 3 - 3
src/main/java/cn/cslg/pas/factorys/EsBuilderFactory/DateQueryBuilder.java

@@ -55,7 +55,7 @@ public class DateQueryBuilder implements IQueryBuilder {
                         break;
                     default:
                         query = QueryBuilders
-                                .range(range -> range.field(field).gte(JsonData.of(yearTime)).lte(JsonData.of(yearNextTime)));
+                                .range(range -> range.field(field).gte(JsonData.of(yearTime)).lt(JsonData.of(yearNextTime)));
                         break;
                 }
             } else if (value.length() == MONTH || value.length() == MONTHONE) {
@@ -93,7 +93,7 @@ public class DateQueryBuilder implements IQueryBuilder {
                         break;
                     default:
                         query = QueryBuilders
-                                .range(range -> range.field(field).gte(JsonData.of(monthTime)).lte(JsonData.of(monthNextTime)));
+                                .range(range -> range.field(field).gte(JsonData.of(monthTime)).lt(JsonData.of(monthNextTime)));
                         break;
                 }
             } else if (value.length() == DAY || value.length() == DAYONE) {
@@ -131,7 +131,7 @@ public class DateQueryBuilder implements IQueryBuilder {
                         break;
                     default:
                         query = QueryBuilders
-                                .range(range -> range.field(field).gte(JsonData.of(dayTime)).lte(JsonData.of(nextDayTime)));
+                                .range(range -> range.field(field).gte(JsonData.of(dayTime)).lt(JsonData.of(nextDayTime)));
                         break;
                 }
             } else {

+ 10 - 4
src/main/java/cn/cslg/pas/factorys/EsBuilderFactory/NestedPersonQueryBuilder.java

@@ -16,10 +16,16 @@ public class NestedPersonQueryBuilder implements IQueryBuilder{
 
     @Override
     public Query creteQuery() throws ParseException {
-        String str = "*";
-        String s = str.concat(value).concat("*");
-        Query query =  QueryBuilders.wildcard(i -> i.field(field).value(s));
-        Query nestedQuery = QueryBuilders.nested(z -> z.path(path).query(query));
+        Query query = null;
+        if (operator.equals("=")) {
+            String str = "*";
+            String s = str.concat(value).concat("*");
+            query = QueryBuilders.wildcard(i -> i.field(field).value(s));
+        } else {
+            query = QueryBuilders.term(i -> i.field(field).value(value));
+        }
+        Query finalQuery = query;
+        Query nestedQuery = QueryBuilders.nested(z -> z.path(path).query(finalQuery));
         return nestedQuery;
     }
 

+ 14 - 6
src/main/java/cn/cslg/pas/factorys/EsBuilderFactory/NestedQueryBuilder.java

@@ -13,15 +13,23 @@ public class NestedQueryBuilder implements IQueryBuilder {
 
     @Override
     public Query creteQuery() {
-        String str = "*";
-        String s = str.concat(value).concat("*");
-        Query query =  QueryBuilders.wildcard(i -> i.field(field).value(s));
-        Query nestedQuery = QueryBuilders.nested(z -> z.path(path).query(query));
+        Query nestedQuery = null;
+        if (operator.equals("=")) {
+            String str = "*";
+            String s = str.concat(value).concat("*");
+            Query query =  QueryBuilders.wildcard(i -> i.field(field).value(s));
+            nestedQuery = QueryBuilders.nested(z -> z.path(path).query(query));
+        } else {
+            Query query = QueryBuilders.term(i -> i.field(field).value(value));
+            nestedQuery = QueryBuilders.nested(z -> z.path(path).query(query));
+        }
         Query childQuery = null;
         if (path.equals("merge_applicant")) {
-            childQuery = QueryBuilders.hasChild(i -> i.type("merge_applicat").query(nestedQuery));
+            Query finalNestedQuery = nestedQuery;
+            childQuery = QueryBuilders.hasChild(i -> i.type("merge_applicat").query(finalNestedQuery));
         } else {
-            childQuery = QueryBuilders.hasChild(i -> i.type(path).query(nestedQuery));
+            Query finalNestedQuery1 = nestedQuery;
+            childQuery = QueryBuilders.hasChild(i -> i.type(path).query(finalNestedQuery1));
         }
         return childQuery;
     }

+ 60 - 0
src/main/java/cn/cslg/pas/factorys/EsBuilderFactory/TermOrWildcardQueryBuilder.java

@@ -0,0 +1,60 @@
+package cn.cslg.pas.factorys.EsBuilderFactory;
+
+import co.elastic.clients.elasticsearch._types.query_dsl.Query;
+import co.elastic.clients.elasticsearch._types.query_dsl.QueryBuilders;
+import org.springframework.stereotype.Component;
+
+import java.text.ParseException;
+
+@Component
+public class TermOrWildcardQueryBuilder implements IQueryBuilder{
+    private String field = "";
+    private String value = "";
+    private String operator = "";
+    public String path = "";
+
+    @Override
+    public Query creteQuery() throws ParseException {
+        Query query = null;
+        if (operator.equals("=")) {
+            String str = "*";
+            String s = str.concat(value).concat("*");
+            query =  QueryBuilders.wildcard(i -> i.field(field).value(s));
+        } else {
+            query = QueryBuilders.term(i -> i.field(field).value(value));
+        }
+        return query;
+    }
+
+    public String getField() {
+        return field;
+    }
+
+    public void setField(String field) {
+        this.field = field;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public String getOperator() {
+        return operator;
+    }
+
+    public void setOperator(String operator) {
+        this.operator = operator;
+    }
+
+    public String getPath() {
+        return path;
+    }
+
+    public void setPath(String path) {
+        this.path = path;
+    }
+}

+ 6 - 6
src/main/java/cn/cslg/pas/factorys/EsCountAnalyseBuilderFactory/DateCountAnalyssBuilder.java

@@ -40,7 +40,7 @@ public class DateCountAnalyssBuilder implements IEsCountAnalysisBuilder {
             Aggregation filter = AggregationBuilders.filter(n -> n.bool(k -> k.must(query)));
             aggregation = new Aggregation.Builder().dateHistogram(new DateHistogramAggregation.Builder()
                     .field(field).format("yyyy")
-                    .calendarInterval(CalendarInterval.Year).build())
+                    .calendarInterval(CalendarInterval.Year).timeZone("+08:00").build())
                     .aggregations(new HashMap() {{
                         put("filter_agg", filter);
                     }}).build();
@@ -167,9 +167,9 @@ public class DateCountAnalyssBuilder implements IEsCountAnalysisBuilder {
             aggregation = AggregationBuilders.dateRange(i -> i.field(field).format("yyyy-MM").ranges(rangeExpressions));
         } else if (StringUtils.isNotEmpty(format) && CollectionUtils.isEmpty(values)) {
             if (format.equals("年")) {
-                aggregation = AggregationBuilders.dateHistogram(i -> i.field(field).format("yyyy").calendarInterval(CalendarInterval.Year));
+                aggregation = AggregationBuilders.dateHistogram(i -> i.field(field).format("yyyy").calendarInterval(CalendarInterval.Year).timeZone("+08:00"));
             } else if (format.equals("半年")) {
-                Aggregation halfYearAgg = AggregationBuilders.dateHistogram(i -> i.field(field).format("yyyy-MM").calendarInterval(CalendarInterval.Month));
+                Aggregation halfYearAgg = AggregationBuilders.dateHistogram(i -> i.field(field).format("yyyy-MM").calendarInterval(CalendarInterval.Month).timeZone("+08:00"));
                 aggregation = new Aggregation.Builder().dateHistogram(new DateHistogramAggregation.Builder()
                         .field(field).format("yyyy")
                         .calendarInterval(CalendarInterval.Year).build())
@@ -177,12 +177,12 @@ public class DateCountAnalyssBuilder implements IEsCountAnalysisBuilder {
                             put("halfYearAgg", halfYearAgg);
                         }}).build();
             } else if (format.equals("季")) {
-                aggregation = AggregationBuilders.dateHistogram(i -> i.field(field).format("yyyy-MM").calendarInterval(CalendarInterval.Quarter));
+                aggregation = AggregationBuilders.dateHistogram(i -> i.field(field).format("yyyy-MM").calendarInterval(CalendarInterval.Quarter).timeZone("+08:00"));
             } else if (format.equals("月")) {
-                aggregation = AggregationBuilders.dateHistogram(i -> i.field(field).format("yyyy-MM").calendarInterval(CalendarInterval.Month));
+                aggregation = AggregationBuilders.dateHistogram(i -> i.field(field).format("yyyy-MM").calendarInterval(CalendarInterval.Month).timeZone("+08:00"));
             }
         } else {
-            aggregation = AggregationBuilders.dateHistogram(i -> i.field(field).format("yyyy").calendarInterval(CalendarInterval.Year));
+            aggregation = AggregationBuilders.dateHistogram(i -> i.field(field).format("yyyy").calendarInterval(CalendarInterval.Year).timeZone("+08:00"));
 
         }
         return aggregation;

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

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

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

@@ -14,9 +14,9 @@ import java.util.List;
 @Repository
 public interface PermissionRecordMapper extends BaseMapper<PermissionRecord> {
 
-    public List<SelectValueCurveDTO> selectLicenseeMonthList(String patentNo);
+    public List<SelectValueCurveDTO> selectLicenseeMonthList(String patentNo,Integer tenantId);
 
-    public List<SelectValueCurveDTO> selectLicenseeYearList(String patentNo);
+    public List<SelectValueCurveDTO> selectLicenseeYearList(String patentNo,Integer tenantId);
 
-    public List<SelectValueCurveDTO> selectLicenseeQuarterList(String patentNo);
+    public List<SelectValueCurveDTO> selectLicenseeQuarterList(String patentNo,Integer tenantId);
 }

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

@@ -38,7 +38,7 @@ public class AdminProceedService extends ServiceImpl<AdminProceedMapper, AdminPr
     private AssoReportAffairFileService assoReportAffairFileService;
 
     /**
-     * 上传行政诉讼判决
+     * 上传行政诉讼书
      * @param addDto
      * @return
      */

+ 7 - 1
src/main/java/cn/cslg/pas/service/business/AsInvalidReasonHistoryService.java

@@ -126,9 +126,15 @@ public class AsInvalidReasonHistoryService extends ServiceImpl<AsInvalidReasonHi
         if (patentNo == null || StringUtils.isEmpty(patentNo)) {
             throw new XiaoShiException("入参为空");
         }
-
+        PersonnelVO personnelVO = new PersonnelVO();
+        try {
+            personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+        } catch (Exception e) {
+            throw new XiaoShiException("未查询到当前登陆人");
+        }
         LambdaQueryWrapper<AsInvalidReasonHistory> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(AsInvalidReasonHistory::getPatentNo, patentNo)
+                .eq(AsInvalidReasonHistory::getTenantId, personnelVO.getTenantId())
                 .orderByDesc(AsInvalidReasonHistory::getInvalidTime);
         List<AsInvalidReasonHistory> asInvalidReasonHistories = this.list(queryWrapper);
 

+ 18 - 2
src/main/java/cn/cslg/pas/service/business/InvalidRecordService.java

@@ -9,6 +9,7 @@ import cn.cslg.pas.common.utils.CacheUtils;
 import cn.cslg.pas.common.utils.LoginUtils;
 import cn.cslg.pas.common.utils.StringUtils;
 import cn.cslg.pas.common.vo.business.InvalidRecordVO;
+import cn.cslg.pas.common.vo.business.ReportVO;
 import cn.cslg.pas.domain.business.*;
 import cn.cslg.pas.exception.XiaoShiException;
 import cn.cslg.pas.mapper.InvalidRecordMapper;
@@ -105,6 +106,7 @@ public class InvalidRecordService extends ServiceImpl<InvalidRecordMapper, Inval
                 throw new XiaoShiException("未查询到当前登陆人");
             }
             invalidRecord.setCreateId(personnelVO.getId());
+            invalidRecord.setTenantId(personnelVO.getTenantId());
             invalidRecord.insert();
             if (fileGuids != null && !fileGuids.isEmpty()) {
                 //先删除 后添加
@@ -125,9 +127,15 @@ public class InvalidRecordService extends ServiceImpl<InvalidRecordMapper, Inval
         if (patentNo == null || StringUtils.isEmpty(patentNo)) {
             throw new XiaoShiException("入参为空");
         }
-
+        PersonnelVO personnelVO = new PersonnelVO();
+        try {
+            personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+        } catch (Exception e) {
+            throw new XiaoShiException("未查询到当前登陆人");
+        }
         LambdaQueryWrapper<InvalidRecord> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(InvalidRecord::getPatentNo, patentNo);
+        queryWrapper.eq(InvalidRecord::getPatentNo, patentNo)
+                .eq(InvalidRecord::getTenantId, personnelVO.getTenantId());
         List<InvalidRecord> invalidRecords = this.list(queryWrapper);
 
         if (!invalidRecords.isEmpty()) {
@@ -230,6 +238,10 @@ public class InvalidRecordService extends ServiceImpl<InvalidRecordMapper, Inval
                     List<String> fileGuids = this.loadFileGuids(item.getProjectId());
                     invalidRecordVO.setFileGuids(fileGuids);
                     invalidRecordVO.setIfAdd(false);
+                    //带出报告信息
+                    ReportVO reportVO = new ReportVO();
+                    BeanUtils.copyProperties(item, reportVO);
+                    invalidRecordVO.setReportVO(reportVO);
                     finalVOS.add(invalidRecordVO);
                 } else if (type.equals(7)) {
                     //报告类型为官方无效  查询行政判决诉讼书
@@ -247,6 +259,10 @@ public class InvalidRecordService extends ServiceImpl<InvalidRecordMapper, Inval
                     List<String> fileGuids = this.loadFileGuids(item.getProjectId());
                     invalidRecordVO.setFileGuids(fileGuids);
                     invalidRecordVO.setIfAdd(false);
+                    //带出报告信息
+                    ReportVO reportVO = new ReportVO();
+                    BeanUtils.copyProperties(item, reportVO);
+                    invalidRecordVO.setReportVO(reportVO);
                     finalVOS.add(invalidRecordVO);
                 }
             });

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

@@ -92,6 +92,7 @@ public class LitigationHistoryService extends ServiceImpl<LitigationHistoryMappe
                 throw new XiaoShiException("未查询到当前登陆人");
             }
             litigationHistory.setCreateId(personnelVO.getId());
+            litigationHistory.setTenantId(personnelVO.getTenantId());
             litigationHistory.insert();
             if (fileGuids != null && !fileGuids.isEmpty()) {
                 //先删除 后添加
@@ -107,7 +108,7 @@ public class LitigationHistoryService extends ServiceImpl<LitigationHistoryMappe
      * @return
      * @throws IOException
      */
-    public Records getLitigationHistory( OtherPatentInfoDTO otherPatentInfoDTO) throws IOException {
+    public Records getLitigationHistory(OtherPatentInfoDTO otherPatentInfoDTO) throws IOException {
         List<LitigationHistoryVO> litigationHistoryVOS = new ArrayList<>();
         String patentNo = otherPatentInfoDTO.getPatentNo();
         if (patentNo == null || StringUtils.isEmpty(patentNo)) {
@@ -116,10 +117,16 @@ public class LitigationHistoryService extends ServiceImpl<LitigationHistoryMappe
         Integer current = otherPatentInfoDTO.getCurrent();
         Integer size = otherPatentInfoDTO.getSize();
         Page<LitigationHistory> page = new Page<>(current, size);
-
+        PersonnelVO personnelVO = new PersonnelVO();
+        try {
+            personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+        } catch (Exception e) {
+            throw new XiaoShiException("未查询到当前登陆人");
+        }
         LambdaQueryWrapper<LitigationHistory> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(LitigationHistory::getPatentNo, patentNo)
-                    .orderByDesc(LitigationHistory::getCreateTime);
+                .eq(LitigationHistory::getTenantId, personnelVO.getTenantId())
+                .orderByDesc(LitigationHistory::getCreateTime);
         IPage<LitigationHistory> litigationHistoryPage = this.page(page, queryWrapper);
         List<LitigationHistory> litigationHistories = litigationHistoryPage.getRecords();
         long total = litigationHistoryPage.getTotal();

+ 4 - 1
src/main/java/cn/cslg/pas/service/business/MergePersonService.java

@@ -641,6 +641,7 @@ public class MergePersonService extends ServiceImpl<MergePersonMapper, MergePers
      */
     public Records getMergePerson(GetAllPersonVO vo) throws Exception {
         Integer projectId = vo.getProjectId();
+        Integer taskId = vo.getTaskId();
         Long pageNum = vo.getPageNum();
         Long pageSize = vo.getPageSize();
         Integer type = vo.getType();
@@ -661,6 +662,7 @@ public class MergePersonService extends ServiceImpl<MergePersonMapper, MergePers
         SearchRequest.Builder builder = new SearchRequest.Builder();
         //设置查询索引
         builder.index("patent");
+        Query mustQ = QueryBuilders.hasChild(i -> i.type("project").query(j -> j.term(n -> n.field("project_id").value(projectId))));
         if (!CollectionUtils.isEmpty(conditionList)) {
             for (String name : conditionList) {
                 List<Query> queries = new ArrayList<>();
@@ -687,7 +689,8 @@ public class MergePersonService extends ServiceImpl<MergePersonMapper, MergePers
                     Query childQ = QueryBuilders.hasChild(i -> i.type("merge_inventor").query(query));
                     queries.add(childQ);
                 }
-                Query bool = QueryBuilders.bool(i -> i.should(queries));
+                Query bool = QueryBuilders.bool(i -> i.must(mustQ).should(queries));
+                builder.size(99999);
                 builder.query(bool);
                 //分页
 //        if (pageNum > 0 && pageSize > 0) {

+ 148 - 0
src/main/java/cn/cslg/pas/service/business/OtherDocumentsService.java

@@ -0,0 +1,148 @@
+package cn.cslg.pas.service.business;
+
+import cn.cslg.pas.common.dto.business.ReportAffairDTO;
+import cn.cslg.pas.common.dto.invalidDTO.*;
+import cn.cslg.pas.common.vo.invalidVO.InvalidDecisionFileVO;
+import cn.cslg.pas.common.vo.invalidVO.OralTrailVO;
+import cn.cslg.pas.common.vo.invalidVO.OtherDocumentsVO;
+import cn.cslg.pas.domain.business.*;
+import cn.cslg.pas.exception.XiaoShiException;
+import cn.cslg.pas.mapper.OtherDocumentsMapper;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 其他文档
+ * @Author xiexiang
+ * @Date 2024/2/23
+ */
+@Slf4j
+@Service
+public class OtherDocumentsService extends ServiceImpl<OtherDocumentsMapper, OtherDocuments> {
+    @Autowired
+    private ReportAffairService reportAffairService;
+
+    @Autowired
+    private AssoReportAffairFileService assoReportAffairFileService;
+
+    /**
+     * 新增
+     * @param addOtherDocumentsDTO
+     * @return
+     */
+    public Integer add(AddOtherDocumentsDTO addOtherDocumentsDTO){
+        if (addOtherDocumentsDTO == null) {
+            throw new XiaoShiException("入参为空");
+        }
+        Integer projectId = addOtherDocumentsDTO.getProjectId();
+        if (projectId == null) {
+            throw new XiaoShiException("报告id为空");
+        }
+        //1. 首先上传报告事务,拿到报告事务id
+        ReportAffairDTO reportAffairDTO = new ReportAffairDTO();
+        reportAffairDTO.setProjectId(projectId);
+        //其他文档 8
+        reportAffairDTO.setAffairType(8);
+        //发生时间是文档时间
+        reportAffairDTO.setOccurredTime(addOtherDocumentsDTO.getDocumentTime());
+        //备注
+        reportAffairDTO.setDescription(addOtherDocumentsDTO.getDescription());
+        Integer reportAffairId = reportAffairService.addReportAffair(reportAffairDTO);
+
+        if (reportAffairId == null) {
+            throw new XiaoShiException("上传报告事务失败");
+        }
+        //2. 上传其他文档
+        OtherDocuments otherDocuments = new OtherDocuments();
+        otherDocuments.setDocumentName(addOtherDocumentsDTO.getDocumentName());
+        otherDocuments.setReportAffairId(reportAffairId);
+        otherDocuments.insert();
+        //3. 添加报告事务与文件关联
+        List<String> fileGuids = addOtherDocumentsDTO.getFileGuids();
+        if (fileGuids != null && !fileGuids.isEmpty()) {
+            List<AssoReportAffairFile> assoReportAffairFiles = new ArrayList<>();
+            fileGuids.forEach(item -> {
+                AssoReportAffairFile assoReportAffairFile = new AssoReportAffairFile();
+                assoReportAffairFile.setReportAffairId(reportAffairId);
+                assoReportAffairFile.setFileGuid(item);
+                assoReportAffairFiles.add(assoReportAffairFile);
+            });
+            assoReportAffairFileService.saveBatch(assoReportAffairFiles);
+        }
+        return reportAffairId;
+    }
+
+    /**
+     * 修改其他文档
+     * @param updateOtherDocumentsDTO
+     * @return
+     */
+    public Integer update(UpdateOtherDocumentsDTO updateOtherDocumentsDTO){
+        if (updateOtherDocumentsDTO == null) {
+            throw new XiaoShiException("入参为空");
+        }
+        Integer projectId = updateOtherDocumentsDTO.getProjectId();
+        Integer id = updateOtherDocumentsDTO.getDocumentId();
+        if (id == null) {
+            throw new XiaoShiException("id为空");
+        }
+        if (projectId == null) {
+            throw new XiaoShiException("报告id为空");
+        }
+        //1. 根据id查出其他文档
+        OtherDocuments otherDocuments = this.getById(id);
+        if (otherDocuments == null) {
+            throw new XiaoShiException("其他文档查询错误");
+        }
+        BeanUtils.copyProperties(updateOtherDocumentsDTO, otherDocuments);
+        otherDocuments.updateById();
+        Integer reportAffairId = otherDocuments.getReportAffairId();
+        //2. 拿到报告事务id,获取报告事务
+        ReportAffair reportAffair = reportAffairService.getById(reportAffairId);
+        reportAffair.setProjectId(projectId);
+        //发生时间是文档时间
+        reportAffair.setOccurredTime(updateOtherDocumentsDTO.getDocumentTime());
+        //备注
+        reportAffair.setDescription(updateOtherDocumentsDTO.getDescription());
+        reportAffair.updateById();
+        //3. 更新报告事务与文件关联
+        LambdaQueryWrapper<AssoReportAffairFile> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(AssoReportAffairFile::getReportAffairId, reportAffairId);
+        assoReportAffairFileService.remove(queryWrapper);
+        List<String> fileGuids = updateOtherDocumentsDTO.getFileGuids();
+        if (fileGuids != null && !fileGuids.isEmpty()) {
+            List<AssoReportAffairFile> assoReportAffairFiles = new ArrayList<>();
+            fileGuids.forEach(item -> {
+                AssoReportAffairFile assoReportAffairFile = new AssoReportAffairFile();
+                assoReportAffairFile.setReportAffairId(reportAffairId);
+                assoReportAffairFile.setFileGuid(item);
+                assoReportAffairFiles.add(assoReportAffairFile);
+            });
+            assoReportAffairFileService.saveBatch(assoReportAffairFiles);
+        }
+        return reportAffairId;
+    }
+
+    public OtherDocumentsVO getOtherDocuments(Integer reportAffairId) {
+        LambdaQueryWrapper<OtherDocuments> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(OtherDocuments::getReportAffairId, reportAffairId);
+        OtherDocuments otherDocuments = this.getOne(queryWrapper, false);
+        OtherDocumentsVO otherDocumentsVO = new OtherDocumentsVO();
+        if (otherDocuments != null) {
+            BeanUtils.copyProperties(otherDocuments, otherDocumentsVO);
+            otherDocumentsVO.setDocumentId(otherDocuments.getId());
+        }
+        ReportAffair reportAffair = reportAffairService.getById(reportAffairId);
+        otherDocumentsVO.setDocumentTime(reportAffair.getOccurredTime());
+        otherDocumentsVO.setDescription(reportAffair.getDescription());
+        otherDocumentsVO.setProjectId(reportAffair.getProjectId());
+        return otherDocumentsVO;
+    }
+}

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

@@ -12,6 +12,7 @@ import cn.cslg.pas.common.utils.StringUtils;
 import cn.cslg.pas.common.vo.business.OtherReferencesVO;
 import cn.cslg.pas.domain.business.AssoOtherPatentInfoFile;
 import cn.cslg.pas.domain.business.OtherReferences;
+import cn.cslg.pas.domain.business.ReviewHistory;
 import cn.cslg.pas.exception.XiaoShiException;
 import cn.cslg.pas.mapper.OtherReferencesMapper;
 import cn.cslg.pas.service.common.FileManagerService;
@@ -89,6 +90,7 @@ public class OtherReferencesService extends ServiceImpl<OtherReferencesMapper, O
                 throw new XiaoShiException("未查询到当前登陆人");
             }
             otherReferences.setCreateId(personnelVO.getId());
+            otherReferences.setTenantId(personnelVO.getTenantId());
             otherReferences.insert();
             if (fileGuids != null && !fileGuids.isEmpty()) {
                 //先删除 后添加
@@ -137,9 +139,15 @@ public class OtherReferencesService extends ServiceImpl<OtherReferencesMapper, O
         Integer current = otherPatentInfoDTO.getCurrent();
         Integer size = otherPatentInfoDTO.getSize();
         Page<OtherReferences> page = new Page<>(current, size);
-
+        PersonnelVO personnelVO = new PersonnelVO();
+        try {
+            personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+        } catch (Exception e) {
+            throw new XiaoShiException("未查询到当前登陆人");
+        }
         LambdaQueryWrapper<OtherReferences> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(OtherReferences::getPatentNo, patentNo);
+        queryWrapper.eq(OtherReferences::getPatentNo, patentNo)
+                .eq(OtherReferences::getTenantId, personnelVO.getTenantId());
         IPage<OtherReferences> otherReferencesPage = this.page(page, queryWrapper);
         List<OtherReferences> otherReferencesList = otherReferencesPage.getRecords();
         long total = otherReferencesPage.getTotal();

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

@@ -515,7 +515,7 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
             rootSql ="category.create_id="+id+" or(category.show_type =0 and category.tenant ="+tenantId+") or ( category.id in (select product_category_id from asso_product_category_person where" +
                     " person_id="+id+" and role=0)) or (category.show_type=2 and  category.id in (select product_category_id from asso_product_category_person where" +
                     " person_id="+id+" and role=1)) or(category.show_type =3 and category.id not in(select product_category_id from asso_product_category_person where" +
-                    " person_id="+id+" and role=2))";
+                    " person_id="+id+" and role=2) and category.tenant="+tenantId+")";
 
         }
         else if(roleType.equals(2))

+ 1 - 2
src/main/java/cn/cslg/pas/service/business/ProductService.java

@@ -540,7 +540,6 @@ public class ProductService extends ServiceImpl<ProductMapper, Product> implemen
     }
 
     //装载查询语句
-    //装载查询语句
     private List<String> loadSearchSql(List<String> sqls) {
         PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
         String id =personnelVO.getId();
@@ -551,7 +550,7 @@ public class ProductService extends ServiceImpl<ProductMapper, Product> implemen
             rootSql = "product.create_id=" + id + " or(product.show_type =0 and product.tenant_id =" + tenantId + ") or ( product.id in (select product_id from asso_product_person where" +
                     " person_id=" + id + " and role=0)) or (product.show_type=2 and  product.id in (select product_id from asso_product_person where" +
                     " person_id=" + id + " and role=1)) or(product.show_type =3 and product.id not in(select product_id from asso_product_person where" +
-                    " person_id=" + id + " and role=2))";
+                    " person_id=" + id + " and role=2) and product.tenant_id=" + tenantId + ")";
 
         }
         else if(roleType.equals(2))

+ 19 - 0
src/main/java/cn/cslg/pas/service/business/ReportAffairService.java

@@ -59,6 +59,9 @@ public class ReportAffairService extends ServiceImpl<ReportAffairMapper, ReportA
     @Autowired
     @Lazy
     private AdminProceedService adminProceedService;
+    @Autowired
+    @Lazy
+    private OtherDocumentsService otherDocumentsService;
 
     /**
      * 创建报告事务
@@ -105,6 +108,10 @@ public class ReportAffairService extends ServiceImpl<ReportAffairMapper, ReportA
                     LambdaQueryWrapper<InvalidDecisionFile> queryWrapper1 = new LambdaQueryWrapper<>();
                     queryWrapper1.eq(InvalidDecisionFile::getReportAffairId, id);
                     invalidDecisionFileService.remove(queryWrapper1);
+                } else if (reportAffair.getAffairType().equals(8)) {//其他文档
+                    LambdaQueryWrapper<OtherDocuments> queryWrapper1 = new LambdaQueryWrapper<>();
+                    queryWrapper1.eq(OtherDocuments::getReportAffairId, id);
+                    otherDocumentsService.remove(queryWrapper1);
                 }
                 this.removeById(id);
             }
@@ -159,6 +166,8 @@ public class ReportAffairService extends ServiceImpl<ReportAffairMapper, ReportA
                 this.loadClaimHistory(reportAffairVO);
             } else if (type.equals(7)) {//7 补充证据及理由
                 this.loadSupplyEvidence(reportAffairVO);
+            } else if (type.equals(8)) {//8 其他文档
+                this.loadOtherDocuments(reportAffairVO);
             }
             reportAffairVOS.add(reportAffairVO);
         });
@@ -550,4 +559,14 @@ public class ReportAffairService extends ServiceImpl<ReportAffairMapper, ReportA
         reportAffairVO.setSupplyEvidenceVO(supplyEvidenceVO);
     }
 
+    /**
+     * 装载其他文档
+     * @param reportAffairVO
+     */
+    public void loadOtherDocuments(ReportAffairVO reportAffairVO) {
+        Integer reportAffairId = reportAffairVO.getId();
+        OtherDocumentsVO otherDocumentsVO = otherDocumentsService.getOtherDocuments(reportAffairId);
+        reportAffairVO.setOtherDocumentsVO(otherDocumentsVO);
+    }
+
 }

+ 8 - 1
src/main/java/cn/cslg/pas/service/business/ReviewHistoryService.java

@@ -33,6 +33,7 @@ import java.util.List;
 import java.util.stream.Collectors;
 
 /**
+ * 审查历史
  * @Author xiexiang
  * @Date 2024/1/15
  */
@@ -118,9 +119,15 @@ public class ReviewHistoryService extends ServiceImpl<ReviewHistoryMapper, Revie
         Integer current = otherPatentInfoDTO.getCurrent();
         Integer size = otherPatentInfoDTO.getSize();
         Page<ReviewHistory> page = new Page<>(current, size);
-
+        PersonnelVO personnelVO = new PersonnelVO();
+        try {
+            personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+        } catch (Exception e) {
+            throw new XiaoShiException("未查询到当前登陆人");
+        }
         LambdaQueryWrapper<ReviewHistory> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(ReviewHistory::getPatentNo, patentNo)
+                .eq(ReviewHistory::getTenantId, personnelVO.getTenantId())
                 .orderByDesc(ReviewHistory::getCreateTime);
         IPage<ReviewHistory> reviewHistoryPage = this.page(page, queryWrapper);
         List<ReviewHistory> reviewHistories = reviewHistoryPage.getRecords();

+ 67 - 43
src/main/java/cn/cslg/pas/service/business/es/EsCountService.java

@@ -1,5 +1,6 @@
 package cn.cslg.pas.service.business.es;
 
+import cn.cslg.pas.common.dto.GetUnselectedDTO;
 import cn.cslg.pas.common.dto.business.EsCountDTO;
 import cn.cslg.pas.common.dto.business.EsCountDetailDTO;
 import cn.cslg.pas.common.dto.es.EsCustomFieldValueDTO;
@@ -18,7 +19,9 @@ import cn.cslg.pas.service.business.CommonService;
 import cn.cslg.pas.service.query.FormatQueryService;
 import co.elastic.clients.elasticsearch.ElasticsearchClient;
 import co.elastic.clients.elasticsearch._types.aggregations.*;
+import co.elastic.clients.elasticsearch._types.query_dsl.IdsQuery;
 import co.elastic.clients.elasticsearch._types.query_dsl.Query;
+import co.elastic.clients.elasticsearch._types.query_dsl.QueryBuilders;
 import co.elastic.clients.elasticsearch.core.SearchRequest;
 import co.elastic.clients.elasticsearch.core.SearchResponse;
 import co.elastic.clients.elasticsearch.core.search.Hit;
@@ -30,6 +33,7 @@ import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
+import java.io.IOException;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.*;
@@ -157,7 +161,7 @@ public class EsCountService {
         }
 
         if (!CollectionUtils.isEmpty(customFields)) {
-            searchCondition = esService.parseCustomField(customFields);
+            searchCondition = esService.parseCustomField(customFields,projectId,taskId);
         }
 
         searchCondition = this.getCondition(searchCondition, taskId, projectId);
@@ -260,7 +264,11 @@ public class EsCountService {
                             Integer finalFieldType = fieldType;
                             filtersBuckets.forEach(filtersBucket -> {
                                 Aggregate filtersAgg = filtersBucket.aggregations().get("filters_agg");
-                                this.getChildCountDTOS(filtersAgg, field, finalFieldType, topN, detailDTOS, esCountDTO);
+                                try {
+                                    this.getChildCountDTOS(filtersAgg, field, finalFieldType, topN, detailDTOS, esCountDTO,projectId,taskId);
+                                } catch (Exception e) {
+                                    e.printStackTrace();
+                                }
                             });
                         } else {
                             Integer finalFieldType1 = fieldType;
@@ -311,7 +319,7 @@ public class EsCountService {
                     }
                 } else if (childList.contains(field)) {
                     if (CollectionUtils.isEmpty(values)) {
-                        this.getChildCountDTOS(agg, field, fieldType, topN, detailDTOS, esCountDTO);
+                        this.getChildCountDTOS(agg, field, fieldType, topN, detailDTOS, esCountDTO, projectId, taskId);
                     } else {
                         this.getChildAnalysisDTOS(agg, field, fieldType, topN,
                                 detailDTOS, esCountDTO, firstName, map, values);
@@ -332,7 +340,7 @@ public class EsCountService {
         String field = rangeVO.getField();
         List<EsCustomFieldValueDTO> customFields = rangeVO.getCustomFields();
         if (!CollectionUtils.isEmpty(customFields)) {
-            searchCondition = esService.parseCustomField(customFields);
+            searchCondition = esService.parseCustomField(customFields, rangeVO.getProjectId(), rangeVO.getTaskId());
         }
         Integer taskId = rangeVO.getTaskId();
         Integer projectId = rangeVO.getProjectId();
@@ -586,7 +594,7 @@ public class EsCountService {
      * @param detailDTOS
      */
     public void getChildCountDTOS(Aggregate agg, String field, Integer fieldType, Integer topN,
-                                  List<EsCountDetailDTO> detailDTOS, EsCountDTO esCountDTO) {
+                                  List<EsCountDetailDTO> detailDTOS, EsCountDTO esCountDTO,Integer projectId, Integer taskId) throws Exception {
         esCountDTO.setAllNumber(agg.children().docCount());
         Aggregate childAgg = agg.children().aggregations().get("childAgg");
         List<StringTermsBucket> list = childAgg.sterms().buckets().array();
@@ -605,47 +613,77 @@ public class EsCountService {
                     dto.setTopN(topN);
                     if (dto.getNumber() > 0) {
                         detailDTOS.add(dto);
-                        if (fieldType == null || fieldType != 6) {
-                            Long docCount = aggregate.sterms().sumOtherDocCount();
-                            EsCountDetailDTO detail = new EsCountDetailDTO();
-                            detail.setField(field);
-                            detail.setName("未选择");
-                            detail.setNumber(docCount);
-                            detail.setTopN(topN);
-                            if (!detailDTOS.contains(detail)) {
-                                detailDTOS.add(detail);
-                            }
-                        }
                     }
                 }
             });
         });
+        if (fieldType == null || fieldType != 6) {
+            GetUnselectedDTO unselectedDTO = this.getUnselectedCustomNum(projectId, taskId);
+            EsCountDetailDTO detail = new EsCountDetailDTO();
+            detail.setField(field);
+            detail.setName("未选择");
+            detail.setNumber(unselectedDTO.getNumber().longValue());
+            detail.setTopN(topN);
+            if (!detailDTOS.contains(detail)) {
+                detailDTOS.add(detail);
+            }
+        }
     }
 
-    public Integer getUnselectedCustomNum(Integer projectId,Integer taskId) throws Exception {
-        String condition = "";
-        if (taskId != null) {
-            condition = "taskId = " + taskId;
-        } else {
-            condition = "projectId = " + projectId;
-        }
+    public GetUnselectedDTO getUnselectedCustomNum(Integer projectId, Integer taskId) throws Exception {
+        GetUnselectedDTO dto = new GetUnselectedDTO();
         SearchRequest.Builder builder = new SearchRequest.Builder();
         //设置查询索引
         builder.index("patent");
-        treeNode tree = expressManager.getInstance().Parse(condition, false);
-        //格式化检索式
-        //3. 从es中检索数据
-        Query q = formatQueryService.EsQueryToQuery((operateNode) tree, "patent");
+        Query q = null;
+        if (taskId != null) {
+            Query query = QueryBuilders.term(i -> i.field("project_task.task_id").value(taskId));
+            q = QueryBuilders.hasChild(i -> i.type("task").query(query));
+        } else {
+            Query query = QueryBuilders.term(i -> i.field("project_id").value(projectId));
+            q = QueryBuilders.hasChild(i -> i.type("project").query(query));
+        }
+        builder.size(9999);
         builder.query(q);
         SearchResponse<Patent> response = client.search(builder.build(), Patent.class);
         List<Hit<Patent>> hits = response.hits().hits();
-        Long total = response.hits().total().value();
         List<String> list = new ArrayList<>();
         for (Hit<Patent> hit : hits) {
             String id = hit.id();
             list.add(id);
         }
-        return null;
+        if (!CollectionUtils.isEmpty(list)) {
+            dto = this.ifExistChild(list);
+        }
+        return dto;
+    }
+
+    public GetUnselectedDTO ifExistChild(List<String> list) throws IOException {
+        GetUnselectedDTO dto = new GetUnselectedDTO();
+        List<String> existChildIds = new ArrayList<>();
+        List<String> beinglessChildIds = new ArrayList<>();
+        int count = 0;
+        for (String id : list) {
+            SearchRequest.Builder builder = new SearchRequest.Builder();
+            //设置查询索引
+            builder.index("patent");
+            Query q1 = QueryBuilders.parentId(i -> i.type("project_customfield").id(id));
+            Query q2 = QueryBuilders.exists(i -> i.field("custom_field"));
+            Query bool = QueryBuilders.bool(i -> i.must(q1, q2));
+            builder.query(bool);
+            SearchResponse<Patent> response = client.search(builder.build(), Patent.class);
+            Long total = response.hits().total().value();
+            if (total > 0) {
+                existChildIds.add(id);
+            } else {
+                beinglessChildIds.add(id);
+                count++;
+            }
+        }
+        dto.setNumber(count);
+        dto.setExistChildIds(existChildIds);
+        dto.setBeinglessChildIds(beinglessChildIds);
+        return dto;
     }
 
     /**
@@ -684,20 +722,6 @@ public class EsCountService {
                         countDetailDTOS.add(detail);
                     }
                 }
-//                if (dto.getNumber() > 0) {
-//                    detailDTOS.add(dto);
-//                    if (fieldType == null || fieldType != 6) {
-//                        Long docCount = aggregate.sterms().sumOtherDocCount();
-//                        EsCountDetailDTO detail = new EsCountDetailDTO();
-//                        detail.setField(field);
-//                        detail.setName("未选择");
-//                        detail.setNumber(docCount);
-//                        detail.setTopN(topN);
-//                        if (!detailDTOS.contains(detail)) {
-//                            detailDTOS.add(detail);
-//                        }
-//                    }
-//                }
             });
         });
 

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

@@ -333,7 +333,7 @@ public class EsCustomFieldService {
         }
         List<EsCustomFieldValueDTO> customFields = vo.getCustomFields();
         if (!CollectionUtils.isEmpty(customFields)) {
-            searchCondition = esService.parseCustomField(customFields);
+            searchCondition = esService.parseCustomField(customFields,projectId,taskId);
         }
         if (taskId != null) {
             if (searchCondition != null && !"".equals(searchCondition.trim())) {

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

@@ -128,6 +128,9 @@ public class EsPatentService {
             if (!CollectionUtils.isEmpty(esMess.getInventor())) {
                 dto.setInventor(this.loadName(esMess.getInventor()));
             }
+            if (esMess.getPatentNo().equals(vo.getPatentNo())) {
+                break;
+            }
         }
         dto.setPictureGuid(FormatUtil.getPictureFormat(dto.getAppNo()));
         List<LegalEvent> legalEvents = this.getLegalEvents(dto.getPatentNo());

+ 72 - 9
src/main/java/cn/cslg/pas/service/business/es/EsService.java

@@ -1,6 +1,7 @@
 package cn.cslg.pas.service.business.es;
 
 import cn.cslg.pas.common.core.base.IfConstant;
+import cn.cslg.pas.common.dto.GetUnselectedDTO;
 import cn.cslg.pas.common.dto.PatentColumnDTO;
 import cn.cslg.pas.common.dto.PatentDTO;
 //import cn.cslg.pas.common.dto.business.EsPatentFamilyDTO;
@@ -61,6 +62,9 @@ public class EsService {
     private PatentStarApiService patentStarApiService;
     @Autowired
     private EsPatentService esPatentService;
+    @Lazy
+    @Autowired
+    private EsCountService esCountService;
 
 
     /**
@@ -158,7 +162,7 @@ public class EsService {
         }
         List<EsCustomFieldValueDTO> customFields = queryRequest.getCustomFields();
         if (!CollectionUtils.isEmpty(customFields)) {
-            searchCondition = this.parseCustomField(customFields);
+            searchCondition = this.parseCustomField(customFields,projectId,taskId);
         }
         if (taskId != null) {
             if (searchCondition != null && !"".equals(searchCondition.trim())) {
@@ -388,7 +392,7 @@ public class EsService {
      * @param customFields
      * @return
      */
-    public String parseCustomField(List<EsCustomFieldValueDTO> customFields) {
+    public String parseCustomField(List<EsCustomFieldValueDTO> customFields, Integer projectId, Integer taskId) throws Exception {
         int m = 1;
         int n = 0;
         StringBuilder builder = new StringBuilder();
@@ -398,10 +402,10 @@ public class EsService {
                 EsCustomFieldValueDTO customField = customFields.get(i);
                 if (i != n) {
                     builder.append(" ").append("and").append(" ").append("(");
-                    this.appendStr(customField, builder, m, customField.getIfHaveChild());
+                    this.appendStr(customField, builder, m, customField.getIfHaveChild(), projectId, taskId);
                 } else {
                     builder.append("(");
-                    this.appendStr(customField, builder, m, customField.getIfHaveChild());
+                    this.appendStr(customField, builder, m, customField.getIfHaveChild(), projectId, taskId);
                 }
             }
         } else {
@@ -409,10 +413,10 @@ public class EsService {
                 EsCustomFieldValueDTO customField = customFields.get(i);
                 if (i != n) {
                     builder.append(" ").append("and").append(" ");
-                    this.appendStr(customField, builder, m, customField.getIfHaveChild());
+                    this.appendStr(customField, builder, m, customField.getIfHaveChild(), projectId, taskId);
                 } else {
                     builder.append("(");
-                    this.appendStr(customField, builder, m, customField.getIfHaveChild());
+                    this.appendStr(customField, builder, m, customField.getIfHaveChild(), projectId, taskId);
                 }
             }
         }
@@ -422,9 +426,14 @@ public class EsService {
         return builder.toString();
     }
 
-    public void appendStr(EsCustomFieldValueDTO customField, StringBuilder builder, int m, boolean ifHaveChild) {
+    public void appendStr(EsCustomFieldValueDTO customField, StringBuilder builder, int m, boolean ifHaveChild,
+                          Integer projectId, Integer taskId) throws Exception {
         builder.append("field").append("=").append(customField.getFieldId());
         List<String> values = customField.getFieldValue();
+        if (values.contains("未选择")) {
+            values.removeIf(value -> value.equals("未选择"));
+            values.add("未选择");
+        }
         if (!CollectionUtils.isEmpty(values)) {
             builder.append(" ").append("and").append(" ");
             if (ifHaveChild) {
@@ -440,12 +449,29 @@ public class EsService {
                     if (j != values.size() - m) {
                         builder.append(s).append(" ").append("or").append(" ");
                     } else {
-                        builder.append(s).append(")").append(")");
+                        if (s.equals("未选择")) {
+                            GetUnselectedDTO unselectedDTO = esCountService.getUnselectedCustomNum(projectId, taskId);
+                            List<String> childIds = unselectedDTO.getBeinglessChildIds();
+                            List<String> nos = this.getPatentNos(childIds);
+                            String noCondition = this.appendPatentNo(nos);
+                            builder.append(s).append(")").append(" ").append("or")
+                                    .append(" ").append("(").append(noCondition).append(")").append(")");
+                        } else {
+                            builder.append(s).append(")").append(")");
+                        }
                     }
                 }
             } else {
                 for (String value : values) {
-                    builder.append(value).append(")");
+                    if (value.equals("未选择")) {
+                        GetUnselectedDTO unselectedDTO = esCountService.getUnselectedCustomNum(projectId, taskId);
+                        List<String> childIds = unselectedDTO.getBeinglessChildIds();
+                        List<String> nos = this.getPatentNos(childIds);
+                        String noCondition = this.appendPatentNo(nos);
+                        builder.append(value).append(" ").append("or").append(" ").append(noCondition).append(")");
+                    } else {
+                        builder.append(value).append(")");
+                    }
                 }
             }
         } else {
@@ -1338,6 +1364,43 @@ public class EsService {
         }
         return null;
     }
+
+    public List<String> getPatentNos(List<String> ids) throws IOException {
+        SearchRequest.Builder builder = new SearchRequest.Builder();
+        //设置查询索引
+        builder.index("patent");
+        Query q = QueryBuilders.ids(i -> i.values(ids));
+        builder.size(9999);
+        builder.query(q);
+        SearchResponse<Patent> response = client.search(builder.build(), Patent.class);
+        List<Hit<Patent>> hits = response.hits().hits();
+        List<String> list = new ArrayList<>();
+        for (Hit<Patent> hit : hits) {
+            Patent patent = hit.source();
+            list.add(patent.getPatentNo());
+        }
+        return list;
+    }
+
+    public String appendPatentNo(List<String> nos) {
+        String str = "NO = ";
+        if (nos.size() > 1) {
+            str = str + "(";
+            for (int i = 0; i < nos.size(); i++) {
+                String s = nos.get(i);
+                if (i != nos.size() - 1) {
+                    str = str + s + " " + "OR" + " ";
+                } else {
+                    str = str + s + ")";
+                }
+            }
+        } else {
+            for (String no : nos) {
+                str = str + no;
+            }
+        }
+        return str;
+    }
 }
 
 

+ 43 - 13
src/main/java/cn/cslg/pas/service/business/es/EsValueCurveService.java

@@ -4,18 +4,25 @@ import cn.cslg.pas.common.core.base.IfConstant;
 import cn.cslg.pas.common.dto.es.EsCustomFieldValueDTO;
 import cn.cslg.pas.common.dto.es.EsValueCurveDTO;
 import cn.cslg.pas.common.dto.es.SelectValueCurveDTO;
+import cn.cslg.pas.common.model.cronModel.PersonnelVO;
 import cn.cslg.pas.common.model.cronModel.Records;
 import cn.cslg.pas.common.model.request.OrderDTO;
+import cn.cslg.pas.common.utils.CacheUtils;
+import cn.cslg.pas.common.utils.LoginUtils;
 import cn.cslg.pas.common.utils.parseQueryToTree.expressManager;
 import cn.cslg.pas.common.utils.parseQueryToTree.operateNode;
 import cn.cslg.pas.common.utils.parseQueryToTree.treeNode;
 import cn.cslg.pas.common.vo.EsConfigVO;
 import cn.cslg.pas.common.vo.es.EsCustomFieldBatchVO;
 import cn.cslg.pas.common.vo.es.EsValueCurveVO;
+import cn.cslg.pas.domain.BaseEntity;
 import cn.cslg.pas.domain.business.PermissionRecord;
+import cn.cslg.pas.domain.business.Product;
 import cn.cslg.pas.domain.business.ProductMarketData;
 import cn.cslg.pas.domain.es.Patent;
+import cn.cslg.pas.exception.XiaoShiException;
 import cn.cslg.pas.mapper.PermissionRecordMapper;
+import cn.cslg.pas.mapper.ProductMapper;
 import cn.cslg.pas.mapper.ProductMarketDataMapper;
 import cn.cslg.pas.service.business.CommonService;
 import cn.cslg.pas.service.query.FormatQueryService;
@@ -51,6 +58,12 @@ public class EsValueCurveService {
     private final ElasticsearchClient client;
 
     @Autowired
+    private CacheUtils cacheUtils;
+
+    @Autowired
+    private LoginUtils loginUtils;
+
+    @Autowired
     private EsService esService;
 
     @Autowired
@@ -62,6 +75,9 @@ public class EsValueCurveService {
     @Autowired
     private PermissionRecordMapper permissionRecordMapper;
 
+    @Autowired
+    private ProductMapper productMapper;
+
     /**
      * 查询价值曲线
      * @param vo
@@ -74,31 +90,40 @@ public class EsValueCurveService {
         Integer startNum = vo.getStartNumber();
         Integer endNum = vo.getEndNumber();
         Integer timeType = vo.getTimeType();
+        //获取登陆人信息 用于设置创建人
+        PersonnelVO personnelVO = new PersonnelVO();
+        try {
+            personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+        } catch (Exception e) {
+            throw new XiaoShiException("未登录");
+        }
+        Integer tenantId = personnelVO.getTenantId();
         Map<String, List<Integer>> map = new HashMap<>();
         if (!CollectionUtils.isEmpty(isAdd) && startNum <= 1 && endNum < 1) {
             isAdd.removeAll(isDel);
-            map = this.getProductIdByPatentNo(isAdd);
+            map = this.getProductIdByPatentNo(isAdd,tenantId);
         } else if (startNum >= 1 && endNum > 0) {
             List<String> patentNos = this.getPatentNos(vo);
-            map = this.getProductIdByPatentNo(patentNos);
+            map = this.getProductIdByPatentNo(patentNos,tenantId);
         }
-        return this.getValueCurveList(map, timeType);
+        return this.getValueCurveList(map, timeType,tenantId);
     }
 
     /**
      * 提取返回数据
+     *
      * @param map
      * @param timeType
      * @return
      */
-    public List<EsValueCurveDTO> getValueCurveList(Map<String, List<Integer>> map, Integer timeType) {
+    public List<EsValueCurveDTO> getValueCurveList(Map<String, List<Integer>> map, Integer timeType, Integer tenantId) {
         List<EsValueCurveDTO> curveDTOS = new ArrayList<>();
         if (!CollectionUtils.isEmpty(map)) {
             for (String patentNo : map.keySet()) {
                 List<SelectValueCurveDTO> listLicensee = new ArrayList<>();
                 List<SelectValueCurveDTO> listSale = new ArrayList<>();
                 //获取许可记录
-                List<SelectValueCurveDTO> licenseeList = this.selectLicensee(patentNo, timeType);
+                List<SelectValueCurveDTO> licenseeList = this.selectLicensee(patentNo, timeType,tenantId);
                 if (!CollectionUtils.isEmpty(licenseeList)) {
                     Map<String, List<SelectValueCurveDTO>> licenseeMap = licenseeList.stream().collect(Collectors.groupingBy(SelectValueCurveDTO::getLicenseTime));
                     for (String key : licenseeMap.keySet()) {
@@ -250,7 +275,7 @@ public class EsValueCurveService {
             if (!CollectionUtils.isEmpty(curveDTOS)) {
                 curveDTOS.forEach(i -> i.setTimeType(timeType));
             }
-        } else if (timeType == 0) {
+        } else if (timeType == 2) {
             curveDTOS = productMarketDataMapper.selectSaleYearList(productIds);
             if (!CollectionUtils.isEmpty(curveDTOS)) {
                 curveDTOS.forEach(i -> i.setTimeType(timeType));
@@ -270,20 +295,20 @@ public class EsValueCurveService {
      * @param timeType
      * @return
      */
-    public List<SelectValueCurveDTO> selectLicensee(String patentNo, Integer timeType) {
+    public List<SelectValueCurveDTO> selectLicensee(String patentNo, Integer timeType,Integer tenantId) {
         List<SelectValueCurveDTO> curveDTOS = new ArrayList<>();
         if (timeType == 0) {
-            curveDTOS = permissionRecordMapper.selectLicenseeMonthList(patentNo);
+            curveDTOS = permissionRecordMapper.selectLicenseeMonthList(patentNo,tenantId);
             if (!CollectionUtils.isEmpty(curveDTOS)) {
                 curveDTOS.forEach(i -> i.setTimeType(timeType));
             }
         } else if (timeType == 2) {
-            curveDTOS = permissionRecordMapper.selectLicenseeYearList(patentNo);
+            curveDTOS = permissionRecordMapper.selectLicenseeYearList(patentNo,tenantId);
             if (!CollectionUtils.isEmpty(curveDTOS)) {
                 curveDTOS.forEach(i -> i.setTimeType(timeType));
             }
         } else {
-            curveDTOS = permissionRecordMapper.selectLicenseeQuarterList(patentNo);
+            curveDTOS = permissionRecordMapper.selectLicenseeQuarterList(patentNo,tenantId);
             if (!CollectionUtils.isEmpty(curveDTOS)) {
                 curveDTOS.forEach(i -> i.setTimeType(timeType));
             }
@@ -317,7 +342,7 @@ public class EsValueCurveService {
         }
         List<EsCustomFieldValueDTO> customFields = vo.getCustomFields();
         if (!CollectionUtils.isEmpty(customFields)) {
-            searchCondition = esService.parseCustomField(customFields);
+            searchCondition = esService.parseCustomField(customFields, projectId, taskId);
         }
         if (taskId != null) {
             if (searchCondition != null && !"".equals(searchCondition.trim())) {
@@ -391,7 +416,7 @@ public class EsValueCurveService {
      * @return
      * @throws IOException
      */
-    public Map<String, List<Integer>> getProductIdByPatentNo(List<String> list) throws IOException {
+    public Map<String, List<Integer>> getProductIdByPatentNo(List<String> list,Integer tenantId) throws IOException {
         Map<String, List<Integer>> map = new HashMap<>();
         if (!CollectionUtils.isEmpty(list)) {
             for (String patentNo : list) {
@@ -419,8 +444,13 @@ public class EsValueCurveService {
                         productIds.add(patent.getProductId());
                     }
                 }
+                List<Integer> ids = new ArrayList<>();
                 List<Integer> collect = productIds.stream().distinct().collect(Collectors.toList());
-                map.put(patentNo, collect);
+                List<Product> products = productMapper.selectBatchIds(collect);
+                if (!CollectionUtils.isEmpty(products)) {
+                    ids = products.stream().filter(i -> i.getTenantId().equals(tenantId)).map(BaseEntity::getId).collect(Collectors.toList());
+                }
+                map.put(patentNo, ids);
             }
         }
         return map;

+ 2 - 2
src/main/resources/jsons/patent.json

@@ -326,7 +326,7 @@
     "value": "agency",
     "field": "AGN",
     "esField": "agency.key",
-    "esClass": "wildcardQueryBuilder",
+    "esClass": "termOrWildcardQueryBuilder",
     "ifSearch": "true",
     "ifGroup": "true",
     "ifShow": "true",
@@ -341,7 +341,7 @@
     "value": "agent",
     "field": "AG",
     "esField": "agent.key",
-    "esClass": "wildcardQueryBuilder",
+    "esClass": "termOrWildcardQueryBuilder",
     "ifSearch": "true",
     "ifGroup": "true",
     "ifShow": "true",

+ 3 - 3
src/main/resources/mapper/PermissionRecordMapper.xml

@@ -6,7 +6,7 @@
         select sum(license_fee) as licenseFee,
                DATE_FORMAT(license_time, '%Y-%m') as licenseTime
         from permission_record
-        where patent_no = #{patentNo}
+        where patent_no = #{patentNo} and tenant_id = #{tenantId}
         group by licenseTime;
     </select>
 
@@ -14,7 +14,7 @@
         select sum(license_fee) as licenseFee,
                CONCAT(DATE_FORMAT(license_time, '%Y'),'年') as licenseTime
         from permission_record
-        where patent_no = #{patentNo}
+        where patent_no = #{patentNo} and tenant_id = #{tenantId}
         group by licenseTime;
     </select>
 
@@ -22,7 +22,7 @@
         select sum(license_fee) as licenseFee,
                CONCAT(YEAR(license_time),'年第',quarter(license_time),'季度') as licenseTime
         from permission_record
-        where patent_no = #{patentNo}
+        where patent_no = #{patentNo} and tenant_id = #{tenantId}
         group by licenseTime;
     </select>
 </mapper>

+ 5 - 2
src/main/resources/mapper/ProductMarketDataMapper.xml

@@ -55,12 +55,13 @@
         from pas_prod2.product_market_data
         <where>
             <if test="productIds != null and productIds.size > 0">
+                product_id in
                 <foreach collection="productIds" item="productId" index="index" open="(" separator="," close=")">
                     #{productId}
                 </foreach>
             </if>
         </where>
-        group by DATE_FORMAT(sale_time, '%Y-%m');
+        group by saleTime;
     </select>
 
     <select id="selectSaleYearList" resultType="cn.cslg.pas.common.dto.es.SelectValueCurveDTO">
@@ -71,12 +72,13 @@
                from pas_prod2.product_market_data
         <where>
             <if test="productIds != null and productIds.size > 0">
+                product_id in
                 <foreach collection="productIds" item="productId" index="index" open="(" separator="," close=")">
                     #{productId}
                 </foreach>
             </if>
         </where>
-        group by DATE_FORMAT(sale_time, '%Y');
+        group by saleTime;
     </select>
 
     <select id="selectSaleQuarterList" resultType="cn.cslg.pas.common.dto.es.SelectValueCurveDTO">
@@ -87,6 +89,7 @@
                from pas_prod2.product_market_data
         <where>
             <if test="productIds != null and productIds.size > 0">
+                product_id in
                 <foreach collection="productIds" item="productId" index="index" open="(" separator="," close=")">
                     #{productId}
                 </foreach>

+ 12 - 5
src/test/java/cn/cslg/pas/service/EventServiceTests.java

@@ -36,6 +36,7 @@ import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.mock.web.MockMultipartFile;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.io.File;
@@ -303,7 +304,7 @@ public class EventServiceTests {
     }
 
     @Test
-    void test16() {
+    void test16() throws Exception {
         List<EsCustomFieldValueDTO> customFields = new ArrayList<>();
         EsCustomFieldValueDTO dto1 = new EsCustomFieldValueDTO();
         dto1.setFieldId("1");
@@ -313,7 +314,7 @@ public class EventServiceTests {
         dto2.setFieldValue(Arrays.asList("a"));
         customFields.add(dto1);
         customFields.add(dto2);
-        String s = esService.parseCustomField(customFields);
+        String s = esService.parseCustomField(customFields,null,null);
         System.out.println("结果为:" + s);
         System.out.println("-----------------------------");
         List<EsCustomFieldValueDTO> fields = new ArrayList<>();
@@ -503,8 +504,14 @@ public class EventServiceTests {
 
     @Test
     public void test103() throws IOException {
-        List<String> fms = Arrays.asList("CN200880110903.8_p");
-        String systemFileFromFMS = fileManagerService.getSystemFileFromFMS(fms);
-        System.out.println(systemFileFromFMS);
+        List<String> values = new ArrayList<>();
+        values.add("48");
+        values.add("45");
+        values.add("未选择");
+        values.add("Test测试");
+        values.removeIf(value -> value.equals("未选择"));
+
+        System.out.println(values);
+
     }
 }