|
@@ -6,12 +6,14 @@ import cn.cslg.report.common.model.vo.ReportVO;
|
|
|
import cn.cslg.report.common.model.vo.SystemDictVO;
|
|
|
import cn.cslg.report.common.utils.*;
|
|
|
import cn.cslg.report.common.utils.SecurityUtils.LoginUtils;
|
|
|
+import cn.cslg.report.entity.Personnel;
|
|
|
import cn.cslg.report.entity.Report;
|
|
|
|
|
|
import cn.cslg.report.entity.ReportFiles;
|
|
|
import cn.cslg.report.entity.asso.AssoReportFile;
|
|
|
import cn.cslg.report.mapper.ReportMapper;
|
|
|
import cn.cslg.report.service.OutInterfaceService;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
@@ -61,25 +63,14 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
|
|
|
try {
|
|
|
report.getScenarioList();
|
|
|
report.setScenarioId(StringUtils.join(report.getScenarioList(), ","));
|
|
|
- String res1 = outInterfaceService.getClientNameFromPAS(report.getClientId());
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(res1);
|
|
|
- String clientName = jsonObject.getString("data");
|
|
|
- String res2 = outInterfaceService.getPersonNameAndDepart(report.getPersonId(), report.getDepartmentId());
|
|
|
if (report.getAssociateReportId() != null) {
|
|
|
LambdaQueryWrapper<Report> wrapper = new LambdaQueryWrapper<>();
|
|
|
wrapper.eq(Report::getId, report.getAssociateReportId());
|
|
|
Report assioReport = this.list(wrapper).get(0);
|
|
|
report.setAssociateReportName(assioReport.getName());
|
|
|
}
|
|
|
- JSONObject jsonObject2 = JSONObject.parseObject(res2);
|
|
|
- Map<String, Object> map = (Map<String, Object>) jsonObject2.get("data");
|
|
|
- report.setClientName(clientName);
|
|
|
- report.setDepartmentName(map.get("departName").toString());
|
|
|
- report.setPersonName(map.get("personName").toString());
|
|
|
-
|
|
|
PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
|
|
|
report.setCreatePersonId(personnelVO.getId());
|
|
|
- report.setCreatePersonName(personnelVO.getName());
|
|
|
boolean addFlag = this.save(report);
|
|
|
|
|
|
if (files != null && files.size() != 0) {
|
|
@@ -121,6 +112,7 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
|
|
|
if (reportVO.getSignPatentNo() != null && reportVO.getSignPatentNo() != "") {
|
|
|
queryWrapper.like(Report::getSignPatentNo, reportVO.getSignPatentNo());
|
|
|
}
|
|
|
+ //控制只能查询自己负责或创建的报告
|
|
|
queryWrapper.and(QueryWrapper -> {
|
|
|
QueryWrapper.eq(Report::getCreatePersonId, loginUtils.getId())
|
|
|
.or().eq(Report::getPersonId, loginUtils.getId());
|
|
@@ -150,31 +142,61 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
|
|
|
//提出报告Id
|
|
|
List<Integer> reportIds = reports.stream().map(Report::getId).collect(Collectors.toList());
|
|
|
// 提出客户Id
|
|
|
- List<Integer> clientId =reports.stream().map(Report::getClientId).collect(Collectors.toList());
|
|
|
+ List<Integer> clientIds = reports.stream().map(Report::getClientId).collect(Collectors.toList());
|
|
|
//提出部门Id
|
|
|
- List<Integer> departId =reports.stream().map(Report::getDepartmentId).collect(Collectors.toList());
|
|
|
+ List<Integer> departIds = reports.stream().map(Report::getDepartmentId).collect(Collectors.toList());
|
|
|
//提出人员Id
|
|
|
- List<Integer> personId =reports.stream().map(Report::getDepartmentId).collect(Collectors.toList());
|
|
|
+ List<Integer> personIds = reports.stream().map(Report::getDepartmentId).collect(Collectors.toList());
|
|
|
//提出创建人Id
|
|
|
- List<Integer> createId =reports.stream().map(Report::getCreatePersonId).collect(Collectors.toList());
|
|
|
- //根据客户Id查出客户信息
|
|
|
-
|
|
|
-
|
|
|
- //根据报告ID查询报告文件关联信息
|
|
|
+ List<Integer> createIds = reports.stream().map(Report::getCreatePersonId).collect(Collectors.toList());
|
|
|
+ personIds.addAll(createIds);
|
|
|
+ //根据报告ID查询报告文件关联信息
|
|
|
List<AssoReportFile> assoReportFiles = assoReportFileService.queryFileByReportId(reportIds);
|
|
|
List<ReportFiles> reportFilesList = new ArrayList<>();
|
|
|
if (assoReportFiles.size() != 0) {
|
|
|
List<Integer> fileIds = assoReportFiles.stream().map(AssoReportFile::getFileId).collect(Collectors.toList());
|
|
|
reportFilesList = reportFileService.getFiles(fileIds);
|
|
|
}
|
|
|
-
|
|
|
String res = outInterfaceService.getDictsFromPAS();
|
|
|
JSONObject jsonObject = JSONObject.parseObject(res);
|
|
|
List<SystemDictVO> list = JSONArray.parseArray(jsonObject.getString("data"), SystemDictVO.class);
|
|
|
List<ReportFiles> temList = reportFilesList;
|
|
|
+ //根据人员Id获得人员信息
|
|
|
+ String res1 = outInterfaceService.getPersonnelByIdsFromPCS(personIds);
|
|
|
+ JSONObject jsonObject1 = JSONObject.parseObject(res1);
|
|
|
+ //解析jason获得标的专利的权要
|
|
|
+ List<Personnel> personnels = JSON.parseArray(jsonObject1.getString("data"), Personnel.class);
|
|
|
+ //根据部门Id 获得部门信息
|
|
|
+ List<Map<String, Object>> mapDeparts =new ArrayList<>();
|
|
|
+ if(departIds.size()!=0) {
|
|
|
+ String res2 = outInterfaceService.getDeparts(departIds);
|
|
|
+ mapDeparts = JSONObject.parseArray(res2);
|
|
|
+ }
|
|
|
+ //根据客户Id 获得客户信息
|
|
|
+ List<Map<String, Object>> mapClients =new ArrayList<>();
|
|
|
+ if(clientIds.size()!=0) {
|
|
|
+ String res3 = outInterfaceService.getClientNameFromPAS(clientIds);
|
|
|
+ mapClients =JSONObject.parseArray(res3);
|
|
|
+ }
|
|
|
//过滤报告
|
|
|
- reports.forEach(
|
|
|
- item -> {
|
|
|
+ for(Report item :reports){
|
|
|
+ //装载创建人名和负责人名
|
|
|
+ List<Personnel> mapCre = personnels.stream().filter(tem -> tem.getId().equals(item.getPersonId())).collect(Collectors.toList());
|
|
|
+ List<Personnel> mapDuty = personnels.stream().filter(tem -> tem.getId().equals(item.getCreatePersonId())).collect(Collectors.toList());
|
|
|
+ if(mapDuty.size()!=0)
|
|
|
+ item.setPersonName(mapDuty.get(0).getPersonnelName());
|
|
|
+ if(mapCre.size()!=0)
|
|
|
+ item.setCreatePersonName(mapCre.get(0).getPersonnelName());
|
|
|
+ //装载部门名
|
|
|
+ List<Map<String, Object>> mapDeaprt = mapDeparts.stream().filter(tem -> tem.get("departId").toString().equals(item.getPersonId().toString())).collect(Collectors.toList());
|
|
|
+ if(mapDeaprt.size()!=0){
|
|
|
+ item.setDepartmentName(mapDeaprt.get(0).get("departName").toString());
|
|
|
+ }
|
|
|
+ //装载客户
|
|
|
+ List<Map<String, Object>> mapClient = mapClients.stream().filter(tem -> tem.get("clientId").toString().equals(item.getClientId().toString())).collect(Collectors.toList());
|
|
|
+ if(mapClient.size()!=0){
|
|
|
+ item.setClientName(mapClient.get(0).get("clientName").toString());
|
|
|
+ }
|
|
|
//装载报告应用场景
|
|
|
if (StringUtils.isNotEmpty(item.getScenarioId())) {
|
|
|
item.setScenarioList(StringUtils.changeStringToString(item.getScenarioId(), ","));
|
|
@@ -190,8 +212,7 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
|
|
|
List<ReportFiles> partFiles = temList.stream().filter(tem -> partFileIds.contains(tem.getId())).collect(Collectors.toList());
|
|
|
item.setReportFiles(partFiles);
|
|
|
}
|
|
|
- });
|
|
|
-
|
|
|
+ }
|
|
|
return reports;
|
|
|
}
|
|
|
|