| | |
| | | import cn.gistack.sm.sjztmd.entity.TbAttResWaterBlock; |
| | | import cn.gistack.sm.sjztmd.entity.TbAttResWaterBlock; |
| | | import cn.gistack.sm.sjztmd.mapper.TbAttResWaterBlockMapper; |
| | | import cn.gistack.sm.sjztmd.service.ITbAttResBaseService; |
| | | import cn.gistack.sm.sjztmd.service.ITbAttResWaterBlockService; |
| | | import cn.gistack.system.user.feign.IUserClient; |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | |
| | | 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 |
| | |
| | | |
| | | @Autowired |
| | | private IUserClient userClient; |
| | | |
| | | @Autowired |
| | | private ITbAttResBaseService tbAttResBaseService; |
| | | |
| | | /** |
| | | * 查询水库填报详情信息 |
| | |
| | | */ |
| | | @Override |
| | | public boolean updateByGuid(List<TbAttResWaterBlock> newList) { |
| | | boolean edit = false; |
| | | // 编辑标记 |
| | | if (newList.get(0).getCheckState()==4){ |
| | | edit = true; |
| | | } |
| | | // 查询是否存在 |
| | | List<TbAttResWaterBlock> oldList = baseMapper.getDetailByResGuid(newList.get(0).getResGuid()); |
| | | // 更新日志 |
| | | setUpdateLog(oldList,newList); |
| | | // 创建或更新数据 |
| | | boolean flag = addOrUpdate(oldList,newList); |
| | | if (flag){ |
| | | // if (!edit) { |
| | | // tbAttResBaseService.updateFinalState(newList.get(0).getResGuid(), 0); |
| | | // } |
| | | return true; |
| | | } |
| | | // 返回 |
| | | return flag; |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | |
| | | 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){ |
| | | // 批量删除 |
| | |
| | | */ |
| | | @Override |
| | | public boolean auditByGuid(List<TbAttResWaterBlock> newList) { |
| | | boolean edit = false; |
| | | // 编辑标记 |
| | | if (newList.get(0).getCheckState()==4){ |
| | | edit = true; |
| | | } |
| | | // 查询是否存在 |
| | | List<TbAttResWaterBlock> oldList = baseMapper.getDetailByResGuid(newList.get(0).getResGuid()); |
| | | // 更新操作日志 |
| | |
| | | // 更新审核日志 |
| | | 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()); |
| | | } |
| | | return true; |
| | | } |
| | | // 返回 |
| | | return batch; |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | |
| | | if (newTbAttResWaterBlock.getCheckState()==4){ |
| | | fillName = "编辑"; |
| | | // 找到相关的 guid 数据 |
| | | for (TbAttResWaterBlock tbAttResWaterBlock : oldList) { |
| | | if (tbAttResWaterBlock.getGuid().equals(newTbAttResWaterBlock.getGuid())){ |
| | | newTbAttResWaterBlock.setCheckState(tbAttResWaterBlock.getCheckState()); |
| | | } |
| | | if (oldList.size()>0){ |
| | | newTbAttResWaterBlock.setCheckState(oldList.get(0).getCheckState()); |
| | | } |
| | | } |
| | | |