refactor(storage): 简化存储适配器配置逻辑并移除降级机制

- 移除默认存储配置常量 DEFAULT_STORAGE
- 简化 UploadStage 中的存储适配器获取逻辑,直接使用 StorageFactory.use()
- 移除降级到默认存储的处理机制
- 在 PuzzleGenerateServiceImpl 中复用存储适配器实例
- 移除 SourceRepository 中的 StorageUnsupportedException 导入
- 移除 GoodsServiceImpl 中的 StorageType 枚举导入
- 移除 SourceServiceImpl 中的 ScenicService 依赖注入
- 移除 PrinterServiceImpl 中的复杂存储适配器配置逻辑
- 在 TaskTaskServiceImpl 中统一使用景点存储适配器
- 在 FaceCleaner 中添加新的存储清理逻辑,使用独立的图片存储适配器
- 添加 sourceImageUrlMap 和 sourceScenicIdMap 来优化文件清理逻辑
This commit is contained in:
2026-02-05 14:16:16 +08:00
parent a85d6b0ead
commit 95c82cfcf2
8 changed files with 66 additions and 102 deletions

View File

@@ -468,12 +468,14 @@ public class PuzzleGenerateServiceImpl implements IPuzzleGenerateService {
// 上传到OSS
try (FileInputStream fis = new FileInputStream(qrcode)) {
String fileName = String.format("qrcode_%d.jpg", faceId);
boolean exists = StorageFactory.use().isExists("puzzle", "wechat_qrcode", fileName);
var storageAdapter = StorageFactory.use();
boolean exists = storageAdapter.isExists("puzzle", "wechat_qrcode", fileName);
if (exists) {
log.debug("微信小程序二维码已存在, 不重复上传: faceId={}, url={}", faceId, StorageFactory.use().getUrl("puzzle", "wechat_qrcode", fileName));
return StorageFactory.use().getUrl("puzzle", "wechat_qrcode", fileName);
String url = storageAdapter.getUrl("puzzle", "wechat_qrcode", fileName);
log.debug("微信小程序二维码已存在, 不重复上传: faceId={}, url={}", faceId, url);
return url;
}
return StorageFactory.use().uploadFile(
return storageAdapter.uploadFile(
"image/jpeg",
fis,
"puzzle",