lwhhszx 2 年之前
父节点
当前提交
08e21ebf59

+ 3 - 7
RMS/src/main/java/cn/cslg/report/common/model/dto/ReportDTO.java

@@ -170,19 +170,15 @@ public class ReportDTO  {
     /**
      * 文件
      */
-    @TableField(exist = false)
+
     private List<ReportFiles> reportFiles;
     /**
      * 场景列表
      */
-    @TableField(exist = false)
-    private List<String> scenarioList;
 
-    @TableField(exist = false)
+    private List<String> scenarioList;
     private List<String> scenarioNames;
-
-    @TableField(exist = false)
     private List<Integer> conclusionIds;
-    @TableField(exist = false)
     private List<Integer> copyIds;
+    private List<String> types;
 }

+ 2 - 0
RMS/src/main/java/cn/cslg/report/common/model/vo/ReportVO.java

@@ -135,4 +135,6 @@ public class ReportVO extends BaseVO {
 
     @Schema(description = "选中人员")
     private List<Integer> scenarioList;
+
+    private List<String> types;
 }

+ 5 - 0
RMS/src/main/java/cn/cslg/report/controller/BaseController.java

@@ -192,6 +192,11 @@ public class BaseController {
     public String getPatentListPAS(@RequestBody PASPatentVO params) throws IOException {
         return  compareFilesService.getCompareFileFromPas(params);
     }
+    @PostMapping("/getCronConClusions")
+    @Operation(summary = "获得核心结论字典")
+    public String getCronConClusions(@RequestBody List<Integer> types) throws IOException {
+        return Response.success(systemDictItemService.getCronConClusions(types));
+    }
 
 
 }

+ 0 - 2
RMS/src/main/java/cn/cslg/report/controller/ReportController.java

