Prechádzať zdrojové kódy

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	RMS/src/main/java/cn/cslg/report/service/business/ReportFieldService.java
lwhhszx 2 rokov pred
rodič
commit
dff6506401

+ 1 - 0
RMS/src/main/java/cn/cslg/report/common/model/vo/PatentQueryFieldSourceVO.java

@@ -19,4 +19,5 @@ public class PatentQueryFieldSourceVO extends BaseVO {
     private Integer applicantStatus;
     private Integer customFieldId;
     private Integer customFieldTreeType;
+    private String patentNo;
 }

+ 12 - 0
RMS/src/main/java/cn/cslg/report/controller/PatentFiledController.java

@@ -107,4 +107,16 @@ public class PatentFiledController {
     public String getPatentQuerySourcePageList(@RequestBody PatentQueryFieldSourceVO params) {
         return Response.success(reportFieldService.getPatentQuerySourcePageList(params));
     }
+    @PostMapping("/query/PatentQueryFieldSourceVO")
+    @Operation(summary ="查询相关的报告交集和并集")
+    public String getPatent(@RequestBody List<PatentQueryFieldSourceVO> params ) throws IOException {
+       return Response.success(reportFieldService.getPatent(params));
+    }
+    @GetMapping("/getPatentField")
+    @Operation(summary ="模糊查询自定义字段")
+    public String getPatentField( int filedId ,String name)throws IOException{
+      return reportFieldService.getReportField(filedId, name);
+
+    }
+
 }

+ 4 - 0
RMS/src/main/java/cn/cslg/report/mapper/ReportFieldTextMapper.java

@@ -2,6 +2,9 @@ package cn.cslg.report.mapper;
 
 import cn.cslg.report.entity.ReportFieldText;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * <p>
@@ -13,4 +16,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface ReportFieldTextMapper extends BaseMapper<ReportFieldText> {
 
+
 }

+ 189 - 1
RMS/src/main/java/cn/cslg/report/service/business/ReportFieldService.java

@@ -1,5 +1,6 @@
 package cn.cslg.report.service.business;
 
+import cn.cslg.report.common.model.BaseEntity;
 import cn.cslg.report.common.model.dto.PatentQueryFieldSourceDTO;
 import cn.cslg.report.common.model.vo.PatentField;
 import cn.cslg.report.common.model.vo.PatentQueryFieldSourceVO;
@@ -42,6 +43,8 @@ public class ReportFieldService extends ServiceImpl<ReportFieldMapper, ReportFie
  private  final ReportFieldOptionService reportFieldOptionService;
  private  final ReportFieldTreeService reportFieldTreeService;
  private  final ReportFieldPatentLinkService reportFieldPatentLinkService;
