From 09ddc2d6e906f4ecebd5e02bd8fc381e096c2d89 Mon Sep 17 00:00:00 2001 From: pengjie <17373303529@163.com> Date: Thu, 3 Aug 2023 19:19:24 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=91=E7=9D=A3=E6=89=A7=E6=B3=95=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/InspectQuestionExamineServiceImpl.java | 17 +++++++++++++---- .../service/impl/InspectRecordServiceImpl.java | 6 ++---- 2 files changed, 15 insertions(+), 8 deletions(-) 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);