You've already forked FrameTour-BE
- 新增Crop和PrinterOrderItem模型用于封装裁剪信息和打印订单项 - 实现基于Pipeline模式的照片处理流程,支持普通照片和拼图处理 - 添加多个处理阶段:下载、方向检测、条件旋转、水印、恢复方向、上传和清理 - 创建PipelineBuilder用于动态构建处理管线 - 实现抽象Stage基类和具体Stage实现类 - 添加Stage执行结果管理和异常处理机制 - 优化照片处理逻辑,使用管线替代原有复杂的嵌套处理代码 - 支持通过景区配置管理水印类型、存储适配器等参数 - 提供临时文件管理工具确保处理过程中文件及时清理 - 增强日志记录和错误处理能力,提升系统可维护性
43 lines
1.1 KiB
Java
43 lines
1.1 KiB
Java
package com.ycwl.basic.model;
|
|
|
|
import com.ycwl.basic.model.pc.printer.resp.MemberPrintResp;
|
|
import com.ycwl.basic.utils.JacksonUtil;
|
|
import lombok.Data;
|
|
|
|
/**
|
|
* 打印订单项(用于管线处理)
|
|
*/
|
|
@Data
|
|
public class PrinterOrderItem {
|
|
|
|
private Long id;
|
|
private Long sourceId;
|
|
private String cropUrl;
|
|
private Crop crop;
|
|
|
|
/**
|
|
* 从MemberPrintResp转换
|
|
*/
|
|
public static PrinterOrderItem fromMemberPrintResp(MemberPrintResp resp) {
|
|
PrinterOrderItem item = new PrinterOrderItem();
|
|
item.setId(resp.getId() != null ? resp.getId().longValue() : null);
|
|
item.setSourceId(resp.getSourceId());
|
|
item.setCropUrl(resp.getCropUrl());
|
|
|
|
if (resp.getCrop() != null) {
|
|
try {
|
|
Crop crop = new Crop();
|
|
Integer rotation = JacksonUtil.getInt(resp.getCrop(), "rotation");
|
|
if (rotation != null) {
|
|
crop.setRotation(rotation);
|
|
}
|
|
item.setCrop(crop);
|
|
} catch (Exception e) {
|
|
// 解析失败,crop为null
|
|
}
|
|
}
|
|
|
|
return item;
|
|
}
|
|
}
|