@@ -93,9 +93,7 @@ public class ReportController {
     @Operation(summary = "文件查询")
     public String queryLitigationHistory(@RequestBody ReportReferences reportReferences)throws IOException{
             return reportReferencesService.queryReportReferences(reportReferences);
-
     }
-
     @GetMapping("/deletefile")
     @Operation(summary = "删除文件")
     public String deleFile(int id)throws IOException{

+ 6 - 1
RMS/src/main/java/cn/cslg/report/entity/Report.java

@@ -197,6 +197,9 @@ public class  Report extends BaseEntity<Report> {
     @TableField(value = "CRON_CONCLUSION")
     private String cronConclusion;
 
+    @Schema(description = "登录人在报告中的角色 0创建人,1负责人,2分享人")
+    @TableField(exist = false)
+    private List<Integer> loginRole;
     /**
      * 文件
      */
@@ -212,5 +215,7 @@ public class  Report extends BaseEntity<Report> {
     private List<String> scenarioNames;
 
     @TableField(exist = false)
-    private List<Integer> conclusionIds                                         ;
+    private List<String> conclusionIds;
+    @TableField(exist = false )
+    private List<String> conclusions;
 }

+ 59 - 20
RMS/src/main/java/cn/cslg/report/service/business/ReportService.java

@@ -13,10 +13,12 @@ import cn.cslg.report.common.utils.auth.checkAuth;
 import cn.cslg.report.entity.*;
 
 import cn.cslg.report.entity.asso.AssoReportFile;
+import cn.cslg.report.entity.asso.AssoReportPerson;
 import cn.cslg.report.mapper.ReportMapper;
 import cn.cslg.report.service.IAvoidDesignDirectionService;
 import cn.cslg.report.service.IProductService;
 import cn.cslg.report.service.OutInterfaceService;
+import cn.cslg.report.service.business.asso.AssoReportPersonService;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -38,6 +40,7 @@ import org.springframework.web.multipart.MultipartFile;
 import java.io.IOException;
 import java.text.SimpleDateFormat;
 import java.util.*;
+import java.util.function.Function;
 import java.util.stream.Collectors;
 
 @Service
@@ -65,7 +68,8 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
     private final ReportDocumentService reportDocumentService;
     private final ReportReferencesService reportReferencesService;
     private final CopyService copyService;
-
+    private final SystemDictItemService systemDictItemService;
+    private final AssoReportPersonService assoReportPersonService;
     private Report loadReport(ReportDTO reportDto) {
         Report report = new Report();
         //装载基本信息
@@ -138,7 +142,7 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
             LambdaQueryWrapper<ReportField> fieldWrapper = new LambdaQueryWrapper<>();
             fieldWrapper.eq(ReportField::getReportId, reportDto.getAssociateReportId());
             List<ReportField> fields = reportFieldService.list(fieldWrapper);
-            List<ReportField> oldFields  =new ArrayList<>(fields);
+            List<ReportField> oldFields = new ArrayList<>(fields);
             if (fields.size() != 0) {
                 for (ReportField reportField : fields) {
                     reportField.setId(null);
@@ -146,7 +150,7 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
                 }
                 reportFieldService.saveBatch(fields);
             }
-           //复制
+            //复制
             if (reportDto.getCopyIds() != null) {
                 //复制对比文件
                 if (reportDto.getCopyIds().contains(Arrays.asList())) {
@@ -154,7 +158,7 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
                 }
                 //复制标引信息
                 if (reportDto.getCopyIds().contains(Arrays.asList())) {
-                    copyService.CopyPatentLabels(oldFields,fields);
+                    copyService.CopyPatentLabels(oldFields, fields);
                 }
             }
         } else {
@@ -179,17 +183,17 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
         if (reportVO.getSignPatentNo() != null && reportVO.getSignPatentNo() != "") {
             queryWrapper.like(Report::getSignPatentNo, reportVO.getSignPatentNo());
         }
-        if (reportVO.getType() != null && reportVO.getType() != "") {
-            queryWrapper.eq(Report::getType, reportVO.getType());
+        if (reportVO.getTypes() != null && reportVO.getTypes().size() > 0) {
+            queryWrapper.in(Report::getType, reportVO.getTypes());
         }
-        if(reportVO.getCronIds()!=null&&reportVO.getCronIds().size()>0){
-            StringBuilder strs =new StringBuilder();
-            for (int i=0;i<reportVO.getCronIds().size();i++){
-                Integer item =reportVO.getCronIds().get(i);
-                if(i==0){
-                strs.append("(FIND_IN_SET("+item+",REPLACE(CONCLUSION_ID, '/', ','))");}
-                else {
-                    strs.append("or FIND_IN_SET("+item+",REPLACE(CONCLUSION_ID, '/', ','))");
+        if (reportVO.getCronIds() != null && reportVO.getCronIds().size() > 0) {
+            StringBuilder strs = new StringBuilder();
+            for (int i = 0; i < reportVO.getCronIds().size(); i++) {
+                Integer item = reportVO.getCronIds().get(i);
+                if (i == 0) {
+                    strs.append("(FIND_IN_SET(" + item + ",REPLACE(CONCLUSION_ID, '/', ','))");
+                } else {
+                    strs.append("or FIND_IN_SET(" + item + ",REPLACE(CONCLUSION_ID, '/', ','))");
                 }
             }
             strs.append(")");
@@ -223,6 +227,14 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
      * @function 查询报告
      */
     public List<Report> reportData(List<Report> reports) throws IOException {
+        PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+          //根据登录人id获得登录人被分享的报告id
+        LambdaQueryWrapper<AssoReportPerson> wrapper =new LambdaQueryWrapper<>();
+        wrapper.select(AssoReportPerson::getReportId);
+        wrapper.eq(AssoReportPerson::getPersonId,personnelVO.getId());
+        Function<Object,Integer> f = (o -> Integer.parseInt(o.toString())) ;
+        List<Integer> shareIds =assoReportPersonService.listObjs(wrapper,f);
+
         //提出报告Id
         List<Integer> reportIds = reports.stream().map(Report::getId).collect(Collectors.toList());
         // 提出客户Id
@@ -234,6 +246,8 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
         //提出创建人Id
         List<Integer> createIds = reports.stream().map(Report::getCreatePersonId).collect(Collectors.toList());
         personIds.addAll(createIds);
+        //根据报告类型
+        List<Map<String, Object>> conclusions = systemDictItemService.getCronConClusions(new ArrayList<Integer>());
         //根据报告ID查询报告文件关联信息
         List<AssoReportFile> assoReportFiles = assoReportFileService.queryFileByReportId(reportIds);
         List<ReportFiles> reportFilesList = new ArrayList<>();
@@ -264,6 +278,18 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
         }
         //过滤报告
         for (Report item : reports) {
+            //装载登录人在报告中的角色
+            List<Integer> roles =new ArrayList<>();
+            if(item.getCreatePersonId().equals(personnelVO.getId())){
+                roles.add(0);
+            }
+            if(item.getPersonId()!=null&&item.getPersonId().equals(personnelVO.getId())){
+                roles.add(1);
+            }
+            if(shareIds.contains(item.getId())){
+                roles.add(2);
+            }
+            item.setLoginRole(roles);
             //装载创建人名和负责人名
             List<Personnel> mapCre = personnels.stream().filter(tem -> tem.getId().equals(item.getCreatePersonId())).collect(Collectors.toList());
             List<Personnel> mapDuty = personnels.stream().filter(tem -> tem.getId().equals(item.getPersonId())).collect(Collectors.toList());
@@ -272,12 +298,12 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
             if (mapCre.size() != 0)
                 item.setCreatePersonName(mapCre.get(0).getPersonnelName());
             //装载部门名
-           if(item.getDepartmentId()!=null) {
-               List<Map<String, Object>> mapDeaprt = mapDeparts.stream().filter(tem -> tem.get("departId").toString().equals(item.getDepartmentId().toString())).collect(Collectors.toList());
-               if (mapDeaprt.size() != 0) {
-                   item.setDepartmentName(mapDeaprt.get(0).get("departName").toString());
-               }
-           }
+            if (item.getDepartmentId() != null) {
+                List<Map<String, Object>> mapDeaprt = mapDeparts.stream().filter(tem -> tem.get("departId").toString().equals(item.getDepartmentId().toString())).collect(Collectors.toList());
+                if (mapDeaprt.size() != 0) {
+                    item.setDepartmentName(mapDeaprt.get(0).get("departName").toString());
+                }
+            }
             if (item.getClientId() == null) {
                 item.setClientId(0);
             }
@@ -293,6 +319,19 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
                 item.setScenarioNames(list.stream().filter(systemDict -> systemDict.getType().equals(Constants.ENTERPRISE_APPLICATION_SCENARIO) && item.getScenarioList().contains(systemDict.getValue())).map(SystemDictVO::getLabel).collect(Collectors.toList()));
                 item.setScenarioId(null);
             }
+            //装载核心结论
+            if (StringUtils.isNotEmpty(item.getConclusionId())) {
+                List<String> ids = StringUtils.changeStringToString(item.getConclusionId(), "/");
+                item.setConclusionIds(ids);
+                List<String> names = new ArrayList<>();
+                for (Map<String, Object> temMap : conclusions) {
+                    if (ids.contains(temMap.get("cType").toString())) {
+                        names.add(temMap.get("cTypeName").toString());
+                    }
+                }
+                item.setConclusions(names);
+
+            }
             //装载报告文件
             List<AssoReportFile> partReportFiles = assoReportFiles.stream().filter(tem -> tem.getReportId().equals(item.getId())).collect(Collectors.toList());
             if (partReportFiles.size() == 0) {

+ 73 - 3
RMS/src/main/java/cn/cslg/report/service/business/SystemDictItemService.java

@@ -27,9 +27,9 @@ public class SystemDictItemService extends ServiceImpl<SystemDictItemMapper, Sys
      * @author 沈永艺
      */
     private final SystemDictItemMapper systemDictItemMapper;
+
     public String getSystemKey() {
         try {
-
             Map<String, Object> lst = new HashMap<>();
             //查询所有字典
             List<SysDictItem> sysDictList = this.list();
@@ -39,8 +39,9 @@ public class SystemDictItemService extends ServiceImpl<SystemDictItemMapper, Sys
                 lambdaQueryWrapper.eq(SysDictItem::getDictParentKey, sysDict.getDictParentKey());
                 //装填数据
                 //字典格式 KEY:KEY值对应的字典项
-                if(!lst.containsKey(sysDict.getDictParentKey())){
-                lst.put(sysDict.getDictParentKey(), systemDictItemMapper.selectList(lambdaQueryWrapper));}
+                if (!lst.containsKey(sysDict.getDictParentKey())) {
+                    lst.put(sysDict.getDictParentKey(), systemDictItemMapper.selectList(lambdaQueryWrapper));
+                }
 //                //数据字典格式 dataDict:查询的所有数据字典数据
 //                lst.put("dataDict", dataSourceService.list());
             }
@@ -51,4 +52,73 @@ public class SystemDictItemService extends ServiceImpl<SystemDictItemMapper, Sys
             return Response.error(Constants.NET_ERROR);
         }
     }
+
+    public List<Map<String, Object>> getCronConClusions(List<Integer> types) {
+        if(types==null||types.size()==0){
+            types=Arrays.asList(0,1,2,3,4,5);
+        }
+        List<String> keys = new ArrayList<>();
+        for (Integer type : types) {
+            switch (type) {
+                case 0:
+                    keys.add("INVALID_ASSESS");
+                    break;
+                case 1:
+                    keys.add("THIRD_ASSESS");
+                    break;
+                case 2:
+                    keys.add("STABILITY_ASSESS");
+                    break;
+                case 3:
+                    keys.add("FTO_ASSESS");
+                    break;
+                case 4:
+                    keys.add("TORT_ASSESS");
+                    break;
+                case 5:
+                    keys.add("AVOID_ASSESS");
+                    break;
+            }
+        }
+        //根据key值查
+        LambdaQueryWrapper<SysDictItem> wrapper = new LambdaQueryWrapper<>();
+        wrapper.in(SysDictItem::getDictParentKey, keys);
+        List<SysDictItem> sysDictItems = this.list(wrapper);
+        List<Map<String, Object>> mapList = new ArrayList<>();
+        sysDictItems.forEach(item -> {
+            Map<String, Object> map = new HashMap<>();
+            switch (item.getDictParentKey()) {
+                case "INVALID_ASSESS":
+                    map.put("rType", 0);
+                    map.put("rTypeName", "无效分析");
+                    break;
+                case "THIRD_ASSESS":
+                    map.put("rType", 1);
+                    map.put("rTypeName", "第三方意见");
+                    break;
+                case "STABILITY_ASSESS":
+                    map.put("rType", 2);
+                    map.put("rTypeName", "稳定性分析");
+                    break;
+                case "FTO_ASSESS":
+                    map.put("rType", 3);
+                    map.put("rTypeName", "FTO调查");
+                    break;
+                case "TORT_ASSESS":
+                    map.put("rType", 4);
+                    map.put("rTypeName", "侵权分析");
+                    break;
+                case "AVOID_ASSESS":
+                    map.put("rType", 5);
+                    map.put("rTypeName", "回避设计");
+                    break;
+            }
+            map.put("cTypeId", item.getId());
+            map.put("cTypeName", item.getDictChildLabel());
+            map.put("cType", item.getDictChildValue());
+            mapList.add(map);
+        });
+        return mapList;
+    }
+
 }