You've already forked FrameTour-BE
1
This commit is contained in:
@ -7,6 +7,7 @@ import com.ycwl.basic.model.pc.member.resp.MemberRespVO;
|
||||
import com.ycwl.basic.model.pc.mp.MpConfigEntity;
|
||||
import com.ycwl.basic.model.pc.scenic.entity.ScenicConfigEntity;
|
||||
import com.ycwl.basic.model.pc.scenic.entity.ScenicEntity;
|
||||
import com.ycwl.basic.model.pc.template.resp.TemplateRespVO;
|
||||
import com.ycwl.basic.notify.NotifyFactory;
|
||||
import com.ycwl.basic.notify.adapters.INotifyAdapter;
|
||||
import com.ycwl.basic.notify.entity.NotifyContent;
|
||||
@ -34,6 +35,8 @@ public class DownloadNotificationTasker {
|
||||
private VideoMapper videoMapper;
|
||||
@Autowired
|
||||
private MemberMapper memberMapper;
|
||||
@Autowired
|
||||
private TemplateRepository templateRepository;
|
||||
|
||||
@Scheduled(cron = "0 0 21 * * *")
|
||||
public void sendDownloadNotification() {
|
||||
@ -45,6 +48,7 @@ public class DownloadNotificationTasker {
|
||||
}
|
||||
MemberRespVO member = memberMapper.getById(item.getMemberId());
|
||||
MpConfigEntity scenicMp = scenicRepository.getScenicMpConfig(member.getScenicId());
|
||||
TemplateRespVO template = templateRepository.getTemplate(item.getTemplateId());
|
||||
// 发送模板消息
|
||||
String templateId = scenicRepository.getVideoDownloadTemplateId(item.getScenicId());
|
||||
if (StringUtils.isBlank(templateId)) {
|
||||
@ -53,7 +57,7 @@ public class DownloadNotificationTasker {
|
||||
}
|
||||
log.info("发送模板消息");
|
||||
ScenicEntity scenic = scenicRepository.getScenic(item.getScenicId());
|
||||
String title = "您在【" + scenic.getName() + "】的专属影像";
|
||||
String title = "您在【" + template.getName() + "】的专属影像";
|
||||
String page = "pages/videoSynthesis/buy?scenicId=" + item.getScenicId() + "&faceId=" + item.getFaceId() + "&id=" + item.getVideoId();
|
||||
/**
|
||||
* 景区 {{thing1.DATA}}
|
||||
@ -90,13 +94,14 @@ public class DownloadNotificationTasker {
|
||||
Integer videoStoreDay = scenicConfig.getVideoStoreDay();
|
||||
// 发送模板消息
|
||||
String templateId = scenicRepository.getVideoPreExpireTemplateId(item.getScenicId());
|
||||
TemplateRespVO template = templateRepository.getTemplate(item.getTemplateId());
|
||||
if (StringUtils.isBlank(templateId)) {
|
||||
log.info("模板消息为空");
|
||||
return;
|
||||
}
|
||||
log.info("发送模板消息");
|
||||
ScenicEntity scenic = scenicRepository.getScenic(item.getScenicId());
|
||||
String title = "您在【" + scenic.getName() + "】的专属影像";
|
||||
String title = "您在【" + template.getName() + "】的专属影像";
|
||||
String page = "pages/videoSynthesis/buy?scenicId=" + item.getScenicId() + "&faceId=" + item.getFaceId() + "&id=" + item.getVideoId();
|
||||
/**
|
||||
* 影像名称 {{thing1.DATA}}
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user