heheng
2025-05-16 8485affcb0d4de05059d80cb1e844d6b18291654
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
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;
    }
}