|
|
@@ -56,6 +56,25 @@ public class VideoSearchServiceImpl implements VideoSearchService {
|
|
|
log.info("调用内容解构服务,title: {}, bizType: {}, contentType: {}",
|
|
|
param.getTitle(), param.getBizType(), param.getContentType());
|
|
|
|
|
|
+ // 检查是否存在重复的 channelContentId
|
|
|
+ String channelContentId = param.getChannelContentId();
|
|
|
+ if (StringUtils.hasText(channelContentId)) {
|
|
|
+ DeconstructContent existingContent = getDeconstructContentByChannelContentId(channelContentId);
|
|
|
+ if (existingContent != null) {
|
|
|
+ Byte status = existingContent.getStatus();
|
|
|
+ // 状态: 0-PENDING, 1-RUNNING, 2-SUCCESS, 3-FAILED
|
|
|
+ // 如果状态为 PENDING、RUNNING 或 SUCCESS,不重复提交,直接返回已有 taskId
|
|
|
+ if (status != null && status != 3) {
|
|
|
+ log.info("解构任务已存在,channelContentId={}, taskId={}, status={}, 不重复提交",
|
|
|
+ channelContentId, existingContent.getTaskId(), getStatusDesc(status));
|
|
|
+ return existingContent.getTaskId();
|
|
|
+ }
|
|
|
+ // 状态为 FAILED 时,允许重新提交
|
|
|
+ log.info("解构任务已存在但失败,channelContentId={}, taskId={}, status={}, 允许重新提交",
|
|
|
+ channelContentId, existingContent.getTaskId(), getStatusDesc(status));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 获取参数
|
|
|
Integer bizType = param.getBizType() != null ? param.getBizType() : 0;
|
|
|
Integer contentType = param.getContentType() != null ? param.getContentType() : 2;
|
|
|
@@ -185,6 +204,17 @@ public class VideoSearchServiceImpl implements VideoSearchService {
|
|
|
return list.isEmpty() ? null : list.get(0);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 根据channelContentId查询解构内容
|
|
|
+ */
|
|
|
+ private DeconstructContent getDeconstructContentByChannelContentId(String channelContentId) {
|
|
|
+ DeconstructContentExample example = new DeconstructContentExample();
|
|
|
+ example.createCriteria().andChannelContentIdEqualTo(channelContentId);
|
|
|
+ example.setOrderByClause("id DESC");
|
|
|
+ List<DeconstructContent> list = deconstructContentMapper.selectByExample(example);
|
|
|
+ return list.isEmpty() ? null : list.get(0);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 根据API结果更新数据库记录
|
|
|
*/
|