package com.gkhy.labRiskManage.domain.riskReport.utils;
|
|
import com.gkhy.labRiskManage.domain.riskReport.entity.*;
|
import com.gkhy.labRiskManage.domain.riskReport.model.dto.*;
|
import com.gkhy.labRiskManage.domain.riskReport.service.*;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Component;
|
import org.springframework.util.ObjectUtils;
|
|
import javax.annotation.PostConstruct;
|
import java.util.List;
|
|
@Component
|
public class EvaluateCheckUtils {
|
|
@Autowired
|
private RiskAssessPlanIdentificationAnalogyService analogyService;
|
@Autowired
|
private RiskAssessPlanIdentificationHazopService hazopService;
|
@Autowired
|
private RiskAssessPlanIdentificationJhaService jhaService;
|
@Autowired
|
private RiskAssessPlanIdentificationPhaService phaService;
|
@Autowired
|
private RiskAssessPlanIdentificationSclService sclService;
|
|
@Autowired
|
private RiskAssessPlanEvaluateLecService lecService;
|
@Autowired
|
private RiskAssessPlanEvaluateLsService lsService;
|
@Autowired
|
private RiskAssessPlanEvaluateMesService mesService;
|
@Autowired
|
private RiskAssessPlanEvaluateRsService rsService;
|
|
|
private static EvaluateCheckUtils methodCheck;
|
|
@PostConstruct
|
private void init(){
|
methodCheck = this;
|
methodCheck.phaService = this.phaService;
|
methodCheck.jhaService = this.jhaService;
|
methodCheck.sclService = this.sclService;
|
methodCheck.hazopService = this.hazopService;
|
methodCheck.analogyService = this.analogyService;
|
methodCheck.lecService = this.lecService;
|
methodCheck.lsService = this.lsService;
|
methodCheck.mesService = this.mesService;
|
methodCheck.rsService = this.rsService;
|
}
|
|
/**
|
* todo 该方法, 检查每一项辨识,是否有对应的评价
|
* 辨识方法:1-PHA;2-JHA;3-SCL;4-HAZOP;5-类比法analogy
|
* */
|
|
public static int evaluateCheckUtils(RiskAssessPlan assessPlanById){
|
|
int tag = 0;
|
//辨识方法 1-PHA;
|
if (assessPlanById.getIdentificationMethod() == 1){
|
List<PhaQueryDTO> phaQueryDTOS = methodCheck.phaService.listPhaByPlanId(assessPlanById.getId());
|
for (PhaQueryDTO phaQueryDTO : phaQueryDTOS) {
|
if (assessPlanById.getEvaluateMethod() == 1){
|
RiskAssessPlanEvaluateLec lecByIdentificationId = methodCheck.lecService.getLecByIdentificationId(phaQueryDTO.getId(), assessPlanById.getIdentificationMethod());
|
if (ObjectUtils.isEmpty(lecByIdentificationId)){
|
tag = 1;
|
}
|
//辨识方法2 - LS
|
}else if (assessPlanById.getEvaluateMethod() == 2){
|
RiskAssessPlanEvaluateLs lsByIdentificationId = methodCheck.lsService.getLsByIdentificationId(phaQueryDTO.getId(), assessPlanById.getIdentificationMethod());
|
if (ObjectUtils.isEmpty(lsByIdentificationId)){
|
tag = 1;
|
}
|
//辨识方法3 - MES
|
}else if (assessPlanById.getEvaluateMethod() == 3){
|
RiskAssessPlanEvaluateMes mesByIdentificationId = methodCheck.mesService.getMesByIdentificationId(phaQueryDTO.getId(), assessPlanById.getIdentificationMethod());
|
if (ObjectUtils.isEmpty(mesByIdentificationId)){
|
tag = 1;
|
}
|
//辨识方法4 - RS
|
}else if (assessPlanById.getEvaluateMethod() == 4){
|
RiskAssessPlanEvaluateRs rsByIdentificationId = methodCheck.rsService.getRsByIdentificationId(phaQueryDTO.getId(), assessPlanById.getIdentificationMethod());
|
if (ObjectUtils.isEmpty(rsByIdentificationId)){
|
tag = 1;
|
}
|
}
|
}
|
|
//辨识方法 2-JHA;
|
}else if (assessPlanById.getIdentificationMethod() == 2){
|
List<JhaQueryDTO> jhaQueryDTOS = methodCheck.jhaService.listJhaByPlanId(assessPlanById.getId());
|
for (JhaQueryDTO jhaQueryDTO : jhaQueryDTOS) {
|
if (assessPlanById.getEvaluateMethod() == 1){
|
RiskAssessPlanEvaluateLec lecByIdentificationId = methodCheck.lecService.getLecByIdentificationId(jhaQueryDTO.getId(), assessPlanById.getIdentificationMethod());
|
if (ObjectUtils.isEmpty(lecByIdentificationId)){
|
tag = 1;
|
}
|
//辨识方法2 - LS
|
}else if (assessPlanById.getEvaluateMethod() == 2){
|
RiskAssessPlanEvaluateLs lsByIdentificationId = methodCheck.lsService.getLsByIdentificationId(jhaQueryDTO.getId(), assessPlanById.getIdentificationMethod());
|
if (ObjectUtils.isEmpty(lsByIdentificationId)){
|
tag = 1;
|
}
|
//辨识方法3 - MES
|
}else if (assessPlanById.getEvaluateMethod() == 3){
|
RiskAssessPlanEvaluateMes mesByIdentificationId = methodCheck.mesService.getMesByIdentificationId(jhaQueryDTO.getId(), assessPlanById.getIdentificationMethod());
|
if (ObjectUtils.isEmpty(mesByIdentificationId)){
|
tag = 1;
|
}
|
//辨识方法4 - RS
|
}else if (assessPlanById.getEvaluateMethod() == 4){
|
RiskAssessPlanEvaluateRs rsByIdentificationId = methodCheck.rsService.getRsByIdentificationId(jhaQueryDTO.getId(), assessPlanById.getIdentificationMethod());
|
if (ObjectUtils.isEmpty(rsByIdentificationId)){
|
tag = 1;
|
}
|
}
|
}
|
|
//辨识方法 3-SCL;
|
}else if (assessPlanById.getIdentificationMethod() == 3){
|
List<SclQueryDTO> sclQueryDTOS = methodCheck.sclService.listSclByPlanId(assessPlanById.getId());
|
for (SclQueryDTO sclQueryDTO : sclQueryDTOS) {
|
if (assessPlanById.getEvaluateMethod() == 1){
|
RiskAssessPlanEvaluateLec lecByIdentificationId = methodCheck.lecService.getLecByIdentificationId(sclQueryDTO.getId(), assessPlanById.getIdentificationMethod());
|
if (ObjectUtils.isEmpty(lecByIdentificationId)){
|
tag = 1;
|
}
|
//辨识方法2 - LS
|
}else if (assessPlanById.getEvaluateMethod() == 2){
|
RiskAssessPlanEvaluateLs lsByIdentificationId = methodCheck.lsService.getLsByIdentificationId(sclQueryDTO.getId(), assessPlanById.getIdentificationMethod());
|
if (ObjectUtils.isEmpty(lsByIdentificationId)){
|
tag = 1;
|
}
|
//辨识方法3 - MES
|
}else if (assessPlanById.getEvaluateMethod() == 3){
|
RiskAssessPlanEvaluateMes mesByIdentificationId = methodCheck.mesService.getMesByIdentificationId(sclQueryDTO.getId(), assessPlanById.getIdentificationMethod());
|
if (ObjectUtils.isEmpty(mesByIdentificationId)){
|
tag = 1;
|
}
|
//辨识方法4 - RS
|
}else if (assessPlanById.getEvaluateMethod() == 4){
|
RiskAssessPlanEvaluateRs rsByIdentificationId = methodCheck.rsService.getRsByIdentificationId(sclQueryDTO.getId(), assessPlanById.getIdentificationMethod());
|
if (ObjectUtils.isEmpty(rsByIdentificationId)){
|
tag = 1;
|
}
|
}
|
}
|
|
//辨识方法 4-HAZOP;
|
}else if (assessPlanById.getIdentificationMethod() == 4){
|
List<HazopQueryDTO> hazopQueryDTOS = methodCheck.hazopService.listHazopByPlanId(assessPlanById.getId());
|
for (HazopQueryDTO hazopQueryDTO : hazopQueryDTOS) {
|
if (assessPlanById.getEvaluateMethod() == 1){
|
RiskAssessPlanEvaluateLec lecByIdentificationId = methodCheck.lecService.getLecByIdentificationId(hazopQueryDTO.getId(), assessPlanById.getIdentificationMethod());
|
if (ObjectUtils.isEmpty(lecByIdentificationId)){
|
tag = 1;
|
}
|
//辨识方法2 - LS
|
}else if (assessPlanById.getEvaluateMethod() == 2){
|
RiskAssessPlanEvaluateLs lsByIdentificationId = methodCheck.lsService.getLsByIdentificationId(hazopQueryDTO.getId(), assessPlanById.getIdentificationMethod());
|
if (ObjectUtils.isEmpty(lsByIdentificationId)){
|
tag = 1;
|
}
|
//辨识方法3 - MES
|
}else if (assessPlanById.getEvaluateMethod() == 3){
|
RiskAssessPlanEvaluateMes mesByIdentificationId = methodCheck.mesService.getMesByIdentificationId(hazopQueryDTO.getId(), assessPlanById.getIdentificationMethod());
|
if (ObjectUtils.isEmpty(mesByIdentificationId)){
|
tag = 1;
|
}
|
//辨识方法4 - RS
|
}else if (assessPlanById.getEvaluateMethod() == 4){
|
RiskAssessPlanEvaluateRs rsByIdentificationId = methodCheck.rsService.getRsByIdentificationId(hazopQueryDTO.getId(), assessPlanById.getIdentificationMethod());
|
if (ObjectUtils.isEmpty(rsByIdentificationId)){
|
tag = 1;
|
}
|
}
|
}
|
|
//5-类比法 nalogy;
|
}else if (assessPlanById.getIdentificationMethod() == 5){
|
List<AnalogyQueryDTO> analogyQueryDTOS = methodCheck.analogyService.listAnalogyByPlanId(assessPlanById.getId());
|
for (AnalogyQueryDTO analogyQueryDTO : analogyQueryDTOS) {
|
if (assessPlanById.getEvaluateMethod() == 1){
|
RiskAssessPlanEvaluateLec lecByIdentificationId = methodCheck.lecService.getLecByIdentificationId(analogyQueryDTO.getId(), assessPlanById.getIdentificationMethod());
|
if (ObjectUtils.isEmpty(lecByIdentificationId)){
|
tag = 1;
|
}
|
//辨识方法2 - LS
|
}else if (assessPlanById.getEvaluateMethod() == 2){
|
RiskAssessPlanEvaluateLs lsByIdentificationId = methodCheck.lsService.getLsByIdentificationId(analogyQueryDTO.getId(), assessPlanById.getIdentificationMethod());
|
if (ObjectUtils.isEmpty(lsByIdentificationId)){
|
tag = 1;
|
}
|
//辨识方法3 - MES
|
}else if (assessPlanById.getEvaluateMethod() == 3){
|
RiskAssessPlanEvaluateMes mesByIdentificationId = methodCheck.mesService.getMesByIdentificationId(analogyQueryDTO.getId(), assessPlanById.getIdentificationMethod());
|
if (ObjectUtils.isEmpty(mesByIdentificationId)){
|
tag = 1;
|
}
|
//辨识方法4 - RS
|
}else if (assessPlanById.getEvaluateMethod() == 4){
|
RiskAssessPlanEvaluateRs rsByIdentificationId = methodCheck.rsService.getRsByIdentificationId(analogyQueryDTO.getId(), assessPlanById.getIdentificationMethod());
|
if (ObjectUtils.isEmpty(rsByIdentificationId)){
|
tag = 1;
|
}
|
}
|
}
|
|
}
|
|
return tag;
|
}
|
|
|
}
|