You've already forked FrameTour-BE
refactor(face): 调整人脸识别匹配逻辑以支持场景参数
- 修改 PrinterTvController 中 faceUpload 方法的 scene 参数值从 print 改为 tv - 在 FaceServiceImpl 中为人脸匹配方法增加 scene 参数支持 - 更新 FaceMatchingOrchestrator 的 orchestrateMatching 方法签名以接收 scene 参数 - 在 FaceService 接口中新增带 scene 参数的 matchFaceId 方法定义 - 更新 VideoTaskGenerator 中调用 matchFaceId 方法时传入 scene 参数
This commit is contained in:
@@ -195,7 +195,7 @@ public class PrinterTvController {
|
||||
@PathVariable Long scenicId) {
|
||||
// 复用 faceUpload 方法的去重逻辑
|
||||
// memberId=0L 表示打印机大屏用户,scene="print" 会触发自动添加打印逻辑并等待完成
|
||||
FaceRecognizeResp resp = pcFaceService.faceUpload(file, scenicId, 0L, "print");
|
||||
FaceRecognizeResp resp = pcFaceService.faceUpload(file, scenicId, 0L, "tv");
|
||||
return ApiResponse.success(resp);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ public interface FaceService {
|
||||
SearchFaceRespVo matchFaceId(Long faceId);
|
||||
|
||||
SearchFaceRespVo matchFaceId(Long faceId, boolean isNew);
|
||||
SearchFaceRespVo matchFaceId(Long faceId, boolean isNew, String scene);
|
||||
|
||||
ApiResponse<String> deleteFace(Long faceId);
|
||||
|
||||
|
||||
@@ -354,7 +354,7 @@ public class FaceServiceImpl implements FaceService {
|
||||
}
|
||||
|
||||
// 正常执行人脸匹配
|
||||
SearchFaceRespVo result = faceMatchingOrchestrator.orchestrateMatching(faceId, false);
|
||||
SearchFaceRespVo result = faceMatchingOrchestrator.orchestrateMatching(faceId, false, null);
|
||||
|
||||
// 执行完成后标记,防止2秒内重复调用
|
||||
faceMatchDedupService.markMatched(face.getMemberId(), face.getScenicId());
|
||||
@@ -364,7 +364,11 @@ public class FaceServiceImpl implements FaceService {
|
||||
|
||||
@Override
|
||||
public SearchFaceRespVo matchFaceId(Long faceId, boolean isNew) {
|
||||
return faceMatchingOrchestrator.orchestrateMatching(faceId, isNew);
|
||||
return matchFaceId(faceId, isNew, null);
|
||||
}
|
||||
@Override
|
||||
public SearchFaceRespVo matchFaceId(Long faceId, boolean isNew, String scene) {
|
||||
return faceMatchingOrchestrator.orchestrateMatching(faceId, isNew, scene);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -108,7 +108,7 @@ public class FaceMatchingOrchestrator {
|
||||
* @param isNew 是否新用户
|
||||
* @return 人脸搜索结果
|
||||
*/
|
||||
public SearchFaceRespVo orchestrateMatching(Long faceId, boolean isNew) {
|
||||
public SearchFaceRespVo orchestrateMatching(Long faceId, boolean isNew, String scene) {
|
||||
if (faceId == null) {
|
||||
throw new IllegalArgumentException("faceId 不能为空");
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ public class VideoTaskGenerator {
|
||||
faceReqQuery.setEndTime(DateUtil.endOfDay(new Date()));
|
||||
List<FaceRespVO> list = faceMapper.list(faceReqQuery);
|
||||
list.forEach(face -> {
|
||||
faceService.matchFaceId(face.getId(), false);
|
||||
faceService.matchFaceId(face.getId(), false, null);
|
||||
if (Integer.valueOf(3).equals(scenicConfig.getBookRoutine())) {
|
||||
// 全部生成
|
||||
templateList.forEach(content -> {
|
||||
|
||||
Reference in New Issue
Block a user