| | |
| | | */ |
| | | @Transactional |
| | | @Override |
| | | public ReportInsertDTO insertRiskReport(Long currentUserId, Long id) { |
| | | public ReportInsertDTO insertRiskReport(Long currentUserId, Long id,String reSubmit) { |
| | | |
| | | if (currentUserId < 0){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无效,请重新登陆"); |
| | |
| | | if (roleTag == 0){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"不是管理员,无权生成报告"); |
| | | } |
| | | if (experimentById.getStage() == StatusEnum.EXPERIMENT_STATUS_REPORT.getCode().byteValue()){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"该实验已经生成报告,无需重复操作"); |
| | | if (!ObjectUtils.isEmpty(reSubmit) && "1".equals(reSubmit) && experimentById.getStage() >= StatusEnum.EXPERIMENT_STATUS_REPORT.getCode().byteValue()){ |
| | | //删除已生成的报告数据 |
| | | delReportData(id,currentUserId); |
| | | }else { |
| | | if (experimentById.getStage() == StatusEnum.EXPERIMENT_STATUS_REPORT.getCode().byteValue()){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"该实验已经生成报告,无需重复操作"); |
| | | } |
| | | } |
| | | |
| | | ReportRiskAssessInfo byExperimentId = reportRepository.getByExperimentId(id); |
| | | if (!ObjectUtils.isEmpty(byExperimentId)){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"该实验已经生成报告,请勿重复操作"); |
| | | } |
| | | |
| | | //定义初始风险等级0级 |
| | | Byte level = 0; |
| | | //获取该实验的所有计划信息 |
| | |
| | | if (tag == 1){ |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode() ,"该实验有未完成的评估计划" + info); |
| | | } |
| | | |
| | | UserInfoDomainDTO liabilityUser = userDomainService.getUserInfoById(experimentById.getLiabilityUserId()); |
| | | if (ObjectUtils.isEmpty(liabilityUser)){ |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode() ,"实验责任人信息不存在"); |
| | | } |
| | | //20250520实验责任人去掉验证 |
| | | // UserInfoDomainDTO liabilityUser = userDomainService.getUserInfoById(experimentById.getLiabilityUserId()); |
| | | // if (ObjectUtils.isEmpty(liabilityUser)){ |
| | | // throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode() ,"实验责任人信息不存在"); |
| | | // } |
| | | |
| | | |
| | | //检查该实验所有的评价结果,遍历评价结果等级 |
| | |
| | | reportInfo.setSafeRiskAnalysis(analysis.toString()); |
| | | |
| | | reportInfo.setAssessPerson(null); |
| | | reportInfo.setAssessLevel(null); |
| | | reportInfo.setDepId(null); //todo 不确定是否需要部门 |
| | | reportInfo.setSafeRiskAnalysis(null); //todo 安全风险分析,暂时不知道数据来源,先设空 |
| | | reportInfo.setAssessLevel(StatusEnum.REPORT_LEVEL_1.getCode().byteValue()); |
| | | //todo 不确定是否需要部门 |
| | | reportInfo.setDepId(null); |
| | | // reportInfo.setSafeRiskAnalysis(null); |
| | | |
| | | |
| | | |
| | | //修改实验 4 生成报告, |
| | |
| | | |
| | | } |
| | | |
| | | private void delReportData(Long id,Long userId){ |
| | | ReportRiskAssessInfo byExperimentId = reportRepository.getByExperimentId(id); |
| | | if (!ObjectUtils.isEmpty(byExperimentId)){ |
| | | reportRepository.delReport(userId, byExperimentId.getId()); |
| | | reportExperimentSiteService.delReportData(byExperimentId.getId()); |
| | | reportSourceTypeService.delReportData(byExperimentId.getId()); |
| | | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 风险评估报告 - 填报信息 |
| | | */ |