package com.gkhy.labRiskManage.domain.riskReport.utils;
|
|
import com.gkhy.labRiskManage.domain.riskReport.entity.*;
|
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;
|
|
@Component
|
public class IdentificationMethodCheck {
|
|
@Autowired
|
private RiskAssessPlanIdentificationAnalogyService analogyService;
|
@Autowired
|
private RiskAssessPlanIdentificationHazopService hazopService;
|
@Autowired
|
private RiskAssessPlanIdentificationJhaService jhaService;
|
@Autowired
|
private RiskAssessPlanIdentificationPhaService phaService;
|
@Autowired
|
private RiskAssessPlanIdentificationSclService sclService;
|
|
|
private static IdentificationMethodCheck 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;
|
}
|
|
public static int identificationMethodCheck(Long identificationId, Byte identificationMethod){
|
|
/**
|
* 辨识方法:1-PHA;2-JHA;3-SCL;4-HAZOP;5-类比法analogy
|
* */
|
int tag = 1;
|
switch (identificationMethod){
|
case 1 :
|
RiskAssessPlanIdentificationPha phaByPlanId = methodCheck.phaService.checkPhaByPlanId(identificationId);
|
if (ObjectUtils.isEmpty(phaByPlanId)){
|
tag = 0;
|
}
|
break;
|
case 2:
|
RiskAssessPlanIdentificationJha jhaByPlanId = methodCheck.jhaService.checkJhaByPlanId(identificationId);
|
if (ObjectUtils.isEmpty(jhaByPlanId)){
|
tag = 0;
|
}
|
break;
|
case 3:
|
RiskAssessPlanIdentificationScl sclByPlanId = methodCheck.sclService.checkSclByPlanId(identificationId);
|
if (ObjectUtils.isEmpty(sclByPlanId)){
|
tag = 0;
|
}
|
break;
|
case 4:
|
RiskAssessPlanIdentificationHazop hazopByPlanId = methodCheck.hazopService.checkHazopByPlanId(identificationId);
|
if (ObjectUtils.isEmpty(hazopByPlanId)){
|
tag = 0;
|
}
|
break;
|
case 5:
|
RiskAssessPlanIdentificationAnalogy analogyByPlanId = methodCheck.analogyService.checkAnalogyByPlanId(identificationId);
|
if (ObjectUtils.isEmpty(analogyByPlanId)){
|
tag = 0;
|
}
|
break;
|
}
|
|
return tag;
|
}
|
}
|