Browse Source

修改预案的修改操作

develop
Mr.Wang 7 months ago
parent
commit
537eb81aff
  1. 23
      zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java

23
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) { public int updateDcEmergencyPlans(DcEmergencyPlans dcEmergencyPlans) {
dcEmergencyPlans.setUpdateTime(DateUtils.getNowDate()); dcEmergencyPlans.setUpdateTime(DateUtils.getNowDate());
List<DcExecuteAction> dcExecuteActionList = dataProcessing(dcEmergencyPlans); List<DcExecuteAction> dcExecuteActionList = dataProcessing(dcEmergencyPlans);
// 修改事件预案表数据
dcEmergencyPlansMapper.updateDcEmergencyPlans(dcEmergencyPlans);
// 修改执行操作表数据 // 修改执行操作表数据
dcExecuteActionList.forEach(dcExecuteAction -> dcExecuteAction.setUpdateTime(DateUtils.getNowDate())); dcExecuteActionList.stream()
// 过滤出删除掉的操作
String dcExecuteActionId = dcExecuteActionList.stream()
.filter(dcExecuteAction -> dcExecuteAction.getId() != null) .filter(dcExecuteAction -> dcExecuteAction.getId() != null)
.map(DcExecuteAction::getEmergencyPlansId) .forEach(dcExecuteAction -> dcExecuteAction.setUpdateTime(DateUtils.getNowDate()));
.map(String::valueOf) // 过滤出删除掉的操作
.findFirst()
.orElse(null);
List<String> ids = dcExecuteActionList.stream() List<String> ids = dcExecuteActionList.stream()
.filter(dcExecuteAction -> dcExecuteAction.getId() != null) .filter(dcExecuteAction -> dcExecuteAction.getId() != null)
.map(DcExecuteAction::getId) .map(DcExecuteAction::getId)
.collect(Collectors.toList()); .collect(Collectors.toList());
// 查询出事件预案关联的操作 // 查询出事件预案关联的操作
List<String> dcExecuteActionIdList = dcExecuteActionService.selectDcExecuteActionByEmergencyPlansId(dcExecuteActionId); List<String> dcExecuteActionIdList = dcExecuteActionService.selectDcExecuteActionByEmergencyPlansId(dcEmergencyPlans.getId().toString());
List<String> commonIds = new ArrayList<>(ids); List<String> commonIds = new ArrayList<>(ids);
commonIds.retainAll(dcExecuteActionIdList); commonIds.retainAll(dcExecuteActionIdList);
@ -1087,8 +1081,15 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
insertDcExecuteActionList.forEach(dcExecuteAction -> dcExecuteAction.setCreateTime(DateUtils.getNowDate())); insertDcExecuteActionList.forEach(dcExecuteAction -> dcExecuteAction.setCreateTime(DateUtils.getNowDate()));
dcExecuteActionService.insertDcExecuteActionBatch(insertDcExecuteActionList); dcExecuteActionService.insertDcExecuteActionBatch(insertDcExecuteActionList);
} }
List<DcExecuteAction> 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);
} }
/** /**

Loading…
Cancel
Save