feat(printer): 添加图片类型字段支持不同来源图片处理

- 在 MemberPrintEntity 和 MemberPrintResp 中新增 imageType 字段
- 根据 sourceId 自动设置图片类型为移动上传或普通照片
- 拼图类型图片明确标记为 PUZZLE 类型
- 修改图片来源判断逻辑从 sourceId 改为 imageType 字段
- 更新数据库映射文件添加 image_type 字段映射
This commit is contained in:
2026-01-17 02:45:14 +08:00
parent 2efc66292e
commit f2c739160a
4 changed files with 17 additions and 10 deletions

View File

@@ -16,6 +16,7 @@ public class MemberPrintEntity {
private Long memberId; private Long memberId;
private Long faceId; private Long faceId;
private Long sourceId; private Long sourceId;
private String imageType;
private String origUrl; private String origUrl;
private String cropUrl; private String cropUrl;
private String printUrl; private String printUrl;

View File

@@ -9,6 +9,7 @@ public class MemberPrintResp {
private Integer id; private Integer id;
private Long scenicId; private Long scenicId;
private Long sourceId; private Long sourceId;
private String imageType;
private String scenicName; private String scenicName;
private Long faceId; private Long faceId;
private Long memberId; private Long memberId;

View File

@@ -313,6 +313,8 @@ public class PrinterServiceImpl implements PrinterService {
entity.setScenicId(scenicId); entity.setScenicId(scenicId);
entity.setFaceId(faceId); entity.setFaceId(faceId);
entity.setSourceId(sourceId); entity.setSourceId(sourceId);
// 根据 sourceId 判断图片类型
entity.setImageType(sourceId == null ? ImageType.MOBILE_UPLOAD.getCode() : ImageType.NORMAL_PHOTO.getCode());
entity.setOrigUrl(url); entity.setOrigUrl(url);
// 获取打印尺寸 // 获取打印尺寸
@@ -596,6 +598,7 @@ public class PrinterServiceImpl implements PrinterService {
entity.setScenicId(scenicId); entity.setScenicId(scenicId);
entity.setFaceId(faceId); entity.setFaceId(faceId);
entity.setSourceId(id); entity.setSourceId(id);
entity.setImageType(ImageType.NORMAL_PHOTO.getCode());
entity.setOrigUrl(url); entity.setOrigUrl(url);
// 获取打印尺寸并裁剪图片 // 获取打印尺寸并裁剪图片
@@ -945,19 +948,18 @@ public class PrinterServiceImpl implements PrinterService {
context.setStageState("image_enhance", true); context.setStageState("image_enhance", true);
} }
// 根据sourceId判断图片来源和source类型 // 根据 imageType 字段判断图片类型
SourceEntity source = null; SourceEntity source = null;
if (item.getSourceId() != null && item.getSourceId() > 0) { if (ImageType.PUZZLE.getCode().equals(item.getImageType())) {
source = sourceMapper.getEntity(item.getSourceId()); context.setImageType(ImageType.PUZZLE);
if (source == null) { } else if (ImageType.MOBILE_UPLOAD.getCode().equals(item.getImageType())) {
context.setImageType(ImageType.PUZZLE); // 特殊
} else {
context.setSource(ImageSource.IPC);
}
} else if (item.getSourceId() == null) {
context.setSource(ImageSource.PHONE); context.setSource(ImageSource.PHONE);
} else { } else {
context.setSource(ImageSource.UNKNOWN); // 普通照片,查询 source 获取设备类型信息
context.setSource(ImageSource.IPC);
if (item.getSourceId() != null && item.getSourceId() > 0) {
source = sourceMapper.getEntity(item.getSourceId());
}
} }
Pipeline<PhotoProcessContext> pipeline; Pipeline<PhotoProcessContext> pipeline;
@@ -1545,6 +1547,7 @@ public class PrinterServiceImpl implements PrinterService {
entity.setScenicId(scenicId); entity.setScenicId(scenicId);
entity.setFaceId(faceId); entity.setFaceId(faceId);
entity.setSourceId(puzzleRecordId); // 使用拼图记录ID作为sourceId entity.setSourceId(puzzleRecordId); // 使用拼图记录ID作为sourceId
entity.setImageType(ImageType.PUZZLE.getCode()); // 明确标记为拼图类型
entity.setOrigUrl(resultImageUrl); entity.setOrigUrl(resultImageUrl);
// 获取打印尺寸并裁剪图片 // 获取打印尺寸并裁剪图片

View File

@@ -114,6 +114,7 @@
scenic_id, scenic_id,
face_id, face_id,
source_id, source_id,
image_type,
orig_url, orig_url,
crop_url, crop_url,
crop, crop,
@@ -126,6 +127,7 @@
#{scenicId}, #{scenicId},
#{faceId}, #{faceId},
#{sourceId}, #{sourceId},
#{imageType},
#{origUrl}, #{origUrl},
#{cropUrl}, #{cropUrl},
#{crop}, #{crop},