From 537eb81aff5d331a3de5a71a655e4e8079436f86 Mon Sep 17 00:00:00 2001 From: "Mr.Wang" Date: Tue, 14 May 2024 17:40:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A2=84=E6=A1=88=E7=9A=84?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/DcEmergencyPlansServiceImpl.java | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java index 156e68a0..4784ce2f 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java @@ -1051,23 +1051,17 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { public int updateDcEmergencyPlans(DcEmergencyPlans dcEmergencyPlans) { dcEmergencyPlans.setUpdateTime(DateUtils.getNowDate()); List dcExecuteActionList = dataProcessing(dcEmergencyPlans); - // 修改事件预案表数据 - dcEmergencyPlansMapper.updateDcEmergencyPlans(dcEmergencyPlans); // 修改执行操作表数据 - dcExecuteActionList.forEach(dcExecuteAction -> dcExecuteAction.setUpdateTime(DateUtils.getNowDate())); - // 过滤出删除掉的操作 - String dcExecuteActionId = dcExecuteActionList.stream() + dcExecuteActionList.stream() .filter(dcExecuteAction -> dcExecuteAction.getId() != null) - .map(DcExecuteAction::getEmergencyPlansId) - .map(String::valueOf) - .findFirst() - .orElse(null); + .forEach(dcExecuteAction -> dcExecuteAction.setUpdateTime(DateUtils.getNowDate())); + // 过滤出删除掉的操作 List ids = dcExecuteActionList.stream() .filter(dcExecuteAction -> dcExecuteAction.getId() != null) .map(DcExecuteAction::getId) .collect(Collectors.toList()); // 查询出事件预案关联的操作 - List dcExecuteActionIdList = dcExecuteActionService.selectDcExecuteActionByEmergencyPlansId(dcExecuteActionId); + List dcExecuteActionIdList = dcExecuteActionService.selectDcExecuteActionByEmergencyPlansId(dcEmergencyPlans.getId().toString()); List commonIds = new ArrayList<>(ids); commonIds.retainAll(dcExecuteActionIdList); @@ -1087,8 +1081,15 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { insertDcExecuteActionList.forEach(dcExecuteAction -> dcExecuteAction.setCreateTime(DateUtils.getNowDate())); dcExecuteActionService.insertDcExecuteActionBatch(insertDcExecuteActionList); } + List updateDcExecuteAction = dcExecuteActionList.stream() + .filter(dcExecuteAction -> dcExecuteAction.getId() != null) + .collect(Collectors.toList()); + if (updateDcExecuteAction.size() > 0) { + dcExecuteActionService.updateDcExecuteActionBatch(updateDcExecuteAction); + } - return dcExecuteActionService.updateDcExecuteActionBatch(dcExecuteActionList); + // 修改事件预案表数据 + return dcEmergencyPlansMapper.updateDcEmergencyPlans(dcEmergencyPlans); } /**