feat(printer): 实现带图像增强选项的重新打印功能

- 在 ReprintRequest 中新增 needEnhance 字段以支持图像增强
- 将 reprint 接口的实现从 controller 下移到 printerService
- 实现 handleReprint 方法,支持根据 needEnhance 条件性添加图像增强阶段
- 重构 reprint 流程,引入 Pipeline 处理图像下载、旋转、增强、水印等步骤
- 增强 reprint 异常处理,失败时回退到原始裁剪图
- 移除 ImageEnhanceStage 中对 TODO 占位符的判断逻辑
- 提供 updateTaskStatusAndPrinter 兜底方法用于无 MemberPrint 场景
This commit is contained in:
2025-11-27 16:04:40 +08:00
parent cbc0584706
commit a7ef2cb35a
5 changed files with 168 additions and 6 deletions

View File

@@ -71,7 +71,7 @@ public class ImageEnhanceStage extends AbstractPipelineStage<PhotoProcessContext
File currentFile = context.getCurrentFile();
if (currentFile == null || !currentFile.exists()) {
return StageResult.failed("当前文件不存在");
return StageResult.skipped("当前文件不存在");
}
try {
@@ -137,10 +137,9 @@ public class ImageEnhanceStage extends AbstractPipelineStage<PhotoProcessContext
String apiKey = enhancerConfig.getApiKey();
String secretKey = enhancerConfig.getSecretKey();
// 检查是否还是TODO占位符
if (appId == null || appId.startsWith("TODO_") ||
apiKey == null || apiKey.startsWith("TODO_") ||
secretKey == null || secretKey.startsWith("TODO_")) {
if (appId == null ||
apiKey == null ||
secretKey == null) {
return false;
}