+
+
     public String add(ReportField reportField) {
         ReportField temp = this.getProjectFieldByName(reportField.getName(), reportField.getReportId());
         if (temp != null) {
@@ -214,7 +217,11 @@ public class ReportFieldService extends ServiceImpl<ReportFieldMapper, ReportFie
         //根据fieldId 从patent_field中获得 自定义字段对象
         LambdaQueryWrapper<ReportField> wrapper =new LambdaQueryWrapper<>();
         wrapper.eq(ReportField::getId,params.getFieldId());
+        if(this.list(wrapper).size()==0){
+            return list;
+        }
         ReportField reportField =this.list(wrapper).get(0);
+
         //根据自定义字段的类型,从三张值表中查询该自定义字段所有值的id
         Integer type1 =reportField.getType();
         switch (type1){
@@ -272,20 +279,201 @@ public class ReportFieldService extends ServiceImpl<ReportFieldMapper, ReportFie
         lambdaQueryWrapper.eq(ReportFieldPatentLink::getFieldId,params.getFieldId())
                 .in(ReportFieldPatentLink::getOptionId,valueIds);
         List<ReportFieldPatentLink> reportFieldPatentLinks =reportFieldPatentLinkService.list(lambdaQueryWrapper);
+        if(reportFieldPatentLinks.size()==0) {
+            return list;
+        }
         list.forEach(tem->{
          List<ReportFieldPatentLink> part =reportFieldPatentLinks.stream().filter(tm->tm.getFieldId().equals(params.getFieldId())&&tm.getOptionId().equals(tem.getKey()
             )).collect(Collectors.toList());
          tem.setCount(part.size());
-         tem.setType(type1);
+            tem.setType(type1);
         });
         //根据值id从ReportFieldPatentLink表中获得信息
         return list;
 
     }
+    public List<PatentQueryFieldSourceVO> getPatentQuerySourcePageList2(PatentQueryFieldSourceVO params){
+        List<PatentQueryFieldSourceVO> list =new ArrayList<>();
+        //根据fieldId 从patent_field中获得 自定义字段对象
+        LambdaQueryWrapper<ReportField> wrapper =new LambdaQueryWrapper<>();
+        wrapper.eq(ReportField::getId,params.getFieldId());
+        ReportField reportField =this.list(wrapper).get(0);
+        //根据自定义字段的类型,从三张值表中查询该自定义字段所有值的id
+        Integer type1 =reportField.getType();
+        switch (type1){
+            //数字
+            case 0:
+                //日期
+            case 1:
+                //文本
+            case 2:
+                LambdaQueryWrapper<ReportFieldText> queryWrapper =new LambdaQueryWrapper<>();
+                queryWrapper.eq(ReportFieldText::getFieldId,params.getFieldId());
+                List<ReportFieldText> reportFieldTexts =reportFieldTextService.list(queryWrapper);
+                reportFieldTexts.forEach(item->{
+                    PatentQueryFieldSourceVO patentQueryFieldSourceVO=new PatentQueryFieldSourceVO();
+                    patentQueryFieldSourceVO.setFieldId(params.getFieldId());
+                    patentQueryFieldSourceVO.setKey(item.getId());
+                    patentQueryFieldSourceVO.setLabel(item.getText());
+                    list.add(patentQueryFieldSourceVO);
+                });
+                break;
+
+            //单选
+            case 4:
+
+                //多选
+            case 5:
+                LambdaQueryWrapper<ReportFieldOption> queryWrapper5 =new LambdaQueryWrapper<>();
+                queryWrapper5.eq(ReportFieldOption::getFieldId,params.getFieldId());
+                List<ReportFieldOption> reportFieldOption =reportFieldOptionService.list(queryWrapper5);
+                reportFieldOption.forEach(item->{
+                    PatentQueryFieldSourceVO patentQueryFieldSourceVO=new PatentQueryFieldSourceVO();
+                    patentQueryFieldSourceVO.setFieldId(params.getFieldId());
+                    patentQueryFieldSourceVO.setKey(item.getId());
+                    patentQueryFieldSourceVO.setLabel(item.getName());
+                    list.add(patentQueryFieldSourceVO);
+                });
+                break;
+
+            //树
+            case 6:
+                LambdaQueryWrapper<ReportFieldTree> queryWrapper6 =new LambdaQueryWrapper<>();
+                queryWrapper6.eq(ReportFieldTree::getFieldId,params.getFieldId());
+                List<ReportFieldTree> reportFieldTrees =reportFieldTreeService.list(queryWrapper6);
+                reportFieldTrees.forEach(item->{
+                    PatentQueryFieldSourceVO patentQueryFieldSourceVO=new PatentQueryFieldSourceVO();
+                    patentQueryFieldSourceVO.setFieldId(params.getFieldId());
+                    patentQueryFieldSourceVO.setKey(item.getId());
+                    patentQueryFieldSourceVO.setLabel(item.getName());
+                    list.add(patentQueryFieldSourceVO);
+                });
+                break;
+
+
+        }
+        List<Integer> valueIds =list.stream().map(PatentQueryFieldSourceVO::getKey).collect(Collectors.toList());
+        LambdaQueryWrapper<ReportFieldPatentLink> lambdaQueryWrapper =new LambdaQueryWrapper<>();
+        lambdaQueryWrapper.eq(ReportFieldPatentLink::getFieldId,params.getFieldId())
+                .in(ReportFieldPatentLink::getOptionId,valueIds);
+        List<ReportFieldPatentLink> reportFieldPatentLinks =reportFieldPatentLinkService.list(lambdaQueryWrapper);
+        list.forEach(tem->{
+            List<ReportFieldPatentLink> part =reportFieldPatentLinks.stream().filter(tm->tm.getFieldId().equals(params.getFieldId())&&tm.getOptionId().equals(tem.getKey()
+            )).collect(Collectors.toList());
+            for(ReportFieldPatentLink reportFieldPatentLink : part){
+                PatentQueryFieldSourceVO patentQueryFieldSourceVO = new PatentQueryFieldSourceVO();
+                patentQueryFieldSourceVO.setPatentNo(reportFieldPatentLink.getPatentNo());
+                list.add(patentQueryFieldSourceVO);
+
+            }
+
+        });
+        return list;
+
+
+
+    }
 
+    /**
+     * 模糊查询自定义字段(参数:自定义字段的id,和模糊查询的字段文本类型)
+     * 文本类型,单选,数字类型不用查
+     * @return 返回自定义字段
+     */
+    public String getReportField(int id,String name) {
 
+        LambdaQueryWrapper<ReportField> wrapper =new LambdaQueryWrapper<>();
+        wrapper.eq(ReportField::getId,id);
+        ReportField reportField =this.list(wrapper).get(0);
+        Integer type1 =reportField.getType();
+        if(type1==1){
+            LambdaQueryWrapper<ReportFieldText> queryWrapper =new LambdaQueryWrapper<>();
+             queryWrapper.eq(ReportFieldText::getFieldId, id)
+                    .like(ReportFieldText::getText, name);
+            return Response.success(reportFieldTextService.list(queryWrapper));
+        }
+        else if(type1==5){
+            LambdaQueryWrapper<ReportFieldOption> queryWrapper5 =new LambdaQueryWrapper<>();
+            queryWrapper5.eq(ReportFieldOption::getFieldId,id)
+                    .like(ReportFieldOption::getName,name);
+            return Response.success( reportFieldOptionService.list(queryWrapper5));
+        }
+        else if(type1==6){
+            LambdaQueryWrapper<ReportFieldTree> queryWrapper6 =new LambdaQueryWrapper<>();
+            queryWrapper6.eq(ReportFieldTree::getFieldId,id)
+                    .like(ReportFieldTree::getName,name);
+            return Response.success(reportFieldTreeService.list(queryWrapper6));
+        }
+       else {
+           return Response.error();
+        }
     }
 
+    /**
+     * 自定义字段的id查询专利号
+     * 并集:当自定义字段的id相同的时候取并集
+     * 交集:当自定义字段的id不同的时候取交集
+     * @param params PatentQueryFieldSourceVO
+     * @return PatentQueryFieldSourceVO
+     * @throws IOException
+     */
+     public String getPatent(List<PatentQueryFieldSourceVO> params)throws IOException{
+         //为一的时候只取一个
+         if(params.size()==1){
+             return Response.success(this.getPatentQuerySourcePageList2(params.get(0)));
+         }
+         //为0的时候错误
+         if(params.size()==0){
+             return Response.error();
+         }
+         else {
+           return Response.success (this.gather(params));
+         }
+     }
+
+     public List<PatentQueryFieldSourceVO> gather(List<PatentQueryFieldSourceVO> params) throws IOException{
+         List<List<PatentQueryFieldSourceVO>> VO=new ArrayList<>();
+         List<PatentQueryFieldSourceVO> list=new ArrayList<>(params);
+         List<PatentQueryFieldSourceVO> list1=new ArrayList<>();
+         Map<Integer, List<PatentQueryFieldSourceVO>> map=new HashMap<>();
+         for(int i=0;i<list.size()-1;i++){
+             for (int j=i+1;j<list.size();j++){
+                 if(list.get(i).getFieldId().equals(list.get(j).getFieldId())){
+                     list.remove(list.get(j));
+
+                 }
+             }
+         }
+         for(int i=0;i<list.size();i++){
+             List<PatentQueryFieldSourceVO> list2=new ArrayList<>();
+             list2.add(list.get(i));
+             for(int j=0;j<params.size();j++){
+                     if(list.get(i).getFieldId().equals(params.get(j).getFieldId())){
+                         list2.add(params.get(j));
+                 }
+             }
+             map.put(list.get(i).getFieldId(),list2);
+         }
+         for( List<PatentQueryFieldSourceVO> a:map.values()){
+                 List<PatentQueryFieldSourceVO> param=new ArrayList<>();
+               for(PatentQueryFieldSourceVO patentQueryFieldSourceVO :a){
+                   List<PatentQueryFieldSourceVO> patentQuerySourcePageList2 = this.getPatentQuerySourcePageList2(patentQueryFieldSourceVO);
+                   param.addAll(patentQuerySourcePageList2);
+
+               }
+               param.stream().distinct().collect(Collectors.toList());
+                 VO.add(param);
+             }
+         List<PatentQueryFieldSourceVO> list2 = VO.get(0);
+         VO.forEach(item -> {
+             list2.retainAll((Collection<?>) item);
+
+         });
+
+         return list2;
+
+     }
+}
+
 
 
 

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 17694
logs/rms/rms-debug.2022-11-28.0.log


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 1307
logs/rms/rms-debug.2022-11-28.1.log


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 11069 - 0
logs/rms/rms-debug.2022-12-02.0.log


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 10314 - 0
logs/rms/rms-debug.2022-12-05.0.log


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 314
logs/rms/rms-info.2022-11-28.0.log


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 669 - 0
logs/rms/rms-info.2022-12-02.0.log


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 389 - 0
logs/rms/rms-info.2022-12-05.0.log