fix(printer): 优化人脸识别逻辑避免重复添加照片

- 在人脸匹配成功后,仅当不存在已匹配的人脸时才自动添加照片到预打印列表
- 更新了用户照片列表的获取条件,确保只在必要时执行此操作
- 保留了对源实体存在的检查,以维持原有业务流程的完整性
This commit is contained in:
2025-11-15 14:11:35 +08:00
parent 9b9e69cf52
commit 6462037dcd

View File

@@ -871,12 +871,14 @@ public class PrinterServiceImpl implements PrinterService {
resp.setScenicId(scenicId);
try {
faceService.matchFaceId(faceId);
autoAddPhotosToPreferPrint(faceId);
if (existingFace == null) {
autoAddPhotosToPreferPrint(faceId);
}
} catch (Exception e) {
// 人脸匹配失败不可以阻止正常流程
log.error("人脸匹配失败", e);
}
if (sourceEntity != null) {
if (sourceEntity != null && existingFace == null) {
List<MemberPrintResp> userPhotoList = getUserPhotoList(userId, scenicId, faceId);
boolean noneMatch = userPhotoList.stream()
.noneMatch(item -> Strings.CI.equals(item.getOrigUrl(), sourceEntity.getUrl()));