Browse Source

报告专利挖掘查询

lwhhszx 1 year ago
parent
commit
d096ae77e7

+ 65 - 0
src/main/java/cn/cslg/pas/factorys/reGroupFactory/GetEntrustGroup.java

@@ -0,0 +1,65 @@
+package cn.cslg.pas.factorys.reGroupFactory;
+
+import cn.cslg.pas.common.model.cronModel.ReGroupDataVO;
+import cn.cslg.pas.common.vo.EntityVO;
+import cn.cslg.pas.common.vo.EntrustVO;
+import cn.cslg.pas.domain.business.Matter;
+import cn.cslg.pas.mapper.EventMapper;
+import cn.cslg.pas.service.business.MatterService;
+import cn.cslg.pas.service.permissions.PermissionService;
+import com.alibaba.fastjson.JSON;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+@Slf4j
+@Component
+public class GetEntrustGroup implements QueryGroupImp {
+    @Autowired
+    private EventMapper eventMapper;
+    @Autowired
+    private PermissionService permissionService;
+
+    @Override
+    public ReGroupDataVO getGroup(List<String> sqls, String tableName, String groupField) {
+        groupField = "p.entrust_type,p.entrust_id";
+        ReGroupDataVO reGroupDataVO = new ReGroupDataVO();
+        List<Map<String, Object>> maps = new ArrayList<>();
+        String selectField = groupField;
+        List<EntrustVO> entrustVOList = new ArrayList<>();
+        try {
+            String json = permissionService.getEntrustsOrder(0);
+            entrustVOList = JSON.parseArray(json, EntrustVO.class);
+        } catch (Exception e) {
+        }
+
+        List<EntrustVO> entrustVOS = eventMapper.getEntrustGroup(sqls, tableName, groupField, selectField);
+        Long total = eventMapper.getEntrustGroupCount(sqls, tableName, groupField, selectField);
+        //装载调查类型名称
+        for (EntrustVO item : entrustVOS) {
+            if (item == null) {
+                continue;
+            }
+            EntrustVO entrustVO = entrustVOList.stream().filter(tem -> tem.getEntrustId().equals(item.getEntrustId()) && tem.getEntrustType().equals(item.getEntrustType())).findFirst().orElse(null);
+            if (entrustVO != null) {
+                Map<String, Object> map = new HashMap<>();
+                map.put("name", entrustVO.getName());
+                map.put("value", entrustVO.getName());
+                map.put("count",item.getNum());
+                maps.add(map);
+            }
+        }
+        reGroupDataVO.setValues(maps);
+        reGroupDataVO.setTotal(total);
+        return reGroupDataVO;
+    }
+
+    ;
+
+}

+ 55 - 0
src/main/java/cn/cslg/pas/factorys/reGroupFactory/GetMatterGroup.java

@@ -0,0 +1,55 @@
+package cn.cslg.pas.factorys.reGroupFactory;
+
+import cn.cslg.pas.common.model.cronModel.ReGroupDataVO;
+import cn.cslg.pas.common.vo.GroupReVO;
+import cn.cslg.pas.domain.business.Matter;
+import cn.cslg.pas.domain.business.SystemDict;
+import cn.cslg.pas.mapper.EventMapper;
+import cn.cslg.pas.service.business.MatterService;
+import cn.cslg.pas.service.business.SystemDictService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.*;
+
+
+@Slf4j
+@Component
+public class GetMatterGroup implements QueryGroupImp {
+    @Autowired
+    private EventMapper eventMapper;
+    @Autowired
+    private MatterService matterService;
+
+    @Override
+    public ReGroupDataVO getGroup(List<String> sqls, String tableName, String groupField) {
+        ReGroupDataVO reGroupDataVO =new ReGroupDataVO();
+        List<Map<String, Object>> maps = new ArrayList<>();
+        String selectField = groupField;
+        List<Matter> matters = matterService.list();
+
+           tableName+=" left join pas_prod2.asso_project_event as aspe on p.id = aspe.project_id";
+        //分组查询应用场景
+        List<GroupReVO> matterIds = eventMapper.getGroups(sqls, tableName, groupField, selectField);
+        Long total =eventMapper.getGroupsCount(sqls, tableName, groupField, selectField);
+        //装载调查类型名称
+        matterIds.forEach(item->{
+            Matter matter = matters.stream().filter(tem->tem.getId().toString().equals(item.getValue())).findFirst().orElse(null);
+            if(matter!=null)
+            {
+                Map<String,Object> map =new HashMap<>();
+                map.put("name",matter.getName());
+                map.put("value",matter.getId());
+                map.put("count",item.getNum());
+                maps.add(map);
+            }
+        });
+        reGroupDataVO.setValues(maps);
+        reGroupDataVO.setTotal(total);
+        return reGroupDataVO;
+    }
+
+    ;
+
+}

