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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
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;
    }
 
 
}