zero 11 tháng trước cách đây
mục cha
commit
af5189c630

+ 66 - 0
src/main/java/cn/cslg/pas/common/dto/QueryNoveltyProjectDTO.java

@@ -2,6 +2,9 @@ package cn.cslg.pas.common.dto;
 
 import lombok.Data;
 
+import java.util.Date;
+import java.util.List;
+
 @Data
 public class QueryNoveltyProjectDTO {
 
@@ -19,4 +22,67 @@ public class QueryNoveltyProjectDTO {
 
     //角色
     private Integer roleType;
+
+    //筛选条件
+    private String customCaseNumber;
+
+    private String innerCaseNumber;
+
+    private String applicants;
+
+    private String inventor;
+
+    private String ipr;
+
+    private String technicalContact;
+
+    private String searchUnit;
+
+    private String searchUnitContact;
+
+    private String caseName;
+
+    private String searchReviewer;
+
+    private String preliminaryConclusions;
+
+    private String ifPatentability;
+
+    private String applicationAdvice;
+
+    private String applicationRemark;
+
+    private String replenishMeans;
+
+    private String writeAdvice;
+
+//    private String ipc;
+
+//    private String solvedProblem;
+
+//    private String technicalField;
+
+//    private String remark;
+
+    private String inventionPoint;
+
+    private List<String> createIds;
+
+    private String createName;
+
+    private Date createTime;
+
+    private List<String> headIds;
+
+    private String headName;
+
+    private Integer entrustType;
+
+    private List<String> entrustIds;
+
+    private String entrustName;
+
+    private List<String> departmentIds;
+
+    private String departmentName;
 }

+ 11 - 0
src/main/java/cn/cslg/pas/common/dto/QuerySimilarInventionPointDTO.java

@@ -0,0 +1,11 @@
+package cn.cslg.pas.common.dto;
+
+import lombok.Data;
+
+@Data
+public class QuerySimilarInventionPointDTO {
+
+    private String content;
+
+    private Integer projectId;
+}

+ 22 - 9
src/main/java/cn/cslg/pas/controller/NoveltyProjectController.java

@@ -7,11 +7,14 @@ import cn.cslg.pas.common.dto.NoveltyProjectDTO.NoveltyRetrieveRecordDTO;
 import cn.cslg.pas.common.dto.NoveltyProjectDTO.QueryTemplateDTO;
 import cn.cslg.pas.common.dto.business.LiteratureQueryDTO;
 import cn.cslg.pas.common.model.cronModel.Records;
+import cn.cslg.pas.common.model.request.StringRequest;
 import cn.cslg.pas.common.utils.Response;
 import cn.cslg.pas.common.vo.NoveltyProjectVO.QueryTemplateVO;
 import cn.cslg.pas.common.vo.QueryCompareFileVO;
 import cn.cslg.pas.common.vo.QueryInventionPointVO;
 import cn.cslg.pas.common.vo.TechnicalCaseVO;
+import cn.cslg.pas.factorys.businessFactory.Business;
+import cn.cslg.pas.factorys.businessFactory.BusinessFactory;
 import cn.cslg.pas.service.business.NoveltyProjectService;
 import cn.cslg.pas.service.business.TechnicalCaseService;
 import cn.cslg.pas.service.novelty.NoveltyReportTemplateService;
@@ -32,6 +35,8 @@ import java.io.IOException;
 @RequestMapping(Constants.API_XiaoSHI + "/noveltyProject")
 @RestController
 public class NoveltyProjectController {
+    @Autowired
+    private BusinessFactory businessFactory;
 
     @Autowired
     private NoveltyProjectService noveltyProjectService;
@@ -60,15 +65,23 @@ public class NoveltyProjectController {
         return Response.success(noveltyProjectId);
     }
 
+//    @Operation(summary = "查询查新检索报告")
+//    @PostMapping("/queryNoveltyProject")
+//    public Response queryNoveltyProject(@RequestBody QueryNoveltyProjectDTO noveltyProjectDTO) throws Exception {
+//        Records records = new Records();
+//        try {
+//            records = noveltyProjectService.queryNoveltyProject(noveltyProjectDTO);
+//        } catch (Exception e) {
+//            return Response.error(e.getMessage());
+//        }
+//        return Response.success(records);
+//    }
+
     @Operation(summary = "查询查新检索报告")
     @PostMapping("/queryNoveltyProject")
-    public Response queryNoveltyProject(@RequestBody QueryNoveltyProjectDTO noveltyProjectDTO) throws Exception {
-        Records records = new Records();
-        try {
-            records = noveltyProjectService.queryNoveltyProject(noveltyProjectDTO);
-        } catch (Exception e) {
-            return Response.error(e.getMessage());
-        }
+    public Response queryNoveltyProject(@RequestBody StringRequest stringRequest) throws Exception {
+        Business business = businessFactory.getClass("noveltyProjectService");
+        Records records = (Records) business.queryMessage(stringRequest);
         return Response.success(records);
     }
 
@@ -121,10 +134,10 @@ public class NoveltyProjectController {
 
     @Operation(summary = "查询技术方案相似发明点")
     @PostMapping("/querySimilarInventionPoint")
-    public Response querySimilarInventionPoint(@RequestBody String content) throws Exception {
+    public Response querySimilarInventionPoint(@RequestBody QuerySimilarInventionPointDTO vo) throws Exception {
         List<QueryInventionPointVO> inventionPointVOS = new ArrayList<>();
         try {
-            inventionPointVOS = technicalCaseService.querySimilarInventionPoint(content);
+            inventionPointVOS = technicalCaseService.querySimilarInventionPoint(vo);
         } catch (Exception e) {
             return Response.error(e.getMessage());
         }

+ 4 - 0
src/main/java/cn/cslg/pas/mapper/NoveltyProjectMapper.java

@@ -2,6 +2,7 @@ package cn.cslg.pas.mapper;
 
 import cn.cslg.pas.common.dto.QueryNoveltyProjectDTO;
 import cn.cslg.pas.common.vo.QueryNoveltyProjectVO;
+import cn.cslg.pas.common.vo.business.PatentProjectVO;
 import cn.cslg.pas.domain.business.NoveltyProject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
@@ -14,4 +15,7 @@ public interface NoveltyProjectMapper extends BaseMapper<NoveltyProject> {
 
     List<QueryNoveltyProjectVO> queryNoveltyProject(@Param("vo") QueryNoveltyProjectDTO vo);
     Long queryNoveltyProjectCount(@Param("vo") QueryNoveltyProjectDTO vo);
+
+    List<QueryNoveltyProjectVO> getPatentProject(String sql1, String sql2, String sql3);
+    Long getPatentProjectCount(String sql);
 }

+ 117 - 5
src/main/java/cn/cslg/pas/service/business/NoveltyProjectService.java

@@ -6,13 +6,18 @@ import cn.cslg.pas.common.dto.NoveltyProjectDTO.NoveltyProjectCopyDTO;
 import cn.cslg.pas.common.dto.NoveltyProjectIdDTO;
 import cn.cslg.pas.common.dto.QueryNoveltyProjectDTO;
 import cn.cslg.pas.common.model.cronModel.*;
+import cn.cslg.pas.common.model.request.GroupRequest;
+import cn.cslg.pas.common.model.request.QueryRequest;
 import cn.cslg.pas.common.utils.CacheUtils;
 import cn.cslg.pas.common.utils.LoginUtils;
 import cn.cslg.pas.common.vo.DepartmentVO;
+import cn.cslg.pas.common.vo.EntrustVO;
 import cn.cslg.pas.common.vo.QueryNoveltyProjectVO;
+import cn.cslg.pas.common.vo.business.PatentProjectVO;
 import cn.cslg.pas.domain.BaseEntity;
 import cn.cslg.pas.domain.business.*;
 import cn.cslg.pas.exception.XiaoShiException;
+import cn.cslg.pas.factorys.businessFactory.Business;
 import cn.cslg.pas.mapper.AssoTechnicalCaseFileMapper;
 import cn.cslg.pas.mapper.NoveltyProjectMapper;
 import cn.cslg.pas.mapper.ProjectMapper;
@@ -23,6 +28,7 @@ import cn.cslg.pas.service.novelty.NoveltyCompareLiteratureService;
 import cn.cslg.pas.service.novelty.NoveltyCompareRecordService;
 import cn.cslg.pas.service.novelty.NoveltySearchRecordService;
 import cn.cslg.pas.service.permissions.PermissionService;
+import cn.cslg.pas.service.query.FormatQueryService;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -38,6 +44,7 @@ import org.springframework.stereotype.Service;
 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.IOException;
 import java.util.ArrayList;
@@ -49,11 +56,14 @@ import java.util.stream.Collectors;
 @Service
 @Slf4j
 @RequiredArgsConstructor(onConstructor_ = {@Lazy})
-public class NoveltyProjectService extends ServiceImpl<NoveltyProjectMapper, NoveltyProject> {
+public class NoveltyProjectService extends ServiceImpl<NoveltyProjectMapper, NoveltyProject> implements Business {
     private final CacheUtils cacheUtils;
     private final LoginUtils loginUtils;
 
     @Autowired
+    private FormatQueryService formatQueryService;
+
+    @Autowired
     private FileManagerService fileManagerService;
 
     @Autowired
@@ -94,7 +104,7 @@ public class NoveltyProjectService extends ServiceImpl<NoveltyProjectMapper, Nov
         return records;
     }
 
-    public void loadPermissions(QueryNoveltyProjectDTO vo) {
+    public void loadPermissions(QueryNoveltyProjectDTO vo) throws IOException {
         PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
         String id = personnelVO.getId();
         Integer tenantId = personnelVO.getTenantId();
@@ -102,6 +112,36 @@ public class NoveltyProjectService extends ServiceImpl<NoveltyProjectMapper, Nov
         vo.setCreateId(id);
         vo.setTenantId(tenantId);
         vo.setRoleType(roleType);
+        if (StringUtils.isNotEmpty(vo.getCreateName())) {
+            String json = permissionService.getPersonIdByNamePCS(vo.getCreateName(), true);
+            if (StringUtils.isNotEmpty(json)) {
+                List<String> ids = JSON.parseArray(json, String.class);
+                vo.setCreateIds(ids);
+            }
+        }
+        if (StringUtils.isNotEmpty(vo.getHeadName())) {
+            String json = permissionService.getPersonIdByNamePCS(vo.getHeadName(), true);
+            if (StringUtils.isNotEmpty(json)) {
+                List<String> ids = JSON.parseArray(json, String.class);
+                vo.setHeadIds(ids);
+            }
+        }
+        if (StringUtils.isNotEmpty(vo.getEntrustName())) {
+            String json = permissionService.getEntrustsByName(vo.getEntrustName(), 1);
+            if (StringUtils.isNotEmpty(json)) {
+                List<EntrustVO> entrustVOS = JSON.parseArray(json, EntrustVO.class);
+                List<String> ids = entrustVOS.stream().map(EntrustVO::getEntrustId).collect(Collectors.toList());
+                vo.setEntrustIds(ids);
+                vo.setEntrustType(1);
+            }
+        }
+        if (StringUtils.isNotEmpty(vo.getDepartmentName())) {
+            String json = permissionService.getDepartmentIdByName(vo.getDepartmentName(), true);
+            if (StringUtils.isNotEmpty(json)) {
+                List<String> ids = JSON.parseArray(json, String.class);
+                vo.setDepartmentIds(ids);
+            }
+        }
     }
 
     private void loadNoveltyProjectVOS(List<QueryNoveltyProjectVO> noveltyProjectVOS) throws IOException {
@@ -356,8 +396,8 @@ public class NoveltyProjectService extends ServiceImpl<NoveltyProjectMapper, Nov
     public Integer copyNoveltyProject(NoveltyProjectCopyDTO noveltyProjectCopyDTO) throws Exception {
         Integer fromProjectId = noveltyProjectCopyDTO.getFromProjectId();
         Integer toProjectId = noveltyProjectCopyDTO.getToProjectId();
-        if(toProjectId==null){
-         toProjectId= this.addNoveltyProject(new AddNoveltyProjectDTO());
+        if (toProjectId == null) {
+            toProjectId = this.addNoveltyProject(new AddNoveltyProjectDTO());
         }
         List<String> compareRecordIds = noveltyProjectCopyDTO.getCompareRecordIds();
         List<Integer> searchRecordIds = noveltyProjectCopyDTO.getSearchRecordIds();
@@ -366,6 +406,78 @@ public class NoveltyProjectService extends ServiceImpl<NoveltyProjectMapper, Nov
         noveltySearchRecordService.copySearchRecord(searchRecordIds, toProjectId);
         noveltyCompareLiteratureService.copyCompareFile(compareLiteratureIds, toProjectId, fromProjectId);
         noveltyCompareRecordService.copyCompareRecord(compareRecordIds, toProjectId, fromProjectId);
- return toProjectId;
+        return toProjectId;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Object queryMessage(QueryRequest queryRequest) throws Exception {
+        List<String> sqls = formatQueryService.formatSqls(queryRequest, "noveltyProject");
+        sqls = this.loadSearchSql(sqls);
+        //根据sql查询专题库信息
+        List<QueryNoveltyProjectVO> noveltyProjectVOS = noveltyProjectMapper.getPatentProject(sqls.get(0), sqls.get(1), sqls.get(2));
+        Long total = noveltyProjectMapper.getPatentProjectCount(sqls.get(0));
+        //装载信息
+        this.loadNoveltyProjectVOS(noveltyProjectVOS);
+        Records records = new Records();
+        records.setCurrent(queryRequest.getCurrent());
+        records.setSize(queryRequest.getSize());
+        records.setData(noveltyProjectVOS);
+        records.setTotal(total);
+        return records;
+    }
+
+    //装载查询语句
+    private List<String> loadSearchSql(List<String> sqls) {
+        PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+        String id = personnelVO.getId();
+        Integer tenantId = personnelVO.getTenantId();
+        Integer roleType = personnelVO.getRoleType();
+        String rootSql = "";
+        if (roleType == null || roleType.equals(0)) {
+            rootSql = "(p.create_id =" + id + " or p.head_id=" + id + " or p.id in (select project_id from asso_project_person where person_id =" + id + "))";
+
+        } else if (roleType.equals(2)) {
+            rootSql = "(p.tenant_id=" + tenantId + " or p.id in (select project_id from asso_project_person where person_id =" + id + "))";
+        }
+
+        if (sqls.get(0) != null && !sqls.get(0).equals("") && !rootSql.equals("")) {
+            sqls.set(0, rootSql + " and" + "(" + sqls.get(0) + ")");
+        } else if ((sqls.get(0) == null || sqls.get(0).equals("")) && !rootSql.equals("")) {
+            sqls.set(0, rootSql);
+        }
+
+        return sqls;
+
+    }
+
+    @Override
+    public Object addMessage(Object object, List<MultipartFile> files) {
+        return null;
+    }
+
+    @Override
+    public Object deleteMessage(List<Integer> ids) throws IOException {
+        return null;
+    }
+
+    @Override
+    public Object updateMessage(Object object, List<MultipartFile> files) {
+        return null;
+    }
+
+    @Override
+    public Object getGroup(GroupRequest groupRequest, String tableName) throws Exception {
+        return null;
+    }
+
+    @Override
+    public Object addMessage(Object object) {
+        return null;
+    }
+
+    @Override
+    public Object updateMessage(Object object) {
+        return null;
     }
 }

+ 12 - 2
src/main/java/cn/cslg/pas/service/business/TechnicalCaseService.java

@@ -1,6 +1,7 @@
 package cn.cslg.pas.service.business;
 
 import cn.cslg.pas.common.dto.AddTechnicalCaseDTO;
+import cn.cslg.pas.common.dto.QuerySimilarInventionPointDTO;
 import cn.cslg.pas.common.dto.TechnicalCaseIdDTO;
 import cn.cslg.pas.common.model.cronModel.Personnel;
 import cn.cslg.pas.common.model.cronModel.PersonnelVO;
@@ -173,14 +174,23 @@ public class TechnicalCaseService extends ServiceImpl<TechnicalCaseMapper, Techn
         return technicalCaseVO;
     }
 
-    public List<QueryInventionPointVO> querySimilarInventionPoint(String content) throws IOException {
+    public List<QueryInventionPointVO> querySimilarInventionPoint(QuerySimilarInventionPointDTO vo) throws IOException {
+        String content = vo.getContent();
+        Integer projectId = vo.getProjectId();
         SearchRequest.Builder builder = new SearchRequest.Builder();
         //设置查询索引
         builder.index("technicalPatent");
         Like likeContent = Like.of(i -> i.text(content));
         Query query = QueryBuilders.moreLikeThis(i -> i.fields("invention_point").like(likeContent)
                 .minTermFreq(1).maxQueryTerms(12).minDocFreq(1));
-        builder.query(query);
+        Query bool = null;
+        if (projectId != null) {
+            Query query1 = QueryBuilders.term(i -> i.field("project_id").value(projectId));
+            bool = QueryBuilders.bool(i -> i.must(query).mustNot(query1));
+        } else {
+            bool = QueryBuilders.bool(i -> i.must(query));
+        }
+        builder.query(bool);
         builder.size(5);
         //解除最大条数限制
 //        builder.trackTotalHits(i -> i.enabled(true));

+ 80 - 0
src/main/java/cn/cslg/pas/service/query/FormatQueryService.java

@@ -34,6 +34,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 import co.elastic.clients.elasticsearch._types.query_dsl.Query;
+import org.springframework.util.CollectionUtils;
 
 import java.io.*;
 import java.text.ParseException;
@@ -300,6 +301,85 @@ public class FormatQueryService {
     }
 
     /**
+     * 返回查新报告sql列表
+     *
+     * @param queryRequest
+     * @return
+     */
+    public List<String> formatSqls(QueryRequest queryRequest, String tableName) {
+        List<String> sqls = new ArrayList<>();
+        String sql1 = "";
+        String sql2 = "";
+        String sql3 = "";
+        //合成检索式
+        StringRequest stringRequest = null;
+
+        if (queryRequest instanceof MapRequest) {
+
+        } else {
+            stringRequest = (StringRequest) queryRequest;
+        }
+
+        String condition = stringRequest.getSearchQuery();
+
+        if (queryRequest.getGroupField() != null) {
+            String value ="";
+            if(queryRequest.getGroupFieldValue()==null||queryRequest.getGroupFieldValue().equals("未知")){
+                value = queryRequest.getGroupField() + "=" +"null";
+            }
+            else {
+                value =queryRequest.getGroupField() + "=" + queryRequest.getGroupFieldValue();
+            }
+            if (condition != null && condition != "") {
+                condition += " AND " + value;
+            } else {
+                condition = value;
+            }
+        }
+        if (queryRequest.getProjectId() != null) {
+            if (condition != null && condition != "") {
+                condition += " AND " + "projectId" + "=" + queryRequest.getProjectId();
+            } else {
+                condition = "projectId" + "=" + queryRequest.getProjectId();
+            }
+        }
+
+        //检索式格式化
+        if (StringUtils.isNotEmpty(condition)) {
+            try {
+                //将检索式转换为二叉树
+                treeNode tree = expressManager.getInstance().Parse(condition, false);
+                //格式化检索式
+                sql1 = this.ToString2((operateNode) tree, null, tableName);
+            } catch (Exception e) {
+                throw new ConditionException("检索式错误");
+            }
+        }
+
+        //格式化排序
+        if (!CollectionUtils.isEmpty(queryRequest.getOrderDTOList())) {
+            String orderSql = this.orderToString(queryRequest.getOrderDTOList(), tableName);
+            sql2 = orderSql;
+        } else {
+            sql2 = "order by p.create_time desc";
+        }
+
+        //格式化 分页信息
+        if (queryRequest.getSize() != null && queryRequest.getCurrent() != null) {
+            Long size = queryRequest.getSize();
+            Long current = queryRequest.getCurrent();
+            String page = " limit " + ((current - 1) * size) + "," + size;
+            sql3 = page;
+        }
+
+        //格式化分组信息
+        sqls.add(sql1);
+        sqls.add(sql2);
+        sqls.add(sql3);
+        return sqls;
+    }
+
+    /**
      * 网站检索式格式化
      *
      * @param node

+ 398 - 0
src/main/resources/jsons/noveltyProject.json

@@ -0,0 +1,398 @@
+[
+  {
+    "name": "项目id",
+    "type": "Integer",
+    "value": "projectId",
+    "field": "projectId",
+    "sqlField": "p.id",
+    "sqlClass": "getComSql",
+    "orderClass": "",
+    "groupClass": "",
+    "ifSearch": "false",
+    "ifGroup": "false",
+    "ifShow": "false",
+    "ifAsCondition": "true"
+  },
+  {
+    "name": "查新报告项目id",
+    "type": "Integer",
+    "value": "noveltyProjectId",
+    "field": "noveltyProjectId",
+    "sqlField": "np.id",
+    "sqlClass": "getComSql",
+    "orderClass": "",
+    "groupClass": "",
+    "ifSearch": "false",
+    "ifGroup": "false",
+    "ifShow": "false",
+    "ifAsCondition": "true"
+  },
+  {
+    "name": "技术方案id",
+    "type": "Integer",
+    "value": "technicalCaseId",
+    "field": "technicalCaseId",
+    "sqlField": "tc.id",
+    "sqlClass": "getComSql",
+    "orderClass": "",
+    "groupClass": "",
+    "ifSearch": "false",
+    "ifGroup": "false",
+    "ifShow": "false",
+    "ifAsCondition": "true"
+  },
+  {
+    "name": "发明点",
+    "type": "String",
+    "value": "inventionPoint",
+    "field": "inventionPoint",
+    "sqlField": "tc.invention_point",
+    "sqlClass": "getLikeSql",
+    "orderClass": "getComOrder",
+    "groupClass": "getComGroup",
+    "ifSearch": "true",
+    "ifGroup": "false",
+    "ifShow": "true",
+    "ifAsCondition": "true"
+  },
+  {
+    "name": "客户案号",
+    "type": "String",
+    "value": "customCaseNumber",
+    "field": "customCaseNumber",
+    "sqlField": "np.custom_case_number",
+    "sqlClass": "getLikeSql",
+    "orderClass": "getComOrder",
+    "groupClass": "getComGroup",
+    "ifSearch": "true",
+    "ifGroup": "false",
+    "ifShow": "true",
+    "ifAsCondition": "true"
+  },
+  {
+    "name": "内部案号",
+    "type": "String",
+    "value": "innerCaseNumber",
+    "field": "innerCaseNumber",
+    "sqlField": "np.inner_case_number",
+    "sqlClass": "getLikeSql",
+    "orderClass": "getComOrder",
+    "groupClass": "getComGroup",
+    "ifSearch": "true",
+    "ifGroup": "false",
+    "ifShow": "true",
+    "ifAsCondition": "true"
+  },
+  {
+    "name": "申请单位",
+    "type": "String",
+    "value": "applicants",
+    "field": "applicants",
+    "sqlField": "np.applicants",
+    "sqlClass": "getLikeSql",
+    "orderClass": "getComOrder",
+    "groupClass": "getComGroup",
+    "ifSearch": "true",
+    "ifGroup": "false",
+    "ifShow": "true",
+    "ifAsCondition": "true"
+  },
+  {
+    "name": "发明人",
+    "type": "String",
+    "value": "inventor",
+    "field": "inventor",
+    "sqlField": "np.inventor",
+    "sqlClass": "getLikeSql",
+    "orderClass": "getComOrder",
+    "groupClass": "getComGroup",
+    "ifSearch": "true",
+    "ifGroup": "false",
+    "ifShow": "true",
+    "ifAsCondition": "true"
+  },
+  {
+    "name": "IPR",
+    "type": "String",
+    "value": "ipr",
+    "field": "ipr",
+    "sqlField": "np.ipr",
+    "sqlClass": "getLikeSql",
+    "orderClass": "getComOrder",
+    "groupClass": "getComGroup",
+    "ifSearch": "true",
+    "ifGroup": "false",
+    "ifShow": "true",
+    "ifAsCondition": "true"
+  },
+  {
+    "name": "技术接口人",
+    "type": "String",
+    "value": "technicalContact",
+    "field": "technicalContact",
+    "sqlField": "np.technical_contact",
+    "sqlClass": "getLikeSql",
+    "orderClass": "getComOrder",
+    "groupClass": "getComGroup",
+    "ifSearch": "true",
+    "ifGroup": "false",
+    "ifShow": "true",
+    "ifAsCondition": "true"
+  },
+  {
+    "name": "检索单位",
+    "type": "String",
+    "value": "searchUnit",
+    "field": "searchUnit",
+    "sqlField": "np.search_unit",
+    "sqlClass": "getLikeSql",
+    "orderClass": "getComOrder",
+    "groupClass": "getComGroup",
+    "ifSearch": "true",
+    "ifGroup": "false",
+    "ifShow": "true",
+    "ifAsCondition": "true"
+  },
+  {
+    "name": "检索员联系方式",
+    "type": "String",
+    "value": "searchUnitContact",
+    "field": "searchUnitContact",
+    "sqlField": "np.search_unit_contact",
+    "sqlClass": "getLikeSql",
+    "orderClass": "getComOrder",
+    "groupClass": "getComGroup",
+    "ifSearch": "true",
+    "ifGroup": "false",
+    "ifShow": "true",
+    "ifAsCondition": "true"
+  },
+  {
+    "name": "案件名称",
+    "type": "String",
+    "value": "caseName",
+    "field": "caseName",
+    "sqlField": "np.case_name",
+    "sqlClass": "getLikeSql",
+    "orderClass": "getComOrder",
+    "groupClass": "getComGroup",
+    "ifSearch": "true",
+    "ifGroup": "false",
+    "ifShow": "true",
+    "ifAsCondition": "true"
+  },
+  {
+    "name": "检索审核人",
+    "type": "String",
+    "value": "searchReviewer",
+    "field": "searchReviewer",
+    "sqlField": "np.search_reviewer",
+    "sqlClass": "getLikeSql",
+    "orderClass": "getComOrder",
+    "groupClass": "getComGroup",
+    "ifSearch": "true",
+    "ifGroup": "false",
+    "ifShow": "true",
+    "ifAsCondition": "true"
+  },
+  {
+    "name": "初步结论",
+    "type": "String",
+    "value": "preliminaryConclusions",
+    "field": "preliminaryConclusions",
+    "sqlField": "np.preliminary_conclusions",
+    "sqlClass": "getLikeSql",
+    "orderClass": "getComOrder",
+    "groupClass": "getComGroup",
+    "ifSearch": "true",
+    "ifGroup": "false",
+    "ifShow": "true",
+    "ifAsCondition": "true"
+  },
+  {
+    "name": "是否具有专利性",
+    "type": "String",
+    "value": "ifPatentability",
+    "field": "ifPatentability",
+    "sqlField": "np.if_patentability",
+    "sqlClass": "getLikeSql",
+    "orderClass": "getComOrder",
+    "groupClass": "getComGroup",
+    "ifSearch": "true",
+    "ifGroup": "false",
+    "ifShow": "true",
+    "ifAsCondition": "true"
+  },
+  {
+    "name": "申请建议",
+    "type": "String",
+    "value": "applicationAdvice",
+    "field": "applicationAdvice",
+    "sqlField": "np.application_advice",
+    "sqlClass": "getLikeSql",
+    "orderClass": "getComOrder",
+    "groupClass": "getComGroup",
+    "ifSearch": "true",
+    "ifGroup": "false",
+    "ifShow": "true",
+    "ifAsCondition": "true"
+  },
+  {
+    "name": "申请描述",
+    "type": "String",
+    "value": "applicationRemark",
+    "field": "applicationRemark",
+    "sqlField": "np.application_remark",
+    "sqlClass": "getLikeSql",
+    "orderClass": "getComOrder",
+    "groupClass": "getComGroup",
+    "ifSearch": "true",
+    "ifGroup": "false",
+    "ifShow": "true",
+    "ifAsCondition": "true"
+  },
+  {
+    "name": "需要补充资料",
+    "type": "String",
+    "value": "replenishMeans",
+    "field": "replenishMeans",
+    "sqlField": "np.replenish_means",
+    "sqlClass": "getLikeSql",
+    "orderClass": "getComOrder",
+    "groupClass": "getComGroup",
+    "ifSearch": "true",
+    "ifGroup": "false",
+    "ifShow": "true",
+    "ifAsCondition": "true"
+  },
+  {
+    "name": "撰写要点建议",
+    "type": "String",
+    "value": "writeAdvice",
+    "field": "writeAdvice",
+    "sqlField": "np.write_advice",
+    "sqlClass": "getLikeSql",
+    "orderClass": "getComOrder",
+    "groupClass": "getComGroup",
+    "ifSearch": "true",
+    "ifGroup": "false",
+    "ifShow": "true",
+    "ifAsCondition": "true"
+  },
+  {
+    "name": "租户id",
+    "type": "Integer",
+    "value": "tenantId",
+    "field": "tenantId",
+    "sqlField": "p.tenant_id",
+    "sqlClass": "getComSql",
+    "orderClass": "",
+    "groupClass": "",
+    "ifSearch": "false",
+    "ifGroup": "false",
+    "ifShow": "false",
+    "ifAsCondition": "true"
+  },
+  {
+    "name": "负责人名称",
+    "type": "String",
+    "value": "headName",
+    "field": "headName",
+    "sqlField": "p.head_id",
+    "sqlClass": "getCreateNameSql",
+    "orderClass": "getCreateNameOrder",
+    "groupClass": "getComGroup",
+    "ifSearch": "true",
+    "ifGroup": "false",
+    "ifShow": "true",
+    "defaultHidden": "true",
+    "ifAsCondition": "true"
+  },
+  {
+    "name": "负责部门",
+    "type": "String",
+    "value": "departmentName",
+    "field": "departmentName",
+    "sqlField": "p.department_id",
+    "sqlClass": "getDepartmentNameSql",
+    "orderClass": "getDepartmentNameOrder",
+    "groupClass": "getScenarioGroup",
+    "ifSearch": "true",
+    "ifGroup": "false",
+    "ifShow": "true",
+    "defaultHidden": "true",
+    "ifAsCondition": "true"
+  },
+  {
+    "name": "委托类型",
+    "type": "Integer",
+    "value": "entrustType",
+    "field": "entrustType",
+    "sqlField": "p.entrust_type",
+    "sqlClass": "getComSql",
+    "orderClass": "",
+    "groupClass": "",
+    "ifSearch": "false",
+    "ifGroup": "false",
+    "ifShow": "false",
+    "ifAsCondition": "true"
+  },
+  {
+    "name": "委托方",
+    "type": "String",
+    "value": "entrustName",
+    "field": "entrustName",
+    "sqlField": "p.entrust_id",
+    "sqlClass": "getEntrustTrueNameSql",
+    "orderClass": "getEntrustOrder",
+    "groupClass": "getEntrustGroup",
+    "ifSearch": "true",
+    "ifGroup": "false",
+    "ifShow": "true",
+    "defaultHidden": "true",
+    "ifAsCondition": "true"
+  },
+  {
+    "name": "委托方",
+    "type": "String",
+    "value": "entrustNameTrue",
+    "field": "entrustNameTrue",
+    "sqlField": "p.entrust_id",
+    "sqlClass": "getEntrustTrueNameSql",
+    "orderClass": "getEntrustOrder",
+    "groupClass": "getEntrustGroup",
+    "ifSearch": "false",
+    "ifGroup": "true",
+    "ifShow": "false",
+    "defaultHidden": "false",
+    "ifAsCondition": "true"
+  },
+  {
+    "name": "创建人",
+    "type": "String",
+    "value": "createName",
+    "field": "createName",
+    "sqlField": "p.create_id",
+    "sqlClass": "getCreateNameSql",
+    "orderClass": "getCreateNameOrder",
+    "groupClass": "getComGroup",
+    "ifSearch": "true",
+    "ifGroup": "false",
+    "ifShow": "true",
+    "ifAsCondition": "true"
+  },
+  {
+    "name": "创建时间",
+    "type": "DateTime",
+    "value": "createTime",
+    "field": "createTime",
+    "sqlField": "p.create_time",
+    "sqlClass": "getDateTimeSql",
+    "orderClass": "getComOrder",
+    "groupClass": "getTimeGroup",
+    "ifSearch": "true",
+    "ifGroup": "false",
+    "ifShow": "true",
+    "ifAsCondition": "true"
+  }
+]

+ 222 - 1
src/main/resources/mapper/NoveltyProjectMapper.xml

@@ -41,6 +41,87 @@
             <if test="vo.projectId != null">
                 np.project_id = #{vo.projectId}
             </if>
+            <if test="vo.customCaseNumber != null and vo.customCaseNumber != ''">
+                and np.custom_case_number like concat('%',#{vo.customCaseNumber},'%')
+            </if>
+            <if test="vo.innerCaseNumber != null and vo.innerCaseNumber != ''">
+                and np.inner_case_number like concat('%',#{vo.innerCaseNumber},'%')
+            </if>
+            <if test="vo.applicants != null and vo.applicants != ''">
+                and np.applicants like concat('%',#{vo.applicants},'%')
+            </if>
+            <if test="vo.inventor != null and vo.inventor != ''">
+                and np.inventor like concat('%',#{vo.inventor},'%')
+            </if>
+            <if test="vo.ipr != null and vo.ipr != ''">
+                and np.ipr like concat('%',#{vo.ipr},'%')
+            </if>
+            <if test="vo.technicalContact != null and vo.technicalContact != ''">
+                and np.technical_contact like concat('%',#{vo.technicalContact},'%')
+            </if>
+            <if test="vo.searchUnit != null and vo.searchUnit != ''">
+                and np.search_unit like concat('%',#{vo.searchUnit},'%')
+            </if>
+            <if test="vo.searchUnitContact != null and vo.searchUnitContact != ''">
+                and np.search_unit_contact like concat('%',#{vo.searchUnitContact},'%')
+            </if>
+            <if test="vo.caseName != null and vo.caseName != ''">
+                and np.case_name like concat('%',#{vo.caseName},'%')
+            </if>
+            <if test="vo.searchReviewer != null and vo.searchReviewer != ''">
+                and np.search_reviewer like concat('%',#{vo.searchReviewer},'%')
+            </if>
+            <if test="vo.preliminaryConclusions != null and vo.preliminaryConclusions != ''">
+                and np.preliminary_conclusions like concat('%',#{vo.preliminaryConclusions},'%')
+            </if>
+            <if test="vo.ifPatentability != null and vo.ifPatentability != ''">
+                and np.if_patentability like concat('%',#{vo.ifPatentability},'%')
+            </if>
+            <if test="vo.applicationAdvice != null and vo.applicationAdvice != ''">
+                and np.application_advice like concat('%',#{vo.applicationAdvice},'%')
+            </if>
+            <if test="vo.applicationRemark != null and vo.applicationRemark != ''">
+                and np.application_remark like concat('%',#{vo.applicationRemark},'%')
+            </if>
+            <if test="vo.replenishMeans != null and vo.replenishMeans != ''">
+                and np.replenish_means like concat('%',#{vo.replenishMeans},'%')
+            </if>
+            <if test="vo.writeAdvice != null and vo.writeAdvice != ''">
+                and np.write_advice like concat('%',#{vo.writeAdvice},'%')
+            </if>
+            <if test="vo.inventionPoint != null and vo.inventionPoint != ''">
+                and tc.invention_point like concat('%',#{vo.inventionPoint},'%')
+            </if>
+            <if test="vo.createIds != null and vo.createIds.size() > 0">
+                and p.create_id in
+                <foreach collection="vo.createIds" index="index" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="vo.headIds != null and vo.headIds.size() > 0">
+                and p.head_id in
+                <foreach collection="vo.headIds" index="index" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="vo.departmentIds != null and vo.departmentIds.size() > 0">
+                and p.department_id in
+                <foreach collection="vo.departmentIds" index="index" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="vo.entrustIds != null and vo.entrustIds.size() > 0">
+                and p.entrust_id in
+                <foreach collection="vo.entrustIds" index="index" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="vo.entrustType != null">
+                and p.entrust_type = #{vo.entrustType}
+            </if>
+            <if test="vo.createTime != null">
+                and p.create_time = #{vo.createTime}
+            </if>
             <if test="vo.roleType == null or vo.roleType == 0">
                 and (p.create_id = #{vo.createId} or p.head_id = #{vo.createId} or p.id in (select project_id from asso_project_person where person_id = #{vo.createId}))
             </if>
@@ -62,8 +143,148 @@
         left join technical_case tc on tc.project_id = p.id
         <where>
             <if test="vo.projectId != null">
-                and np.project_id = #{vo.projectId}
+                np.project_id = #{vo.projectId}
+            </if>
+            <if test="vo.customCaseNumber != null and vo.customCaseNumber != ''">
+                and np.custom_case_number like concat('%',#{vo.customCaseNumber},'%')
+            </if>
+            <if test="vo.innerCaseNumber != null and vo.innerCaseNumber != ''">
+                and np.inner_case_number like concat('%',#{vo.innerCaseNumber},'%')
+            </if>
+            <if test="vo.applicants != null and vo.applicants != ''">
+                and np.applicants like concat('%',#{vo.applicants},'%')
+            </if>
+            <if test="vo.inventor != null and vo.inventor != ''">
+                and np.inventor like concat('%',#{vo.inventor},'%')
+            </if>
+            <if test="vo.ipr != null and vo.ipr != ''">
+                and np.ipr like concat('%',#{vo.ipr},'%')
+            </if>
+            <if test="vo.technicalContact != null and vo.technicalContact != ''">
+                and np.technical_contact like concat('%',#{vo.technicalContact},'%')
+            </if>
+            <if test="vo.searchUnit != null and vo.searchUnit != ''">
+                and np.search_unit like concat('%',#{vo.searchUnit},'%')
+            </if>
+            <if test="vo.searchUnitContact != null and vo.searchUnitContact != ''">
+                and np.search_unit_contact like concat('%',#{vo.searchUnitContact},'%')
+            </if>
+            <if test="vo.caseName != null and vo.caseName != ''">
+                and np.case_name like concat('%',#{vo.caseName},'%')
+            </if>
+            <if test="vo.searchReviewer != null and vo.searchReviewer != ''">
+                and np.search_reviewer like concat('%',#{vo.searchReviewer},'%')
+            </if>
+            <if test="vo.preliminaryConclusions != null and vo.preliminaryConclusions != ''">
+                and np.preliminary_conclusions like concat('%',#{vo.preliminaryConclusions},'%')
+            </if>
+            <if test="vo.ifPatentability != null and vo.ifPatentability != ''">
+                and np.if_patentability like concat('%',#{vo.ifPatentability},'%')
+            </if>
+            <if test="vo.applicationAdvice != null and vo.applicationAdvice != ''">
+                and np.application_advice like concat('%',#{vo.applicationAdvice},'%')
+            </if>
+            <if test="vo.applicationRemark != null and vo.applicationRemark != ''">
+                and np.application_remark like concat('%',#{vo.applicationRemark},'%')
+            </if>
+            <if test="vo.replenishMeans != null and vo.replenishMeans != ''">
+                and np.replenish_means like concat('%',#{vo.replenishMeans},'%')
+            </if>
+            <if test="vo.writeAdvice != null and vo.writeAdvice != ''">
+                and np.write_advice like concat('%',#{vo.writeAdvice},'%')
+            </if>
+            <if test="vo.inventionPoint != null and vo.inventionPoint != ''">
+                and tc.invention_point like concat('%',#{vo.inventionPoint},'%')
+            </if>
+            <if test="vo.createIds != null and vo.createIds.size() > 0">
+                and p.create_id in
+                <foreach collection="vo.createIds" index="index" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="vo.headIds != null and vo.headIds.size() > 0">
+                and p.head_id in
+                <foreach collection="vo.headIds" index="index" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="vo.departmentIds != null and vo.departmentIds.size() > 0">
+                and p.department_id in
+                <foreach collection="vo.departmentIds" index="index" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="vo.entrustIds != null and vo.entrustIds.size() > 0">
+                and p.entrust_id in
+                <foreach collection="vo.entrustIds" index="index" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="vo.entrustType != null">
+                and p.entrust_type = #{vo.entrustType}
+            </if>
+            <if test="vo.createTime != null">
+                and p.create_time = #{vo.createTime}
+            </if>
+            <if test="vo.roleType == null or vo.roleType == 0">
+                and (p.create_id = #{vo.createId} or p.head_id = #{vo.createId} or p.id in (select project_id from asso_project_person where person_id = #{vo.createId}))
+            </if>
+            <if test="vo.roleType == 2">
+                and (p.tenant_id = #{vo.tenantId} or p.id in (select project_id from asso_project_person where person_id = #{vo.createId}))
             </if>
         </where>
     </select>
+
+    <select id="getPatentProject" resultType="cn.cslg.pas.common.vo.QueryNoveltyProjectVO">
+        select p.id as projectId,
+               p.entrust_type,
+               p.entrust_id,
+               p.head_id,
+               p.department_id,
+               p.create_id,
+               p.create_time,
+               p.tenant_id,
+               np.id as noveltyProjectId,
+               tc.id as technicalCaseId,
+               np.custom_case_number,
+               np.inner_case_number,
+               np.applicants,
+               np.inventor,
+               np.ipr,
+               np.technical_contact,
+               np.search_unit,
+               np.search_unit_contact,
+               np.case_name,
+               np.search_reviewer,
+               np.preliminary_conclusions,
+               np.if_patentability,
+               np.application_advice,
+               np.application_remark,
+               np.replenish_means,
+               np.write_advice,
+               tc.ipc,
+               tc.solved_problem,
+               tc.technical_field,
+               tc.remark,
+               tc.invention_point
+        from novelty_project np
+        left join project p on p.id = np.project_id
+        left join technical_case tc on tc.project_id = p.id
+        <if test="sql1!=''">
+            where ${sql1}
+        </if>
+        ${sql2} ${sql3}
+    </select>
+
+    <select id="getPatentProjectCount" resultType="java.lang.Long">
+        select count(*)
+        from novelty_project np
+        left join project p on p.id = np.project_id
+        left join technical_case tc on tc.project_id = p.id
+        <if test="sql1!=''">
+            where ${sql1}
+        </if>
+    </select>
+
+
 </mapper>