| | |
| | | package com.gkhy.labRiskManage.domain.riskReport.service.impl; |
| | | |
| | | import com.gkhy.labRiskManage.api.controller.riskReport.dto.repDto.*; |
| | | import com.gkhy.labRiskManage.application.account.dto.respDto.UserEvaluateRespDTO; |
| | | import com.gkhy.labRiskManage.application.account.dto.respDto.UserIdentityRespDTO; |
| | | import com.gkhy.labRiskManage.application.riskReport.dto.bo.*; |
| | | import com.gkhy.labRiskManage.application.riskReport.dto.dto.RiskAssessAppQueryDTO; |
| | | import com.gkhy.labRiskManage.application.riskReport.dto.dto.RiskAssessAppQueryDTO_0223bak; |
| | |
| | | import com.gkhy.labRiskManage.domain.basic.service.BasicExperimentPersonService; |
| | | import com.gkhy.labRiskManage.domain.basic.service.BasicRiskUnitService; |
| | | import com.gkhy.labRiskManage.domain.basic.service.BasicRiskUnitTypeService; |
| | | import com.gkhy.labRiskManage.domain.experiment.entity.ExperimentInfo; |
| | | import com.gkhy.labRiskManage.domain.experiment.model.dto.ExperimentInfoDTO; |
| | | import com.gkhy.labRiskManage.domain.experiment.service.ExperimentInfoService; |
| | | import com.gkhy.labRiskManage.domain.riskReport.entity.*; |
| | | import com.gkhy.labRiskManage.domain.riskReport.model.bo.*; |
| | | import com.gkhy.labRiskManage.domain.riskReport.model.dto.*; |
| | | import com.gkhy.labRiskManage.domain.riskReport.repository.jpa.RiskAssessPlanEvaluateUserRepository; |
| | | import com.gkhy.labRiskManage.domain.riskReport.repository.jpa.RiskAssessPlanIdentificationUserRepository; |
| | | import com.gkhy.labRiskManage.domain.riskReport.repository.jpa.RiskAssessPlanRepository; |
| | | import com.gkhy.labRiskManage.domain.riskReport.service.*; |
| | | import com.gkhy.labRiskManage.domain.riskReport.utils.EvaluateAndIdentificationUtils; |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | | /** |
| | | * 风险评估计划 |
| | | */ |
| | | @Service |
| | | public class RiskAssessPlanServiceImpl implements RiskAssessPlanService { |
| | | public class RiskAssessPlanServiceImpl implements RiskAssessPlanService { |
| | | |
| | | @Autowired |
| | | private RiskAssessPlanRepository assessPlanRepository; |
| | |
| | | private RiskAssessPlanIdentificationSclService sclService; |
| | | |
| | | @Autowired |
| | | private RiskAssessPlanIdentificationUserService planIdentificationUserService; |
| | | |
| | | @Autowired |
| | | private RiskAssessPlanEvaluateUserService evaluateUserService; |
| | | |
| | | @Autowired |
| | | private RiskAssessPlanEvaluateLecService lecService; |
| | | @Autowired |
| | | private RiskAssessPlanEvaluateLsService lsService; |
| | |
| | | @Override |
| | | public PlanInsertDTO insertAssessPlan(Long currentUserId, RiskAssessPlanAppInsertBO insertParam) { |
| | | |
| | | if (currentUserId < 0){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无效,请重新登陆"); |
| | | if (currentUserId < 0) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户无效,请重新登陆"); |
| | | } |
| | | // 检查是否是实验管理者 |
| | | int roleTag = 0; |
| | |
| | | // if (roleTag ==0 ){ |
| | | // throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无权添加实验评估计划"); |
| | | // } |
| | | if (ObjectUtils.isEmpty(user)){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户不存在或已被删除"); |
| | | if (ObjectUtils.isEmpty(user)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户不存在或已被删除"); |
| | | } |
| | | //参数校验 |
| | | if (ObjectUtils.isEmpty(insertParam)){ |
| | | if (ObjectUtils.isEmpty(insertParam)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "请求参数为空"); |
| | | } |
| | | if (ObjectUtils.isEmpty(insertParam.getRiskUnitId())){ |
| | | if (ObjectUtils.isEmpty(insertParam.getRiskUnitId())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "风险单元不能为空"); |
| | | } |
| | | if (ObjectUtils.isEmpty(insertParam.getRiskType())){ |
| | | if (ObjectUtils.isEmpty(insertParam.getRiskType())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "风险单元类型不能为空"); |
| | | } |
| | | if (ObjectUtils.isEmpty(insertParam.getIdentificationType())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "辨识类型不能为空"); |
| | | } |
| | | RiskUnitQueryDTO riskUnitById = riskUnitService.getRiskUnitById(insertParam.getRiskUnitId()); |
| | | if (ObjectUtils.isEmpty(riskUnitById.getId())){ |
| | | if (ObjectUtils.isEmpty(riskUnitById.getId())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "风险单元不存在或已被删除"); |
| | | } |
| | | List<RiskAssessPlan> assessPlanByUnitId = assessPlanRepository.getAssessPlanByUnitId(insertParam.getRiskUnitId()); |
| | | if (assessPlanByUnitId.size() >= 1){ |
| | | if (assessPlanByUnitId.size() >= 1) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "该单元已有评估计划"); |
| | | } |
| | | ExperimentInfoDTO experimentById = experimentInfoService.getExperimentById(riskUnitById.getExperimentId()); |
| | | if (ObjectUtils.isEmpty(experimentById)){ |
| | | if (ObjectUtils.isEmpty(experimentById)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "实验不存在或已被删除"); |
| | | } |
| | | if (experimentById.getStatus() == 1){ |
| | | if (experimentById.getStatus() == 1) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "实验未被批准,无法进行评估"); |
| | | } |
| | | if (ObjectUtils.isEmpty(insertParam.getAssessPlanName())){ |
| | | if (ObjectUtils.isEmpty(insertParam.getAssessPlanName())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评估计划名称不能为空"); |
| | | } |
| | | RiskAssessPlan assessPlanByName = assessPlanRepository.getAssessPlanByName(insertParam.getAssessPlanName()); |
| | | if (!ObjectUtils.isEmpty(assessPlanByName)){ |
| | | if (!ObjectUtils.isEmpty(assessPlanByName)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "评估计划名称已被使用"); |
| | | } |
| | | if (ObjectUtils.isEmpty(insertParam.getAssessStartTime())){ |
| | | if (ObjectUtils.isEmpty(insertParam.getAssessStartTime())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评估开始时间不能为空"); |
| | | } |
| | | if (ObjectUtils.isEmpty(insertParam.getAssessEndTime())){ |
| | | if (ObjectUtils.isEmpty(insertParam.getAssessEndTime())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评估结束时间不能为空"); |
| | | } |
| | | if (insertParam.getAssessEndTime().isBefore(insertParam.getAssessStartTime())){ |
| | | if (insertParam.getAssessEndTime().isBefore(insertParam.getAssessStartTime())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "评估结束时间必须在评估开始时间之后"); |
| | | } |
| | | // 计划制定人? |
| | | if (ObjectUtils.isEmpty(insertParam.getPlanUserId())){ |
| | | if (ObjectUtils.isEmpty(insertParam.getPlanUserId())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "计划制定人不能为空"); |
| | | } |
| | | UserInfoDomainDTO planUser = userDomainService.getUserInfoByIdAndSellInfo(insertParam.getPlanUserId(),"计划指定人"); |
| | | if (ObjectUtils.isEmpty(planUser)){ |
| | | UserInfoDomainDTO planUser = userDomainService.getUserInfoByIdAndSellInfo(insertParam.getPlanUserId(), "计划指定人"); |
| | | if (ObjectUtils.isEmpty(planUser)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "计划制定人不存在或已被删除"); |
| | | } |
| | | List<Long> identificationUserInsert = insertParam.getIdentificationUserInsert(); |
| | | // 辨识专家 |
| | | if (ObjectUtils.isEmpty(insertParam.getIdentificationUserId())){ |
| | | if (ObjectUtils.isEmpty(identificationUserInsert)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "辨识专家不能为空"); |
| | | } |
| | | UserInfoDomainDTO identificationUser = userDomainService.getUserInfoByIdAndSellInfo(insertParam.getIdentificationUserId(), "辨识专家"); |
| | | if (ObjectUtils.isEmpty(identificationUser)){ |
| | | List<UserInfoDomainDTO> identificationUser = userDomainService.getUserInfoByIds(identificationUserInsert, "辨识专家"); |
| | | if (ObjectUtils.isEmpty(identificationUser)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "辨识专家不存在或已被删除"); |
| | | } |
| | | if (identificationUser.size() != identificationUserInsert.size()) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "存在选中辨识专家不存在或已被删除"); |
| | | } |
| | | |
| | | List<Long> evaluateUserInsert = insertParam.getEvaluateUserInsert(); |
| | | // 评价专家 |
| | | if (ObjectUtils.isEmpty(insertParam.getEvaluateUserId())){ |
| | | if (ObjectUtils.isEmpty(evaluateUserInsert)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评价专家不能为空"); |
| | | } |
| | | UserInfoDomainDTO evaluateUser = userDomainService.getUserInfoByIdAndSellInfo(insertParam.getEvaluateUserId(), "评价专家"); |
| | | if (ObjectUtils.isEmpty(evaluateUser)){ |
| | | List<UserInfoDomainDTO> evaluateUserUser = userDomainService.getUserInfoByIds(evaluateUserInsert, "评价专家"); |
| | | if (ObjectUtils.isEmpty(evaluateUserUser)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "评价专家不存在或已被删除"); |
| | | } |
| | | if (evaluateUserUser.size() != evaluateUserInsert.size()) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "存在选中评价专家不存在或已被删除"); |
| | | } |
| | | |
| | | // // 评价专家 |
| | | // if (ObjectUtils.isEmpty(insertParam.getEvaluateUserId())){ |
| | | // throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评价专家不能为空"); |
| | | // } |
| | | // UserInfoDomainDTO evaluateUser = userDomainService.getUserInfoByIdAndSellInfo(insertParam.getEvaluateUserId(), "评价专家"); |
| | | // if (ObjectUtils.isEmpty(evaluateUser)){ |
| | | // throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "评价专家不存在或已被删除"); |
| | | // } |
| | | |
| | | BasicRiskUnitType riskUnitTypeById = riskUnitTypeService.getRiskUnitTypeById(riskUnitById.getRiskUnitTypeId()); |
| | | |
| | |
| | | //获取需要的参数 |
| | | LocalDateTime date = LocalDateTime.now(); |
| | | // 如果是实验风险,添加实验id |
| | | if (insertParam.getRiskType() == StatusEnum.EXPERIMENT_RISK.getCode().byteValue()){ |
| | | if (insertParam.getRiskType() == StatusEnum.EXPERIMENT_RISK.getCode().byteValue()) { |
| | | riskAssessPlan.setExperimentId(riskUnitById.getExperimentId());// |
| | | } |
| | | riskAssessPlan.setCreateTime(date); |
| | |
| | | riskAssessPlan.setPlanSellStatus(StatusEnum.PLAN_SELL_NOT.getCode().byteValue());//计划未派发 |
| | | riskAssessPlan.setPlanExecStatus(StatusEnum.PLAN_EXEC_NOT_START.getCode().byteValue());//计划执行未开始(执行阶段) |
| | | // riskAssessPlan.setPlanTimeStatus(StatusEnum.PLAN_STATUS_NOT_START.getCode().byteValue());//计划状态未开始 |
| | | riskAssessPlan.setIdentificationUserId(insertParam.getIdentificationUserId());//辨识专家id |
| | | riskAssessPlan.setIdentificationUser(identificationUser.getRealName());//辨识专家 |
| | | riskAssessPlan.setEvaluateUserId(insertParam.getEvaluateUserId());//评价专家id |
| | | riskAssessPlan.setEvaluateUser(evaluateUser.getRealName());//评价专家 |
| | | // riskAssessPlan.setIdentificationUserId(insertParam.getIdentificationUserId());//辨识专家id |
| | | // riskAssessPlan.setIdentificationUser(identificationUser.getRealName());//辨识专家 |
| | | // riskAssessPlan.setEvaluateUserId(insertParam.getEvaluateUserId());//评价专家id |
| | | // riskAssessPlan.setEvaluateUser(evaluateUser.getRealName());//评价专家 |
| | | |
| | | riskAssessPlan.setIdentificationMethod(MethodEnum.IDENTIFICATION_METHOD_PHA.getCode());//辨识方法 |
| | | riskAssessPlan.setEvaluateMethod(MethodEnum.EVALUATE_METHOD_LEC.getCode());//评价方法 |
| | | |
| | | RiskAssessPlan saveResult = assessPlanRepository.save(riskAssessPlan); |
| | | |
| | | //处理辨识专家 |
| | | saveIdentificationUser(saveResult.getId(), identificationUser, date, user.getId()); |
| | | //处理评价专家 |
| | | saveEvaUser(saveResult.getId(), evaluateUserUser, date, user.getId()); |
| | | //修改实验状态为评估中 |
| | | ExperimentInfoDTO experimentInfoDTO = experimentInfoService.updateExperimentStage(experimentById.getId(), StatusEnum.EXPERIMENT_STATUS_START.getCode().byteValue()); |
| | | if (ObjectUtils.isEmpty(experimentInfoDTO)){ |
| | | if (ObjectUtils.isEmpty(experimentInfoDTO)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "实验状态修改失败"); |
| | | } |
| | | //修改风险单元为已有评估计划 |
| | | if (insertParam.getRiskType() == StatusEnum.EXPERIMENT_RISK.getCode().byteValue()){ |
| | | if (insertParam.getRiskType() == StatusEnum.EXPERIMENT_RISK.getCode().byteValue()) { |
| | | RiskUnit riskUnit = riskUnitService.updateRiskUnitStatus(insertParam.getRiskUnitId(), StatusEnum.EVALUATE_WAIT.getCode()); |
| | | if (ObjectUtils.isEmpty(riskUnit)){ |
| | | if (ObjectUtils.isEmpty(riskUnit)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "风险单元状态修改失败"); |
| | | } |
| | | }else if (insertParam.getRiskType() == StatusEnum.INHERENT_RISK.getCode().byteValue()){ |
| | | } else if (insertParam.getRiskType() == StatusEnum.INHERENT_RISK.getCode().byteValue()) { |
| | | RiskUnitUpdateDTO riskUnitUpdateDTO = basicRiskUnitService.updateRiskUnitStatus(insertParam.getRiskUnitId(), StatusEnum.EVALUATE_WAIT.getCode()); |
| | | if (ObjectUtils.isEmpty(riskUnitUpdateDTO)){ |
| | | if (ObjectUtils.isEmpty(riskUnitUpdateDTO)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "风险单元状态修改失败"); |
| | | } |
| | | } |
| | |
| | | return planInsertDTO; |
| | | } |
| | | |
| | | private void saveIdentificationUser(Long id, List<UserInfoDomainDTO> identificationUser, LocalDateTime date, Long userId) { |
| | | |
| | | // 处理辨识专家 |
| | | List<RiskAssessPlanIdentificationUser> saveList = new ArrayList<>(); |
| | | for (UserInfoDomainDTO userInfo : identificationUser) { |
| | | RiskAssessPlanIdentificationUser planIdentificationUser = new RiskAssessPlanIdentificationUser(); |
| | | planIdentificationUser.setRiskAssessPlanId(id); |
| | | planIdentificationUser.setIdentificationUserId(userInfo.getId()); |
| | | planIdentificationUser.setIdentificationUser(userInfo.getRealName()); |
| | | planIdentificationUser.setCreateTime(date); |
| | | planIdentificationUser.setCreateByUserId(userId); |
| | | planIdentificationUser.setDeleteStatus((byte)0); |
| | | saveList.add(planIdentificationUser); |
| | | } |
| | | planIdentificationUserService.InsertData(saveList); |
| | | } |
| | | |
| | | private void saveEvaUser(Long id, List<UserInfoDomainDTO> identificationUser, LocalDateTime date, Long userId) { |
| | | |
| | | // 处理辨识专家 |
| | | List<RiskAssessPlanEvaluateUser> saveList = new ArrayList<>(); |
| | | for (UserInfoDomainDTO userInfo : identificationUser) { |
| | | RiskAssessPlanEvaluateUser planIdentificationUser = new RiskAssessPlanEvaluateUser(); |
| | | planIdentificationUser.setRiskAssessPlanId(id); |
| | | planIdentificationUser.setEvaluateUserId(userInfo.getId()); |
| | | planIdentificationUser.setEvaluateUser(userInfo.getRealName()); |
| | | planIdentificationUser.setCreateTime(date); |
| | | planIdentificationUser.setCreateByUserId(userId); |
| | | planIdentificationUser.setDeleteStatus((byte)0); |
| | | saveList.add(planIdentificationUser); |
| | | } |
| | | evaluateUserService.InsertEvaluate(saveList); |
| | | } |
| | | |
| | | /** |
| | | * 风险评估计划 - 查询 |
| | | */ |
| | |
| | | |
| | | |
| | | //校验参数 |
| | | if (ObjectUtils.isEmpty(queryParamBO.getPageSize())){ |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode() ,"分页信息不能为空"); |
| | | if (ObjectUtils.isEmpty(queryParamBO.getPageSize())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode(), "分页信息不能为空"); |
| | | } |
| | | if (ObjectUtils.isEmpty(queryParamBO.getPageIndex())){ |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode() ,"分页信息不能为空"); |
| | | if (ObjectUtils.isEmpty(queryParamBO.getPageIndex())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode(), "分页信息不能为空"); |
| | | } |
| | | if (queryParamBO.getRiskUnitName() == "null"){ |
| | | if (queryParamBO.getRiskUnitName() == "null") { |
| | | queryParamBO.setRiskUnitName(null); |
| | | } |
| | | if (queryParamBO.getAssessPlanName() == "null"){ |
| | | if (queryParamBO.getAssessPlanName() == "null") { |
| | | queryParamBO.setAssessPlanName(null); |
| | | } |
| | | // 检查是否是实验管理者 |
| | | UserInfoDomainDTO user = userDomainService.getUserById(currentUserId); |
| | | if (ObjectUtils.isEmpty(user)){ |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode() ,"用户不存在"); |
| | | if (ObjectUtils.isEmpty(user)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode(), "用户不存在"); |
| | | } |
| | | int roleTag = GetRoleTagUtils.GetRoleTagUtils(user); |
| | | |
| | | List<Long> ids = new ArrayList<>(); |
| | | if (!ObjectUtils.isEmpty(queryParamBO.getRiskUnitName())){ |
| | | List<RiskUnitQueryDTO> riskUnitList= riskUnitService.getRiskUnitByName(queryParamBO.getRiskUnitName()); |
| | | if (riskUnitList.size() < 1){ |
| | | if (!ObjectUtils.isEmpty(queryParamBO.getRiskUnitName())) { |
| | | List<RiskUnitQueryDTO> riskUnitList = riskUnitService.getRiskUnitByName(queryParamBO.getRiskUnitName()); |
| | | if (riskUnitList.size() < 1) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "风险单元不存在或已被删除"); |
| | | } |
| | | for (RiskUnitQueryDTO riskUnit : riskUnitList) { |
| | |
| | | |
| | | List<Long> experimentIdList = new ArrayList<>(); |
| | | experimentIdList.add(0L); |
| | | if (!ObjectUtils.isEmpty(experimentByList)){ |
| | | if (!ObjectUtils.isEmpty(experimentByList)) { |
| | | for (ExperimentInfoDTO experimentInfo : experimentByList) { |
| | | experimentIdList.add(experimentInfo.getId()); |
| | | } |
| | | } |
| | | |
| | | RiskAssessPlanQueryBO queryParam = BeanCopyUtils.copyBean(queryParamBO, RiskAssessPlanQueryBO.class); |
| | | RiskAssessPlanQueryBO queryParam = BeanCopyUtils.copyBean(queryParamBO, RiskAssessPlanQueryBO.class); |
| | | queryParam.setRiskUnitIds(ids); |
| | | SearchResult searchResult = new SearchResult<>(); |
| | | searchResult.setPageIndex(queryParam.getPageIndex()); |
| | |
| | | @Override |
| | | public Predicate toPredicate(Root<RiskAssessPlan> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder) { |
| | | List<Predicate> predicateList = new ArrayList<>(); |
| | | if (queryParam.getAssessPlanName() != null && !queryParam.getAssessPlanName().equals("")){ |
| | | predicateList.add(criteriaBuilder.like(root.get("assessPlanName"),"%"+queryParam.getAssessPlanName()+"%")); |
| | | if (queryParam.getAssessPlanName() != null && !queryParam.getAssessPlanName().equals("")) { |
| | | predicateList.add(criteriaBuilder.like(root.get("assessPlanName"), "%" + queryParam.getAssessPlanName() + "%")); |
| | | } |
| | | //in |
| | | if (queryParam.getRiskUnitIds().size() >= 1){ |
| | | if (queryParam.getRiskUnitIds().size() >= 1) { |
| | | predicateList.add(criteriaBuilder.in(root.get("riskUnitId")).value(ids)); |
| | | } |
| | | if (queryParam.getExperimentId() != null){ |
| | | predicateList.add(criteriaBuilder.equal(root.get("experimentId"),queryParam.getExperimentId())); |
| | | if (queryParam.getExperimentId() != null) { |
| | | predicateList.add(criteriaBuilder.equal(root.get("experimentId"), queryParam.getExperimentId())); |
| | | } |
| | | if (roleTag == UserTagEnum.USER_TAG_0.getCode()){ |
| | | Join<RiskAssessPlan, RiskAssessPlanIdentificationUser> identificationUserJoin = root.join("riskAssessPlanIdentificationUsers", JoinType.LEFT); |
| | | Join<RiskAssessPlan, RiskAssessPlanEvaluateUser> evaluateUserJoin = root.join("riskAssessPlanEvaluateUsers", JoinType.LEFT); |
| | | |
| | | if (roleTag == UserTagEnum.USER_TAG_0.getCode()) { |
| | | |
| | | //此处应有谁能查询:辨识专家,评价专家,实验负责人(此处未存相关信息,以实验id为条件查询) |
| | | predicateList.add(criteriaBuilder.or( |
| | | criteriaBuilder.equal(root.get("identificationUserId"), currentUserId), |
| | | criteriaBuilder.equal(root.get("evaluateUserId"), currentUserId), |
| | | criteriaBuilder.in(root.get("experimentId")).value(experimentIdList) |
| | | criteriaBuilder.equal(identificationUserJoin.get("identificationUserId"), currentUserId), |
| | | criteriaBuilder.equal(evaluateUserJoin.get("evaluateUserId"), currentUserId), |
| | | criteriaBuilder.in(root.get("experimentId")).value(experimentIdList) |
| | | ) |
| | | ); |
| | | } |
| | | predicateList.add(criteriaBuilder.equal(root.get("deleteStatus"),StatusEnum.DELETE_NOT.getCode())); |
| | | query.groupBy(root.get("id")); |
| | | predicateList.add(criteriaBuilder.equal(root.get("deleteStatus"), StatusEnum.DELETE_NOT.getCode())); |
| | | return criteriaBuilder.and(predicateList.toArray(new Predicate[0])); |
| | | } |
| | | }; |
| | |
| | | List<UserInfoDomainDTO> userList = userDomainService.getUserList(); |
| | | for (RiskAssessPlanQueryDTO assessPlanQueryDTO : assessPlanQueryDTOS) { |
| | | for (UserInfoDomainDTO userInfo : userList) { |
| | | if (userInfo.getId() == assessPlanQueryDTO.getCreateByUserId()){ |
| | | if (userInfo.getId() == assessPlanQueryDTO.getCreateByUserId()) { |
| | | assessPlanQueryDTO.setCreateByUserName(userInfo.getRealName()); |
| | | } |
| | | if (userInfo.getId() == assessPlanQueryDTO.getUpdateByUserId()){ |
| | | if (userInfo.getId() == assessPlanQueryDTO.getUpdateByUserId()) { |
| | | assessPlanQueryDTO.setUpdateByUserName(userInfo.getRealName()); |
| | | } |
| | | if (userInfo.getId() == assessPlanQueryDTO.getPlanUserId()){ |
| | | if (userInfo.getId() == assessPlanQueryDTO.getPlanUserId()) { |
| | | assessPlanQueryDTO.setPlanUserName(userInfo.getRealName()); |
| | | } |
| | | } |
| | | for (RiskUnitListAppQueryDTO riskUnit : riskUnitListAppQueryDTOS) { |
| | | if (riskUnit.getId() == assessPlanQueryDTO.getRiskUnitId()){ |
| | | if (riskUnit.getId() == assessPlanQueryDTO.getRiskUnitId()) { |
| | | assessPlanQueryDTO.setRiskUnitName(riskUnit.getRiskName()); |
| | | } |
| | | } |
| | | //todo 处理数据 |
| | | List<RiskAssessPlanIdentificationUser> riskAssessPlanIdentificationUsers = assessPlanQueryDTO.getRiskAssessPlanIdentificationUsers(); |
| | | if (!ObjectUtils.isEmpty(riskAssessPlanIdentificationUsers)) { |
| | | String identificationUsersString = riskAssessPlanIdentificationUsers.stream() |
| | | .map(RiskAssessPlanIdentificationUser::getIdentificationUser) |
| | | .collect(Collectors.joining(",")); |
| | | assessPlanQueryDTO.setIdentificationUser(identificationUsersString); |
| | | List<UserIdentityRespDTO> userIdentityRespDTOS = BeanCopyUtils.copyBeanList(riskAssessPlanIdentificationUsers, UserIdentityRespDTO.class); |
| | | assessPlanQueryDTO.setIdentityUsers(userIdentityRespDTOS); |
| | | assessPlanQueryDTO.setRiskAssessPlanIdentificationUsers(null); |
| | | } |
| | | |
| | | List<RiskAssessPlanEvaluateUser> riskAssessPlanEvaluateUsers = assessPlanQueryDTO.getRiskAssessPlanEvaluateUsers(); |
| | | if (!ObjectUtils.isEmpty(riskAssessPlanEvaluateUsers)) { |
| | | String identificationUsersString = riskAssessPlanEvaluateUsers.stream() |
| | | .map(RiskAssessPlanEvaluateUser::getEvaluateUser) |
| | | .collect(Collectors.joining(",")); |
| | | assessPlanQueryDTO.setEvaluateUser(identificationUsersString); |
| | | List<UserEvaluateRespDTO> userEvaluateRespDTOS = BeanCopyUtils.copyBeanList(riskAssessPlanEvaluateUsers, UserEvaluateRespDTO.class); |
| | | assessPlanQueryDTO.setEvaluateUsers(userEvaluateRespDTOS); |
| | | assessPlanQueryDTO.setRiskAssessPlanEvaluateUsers(null); |
| | | } |
| | | } |
| | | |
| | |
| | | public AssessPlanUpdateDTO updateAssessPlan(Long currentUserId, RiskAssessPlanUpdateReqBO updateParam) { |
| | | |
| | | |
| | | if (currentUserId < 0){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无效,请重新登陆"); |
| | | if (currentUserId < 0) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户无效,请重新登陆"); |
| | | } |
| | | UserInfoDomainDTO userInfoById = userDomainService.getUserInfoById(currentUserId); |
| | | if (ObjectUtils.isEmpty(userInfoById)){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户不存在或已被删除"); |
| | | if (ObjectUtils.isEmpty(userInfoById)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户不存在或已被删除"); |
| | | } |
| | | // 检查是否是实验管理者 |
| | | int roleTag = 0; |
| | |
| | | // throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无权修改实验评估计划"); |
| | | // } |
| | | //参数校验 |
| | | if (ObjectUtils.isEmpty(updateParam)){ |
| | | if (ObjectUtils.isEmpty(updateParam)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "要求改的参数为空"); |
| | | } |
| | | RiskAssessPlan assessPlanById = assessPlanRepository.getAssessPlanById(updateParam.getId()); |
| | | if (assessPlanById.getPlanSellStatus() == 2){ |
| | | if (assessPlanById.getPlanSellStatus() == 2) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "该计划已经派发,无法修改"); |
| | | } |
| | | if (ObjectUtils.isEmpty(assessPlanById)){ |
| | | if (ObjectUtils.isEmpty(assessPlanById)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评估计划不存在或已被删除"); |
| | | } |
| | | if (ObjectUtils.isEmpty(updateParam.getRiskUnitId())){ |
| | | if (ObjectUtils.isEmpty(updateParam.getRiskUnitId())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "风险单元参数不能为空"); |
| | | } |
| | | if (ObjectUtils.isEmpty(updateParam.getAssessStartTime())){ |
| | | if (ObjectUtils.isEmpty(updateParam.getAssessStartTime())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评估开始时间不能为空"); |
| | | } |
| | | if (ObjectUtils.isEmpty(updateParam.getAssessEndTime())){ |
| | | if (ObjectUtils.isEmpty(updateParam.getAssessEndTime())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评估结束时间不能为空"); |
| | | } |
| | | if (updateParam.getAssessEndTime().isBefore(updateParam.getAssessStartTime())){ |
| | | if (updateParam.getAssessEndTime().isBefore(updateParam.getAssessStartTime())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "评估结束时间必须在评估开始时间之后"); |
| | | } |
| | | RiskUnitQueryDTO riskUnitById = riskUnitService.getRiskUnitById(updateParam.getRiskUnitId()); |
| | | if (ObjectUtils.isEmpty(riskUnitById.getId())){ |
| | | if (ObjectUtils.isEmpty(riskUnitById.getId())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "风险单元不存在或已被删除"); |
| | | } |
| | | ExperimentInfoDTO experimentById = experimentInfoService.getExperimentById(riskUnitById.getExperimentId()); |
| | | if (ObjectUtils.isEmpty(experimentById)){ |
| | | if (ObjectUtils.isEmpty(experimentById)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "实验不存在或已被删除"); |
| | | } |
| | | |
| | | if (ObjectUtils.isEmpty(updateParam.getAssessPlanName())){ |
| | | if (ObjectUtils.isEmpty(updateParam.getAssessPlanName())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评估计划名称不能为空"); |
| | | } |
| | | RiskAssessPlan assessPlanByName = assessPlanRepository.getAssessPlanByName(updateParam.getAssessPlanName()); |
| | | if (!ObjectUtils.isEmpty(assessPlanByName) && !assessPlanByName.getId().equals(updateParam.getId())){ |
| | | if (!ObjectUtils.isEmpty(assessPlanByName) && !assessPlanByName.getId().equals(updateParam.getId())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评估计划已存在,请换一个计划名称"); |
| | | } |
| | | // 计划制定人 |
| | | if (ObjectUtils.isEmpty(updateParam.getPlanUserId())){ |
| | | if (ObjectUtils.isEmpty(updateParam.getPlanUserId())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "计划制定人不能为空"); |
| | | } |
| | | UserInfoDomainDTO planUser = userDomainService.getUserInfoByIdAndSellInfo(updateParam.getPlanUserId(), "计划制定人"); |
| | | if (ObjectUtils.isEmpty(planUser)){ |
| | | if (ObjectUtils.isEmpty(planUser)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "计划制定人不存在或已被删除"); |
| | | } |
| | | List<Long> identificationUserInsert = updateParam.getIdentificationUserInsert(); |
| | | // 辨识专家 |
| | | if (ObjectUtils.isEmpty(updateParam.getIdentificationUserId())){ |
| | | if (ObjectUtils.isEmpty(identificationUserInsert)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "辨识专家不能为空"); |
| | | } |
| | | UserInfoDomainDTO identificationUser = userDomainService.getUserInfoByIdAndSellInfo(updateParam.getIdentificationUserId(), "辨识专家"); |
| | | if (ObjectUtils.isEmpty(identificationUser)){ |
| | | List<UserInfoDomainDTO> identificationUser = userDomainService.getUserInfoByIds(identificationUserInsert, "辨识专家"); |
| | | if (ObjectUtils.isEmpty(identificationUser)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "辨识专家不存在或已被删除"); |
| | | } |
| | | if (identificationUser.size() != identificationUserInsert.size()) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "存在选中辨识专家不存在或已被删除"); |
| | | } |
| | | // // 辨识专家 |
| | | // if (ObjectUtils.isEmpty(updateParam.getIdentificationUserId())){ |
| | | // throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "辨识专家不能为空"); |
| | | // } |
| | | // UserInfoDomainDTO identificationUser = userDomainService.getUserInfoByIdAndSellInfo(updateParam.getIdentificationUserId(), "辨识专家"); |
| | | // if (ObjectUtils.isEmpty(identificationUser)){ |
| | | // throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "辨识专家不存在或已被删除"); |
| | | // } |
| | | // 评价专家 |
| | | if (ObjectUtils.isEmpty(updateParam.getEvaluateUserId())){ |
| | | List<Long> evaluateUserInsert = updateParam.getEvaluateUserInsert(); |
| | | // 评价专家 |
| | | if (ObjectUtils.isEmpty(evaluateUserInsert)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评价专家不能为空"); |
| | | } |
| | | UserInfoDomainDTO evaluateUser = userDomainService.getUserInfoByIdAndSellInfo(updateParam.getEvaluateUserId(), "评价专家"); |
| | | if (ObjectUtils.isEmpty(evaluateUser)){ |
| | | List<UserInfoDomainDTO> evaluateUserUser = userDomainService.getUserInfoByIds(evaluateUserInsert, "评价专家"); |
| | | if (ObjectUtils.isEmpty(evaluateUserUser)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "评价专家不存在或已被删除"); |
| | | } |
| | | if (evaluateUserUser.size() != evaluateUserInsert.size()) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "存在选中评价专家不存在或已被删除"); |
| | | } |
| | | // if (ObjectUtils.isEmpty(updateParam.getEvaluateUserId())){ |
| | | // throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评价专家不能为空"); |
| | | // } |
| | | // UserInfoDomainDTO evaluateUser = userDomainService.getUserInfoByIdAndSellInfo(updateParam.getEvaluateUserId(), "评价专家"); |
| | | // if (ObjectUtils.isEmpty(evaluateUser)){ |
| | | // throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "评价专家不存在或已被删除"); |
| | | // } |
| | | |
| | | //获取需要的参数 |
| | | LocalDateTime date = LocalDateTime.now(); |
| | |
| | | assessPlanById.setAssessStartTime(updateParam.getAssessStartTime()); |
| | | assessPlanById.setAssessEndTime(updateParam.getAssessEndTime()); |
| | | // assessPlanById.setIdentificationMethod(updateParam.getIdentificationMethod());//辨识方法 |
| | | assessPlanById.setIdentificationUserId(updateParam.getIdentificationUserId());//辨识专家id |
| | | assessPlanById.setIdentificationUser(identificationUser.getRealName());//辨识专家 |
| | | // assessPlanById.setIdentificationUserId(updateParam.getIdentificationUserId());//辨识专家id |
| | | // assessPlanById.setIdentificationUser(identificationUser.getRealName());//辨识专家 |
| | | // assessPlanById.setEvaluateMethod(updateParam.getEvaluateMethod());//评价方法 |
| | | assessPlanById.setEvaluateUserId(updateParam.getEvaluateUserId());//评价专家id |
| | | assessPlanById.setEvaluateUser(evaluateUser.getRealName());//评价专家 |
| | | // assessPlanById.setEvaluateUserId(updateParam.getEvaluateUserId());//评价专家id |
| | | // assessPlanById.setEvaluateUser(evaluateUser.getRealName());//评价专家 |
| | | //处理风险数据 |
| | | planIdentificationUserService.deleteByPlanId(assessPlanById.getId(), date); |
| | | saveIdentificationUser(assessPlanById.getId(), identificationUser, date, userInfoById.getId()); |
| | | |
| | | //处理评价专家 |
| | | evaluateUserService.deleteRsByPlan(assessPlanById.getId(), date); |
| | | saveEvaUser(assessPlanById.getId(), evaluateUserUser, date, user.getId()); |
| | | |
| | | RiskAssessPlan saveResult = assessPlanRepository.save(assessPlanById); |
| | | |
| | |
| | | @Override |
| | | public AssessPlanDeleteDTO deleteAssessPlan(Long currentUserId, Long id) { |
| | | |
| | | if (currentUserId < 0){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无效,请重新登陆"); |
| | | if (currentUserId < 0) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户无效,请重新登陆"); |
| | | } |
| | | // 检查是否是实验管理者 |
| | | int roleTag = 0; |
| | |
| | | // throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无权删除实验评估计划"); |
| | | // } |
| | | UserInfoDomainDTO userInfoById = userDomainService.getUserInfoById(currentUserId); |
| | | if (ObjectUtils.isEmpty(userInfoById)){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户不存在或已被删除"); |
| | | if (ObjectUtils.isEmpty(userInfoById)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户不存在或已被删除"); |
| | | } |
| | | if (ObjectUtils.isEmpty(id)){ |
| | | if (ObjectUtils.isEmpty(id)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "删除的内容不能为空"); |
| | | } |
| | | RiskAssessPlan assessPlanById = assessPlanRepository.getAssessPlanById(id); |
| | | if (ObjectUtils.isEmpty(assessPlanById)){ |
| | | if (ObjectUtils.isEmpty(assessPlanById)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "删除的内容不存在或已被删除"); |
| | | } |
| | | if (assessPlanById.getPlanSellStatus() == 2){ |
| | | if (assessPlanById.getPlanSellStatus() == 2) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "该计划已经派发,无法删除"); |
| | | } |
| | | //设置必要参数 |
| | |
| | | @Override |
| | | public AssessPlanUpdateDTO sellAssessPlan(Long currentUserId, Long id) { |
| | | |
| | | if (currentUserId < 0){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无效,请重新登陆"); |
| | | if (currentUserId < 0) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户无效,请重新登陆"); |
| | | } |
| | | UserInfoDomainDTO userInfoById = userDomainService.getUserInfoById(currentUserId); |
| | | if (ObjectUtils.isEmpty(userInfoById)){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户不存在或已被删除"); |
| | | if (ObjectUtils.isEmpty(userInfoById)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户不存在或已被删除"); |
| | | } |
| | | // 检查是否是实验管理者 |
| | | int roleTag = 0; |
| | | UserInfoDomainDTO user = userDomainService.getUserById(currentUserId); |
| | | for (SysUserRoleBindDomainDTO role : user.getRoles()) { |
| | | if (role.getRoleId() == UserRoleEnum.USER_ROLE_4.getCode().byteValue()){ |
| | | if (role.getRoleId() == UserRoleEnum.USER_ROLE_4.getCode().byteValue()) { |
| | | roleTag = 1; |
| | | } |
| | | } |
| | | if (roleTag ==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(), "当前用户无权派发任务"); |
| | | } |
| | | LocalDateTime date = LocalDateTime.now(); |
| | | |
| | | if (ObjectUtils.isEmpty(id)){ |
| | | if (ObjectUtils.isEmpty(id)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "选择的内容不能为空"); |
| | | } |
| | | RiskAssessPlan assessPlanById = assessPlanRepository.getAssessPlanById(id); |
| | | if (ObjectUtils.isEmpty(assessPlanById)){ |
| | | if (ObjectUtils.isEmpty(assessPlanById)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "要派发的计划不存在或已被删除"); |
| | | } |
| | | if (assessPlanById.getPlanSellStatus() == 2){ |
| | | if (assessPlanById.getPlanSellStatus() == 2) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "该计划已经派发"); |
| | | } |
| | | if (assessPlanById.getAssessEndTime().isBefore(date)){ |
| | | if (assessPlanById.getAssessEndTime().isBefore(date)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "任务派发必须在评估结束时间之前"); |
| | | } |
| | | // if (!assessPlanById.getPlanUserId().equals(userInfoById.getId())){ |
| | |
| | | @Override |
| | | public AssessPlanIdentificationDTO identification(Long currentUserId, RiskAssessPlanAppIdentificationBO identificationParam) { |
| | | |
| | | if (currentUserId < 0){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无效,请重新登陆"); |
| | | if (currentUserId < 0) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户无效,请重新登陆"); |
| | | } |
| | | UserInfoDomainDTO userInfoById = userDomainService.getUserInfoById(currentUserId); |
| | | if (ObjectUtils.isEmpty(userInfoById)){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户不存在或已被删除"); |
| | | if (ObjectUtils.isEmpty(userInfoById)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户不存在或已被删除"); |
| | | } |
| | | LocalDateTime date = LocalDateTime.now(); |
| | | |
| | | if (ObjectUtils.isEmpty(identificationParam)){ |
| | | if (ObjectUtils.isEmpty(identificationParam)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "辨识的内容不能为空"); |
| | | } |
| | | if (ObjectUtils.isEmpty(identificationParam.getIdentificationMethod())){ |
| | | if (ObjectUtils.isEmpty(identificationParam.getIdentificationMethod())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "选择的辨识方法不存在"); |
| | | } |
| | | // if (ObjectUtils.isEmpty(identificationParam.getManageMeasure())){ |
| | |
| | | // } |
| | | |
| | | RiskAssessPlan assessPlanById = assessPlanRepository.getAssessPlanById(identificationParam.getId()); |
| | | if (ObjectUtils.isEmpty(assessPlanById)){ |
| | | if (ObjectUtils.isEmpty(assessPlanById)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "要辨识的计划不存在或已被删除"); |
| | | } |
| | | if (!assessPlanById.getIdentificationUserId().equals(currentUserId)){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"不是辨识专家,无法操作"); |
| | | List<RiskAssessPlanIdentificationUser> assessPlanIdentificationUserPlanId = planIdentificationUserService.getAssessPlanIdentificationUserPlanId(assessPlanById.getId(), currentUserId); |
| | | |
| | | if (ObjectUtils.isEmpty(assessPlanIdentificationUserPlanId)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "不是辨识专家,无法操作"); |
| | | } |
| | | if (assessPlanById.getPlanSellStatus() == 1){ |
| | | if (assessPlanById.getPlanSellStatus() == 1) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "该计划尚未派发,无法辨识"); |
| | | } |
| | | if (assessPlanById.getPlanExecStatus() != 2){ |
| | | if (assessPlanById.getPlanExecStatus() != 2) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "该计划不处在辨识阶段,无法辨识"); |
| | | } |
| | | if (date.isAfter(assessPlanById.getAssessEndTime())){ |
| | | if (date.isAfter(assessPlanById.getAssessEndTime())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "风险辨识必须在评估结束时间之前"); |
| | | } |
| | | if (date.isBefore(assessPlanById.getAssessStartTime())){ |
| | | if (date.isBefore(assessPlanById.getAssessStartTime())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "未到辨识时间"); |
| | | } |
| | | if (!assessPlanById.getIdentificationUserId().equals(userInfoById.getId())){ |
| | | List<RiskAssessPlanIdentificationUser> assessPlanIdentificationUser = |
| | | planIdentificationUserService.getAssessPlanIdentificationUserPlanId(assessPlanById.getId(), userInfoById.getId()); |
| | | |
| | | if (ObjectUtils.isEmpty(assessPlanIdentificationUser)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "您不是辨识人,无法进行辨识"); |
| | | } |
| | | |
| | |
| | | @Override |
| | | public AssessPlanUpdateDTO identificationSubmit(Long currentUserId, Long id) { |
| | | |
| | | if (currentUserId < 0){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无效,请重新登陆"); |
| | | if (currentUserId < 0) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户无效,请重新登陆"); |
| | | } |
| | | UserInfoDomainDTO userInfoById = userDomainService.getUserInfoById(currentUserId); |
| | | if (ObjectUtils.isEmpty(userInfoById)){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户不存在或已被删除"); |
| | | if (ObjectUtils.isEmpty(userInfoById)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户不存在或已被删除"); |
| | | } |
| | | if (ObjectUtils.isEmpty(id)){ |
| | | if (ObjectUtils.isEmpty(id)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "所选辨识不能为空"); |
| | | } |
| | | RiskAssessPlan assessPlanById = assessPlanRepository.getAssessPlanById(id); |
| | | if (ObjectUtils.isEmpty(assessPlanById)){ |
| | | if (ObjectUtils.isEmpty(assessPlanById)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "所选辨识为空或已被删除"); |
| | | } |
| | | if (assessPlanById.getPlanExecStatus() < StatusEnum.PLAN_EXEC_IDENTIFICATION.getCode().byteValue()){ |
| | | if (assessPlanById.getPlanExecStatus() < StatusEnum.PLAN_EXEC_IDENTIFICATION.getCode().byteValue()) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "不在辨识阶段,无法提交"); |
| | | }else if (assessPlanById.getPlanExecStatus() > StatusEnum.PLAN_EXEC_IDENTIFICATION.getCode().byteValue()){ |
| | | } else if (assessPlanById.getPlanExecStatus() > StatusEnum.PLAN_EXEC_IDENTIFICATION.getCode().byteValue()) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "辨识已完成,无需重复提交"); |
| | | } |
| | | if (!assessPlanById.getIdentificationUserId().equals(userInfoById.getId())){ |
| | | List<RiskAssessPlanIdentificationUser> assessPlanIdentificationUser = |
| | | planIdentificationUserService.getAssessPlanIdentificationUserPlanId(assessPlanById.getId(), userInfoById.getId()); |
| | | |
| | | if (ObjectUtils.isEmpty(assessPlanIdentificationUser)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "您不是辨识人,无法进行辨识结果提交"); |
| | | } |
| | | // 没有进行任何辨识,无法提交 |
| | | if (assessPlanById.getIdentificationMethod() == 1){ |
| | | if (assessPlanById.getIdentificationMethod() == 1) { |
| | | List<PhaQueryDTO> phaQueryDTOS = phaService.listPhaByPlanId(assessPlanById.getId()); |
| | | if (phaQueryDTOS.size() < 1){ |
| | | if (phaQueryDTOS.size() < 1) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "您未做任何辨识,无法提交"); |
| | | } |
| | | //辨识方法 2-JHA; |
| | | }else if (assessPlanById.getIdentificationMethod() == 2){ |
| | | } else if (assessPlanById.getIdentificationMethod() == 2) { |
| | | List<JhaQueryDTO> jhaQueryDTOS = jhaService.listJhaByPlanId(assessPlanById.getId()); |
| | | if (jhaQueryDTOS.size() < 1){ |
| | | if (jhaQueryDTOS.size() < 1) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "您未做任何辨识,无法提交"); |
| | | } |
| | | //辨识方法 3-SCL; |
| | | }else if (assessPlanById.getIdentificationMethod() == 3){ |
| | | } else if (assessPlanById.getIdentificationMethod() == 3) { |
| | | List<SclQueryDTO> sclQueryDTOS = sclService.listSclByPlanId(assessPlanById.getId()); |
| | | if (sclQueryDTOS.size() < 1){ |
| | | if (sclQueryDTOS.size() < 1) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "您未做任何辨识,无法提交"); |
| | | } |
| | | //辨识方法 4-HAZOP; |
| | | }else if (assessPlanById.getIdentificationMethod() == 4){ |
| | | } else if (assessPlanById.getIdentificationMethod() == 4) { |
| | | List<HazopQueryDTO> hazopQueryDTOS = hazopService.listHazopByPlanId(assessPlanById.getId()); |
| | | if (hazopQueryDTOS.size() < 1){ |
| | | if (hazopQueryDTOS.size() < 1) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "您未做任何辨识,无法提交"); |
| | | } |
| | | //5-类比法 analogy; |
| | | }else if (assessPlanById.getIdentificationMethod() == 5){ |
| | | } else if (assessPlanById.getIdentificationMethod() == 5) { |
| | | List<AnalogyQueryDTO> analogyQueryDTOS = analogyService.listAnalogyByPlanId(assessPlanById.getId()); |
| | | if (analogyQueryDTOS.size() < 1){ |
| | | if (analogyQueryDTOS.size() < 1) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "您未做任何辨识,无法提交"); |
| | | } |
| | | }else { |
| | | } else { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode(), "辨识方法参数错误"); |
| | | } |
| | | |
| | |
| | | @Override |
| | | public AssessPlanEvaluateDTO evaluate(Long currentUserId, RiskAssessPlanAppEvaluateBO evaluateParam) { |
| | | |
| | | if (currentUserId < 0){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无效,请重新登陆"); |
| | | if (currentUserId < 0) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户无效,请重新登陆"); |
| | | } |
| | | UserInfoDomainDTO userInfoById = userDomainService.getUserInfoById(currentUserId); |
| | | if (ObjectUtils.isEmpty(userInfoById)){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户不存在或已被删除"); |
| | | if (ObjectUtils.isEmpty(userInfoById)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户不存在或已被删除"); |
| | | } |
| | | LocalDateTime date = LocalDateTime.now(); |
| | | |
| | | if (ObjectUtils.isEmpty(evaluateParam)){ |
| | | if (ObjectUtils.isEmpty(evaluateParam)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评价的内容不能为空"); |
| | | } |
| | | if (ObjectUtils.isEmpty(evaluateParam.getRiskValue())){ |
| | | if (ObjectUtils.isEmpty(evaluateParam.getRiskValue())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "风险数值不能为空"); |
| | | } |
| | | if (ObjectUtils.isEmpty(evaluateParam.getRiskLevelValue())){ |
| | | if (ObjectUtils.isEmpty(evaluateParam.getRiskLevelValue())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "风险等级值不能为空"); |
| | | } |
| | | if (ObjectUtils.isEmpty(evaluateParam.getRiskLevel())){ |
| | | if (ObjectUtils.isEmpty(evaluateParam.getRiskLevel())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "风险级别不能为空"); |
| | | } |
| | | if (ObjectUtils.isEmpty(evaluateParam.getRiskColor())){ |
| | | if (ObjectUtils.isEmpty(evaluateParam.getRiskColor())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "风险色不能为空"); |
| | | } |
| | | if (ObjectUtils.isEmpty(evaluateParam.getManageLevel())){ |
| | | if (ObjectUtils.isEmpty(evaluateParam.getManageLevel())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "管理层级不能为空"); |
| | | } |
| | | |
| | | RiskAssessPlan assessPlanById = assessPlanRepository.getAssessPlanById(evaluateParam.getId()); |
| | | if (ObjectUtils.isEmpty(assessPlanById)){ |
| | | if (ObjectUtils.isEmpty(assessPlanById)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "要评价的计划不存在或已被删除"); |
| | | } |
| | | if (assessPlanById.getPlanSellStatus() == 1){ |
| | | if (assessPlanById.getPlanSellStatus() == 1) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "该计划尚未派发,无法辨识"); |
| | | } |
| | | if (assessPlanById.getPlanExecStatus() != 3){ |
| | | if (assessPlanById.getPlanExecStatus() != 3) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "该计划不处待评价阶段,无法评价"); |
| | | } |
| | | if (assessPlanById.getAssessEndTime().isBefore(date)){ |
| | | if (assessPlanById.getAssessEndTime().isBefore(date)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "风险评价必须在评估结束时间之前"); |
| | | } |
| | | if (!assessPlanById.getEvaluateUserId().equals(userInfoById.getId())){ |
| | | List<RiskAssessPlanEvaluateUser> assessPlanEvaluateUserPlanId = evaluateUserService.getAssessPlanEvaluateUserPlanId(assessPlanById.getId(), userInfoById.getId()); |
| | | if (ObjectUtils.isEmpty(assessPlanEvaluateUserPlanId)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "您不是评价人,无法进行评价"); |
| | | } |
| | | //设置必要参数 |
| | |
| | | @Override |
| | | public AssessPlanEvaluateDTO evaluateUpdate(Long currentUserId, RiskAssessPlanAppEvaluateBO evaluateParam) { |
| | | |
| | | if (currentUserId < 0){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无效,请重新登陆"); |
| | | if (currentUserId < 0) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户无效,请重新登陆"); |
| | | } |
| | | UserInfoDomainDTO userInfoById = userDomainService.getUserInfoById(currentUserId); |
| | | if (ObjectUtils.isEmpty(userInfoById)){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户不存在或已被删除"); |
| | | if (ObjectUtils.isEmpty(userInfoById)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户不存在或已被删除"); |
| | | } |
| | | LocalDateTime date = LocalDateTime.now(); |
| | | |
| | | if (ObjectUtils.isEmpty(evaluateParam)){ |
| | | if (ObjectUtils.isEmpty(evaluateParam)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评价的内容不能为空"); |
| | | } |
| | | if (ObjectUtils.isEmpty(evaluateParam.getRiskValue())){ |
| | | if (ObjectUtils.isEmpty(evaluateParam.getRiskValue())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "风险数值不能为空"); |
| | | } |
| | | if (ObjectUtils.isEmpty(evaluateParam.getRiskLevelValue())){ |
| | | if (ObjectUtils.isEmpty(evaluateParam.getRiskLevelValue())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "风险等级值不能为空"); |
| | | } |
| | | if (ObjectUtils.isEmpty(evaluateParam.getRiskLevel())){ |
| | | if (ObjectUtils.isEmpty(evaluateParam.getRiskLevel())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "风险级别不能为空"); |
| | | } |
| | | if (ObjectUtils.isEmpty(evaluateParam.getRiskColor())){ |
| | | if (ObjectUtils.isEmpty(evaluateParam.getRiskColor())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "风险色不能为空"); |
| | | } |
| | | if (ObjectUtils.isEmpty(evaluateParam.getManageLevel())){ |
| | | if (ObjectUtils.isEmpty(evaluateParam.getManageLevel())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "管理层级不能为空"); |
| | | } |
| | | |
| | | RiskAssessPlan assessPlanById = assessPlanRepository.getAssessPlanById(evaluateParam.getId()); |
| | | if (ObjectUtils.isEmpty(assessPlanById)){ |
| | | if (ObjectUtils.isEmpty(assessPlanById)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "要评价的计划不存在或已被删除"); |
| | | } |
| | | if (assessPlanById.getPlanSellStatus() == 1){ |
| | | if (assessPlanById.getPlanSellStatus() == 1) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "该计划尚未派发,无法辨识"); |
| | | } |
| | | if (assessPlanById.getPlanExecStatus() != 3){ |
| | | if (assessPlanById.getPlanExecStatus() != 3) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "该计划不处待评价阶段,无法评价"); |
| | | } |
| | | if (assessPlanById.getAssessEndTime().isBefore(date)){ |
| | | if (assessPlanById.getAssessEndTime().isBefore(date)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "风险评价必须在评估结束时间之前"); |
| | | } |
| | | if (!assessPlanById.getEvaluateUserId().equals(userInfoById.getId())){ |
| | | List<RiskAssessPlanEvaluateUser> assessPlanEvaluateUserPlanId = evaluateUserService.getAssessPlanEvaluateUserPlanId(assessPlanById.getId(), userInfoById.getId()); |
| | | if (ObjectUtils.isEmpty(assessPlanEvaluateUserPlanId)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "您不是评价人,无法进行评价"); |
| | | } |
| | | //设置必要参数 |
| | |
| | | @Override |
| | | public AssessPlanUpdateDTO evaluateSubmit(Long currentUserId, Long id) { |
| | | |
| | | if (currentUserId < 0){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无效,请重新登陆"); |
| | | if (currentUserId < 0) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户无效,请重新登陆"); |
| | | } |
| | | UserInfoDomainDTO userInfoById = userDomainService.getUserInfoById(currentUserId); |
| | | if (ObjectUtils.isEmpty(userInfoById)){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户不存在或已被删除"); |
| | | if (ObjectUtils.isEmpty(userInfoById)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户不存在或已被删除"); |
| | | } |
| | | if (ObjectUtils.isEmpty(id)){ |
| | | if (ObjectUtils.isEmpty(id)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "所选评价不能为空"); |
| | | } |
| | | RiskAssessPlan assessPlanById = assessPlanRepository.getAssessPlanById(id); |
| | | if (ObjectUtils.isEmpty(assessPlanById)){ |
| | | if (ObjectUtils.isEmpty(assessPlanById)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "所选评价为空或已被删除"); |
| | | } |
| | | if (assessPlanById.getPlanExecStatus() < StatusEnum.PLAN_EXEC_EVALUATE.getCode().byteValue()){ |
| | | if (assessPlanById.getPlanExecStatus() < StatusEnum.PLAN_EXEC_EVALUATE.getCode().byteValue()) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "不在评价阶段,无法提交"); |
| | | }else if (assessPlanById.getPlanExecStatus() > StatusEnum.PLAN_EXEC_EVALUATE.getCode().byteValue()){ |
| | | } else if (assessPlanById.getPlanExecStatus() > StatusEnum.PLAN_EXEC_EVALUATE.getCode().byteValue()) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评价已完成,无需重复提交"); |
| | | } |
| | | if (!assessPlanById.getEvaluateUserId().equals(userInfoById.getId())){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "您不是评价人,无法进行评价结果提交"); |
| | | List<RiskAssessPlanEvaluateUser> assessPlanEvaluateUserPlanId = evaluateUserService.getAssessPlanEvaluateUserPlanId(assessPlanById.getId(), userInfoById.getId()); |
| | | if (ObjectUtils.isEmpty(assessPlanEvaluateUserPlanId)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "您不是评价人,无法进行评价"); |
| | | } |
| | | // ExecStatusSubmitBO execStatusSubmitBO = new ExecStatusSubmitBO(); |
| | | // execStatusSubmitBO.setId(id); |
| | |
| | | assessPlanById.setPlanExecStatus(StatusEnum.PLAN_EXEC_OVER.getCode().byteValue()); |
| | | assessPlanById.setEvaluateTime(LocalDateTime.now()); |
| | | //修改风险单元评价状态 |
| | | RiskUnit riskUnit = riskUnitService.updateRiskUnitStatus(assessPlanById.getRiskUnitId(),StatusEnum.EVALUATE.getCode()); |
| | | if (ObjectUtils.isEmpty(riskUnit)){ |
| | | RiskUnit riskUnit = riskUnitService.updateRiskUnitStatus(assessPlanById.getRiskUnitId(), StatusEnum.EVALUATE.getCode()); |
| | | if (ObjectUtils.isEmpty(riskUnit)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "修改风险单元状态失败"); |
| | | } |
| | | |
| | | // 1-检查该计划的所有辨识项,是否全部完成评价,否则无法提交 |
| | | int result = EvaluateCheckUtils.evaluateCheckUtils(assessPlanById); |
| | | if (result == 1){ |
| | | if (result == 1) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "有辨识项未评价,无法提交"); |
| | | } |
| | | |
| | |
| | | int tag = 0; |
| | | for (RiskAssessPlan riskAssessPlan : assessPlanByExperimentId) { |
| | | // todo - 之前检查使用评价计划的status,存在编写完但未提交的计划。 先加上评估计划执行状态判断。 --- 需要测试是否能避免问题 |
| | | if (assessPlanById.getPlanExecStatus() != StatusEnum.PLAN_EXEC_OVER.getCode().byteValue()){ |
| | | if (assessPlanById.getPlanExecStatus() != StatusEnum.PLAN_EXEC_OVER.getCode().byteValue()) { |
| | | tag = 1; |
| | | } |
| | | if (assessPlanById.getEvaluateMethod() == 1){ |
| | | if (assessPlanById.getEvaluateMethod() == 1) { |
| | | List<LecQueryDTO> lecQueryDTOS = lecService.listLecByPlanId(riskAssessPlan.getId()); |
| | | for (LecQueryDTO lec : lecQueryDTOS) { |
| | | if (lec.getStatus() != 1){ |
| | | if (lec.getStatus() != 1) { |
| | | tag = 1; |
| | | } |
| | | } |
| | | //辨识方法2 - LS |
| | | }else if (assessPlanById.getEvaluateMethod() == 2){ |
| | | } else if (assessPlanById.getEvaluateMethod() == 2) { |
| | | List<LsQueryDTO> lsQueryDTOS = lsService.listLsByPlanId(riskAssessPlan.getId()); |
| | | for (LsQueryDTO ls : lsQueryDTOS) { |
| | | if (ls.getStatus() != 1){ |
| | | if (ls.getStatus() != 1) { |
| | | tag = 1; |
| | | } |
| | | } |
| | | //辨识方法3 - MES |
| | | }else if (assessPlanById.getEvaluateMethod() == 3){ |
| | | } else if (assessPlanById.getEvaluateMethod() == 3) { |
| | | List<MesQueryDTO> mesQueryDTOS = mesService.listMesByPlanId(riskAssessPlan.getId()); |
| | | for (MesQueryDTO mes : mesQueryDTOS) { |
| | | if (mes.getStatus() != 1){ |
| | | if (mes.getStatus() != 1) { |
| | | tag = 1; |
| | | } |
| | | } |
| | | //辨识方法4 - RS |
| | | }else if (assessPlanById.getEvaluateMethod() == 4){ |
| | | } else if (assessPlanById.getEvaluateMethod() == 4) { |
| | | List<RsQueryDTO> rsQueryDTOS = rsService.listRsByPlanId(riskAssessPlan.getId()); |
| | | for (RsQueryDTO rs : rsQueryDTOS) { |
| | | if (rs.getStatus() != 1){ |
| | | if (rs.getStatus() != 1) { |
| | | tag = 1; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //所有评估计划完成,设置实验为评估完成状态。 |
| | | if (tag == 0){ |
| | | if (tag == 0) { |
| | | //修改实验 为 评估完成 |
| | | ExperimentInfoDTO experimentInfoDTO = experimentInfoService.updateExperimentStage(assessPlanById.getExperimentId(), StatusEnum.EXPERIMENT_STATUS_FINISH.getCode().byteValue()); |
| | | if (ObjectUtils.isEmpty(experimentInfoDTO)){ |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode() ,"实验状态修改失败"); |
| | | if (ObjectUtils.isEmpty(experimentInfoDTO)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode(), "实验状态修改失败"); |
| | | } |
| | | } |
| | | |
| | |
| | | public SearchResult<RiskAssessAppQueryDTO> selectAssessPage(Long currentUserId, RiskAssessAppQueryBO queryBO) { |
| | | |
| | | //校验参数 |
| | | if (ObjectUtils.isEmpty(queryBO.getPageSize())){ |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode() ,"分页信息不能为空"); |
| | | if (ObjectUtils.isEmpty(queryBO.getPageSize())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode(), "分页信息不能为空"); |
| | | } |
| | | if (ObjectUtils.isEmpty(queryBO.getPageIndex())){ |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode() ,"分页信息不能为空"); |
| | | if (ObjectUtils.isEmpty(queryBO.getPageIndex())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode(), "分页信息不能为空"); |
| | | } |
| | | // 检查是否是实验管理者 |
| | | UserInfoDomainDTO userInfo = userDomainService.getUserById(currentUserId); |
| | | if (ObjectUtils.isEmpty(userInfo)){ |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode() ,"用户不存在"); |
| | | if (ObjectUtils.isEmpty(userInfo)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode(), "用户不存在"); |
| | | } |
| | | if (queryBO.getAssessPlanName() == "null"){ |
| | | if (queryBO.getAssessPlanName() == "null") { |
| | | queryBO.setAssessPlanName(null); |
| | | } |
| | | if (queryBO.getExperimentName() == "null"){ |
| | | if (queryBO.getExperimentName() == "null") { |
| | | queryBO.setExperimentName(null); |
| | | } |
| | | |
| | | AssessQueryBO queryParam = BeanCopyUtils.copyBean(queryBO, AssessQueryBO.class); |
| | | if (!ObjectUtils.isEmpty(queryBO.getExperimentName())){ |
| | | if (!ObjectUtils.isEmpty(queryBO.getExperimentName())) { |
| | | ExperimentInfoDTO experimentByName = experimentInfoService.getExperimentByName(queryBO.getExperimentName()); |
| | | if (ObjectUtils.isEmpty(experimentByName)){ |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode() ,"分页信息不能为空"); |
| | | if (ObjectUtils.isEmpty(experimentByName)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode(), "分页信息不能为空"); |
| | | } |
| | | queryParam.setExperimentId(experimentByName.getId()); |
| | | } |
| | | // 拿到所有的固有风险单元 ,遍历 |
| | | List<Long> planIds = new ArrayList<>(); |
| | | List<RiskUnit> riskUnits = riskUnitService.listInherentRiskUnit(); |
| | | if (ObjectUtils.isEmpty(riskUnits)){ |
| | | if (ObjectUtils.isEmpty(riskUnits)) { |
| | | for (RiskUnit riskUnit : riskUnits) { |
| | | // 拿到所有固有风险的评估计划 |
| | | List<RiskAssessPlan> assessPlanByInherentUnit = assessPlanRepository.getAssessPlanByInherentUnit(riskUnit.getBasicRiskUnitId()); |
| | | if (assessPlanByInherentUnit.size() > 0){ |
| | | if (assessPlanByInherentUnit.size() > 0) { |
| | | // 遍历固有风险评估计划,如果当前用户属于对应实验的负责人,新增,修改人 |
| | | for (RiskAssessPlan inherentRiskAssessPlan : assessPlanByInherentUnit) { |
| | | if (riskUnit.getExperimentId().equals(currentUserId) || riskUnit.getCreateByUserId().equals(currentUserId) || riskUnit.getUpdateByUserId().equals(currentUserId)){ |
| | | if (riskUnit.getExperimentId().equals(currentUserId) || riskUnit.getCreateByUserId().equals(currentUserId) || riskUnit.getUpdateByUserId().equals(currentUserId)) { |
| | | planIds.add(inherentRiskAssessPlan.getId()); |
| | | } |
| | | } |
| | |
| | | List<ExperimentInfoDTO> experimentByList = experimentInfoService.getExperimentByUser(currentUserId); |
| | | List<Long> experimentIdList = new ArrayList<>(); |
| | | experimentIdList.add(0L); |
| | | if (!ObjectUtils.isEmpty(experimentByList)){ |
| | | if (!ObjectUtils.isEmpty(experimentByList)) { |
| | | for (ExperimentInfoDTO experimentInfo : experimentByList) { |
| | | experimentIdList.add(experimentInfo.getId()); |
| | | } |
| | |
| | | @Override |
| | | public Predicate toPredicate(Root<RiskAssessPlan> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder) { |
| | | List<Predicate> predicateList = new ArrayList<>(); |
| | | if (queryParam.getAssessPlanName() != null && !queryParam.getAssessPlanName().equals("")){ |
| | | predicateList.add(criteriaBuilder.like(root.get("assessPlanName"),"%"+queryParam.getAssessPlanName()+"%")); |
| | | if (queryParam.getAssessPlanName() != null && !queryParam.getAssessPlanName().equals("")) { |
| | | predicateList.add(criteriaBuilder.like(root.get("assessPlanName"), "%" + queryParam.getAssessPlanName() + "%")); |
| | | } |
| | | if (queryParam.getExperimentId() != null && !queryParam.getExperimentId().equals("")){ |
| | | if (queryParam.getExperimentId() != null && !queryParam.getExperimentId().equals("")) { |
| | | predicateList.add(criteriaBuilder.equal(root.get("experimentId"), queryParam.getExperimentId())); |
| | | } |
| | | if (queryParam.getAssessPlanId() != null && !queryParam.getAssessPlanId().equals("")){ |
| | | if (queryParam.getAssessPlanId() != null && !queryParam.getAssessPlanId().equals("")) { |
| | | predicateList.add(criteriaBuilder.equal(root.get("id"), queryParam.getAssessPlanId())); |
| | | } |
| | | if (!ObjectUtils.isEmpty(queryParam.getPlanExecStatus())){ |
| | | if (queryParam.getPlanExecStatus() == 5){ |
| | | if (!ObjectUtils.isEmpty(queryParam.getPlanExecStatus())) { |
| | | if (queryParam.getPlanExecStatus() == 5) { |
| | | predicateList.add(criteriaBuilder.ge(root.get("planExecStatus"), 3)); |
| | | }else { |
| | | } else { |
| | | predicateList.add(criteriaBuilder.equal(root.get("planExecStatus"), queryParam.getPlanExecStatus())); |
| | | } |
| | | } |
| | | if (queryParam.getTag() == 2){ |
| | | if (queryParam.getTag() == 2) { |
| | | predicateList.add(criteriaBuilder.isNotNull(root.get("identificationTime"))); |
| | | } |
| | | if (queryParam.getTag() == 3){ |
| | | if (queryParam.getTag() == 3) { |
| | | predicateList.add(criteriaBuilder.isNotNull(root.get("evaluateTime"))); |
| | | } |
| | | if (planIds.size() > 0){ |
| | | if (planIds.size() > 0) { |
| | | predicateList.add(criteriaBuilder.in(root.get("id")).value(planIds)); |
| | | } |
| | | |
| | | if (roleTag == UserTagEnum.USER_TAG_0.getCode()){ |
| | | Join<RiskAssessPlan, RiskAssessPlanIdentificationUser> identificationUserJoin = root.join("riskAssessPlanIdentificationUsers", JoinType.LEFT); |
| | | Join<RiskAssessPlan, RiskAssessPlanEvaluateUser> evaluateUserJoin = root.join("riskAssessPlanEvaluateUsers", JoinType.LEFT); |
| | | |
| | | if (roleTag == UserTagEnum.USER_TAG_0.getCode()) { |
| | | //此处应有谁能查询:辨识专家,评价专家,实验负责人(此处未存相关信息,以实验id为条件查询) |
| | | predicateList.add(criteriaBuilder.or( |
| | | criteriaBuilder.equal(root.get("identificationUserId"), currentUserId), |
| | | criteriaBuilder.equal(root.get("evaluateUserId"), currentUserId), |
| | | criteriaBuilder.equal(identificationUserJoin.get("identificationUserId"), currentUserId), |
| | | criteriaBuilder.equal(evaluateUserJoin.get("evaluateUserId"), currentUserId), |
| | | criteriaBuilder.in(root.get("experimentId")).value(experimentIdList) |
| | | ) |
| | | ); |
| | | // predicateList.add(criteriaBuilder.or( |
| | | // criteriaBuilder.equal(root.get("identificationUserId"), currentUserId), |
| | | // criteriaBuilder.equal(root.get("evaluateUserId"), currentUserId), |
| | | // criteriaBuilder.in(root.get("experimentId")).value(experimentIdList) |
| | | // ) |
| | | // ); |
| | | } |
| | | predicateList.add(criteriaBuilder.equal(root.get("deleteStatus"),StatusEnum.DELETE_NOT.getCode())); |
| | | query.groupBy(root.get("id")); |
| | | predicateList.add(criteriaBuilder.equal(root.get("deleteStatus"), StatusEnum.DELETE_NOT.getCode())); |
| | | return criteriaBuilder.and(predicateList.toArray(new Predicate[0])); |
| | | } |
| | | }; |
| | |
| | | // } |
| | | // } |
| | | |
| | | if (pageResult.getContent().size() > 0){ |
| | | if (pageResult.getContent().size() > 0) { |
| | | for (RiskAssessPlan riskAssessPlan : pageResult.getContent()) { |
| | | |
| | | AssessQueryDTO assessQueryDTO = BeanCopyUtils.copyBean(riskAssessPlan, AssessQueryDTO.class); |
| | | for (RiskUnitListAppQueryDTO riskUnit : riskUnitListAppQueryDTOS) { |
| | | if (riskUnit.getId() == assessQueryDTO.getRiskUnitId()){ |
| | | if (riskUnit.getId() == assessQueryDTO.getRiskUnitId()) { |
| | | assessQueryDTO.setRiskUnitName(riskUnit.getRiskName()); |
| | | } |
| | | } |
| | | List<RiskAssessPlanIdentificationUser> riskAssessPlanIdentificationUsers = riskAssessPlan.getRiskAssessPlanIdentificationUsers(); |
| | | if (!ObjectUtils.isEmpty(riskAssessPlanIdentificationUsers)) { |
| | | String identificationUsersString = riskAssessPlanIdentificationUsers.stream() |
| | | .map(RiskAssessPlanIdentificationUser::getIdentificationUser) |
| | | .collect(Collectors.joining(",")); |
| | | assessQueryDTO.setIdentificationUser(identificationUsersString); |
| | | List<UserIdentityRespDTO> userIdentityRespDTOS = BeanCopyUtils.copyBeanList(riskAssessPlanIdentificationUsers, UserIdentityRespDTO.class); |
| | | assessQueryDTO.setIdentityUsers(userIdentityRespDTOS); |
| | | |
| | | } |
| | | |
| | | List<RiskAssessPlanEvaluateUser> riskAssessPlanEvaluateUsers = riskAssessPlan.getRiskAssessPlanEvaluateUsers(); |
| | | if (!ObjectUtils.isEmpty(riskAssessPlanEvaluateUsers)) { |
| | | String identificationUsersString = riskAssessPlanEvaluateUsers.stream() |
| | | .map(RiskAssessPlanEvaluateUser::getEvaluateUser) |
| | | .collect(Collectors.joining(",")); |
| | | assessQueryDTO.setEvaluateUser(identificationUsersString); |
| | | List<UserEvaluateRespDTO> userEvaluateRespDTOS = BeanCopyUtils.copyBeanList(riskAssessPlanEvaluateUsers, UserEvaluateRespDTO.class); |
| | | assessQueryDTO.setEvaluateUsers(userEvaluateRespDTOS); |
| | | } |
| | | List<FactorQueryDTO> factorQueryDTOList = new ArrayList<>(); |
| | | List<PhaQueryDTO> phaList = new ArrayList<>(); |
| | |
| | | List<AnalogyQueryDTO> analogyList = new ArrayList<>(); |
| | | |
| | | //辨识方法 1-PHA; |
| | | if (assessQueryDTO.getIdentificationMethod() == 1){ |
| | | if (assessQueryDTO.getIdentificationMethod() == 1) { |
| | | phaList = phaService.listPhaByPlanId(riskAssessPlan.getId()); |
| | | //辨识方法 2-JHA; |
| | | }else if (assessQueryDTO.getIdentificationMethod() == 2){ |
| | | } else if (assessQueryDTO.getIdentificationMethod() == 2) { |
| | | jhaList = jhaService.listJhaByPlanId(riskAssessPlan.getId()); |
| | | //辨识方法 3-SCL; |
| | | }else if (assessQueryDTO.getIdentificationMethod() == 3){ |
| | | } else if (assessQueryDTO.getIdentificationMethod() == 3) { |
| | | sclList = sclService.listSclByPlanId(riskAssessPlan.getId()); |
| | | //辨识方法 4-HAZOP; |
| | | }else if (assessQueryDTO.getIdentificationMethod() == 4){ |
| | | } else if (assessQueryDTO.getIdentificationMethod() == 4) { |
| | | hazopList = hazopService.listHazopByPlanId(riskAssessPlan.getId()); |
| | | //5-类比法 analogy; |
| | | }else if (assessQueryDTO.getIdentificationMethod() == 5){ |
| | | } else if (assessQueryDTO.getIdentificationMethod() == 5) { |
| | | analogyList = analogyService.listAnalogyByPlanId(riskAssessPlan.getId()); |
| | | }else { |
| | | } else { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode(), "辨识方法参数错误"); |
| | | } |
| | | |
| | | //评价方法1 - LEC |
| | | if (assessQueryDTO.getEvaluateMethod() == 1){ |
| | | if (assessQueryDTO.getEvaluateMethod() == 1) { |
| | | List<LecQueryDTO> lecList = lecService.listLecByPlanId(riskAssessPlan.getId()); |
| | | if (assessQueryDTO.getIdentificationMethod() == 1){ |
| | | if (assessQueryDTO.getIdentificationMethod() == 1) { |
| | | for (PhaQueryDTO pha : phaList) { |
| | | FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(pha, FactorQueryDTO.class); |
| | | factorQueryDTO.setId(riskAssessPlan.getId()); |
| | |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | | factorQueryDTO.setItemIdentificationTime(pha.getUpdateTime()); |
| | | for (LecQueryDTO lec : lecList) { |
| | | if (lec.getIdentificationId() == pha.getId()){ |
| | | if (lec.getIdentificationId() == pha.getId()) { |
| | | EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils(); |
| | | factorQueryDTO = evaluateAndIdentificationUtils.lecMatchPha(pha, lec); |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | |
| | | } |
| | | } |
| | | for (UserInfoDomainDTO user : userList) { |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()) { |
| | | assessQueryDTO.setCreateByUserName(user.getRealName()); |
| | | } |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()) { |
| | | assessQueryDTO.setUpdateByUserName(user.getRealName()); |
| | | } |
| | | } |
| | | factorQueryDTOList.add(factorQueryDTO); |
| | | } |
| | | }else if (assessQueryDTO.getIdentificationMethod() == 2){ |
| | | } else if (assessQueryDTO.getIdentificationMethod() == 2) { |
| | | for (JhaQueryDTO jha : jhaList) { |
| | | FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(jha, FactorQueryDTO.class); |
| | | factorQueryDTO.setId(riskAssessPlan.getId()); |
| | |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | | factorQueryDTO.setItemIdentificationTime(jha.getUpdateTime()); |
| | | for (LecQueryDTO lec : lecList) { |
| | | if (lec.getIdentificationId() == jha.getId()){ |
| | | if (lec.getIdentificationId() == jha.getId()) { |
| | | EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils(); |
| | | factorQueryDTO = evaluateAndIdentificationUtils.lecMatchJha(jha, lec); |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | |
| | | } |
| | | } |
| | | for (UserInfoDomainDTO user : userList) { |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()) { |
| | | assessQueryDTO.setCreateByUserName(user.getRealName()); |
| | | } |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()) { |
| | | assessQueryDTO.setUpdateByUserName(user.getRealName()); |
| | | } |
| | | } |
| | | factorQueryDTOList.add(factorQueryDTO); |
| | | } |
| | | }else if (assessQueryDTO.getIdentificationMethod() == 3){ |
| | | } else if (assessQueryDTO.getIdentificationMethod() == 3) { |
| | | for (SclQueryDTO scl : sclList) { |
| | | FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(scl, FactorQueryDTO.class); |
| | | factorQueryDTO.setId(riskAssessPlan.getId()); |
| | |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | | factorQueryDTO.setItemIdentificationTime(scl.getUpdateTime()); |
| | | for (LecQueryDTO lec : lecList) { |
| | | if (lec.getIdentificationId() == scl.getId()){ |
| | | if (lec.getIdentificationId() == scl.getId()) { |
| | | EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils(); |
| | | factorQueryDTO = evaluateAndIdentificationUtils.lecMatchScl(scl, lec); |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | |
| | | } |
| | | } |
| | | for (UserInfoDomainDTO user : userList) { |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()) { |
| | | assessQueryDTO.setCreateByUserName(user.getRealName()); |
| | | } |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()) { |
| | | assessQueryDTO.setUpdateByUserName(user.getRealName()); |
| | | } |
| | | } |
| | | factorQueryDTOList.add(factorQueryDTO); |
| | | } |
| | | }else if (assessQueryDTO.getIdentificationMethod() == 4){ |
| | | } else if (assessQueryDTO.getIdentificationMethod() == 4) { |
| | | for (HazopQueryDTO hazop : hazopList) { |
| | | FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(hazop, FactorQueryDTO.class); |
| | | factorQueryDTO.setId(riskAssessPlan.getId()); |
| | |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | | factorQueryDTO.setItemIdentificationTime(hazop.getUpdateTime()); |
| | | for (LecQueryDTO lec : lecList) { |
| | | if (lec.getIdentificationId() == hazop.getId()){ |
| | | if (lec.getIdentificationId() == hazop.getId()) { |
| | | EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils(); |
| | | factorQueryDTO = evaluateAndIdentificationUtils.lecMatchHazop(hazop, lec); |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | | } |
| | | for (UserInfoDomainDTO user : userList) { |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()) { |
| | | assessQueryDTO.setCreateByUserName(user.getRealName()); |
| | | } |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()) { |
| | | assessQueryDTO.setUpdateByUserName(user.getRealName()); |
| | | } |
| | | } |
| | | factorQueryDTOList.add(factorQueryDTO); |
| | | } |
| | | } |
| | | }else if (assessQueryDTO.getIdentificationMethod() == 5){ |
| | | } else if (assessQueryDTO.getIdentificationMethod() == 5) { |
| | | for (AnalogyQueryDTO analogy : analogyList) { |
| | | FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(analogy, FactorQueryDTO.class); |
| | | factorQueryDTO.setId(riskAssessPlan.getId()); |
| | |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | | factorQueryDTO.setItemIdentificationTime(analogy.getUpdateTime()); |
| | | for (LecQueryDTO lec : lecList) { |
| | | if (lec.getIdentificationId() == analogy.getId()){ |
| | | if (lec.getIdentificationId() == analogy.getId()) { |
| | | EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils(); |
| | | factorQueryDTO = evaluateAndIdentificationUtils.lecMatchAnalogy(analogy, lec); |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | |
| | | } |
| | | } |
| | | for (UserInfoDomainDTO user : userList) { |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()) { |
| | | assessQueryDTO.setCreateByUserName(user.getRealName()); |
| | | } |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()) { |
| | | assessQueryDTO.setUpdateByUserName(user.getRealName()); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | //评价方法2 - LS |
| | | }else if (assessQueryDTO.getEvaluateMethod() == 2){ |
| | | } else if (assessQueryDTO.getEvaluateMethod() == 2) { |
| | | List<LsQueryDTO> lsList = lsService.listLsByPlanId(riskAssessPlan.getId()); |
| | | if (assessQueryDTO.getIdentificationMethod() == 1){ |
| | | if (assessQueryDTO.getIdentificationMethod() == 1) { |
| | | for (PhaQueryDTO pha : phaList) { |
| | | FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(pha, FactorQueryDTO.class); |
| | | factorQueryDTO.setId(riskAssessPlan.getId()); |
| | |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | | factorQueryDTO.setItemIdentificationTime(pha.getUpdateTime()); |
| | | for (LsQueryDTO ls : lsList) { |
| | | if (ls.getIdentificationId() == pha.getId()){ |
| | | if (ls.getIdentificationId() == pha.getId()) { |
| | | EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils(); |
| | | factorQueryDTO = evaluateAndIdentificationUtils.lsMatchPha(pha, ls); |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | |
| | | } |
| | | } |
| | | for (UserInfoDomainDTO user : userList) { |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()) { |
| | | assessQueryDTO.setCreateByUserName(user.getRealName()); |
| | | } |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()) { |
| | | assessQueryDTO.setUpdateByUserName(user.getRealName()); |
| | | } |
| | | } |
| | | factorQueryDTOList.add(factorQueryDTO); |
| | | } |
| | | }else if (assessQueryDTO.getIdentificationMethod() == 2){ |
| | | } else if (assessQueryDTO.getIdentificationMethod() == 2) { |
| | | for (JhaQueryDTO jha : jhaList) { |
| | | FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(jha, FactorQueryDTO.class); |
| | | factorQueryDTO.setId(riskAssessPlan.getId()); |
| | |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | | factorQueryDTO.setItemIdentificationTime(jha.getUpdateTime()); |
| | | for (LsQueryDTO ls : lsList) { |
| | | if (ls.getIdentificationId() == jha.getId()){ |
| | | if (ls.getIdentificationId() == jha.getId()) { |
| | | EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils(); |
| | | factorQueryDTO = evaluateAndIdentificationUtils.lsMatchJha(jha, ls); |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | |
| | | } |
| | | } |
| | | for (UserInfoDomainDTO user : userList) { |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()) { |
| | | assessQueryDTO.setCreateByUserName(user.getRealName()); |
| | | } |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()) { |
| | | assessQueryDTO.setUpdateByUserName(user.getRealName()); |
| | | } |
| | | } |
| | | factorQueryDTOList.add(factorQueryDTO); |
| | | } |
| | | }else if (assessQueryDTO.getIdentificationMethod() == 3){ |
| | | } else if (assessQueryDTO.getIdentificationMethod() == 3) { |
| | | for (SclQueryDTO scl : sclList) { |
| | | FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(scl, FactorQueryDTO.class); |
| | | factorQueryDTO.setId(riskAssessPlan.getId()); |
| | |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | | factorQueryDTO.setItemIdentificationTime(scl.getUpdateTime()); |
| | | for (LsQueryDTO ls : lsList) { |
| | | if (ls.getIdentificationId() == scl.getId()){ |
| | | if (ls.getIdentificationId() == scl.getId()) { |
| | | EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils(); |
| | | factorQueryDTO = evaluateAndIdentificationUtils.lsMatchScl(scl, ls); |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | |
| | | } |
| | | } |
| | | for (UserInfoDomainDTO user : userList) { |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()) { |
| | | assessQueryDTO.setCreateByUserName(user.getRealName()); |
| | | } |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()) { |
| | | assessQueryDTO.setUpdateByUserName(user.getRealName()); |
| | | } |
| | | } |
| | | factorQueryDTOList.add(factorQueryDTO); |
| | | } |
| | | }else if (assessQueryDTO.getIdentificationMethod() == 4){ |
| | | } else if (assessQueryDTO.getIdentificationMethod() == 4) { |
| | | for (HazopQueryDTO hazop : hazopList) { |
| | | FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(hazop, FactorQueryDTO.class); |
| | | factorQueryDTO.setId(riskAssessPlan.getId()); |
| | |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | | factorQueryDTO.setItemIdentificationTime(hazop.getUpdateTime()); |
| | | for (LsQueryDTO ls : lsList) { |
| | | if (ls.getIdentificationId() == hazop.getId()){ |
| | | if (ls.getIdentificationId() == hazop.getId()) { |
| | | EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils(); |
| | | factorQueryDTO = evaluateAndIdentificationUtils.lsMatchHazop(hazop, ls); |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | |
| | | } |
| | | } |
| | | for (UserInfoDomainDTO user : userList) { |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()) { |
| | | assessQueryDTO.setCreateByUserName(user.getRealName()); |
| | | } |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()) { |
| | | assessQueryDTO.setUpdateByUserName(user.getRealName()); |
| | | } |
| | | } |
| | | factorQueryDTOList.add(factorQueryDTO); |
| | | } |
| | | }else if (assessQueryDTO.getIdentificationMethod() == 5){ |
| | | } else if (assessQueryDTO.getIdentificationMethod() == 5) { |
| | | for (AnalogyQueryDTO analogy : analogyList) { |
| | | FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(analogy, FactorQueryDTO.class); |
| | | factorQueryDTO.setId(riskAssessPlan.getId()); |
| | |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | | factorQueryDTO.setItemIdentificationTime(analogy.getUpdateTime()); |
| | | for (LsQueryDTO ls : lsList) { |
| | | if (ls.getIdentificationId() == analogy.getId()){ |
| | | if (ls.getIdentificationId() == analogy.getId()) { |
| | | EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils(); |
| | | factorQueryDTO = evaluateAndIdentificationUtils.lsMatchAnalogy(analogy, ls); |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | |
| | | } |
| | | } |
| | | for (UserInfoDomainDTO user : userList) { |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()) { |
| | | assessQueryDTO.setCreateByUserName(user.getRealName()); |
| | | } |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()) { |
| | | assessQueryDTO.setUpdateByUserName(user.getRealName()); |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | //评价方法3 - MES |
| | | }else if (assessQueryDTO.getEvaluateMethod() == 3){ |
| | | } else if (assessQueryDTO.getEvaluateMethod() == 3) { |
| | | List<MesQueryDTO> mesList = mesService.listMesByPlanId(riskAssessPlan.getId()); |
| | | if (assessQueryDTO.getIdentificationMethod() == 1){ |
| | | if (assessQueryDTO.getIdentificationMethod() == 1) { |
| | | for (PhaQueryDTO pha : phaList) { |
| | | FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(pha, FactorQueryDTO.class); |
| | | factorQueryDTO.setId(riskAssessPlan.getId()); |
| | |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | | factorQueryDTO.setItemIdentificationTime(pha.getUpdateTime()); |
| | | for (MesQueryDTO mes : mesList) { |
| | | if (mes.getIdentificationId() == pha.getId()){ |
| | | if (mes.getIdentificationId() == pha.getId()) { |
| | | EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils(); |
| | | factorQueryDTO = evaluateAndIdentificationUtils.mesMatchPha(pha, mes); |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | |
| | | } |
| | | } |
| | | for (UserInfoDomainDTO user : userList) { |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()) { |
| | | assessQueryDTO.setCreateByUserName(user.getRealName()); |
| | | } |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()) { |
| | | assessQueryDTO.setUpdateByUserName(user.getRealName()); |
| | | } |
| | | } |
| | | factorQueryDTOList.add(factorQueryDTO); |
| | | } |
| | | }else if (assessQueryDTO.getIdentificationMethod() == 2){ |
| | | } else if (assessQueryDTO.getIdentificationMethod() == 2) { |
| | | for (JhaQueryDTO jha : jhaList) { |
| | | FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(jha, FactorQueryDTO.class); |
| | | factorQueryDTO.setId(riskAssessPlan.getId()); |
| | |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | | factorQueryDTO.setItemIdentificationTime(jha.getUpdateTime()); |
| | | for (MesQueryDTO mes : mesList) { |
| | | if (mes.getIdentificationId() == jha.getId()){ |
| | | if (mes.getIdentificationId() == jha.getId()) { |
| | | EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils(); |
| | | factorQueryDTO = evaluateAndIdentificationUtils.mesMatchJha(jha, mes); |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | |
| | | } |
| | | } |
| | | for (UserInfoDomainDTO user : userList) { |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()) { |
| | | assessQueryDTO.setCreateByUserName(user.getRealName()); |
| | | } |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()) { |
| | | assessQueryDTO.setUpdateByUserName(user.getRealName()); |
| | | } |
| | | } |
| | | factorQueryDTOList.add(factorQueryDTO); |
| | | } |
| | | }else if (assessQueryDTO.getIdentificationMethod() == 3){ |
| | | } else if (assessQueryDTO.getIdentificationMethod() == 3) { |
| | | for (SclQueryDTO scl : sclList) { |
| | | FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(scl, FactorQueryDTO.class); |
| | | factorQueryDTO.setId(riskAssessPlan.getId()); |
| | |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | | factorQueryDTO.setItemIdentificationTime(scl.getUpdateTime()); |
| | | for (MesQueryDTO mes : mesList) { |
| | | if (mes.getIdentificationId() == scl.getId()){ |
| | | if (mes.getIdentificationId() == scl.getId()) { |
| | | EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils(); |
| | | factorQueryDTO = evaluateAndIdentificationUtils.mesMatchScl(scl, mes); |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | |
| | | } |
| | | } |
| | | for (UserInfoDomainDTO user : userList) { |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()) { |
| | | assessQueryDTO.setCreateByUserName(user.getRealName()); |
| | | } |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()) { |
| | | assessQueryDTO.setUpdateByUserName(user.getRealName()); |
| | | } |
| | | } |
| | | factorQueryDTOList.add(factorQueryDTO); |
| | | } |
| | | }else if (assessQueryDTO.getIdentificationMethod() == 4){ |
| | | } else if (assessQueryDTO.getIdentificationMethod() == 4) { |
| | | for (HazopQueryDTO hazop : hazopList) { |
| | | FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(hazop, FactorQueryDTO.class); |
| | | factorQueryDTO.setId(riskAssessPlan.getId()); |
| | |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | | factorQueryDTO.setItemIdentificationTime(hazop.getUpdateTime()); |
| | | for (MesQueryDTO mes : mesList) { |
| | | if (mes.getIdentificationId() == hazop.getId()){ |
| | | if (mes.getIdentificationId() == hazop.getId()) { |
| | | EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils(); |
| | | factorQueryDTO = evaluateAndIdentificationUtils.mesMatchHazop(hazop, mes); |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | |
| | | } |
| | | } |
| | | for (UserInfoDomainDTO user : userList) { |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()) { |
| | | assessQueryDTO.setCreateByUserName(user.getRealName()); |
| | | } |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()) { |
| | | assessQueryDTO.setUpdateByUserName(user.getRealName()); |
| | | } |
| | | } |
| | | factorQueryDTOList.add(factorQueryDTO); |
| | | } |
| | | }else if (assessQueryDTO.getIdentificationMethod() == 5){ |
| | | } else if (assessQueryDTO.getIdentificationMethod() == 5) { |
| | | for (AnalogyQueryDTO analogy : analogyList) { |
| | | FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(analogy, FactorQueryDTO.class); |
| | | factorQueryDTO.setId(riskAssessPlan.getId()); |
| | |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | | factorQueryDTO.setItemIdentificationTime(analogy.getUpdateTime()); |
| | | for (MesQueryDTO mes : mesList) { |
| | | if (mes.getIdentificationId() == analogy.getId()){ |
| | | if (mes.getIdentificationId() == analogy.getId()) { |
| | | EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils(); |
| | | factorQueryDTO = evaluateAndIdentificationUtils.mesMatchAnalogy(analogy, mes); |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | |
| | | } |
| | | } |
| | | for (UserInfoDomainDTO user : userList) { |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()) { |
| | | assessQueryDTO.setCreateByUserName(user.getRealName()); |
| | | } |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()) { |
| | | assessQueryDTO.setUpdateByUserName(user.getRealName()); |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | //评价方法4 - RS |
| | | }else if (assessQueryDTO.getEvaluateMethod() == 4){ |
| | | } else if (assessQueryDTO.getEvaluateMethod() == 4) { |
| | | List<RsQueryDTO> rsList = rsService.listRsByPlanId(riskAssessPlan.getId()); |
| | | if (assessQueryDTO.getIdentificationMethod() == 1){ |
| | | if (assessQueryDTO.getIdentificationMethod() == 1) { |
| | | for (PhaQueryDTO pha : phaList) { |
| | | FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(pha, FactorQueryDTO.class); |
| | | factorQueryDTO.setId(riskAssessPlan.getId()); |
| | |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | | factorQueryDTO.setItemIdentificationTime(pha.getUpdateTime()); |
| | | for (RsQueryDTO rs : rsList) { |
| | | if (rs.getIdentificationId() == pha.getId()){ |
| | | if (rs.getIdentificationId() == pha.getId()) { |
| | | EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils(); |
| | | factorQueryDTO = evaluateAndIdentificationUtils.rsMatchPha(pha, rs); |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | |
| | | } |
| | | } |
| | | for (UserInfoDomainDTO user : userList) { |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()) { |
| | | assessQueryDTO.setCreateByUserName(user.getRealName()); |
| | | } |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()) { |
| | | assessQueryDTO.setUpdateByUserName(user.getRealName()); |
| | | } |
| | | } |
| | | factorQueryDTOList.add(factorQueryDTO); |
| | | } |
| | | }else if (assessQueryDTO.getIdentificationMethod() == 2){ |
| | | } else if (assessQueryDTO.getIdentificationMethod() == 2) { |
| | | for (JhaQueryDTO jha : jhaList) { |
| | | FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(jha, FactorQueryDTO.class); |
| | | factorQueryDTO.setId(riskAssessPlan.getId()); |
| | |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | | factorQueryDTO.setItemIdentificationTime(jha.getUpdateTime()); |
| | | for (RsQueryDTO rs : rsList) { |
| | | if (rs.getIdentificationId() == jha.getId()){ |
| | | if (rs.getIdentificationId() == jha.getId()) { |
| | | EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils(); |
| | | factorQueryDTO = evaluateAndIdentificationUtils.rsMatchJha(jha, rs); |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | |
| | | } |
| | | } |
| | | for (UserInfoDomainDTO user : userList) { |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()) { |
| | | assessQueryDTO.setCreateByUserName(user.getRealName()); |
| | | } |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()) { |
| | | assessQueryDTO.setUpdateByUserName(user.getRealName()); |
| | | } |
| | | } |
| | | factorQueryDTOList.add(factorQueryDTO); |
| | | } |
| | | }else if (assessQueryDTO.getIdentificationMethod() == 3){ |
| | | } else if (assessQueryDTO.getIdentificationMethod() == 3) { |
| | | for (SclQueryDTO scl : sclList) { |
| | | FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(scl, FactorQueryDTO.class); |
| | | factorQueryDTO.setId(riskAssessPlan.getId()); |
| | |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | | factorQueryDTO.setItemIdentificationTime(scl.getUpdateTime()); |
| | | for (RsQueryDTO rs : rsList) { |
| | | if (rs.getIdentificationId() == scl.getId()){ |
| | | if (rs.getIdentificationId() == scl.getId()) { |
| | | EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils(); |
| | | factorQueryDTO = evaluateAndIdentificationUtils.rsMatchScl(scl, rs); |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | |
| | | } |
| | | } |
| | | for (UserInfoDomainDTO user : userList) { |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()) { |
| | | assessQueryDTO.setCreateByUserName(user.getRealName()); |
| | | } |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()) { |
| | | assessQueryDTO.setUpdateByUserName(user.getRealName()); |
| | | } |
| | | } |
| | | factorQueryDTOList.add(factorQueryDTO); |
| | | } |
| | | }else if (assessQueryDTO.getIdentificationMethod() == 4){ |
| | | } else if (assessQueryDTO.getIdentificationMethod() == 4) { |
| | | for (HazopQueryDTO hazop : hazopList) { |
| | | FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(hazop, FactorQueryDTO.class); |
| | | factorQueryDTO.setId(riskAssessPlan.getId()); |
| | |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | | factorQueryDTO.setItemIdentificationTime(hazop.getUpdateTime()); |
| | | for (RsQueryDTO rs : rsList) { |
| | | if (rs.getIdentificationId() == hazop.getId()){ |
| | | if (rs.getIdentificationId() == hazop.getId()) { |
| | | EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils(); |
| | | factorQueryDTO = evaluateAndIdentificationUtils.rsMatchHazop(hazop, rs); |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | |
| | | } |
| | | } |
| | | for (UserInfoDomainDTO user : userList) { |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()) { |
| | | assessQueryDTO.setCreateByUserName(user.getRealName()); |
| | | } |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()) { |
| | | assessQueryDTO.setUpdateByUserName(user.getRealName()); |
| | | } |
| | | } |
| | | factorQueryDTOList.add(factorQueryDTO); |
| | | } |
| | | }else if (assessQueryDTO.getIdentificationMethod() == 5){ |
| | | } else if (assessQueryDTO.getIdentificationMethod() == 5) { |
| | | for (AnalogyQueryDTO analogy : analogyList) { |
| | | FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(analogy, FactorQueryDTO.class); |
| | | factorQueryDTO.setId(riskAssessPlan.getId()); |
| | |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | | factorQueryDTO.setItemIdentificationTime(analogy.getUpdateTime()); |
| | | for (RsQueryDTO rs : rsList) { |
| | | if (rs.getIdentificationId() == analogy.getId()){ |
| | | if (rs.getIdentificationId() == analogy.getId()) { |
| | | EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils(); |
| | | factorQueryDTO = evaluateAndIdentificationUtils.rsMatchAnalogy(analogy, rs); |
| | | factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod()); |
| | |
| | | } |
| | | } |
| | | for (UserInfoDomainDTO user : userList) { |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getCreateByUserId()) { |
| | | assessQueryDTO.setCreateByUserName(user.getRealName()); |
| | | } |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()){ |
| | | if (user.getId() == assessQueryDTO.getUpdateByUserId()) { |
| | | assessQueryDTO.setUpdateByUserName(user.getRealName()); |
| | | } |
| | | } |
| | | factorQueryDTOList.add(factorQueryDTO); |
| | | } |
| | | } |
| | | }else { |
| | | } else { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode(), "评价方法参数错误"); |
| | | } |
| | | assessQueryDTO.setFactorQueryDTOList(factorQueryDTOList); |
| | |
| | | @Override |
| | | public AssessPlanUpdateDTO deleteIdentification(Long currentUserId, RiskAssessPlanIdentificationDeleteReqBO deleteReqBO) { |
| | | |
| | | if (currentUserId < 0){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无效,请重新登陆"); |
| | | if (currentUserId < 0) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户无效,请重新登陆"); |
| | | } |
| | | UserInfoDomainDTO userInfoById = userDomainService.getUserInfoById(currentUserId); |
| | | if (ObjectUtils.isEmpty(userInfoById)){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户不存在或已被删除"); |
| | | if (ObjectUtils.isEmpty(userInfoById)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户不存在或已被删除"); |
| | | } |
| | | if (ObjectUtils.isEmpty(deleteReqBO.getId())){ |
| | | if (ObjectUtils.isEmpty(deleteReqBO.getId())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "要删除的辨识项目不能为空"); |
| | | } |
| | | RiskAssessPlan assessPlanById = assessPlanRepository.getAssessPlanById(deleteReqBO.getId()); |
| | | if (ObjectUtils.isEmpty(assessPlanById)){ |
| | | if (ObjectUtils.isEmpty(assessPlanById)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "辨识计划不存在,或已被删除"); |
| | | } |
| | | if (!assessPlanById.getIdentificationUserId().equals(currentUserId)){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"不是辨识专家,无法操作"); |
| | | |
| | | List<RiskAssessPlanIdentificationUser> assessPlanIdentificationUserPlanId = planIdentificationUserService.getAssessPlanIdentificationUserPlanId(assessPlanById.getId(), currentUserId); |
| | | if (ObjectUtils.isEmpty(assessPlanIdentificationUserPlanId)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "不是辨识专家,无法操作"); |
| | | } |
| | | if (ObjectUtils.isEmpty(assessPlanById.getIdentificationMethod())){ |
| | | if (ObjectUtils.isEmpty(assessPlanById.getIdentificationMethod())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "要删除的辨识项目为空,或已被删除"); |
| | | } |
| | | if (assessPlanById.getPlanExecStatus() != StatusEnum.PLAN_EXEC_IDENTIFICATION.getCode().byteValue()){ |
| | | if (assessPlanById.getPlanExecStatus() != StatusEnum.PLAN_EXEC_IDENTIFICATION.getCode().byteValue()) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "辨识已提交,无法删除"); |
| | | } |
| | | // if (!assessPlanById.getPlanUserId().equals(userInfoById.getId())){ |
| | |
| | | //处理辨识表 |
| | | //辨识方法 1-PHA; |
| | | int tag = 0; |
| | | if (assessPlanById.getIdentificationMethod() == 1){ |
| | | if (assessPlanById.getIdentificationMethod() == 1) { |
| | | IdentificationMethodDeleteDTO deleteIdentificationResult = phaService.deletePhaByPlanId(currentUserId, deleteReqBO.getPhaId()); |
| | | if (deleteIdentificationResult.getResult() < 1){ |
| | | if (deleteIdentificationResult.getResult() < 1) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "删除辨识项目失败"); |
| | | } |
| | | tag = 1; |
| | | //辨识方法 2-JHA; |
| | | }else if (assessPlanById.getIdentificationMethod() == 2){ |
| | | } else if (assessPlanById.getIdentificationMethod() == 2) { |
| | | IdentificationMethodDeleteDTO deleteIdentificationResult = jhaService.deleteJhaByPlanId(currentUserId, deleteReqBO.getJhaId()); |
| | | if (deleteIdentificationResult.getResult() < 1){ |
| | | if (deleteIdentificationResult.getResult() < 1) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "删除辨识项目失败"); |
| | | } |
| | | tag = 1; |
| | | //辨识方法 3-SCL; |
| | | }else if (assessPlanById.getIdentificationMethod() == 3){ |
| | | IdentificationMethodDeleteDTO deleteIdentificationResult =sclService.deleteSclByPlanId(currentUserId, deleteReqBO.getSclId()); |
| | | if (deleteIdentificationResult.getResult() < 1){ |
| | | } else if (assessPlanById.getIdentificationMethod() == 3) { |
| | | IdentificationMethodDeleteDTO deleteIdentificationResult = sclService.deleteSclByPlanId(currentUserId, deleteReqBO.getSclId()); |
| | | if (deleteIdentificationResult.getResult() < 1) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "删除辨识项目失败"); |
| | | } |
| | | tag = 1; |
| | | //辨识方法 4-HAZOP; |
| | | }else if (assessPlanById.getIdentificationMethod() == 4){ |
| | | } else if (assessPlanById.getIdentificationMethod() == 4) { |
| | | IdentificationMethodDeleteDTO deleteIdentificationResult = hazopService.deleteHazopByPlanId(currentUserId, deleteReqBO.getHazopId()); |
| | | if (deleteIdentificationResult.getResult() < 1){ |
| | | if (deleteIdentificationResult.getResult() < 1) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "删除辨识项目失败"); |
| | | } |
| | | tag = 1; |
| | | //5-类比法 analogy; |
| | | }else if (assessPlanById.getIdentificationMethod() == 5){ |
| | | IdentificationMethodDeleteDTO deleteIdentificationResult= analogyService.deleteAnalogyByPlanId(currentUserId, deleteReqBO.getAnalogyId()); |
| | | if (deleteIdentificationResult.getResult() < 1){ |
| | | } else if (assessPlanById.getIdentificationMethod() == 5) { |
| | | IdentificationMethodDeleteDTO deleteIdentificationResult = analogyService.deleteAnalogyByPlanId(currentUserId, deleteReqBO.getAnalogyId()); |
| | | if (deleteIdentificationResult.getResult() < 1) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "删除辨识项目失败"); |
| | | } |
| | | tag = 1; |
| | | }else { |
| | | } else { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode(), "辨识方法参数错误"); |
| | | } |
| | | //处理计划表 , 清除辨识时间 |
| | |
| | | //todo 需要进行判断,如果没有辨识,清空时间,如果有,重置时间 |
| | | assessPlanById.setIdentificationTime(null); |
| | | RiskAssessPlan deleteResult = assessPlanRepository.save(assessPlanById); |
| | | if (ObjectUtils.isEmpty(deleteResult)){ |
| | | if (ObjectUtils.isEmpty(deleteResult)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "辨识方法删除失败"); |
| | | } |
| | | |
| | |
| | | @Override |
| | | public AssessPlanUpdateDTO deleteEvaluate(Long currentUserId, RiskAssessPlanEvaluateDeleteReqBO deleteReqBO) { |
| | | |
| | | if (currentUserId < 0){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无效,请重新登陆"); |
| | | if (currentUserId < 0) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户无效,请重新登陆"); |
| | | } |
| | | UserInfoDomainDTO userInfoById = userDomainService.getUserInfoById(currentUserId); |
| | | if (ObjectUtils.isEmpty(userInfoById)){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户不存在或已被删除"); |
| | | if (ObjectUtils.isEmpty(userInfoById)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户不存在或已被删除"); |
| | | } |
| | | if (ObjectUtils.isEmpty(deleteReqBO.getId())){ |
| | | if (ObjectUtils.isEmpty(deleteReqBO.getId())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "要删除的评价项目不能为空"); |
| | | } |
| | | RiskAssessPlan assessPlanById = assessPlanRepository.getAssessPlanById(deleteReqBO.getId()); |
| | | if (ObjectUtils.isEmpty(assessPlanById)){ |
| | | if (ObjectUtils.isEmpty(assessPlanById)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "评价计划不存在,或已被删除"); |
| | | } |
| | | if (ObjectUtils.isEmpty(assessPlanById.getEvaluateMethod())){ |
| | | if (ObjectUtils.isEmpty(assessPlanById.getEvaluateMethod())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "要删除的评价项目为空,或已被删除"); |
| | | } |
| | | if (assessPlanById.getPlanExecStatus() != StatusEnum.PLAN_EXEC_EVALUATE.getCode().byteValue()){ |
| | | if (assessPlanById.getPlanExecStatus() != StatusEnum.PLAN_EXEC_EVALUATE.getCode().byteValue()) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "评价已提交,无法删除"); |
| | | } |
| | | if (!assessPlanById.getPlanUserId().equals(userInfoById.getId())){ |
| | | if (!assessPlanById.getPlanUserId().equals(userInfoById.getId())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode(), "您不是计划制定者,无法删除"); |
| | | } |
| | | //辨识方法1 - LEC |
| | | if (assessPlanById.getEvaluateMethod() == 1){ |
| | | if (assessPlanById.getEvaluateMethod() == 1) { |
| | | EvaluateMethodDeleteDTO deleteEvaluateResult = lecService.deleteLecByPlanId(currentUserId, deleteReqBO); |
| | | if (deleteEvaluateResult.getResult() < 1){ |
| | | if (deleteEvaluateResult.getResult() < 1) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "删除评价项目失败"); |
| | | } |
| | | //辨识方法2 - LS |
| | | }else if (assessPlanById.getEvaluateMethod() == 2){ |
| | | } else if (assessPlanById.getEvaluateMethod() == 2) { |
| | | EvaluateMethodDeleteDTO deleteEvaluateResult = lsService.deleteLsByPlanId(currentUserId, deleteReqBO); |
| | | if (deleteEvaluateResult.getResult() < 1){ |
| | | if (deleteEvaluateResult.getResult() < 1) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "删除评价项目失败"); |
| | | } |
| | | //辨识方法3 - MES |
| | | }else if (assessPlanById.getEvaluateMethod() == 3){ |
| | | } else if (assessPlanById.getEvaluateMethod() == 3) { |
| | | EvaluateMethodDeleteDTO deleteEvaluateResult = mesService.deleteMesByPlanId(currentUserId, deleteReqBO); |
| | | if (deleteEvaluateResult.getResult() < 1){ |
| | | if (deleteEvaluateResult.getResult() < 1) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "删除评价项目失败"); |
| | | } |
| | | //辨识方法4 - RS |
| | | }else if (assessPlanById.getEvaluateMethod() == 4){ |
| | | } else if (assessPlanById.getEvaluateMethod() == 4) { |
| | | EvaluateMethodDeleteDTO deleteEvaluateResult = rsService.deleteRsByPlanId(currentUserId, deleteReqBO); |
| | | if (deleteEvaluateResult.getResult() < 1){ |
| | | if (deleteEvaluateResult.getResult() < 1) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "删除评价项目失败"); |
| | | } |
| | | }else { |
| | | } else { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode(), "评价方法参数错误"); |
| | | } |
| | | |
| | |
| | | // RiskAssessPlan deleteResult = assessPlanRepository.deleteEvaluate(id, LocalDateTime.now()); |
| | | assessPlanById.setIdentificationTime(null); |
| | | RiskAssessPlan deleteResult = assessPlanRepository.save(assessPlanById); |
| | | if (ObjectUtils.isEmpty(deleteResult)){ |
| | | if (ObjectUtils.isEmpty(deleteResult)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "评价方法删除失败"); |
| | | } |
| | | |
| | |
| | | @Override |
| | | public AssessPlanQueryDTO getAssessPlanById(Long id) { |
| | | |
| | | if (ObjectUtils.isEmpty(id)){ |
| | | if (ObjectUtils.isEmpty(id)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评估计划不能为空"); |
| | | } |
| | | |
| | | RiskAssessPlan assessPlanById = assessPlanRepository.getAssessPlanById(id); |
| | | if (ObjectUtils.isEmpty(assessPlanById)){ |
| | | if (ObjectUtils.isEmpty(assessPlanById)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "评估计划不存在"); |
| | | } |
| | | return BeanCopyUtils.copyBean(assessPlanById, AssessPlanQueryDTO.class); |
| | |
| | | @Override |
| | | public List<AssessPlanQueryDTO> getAssessPlanByExperimentId(Long experimentId) { |
| | | |
| | | if (ObjectUtils.isEmpty(experimentId)){ |
| | | if (ObjectUtils.isEmpty(experimentId)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评估计划不能为空"); |
| | | } |
| | | List<RiskAssessPlan> assessPlanList = assessPlanRepository.getAssessPlanByExperimentId(experimentId); |
| | | return BeanCopyUtils.copyBeanList(assessPlanList, AssessPlanQueryDTO.class); |
| | | } |
| | | |
| | | /** |
| | | * 评估计划 - 查询已派发 |
| | | */ |
| | | @Override |
| | | public List<RiskAssessPlanListAppDTO> listAssessPlan(Byte status) { |
| | | List<RiskAssessPlan> riskAssessPlans = assessPlanRepository.listAssessPlan(status); |
| | | if (riskAssessPlans.size() < 1){ |
| | | if (riskAssessPlans.size() < 1) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "没有可以辨识的评估计划"); |
| | | } |
| | | return BeanCopyUtils.copyBeanList(riskAssessPlans, RiskAssessPlanListAppDTO.class); |
| | | } |
| | | |
| | | /** |
| | | * 评估计划 - 修改任务派发状态 |
| | | */ |
| | |
| | | for (RiskAssessPlan riskAssessPlan : assessPlanByExperimentId) { |
| | | riskAssessPlan.setPlanSellStatus(status); |
| | | RiskAssessPlan save = assessPlanRepository.save(riskAssessPlan); |
| | | if (ObjectUtils.isEmpty(save)){ |
| | | if (ObjectUtils.isEmpty(save)) { |
| | | tag = 0; |
| | | } |
| | | } |
| | | |
| | | return tag; |
| | | } |
| | | |
| | | /** |
| | | * 风险评估计划 - 辨识专家拒绝 |
| | | */ |
| | | @Override |
| | | public AssessPlanUpdateDTO identificationRefuse(Long currentUserId, Long id) { |
| | | |
| | | if (ObjectUtils.isEmpty(id)){ |
| | | if (ObjectUtils.isEmpty(id)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "请选择正确的评估计划"); |
| | | } |
| | | UserInfoDomainDTO user = userDomainService.getUserById(currentUserId); |
| | | |
| | | RiskAssessPlan assessPlanById = assessPlanRepository.getAssessPlanById(id); |
| | | if (!currentUserId.equals(assessPlanById.getIdentificationUserId())){ |
| | | if (!currentUserId.equals(assessPlanById.getIdentificationUserId())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "不能拒绝其他专家的辨识任务"); |
| | | } |
| | | if (assessPlanById.getPlanExecStatus().equals(StatusEnum.PLAN_EXEC_EVALUATE.getCode())){ |
| | | if (assessPlanById.getPlanExecStatus().equals(StatusEnum.PLAN_EXEC_EVALUATE.getCode())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "辨识结果已提交,无法拒绝任务"); |
| | | } |
| | | assessPlanById.setIdentificationUser(null); |
| | |
| | | @Transactional |
| | | @Override |
| | | public AssessPlanUpdateDTO evaluateRefuse(Long currentUserId, Long id) { |
| | | if (ObjectUtils.isEmpty(id)){ |
| | | if (ObjectUtils.isEmpty(id)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "请选择正确的评估计划"); |
| | | } |
| | | UserInfoDomainDTO user = userDomainService.getUserById(currentUserId); |
| | | |
| | | RiskAssessPlan assessPlanById = assessPlanRepository.getAssessPlanById(id); |
| | | if (!currentUserId.equals(assessPlanById.getEvaluateUserId())){ |
| | | List<RiskAssessPlanEvaluateUser> assessPlanEvaluateUserPlanId = evaluateUserService.getAssessPlanEvaluateUserPlanId(id, currentUserId); |
| | | if (ObjectUtils.isEmpty(assessPlanEvaluateUserPlanId)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "不能拒绝其他专家的评价任务"); |
| | | } |
| | | if (assessPlanById.getPlanExecStatus().equals(StatusEnum.PLAN_EXEC_OVER.getCode())){ |
| | | if (assessPlanById.getPlanExecStatus().equals(StatusEnum.PLAN_EXEC_OVER.getCode())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评估已完成,无法拒绝任务"); |
| | | } |
| | | assessPlanById.setEvaluateUser(null); |
| | | assessPlanById.setEvaluateUserId(null); |
| | | if (assessPlanById.getEvaluateTime() != null){ |
| | | if (assessPlanById.getEvaluateMethod().equals(MethodEnum.EVALUATE_METHOD_LEC.getCode())){ |
| | | if (assessPlanById.getEvaluateTime() != null) { |
| | | if (assessPlanById.getEvaluateMethod().equals(MethodEnum.EVALUATE_METHOD_LEC.getCode())) { |
| | | int result = lecService.deleteLecByAssessPlanId(id); |
| | | if (result == 1){ |
| | | if (result == 1) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "删除评价信息失败"); |
| | | } |
| | | }else if (assessPlanById.getEvaluateMethod().equals(MethodEnum.EVALUATE_METHOD_LS.getCode())){ |
| | | } else if (assessPlanById.getEvaluateMethod().equals(MethodEnum.EVALUATE_METHOD_LS.getCode())) { |
| | | int result = lsService.deleteLsByAssessPlanId(id); |
| | | if (result == 1){ |
| | | if (result == 1) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "删除评价信息失败"); |
| | | } |
| | | }else if (assessPlanById.getEvaluateMethod().equals(MethodEnum.EVALUATE_METHOD_MES.getCode())){ |
| | | } else if (assessPlanById.getEvaluateMethod().equals(MethodEnum.EVALUATE_METHOD_MES.getCode())) { |
| | | int result = mesService.deleteMesByAssessPlanId(id); |
| | | if (result == 1){ |
| | | if (result == 1) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "删除评价信息失败"); |
| | | } |
| | | }else if (assessPlanById.getEvaluateMethod().equals(MethodEnum.EVALUATE_METHOD_RS.getCode())){ |
| | | } else if (assessPlanById.getEvaluateMethod().equals(MethodEnum.EVALUATE_METHOD_RS.getCode())) { |
| | | int result = rsService.deleteRsByAssessPlanId(id); |
| | | if (result == 1){ |
| | | if (result == 1) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "删除评价信息失败"); |
| | | } |
| | | } |
| | |
| | | @Override |
| | | public AssessPlanUpdateDTO identificationUpdateMethod(Long currentUserId, MethodUpdateReqDTO updateReqDTO) { |
| | | |
| | | if (ObjectUtils.isEmpty(updateReqDTO.getId())){ |
| | | if (ObjectUtils.isEmpty(updateReqDTO.getId())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "请选择正确的评估计划"); |
| | | } |
| | | if (ObjectUtils.isEmpty(updateReqDTO.getIdentificationMethodId())){ |
| | | if (ObjectUtils.isEmpty(updateReqDTO.getIdentificationMethodId())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "请选择正确的辨识方法"); |
| | | } |
| | | RiskAssessPlan assessPlanById = assessPlanRepository.getAssessPlanById(updateReqDTO.getId()); |
| | | if (ObjectUtils.isEmpty(assessPlanById)){ |
| | | if (ObjectUtils.isEmpty(assessPlanById)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "辨识任务不存在"); |
| | | } |
| | | if (!assessPlanById.getIdentificationUserId().equals(currentUserId)){ |
| | | List<RiskAssessPlanIdentificationUser> assessPlanIdentificationUser = |
| | | planIdentificationUserService.getAssessPlanIdentificationUserPlanId(assessPlanById.getId(), currentUserId); |
| | | |
| | | if (ObjectUtils.isEmpty(assessPlanIdentificationUser)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "只能修改自己的辨识任务"); |
| | | } |
| | | assessPlanById.setIdentificationMethod(updateReqDTO.getIdentificationMethodId()); |
| | |
| | | @Override |
| | | public AssessPlanUpdateDTO evaluateUpdateMethod(Long currentUserId, MethodUpdateReqDTO updateReqDTO) { |
| | | |
| | | if (ObjectUtils.isEmpty(updateReqDTO.getId())){ |
| | | if (ObjectUtils.isEmpty(updateReqDTO.getId())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "请选择正确的评估计划"); |
| | | } |
| | | if (ObjectUtils.isEmpty(updateReqDTO.getEvaluateMethodId())){ |
| | | if (ObjectUtils.isEmpty(updateReqDTO.getEvaluateMethodId())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "请选择正确的评价方法"); |
| | | } |
| | | RiskAssessPlan assessPlanById = assessPlanRepository.getAssessPlanById(updateReqDTO.getId()); |
| | | if (ObjectUtils.isEmpty(assessPlanById)){ |
| | | if (ObjectUtils.isEmpty(assessPlanById)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评价任务不存在"); |
| | | } |
| | | if (!assessPlanById.getEvaluateUserId().equals(currentUserId)){ |
| | | List<RiskAssessPlanEvaluateUser> assessPlanEvaluateUserPlanId = evaluateUserService.getAssessPlanEvaluateUserPlanId(assessPlanById.getId(), currentUserId); |
| | | if (ObjectUtils.isEmpty(assessPlanEvaluateUserPlanId)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "只能修改自己的评价任务"); |
| | | } |
| | | assessPlanById.setEvaluateMethod(updateReqDTO.getEvaluateMethodId()); |
| | |
| | | assessPlanById.setUpdateByUserId(currentUserId); |
| | | assessPlanById.setEvaluateTime(null); |
| | | |
| | | if (updateReqDTO.getEvaluateMethodId() == 1){ |
| | | if (updateReqDTO.getEvaluateMethodId() == 1) { |
| | | int result = lecService.deleteLecByPlan(updateReqDTO.getId()); |
| | | if (result == StatusEnum.FAIL.getCode()){ |
| | | if (result == StatusEnum.FAIL.getCode()) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "修改评价方法失败"); |
| | | } |
| | | }else if (updateReqDTO.getEvaluateMethodId() == 2){ |
| | | } else if (updateReqDTO.getEvaluateMethodId() == 2) { |
| | | int result = lsService.deleteLsByPlan(updateReqDTO.getId()); |
| | | if (result == StatusEnum.FAIL.getCode()){ |
| | | if (result == StatusEnum.FAIL.getCode()) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "修改评价方法失败"); |
| | | } |
| | | }else if (updateReqDTO.getEvaluateMethodId() == 3){ |
| | | } else if (updateReqDTO.getEvaluateMethodId() == 3) { |
| | | int result = mesService.deleteMesByPlan(updateReqDTO.getId()); |
| | | if (result == StatusEnum.FAIL.getCode()){ |
| | | if (result == StatusEnum.FAIL.getCode()) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "修改评价方法失败"); |
| | | } |
| | | }else if (updateReqDTO.getEvaluateMethodId() == 4){ |
| | | } else if (updateReqDTO.getEvaluateMethodId() == 4) { |
| | | int result = rsService.deleteRsByPlan(updateReqDTO.getId()); |
| | | if (result == StatusEnum.FAIL.getCode()){ |
| | | if (result == StatusEnum.FAIL.getCode()) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "修改评价方法失败"); |
| | | } |
| | | } |
| | |
| | | @Override |
| | | public AssessPlanUpdateDTO appoint(Long currentUserId, AppointUserReBO appointUserReBO) { |
| | | |
| | | if (ObjectUtils.isEmpty(appointUserReBO.getId())){ |
| | | if (ObjectUtils.isEmpty(appointUserReBO.getId())) { |
| | | throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "请选择正确的评估计划"); |
| | | } |
| | | UserInfoDomainDTO user = userDomainService.getUserById(currentUserId); |
| | | RiskAssessPlan assessPlanById = assessPlanRepository.getAssessPlanById(appointUserReBO.getId()); |
| | | |
| | | if (!ObjectUtils.isEmpty(appointUserReBO.getIdentificationUserId())){ |
| | | if (!ObjectUtils.isEmpty(appointUserReBO.getIdentificationUserId())) { |
| | | UserInfoDomainDTO identificationUser = userDomainService.getUserById(appointUserReBO.getIdentificationUserId()); |
| | | if (ObjectUtils.isEmpty(identificationUser)){ |
| | | if (ObjectUtils.isEmpty(identificationUser)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "所选的辨识专家不存在"); |
| | | } |
| | | assessPlanById.setIdentificationUserId(identificationUser.getId()); |
| | | assessPlanById.setIdentificationUser(identificationUser.getRealName()); |
| | | } |
| | | if (!ObjectUtils.isEmpty(appointUserReBO.getEvaluateUserId())){ |
| | | if (!ObjectUtils.isEmpty(appointUserReBO.getEvaluateUserId())) { |
| | | UserInfoDomainDTO evaluateUser = userDomainService.getUserById(appointUserReBO.getEvaluateUserId()); |
| | | if (ObjectUtils.isEmpty(evaluateUser)){ |
| | | if (ObjectUtils.isEmpty(evaluateUser)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "所选的评价专家不存在"); |
| | | } |
| | | assessPlanById.setEvaluateUserId(evaluateUser.getId()); |
| | |
| | | return BeanCopyUtils.copyBean(save, AssessPlanUpdateDTO.class); |
| | | } |
| | | |
| | | @Override |
| | | public int appointNew(Long currentUserId, AppointUserTypeReBO appointUserReBO) { |
| | | if (appointUserReBO == null){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "数据错误"); |
| | | } |
| | | List<Long> userIds = appointUserReBO.getUserIds(); |
| | | if (ObjectUtils.isEmpty(userIds)){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "数据错误"); |
| | | } |
| | | RiskAssessPlan assessPlanById = assessPlanRepository.getAssessPlanById(appointUserReBO.getRiskAssessPlanId()); |
| | | if (ObjectUtils.isEmpty(assessPlanById)){ |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "评价计划不存在"); |
| | | } |
| | | String userType = appointUserReBO.getUserType(); |
| | | String userTypeName = userType == "1" ? "辨识专家" : "评价专家"; |
| | | |
| | | List<UserInfoDomainDTO> identificationUser = userDomainService.getUserInfoByIds(userIds, userTypeName); |
| | | if (ObjectUtils.isEmpty(identificationUser)) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), userTypeName+"不存在或已被删除"); |
| | | } |
| | | if (identificationUser.size() != userIds.size()) { |
| | | throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "存在选中"+userTypeName+"不存在或已被删除"); |
| | | } |
| | | if (userType == "1"){ |
| | | planIdentificationUserService.deleteByPlanId(assessPlanById.getId(), LocalDateTime.now()); |
| | | saveIdentificationUser(assessPlanById.getId(), identificationUser, LocalDateTime.now(), currentUserId); |
| | | }else { |
| | | //处理评价专家 |
| | | evaluateUserService.deleteRsByPlan(assessPlanById.getId(), LocalDateTime.now()); |
| | | saveEvaUser(assessPlanById.getId(), identificationUser, LocalDateTime.now(), currentUserId); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | } |