heheng
2025-05-23 761bdc5b3f17df62aae1b424f2d2dabc11e844bc
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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
package com.gkhy.labRiskManage.domain.riskReport.service.impl;
 
import com.gkhy.labRiskManage.api.controller.riskReport.dto.repDto.RiskAssessPlanEvaluateDeleteReqBO;
import com.gkhy.labRiskManage.commons.enums.MethodEnum;
import com.gkhy.labRiskManage.commons.enums.ResultCode;
import com.gkhy.labRiskManage.commons.enums.StatusEnum;
import com.gkhy.labRiskManage.commons.exception.BusinessException;
import com.gkhy.labRiskManage.commons.utils.BeanCopyUtils;
import com.gkhy.labRiskManage.domain.riskReport.entity.RiskAssessPlanEvaluateLec;
import com.gkhy.labRiskManage.domain.riskReport.model.bo.AssessLecInsertBO;
import com.gkhy.labRiskManage.domain.riskReport.model.dto.EvaluateInsertDTO;
import com.gkhy.labRiskManage.domain.riskReport.model.dto.EvaluateMethodDeleteDTO;
import com.gkhy.labRiskManage.domain.riskReport.model.dto.LecInsertDTO;
import com.gkhy.labRiskManage.domain.riskReport.model.dto.LecQueryDTO;
import com.gkhy.labRiskManage.domain.riskReport.repository.jpa.RiskAssessPlanEvaluateLecRepository;
import com.gkhy.labRiskManage.domain.riskReport.service.RiskAssessPlanEvaluateLecService;
import com.gkhy.labRiskManage.domain.riskReport.utils.IdentificationMethodCheck;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
 
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.List;
 
/**
 * 评价方法LEC
 */
@Service
public class RiskAssessPlanEvaluateLecServiceImpl implements RiskAssessPlanEvaluateLecService {
 
