Преглед на файлове

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	PAS/src/main/java/cn/cslg/pas/domain/PatentRight.java
chenyu преди 2 години
родител
ревизия
7961f14e89
променени са 19 файла, в които са добавени 447 реда и са изтрити 165 реда
  1. 0 3
      PAS/src/main/java/cn/cslg/pas/common/model/BaseEntity.java
  2. 70 14
      PAS/src/main/java/cn/cslg/pas/common/model/PatentCell.java
  3. 1 0
      PAS/src/main/java/cn/cslg/pas/common/model/QueryPatentVO.java
  4. 3 1
      PAS/src/main/java/cn/cslg/pas/controller/PatentInstructionController.java
  5. 0 1
      PAS/src/main/java/cn/cslg/pas/controller/ReportController.java
  6. 2 1
      PAS/src/main/java/cn/cslg/pas/controller/SystemController.java
  7. 1 3
      PAS/src/main/java/cn/cslg/pas/mapper/PatentSimpleFamilyLinkMapper.java
  8. 20 8
      PAS/src/main/java/cn/cslg/pas/mapper/ProductCategoryMapper.java
  9. 33 0
      PAS/src/main/java/cn/cslg/pas/service/PatentAffairService.java
  10. 5 2
      PAS/src/main/java/cn/cslg/pas/service/PatentApplicantLinkService.java
  11. 12 0
      PAS/src/main/java/cn/cslg/pas/service/PatentInstructionService.java
  12. 70 42
      PAS/src/main/java/cn/cslg/pas/service/PatentSimpleFamilyService.java
  13. 1 1
      PAS/src/main/java/cn/cslg/pas/service/ReportService.java
  14. 66 8
      PAS/src/main/java/cn/cslg/pas/service/UploadPatentBatchService.java
  15. 19 8
      PAS/src/main/java/cn/cslg/pas/service/impl/ProductCategoryServiceImpl.java
  16. 0 7
      PAS/src/main/java/cn/cslg/pas/service/impl/ProductServiceImpl.java
  17. 10 0
      PAS/src/main/resources/mapper/PatentSimpleFamilyLinkMapper.xml
  18. 51 42
      PAS/src/main/resources/mapper/ProductCategoryMapper.xml
  19. 83 24
      PAS/src/main/resources/mapper/ProductMapper.xml

+ 0 - 3
PAS/src/main/java/cn/cslg/pas/common/model/BaseEntity.java

