You've already forked FrameTour-BE
fix(printer):优化水印处理逻辑并增强人脸匹配容错
- 限制水印处理仅在sourceId不为空时执行 - 调整水印处理代码结构,提高可读性 - 增加人脸匹配异常捕获,避免影响主流程 -保持原有打印任务创建逻辑不变
This commit is contained in:
@@ -622,11 +622,9 @@ public class PrinterServiceImpl implements PrinterService {
|
||||
}
|
||||
userPhotoListByOrderId.forEach(item -> {
|
||||
PrinterEntity printer = printerMapper.getById(item.getPrinterId());
|
||||
if (item.getSourceId() == null) {
|
||||
return;
|
||||
}
|
||||
// 水印处理逻辑
|
||||
// 水印处理逻辑(仅当sourceId不为空时执行)
|
||||
String printUrl = item.getCropUrl();
|
||||
if (item.getSourceId() != null) {
|
||||
try {
|
||||
ScenicConfigManager scenicConfig = scenicRepository.getScenicConfigManager(item.getScenicId());
|
||||
String printWatermarkType = scenicConfig.getString("print_watermark_type");
|
||||
@@ -727,6 +725,7 @@ public class PrinterServiceImpl implements PrinterService {
|
||||
} catch (Exception e) {
|
||||
log.error("获取景区配置失败,使用原始照片进行打印。景区ID: {}, 照片ID: {}", item.getScenicId(), item.getId(), e);
|
||||
}
|
||||
}
|
||||
|
||||
// 根据数量创建多个打印任务
|
||||
Integer quantity = item.getQuantity();
|
||||
@@ -808,8 +807,13 @@ public class PrinterServiceImpl implements PrinterService {
|
||||
resp.setUrl(faceUrl);
|
||||
resp.setFaceId(faceId);
|
||||
resp.setScenicId(scenicId);
|
||||
try {
|
||||
faceService.matchFaceId(faceId);
|
||||
autoAddPhotosToPreferPrint(faceId);
|
||||
} catch (Exception e) {
|
||||
// 人脸匹配失败不可以阻止正常流程
|
||||
log.error("人脸匹配失败", e);
|
||||
}
|
||||
if (sourceEntity != null) {
|
||||
List<MemberPrintResp> userPhotoList = getUserPhotoList(userId, scenicId, faceId);
|
||||
boolean noneMatch = userPhotoList.stream()
|
||||
|
||||
Reference in New Issue
Block a user