    @Autowired
    private RiskAssessPlanEvaluateLecRepository lecRepository;
 
 
    /**
     * 评价方法LEC - 评价插入
     */
    @Override
    public LecInsertDTO insertLec(Long currentUserId, AssessLecInsertBO lecInsertBO) {
 
        EvaluateInsertDTO insertDTO = new EvaluateInsertDTO();
        insertDTO.setResult(1);
        IdentificationMethodCheck methodCheck = new IdentificationMethodCheck();
 
        //校验辨识方法是否存在
        int result = methodCheck.identificationMethodCheck(lecInsertBO.getIdentificationId(), lecInsertBO.getIdentificationMethod());
        if (result == 0){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "辨识方法不存在");
        }
        if (ObjectUtils.isEmpty(lecInsertBO.getAssessPlanId())){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评价的计划不能为空");
        }
        if (ObjectUtils.isEmpty(lecInsertBO.getLecL())){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "LEC_L的数值不能为空");
        }
        if (ObjectUtils.isEmpty(lecInsertBO.getLecE())){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "LEC_E的数值不能为空");
        }
        if (ObjectUtils.isEmpty(lecInsertBO.getLecC())){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "LEC_C的数值不能为空");
        }
        if (ObjectUtils.isEmpty(lecInsertBO.getRiskValue())){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "风险数值不能为空");
        }
        if (ObjectUtils.isEmpty(lecInsertBO.getIdentificationId())){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "辨识方法不能为空");
        }
        if (ObjectUtils.isEmpty(lecInsertBO.getIdentificationMethod())){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "辨识方法类型不能为空");
        }
        if (ObjectUtils.isEmpty(lecInsertBO.getOriginalLecL())){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "固有LEC_L的数值不能为空");
        }
        if (ObjectUtils.isEmpty(lecInsertBO.getOriginalLecE())){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "固有LEC_E的数值不能为空");
        }
        if (ObjectUtils.isEmpty(lecInsertBO.getOriginalLecC())){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "固有LEC_C的数值不能为空");
        }
        if (ObjectUtils.isEmpty(lecInsertBO.getOriginalRiskValue())){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "固有风险数值不能为空");
        }
        RiskAssessPlanEvaluateLec lecByIdentification = lecRepository.getLecByIdentification(lecInsertBO.getIdentificationId(), lecInsertBO.getIdentificationMethod());
        if (!ObjectUtils.isEmpty(lecByIdentification)){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "该辨识已经被评价,无需重复操作");
        }
        if (ObjectUtils.isEmpty(lecInsertBO.getEvaluateDesc())){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评价专家意见不能为空");
        }
        if (ObjectUtils.isEmpty(lecInsertBO.getSafeRiskAnalysis())){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "安全风险分析内容不能为空");
        }
 
        BigDecimal valueL = lecInsertBO.getLecL();
        BigDecimal valueE = lecInsertBO.getLecE();
        BigDecimal valueC = lecInsertBO.getLecC();
        BigDecimal value = valueL.multiply(valueE).multiply(valueC);
        //BigDecimal类型比较,结果为0是相等
        if (value.compareTo(lecInsertBO.getRiskValue()) != 0){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "风险数值计算有误,无法保存");
        }
 
        RiskAssessPlanEvaluateLec lec = new RiskAssessPlanEvaluateLec();
        //设置参数
        if (value.compareTo(new BigDecimal(10)) < 0){
            lec.setRiskLevel(MethodEnum.RISK_LEVEL_1.getCode());
            lec.setRiskLevelValue(MethodEnum.RISK_LEVEL_1.getCode());
            lec.setRiskColor(MethodEnum.RISK_LEVEL_1.getCode());
        }else if (value.compareTo(new BigDecimal(MethodEnum.RISK_EVALUATE_VALUE_1.getCode())) > 0 && value.compareTo(new BigDecimal(MethodEnum.RISK_EVALUATE_VALUE_2.getCode())) < 0){
            lec.setRiskLevel(MethodEnum.RISK_LEVEL_2.getCode());
            lec.setRiskLevelValue(MethodEnum.RISK_LEVEL_2.getCode());
            lec.setRiskColor(MethodEnum.RISK_LEVEL_2.getCode());
        }else if (value.compareTo(new BigDecimal(MethodEnum.RISK_EVALUATE_VALUE_2.getCode())) > 0 && value.compareTo(new BigDecimal(MethodEnum.RISK_EVALUATE_VALUE_3.getCode())) < 0){
            lec.setRiskLevel(MethodEnum.RISK_LEVEL_3.getCode());
            lec.setRiskLevelValue(MethodEnum.RISK_LEVEL_3.getCode());
            lec.setRiskColor(MethodEnum.RISK_LEVEL_3.getCode());
        }else if (value.compareTo(new BigDecimal(MethodEnum.RISK_EVALUATE_VALUE_3.getCode())) > 0){
            lec.setRiskLevel(MethodEnum.RISK_LEVEL_4.getCode());
            lec.setRiskLevelValue(MethodEnum.RISK_LEVEL_4.getCode());
            lec.setRiskColor(MethodEnum.RISK_LEVEL_4.getCode());
        }
        LocalDateTime date = LocalDateTime.now();
        lec.setAssessPlanId(lecInsertBO.getAssessPlanId());
        lec.setIdentificationId(lecInsertBO.getIdentificationId());
        lec.setIdentificationMethod(lecInsertBO.getIdentificationMethod());
        lec.setLecL(lecInsertBO.getLecL());
        lec.setLecE(lecInsertBO.getLecE());
        lec.setLecC(lecInsertBO.getLecC());
        lec.setDeleteStatus(StatusEnum.DELETE_NOT.getCode().byteValue());
        lec.setCreateTime(date);
        lec.setUpdateTime(date);
        lec.setRiskValue(lecInsertBO.getRiskValue());
        lec.setManageLevel(lecInsertBO.getManageLevel());
        lec.setStatus((byte) 1);
        lec.setEvaluateDesc(lecInsertBO.getEvaluateDesc());
 
        lec.setEducationMeasure(lecInsertBO.getEducationMeasure());
        lec.setTechnologyMeasure(lecInsertBO.getTechnologyMeasure());
        lec.setManageMeasure(lecInsertBO.getManageMeasure());
        lec.setPersonalProtectionMeasure(lecInsertBO.getPersonalProtectionMeasure());
        lec.setEmergencyMeasure(lecInsertBO.getEmergencyMeasure());
 
        lec.setOriginalLecL(lecInsertBO.getOriginalLecL());
        lec.setOriginalLecE(lecInsertBO.getOriginalLecE());
        lec.setOriginalLecC(lecInsertBO.getOriginalLecC());
        lec.setOriginalRiskValue(lecInsertBO.getOriginalRiskValue());
        lec.setOriginalRiskLevelValue(lecInsertBO.getOriginalRiskLevelValue());
        lec.setOriginalRiskLevel(lecInsertBO.getOriginalRiskLevel());
        lec.setOriginalRiskColor(lecInsertBO.getOriginalRiskColor());
        lec.setOriginalManageLevel(lecInsertBO.getOriginalManageLevel());
        lec.setAdviseTechnologyMeasure(lecInsertBO.getAdviseTechnologyMeasure());
        lec.setAdviseManageMeasure(lecInsertBO.getAdviseManageMeasure());
        lec.setAdviseEmergencyMeasure(lecInsertBO.getAdviseEmergencyMeasure());
        lec.setAdviseEducationMeasure(lecInsertBO.getAdviseEducationMeasure());
        lec.setAdvisePersonalProtectionMeasure(lecInsertBO.getAdvisePersonalProtectionMeasure());
        lec.setSafeRiskAnalysis(lecInsertBO.getSafeRiskAnalysis());
 
        RiskAssessPlanEvaluateLec insertResult = lecRepository.save(lec);
 
        return BeanCopyUtils.copyBean(insertResult, LecInsertDTO.class);
    }
 
    /**
     * 评价方法LEC - 修改
     */
    @Override
    public LecInsertDTO updateLec(Long currentUserId, AssessLecInsertBO lecInsertBO) {
 
        EvaluateInsertDTO insertDTO = new EvaluateInsertDTO();
        insertDTO.setResult(1);
 
        if (ObjectUtils.isEmpty(lecInsertBO.getId())){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "要修改的评价内容不能为空");
        }
        RiskAssessPlanEvaluateLec lecById = lecRepository.getLecById(lecInsertBO.getId());
        if (ObjectUtils.isEmpty(lecById)){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "要修改的评价不存在");
        }
        if (ObjectUtils.isEmpty(lecInsertBO.getAssessPlanId())){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评价的计划不能为空");
        }
        if (ObjectUtils.isEmpty(lecInsertBO.getLecL())){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "LEC_L的数值不能为空");
        }
        if (ObjectUtils.isEmpty(lecInsertBO.getLecE())){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "LEC_E的数值不能为空");
        }
        if (ObjectUtils.isEmpty(lecInsertBO.getLecC())){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "LEC_C的数值不能为空");
        }
        if (ObjectUtils.isEmpty(lecInsertBO.getRiskValue())){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "风险数值不能为空");
        }
        if (ObjectUtils.isEmpty(lecInsertBO.getOriginalLecL())){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "固有LEC_L的数值不能为空");
        }
        if (ObjectUtils.isEmpty(lecInsertBO.getOriginalLecE())){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "固有LEC_E的数值不能为空");
        }
        if (ObjectUtils.isEmpty(lecInsertBO.getOriginalLecC())){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "固有LEC_C的数值不能为空");
        }
        if (ObjectUtils.isEmpty(lecInsertBO.getOriginalRiskValue())){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "固有风险数值不能为空");
        }
        if (ObjectUtils.isEmpty(lecInsertBO.getEvaluateDesc())){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评价专家意见不能为空");
        }
        if (ObjectUtils.isEmpty(lecInsertBO.getSafeRiskAnalysis())){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "安全风险分析内容不能为空");
        }
 
        BigDecimal valueL = lecInsertBO.getLecL();
        BigDecimal valueE = lecInsertBO.getLecE();
        BigDecimal valueC = lecInsertBO.getLecC();
        BigDecimal value = valueL.multiply(valueE).multiply(valueC);
        //BigDecimal类型比较,结果为0是相等
        if (value.compareTo(lecInsertBO.getRiskValue()) != 0){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "风险数值计算有误,无法保存");
        }
        //设置参数
        RiskAssessPlanEvaluateLec lec = BeanCopyUtils.copyBean(lecById, RiskAssessPlanEvaluateLec.class);
        LocalDateTime date = LocalDateTime.now();
        if (value.compareTo(new BigDecimal(10)) < 0){
            lec.setRiskLevel(MethodEnum.RISK_LEVEL_1.getCode());
            lec.setRiskLevelValue(MethodEnum.RISK_LEVEL_1.getCode());
            lec.setRiskColor(MethodEnum.RISK_LEVEL_1.getCode());
        }else if (value.compareTo(new BigDecimal(MethodEnum.RISK_EVALUATE_VALUE_1.getCode())) > 0 && value.compareTo(new BigDecimal(MethodEnum.RISK_EVALUATE_VALUE_2.getCode())) < 0){
            lec.setRiskLevel(MethodEnum.RISK_LEVEL_2.getCode());
            lec.setRiskLevelValue(MethodEnum.RISK_LEVEL_2.getCode());
            lec.setRiskColor(MethodEnum.RISK_LEVEL_2.getCode());
        }else if (value.compareTo(new BigDecimal(MethodEnum.RISK_EVALUATE_VALUE_2.getCode())) > 0 && value.compareTo(new BigDecimal(MethodEnum.RISK_EVALUATE_VALUE_3.getCode())) < 0){
            lec.setRiskLevel(MethodEnum.RISK_LEVEL_3.getCode());
            lec.setRiskLevelValue(MethodEnum.RISK_LEVEL_3.getCode());
            lec.setRiskColor(MethodEnum.RISK_LEVEL_3.getCode());
        }else if (value.compareTo(new BigDecimal(MethodEnum.RISK_EVALUATE_VALUE_3.getCode())) > 0){
            lec.setRiskLevel(MethodEnum.RISK_LEVEL_4.getCode());
            lec.setRiskLevelValue(MethodEnum.RISK_LEVEL_4.getCode());
            lec.setRiskColor(MethodEnum.RISK_LEVEL_4.getCode());
        }
        lec.setLecL(lecInsertBO.getLecL());
        lec.setLecE(lecInsertBO.getLecE());
        lec.setLecC(lecInsertBO.getLecC());
        lec.setUpdateTime(date);
        lec.setRiskValue(lecInsertBO.getRiskValue());
        lec.setManageLevel(lecInsertBO.getManageLevel());
        lec.setEvaluateDesc(lecInsertBO.getEvaluateDesc());
 
        lec.setEducationMeasure(lecInsertBO.getEducationMeasure());
        lec.setTechnologyMeasure(lecInsertBO.getTechnologyMeasure());
        lec.setManageMeasure(lecInsertBO.getManageMeasure());
        lec.setPersonalProtectionMeasure(lecInsertBO.getPersonalProtectionMeasure());
        lec.setEmergencyMeasure(lecInsertBO.getEmergencyMeasure());
 
        lec.setOriginalLecL(lecInsertBO.getOriginalLecL());
        lec.setOriginalLecE(lecInsertBO.getOriginalLecE());
        lec.setOriginalLecC(lecInsertBO.getOriginalLecC());
        lec.setOriginalRiskValue(lecInsertBO.getOriginalRiskValue());
        lec.setOriginalRiskLevelValue(lecInsertBO.getOriginalRiskLevelValue());
        lec.setOriginalRiskLevel(lecInsertBO.getOriginalRiskLevel());
        lec.setOriginalRiskColor(lecInsertBO.getOriginalRiskColor());
        lec.setOriginalManageLevel(lecInsertBO.getOriginalManageLevel());
        lec.setAdviseTechnologyMeasure(lecInsertBO.getAdviseTechnologyMeasure());
        lec.setAdviseManageMeasure(lecInsertBO.getAdviseManageMeasure());
        lec.setAdviseEmergencyMeasure(lecInsertBO.getAdviseEmergencyMeasure());
        lec.setAdviseEducationMeasure(lecInsertBO.getAdviseEducationMeasure());
        lec.setAdvisePersonalProtectionMeasure(lecInsertBO.getAdvisePersonalProtectionMeasure());
        lec.setSafeRiskAnalysis(lecInsertBO.getSafeRiskAnalysis());
 
        RiskAssessPlanEvaluateLec insertResult = lecRepository.save(lec);
 
        return BeanCopyUtils.copyBean(insertResult, LecInsertDTO.class);
    }
 
    /**
     * 评价方法LEC - 查询
     */
    @Override
    public LecQueryDTO getLecByPlanId(Long id) {
 
        RiskAssessPlanEvaluateLec lecById = lecRepository.getLecById(id);
        if (ObjectUtils.isEmpty(lecById)){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "lec评价方法不存在或已被删除");
        }
        return BeanCopyUtils.copyBean(lecById, LecQueryDTO.class);
    }
 
    /**
     * 评价方法LEC - 删除
     */
    @Override
    public EvaluateMethodDeleteDTO deleteLecByPlanId(Long currentUserId,  RiskAssessPlanEvaluateDeleteReqBO deleteReqBO) {
 
        if (ObjectUtils.isEmpty(deleteReqBO.getLecId())){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "要删除的评价项目不能为空");
        }
        RiskAssessPlanEvaluateLec lecById = lecRepository.getLecById(deleteReqBO.getLecId());
 
        if (ObjectUtils.isEmpty(lecById)){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "要删除的评价项目为空,或已被删除");
        }
        if (!lecById.getAssessPlanId().equals(deleteReqBO.getId())){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评估计划与评价项不匹配,无法删除");
        }
 
        EvaluateMethodDeleteDTO deleteDTO = new EvaluateMethodDeleteDTO();
 
        LocalDateTime date = LocalDateTime.now();
        lecById.setDeleteStatus(StatusEnum.DELETED.getCode().byteValue());
        lecById.setUpdateTime(date);
 
        RiskAssessPlanEvaluateLec deleteResult = lecRepository.save(lecById);
 
        if (ObjectUtils.isEmpty(deleteResult)){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评价方法不存在或已被删除");
        }
        deleteDTO.setResult(StatusEnum.DELETED.getCode().byteValue());
 
        return deleteDTO;
    }
 
    /**
     * 评价方法LEC - list
     */
    @Override
    public List<LecQueryDTO> listLecByPlanId(Long id) {
        List<RiskAssessPlanEvaluateLec> lecList = lecRepository.listLecByPlanId(id);
        return BeanCopyUtils.copyBeanList(lecList, LecQueryDTO.class);
    }
 
    @Override
    public List<RiskAssessPlanEvaluateLec> getLecByIds(List<Long> assessPlanIds) {
        List<RiskAssessPlanEvaluateLec> lecByIds = lecRepository.getLecByIds(assessPlanIds);
        return lecByIds;
    }
 
    @Override
    public int deleteLecByAssessPlanId(Long assessPlanId) {
 
        List<RiskAssessPlanEvaluateLec> lecList = lecRepository.getbyByAssessPlanId(assessPlanId);
        if (lecList.size() < 1){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评价方法不存在或已被删除");
        }
        int i = 0;
        for (RiskAssessPlanEvaluateLec  lec : lecList) {
            lec.setDeleteStatus(StatusEnum.DELETED.getCode().byteValue());
            RiskAssessPlanEvaluateLec save = lecRepository.save(lec);
            if (ObjectUtils.isEmpty(save)){
                i = 1;
            }
        }
        return i;
    }
 
    @Override
    public int deleteLecByPlan(Long id) {
 
        List<RiskAssessPlanEvaluateLec> lecListByPlanId = lecRepository.getLecByPlanId(id);
        if (ObjectUtils.isEmpty(lecListByPlanId)){
            return StatusEnum.SUCCESS.getCode();
        }
        for (RiskAssessPlanEvaluateLec riskAssessPlanEvaluateLec : lecListByPlanId) {
            riskAssessPlanEvaluateLec.setDeleteStatus(StatusEnum.DELETED.getCode().byteValue());
        }
        List<RiskAssessPlanEvaluateLec> result = lecRepository.saveAll(lecListByPlanId);
        if (result.size() != lecListByPlanId.size()){
            return StatusEnum.FAIL.getCode();
        }
        return StatusEnum.SUCCESS.getCode();
    }
 
    @Override
    public RiskAssessPlanEvaluateLec getLecByIdentificationId(Long identificationId, Byte identificationMethod) {
        return lecRepository.getLecByIdentification(identificationId, identificationMethod);
    }
 
    @Override
    public List<RiskAssessPlanEvaluateLec> listLecByParam(Long assessPlanId, Long identificationId, Byte identificationMethod) {
        return lecRepository.getLecByByParam(assessPlanId,identificationId,  identificationMethod);
    }
}