You've already forked FrameTour-BE
feat(printer):优化人脸样本使用逻辑并增强景区列表查询
- 修改 useSample 接口返回类型为 FaceRecognizeResp - 增加根据样本ID和类型查询来源实体的逻辑 - 在景区列表查询中添加参数校验和异常处理 - 完善景区信息处理流程,增加设备数量统计 -优化景区距离计算与筛选逻辑 - 增加人脸匹配后自动添加照片到用户相册的功能 - 添加 XML 映射文件中新的查询语句实现
This commit is contained in:
@@ -752,9 +752,10 @@ public class PrinterServiceImpl implements PrinterService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object useSample(Long userId, Long sampleId) {
|
||||
public FaceRecognizeResp useSample(Long userId, Long sampleId) {
|
||||
// 1. 查询 faceSample 获取其 URL
|
||||
FaceSampleEntity faceSample = faceSampleMapper.getEntity(sampleId);
|
||||
SourceEntity sourceEntity = sourceMapper.getBySampleIdAndType(sampleId, 2);
|
||||
if (faceSample == null) {
|
||||
throw new BaseException("人脸样本不存在");
|
||||
}
|
||||
@@ -807,6 +808,12 @@ public class PrinterServiceImpl implements PrinterService {
|
||||
resp.setScenicId(scenicId);
|
||||
faceService.matchFaceId(faceId);
|
||||
autoAddPhotosToPreferPrint(faceId);
|
||||
List<MemberPrintResp> userPhotoList = getUserPhotoList(userId, scenicId, faceId);
|
||||
boolean noneMatch = userPhotoList.stream()
|
||||
.noneMatch(item -> Strings.CI.equals(item.getOrigUrl(), sourceEntity.getUrl()));
|
||||
if (noneMatch) {
|
||||
addUserPhoto(userId, scenicId, sourceEntity.getUrl(), faceId);
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user