You've already forked FrameTour-BE
fix(printer): 优化人脸识别逻辑避免重复添加照片
- 在人脸匹配成功后,仅当不存在已匹配的人脸时才自动添加照片到预打印列表 - 更新了用户照片列表的获取条件,确保只在必要时执行此操作 - 保留了对源实体存在的检查,以维持原有业务流程的完整性
This commit is contained in:
@@ -871,12 +871,14 @@ public class PrinterServiceImpl implements PrinterService {
|
|||||||
resp.setScenicId(scenicId);
|
resp.setScenicId(scenicId);
|
||||||
try {
|
try {
|
||||||
faceService.matchFaceId(faceId);
|
faceService.matchFaceId(faceId);
|
||||||
autoAddPhotosToPreferPrint(faceId);
|
if (existingFace == null) {
|
||||||
|
autoAddPhotosToPreferPrint(faceId);
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// 人脸匹配失败不可以阻止正常流程
|
// 人脸匹配失败不可以阻止正常流程
|
||||||
log.error("人脸匹配失败", e);
|
log.error("人脸匹配失败", e);
|
||||||
}
|
}
|
||||||
if (sourceEntity != null) {
|
if (sourceEntity != null && existingFace == null) {
|
||||||
List<MemberPrintResp> userPhotoList = getUserPhotoList(userId, scenicId, faceId);
|
List<MemberPrintResp> userPhotoList = getUserPhotoList(userId, scenicId, faceId);
|
||||||
boolean noneMatch = userPhotoList.stream()
|
boolean noneMatch = userPhotoList.stream()
|
||||||
.noneMatch(item -> Strings.CI.equals(item.getOrigUrl(), sourceEntity.getUrl()));
|
.noneMatch(item -> Strings.CI.equals(item.getOrigUrl(), sourceEntity.getUrl()));
|
||||||
|
|||||||
Reference in New Issue
Block a user