This commit is contained in:
2025-01-16 22:22:35 +08:00
parent bbcbdd2839
commit 937e1c1ff5
9 changed files with 58 additions and 17 deletions

View File

@ -155,11 +155,11 @@ public class DynamicTaskGenerator {
public static void addTask(Long faceSampleId) {
Date createTime = new Date();
// 两分钟后
createTime.setTime(createTime.getTime() + 120000L);
createTime.setTime(createTime.getTime() + 80000L);
queue.add(new Task(faceSampleId, createTime));
}
@Scheduled(fixedRate = 30000L)
@Scheduled(fixedRate = 10000L)
public void doTask() {
Task task = queue.poll();
if (task == null) {
@ -181,7 +181,7 @@ public class DynamicTaskGenerator {
log.info("当前景区{}未启用预约流程,跳过", faceSample.getScenicId());
return;
}
SearchFaceRespVo userDbSearchResult = faceService.searchFace(USER_FACE_DB_NAME, faceSample.getFaceUrl());
SearchFaceRespVo userDbSearchResult = faceService.searchFace(USER_FACE_DB_NAME+faceSample.getScenicId(), faceSample.getFaceUrl());
// 如果人脸样本ID在人脸样本库中则创建任务
if (!userDbSearchResult.getSampleListIds().isEmpty()) {
log.info("人脸样本ID在人脸样本库中创建任务{}", task);
@ -197,11 +197,10 @@ public class DynamicTaskGenerator {
log.info("本景区人脸样本ID不在人脸样本库中忽略任务{}", task);
return;
}
List<TemplateRespVO> templateList = templateRepository.getTemplateListByScenicId(faceSample.getScenicId());
if (templateList == null || templateList.isEmpty()) {
log.info("当前景区{},无模板配置", faceSample.getScenicId());
return;
}
faceIdList.forEach(faceId -> {
// 每一个都重新匹配
faceService.searchFace(faceId);
});
faceIdList.forEach(faceId -> {
log.info("自动下发任务人脸ID{}", faceId);
taskService.autoCreateTaskByFaceId(faceId);