| | |
| | | return save(file); |
| | | } |
| | | |
| | | public boolean deleteFile(Long fileId) { |
| | | IpVolumeFile byId = getById(fileId); |
| | | String bucketName; |
| | | if (SecurityUtils.getClientId() == null) { |
| | | bucketName = MinIoConstant.ADMIN_BROADCAST_FILE.getBucketName(); |
| | | } else { |
| | | bucketName = MinIoConstant.BROADCAST_FILE.getBucketName() + SecurityUtils.getUserId(); |
| | | } |
| | | if (byId == null) { |
| | | throw new BusinessException("找不到对应文件"); |
| | | } |
| | | boolean b = minIoUtil.deleteFile(bucketName, byId.getFileName()); |
| | | public boolean deleteFile(List<Long> fileIds) { |
| | | fileIds.forEach(fileId -> { |
| | | IpVolumeFile byId = getById(fileId); |
| | | String bucketName; |
| | | if (SecurityUtils.getClientId() == null) { |
| | | bucketName = MinIoConstant.ADMIN_BROADCAST_FILE.getBucketName(); |
| | | } else { |
| | | bucketName = MinIoConstant.BROADCAST_FILE.getBucketName() + SecurityUtils.getUserId(); |
| | | } |
| | | if (byId == null) { |
| | | throw new BusinessException("找不到对应文件"); |
| | | } |
| | | boolean b = minIoUtil.deleteFile(bucketName, byId.getFileName()); |
| | | // if (!b) { |
| | | // throw new BusinessException("服务器删除失败"); |
| | | // } |
| | | /** |
| | | * 音柱文件删除 日志记录开始 |
| | | */ |
| | | String content = "删除文件id:" + fileId + "音柱文件名称:" + byId.getFileName() + ",文件大小:" + byId.getOriginSize() + ",文件路径:" + byId.getFileUrl(); |
| | | StoreOperationRecordsUtils.storeOperationData(null, null, "音柱文件删除", content); |
| | | /** |
| | | * 音柱文件删除 日志记录结束 |
| | | */ |
| | | /** |
| | | * 音柱文件删除 日志记录开始 |
| | | */ |
| | | String content = "删除文件id:" + fileId + "音柱文件名称:" + byId.getFileName() + ",文件大小:" + byId.getOriginSize() + ",文件路径:" + byId.getFileUrl(); |
| | | StoreOperationRecordsUtils.storeOperationData(null, null, "音柱文件删除", content); |
| | | /** |
| | | * 音柱文件删除 日志记录结束 |
| | | */ |
| | | |
| | | return removeById(fileId); |
| | | }); |
| | | return removeByIds(fileIds); |
| | | } |
| | | |
| | | public List<IpVolumeFile> ipVolumeFileList(BaseConditionVO baseConditionVO, String keyword, Integer order, Integer seq) { |