|
@@ -1,5 +1,6 @@
|
|
|
package cn.cslg.pas.service.business;
|
|
|
|
|
|
+import cn.cslg.pas.common.dto.QueryPatentDigProjectFilesDTO;
|
|
|
import cn.cslg.pas.common.dto.business.PatentDigProjectFilesDTO;
|
|
|
import cn.cslg.pas.common.model.cronModel.Personnel;
|
|
|
import cn.cslg.pas.common.model.cronModel.PersonnelVO;
|
|
@@ -10,6 +11,8 @@ 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.business.PatentDigProjectFilesVO;
|
|
|
+import cn.cslg.pas.domain.business.AssoProjectFile;
|
|
|
+import cn.cslg.pas.domain.business.AssoTaskFile;
|
|
|
import cn.cslg.pas.domain.business.PatentDigProjectFiles;
|
|
|
import cn.cslg.pas.domain.business.ProjectTask;
|
|
|
import cn.cslg.pas.exception.UnLoginException;
|
|
@@ -33,6 +36,7 @@ import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 专利挖掘项目文件Service层
|
|
@@ -64,6 +68,12 @@ public class PatentDigProjectFilesService extends ServiceImpl<PatentDigProjectFi
|
|
|
@Lazy
|
|
|
private ProjectTaskService projectTaskService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private AssoTaskFileService assoTaskFileService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private AssoProjectFileService assoProjectFileService;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public Object queryMessage(QueryRequest queryRequest) throws Exception {
|
|
@@ -178,11 +188,15 @@ public class PatentDigProjectFilesService extends ServiceImpl<PatentDigProjectFi
|
|
|
*/
|
|
|
private void loadPatentDigProjectFiles(List<PatentDigProjectFilesVO> patentDigProjectFilesVOS) throws IOException {
|
|
|
List<String> createIds = new ArrayList<>();
|
|
|
+ List<String> fileGuids = new ArrayList<>();
|
|
|
patentDigProjectFilesVOS.forEach(
|
|
|
item -> {
|
|
|
if (item.getCreateId() != null) {
|
|
|
createIds.add(item.getCreateId());
|
|
|
}
|
|
|
+ if (item.getFileGuid() != null) {
|
|
|
+ fileGuids.add(item.getFileGuid());
|
|
|
+ }
|
|
|
}
|
|
|
);
|
|
|
List<Personnel> personnels = new ArrayList<>();
|
|
@@ -192,6 +206,12 @@ public class PatentDigProjectFilesService extends ServiceImpl<PatentDigProjectFi
|
|
|
JSONObject jsonObject = JSONObject.parseObject(res);
|
|
|
personnels = JSONObject.parseArray(jsonObject.getString("data"), Personnel.class);
|
|
|
}
|
|
|
+
|
|
|
+ List<SystemFile> systemFiles = new ArrayList<>();
|
|
|
+ if (fileGuids.size() != 0) {
|
|
|
+ String res = fileManagerService.getSystemFileFromFMS(fileGuids);
|
|
|
+ systemFiles = JSONObject.parseArray(res, SystemFile.class);
|
|
|
+ }
|
|
|
for (PatentDigProjectFilesVO patentDigProjectFilesVO : patentDigProjectFilesVOS) {
|
|
|
//装载人员信息
|
|
|
Personnel personnel = personnels.stream().filter(item -> item.getId().equals(patentDigProjectFilesVO.getCreateId())).findFirst().orElse(null);
|
|
@@ -200,9 +220,19 @@ public class PatentDigProjectFilesService extends ServiceImpl<PatentDigProjectFi
|
|
|
} else {
|
|
|
throw new XiaoShiException("未获取到当前登陆人信息");
|
|
|
}
|
|
|
+ SystemFile systemFile = systemFiles.stream().filter(item -> item.getGuid().equals(patentDigProjectFilesVO.getFileGuid())).findFirst().orElse(null);
|
|
|
+ patentDigProjectFilesVO.setType(systemFile.getType());
|
|
|
+ patentDigProjectFilesVO.setName(systemFile.getOriginalName());
|
|
|
//调用查询流程名称方法
|
|
|
String name = this.getProcessName(patentDigProjectFilesVO.getProcessId());
|
|
|
patentDigProjectFilesVO.setProcessName(name);
|
|
|
+
|
|
|
+ //任务信息
|
|
|
+ Integer taskId = patentDigProjectFilesVO.getTaskId();
|
|
|
+ if (taskId != null) {
|
|
|
+ ProjectTask projectTask = projectTaskService.getById(taskId);
|
|
|
+ patentDigProjectFilesVO.setProjectTask(projectTask);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -253,6 +283,11 @@ public class PatentDigProjectFilesService extends ServiceImpl<PatentDigProjectFi
|
|
|
return taskId;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取流程信息
|
|
|
+ * @param projectId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public Map<Integer, Map<String, Integer>> getProcessInfo(Integer projectId){
|
|
|
Map<Integer, Map<String, Integer>> processInfo = new HashMap<>();
|
|
|
for (int i = 1; i < 8; i++) {
|
|
@@ -269,4 +304,90 @@ public class PatentDigProjectFilesService extends ServiceImpl<PatentDigProjectFi
|
|
|
}
|
|
|
return processInfo;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询专利挖掘项目所有文件
|
|
|
+ * @param queryPatentDigProjectFilesDTO
|
|
|
+ */
|
|
|
+ public List<PatentDigProjectFilesVO> getPatentDigProjectFiles(QueryPatentDigProjectFilesDTO queryPatentDigProjectFilesDTO){
|
|
|
+ List<PatentDigProjectFilesVO> patentDigProjectFilesVOS = new ArrayList<>();
|
|
|
+ //查询本表
|
|
|
+ if (queryPatentDigProjectFilesDTO == null) {
|
|
|
+ throw new XiaoShiException("入参为空");
|
|
|
+ }
|
|
|
+ Integer projectId = queryPatentDigProjectFilesDTO.getProjectId();
|
|
|
+ if (projectId == null) {
|
|
|
+ throw new XiaoShiException("projectId为空");
|
|
|
+ }
|
|
|
+ Integer processId = queryPatentDigProjectFilesDTO.getProcessId();
|
|
|
+ Integer taskId = queryPatentDigProjectFilesDTO.getTaskId();
|
|
|
+ LambdaQueryWrapper<PatentDigProjectFiles> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(PatentDigProjectFiles::getProjectId, projectId);
|
|
|
+ if (processId != null) {
|
|
|
+ queryWrapper.eq(PatentDigProjectFiles::getProcessId, processId);
|
|
|
+ }
|
|
|
+ if (taskId != null) {
|
|
|
+ queryWrapper.eq(PatentDigProjectFiles::getTaskId, taskId);
|
|
|
+ }
|
|
|
+ List<PatentDigProjectFiles> patentDigProjectFilesList = this.list(queryWrapper);
|
|
|
+ if (!patentDigProjectFilesList.isEmpty()) {
|
|
|
+ patentDigProjectFilesList.forEach(item -> {
|
|
|
+ PatentDigProjectFilesVO patentDigProjectFilesVO = new PatentDigProjectFilesVO();
|
|
|
+ BeanUtils.copyProperties(item, patentDigProjectFilesVO);
|
|
|
+ patentDigProjectFilesVOS.add(patentDigProjectFilesVO);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //查询项目下所有任务的文件
|
|
|
+ LambdaQueryWrapper<ProjectTask> queryWrapper1 = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper1.eq(ProjectTask::getProjectId, projectId);
|
|
|
+ if (processId != null) {
|
|
|
+ queryWrapper1.eq(ProjectTask::getProcessId, processId);
|
|
|
+ }
|
|
|
+ if (taskId != null) {
|
|
|
+ queryWrapper1.eq(ProjectTask::getId, taskId);
|
|
|
+ }
|
|
|
+ List<ProjectTask> projectTasks = projectTaskService.list(queryWrapper1);
|
|
|
+ if (!projectTasks.isEmpty()) {
|
|
|
+ List<Integer> taskIds = projectTasks.stream().map(ProjectTask::getId).collect(Collectors.toList());
|
|
|
+ LambdaQueryWrapper<AssoTaskFile> queryWrapper2 = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper2.in(AssoTaskFile::getTaskId, taskIds);
|
|
|
+ List<AssoTaskFile> assoTaskFiles = assoTaskFileService.list(queryWrapper2);
|
|
|
+ if (!assoTaskFiles.isEmpty()) {
|
|
|
+ assoTaskFiles.forEach(item -> {
|
|
|
+ ProjectTask projectTask = projectTasks.stream().filter(item2 -> item2.getId().equals(item.getTaskId())).findFirst().orElse(null);
|
|
|
+ PatentDigProjectFilesVO patentDigProjectFilesVO = new PatentDigProjectFilesVO();
|
|
|
+ patentDigProjectFilesVO.setProjectId(projectId);
|
|
|
+ patentDigProjectFilesVO.setFileGuid(item.getFileGuid());
|
|
|
+ patentDigProjectFilesVO.setTaskId(item.getTaskId());
|
|
|
+ patentDigProjectFilesVO.setCreateId(item.getCreateId());
|
|
|
+ patentDigProjectFilesVO.setCreateTime(item.getCreateTime());
|
|
|
+ patentDigProjectFilesVO.setDescription(item.getDescription());
|
|
|
+ if (projectTask != null) {
|
|
|
+ patentDigProjectFilesVO.setProcessId(projectTask.getProcessId());
|
|
|
+ }
|
|
|
+ patentDigProjectFilesVOS.add(patentDigProjectFilesVO);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //查询项目下的文件
|
|
|
+ LambdaQueryWrapper<AssoProjectFile> queryWrapper2 = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper2.eq(AssoProjectFile::getProjectId, projectId);
|
|
|
+ List<AssoProjectFile> assoProjectFiles = assoProjectFileService.list(queryWrapper2);
|
|
|
+ if (!assoProjectFiles.isEmpty()) {
|
|
|
+ assoProjectFiles.forEach(item -> {
|
|
|
+ PatentDigProjectFilesVO patentDigProjectFilesVO = new PatentDigProjectFilesVO();
|
|
|
+ patentDigProjectFilesVO.setProjectId(projectId);
|
|
|
+ patentDigProjectFilesVO.setFileGuid(item.getFileGuid());
|
|
|
+ patentDigProjectFilesVO.setCreateId(item.getCreateId());
|
|
|
+ patentDigProjectFilesVO.setCreateTime(item.getCreateTime().toDate());
|
|
|
+ patentDigProjectFilesVOS.add(patentDigProjectFilesVO);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ this.loadPatentDigProjectFiles(patentDigProjectFilesVOS);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new XiaoShiException("装载信息错误");
|
|
|
+ }
|
|
|
+ return patentDigProjectFilesVOS;
|
|
|
+ }
|
|
|
}
|