| | |
| | | |
| | | import cn.gistack.sm.intelligentCall.entity.Scene; |
| | | import cn.gistack.sm.sjztmd.entity.TbAttResPowerStation; |
| | | import cn.gistack.sm.sjztmd.entity.TbAttResWaterDelivery; |
| | | import cn.gistack.sm.sjztmd.mapper.TbAttResPowerStationMapper; |
| | | import cn.gistack.sm.sjztmd.service.ITbAttResBaseService; |
| | | import cn.gistack.sm.sjztmd.service.ITbAttResPowerStationService; |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | /** |
| | | * @ClassName TbAttResPowerStationServiceImpl |
| | |
| | | // 创建或更新数据 |
| | | boolean flag = addOrUpdate(oldList,newList); |
| | | if (flag){ |
| | | if (!edit) { |
| | | tbAttResBaseService.updateFinalState(newList.get(0).getResGuid(), 0); |
| | | } |
| | | // if (!edit) { |
| | | // tbAttResBaseService.updateFinalState(newList.get(0).getResGuid(), 0); |
| | | // } |
| | | return true; |
| | | } |
| | | // 返回 |
| | |
| | | //如果是中途管理员编辑新增了一个,将状态设置为和原有的状态一致 |
| | | // 批量新增 |
| | | addFlag = saveBatch(addList); |
| | | tbAttResBaseService.updateFinalState(addList.get(0).getResGuid(),addList.get(0).getCheckState()); |
| | | } |
| | | if (updateList.size()>0){ |
| | | // 批量更新 |
| | | addFlag = updateBatchById(updateList); |
| | | tbAttResBaseService.updateFinalState(updateList.get(0).getResGuid(),updateList.get(0).getCheckState()); |
| | | } |
| | | if (removeList.size()>0){ |
| | | // 批量删除 |
| | |
| | | setUpdateLog(oldList,newList); |
| | | // 更新审核日志 |
| | | setUpdateCheckLog(oldList,newList); |
| | | |
| | | // 取旧数据和新提交数据交集--更新 |
| | | List<TbAttResPowerStation> updateList = Stream.concat(oldList.stream(),newList.stream()) |
| | | .collect(Collectors.toMap(TbAttResPowerStation::getGuid, Function.identity(),(oldValue, newValue) -> { |
| | | oldValue.setCheckState(newValue.getCheckState()); |
| | | return oldValue; |
| | | } |
| | | )) |
| | | .values() |
| | | .stream() |
| | | .collect(Collectors.toList()); |
| | | |
| | | |
| | | // 更新数据 |
| | | boolean batch = updateBatchById(newList); |
| | | boolean batch = updateBatchById(updateList); |
| | | if (batch){ |
| | | if (!edit) { |
| | | tbAttResBaseService.updateFinalState(newList.get(0).getResGuid(), newList.get(0).getCheckState()); |