+ 52 - 0
src/main/java/cn/cslg/pas/factorys/reGroupFactory/GetReportTypeGroup.java

@@ -0,0 +1,52 @@
+package cn.cslg.pas.factorys.reGroupFactory;
+
+import cn.cslg.pas.common.model.cronModel.ReGroupDataVO;
+import cn.cslg.pas.common.vo.GroupReVO;
+import cn.cslg.pas.domain.business.SystemDict;
+import cn.cslg.pas.mapper.EventMapper;
+import cn.cslg.pas.service.business.SystemDictService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.*;
+
+
+@Slf4j
+@Component
+public class GetReportTypeGroup implements QueryGroupImp {
+    @Autowired
+    private EventMapper eventMapper;
+    @Autowired
+    private SystemDictService systemDictService;
+
+    @Override
+    public ReGroupDataVO getGroup(List<String> sqls, String tableName, String groupField) {
+        ReGroupDataVO reGroupDataVO =new ReGroupDataVO();
+        List<Map<String, Object>> maps = new ArrayList<>();
+        String selectField = groupField;
+        List<SystemDict> systemDictList = systemDictService.getSystemDictListByType(Arrays.asList("REPORT_TYPE"));
+
+        //分组查询报告类型
+        List<GroupReVO> typeIds = eventMapper.getGroups(sqls, tableName, groupField, selectField);
+        Long total =eventMapper.getGroupsCount(sqls, tableName, groupField, selectField);
+        //装载应用场景名称
+        typeIds.forEach(item->{
+     SystemDict systemDict = systemDictList.stream().filter(tem->tem.getValue().equals(item.getValue())).findFirst().orElse(null);
+            if(systemDict!=null)
+            {
+                Map<String,Object> map =new HashMap<>();
+                map.put("name",systemDict.getLabel());
+                map.put("value",systemDict.getValue());
+                map.put("count",item.getNum());
+                maps.add(map);
+            }
+        });
+        reGroupDataVO.setValues(maps);
+        reGroupDataVO.setTotal(total);
+        return reGroupDataVO;
+    }
+
+    ;
+
+}

+ 29 - 2
src/main/resources/mapper/Event.xml

@@ -21,8 +21,8 @@
             where    ${sql}
         </if>
     </select>
-    <select id="getGroups"  resultType="java.lang.String">
-        select ${selectField} from  ${tableName}
+    <select id="getGroups"  resultType="cn.cslg.pas.common.vo.GroupReVO">
+        select ${selectField} as value ,count(*) as num from  ${tableName}
         <if test="sqls.get(0)!=''">
             where    ${sqls.get(0)}
         </if>
@@ -33,6 +33,10 @@
         select count(*) from (select ${selectField} from ${tableName}
         <if test="sqls.get(0)!=''">
             where ${sqls.get(0)}
+        and ${selectField} is not null
+        </if>
+        <if test="sqls.get(0)==''">
+            where  ${selectField} is not null
         </if>
          group by ${groupField}
         ) as c
@@ -50,4 +54,27 @@
             desc
         </if>
     </select>
