diff --git a/src/main/java/com/ycwl/basic/model/pc/printer/entity/MemberPrintEntity.java b/src/main/java/com/ycwl/basic/model/pc/printer/entity/MemberPrintEntity.java index 62429180..f30d8f54 100644 --- a/src/main/java/com/ycwl/basic/model/pc/printer/entity/MemberPrintEntity.java +++ b/src/main/java/com/ycwl/basic/model/pc/printer/entity/MemberPrintEntity.java @@ -16,6 +16,7 @@ public class MemberPrintEntity { private Long memberId; private Long faceId; private Long sourceId; + private String imageType; private String origUrl; private String cropUrl; private String printUrl; diff --git a/src/main/java/com/ycwl/basic/model/pc/printer/resp/MemberPrintResp.java b/src/main/java/com/ycwl/basic/model/pc/printer/resp/MemberPrintResp.java index cd6cc204..07c52ff7 100644 --- a/src/main/java/com/ycwl/basic/model/pc/printer/resp/MemberPrintResp.java +++ b/src/main/java/com/ycwl/basic/model/pc/printer/resp/MemberPrintResp.java @@ -9,6 +9,7 @@ public class MemberPrintResp { private Integer id; private Long scenicId; private Long sourceId; + private String imageType; private String scenicName; private Long faceId; private Long memberId; diff --git a/src/main/java/com/ycwl/basic/service/printer/impl/PrinterServiceImpl.java b/src/main/java/com/ycwl/basic/service/printer/impl/PrinterServiceImpl.java index 8ca9b63d..5ff4f70a 100644 --- a/src/main/java/com/ycwl/basic/service/printer/impl/PrinterServiceImpl.java +++ b/src/main/java/com/ycwl/basic/service/printer/impl/PrinterServiceImpl.java @@ -313,6 +313,8 @@ public class PrinterServiceImpl implements PrinterService { entity.setScenicId(scenicId); entity.setFaceId(faceId); entity.setSourceId(sourceId); + // 根据 sourceId 判断图片类型 + entity.setImageType(sourceId == null ? ImageType.MOBILE_UPLOAD.getCode() : ImageType.NORMAL_PHOTO.getCode()); entity.setOrigUrl(url); // 获取打印尺寸 @@ -596,6 +598,7 @@ public class PrinterServiceImpl implements PrinterService { entity.setScenicId(scenicId); entity.setFaceId(faceId); entity.setSourceId(id); + entity.setImageType(ImageType.NORMAL_PHOTO.getCode()); entity.setOrigUrl(url); // 获取打印尺寸并裁剪图片 @@ -945,19 +948,18 @@ public class PrinterServiceImpl implements PrinterService { context.setStageState("image_enhance", true); } - // 根据sourceId判断图片来源和source类型 + // 根据 imageType 字段判断图片类型 SourceEntity source = null; - if (item.getSourceId() != null && item.getSourceId() > 0) { - source = sourceMapper.getEntity(item.getSourceId()); - if (source == null) { - context.setImageType(ImageType.PUZZLE); // 特殊 - } else { - context.setSource(ImageSource.IPC); - } - } else if (item.getSourceId() == null) { + if (ImageType.PUZZLE.getCode().equals(item.getImageType())) { + context.setImageType(ImageType.PUZZLE); + } else if (ImageType.MOBILE_UPLOAD.getCode().equals(item.getImageType())) { context.setSource(ImageSource.PHONE); } else { - context.setSource(ImageSource.UNKNOWN); + // 普通照片,查询 source 获取设备类型信息 + context.setSource(ImageSource.IPC); + if (item.getSourceId() != null && item.getSourceId() > 0) { + source = sourceMapper.getEntity(item.getSourceId()); + } } Pipeline pipeline; @@ -1545,6 +1547,7 @@ public class PrinterServiceImpl implements PrinterService { entity.setScenicId(scenicId); entity.setFaceId(faceId); entity.setSourceId(puzzleRecordId); // 使用拼图记录ID作为sourceId + entity.setImageType(ImageType.PUZZLE.getCode()); // 明确标记为拼图类型 entity.setOrigUrl(resultImageUrl); // 获取打印尺寸并裁剪图片 diff --git a/src/main/resources/mapper/PrinterMapper.xml b/src/main/resources/mapper/PrinterMapper.xml index 319bfd58..9a023ac9 100644 --- a/src/main/resources/mapper/PrinterMapper.xml +++ b/src/main/resources/mapper/PrinterMapper.xml @@ -114,6 +114,7 @@ scenic_id, face_id, source_id, + image_type, orig_url, crop_url, crop, @@ -126,6 +127,7 @@ #{scenicId}, #{faceId}, #{sourceId}, + #{imageType}, #{origUrl}, #{cropUrl}, #{crop},