|
@@ -1,6 +1,8 @@
|
|
package cn.cslg.pas.service.business;
|
|
package cn.cslg.pas.service.business;
|
|
|
|
|
|
import cn.cslg.pas.common.dto.business.PatentProjectDTO;
|
|
import cn.cslg.pas.common.dto.business.PatentProjectDTO;
|
|
|
|
+import cn.cslg.pas.common.dto.business.ProjectEventDTO;
|
|
|
|
+import cn.cslg.pas.common.dto.business.ReportProjectDTO;
|
|
import cn.cslg.pas.common.model.cronModel.*;
|
|
import cn.cslg.pas.common.model.cronModel.*;
|
|
import cn.cslg.pas.common.model.request.GroupRequest;
|
|
import cn.cslg.pas.common.model.request.GroupRequest;
|
|
import cn.cslg.pas.common.model.request.QueryRequest;
|
|
import cn.cslg.pas.common.model.request.QueryRequest;
|
|
@@ -9,10 +11,8 @@ import cn.cslg.pas.common.utils.CacheUtils;
|
|
import cn.cslg.pas.common.utils.LoginUtils;
|
|
import cn.cslg.pas.common.utils.LoginUtils;
|
|
import cn.cslg.pas.common.vo.business.EventCountVO;
|
|
import cn.cslg.pas.common.vo.business.EventCountVO;
|
|
import cn.cslg.pas.common.vo.business.EventVO;
|
|
import cn.cslg.pas.common.vo.business.EventVO;
|
|
-import cn.cslg.pas.domain.business.AssoEventFile;
|
|
|
|
-import cn.cslg.pas.domain.business.PatentProject;
|
|
|
|
-import cn.cslg.pas.domain.business.ReportProject;
|
|
|
|
-import cn.cslg.pas.domain.business.SystemDict;
|
|
|
|
|
|
+import cn.cslg.pas.domain.business.*;
|
|
|
|
+import cn.cslg.pas.exception.UnLoginException;
|
|
import cn.cslg.pas.exception.XiaoShiException;
|
|
import cn.cslg.pas.exception.XiaoShiException;
|
|
import cn.cslg.pas.factorys.businessFactory.Business;
|
|
import cn.cslg.pas.factorys.businessFactory.Business;
|
|
import cn.cslg.pas.factorys.reGroupFactory.QueryGroupFactory;
|
|
import cn.cslg.pas.factorys.reGroupFactory.QueryGroupFactory;
|
|
@@ -69,7 +69,17 @@ public class ReportProjectService extends ServiceImpl<ReportProjectMapper,Report
|
|
private AssoProjectEventMapper assoProjectEventMapper;
|
|
private AssoProjectEventMapper assoProjectEventMapper;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
|
+ private AssoProjectEventService assoProjectEventService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private AssoProjectFileService assoProjectFileService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private AssoReportCronService assoReportCronService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
private CacheUtils cacheUtils;
|
|
private CacheUtils cacheUtils;
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
private LoginUtils loginUtils;
|
|
private LoginUtils loginUtils;
|
|
|
|
|
|
@@ -98,31 +108,6 @@ public class ReportProjectService extends ServiceImpl<ReportProjectMapper,Report
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public Integer addMessage(Object object, List<MultipartFile> files) {
|
|
public Integer addMessage(Object object, List<MultipartFile> files) {
|
|
|
|
|
|
- //校验参数
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 装载project
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 装载reportProject
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 装载事件与project关联
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 装载和附件关联
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 装载核心结论
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -199,9 +184,103 @@ public class ReportProjectService extends ServiceImpl<ReportProjectMapper,Report
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Object addMessage(Object object) {
|
|
public Object addMessage(Object object) {
|
|
- //
|
|
|
|
|
|
+ //TODO 校验参数
|
|
|
|
+ //object to reportProjectDTO
|
|
|
|
+ ReportProjectDTO reportProjectDTO = (ReportProjectDTO) object;
|
|
|
|
+ /**
|
|
|
|
+ * 校验必传参数是否上传
|
|
|
|
+ */
|
|
|
|
+ //负责人id
|
|
|
|
+ if (reportProjectDTO.getHeadId() == null) {
|
|
|
|
+ throw new XiaoShiException("负责人id不能为空");
|
|
|
|
+ }
|
|
|
|
+ //报告类型
|
|
|
|
+ if (reportProjectDTO.getReportType().equals(null)) {
|
|
|
|
+ throw new XiaoShiException("报告类型不能为空");
|
|
|
|
+ }
|
|
|
|
+ //报告状态
|
|
|
|
+ if (reportProjectDTO.getStauts().equals(null)) {
|
|
|
|
+ throw new XiaoShiException("报告状态不能为空");
|
|
|
|
+ }
|
|
|
|
+ //获取登陆人信息 用于设置创建人
|
|
|
|
+ PersonnelVO personnelVO = new PersonnelVO();
|
|
|
|
+ try {
|
|
|
|
+ personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ throw new UnLoginException("未登录");
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
|
|
+ * 装载project
|
|
|
|
+ */
|
|
|
|
+ Project project = new Project();
|
|
|
|
+ BeanUtils.copyProperties(reportProjectDTO, project);
|
|
|
|
+ project.setCreateId(personnelVO.getId());
|
|
|
|
+ project.setTenantId(personnelVO.getTenantId());
|
|
|
|
+ project.insert();
|
|
|
|
+ /**
|
|
|
|
+ * 装载reportProject
|
|
|
|
+ */
|
|
|
|
+ ReportProject reportProject = new ReportProject();
|
|
|
|
+ BeanUtils.copyProperties(reportProjectDTO, reportProject);
|
|
|
|
+ reportProject.setProject_id(project.getId());
|
|
|
|
+ reportProject.insert();
|
|
|
|
+ /**
|
|
|
|
+ * 装载事件与project关联
|
|
|
|
+ */
|
|
|
|
+ List<AssoProjectEvent> assoProjectEvents = new ArrayList<>();
|
|
|
|
+ List<ProjectEventDTO> events = reportProjectDTO.getEvents();
|
|
|
|
+ if (events != null && events.size() != 0) {
|
|
|
|
+ //遍历传入的事件集合
|
|
|
|
+ for (ProjectEventDTO projectEventDTO : events) {
|
|
|
|
+ AssoProjectEvent assoProjectEvent = new AssoProjectEvent();
|
|
|
|
+ //事件id和处理事项id
|
|
|
|
+ BeanUtils.copyProperties(projectEventDTO, assoProjectEvent);
|
|
|
|
+ //项目id
|
|
|
|
+ assoProjectEvent.setProjectId(project.getId());
|
|
|
|
+ //创建人
|
|
|
|
+ assoProjectEvent.setCreateId(personnelVO.getId());
|
|
|
|
+ //类型为报告
|
|
|
|
+ assoProjectEvent.setProjectType(1);
|
|
|
|
+ assoProjectEvents.add(assoProjectEvent);
|
|
|
|
+ }
|
|
|
|
+ if (assoProjectEvents != null && assoProjectEvents.size() != 0) {
|
|
|
|
+ assoProjectEventService.saveBatch(assoProjectEvents);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
|
|
+ * 装载和附件关联
|
|
|
|
+ */
|
|
|
|
+ List<AssoProjectFile> assoProjectFiles = new ArrayList<>();
|
|
|
|
+ List<String> fileGuids = reportProjectDTO.getFileGuids();
|
|
|
|
+ if (fileGuids != null && fileGuids.size() != 0) {
|
|
|
|
+ for (String fileGuid : fileGuids) {
|
|
|
|
+ AssoProjectFile assoProjectFile = new AssoProjectFile();
|
|
|
|
+ assoProjectFile.setProjectId(project.getId());
|
|
|
|
+ assoProjectFile.setFileGuid(fileGuid);
|
|
|
|
+ assoProjectFile.setCreateId(personnelVO.getId());
|
|
|
|
+ assoProjectFiles.add(assoProjectFile);
|
|
|
|
+ }
|
|
|
|
+ if (assoProjectFiles != null && assoProjectFiles.size() != 0) {
|
|
|
|
+ assoProjectFileService.saveBatch(assoProjectFiles);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- return null;
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 装载核心结论
|
|
|
|
+ */
|
|
|
|
+ List<Integer> cronIds = reportProjectDTO.getCronIds();
|
|
|
|
+ List<AssoReportCron> assoReportCrons = new ArrayList<>();
|
|
|
|
+ if (cronIds != null && cronIds.size() != 0) {
|
|
|
|
+ cronIds.forEach(item -> {
|
|
|
|
+ AssoReportCron assoReportCron = new AssoReportCron();
|
|
|
|
+ assoReportCron.setProjectId(project.getId());
|
|
|
|
+ assoReportCron.setCronId(item);
|
|
|
|
+ assoReportCrons.add(assoReportCron);
|
|
|
|
+ });
|
|
|
|
+ assoReportCronService.saveBatch(assoReportCrons);
|
|
|
|
+ }
|
|
|
|
+ //返回id
|
|
|
|
+ return project.getId();
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|