@@ -8,17 +8,14 @@ import lombok.Data;
 
 /**
  * Entity基类
- *
  */
 @Data
 @SuppressWarnings("rawtypes")
 public class BaseEntity<T extends Model> extends Model {
-
     /**
      *
      */
     private static final long serialVersionUID = -4851055162892178225L;
-
     /**
      * 唯一ID
      */

+ 70 - 14
PAS/src/main/java/cn/cslg/pas/common/model/PatentCell.java

@@ -1,6 +1,7 @@
 package cn.cslg.pas.common.model;
 
 
+import cn.cslg.pas.common.model.dto.UploadFileDTO;
 import lombok.Data;
 
 import java.util.List;
@@ -33,7 +34,14 @@ public class PatentCell {
     申请号
      */
     private String applicationNo;
-
+    /*
+    专题库id
+     */
+    private Integer projectId;
+    /*
+报告id
+ */
+    private Integer reportId;
     private String country;
     private String applicationDate;
     private String pubilcDate;
@@ -46,30 +54,31 @@ public class PatentCell {
      */
     private String publicAccreditDate;
     /*
-    主分类号
-     */
-    private String mainTypeNo;
+      主分类号
+       */
+    private String mainIpc;
     /*
       分类号
        */
-    private String typeNo;
+    private List<String> ipc;
     /*
     申请人
      */
-    private String applicationPerson;
+    private List<String> applicationPersons;
     /*
 申请人地址
  */
-    private String applicationAddress;
+    private List<String> applicationAddress;
     /*
   发明人
    */
-    private String inventor;
+    private List<String> inventors;
 
     /*
     当前权利人
      */
-    private String patentApplication;
+    private List<String> applicationCurrents;
+    private List<String> applicationCurrentAddress;
     /*
     范畴分类
      */
@@ -78,25 +87,72 @@ public class PatentCell {
     状态
      */
     private String statue;
+
     /*
     摘要
      */
     private  String abstrText;
+
     /*
     主权要
      */
     private String mainRignt;
+
     /*
     权要
      */
     private List<String> rights;
+
     /*
-    PDF文档
-     */
-    private String PDF;
+        PDF文档路径
+         */
+    private String PDFUrl;
+
     /*
-说明书
- */
+   PDF文档大小
+    */
+    private Long PDFSize;
+    private String PDFName;
+    private UploadFileDTO pdf;
+    /*
+    说明书
+     */
     private String patentInstructionText;
+    /*
+     公开号
+     */
+    private String publicNo;
+
+    /*
+   代理机构
+    */
+    private  String agency;
+    /*
+    代理人
+     */
+    private List<String> agencyPersons;
+
+    /*专利法律状态
+
+     */
+    List<PatentAffair> patentAffairs ;
+    @Data
+    public static  class PatentAffair{
+        /**
+         * 法律状态
+         */
+        private String status;
+
+        /**
+         * 发生日期
+         */
+        private String dateTime;
+        /**
+         * 简单法律状态
+         */
+
+        private String simpleStatus;
+
 
+    }
 }

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

@@ -39,6 +39,7 @@ public class QueryPatentVO extends BaseVO {
 
     private String orderItem;
 
+    private List<String> conPatentNos;
     @Schema(description = "专题库自定义选项列表")
     private List<SourceVO> pasOptions;
     @Schema(description = "专利号")

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

@@ -91,7 +91,9 @@ public class PatentInstructionController {
             if (patentInstruction != null) {
                 response.setHeader("Content-Disposition", "attachment;filename=" + patentInstruction.getFileName());
                 ServletOutputStream out = response.getOutputStream();
-                out.write(FileUtil.readBytes(fileUtils.getSystemPath(patentInstruction.getUrl())));
+//                out.write(FileUtil.readBytes(fileUtils.getSystemPath(patentInstruction.getUrl())));
+                String fil =fileUtils.getSystemPath()+patentInstruction.getUrl();
+                out.write(FileUtil.readBytes(fil));
                 IoUtil.close(out);
             }
         } catch (Exception e) {

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

@@ -51,7 +51,6 @@ public class ReportController {
     }
 
 
-
     @checkAuth(FunId = "/workspace/folder/analyticSystem/generateReport")
     @Permission(roles = {2})
     @PostMapping("add")

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

@@ -20,6 +20,7 @@ import lombok.RequiredArgsConstructor;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.web.bind.annotation.*;
 
+import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -85,7 +86,7 @@ public class SystemController {
 
     @PostMapping("/patentCellTODb")
     @Operation(summary = "专利上传到数据库")
-    public String   getPatentDTOListForRMS(@RequestBody PatentCell patentCell) {
+    public String   getPatentDTOListForRMS(@RequestBody PatentCell patentCell) throws ParseException {
         uploadPatentBatchService.dataToDBCell(patentCell);
         return Response.success();
 

+ 1 - 3
PAS/src/main/java/cn/cslg/pas/mapper/PatentSimpleFamilyLinkMapper.java

@@ -3,7 +3,6 @@ package cn.cslg.pas.mapper;
 import cn.cslg.pas.domain.PatentSimpleFamilyLink;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
-import org.apache.ibatis.annotations.Select;
 
 import java.util.List;
 
@@ -18,8 +17,7 @@ import java.util.List;
 public interface PatentSimpleFamilyLinkMapper extends BaseMapper<PatentSimpleFamilyLink> {
 
 
-    @Select("select a.* from os_patent_simplefamily_link a left join os_patent_simplefamily b on a.family_id=b.id where b.type=#{type} and a.patent_no in (#{patentNos})")
- public  List<PatentSimpleFamilyLink> getPatentFamilyLinkByPatentNo(@Param("patentNos") List<String> patentNos,@Param("type")Integer type);
+ List<PatentSimpleFamilyLink> getPatentFamilyLinkByPatentNo(@Param("patentNos") List<String> patentNos,@Param("type")Integer type);
 
 
 }

+ 20 - 8
PAS/src/main/java/cn/cslg/pas/mapper/ProductCategoryMapper.java

@@ -51,6 +51,15 @@ public interface ProductCategoryMapper {
     int countByProductCategoryName(String productCategoryName);
 
     /**
+     * 根据id和名称统计数量
+     *
+     * @param id                  id
+     * @param productCategoryName 名称
+     * @return
+     */
+    int countByIdAndName(Integer id, String productCategoryName);
+
+    /**
      * 根据id统计数量
      *
      * @param id 产品类别id
@@ -68,20 +77,22 @@ public interface ProductCategoryMapper {
 
     /**
      * 根据架构id、营销地区、时间单位和公司名称查询营销数据
-     * @param categoryId 架构id(必需)
+     *
+     * @param categoryId   架构id(必需)
      * @param categoryArea 营销地区
-     * @param companyName 公司名称
+     * @param companyName  公司名称
      * @return 返回查询到的营销数据
      */
-    List<ProductMarketDataTrendVO> categoryQueryByYear(Integer categoryId,String categoryArea,String companyName);
+    List<ProductMarketDataTrendVO> categoryQueryByYear(Integer categoryId, String categoryArea, String companyName);
 
-    List<ProductMarketDataTrendVO> categoryQueryBySeason(Integer categoryId,String categoryArea,String companyName);
+    List<ProductMarketDataTrendVO> categoryQueryBySeason(Integer categoryId, String categoryArea, String companyName);
 
-    List<ProductMarketDataTrendVO> categoryQueryByMonth(Integer categoryId,String categoryArea,String companyName);
+    List<ProductMarketDataTrendVO> categoryQueryByMonth(Integer categoryId, String categoryArea, String companyName);
 
     /**
      * 根据产品id查询营销数据
-     * @param productId 产品id
+     *
+     * @param productId    产品id
      * @param categoryArea 营销地区
      * @return 返回查询到的营销数据
      */
@@ -94,12 +105,13 @@ public interface ProductCategoryMapper {
 
     /**
      * 根据架构id查询产品id和名称
-     * @param categoryId 架构id(必需)
+     *
+     * @param categoryId  架构id(必需)
      * @param companyName 公司名
      * @return productId 产品id
      * @return productName 产品名称
      */
-    List<ProductIdAndNameVO> queryProductIdAndNameByCategoryId(Integer categoryId,String companyName);
+    List<ProductIdAndNameVO> queryProductIdAndNameByCategoryId(Integer categoryId, String companyName);
 
     /**
      * 查询地区列表

+ 33 - 0
PAS/src/main/java/cn/cslg/pas/service/PatentAffairService.java

@@ -1,6 +1,7 @@
 package cn.cslg.pas.service;
 
 import cn.cslg.pas.common.core.base.Constants;
+import cn.cslg.pas.common.model.PatentCell;
 import cn.cslg.pas.common.model.vo.KeyValueVO;
 import cn.cslg.pas.common.utils.JsonUtils;
 import cn.cslg.pas.common.utils.StringUtils;
@@ -21,6 +22,8 @@ import lombok.RequiredArgsConstructor;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -106,6 +109,36 @@ public class PatentAffairService extends ServiceImpl<PatentAffairMapper, PatentA
             this.saveOrUpdate(patentAffair);
         }
     }
+    //批量上传法律状态
+    public void updatePatientAffairs(List<PatentCell.PatentAffair> params,Integer patentId) {
+        List<SystemDict> systemDictList = systemDictService.getSystemDictListByType(Collections.singletonList(Constants.PATENT_SIMPLE_STATUS));
+        this.deleteByPatentId(patentId);
+        List<PatentAffair> patentAffairs =new ArrayList<>();
+        params.forEach(
+                item->{
+                    Integer simpleStatus = Integer.parseInt(systemDictList.stream()
+                            .filter(systemDict -> systemDict.getType().equals(Constants.PATENT_SIMPLE_STATUS) && systemDict.getLabel().equals(item.getSimpleStatus()))
+                            .findFirst()
+                            .orElse(new SystemDict()).getValue());
+                    PatentAffair patentAffair = new PatentAffair();
+                    patentAffair.setPatentId(patentId);
+                    patentAffair.setStatus(item.getStatus());
+                    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy.MM.dd");
+                    Date date = null;
+                    try {
+                        date = simpleDateFormat.parse(item.getDateTime());
+                    } catch (ParseException e) {
+                        e.printStackTrace();
+                    }
+                    Integer ts = (int) date.getTime();
+                    patentAffair.setDateTime(ts);
+                    patentAffair.setSimpleStatus(simpleStatus);
+                    patentAffairs.add(patentAffair);
+                }
+        );
+        if(patentAffairs.size()>0){
+        this.saveOrUpdateBatch(patentAffairs);}
+    }
 
     public void deleteByPatentId(Integer patentId) {
         this.remove(Wrappers.<PatentAffair>lambdaQuery().eq(PatentAffair::getPatentId, patentId));

+ 5 - 2
PAS/src/main/java/cn/cslg/pas/service/PatentApplicantLinkService.java

@@ -42,8 +42,11 @@ public class PatentApplicantLinkService extends ServiceImpl<PatentApplicantLinkM
         return this.list(queryWrapper);
     }
 
-    public void updatePatentApplicantLink(List<String> name, List<String> shortName, Integer type, Integer patentId,List<PatentApplicant> patentApplicantList) {
-        List<Integer> applicableIds = patentApplicantService.updatePatentApplicant(name, shortName,patentApplicantList);
+    public void updatePatentApplicantLink(List<String> name, List<String> shortName, Integer type, Integer patentId, List<PatentApplicant> patentApplicantList) {
+        if (shortName == null) {
+            shortName = new ArrayList<>();
+        }
+        List<Integer> applicableIds = patentApplicantService.updatePatentApplicant(name, shortName, patentApplicantList);
         if (applicableIds.size() != 0) {
             this.remove(Wrappers.<PatentApplicantLink>lambdaQuery().eq(PatentApplicantLink::getPatentId, patentId).eq(PatentApplicantLink::getType, type));
             for (int i = 0; i < applicableIds.size(); i++) {

+ 12 - 0
PAS/src/main/java/cn/cslg/pas/service/PatentInstructionService.java

@@ -50,6 +50,7 @@ public class PatentInstructionService extends ServiceImpl<PatentInstructionMappe
     private final PatentService patentService;
     private final ProjectFileService projectFileService;
     private final LoginUtils loginUtils;
+
     public IPage<PatentInstruction> getPageList(PatentInstructionVO params) {
         LambdaQueryWrapper<PatentInstruction> queryWrapper = new LambdaQueryWrapper<>();
         if (StringUtils.isNotEmpty(params.getPatentNo())) {
@@ -160,6 +161,17 @@ public class PatentInstructionService extends ServiceImpl<PatentInstructionMappe
         return Response.success(true);
     }
 
+    @Transactional
+    public String edit(String patentNo, UploadFileDTO pdf) {
+        PatentInstruction patentInstruction = new PatentInstruction();
+        patentInstruction.setUrl(pdf.getPath());
+        patentInstruction.setFileName(pdf.getFileName());
+        patentInstruction.setSize(pdf.getFileSize());
+        patentInstruction.setPatentNo(patentNo);
+        patentInstruction.insert();
+        return Response.success(true);
+    }
+
     public String delete(Integer id) {
         PatentInstruction temp = this.getById(id);
         this.removeById(id);

+ 70 - 42
PAS/src/main/java/cn/cslg/pas/service/PatentSimpleFamilyService.java

@@ -9,6 +9,7 @@ import cn.cslg.pas.domain.PatentSimpleFamilyLink;
 import cn.cslg.pas.mapper.PatentSimpleFamilyLinkMapper;
 import cn.cslg.pas.mapper.PatentSimpleFamilyMapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.RequiredArgsConstructor;
 import org.springframework.context.annotation.Lazy;
@@ -111,69 +112,96 @@ public class PatentSimpleFamilyService extends ServiceImpl<PatentSimpleFamilyMap
         else{
             temPatentNo= patentNo;
         }
+        String familyPatent =temPatentNo;
+         //根据专利号查询同族信息
+        LambdaQueryWrapper<PatentSimpleFamily> wrapper =new LambdaQueryWrapper<>();
+        wrapper.in(PatentSimpleFamily::getPatentNo,familyNo)
+               .eq(PatentSimpleFamily::getType,type);
+        List<PatentSimpleFamily>  simpleFamilies = this.list(wrapper);
+        //获得同族专利的同族id
+        List<Integer> familyIds =simpleFamilies.stream().map(PatentSimpleFamily::getId).collect(Collectors.toList());
+        //查询是否有满足条件的
+      PatentSimpleFamily simpleFamily  =simpleFamilies.stream().filter(item->item.getPatentNo().equals(familyPatent)&&item.getType().equals(type)).findFirst().orElse(null);
+      if(simpleFamily==null){
+          simpleFamily= this.add(type,familyPatent);
+      }
+      familyIds.remove(simpleFamily.getId());
 
         //3.根据专利号(faimlyNo + patentNo)和同族类型从family关联表中取数据
         List<PatentSimpleFamilyLink> patentSimpleFamilyLinkList = patentSimpleFamilyLinkMapper.getPatentFamilyLinkByPatentNo(familyNo,type);
 
-        //4.第3步中如果有数据,则取得一个familID为下一步的插入关联表中的id
-        PatentSimpleFamily patentSimpleFamily;
-        if(patentSimpleFamilyLinkList !=null && patentSimpleFamilyLinkList.size() >0){
-            //4.1 第3步中有数据
-             patentSimpleFamily = this.getPatentSimpleFamilyByIdsAndType(patentSimpleFamilyLinkList.stream().map(PatentSimpleFamilyLink::getFamilyId).collect(Collectors.toList()), type);
-        }
-        else{
-            //4.2 第3步中有数据则在Family表中添加一条记录,并
-            patentSimpleFamily = this.add(type,temPatentNo);
-        }
-
         //5.专利号(faimlyNo + patentNo)和第三步获得的记录比较,如果没有则在关联表中添加一条记录
         for(String temPN:familyNo) {
             PatentSimpleFamilyLink temp = patentSimpleFamilyLinkList.stream().filter(item -> item.getPatentNo().equals(temPN)).findFirst().orElse(null);
             if (temp == null) {
                 //5.1 如果关联表中没有记录,添加一个
                 PatentSimpleFamilyLink patentSimpleFamilyLink = new PatentSimpleFamilyLink();
-                patentSimpleFamilyLink.setFamilyId(patentSimpleFamily.getId());
+                patentSimpleFamilyLink.setFamilyId(simpleFamily.getId());
                 patentSimpleFamilyLink.setPatentNo(temPN);
                 patentSimpleFamilyLink.insert();
             } else {
                 //5.2 如果关联表中有记录,判断familyid是否跟temFailyID相同,不相同则更新记录
-                if (temp.getFamilyId() != patentSimpleFamily.getId()) {
-                    temp.setFamilyId(patentSimpleFamily.getId());
+                if (temp.getFamilyId() != simpleFamily.getId()) {
+                    temp.setFamilyId(simpleFamily.getId());
                     temp.updateById();
                 }
             }
-
-            //6.如果同族关联表有数据则更新,无数据则插入一条数据
-            Patent patent1 = patent1s.stream().filter(item -> item.getPatentNo().equals(temPN)).findFirst().orElse(null);
-            if (patent1 != null) {
-                switch (type) {
-                    case 1:
-                        if(patent1.getSimpleFamily()!=patentSimpleFamily.getId())
-                        {
-                            patent1.setSimpleFamily(patentSimpleFamily.getId());
-                            patent1.updateById();
-                        }
-                        break;
-                    case 2:
-                        if(patent1.getInpadocFamily()!=patentSimpleFamily.getId())
-                        {
-                            patent1.setInpadocFamily(patentSimpleFamily.getId());
-                            patent1.updateById();
-                        }
-                        break;
-                    case 3:
-                        if(patent1.getPatSnapFamily()!=patentSimpleFamily.getId())
-                        {
-                            patent1.setPatSnapFamily(patentSimpleFamily.getId());
-                            patent1.updateById();
-                        }
-                        break;
-                }
-
+        }
+        //6.如果同族关联表有数据则更新,无数据则插入一条数据
+        Patent patent1 = patent1s.stream().filter(item -> item.getPatentNo().equals(familyPatent)).findFirst().orElse(null);
+        if (patent1 != null) {
+            switch (type) {
+                case 1:
+                    if(patent1.getSimpleFamily()!=simpleFamily.getId())
+                    {
+                        patent1.setSimpleFamily(simpleFamily.getId());
+                        patent1.updateById();
+                    }
+                    break;
+                case 2:
+                    if(patent1.getInpadocFamily()!=simpleFamily.getId())
+                    {
+                        patent1.setInpadocFamily(simpleFamily.getId());
+                        patent1.updateById();
+                    }
+                    break;
+                case 3:
+                    if(patent1.getPatSnapFamily()!=simpleFamily.getId())
+                    {
+                        patent1.setPatSnapFamily(simpleFamily.getId());
+                        patent1.updateById();
+                    }
+                    break;
             }
+
+        }
+        if(familyIds.size()!=0) {
+            //删除同族关联信息
+            LambdaQueryWrapper<PatentSimpleFamilyLink> linkWrapper =new LambdaQueryWrapper<>();
+            linkWrapper.in(PatentSimpleFamilyLink::getId,familyIds);
+            patentSimpleFamilyLinkService.remove(linkWrapper);
+            //删除其他同族信息
+            LambdaUpdateWrapper<PatentSimpleFamily> deleteWrapper= new LambdaUpdateWrapper<>();
+            deleteWrapper.in(PatentSimpleFamily::getId,familyIds);
+            this.remove(deleteWrapper);
         }
         long end =System.currentTimeMillis();
         System.out.println("总共用时---"+(start-end));
     }
 
+//
+//        //4.第3步中如果有数据,则取得一个familID为下一步的插入关联表中的id
+//        PatentSimpleFamily patentSimpleFamily;
+//        if(patentSimpleFamilyLinkList !=null && patentSimpleFamilyLinkList.size() >0){
+//            //4.1 第3步中有数据
+//             patentSimpleFamily = this.getPatentSimpleFamilyByIdsAndType(patentSimpleFamilyLinkList.stream().map(PatentSimpleFamilyLink::getFamilyId).collect(Collectors.toList()), type);
+//        }
+//        else{
+//            //4.2 第3步中有数据则在Family表中添加一条记录,并
+//            patentSimpleFamily = this.add(type,temPatentNo);
+//        }
+//
+
+//
+
 }

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

@@ -544,7 +544,7 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
     }
 
     //根据Id删除报告
-    public String deleteById(List<Integer> ids){
+    public String deleteById(List<Integer> ids) {
         this.deleteById(ids);
         return Response.success();
 

+ 66 - 8
PAS/src/main/java/cn/cslg/pas/service/UploadPatentBatchService.java

@@ -22,6 +22,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -51,6 +52,7 @@ public class UploadPatentBatchService {
     private final PatentAffairService patentAffairService;
     private final ImportErrorLogMapper importErrorLogMapper;
     private final AssoProductPatentService assoProductPatentService;
+    private final PatentInstructionService patentInstructionService;
     private static int FLAG = 0;
 
     @Async("singleThreadAsyncTaskExecutor")
@@ -355,6 +357,7 @@ public class UploadPatentBatchService {
      */
     private void getOneOrInsertOne(UploadParamsVO uploadParamsVO) {
         if (uploadParamsVO.getPatent() != null) {
+            uploadParamsVO.getPatent().setPatentNo(uploadParamsVO.getPatent().getPatentNo().trim());
             //用专利号查询该条数据是否存在
             Patent patent = patentService.getByPatentNo(uploadParamsVO.getPatent().getPatentNo());
             //如果不存在就新增一条
@@ -659,12 +662,45 @@ public class UploadPatentBatchService {
      * @description 将装配完毕的VO类向数据库中不同的表进行添加或修改操作(dataToDB兄弟类)
      */
     @Transactional(rollbackFor = Exception.class)
-    public String dataToDBCell(PatentCell patentCell) {
+    public String dataToDBCell(PatentCell patentCell) throws ParseException {
         UploadParamsVO uploadParamsVO = new UploadParamsVO();
-        uploadParamsVO.setPatent(new Patent());
-        uploadParamsVO.getPatent().setPatentNo(patentCell.getPatentNo());
-        getOneOrInsertOne(uploadParamsVO);
+        Patent patent = new Patent();
+        //设置专利号
+        patent.setPatentNo(patentCell.getPatentNo());
+        //设置摘要
+        patent.setAbstractStr(patentCell.getAbstrText());
+        //设置标题
+        patent.setName(patentCell.getTitle());
+        //设置公开日
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy.MM.dd");
+        if (patentCell.getPubilcDate() != null) {
+            Date date = simpleDateFormat.parse(patentCell.getPubilcDate());
+            Integer ts = (int) date.getTime();
+            patent.setPublicDate(ts);
+        }
+        //设置申请号
+        patent.setApplicationNo(patentCell.getApplicationNo());
+        //设置申请日
+        if (patentCell.getApplicationDate() != null) {
+            Date date = simpleDateFormat.parse(patentCell.getApplicationDate());
+            Integer ts = (int) date.getTime();
+            patent.setApplicationDate(ts);
+        }
+        //设置摘要附图
+        patent.setAbstractPath(patentCell.getPicUrl());
+        //设置pdf文档
+        if (patentCell.getPdf() != null) {
+            patentInstructionService.edit(patentCell.getPatentNo(), patentCell.getPdf());
+        }
+        //设置公开号
+        patent.setPublicNo(patentCell.getPublicNo());
         uploadParamsVO.setSimpleStatus(patentCell.getStatue());
+        uploadParamsVO.setPatent(patent);
+        getOneOrInsertOne(uploadParamsVO);
+        //装载代理机构
+        if (patentCell.getAgency() != null) {
+            uploadParamsVO.getPatent().setAgencyId(patentAgencyService.getAgencyStringIdByName(patentCell.getAgency()));
+        }
         try {
             //专利信息 OS_PATENT
             if (uploadParamsVO.getPatent() != null) {
@@ -687,18 +723,40 @@ public class UploadPatentBatchService {
             if (uploadParamsVO.getPatentInstructionText() != null) {
                 patentInstructionTextBusiness(uploadParamsVO);
             }
-            //简单同族 OS_PATENT_SIMPLEFAMILY
-            patentSimplyFamilyBusiness(uploadParamsVO);
             //发明人 OS_PATENT_INVENTOR
-            patentInventorBusiness(uploadParamsVO);
+            if (patentCell.getInventors().size() != 0) {
+                PatentInventorParams patentInventorParams = new PatentInventorParams();
+                patentInventorParams.setPatentId(uploadParamsVO.getPatent().getId());
+                patentInventorParams.setNameList(patentCell.getInventors());
+                patentInventorParams.setAddressList(new ArrayList<>());
+                patentInventorService.updatePatentInventor(patentInventorParams);
+            }
             //申请人(原始)/权利人(当前) OS_PATENT_APPLICATION || OS_APPLICATION_ATTR
+            uploadParamsVO.setPatentApplicantCurrentName(patentCell.getApplicationCurrents());
+            uploadParamsVO.setPatentApplicantOriginalName(patentCell.getApplicationPersons());
             patentApplicationBusiness(uploadParamsVO);
             //申请人地址 OS_PATENT_APPLICATION
+            uploadParamsVO.setPatentApplicantOriginalAddress(patentCell.getApplicationAddress());
             patentApplicationAddressBusiness(uploadParamsVO);
             //分类号关联 OS_PATENT_TYPENO
+            uploadParamsVO.setIpcList(patentCell.getIpc());
+            uploadParamsVO.setMainIpc(patentCell.getMainIpc());
             patentTypeNoBusiness(uploadParamsVO);
+            //代理人 OS_PATENT_AGENT
+            if (patentCell.getAgencyPersons() != null && patentCell.getAgencyPersons().size() != 0) {
+                PatentAgentParams patentAgentParams = new PatentAgentParams();
+                patentAgentParams.setPatentId(uploadParamsVO.getPatent().getId());
+                patentAgentParams.setAgent(patentCell.getAgencyPersons());
+                patentAgentService.updatePatentAgent(patentAgentParams);
+            }
             //事务信息 OS_PATENT_AFFAIR
-            patentAffairBusiness(uploadParamsVO);
+            if (patentCell.getPatentAffairs() != null && patentCell.getPatentAffairs().size() > 0) {
+                patentAffairService.updatePatientAffairs(patentCell.getPatentAffairs(), uploadParamsVO.getPatent().getId());
+            }
+            //当专题库id不为null时添加专利到专题库
+            if (patentCell.getProjectId() != null) {
+                projectPatentLinkService.updateProjectPatent(patentCell.getProjectId(), uploadParamsVO.getPatent().getId());
+            }
             return Response.success();
         } catch (Exception e) {
             e.printStackTrace();

+ 19 - 8
PAS/src/main/java/cn/cslg/pas/service/impl/ProductCategoryServiceImpl.java

@@ -147,6 +147,7 @@ public class ProductCategoryServiceImpl implements IProductCategoryService {
 
         //检查尝试修改的数据是否存在
         Integer productCategoryId = productCategoryUpdateDTO.getId();
+        String productCategoryName = productCategoryUpdateDTO.getProductCategoryName();
         log.info("检查尝试修改的数据是否存在");
         int count = productCategoryMapper.countById(productCategoryId);
         if (count == 0) {
@@ -155,6 +156,15 @@ public class ProductCategoryServiceImpl implements IProductCategoryService {
             throw new XiaoShiException(message);
         }
 
+        //检查尝试修改的产品类别名称是否被占用
+        log.info("检查尝试修改的产品类别名称是否被占用");
+        count = productCategoryMapper.countByIdAndName(productCategoryId, productCategoryName);
+        if (count > 0) {
+            String message = "修改产品类别失败,类别名称【" + productCategoryName + "】已存在,请尝试更换名称";
+            log.info("{}", message);
+            throw new XiaoShiException(message);
+        }
+
         //产品类别DTO对象赋值给实体类
         ProductCategory productCategory = new ProductCategory();
         BeanUtils.copyProperties(productCategoryUpdateDTO, productCategory);
@@ -247,11 +257,12 @@ public class ProductCategoryServiceImpl implements IProductCategoryService {
         log.info("删除产品类别完成");
 
     }
+
     //返回总的营销数据
     @Override
     public List<ProductCategoryTrendVO> showTrend(ProductCategoryDTO dto) {
         //判断架构id是否有内容,没有的话直接返回null
-        if(dto.getCategoryId() == null && dto.getCategoryId() == 0) {
+        if (dto.getCategoryId() == null && dto.getCategoryId() == 0) {
             return null;
         }
         //存储各个产品信息和营销数据
@@ -265,11 +276,11 @@ public class ProductCategoryServiceImpl implements IProductCategoryService {
         //查询架构id返回的总体营销数据
         List<ProductMarketDataTrendVO> totalSaleVOS = new ArrayList<>();
         if (dto.getTimeUnit() == 2) {//按照年份返回营销数据
-            totalSaleVOS = productCategoryMapper.categoryQueryByYear(dto.getCategoryId(),dto.getCategoryArea(),dto.getCompanyName());
+            totalSaleVOS = productCategoryMapper.categoryQueryByYear(dto.getCategoryId(), dto.getCategoryArea(), dto.getCompanyName());
         } else if (dto.getTimeUnit() == 1) {//按照季度返回营销数据
-            totalSaleVOS = productCategoryMapper.categoryQueryBySeason(dto.getCategoryId(),dto.getCategoryArea(),dto.getCompanyName());
+            totalSaleVOS = productCategoryMapper.categoryQueryBySeason(dto.getCategoryId(), dto.getCategoryArea(), dto.getCompanyName());
         } else if (dto.getTimeUnit() == null || dto.getTimeUnit() == 0) {//按照月份返回营销数据
-            totalSaleVOS = productCategoryMapper.categoryQueryByMonth(dto.getCategoryId(),dto.getCategoryArea(),dto.getCompanyName());
+            totalSaleVOS = productCategoryMapper.categoryQueryByMonth(dto.getCategoryId(), dto.getCategoryArea(), dto.getCompanyName());
         }
         totalTrendVO.setSaleVOS(totalSaleVOS);
         trendVOS.add(totalTrendVO);
@@ -277,17 +288,17 @@ public class ProductCategoryServiceImpl implements IProductCategoryService {
         List<ProductIdAndNameVO> idNameVOS = new ArrayList<>();
         idNameVOS = productCategoryMapper.queryProductIdAndNameByCategoryId(dto.getCategoryId(), dto.getCompanyName());
         //返回根据架构id查询到的每个产品id的营销数据
-        for(ProductIdAndNameVO idNameVO:idNameVOS){
+        for (ProductIdAndNameVO idNameVO : idNameVOS) {
             ProductCategoryTrendVO trendVO = new ProductCategoryTrendVO();
             trendVO.setProductId(idNameVO.getProductId());
             trendVO.setProductName(idNameVO.getProductName());
             List<ProductMarketDataTrendVO> temSaleVOS = new ArrayList<>();
             if (dto.getTimeUnit() == 2) {//按照年份返回营销数据
-                temSaleVOS = productCategoryMapper.queryByYear(idNameVO.getProductId(),dto.getCategoryArea());
+                temSaleVOS = productCategoryMapper.queryByYear(idNameVO.getProductId(), dto.getCategoryArea());
             } else if (dto.getTimeUnit() == 1) {//按照季度返回营销数据
-                temSaleVOS = productCategoryMapper.queryBySeason(idNameVO.getProductId(),dto.getCategoryArea());
+                temSaleVOS = productCategoryMapper.queryBySeason(idNameVO.getProductId(), dto.getCategoryArea());
             } else if (dto.getTimeUnit() == null || dto.getTimeUnit() == 0) {//按照月份返回营销数据
-                temSaleVOS = productCategoryMapper.queryByMonth(idNameVO.getProductId(),dto.getCategoryArea());
+                temSaleVOS = productCategoryMapper.queryByMonth(idNameVO.getProductId(), dto.getCategoryArea());
             }
             trendVO.setSaleVOS(temSaleVOS);
             trendVOS.add(trendVO);

+ 0 - 7
PAS/src/main/java/cn/cslg/pas/service/impl/ProductServiceImpl.java

@@ -238,13 +238,6 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
             List<ProductGroupVO> productGroupVOS;
             if (groupBy.equals("product_category_id")) {
                 productGroupVOS = productMapper.queryByGroupProductCategoryId(productQueryPageDTO);
-//                for (ProductGroupVO productGroupVO : productGroupVOS) {
-//                    ProductVO productVO = productGroupVO.getProducts().get(0);
-//                    if (productVO != null) {
-//                        String productCategoryName = productVO.getProductCategory().getProductCategoryName();
-//                        productGroupVO.setProductCategoryName(productCategoryName);
-//                    }
-//                }
             } else {
                 productGroupVOS = productMapper.queryByGroupCompanyName(productQueryPageDTO);
             }

+ 10 - 0
PAS/src/main/resources/mapper/PatentSimpleFamilyLinkMapper.xml

@@ -0,0 +1,10 @@
+<?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.PatentSimpleFamilyLinkMapper">
+    <select id="getPatentFamilyLinkByPatentNo"  resultType="cn.cslg.pas.domain.PatentSimpleFamilyLink">
+        select a.* from os_patent_simplefamily_link a left join os_patent_simplefamily b on a.family_id=b.id where b.type=#{type}
+        and a.patent_no in <foreach collection="patentNos" item="id" open="(" separator="," close=")"> #{id}</foreach>
+    </select>
+
+</mapper>

+ 51 - 42
PAS/src/main/resources/mapper/ProductCategoryMapper.xml

@@ -43,6 +43,15 @@
         where product_category_name = #{productCategoryName}
     </select>
 
+    <!--根据id和名称统计数量-->
+    <!--int countByIdAndName(Integer id, String productCategoryName);-->
+    <select id="countByIdAndName" resultType="int">
+        select count(*)
+        from product_category
+        where product_category_name = #{productCategoryName}
+          and id != #{id}
+    </select>
+
     <!--根据id统计数量-->
     <!--int countById(Integer id);-->
     <select id="countById" resultType="int">
@@ -116,35 +125,35 @@
     <!--按照月份返回总体-->
     <select id="categoryQueryByMonth" resultMap="queryByDateMap">
         SELECT CONCAT(CAST(YEAR(STR_TO_DATE(sale_time,'%Y-%m')) AS CHAR),'-',
-                      CAST(MONTH(STR_TO_DATE(sale_time,'%Y-%m')) AS CHAR)) AS market_date,
-               sum(sale_money) AS sale_total_money,
-               CAST(sum(custom_license_rate * sale_money) AS DECIMAL (19, 2)) AS custom_license_money
-        FROM  product_market_data
+        CAST(MONTH(STR_TO_DATE(sale_time,'%Y-%m')) AS CHAR)) AS market_date,
+        sum(sale_money) AS sale_total_money,
+        CAST(sum(custom_license_rate * sale_money) AS DECIMAL (19, 2)) AS custom_license_money
+        FROM product_market_data
         WHERE product_id IN(SELECT id AS product_id
-                            FROM product
-                            WHERE product_category_id = #{categoryId}
-                            <if test="companyName != null and companyName != ''">
-                                AND company_name = #{companyName}
-                            </if>)
-                <if test="categoryArea != null and categoryArea != ''">
-                    AND sale_area = #{categoryArea}
-                </if>
+        FROM product
+        WHERE product_category_id = #{categoryId}
+        <if test="companyName != null and companyName != ''">
+            AND company_name = #{companyName}
+        </if>)
+        <if test="categoryArea != null and categoryArea != ''">
+            AND sale_area = #{categoryArea}
+        </if>
         GROUP BY market_date
     </select>
 
     <!--按照季度返回总体-->
     <select id="categoryQueryBySeason" resultMap="queryByDateMap">
         SELECT CONCAT(CAST(YEAR(STR_TO_DATE(sale_time,'%Y-%m')) as CHAR),'年',
-                      '第',CAST(QUARTER(STR_TO_DATE(sale_time,'%Y-%m')) as CHAR),'季度') AS market_date,
-               sum(sale_money) AS sale_total_money,
-               CAST(sum(custom_license_rate * sale_money) AS DECIMAL (19, 2)) AS custom_license_money
-        FROM  product_market_data
+        '第',CAST(QUARTER(STR_TO_DATE(sale_time,'%Y-%m')) as CHAR),'季度') AS market_date,
+        sum(sale_money) AS sale_total_money,
+        CAST(sum(custom_license_rate * sale_money) AS DECIMAL (19, 2)) AS custom_license_money
+        FROM product_market_data
         WHERE product_id IN(SELECT id AS product_id
-                            FROM product
-                            WHERE product_category_id = #{categoryId}
-                            <if test="companyName != null and companyName != ''">
-                                AND company_name = #{companyName}
-                            </if>)
+        FROM product
+        WHERE product_category_id = #{categoryId}
+        <if test="companyName != null and companyName != ''">
+            AND company_name = #{companyName}
+        </if>)
         <if test="categoryArea != null and categoryArea != ''">
             AND sale_area = #{categoryArea}
         </if>
@@ -153,15 +162,15 @@
     <!--按照年度返回总体-->
     <select id="categoryQueryByYear" resultMap="queryByDateMap">
         SELECT CONCAT(CAST(YEAR(STR_TO_DATE(sale_time,'%Y-%m')) as CHAR),'年') AS market_date,
-               sum(sale_money) AS sale_total_money,
-               CAST(sum(custom_license_rate * sale_money) AS DECIMAL (19, 2)) AS custom_license_money
-        FROM  product_market_data
+        sum(sale_money) AS sale_total_money,
+        CAST(sum(custom_license_rate * sale_money) AS DECIMAL (19, 2)) AS custom_license_money
+        FROM product_market_data
         WHERE product_id IN(SELECT id AS product_id
-                            FROM product
-                            WHERE product_category_id = #{categoryId}
-                            <if test="companyName != null and companyName != ''">
-                                AND company_name = #{companyName}
-                            </if>)
+        FROM product
+        WHERE product_category_id = #{categoryId}
+        <if test="companyName != null and companyName != ''">
+            AND company_name = #{companyName}
+        </if>)
         <if test="categoryArea != null and categoryArea != ''">
             AND sale_area = #{categoryArea}
         </if>
@@ -171,9 +180,9 @@
     <!--按照年度返回每个-->
     <select id="queryByYear" resultMap="queryByDateMap">
         SELECT CONCAT(CAST(YEAR(STR_TO_DATE(sale_time,'%Y-%m')) as CHAR),'年') AS market_date,
-               sum(sale_money) AS sale_total_money,
-               CAST(sum(custom_license_rate * sale_money) AS DECIMAL (19, 2)) AS custom_license_money
-        FROM  product_market_data
+        sum(sale_money) AS sale_total_money,
+        CAST(sum(custom_license_rate * sale_money) AS DECIMAL (19, 2)) AS custom_license_money
+        FROM product_market_data
         WHERE product_id = #{productId}
         <if test="categoryArea != null and categoryArea != ''">
             AND sale_Area = #{categoryArea}
@@ -184,10 +193,10 @@
     <!--按照季度返回每个-->
     <select id="queryBySeason" resultMap="queryByDateMap">
         SELECT CONCAT(CAST(YEAR(STR_TO_DATE(sale_time,'%Y-%m')) as CHAR),'年',
-                 '第',CAST(QUARTER(STR_TO_DATE(sale_time,'%Y-%m')) as CHAR),'季度') AS market_date,
-                      sum(sale_money) AS sale_total_money,
-                      CAST(sum(custom_license_rate * sale_money) AS DECIMAL (19, 2)) AS custom_license_money
-        FROM  product_market_data
+        '第',CAST(QUARTER(STR_TO_DATE(sale_time,'%Y-%m')) as CHAR),'季度') AS market_date,
+        sum(sale_money) AS sale_total_money,
+        CAST(sum(custom_license_rate * sale_money) AS DECIMAL (19, 2)) AS custom_license_money
+        FROM product_market_data
         WHERE product_id = #{productId}
         <if test="categoryArea != null and categoryArea != ''">
             AND sale_Area = #{categoryArea}
@@ -198,10 +207,10 @@
     <!--按照月份返回每个-->
     <select id="queryByMonth" resultMap="queryByDateMap">
         SELECT CONCAT(CAST(YEAR(STR_TO_DATE(sale_time,'%Y-%m')) AS CHAR),'-',
-                      CAST(MONTH(STR_TO_DATE(sale_time,'%Y-%m')) AS CHAR)) AS market_date,
-                      sum(sale_money) AS sale_total_money,
-                      CAST(sum(custom_license_rate * sale_money) AS DECIMAL (19, 2)) AS custom_license_money
-        FROM  product_market_data
+        CAST(MONTH(STR_TO_DATE(sale_time,'%Y-%m')) AS CHAR)) AS market_date,
+        sum(sale_money) AS sale_total_money,
+        CAST(sum(custom_license_rate * sale_money) AS DECIMAL (19, 2)) AS custom_license_money
+        FROM product_market_data
         WHERE product_id = #{productId}
         <if test="categoryArea != null and categoryArea != ''">
             AND sale_Area = #{categoryArea}
@@ -217,10 +226,10 @@
 
     <select id="queryProductIdAndNameByCategoryId" resultMap="idNameMap">
         SELECT id AS product_id,product_name
-        FROM  product
+        FROM product
         WHERE product_category_id = #{categoryId}
         <if test="companyName != null and companyName != ''">
-          AND company_name = #{companyName}
+            AND company_name = #{companyName}
         </if>
     </select>
 

+ 83 - 24
PAS/src/main/resources/mapper/ProductMapper.xml

@@ -115,21 +115,21 @@
         from product p
         join product_category pc on p.product_category_id = pc.id
         <where>
-            <if test="productName != null">
+            <if test="productName != null and productName != ''">
                 and product_name like '%${productName}%'
             </if>
-            <if test="companyName != null">
+            <if test="companyName != null and companyName != ''">
                 and company_name like '%${companyName}%'
             </if>
-            <if test="patentNo != null">
-                and id in
+            <if test="patentNo != null and patentNo != ''">
+                and p.id in
                 (select product_id from asso_product_patent where patent_no = #{patentNo}
                 union select product_id from asso_structure_patent where patent_no = #{patentNo})
             </if>
-            <if test="productCategoryId != null">
+            <if test="productCategoryId != null and productCategoryId != ''">
                 and product_category_id = #{productCategoryId}
             </if>
-            <if test="productCategoryName != null">
+            <if test="productCategoryName != null and productCategoryName != ''">
                 and product_category_id in (select id from product_category where product_category_name like
                 '%${productCategoryName}%')
             </if>
@@ -230,26 +230,31 @@
     <select id="queryByGroupProductCategoryId" resultMap="queryByGroupProductCategoryIdMap">
         select product_category_id pci,
         product_category_name,
-        #{orderBy} orderBy,
-        #{orderType} orderType
+        ifnull(#{orderBy}, '') orderBy,
+        ifnull(#{orderType}, '') orderType,
+        ifnull(#{productName}, '') productName,
+        ifnull(#{companyName}, '') companyName,
+        ifnull(#{patentNo}, '') patentNo,
+        ifnull(#{productCategoryId}, '') productCategoryId,
+        ifnull(#{productCategoryName}, '') productCategoryName
         from product p
         join product_category pc on p.product_category_id = pc.id
         <where>
-            <if test="productName != null">
+            <if test="productName != null and productName != ''">
                 and product_name like '%${productName}%'
             </if>
-            <if test="companyName != null">
+            <if test="companyName != null and companyName != ''">
                 and company_name like '%${companyName}%'
             </if>
-            <if test="patentNo != null">
-                and id in
+            <if test="patentNo != null and patentNo != ''">
+                and p.id in
                 (select product_id from asso_product_patent where patent_no = #{patentNo}
                 union select product_id from asso_structure_patent where patent_no = #{patentNo})
             </if>
-            <if test="productCategoryId != null">
+            <if test="productCategoryId != null and productCategoryId != ''">
                 and product_category_id = #{productCategoryId}
             </if>
-            <if test="productCategoryName != null">
+            <if test="productCategoryName != null and productCategoryName != ''">
                 and product_category_id in (select id from product_category where product_category_name like
                 '%${productCategoryName}%')
             </if>
@@ -262,7 +267,9 @@
         <result column="product_category_id" property="productCategoryId"/>
         <result column="product_category_name" property="productCategoryName"/>
         <collection property="products" ofType="cn.cslg.pas.common.model.vo.ProductVO"
-                    select="queryByGroupProductCategoryId2" column="{pci=pci, orderBy=orderBy, orderType=orderType}">
+                    select="queryByGroupProductCategoryId2"
+                    column="{pci=pci, orderBy=orderBy, orderType=orderType, productName=productName, companyName=companyName,
+                             patentNo=patentNo, productCategoryId=productCategoryId, productCategoryName=productCategoryName}">
         </collection>
     </resultMap>
 
@@ -279,7 +286,29 @@
         product_category_name
         from product p
         join product_category pc on p.product_category_id = pc.id
-        where product_category_id = #{pci}
+        <where>
+            <if test="productName != null and productName != ''">
+                and product_name like '%${productName}%'
+            </if>
+            <if test="companyName != null and companyName != ''">
+                and company_name like '%${companyName}%'
+            </if>
+            <if test="patentNo != null and patentNo != ''">
+                and p.id in
+                (select product_id from asso_product_patent where patent_no = #{patentNo}
+                union select product_id from asso_structure_patent where patent_no = #{patentNo})
+            </if>
+            <if test="productCategoryId != null and productCategoryId != ''">
+                and product_category_id = #{productCategoryId}
+            </if>
+            <if test="productCategoryName != null and productCategoryName != ''">
+                and product_category_id in (select id from product_category where product_category_name like
+                '%${productCategoryName}%')
+            </if>
+            <if test="true">
+                and product_category_id = #{pci}
+            </if>
+        </where>
         order by
         <choose>
             <when test="orderBy != null and orderBy != ''">
@@ -295,24 +324,30 @@
     <!--List<ProductGroupVO> queryByGroupCompanyName(ProductQueryPageDTO productQueryPageDTO);-->
     <select id="queryByGroupCompanyName" resultMap="queryByGroupCompanyNameMap">
         select company_name cn,
-        #{orderBy} orderBy, #{orderType} orderType
+        ifnull(#{orderBy}, '') orderBy,
+        ifnull(#{orderType}, '') orderType,
+        ifnull(#{productName}, '') productName,
+        ifnull(#{companyName}, '') companyName,
+        ifnull(#{patentNo}, '') patentNo,
+        ifnull(#{productCategoryId}, '') productCategoryId,
+        ifnull(#{productCategoryName}, '') productCategoryName
         from product
         <where>
-            <if test="productName != null">
+            <if test="productName != null and productName != ''">
                 and product_name like '%${productName}%'
             </if>
-            <if test="companyName != null">
+            <if test="companyName != null and companyName != ''">
                 and company_name like '%${companyName}%'
             </if>
-            <if test="patentNo != null">
+            <if test="patentNo != null and patentNo != ''">
                 and id in
                 (select product_id from asso_product_patent where patent_no = #{patentNo}
                 union select product_id from asso_structure_patent where patent_no = #{patentNo})
             </if>
-            <if test="productCategoryId != null">
+            <if test="productCategoryId != null and productCategoryId != ''">
                 and product_category_id = #{productCategoryId}
             </if>
-            <if test="productCategoryName != null">
+            <if test="productCategoryName != null and productCategoryName != ''">
                 and product_category_id in (select id from product_category where product_category_name like
                 '%${productCategoryName}%')
             </if>
@@ -327,7 +362,9 @@
     <resultMap id="queryByGroupCompanyNameMap" type="cn.cslg.pas.common.model.vo.ProductGroupVO">
         <result column="cn" property="companyName"/>
         <collection property="products" ofType="cn.cslg.pas.common.model.vo.ProductVO"
-                    select="queryByGroupCompanyNameMap2" column="{cn=cn, orderBy=orderBy, orderType=orderType}">
+                    select="queryByGroupCompanyNameMap2"
+                    column="{cn=cn, orderBy=orderBy, orderType=orderType, productName=productName, companyName=companyName,
+                             patentNo=patentNo, productCategoryId=productCategoryId, productCategoryName=productCategoryName}">
         </collection>
     </resultMap>
 
@@ -344,7 +381,29 @@
         product_category_name
         from product p
         join product_category pc on p.product_category_id = pc.id
-        where company_name = #{cn}
+        <where>
+            <if test="productName != null and productName != ''">
+                and product_name like '%${productName}%'
+            </if>
+            <if test="companyName != null and companyName != ''">
+                and company_name like '%${companyName}%'
+            </if>
+            <if test="patentNo != null and patentNo != ''">
+                and p.id in
+                (select product_id from asso_product_patent where patent_no = #{patentNo}
+                union select product_id from asso_structure_patent where patent_no = #{patentNo})
+            </if>
+            <if test="productCategoryId != null and productCategoryId != ''">
+                and product_category_id = #{productCategoryId}
+            </if>
+            <if test="productCategoryName != null and productCategoryName != ''">
+                and product_category_id in (select id from product_category where product_category_name like
+                '%${productCategoryName}%')
+            </if>
+            <if test="true">
+                and company_name = #{cn}
+            </if>
+        </where>
         order by
         <choose>
             <when test="orderBy != null and orderBy != ''">