| | |
| | | */ |
| | | @Override |
| | | public boolean updateSection(StandardProductList list) { |
| | | // 根据id 查询到原始值 |
| | | StandardProductList standardProductList = standardProductListMapper.selectById(list.getId()); |
| | | if(ObjectUtils.isEmpty(standardProductList)){ |
| | | throw new RuntimeException("更新失败,未查找到检查项"); |
| | | } |
| | | // 判断当前状态 如果是审核中 |
| | | if(StandardProductListChcekTypeEnums.CHECK_ING.getCode().equals(list.getCheckStatus())){ |
| | | throw new RuntimeException("审核中不支持修改"); |
| | | } |
| | | // 查询最新的一次关联备份 如果存在说明未审核完继续修改了。不做数据处理。 |
| | | StandardProductListBackupRel standardProductListBackupRel = standardProductListBackupRelMapper.selectById(list.getId()); |
| | | if(ObjectUtils.isEmpty(standardProductListBackupRel)){ |
| | | StandardProductListBackupRel productListBackupRel = new StandardProductListBackupRel(); |
| | | BeanUtils.copyProperties(standardProductList, productListBackupRel); |
| | | standardProductListBackupRelMapper.insert(productListBackupRel); |
| | | } |
| | | // 修改状态 |
| | | list.setCheckStatus(StandardProductListChcekTypeEnums.WAIT_CHECK.getCode()); |
| | | standardProductListMapper.updateSection(list); |
| | | return true; |
| | | } |
| | |
| | | QueryWrapper<StandardProductList> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("check_status",StandardProductListChcekTypeEnums.WAIT_CHECK.getCode()); |
| | | List<StandardProductList> unCheckStandardProductListArray = standardProductListMapper.selectList(queryWrapper); |
| | | |
| | | if(CollectionUtils.isEmpty(unCheckStandardProductListArray)){ |
| | | throw new RuntimeException("暂无修改数据"); |
| | | } |
| | | List<Long> standardProductListIds = new ArrayList<>(); |
| | | // 插入修改记录 |
| | | standardProductListUpdateRecordMapper.insert(standardProductListUpdateRecord); |
| | |
| | | } |
| | | standardProductListUpdateRecordMapper.updateById(standardProductListUpdateRecord); |
| | | } |
| | | |
| | | /** |
| | | * 查询标准库是否存在审核中状态 |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean existCheckingRecord() { |
| | | QueryWrapper<StandardProductListUpdateRecord> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("check_status",StandardProductListChcekTypeEnums.CHECK_ING.getCode()); |
| | | List<StandardProductListUpdateRecord> standardProductListUpdateRecordList = standardProductListUpdateRecordMapper.selectList(queryWrapper); |
| | | if(CollectionUtils.isEmpty(standardProductListUpdateRecordList)){ |
| | | return false; |
| | | }else { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |