|
@@ -1,10 +1,10 @@
|
|
|
package cn.cslg.pas.service.business;
|
|
|
|
|
|
import cn.cslg.pas.common.dto.business.PatentDigProjectFilesDTO;
|
|
|
-import cn.cslg.pas.common.dto.business.UpdatePatentDigProjectFilesDTO;
|
|
|
import cn.cslg.pas.common.model.cronModel.Personnel;
|
|
|
import cn.cslg.pas.common.model.cronModel.PersonnelVO;
|
|
|
import cn.cslg.pas.common.model.cronModel.Records;
|
|
|
+import cn.cslg.pas.common.model.cronModel.SystemFile;
|
|
|
import cn.cslg.pas.common.model.request.GroupRequest;
|
|
|
import cn.cslg.pas.common.model.request.QueryRequest;
|
|
|
import cn.cslg.pas.common.utils.CacheUtils;
|
|
@@ -15,18 +15,23 @@ import cn.cslg.pas.exception.UnLoginException;
|
|
|
import cn.cslg.pas.exception.XiaoShiException;
|
|
|
import cn.cslg.pas.factorys.businessFactory.Business;
|
|
|
import cn.cslg.pas.mapper.PatentDigProjectFilesMapper;
|
|
|
+import cn.cslg.pas.service.common.FileManagerService;
|
|
|
import cn.cslg.pas.service.permissions.PermissionService;
|
|
|
import cn.cslg.pas.service.query.FormatQueryService;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* 专利挖掘项目文件Service层
|
|
@@ -51,6 +56,13 @@ public class PatentDigProjectFilesService extends ServiceImpl<PatentDigProjectFi
|
|
|
@Autowired
|
|
|
private PermissionService permissionService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private FileManagerService fileManagerService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ @Lazy
|
|
|
+ private ProjectTaskService projectTaskService;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public Object queryMessage(QueryRequest queryRequest) throws Exception {
|
|
@@ -78,7 +90,10 @@ public class PatentDigProjectFilesService extends ServiceImpl<PatentDigProjectFi
|
|
|
|
|
|
@Override
|
|
|
public Object deleteMessage(List<Integer> ids) throws IOException {
|
|
|
- return null;
|
|
|
+ if (!ids.isEmpty()) {
|
|
|
+ this.removeBatchByIds(ids);
|
|
|
+ }
|
|
|
+ return ids;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -91,23 +106,23 @@ public class PatentDigProjectFilesService extends ServiceImpl<PatentDigProjectFi
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 新增专利挖掘项目文件
|
|
|
+ * @param object
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@Override
|
|
|
public Object addMessage(Object object) {
|
|
|
- if (object.equals(null)) {
|
|
|
- throw new XiaoShiException("传入参数不能为空");
|
|
|
- }
|
|
|
+ //object to patentDigProjectFilesDTO
|
|
|
PatentDigProjectFilesDTO patentDigProjectFilesDTO = (PatentDigProjectFilesDTO) object;
|
|
|
+ //判断projectId是否为空
|
|
|
if (patentDigProjectFilesDTO.getProjectId() == null) {
|
|
|
throw new XiaoShiException("projectId不能为空");
|
|
|
}
|
|
|
- if (patentDigProjectFilesDTO.getFileGuid() == null && patentDigProjectFilesDTO.getFileGuid().equals("")) {
|
|
|
- throw new XiaoShiException("文件名guid不能为空");
|
|
|
- }
|
|
|
- if (patentDigProjectFilesDTO.getFileGuid() != null) {
|
|
|
-
|
|
|
+ //判断processId是否为空
|
|
|
+ if (patentDigProjectFilesDTO.getProcessId() == null) {
|
|
|
+ throw new XiaoShiException("processId不能为空");
|
|
|
}
|
|
|
- PatentDigProjectFiles patentDigProjectFiles = new PatentDigProjectFiles();
|
|
|
- BeanUtils.copyProperties(patentDigProjectFilesDTO, patentDigProjectFiles);
|
|
|
//获取登陆人信息 用于设置创建人
|
|
|
PersonnelVO personnelVO = new PersonnelVO();
|
|
|
try {
|
|
@@ -115,31 +130,49 @@ public class PatentDigProjectFilesService extends ServiceImpl<PatentDigProjectFi
|
|
|
} catch (Exception e) {
|
|
|
throw new UnLoginException("未登录");
|
|
|
}
|
|
|
- patentDigProjectFiles.setCreateId(personnelVO.getId());
|
|
|
- patentDigProjectFiles.insert();
|
|
|
- return patentDigProjectFiles.getId();
|
|
|
+ List<Integer> ids = new ArrayList<>();
|
|
|
+
|
|
|
+ if (patentDigProjectFilesDTO.getFileGuids() != null && !patentDigProjectFilesDTO.getFileGuids().isEmpty()){
|
|
|
+ List<String> fileGuids = patentDigProjectFilesDTO.getFileGuids();
|
|
|
+ List<SystemFile> systemFiles = new ArrayList<>();
|
|
|
+ List<PatentDigProjectFiles> patentDigProjectFilesS = new ArrayList<>();
|
|
|
+ //调用文件系统查询文件信息接口
|
|
|
+ if (fileGuids.size() != 0) {
|
|
|
+ try {
|
|
|
+ String res = fileManagerService.getSystemFileFromFMS(fileGuids);
|
|
|
+ systemFiles = JSONObject.parseArray(res, SystemFile.class);
|
|
|
+ if (systemFiles.size() != 0) {
|
|
|
+ for (String item : fileGuids) {
|
|
|
+ SystemFile systemFile = systemFiles.stream().filter(item1 -> item1.getGuid().equals(item)).findFirst().orElse(null);
|
|
|
+ PatentDigProjectFiles patentDigProjectFiles = new PatentDigProjectFiles();
|
|
|
+ BeanUtils.copyProperties(patentDigProjectFilesDTO, patentDigProjectFiles);
|
|
|
+ patentDigProjectFiles.setFileGuid(item);
|
|
|
+ patentDigProjectFiles.setName(systemFile.getOriginalName());
|
|
|
+ patentDigProjectFiles.setCreateId(personnelVO.getId());
|
|
|
+ patentDigProjectFilesS.add(patentDigProjectFiles);
|
|
|
+ }
|
|
|
+ this.saveBatch(patentDigProjectFilesS);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new XiaoShiException("查询文件信息错误");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ patentDigProjectFilesS.forEach(item -> {
|
|
|
+ ids.add(item.getId());
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ return ids;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public Object updateMessage(Object object) {
|
|
|
- if (object == null) {
|
|
|
- throw new XiaoShiException("传入参数不能为空");
|
|
|
- }
|
|
|
- UpdatePatentDigProjectFilesDTO updatePatentDigProjectFilesDTO = (UpdatePatentDigProjectFilesDTO) object;
|
|
|
- if (updatePatentDigProjectFilesDTO.getProjectId() == null) {
|
|
|
- throw new XiaoShiException("projectId不能为空");
|
|
|
- }
|
|
|
-// if (updatePatentDigProjectFilesDTO.getType() == null) {
|
|
|
-// throw new XiaoShiException("文件类型不能为空");
|
|
|
-// }
|
|
|
- PatentDigProjectFiles patentDigProjectFiles = this.getById(updatePatentDigProjectFilesDTO.getId());
|
|
|
- BeanUtils.copyProperties(updatePatentDigProjectFilesDTO, patentDigProjectFiles);
|
|
|
- patentDigProjectFiles.updateById();
|
|
|
- return patentDigProjectFiles.getId();
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 装载
|
|
|
+ * 装载专利挖掘文件列表信息
|
|
|
* @param patentDigProjectFilesVOS
|
|
|
*/
|
|
|
private void loadPatentDigProjectFiles(List<PatentDigProjectFilesVO> patentDigProjectFilesVOS) throws IOException {
|
|
@@ -166,6 +199,52 @@ public class PatentDigProjectFilesService extends ServiceImpl<PatentDigProjectFi
|
|
|
} else {
|
|
|
throw new XiaoShiException("未获取到当前登陆人信息");
|
|
|
}
|
|
|
+ //调用查询流程名称方法
|
|
|
+ String name = this.getProcessName(patentDigProjectFilesVO.getProcessId());
|
|
|
+ patentDigProjectFilesVO.setProcessName(name);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 装载流程名
|
|
|
+ * @param processId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String getProcessName(Integer processId){
|
|
|
+ String name = null;
|
|
|
+ Map<Integer, String> processMap = new HashMap<>();
|
|
|
+ processMap.put(1, "创新点梳理");
|
|
|
+ processMap.put(2, "查新检索");
|
|
|
+ processMap.put(3, "保护主题规划");
|
|
|
+ processMap.put(4, "独权撰写");
|
|
|
+ processMap.put(5, "从权撰写");
|
|
|
+ processMap.put(6, "申请文件定稿");
|
|
|
+ processMap.put(7, "说明书规划撰写");
|
|
|
+ name = processMap.get(processId);
|
|
|
+ return name;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 上传专利挖掘项目文件后提交审核,新增专利挖掘文件审核记录
|
|
|
+ * @param patentDigProjectFilesDTO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Integer addPDProjectFilesTask(PatentDigProjectFilesDTO patentDigProjectFilesDTO){
|
|
|
+ //首先调用新增文件接口
|
|
|
+ List<Integer> ids = (List<Integer>) this.addMessage(patentDigProjectFilesDTO);
|
|
|
+ //其次调用新增任务接口
|
|
|
+ Integer taskId = projectTaskService.addTask(patentDigProjectFilesDTO.getProjectTaskDTO());
|
|
|
+ if (!ids.isEmpty()) {
|
|
|
+ LambdaQueryWrapper<PatentDigProjectFiles> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.in(PatentDigProjectFiles::getId, ids);
|
|
|
+ List<PatentDigProjectFiles> patentDigProjectFiles = this.list(queryWrapper);
|
|
|
+ if (!patentDigProjectFiles.isEmpty()) {
|
|
|
+ patentDigProjectFiles.forEach(item -> {
|
|
|
+ item.setTaskId(taskId);
|
|
|
+ });
|
|
|
+ this.updateBatchById(patentDigProjectFiles);
|
|
|
+ }
|
|
|
}
|
|
|
+ return taskId;
|
|
|
}
|
|
|
}
|