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

@@ -19,7 +19,6 @@ import com.ycwl.basic.pricing.enums.VoucherDiscountType;
import com.ycwl.basic.pricing.service.IVoucherService;
import com.ycwl.basic.storage.StorageFactory;
import com.ycwl.basic.storage.adapters.IStorageAdapter;
import com.ycwl.basic.storage.exceptions.StorageUnsupportedException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
@@ -154,14 +153,7 @@ public class SourceRepository {
.build();
context.enableStage("image_sr");
context.enableStage("image_enhance");
ScenicConfigManager configManager = scenicRepository.getScenicConfigManager(source.getScenicId());
IStorageAdapter adapter;
try {
adapter = StorageFactory.get(configManager.getString("store_type"));
adapter.loadConfig(configManager.getObject("store_config_json", Map.class));
} catch (StorageUnsupportedException ignored) {
adapter = StorageFactory.use("assets-ext");
}
IStorageAdapter adapter = StorageFactory.use();
context.setStorageAdapter(adapter);
// 2. 设置结果URL回调 - 更新source记录