|
@@ -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) {
|