| | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | /** |
| | | * @ClassName TbAttResWaterBlockServiceImpl |
| | |
| | | // 创建或更新数据 |
| | | 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; |
| | | } |
| | | // 返回 |
| | |
| | | if (addList.size()>0){ |
| | | // 批量新增 |
| | | 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){ |
| | | // 批量删除 |
| | |
| | | // 更新审核日志 |
| | | setUpdateCheckLog(oldList,newList); |
| | | // 更新数据 |
| | | boolean batch = updateBatchById(newList); |
| | | List<TbAttResWaterBlock> updateList = Stream.concat(oldList.stream(),newList.stream()) |
| | | .collect(Collectors.toMap(TbAttResWaterBlock::getGuid, Function.identity(),(oldValue, newValue) -> { |
| | | oldValue.setCheckState(newValue.getCheckState()); |
| | | return oldValue; |
| | | } |
| | | )) |
| | | .values() |
| | | .stream() |
| | | .collect(Collectors.toList()); |
| | | boolean batch = updateBatchById(updateList); |
| | | if (batch){ |
| | | if (!edit) { |
| | | tbAttResBaseService.updateFinalState(newList.get(0).getResGuid(), newList.get(0).getCheckState()); |