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); } /**