bug修复

This commit is contained in:
2025-02-05 11:28:50 +08:00
parent 0b861f0e21
commit 7892c0f5cc
21 changed files with 324 additions and 95 deletions

View File

@@ -13,7 +13,9 @@ import com.ycwl.basic.repository.ScenicRepository;
import com.ycwl.basic.repository.TemplateRepository;
import com.ycwl.basic.service.task.TaskFaceService;
import com.ycwl.basic.service.task.impl.TaskTaskServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Profile;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@@ -21,8 +23,10 @@ import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.List;
@Slf4j
@EnableScheduling
@Component
@Profile("prod")
public class VideoTaskGenerator {
@Autowired
private FaceMapper faceMapper;
@@ -55,31 +59,10 @@ public class VideoTaskGenerator {
taskFaceService.searchFace(face.getId());
boolean canAutoGenerate = templateBiz.determineTemplateCanAutoGenerate(templateId, face.getId(), false);
if (canAutoGenerate) {
taskTaskService.autoCreateTaskByFaceId(face.getId());
}
});
}
@Scheduled(cron = "0 30 4 * * *")
public void generateVideoTaskZTJQ() {
// 指定,获取指定日期的未完成人脸样本,并生成任务
Long scenicId = 3930324797233434624L;
List<ContentPageVO> contentList = templateMapper.listFor(scenicId);
if (contentList.isEmpty()) {
return;
}
Long templateId = contentList.get(0).getTemplateId();
FaceReqQuery query = new FaceReqQuery();
query.setScenicId(scenicId);
query.setStartTime(DateUtil.beginOfDay(new Date()));
query.setEndTime(DateUtil.endOfDay(new Date()));
List<FaceRespVO> list = faceMapper.list(query);
list.stream().parallel().forEach(face -> {
taskFaceService.searchFace(face.getId());
boolean canAutoGenerate = templateBiz.determineTemplateCanAutoGenerate(templateId, face.getId(), false);
if (canAutoGenerate) {
taskTaskService.autoCreateTaskByFaceId(face.getId());
log.info("task callback: 自动生成");
taskTaskService.forceCreateTaskByFaceIdAndTempalteId(face.getId(), templateId);
} else {
log.info("task callback: 不自动生成");
}
});
}