+
+
+    <select id="getEntrustGroup"  resultType="cn.cslg.pas.common.vo.EntrustVO">
+        select distinct ${selectField} ,p.id,count(*) as num from  ${tableName}
+        <if test="sqls.get(0)!=''">
+            where    ${sqls.get(0)}
+        </if>
+        group by ${groupField} ${sqls.get(1)}  ${sqls.get(2)}
+    </select>
+
+
+    <select id="getEntrustGroupCount"  resultType="java.lang.Long">
+        select count(*) from (select ${selectField} from ${tableName}
+        <if test="sqls.get(0)!=''">
+            where ${sqls.get(0)}
+            and p.entrust_type is not null
+        </if>
+        <if test="sqls.get(0)==''">
+            where  p.entrust_type  is not null
+        </if>
+        group by ${groupField}
+        ) as c
+    </select>
 </mapper>

+ 18 - 1
src/main/resources/mapper/PatentDigProjectMapper.xml

@@ -5,7 +5,8 @@
         select p.id,dp.name as name,dp.output as output,dp.technical_direction as technicalDirection,dp.if_search as
         ifSearch,dp.related_competitors as relatedCompetitors,dp.technical_keyword as technicalKeyword,dp.process as
         process,dp.state as state,rp.name as rdName,rp.number as rdnumber,rp.product_phase as productPhase,rp.product as product,
-        p.create_id as createId,p.create_time as createTime,p.description as description,p.head_id as headId
+        p.create_id as createId,p.create_time as createTime,p.description as description,p.head_id as headId,
+        p.entrust_type as entrustType,p.entrust_id as entrustId
         from patent_dig_project as dp left join project as p
         on dp.project_id =p.id left join rd_project rp on dp.rd_project_id =rp.id
         <if test="sql1!=''">
@@ -23,4 +24,20 @@
             where ${sql1}
         </if>
     </select>
+
+
+    <select id="getRdProject" resultType="cn.cslg.pas.domain.business.RdProject">
+        select *
+        from rd_project
+        <if test="sql1!=''">
+            where ${sql1}
+        </if>
+    </select>
+    <select id="getRdProjectCount" resultType="java.lang.Long">
+        select count(*)
+        from rd_project
+        <if test="sql1!=''">
+            where ${sql1}
+        </if>
+    </select>
 </mapper>

+ 3 - 2
src/main/resources/mapper/PatentProjectMapper.xml

@@ -17,8 +17,9 @@
 
 
     <select id="getPatentProjectCount" resultType="java.lang.Long">
-        select count(*) from (select distinct p.id from patent_project as pp left join project as p
-        on pp.project_id =p.id left join asso_project_event as asso_event on asso_event.project_id =p.id
+        select count(*) from (select distinct p.id    from patent_project as pp left join project as p
+        on pp.project_id =p.id  left join asso_project_tree_node as aspt on p.id =aspt.project_id
+        left join asso_project_event as aspe on p.id =aspe.project_id
         <if test="sql1!=''">
             where ${sql1}
         </if>

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

@@ -2,14 +2,15 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 <mapper namespace="cn.cslg.pas.mapper.ReportProjectMapper">
     <select id="getReportProject" resultType="cn.cslg.pas.common.vo.business.ReportProjectVO">
-        select p.id as id,p.name as name ,rp.sign_patent_no as signPatentNo,p.contract_no as contract_no,p.volume_number
+        select distinct p.id as id,p.name as name ,rp.sign_patent_no as signPatentNo,p.contract_no as contract_no,p.volume_number
         as
         volumeNumber,p.commission_case_day as commissionCaseDay,p.description as description,p.create_id as
         createId,p.create_time as createTime, rp.report_type as reportType ,p.head_id as headId,p.department_id as
         departmentId,
         p.entrust_type as entrustType,p.entrust_id as entrustId,rp.product_or_tech as productOrTech,rp.cron_description
         as cronDescription from report as rp left join project as p
-        on rp.project_id =p.id
+        on rp.project_id =p.id left join asso_report_cron arc on p.id =arc.project_id
+        left join asso_project_event as aspe on p.id =aspe.project_id
         <if test="sql1!=''">
             where ${sql1}
         </if>
@@ -19,6 +20,8 @@
     <select id="getReportProjectCount" resultType="java.lang.Long">
         select count(*) from (select distinct p.id from report as rp left join project as p
         on rp.project_id =p.id
+        left join asso_report_cron arc on p.id =arc.project_id
+        left join asso_project_event as aspe on p.id =aspe.project_id
         <if test="sql1!=''">
             where ${sql1}
         </if>