diff --git a/src/main/java/com/zhgd/xmgl/modules/safety/service/impl/InspectQuestionExamineServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/safety/service/impl/InspectQuestionExamineServiceImpl.java index 0c43a0b..5dfca43 100644 --- a/src/main/java/com/zhgd/xmgl/modules/safety/service/impl/InspectQuestionExamineServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/safety/service/impl/InspectQuestionExamineServiceImpl.java @@ -33,25 +33,24 @@ public class InspectQuestionExamineServiceImpl extends ServiceImpl wrapperQuestion = Wrappers.lambdaUpdate(); wrapperQuestion.set(InspectQuestion::getState, inspectQuestionExamine.getExamineState() == 1 ? 3 : 4); - wrapperQuestion.set(InspectQuestion::getLevel, level); + wrapperQuestion.set(InspectQuestion::getLevel, inspectQuestionExamine.getLevel()); wrapperQuestion.eq(InspectQuestion::getId, inspectQuestionExamine.getInspectQuestionId()); inspectQuestionService.update(wrapperQuestion); // 查询是否全部整改完成 InspectQuestion inspectQuestion = inspectQuestionService.getById(inspectQuestionExamine.getInspectQuestionId()); List inspectQuestions = inspectQuestionService.list(Wrappers.lambdaQuery().eq(InspectQuestion::getRecordId, inspectQuestion.getRecordId())); Integer state = 3; - if (inspectQuestions.stream().filter(i -> i.getState() == 3).collect(Collectors.toList()).size() == inspectQuestions.size()) { + if (inspectQuestions.stream().filter(i -> i.getState() == 3 && i.getLevel() == 2).collect(Collectors.toList()).size() == inspectQuestions.size()) { state = 4; } else if (inspectQuestions.stream().filter(i -> i.getState() < 3).collect(Collectors.toList()).size() == 0) { state = 5; } if (state != 3) { LambdaUpdateWrapper recordWrapper = Wrappers.lambdaUpdate(); - recordWrapper.set(InspectRecord::getLevel, level); + recordWrapper.set(InspectRecord::getLevel, inspectQuestionExamine.getLevel()); recordWrapper.set(InspectRecord::getState, state); recordWrapper.eq(InspectRecord::getId, inspectQuestion.getRecordId()); inspectRecordService.update(recordWrapper); @@ -63,8 +62,18 @@ public class InspectQuestionExamineServiceImpl extends ServiceImpl wrapperQuestion = Wrappers.lambdaUpdate(); wrapperQuestion.set(InspectQuestion::getState, 2); + wrapperQuestion.set(InspectQuestion::getLevel, 1); wrapperQuestion.eq(InspectQuestion::getId, inspectQuestionExamine.getInspectQuestionId()); inspectQuestionService.update(wrapperQuestion); + InspectQuestion inspectQuestion = inspectQuestionService.getById(inspectQuestionExamine.getInspectQuestionId()); + List inspectQuestions = inspectQuestionService.list(Wrappers.lambdaQuery().eq(InspectQuestion::getRecordId, inspectQuestion.getRecordId())); + if (inspectQuestions.stream().filter(i -> i.getState() == 2 || i.getState() == 3).collect(Collectors.toList()).size() == inspectQuestions.size()) { + LambdaUpdateWrapper recordWrapper = Wrappers.lambdaUpdate(); + recordWrapper.set(InspectRecord::getLevel, 1); + recordWrapper.set(InspectRecord::getState, 3); + recordWrapper.eq(InspectRecord::getId, inspectQuestion.getRecordId()); + inspectRecordService.update(recordWrapper); + } return this.save(inspectQuestionExamine); } } diff --git a/src/main/java/com/zhgd/xmgl/modules/safety/service/impl/InspectRecordServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/safety/service/impl/InspectRecordServiceImpl.java index 2857ab8..468532c 100644 --- a/src/main/java/com/zhgd/xmgl/modules/safety/service/impl/InspectRecordServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/safety/service/impl/InspectRecordServiceImpl.java @@ -145,7 +145,6 @@ public class InspectRecordServiceImpl extends ServiceImpl list = Arrays.asList(1,4); @@ -157,12 +156,11 @@ public class InspectRecordServiceImpl extends ServiceImpl wrapperQuestion = Wrappers.lambdaUpdate(); wrapperQuestion.set(InspectQuestion::getState, questionState); - wrapperQuestion.set(InspectQuestion::getLevel, level); + wrapperQuestion.set(InspectQuestion::getLevel, inspectRecord.getLevel()); wrapperQuestion.eq(InspectQuestion::getRecordId, inspectRecord.getId()); wrapperQuestion.eq(InspectQuestion::getState, inspectRecord.getLevel() == 1 ? 2 : 3); boolean flag = inspectQuestionService.update(wrapperQuestion); @@ -174,7 +172,7 @@ public class InspectRecordServiceImpl extends ServiceImpl wrapper = Wrappers.lambdaUpdate(); wrapper.set(InspectQuestionExamine::getExamineState, questionExamineState); wrapper.set(InspectQuestionExamine::getSuggest, suggest); - wrapper.set(InspectQuestionExamine::getLevel, level); + wrapper.set(InspectQuestionExamine::getLevel, inspectRecord.getLevel()); wrapper.in(InspectQuestionExamine::getInspectQuestionId, questionId); wrapper.eq(InspectQuestionExamine::getExamineState, 0); inspectQuestionExamineService.update(wrapper);