|
@@ -3,9 +3,7 @@ package com.tzld.piaoquan.api.service.contentplatform.impl;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
|
import com.tzld.piaoquan.api.common.enums.ExceptionEnum;
|
|
import com.tzld.piaoquan.api.common.enums.ExceptionEnum;
|
|
|
-import com.tzld.piaoquan.api.common.enums.contentplatform.ContentPlatformGzhPlanTypeEnum;
|
|
|
|
|
-import com.tzld.piaoquan.api.common.enums.contentplatform.PublishStageEnum;
|
|
|
|
|
-import com.tzld.piaoquan.api.common.enums.contentplatform.QwPlanTypeEnum;
|
|
|
|
|
|
|
+import com.tzld.piaoquan.api.common.enums.contentplatform.*;
|
|
|
import com.tzld.piaoquan.api.common.exception.CommonException;
|
|
import com.tzld.piaoquan.api.common.exception.CommonException;
|
|
|
import com.tzld.piaoquan.api.component.*;
|
|
import com.tzld.piaoquan.api.component.*;
|
|
|
import com.tzld.piaoquan.api.dao.mapper.contentplatform.*;
|
|
import com.tzld.piaoquan.api.dao.mapper.contentplatform.*;
|
|
@@ -24,6 +22,7 @@ import com.tzld.piaoquan.api.model.vo.contentplatform.VideoContentItemVO;
|
|
|
import com.tzld.piaoquan.api.service.CgiReplyService;
|
|
import com.tzld.piaoquan.api.service.CgiReplyService;
|
|
|
import com.tzld.piaoquan.api.service.GhDetailService;
|
|
import com.tzld.piaoquan.api.service.GhDetailService;
|
|
|
import com.tzld.piaoquan.api.service.contentplatform.ContentPlatformAccountService;
|
|
import com.tzld.piaoquan.api.service.contentplatform.ContentPlatformAccountService;
|
|
|
|
|
+import com.tzld.piaoquan.api.service.contentplatform.ContentPlatformCollectContentService;
|
|
|
import com.tzld.piaoquan.api.service.contentplatform.ContentPlatformCooperateAccountService;
|
|
import com.tzld.piaoquan.api.service.contentplatform.ContentPlatformCooperateAccountService;
|
|
|
import com.tzld.piaoquan.api.service.contentplatform.ContentPlatformPlanService;
|
|
import com.tzld.piaoquan.api.service.contentplatform.ContentPlatformPlanService;
|
|
|
import com.tzld.piaoquan.growth.common.common.enums.GhTypeEnum;
|
|
import com.tzld.piaoquan.growth.common.common.enums.GhTypeEnum;
|
|
@@ -33,6 +32,7 @@ import com.tzld.piaoquan.growth.common.model.bo.VideoDetail;
|
|
|
import com.tzld.piaoquan.growth.common.model.po.CgiReplyBucketData;
|
|
import com.tzld.piaoquan.growth.common.model.po.CgiReplyBucketData;
|
|
|
import com.tzld.piaoquan.growth.common.model.po.GhDetail;
|
|
import com.tzld.piaoquan.growth.common.model.po.GhDetail;
|
|
|
import com.tzld.piaoquan.growth.common.service.MessageAttachmentService;
|
|
import com.tzld.piaoquan.growth.common.service.MessageAttachmentService;
|
|
|
|
|
+import com.tzld.piaoquan.growth.common.utils.DateUtils;
|
|
|
import com.tzld.piaoquan.growth.common.utils.MessageUtil;
|
|
import com.tzld.piaoquan.growth.common.utils.MessageUtil;
|
|
|
import com.tzld.piaoquan.growth.common.utils.page.Page;
|
|
import com.tzld.piaoquan.growth.common.utils.page.Page;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -64,9 +64,9 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private CgiReplyBucketDataMapperExt cgiReplyBucketDataMapperExt;
|
|
private CgiReplyBucketDataMapperExt cgiReplyBucketDataMapperExt;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
- private ContentPlatformVideoMapper contentPlatformVideoMapper;
|
|
|
|
|
|
|
+ private ContentPlatformVideoMapper videoMapper;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
- private ContentPlatformVideoAggMapper contentPlatformVideoAggMapper;
|
|
|
|
|
|
|
+ private ContentPlatformVideoAggMapper videoAggMapper;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private ContentPlatformGzhPlanChangeLogMapper gzhPlanChangeLogMapper;
|
|
private ContentPlatformGzhPlanChangeLogMapper gzhPlanChangeLogMapper;
|
|
|
@Autowired
|
|
@Autowired
|
|
@@ -74,6 +74,8 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private ContentPlatformCooperateAccountService cooperateAccountService;
|
|
private ContentPlatformCooperateAccountService cooperateAccountService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
|
|
+ private ContentPlatformCollectContentService videoCollectService;
|
|
|
|
|
+ @Autowired
|
|
|
private GhDetailService ghDetailService;
|
|
private GhDetailService ghDetailService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private AigcApiService aigcApiService;
|
|
private AigcApiService aigcApiService;
|
|
@@ -91,6 +93,8 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
|
|
|
private CgiReplyService cgiReplyService;
|
|
private CgiReplyService cgiReplyService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private TouLiuHttpClient touLiuHttpClient;
|
|
private TouLiuHttpClient touLiuHttpClient;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ ContentPlatformCollectContentService collectService;
|
|
|
|
|
|
|
|
|
|
|
|
|
@Value("${vlog.share.appType:11}")
|
|
@Value("${vlog.share.appType:11}")
|
|
@@ -188,7 +192,7 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
|
|
|
@Override
|
|
@Override
|
|
|
public List<ContentPlatformGzhPlanVideo> getGzhPlanVideoList(List<Long> planIds) {
|
|
public List<ContentPlatformGzhPlanVideo> getGzhPlanVideoList(List<Long> planIds) {
|
|
|
ContentPlatformGzhPlanVideoExample example = new ContentPlatformGzhPlanVideoExample();
|
|
ContentPlatformGzhPlanVideoExample example = new ContentPlatformGzhPlanVideoExample();
|
|
|
- example.createCriteria().andPlanIdIn(planIds);
|
|
|
|
|
|
|
+ example.createCriteria().andPlanIdIn(planIds).andStatusEqualTo(VideoStatusEnum.NORMAL.getVal());
|
|
|
return gzhPlanVideoMapper.selectByExample(example);
|
|
return gzhPlanVideoMapper.selectByExample(example);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -198,7 +202,7 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
|
|
|
if (Objects.isNull(plan)) {
|
|
if (Objects.isNull(plan)) {
|
|
|
throw new CommonException(ExceptionEnum.GZH_PLAN_NOT_EXISTS);
|
|
throw new CommonException(ExceptionEnum.GZH_PLAN_NOT_EXISTS);
|
|
|
}
|
|
}
|
|
|
- plan.setStatus(0);
|
|
|
|
|
|
|
+ plan.setStatus(PlanStatusEnum.DELETED.getVal());
|
|
|
plan.setUpdateTimestamp(System.currentTimeMillis());
|
|
plan.setUpdateTimestamp(System.currentTimeMillis());
|
|
|
gzhPlanMapper.updateByPrimaryKeySelective(plan);
|
|
gzhPlanMapper.updateByPrimaryKeySelective(plan);
|
|
|
if (PublishStageEnum.PLATFORM.getVal() == plan.getPublishStage()) {
|
|
if (PublishStageEnum.PLATFORM.getVal() == plan.getPublishStage()) {
|
|
@@ -232,7 +236,7 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
|
|
|
if (Objects.isNull(plan)) {
|
|
if (Objects.isNull(plan)) {
|
|
|
throw new CommonException(ExceptionEnum.QW_PLAN_NOT_EXISTS);
|
|
throw new CommonException(ExceptionEnum.QW_PLAN_NOT_EXISTS);
|
|
|
}
|
|
}
|
|
|
- plan.setStatus(0);
|
|
|
|
|
|
|
+ plan.setStatus(PlanStatusEnum.DELETED.getVal());
|
|
|
plan.setUpdateTimestamp(System.currentTimeMillis());
|
|
plan.setUpdateTimestamp(System.currentTimeMillis());
|
|
|
qwPlanMapper.updateByPrimaryKeySelective(plan);
|
|
qwPlanMapper.updateByPrimaryKeySelective(plan);
|
|
|
}
|
|
}
|
|
@@ -346,7 +350,9 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
|
|
|
.collect(Collectors.toMap(ContentPlatformGzhPlanVideo::getVideoId, item -> item));
|
|
.collect(Collectors.toMap(ContentPlatformGzhPlanVideo::getVideoId, item -> item));
|
|
|
for (ContentPlatformGzhPlanVideo item : existsVideo) {
|
|
for (ContentPlatformGzhPlanVideo item : existsVideo) {
|
|
|
if (!videoIds.contains(item.getVideoId())) {
|
|
if (!videoIds.contains(item.getVideoId())) {
|
|
|
- gzhPlanVideoMapper.deleteByPrimaryKey(item.getId());
|
|
|
|
|
|
|
+ //gzhPlanVideoMapper.deleteByPrimaryKey(item.getId());
|
|
|
|
|
+ item.setStatus(VideoStatusEnum.DELETED.getVal());
|
|
|
|
|
+ gzhPlanVideoMapper.updateByPrimaryKeySelective(item);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
for (GzhPlanVideoContentItemParam vo : param.getVideoList()) {
|
|
for (GzhPlanVideoContentItemParam vo : param.getVideoList()) {
|
|
@@ -363,6 +369,7 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
|
|
|
item.setCover(vo.getCover());
|
|
item.setCover(vo.getCover());
|
|
|
item.setCustomCover(vo.getCustomCover());
|
|
item.setCustomCover(vo.getCustomCover());
|
|
|
item.setCustomCoverType(vo.getCustomCoverType());
|
|
item.setCustomCoverType(vo.getCustomCoverType());
|
|
|
|
|
+ item.setStatus(VideoStatusEnum.NORMAL.getVal());
|
|
|
gzhPlanVideoMapper.updateByPrimaryKey(item);
|
|
gzhPlanVideoMapper.updateByPrimaryKey(item);
|
|
|
} else {
|
|
} else {
|
|
|
ContentPlatformGzhPlanVideo item = new ContentPlatformGzhPlanVideo();
|
|
ContentPlatformGzhPlanVideo item = new ContentPlatformGzhPlanVideo();
|
|
@@ -387,6 +394,7 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
|
|
|
SmallPageUrlDetail smallPageUrlDetail = json.getJSONObject("data").toJavaObject(SmallPageUrlDetail.class);
|
|
SmallPageUrlDetail smallPageUrlDetail = json.getJSONObject("data").toJavaObject(SmallPageUrlDetail.class);
|
|
|
item.setPageUrl(smallPageUrlDetail.getUrl());
|
|
item.setPageUrl(smallPageUrlDetail.getUrl());
|
|
|
}
|
|
}
|
|
|
|
|
+ item.setStatus(VideoStatusEnum.NORMAL.getVal());
|
|
|
item.setCreateAccountId(loginAccount.getId());
|
|
item.setCreateAccountId(loginAccount.getId());
|
|
|
item.setCreateTimestamp(System.currentTimeMillis());
|
|
item.setCreateTimestamp(System.currentTimeMillis());
|
|
|
gzhPlanVideoMapper.insert(item);
|
|
gzhPlanVideoMapper.insert(item);
|
|
@@ -419,7 +427,7 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
|
|
|
|
|
|
|
|
private List<ContentPlatformGzhPlanVideo> getGzhVideoByPlanId(Long planId) {
|
|
private List<ContentPlatformGzhPlanVideo> getGzhVideoByPlanId(Long planId) {
|
|
|
ContentPlatformGzhPlanVideoExample example = new ContentPlatformGzhPlanVideoExample();
|
|
ContentPlatformGzhPlanVideoExample example = new ContentPlatformGzhPlanVideoExample();
|
|
|
- example.createCriteria().andPlanIdEqualTo(planId);
|
|
|
|
|
|
|
+ example.createCriteria().andPlanIdEqualTo(planId).andStatusEqualTo(VideoStatusEnum.NORMAL.getVal());
|
|
|
return gzhPlanVideoMapper.selectByExample(example);
|
|
return gzhPlanVideoMapper.selectByExample(example);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -451,14 +459,14 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
|
|
|
@Override
|
|
@Override
|
|
|
public List<ContentPlatformGzhPlan> getGzhPlanListByCooperateAccountId(Long accountId) {
|
|
public List<ContentPlatformGzhPlan> getGzhPlanListByCooperateAccountId(Long accountId) {
|
|
|
ContentPlatformGzhPlanExample example = new ContentPlatformGzhPlanExample();
|
|
ContentPlatformGzhPlanExample example = new ContentPlatformGzhPlanExample();
|
|
|
- example.createCriteria().andAccountIdEqualTo(accountId).andStatusEqualTo(1);
|
|
|
|
|
|
|
+ example.createCriteria().andAccountIdEqualTo(accountId).andStatusEqualTo(PlanStatusEnum.NORMAL.getVal());
|
|
|
return gzhPlanMapper.selectByExample(example);
|
|
return gzhPlanMapper.selectByExample(example);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public List<ContentPlatformGzhPlan> getGzhPlanListByCreateAccountId(Long createAccountId) {
|
|
public List<ContentPlatformGzhPlan> getGzhPlanListByCreateAccountId(Long createAccountId) {
|
|
|
ContentPlatformGzhPlanExample example = new ContentPlatformGzhPlanExample();
|
|
ContentPlatformGzhPlanExample example = new ContentPlatformGzhPlanExample();
|
|
|
- example.createCriteria().andCreateAccountIdEqualTo(createAccountId).andStatusEqualTo(1);
|
|
|
|
|
|
|
+ example.createCriteria().andCreateAccountIdEqualTo(createAccountId).andStatusEqualTo(PlanStatusEnum.NORMAL.getVal());
|
|
|
return gzhPlanMapper.selectByExample(example);
|
|
return gzhPlanMapper.selectByExample(example);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -474,26 +482,81 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
|
|
|
ContentPlatformAccount user = LoginUserContext.getUser();
|
|
ContentPlatformAccount user = LoginUserContext.getUser();
|
|
|
Page<VideoContentItemVO> result = new Page<>(param.getPageNum(), param.getPageSize());
|
|
Page<VideoContentItemVO> result = new Page<>(param.getPageNum(), param.getPageSize());
|
|
|
int offset = (param.getPageNum() - 1) * param.getPageSize();
|
|
int offset = (param.getPageNum() - 1) * param.getPageSize();
|
|
|
|
|
+ // get sql Filter param
|
|
|
String dt = planMapperExt.getVideoMaxDt();
|
|
String dt = planMapperExt.getVideoMaxDt();
|
|
|
String datastatDt = planMapperExt.getVideoDatastatMaxDt();
|
|
String datastatDt = planMapperExt.getVideoDatastatMaxDt();
|
|
|
- int count = planMapperExt.getVideoCount(param, dt, videoMinScore);
|
|
|
|
|
|
|
+ String sort = getVideoContentListSort(param.getSortType(), param.getSort());
|
|
|
|
|
+ String type = getVideoContentListType(param.getType());
|
|
|
|
|
+ String channel = getVideoContentListChannel(param.getSort(), user.getChannel());
|
|
|
|
|
+ String strategy = param.getSort() == 3 ? "recommend" : "normal";
|
|
|
|
|
+ // 标签筛选
|
|
|
|
|
+ String tagFilterSql = getVideoContentListTagFilterSql(param.getTags(), user.getId(), type, user.getChannel());
|
|
|
|
|
+ // 近期未使用
|
|
|
|
|
+ Long excludeVideoRecentNotUsed = getVideoExcludeRecentNotUsed(param.getRecentNotUsed());
|
|
|
|
|
+
|
|
|
|
|
+ int count = planMapperExt.getVideoCount(param, dt, datastatDt, type, channel, strategy,
|
|
|
|
|
+ videoMinScore, user.getId(), excludeVideoRecentNotUsed, tagFilterSql);
|
|
|
result.setTotalSize(count);
|
|
result.setTotalSize(count);
|
|
|
if (count == 0) {
|
|
if (count == 0) {
|
|
|
result.setObjs(new ArrayList<>());
|
|
result.setObjs(new ArrayList<>());
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
- String sort = getVideoContentListSort(param.getSort());
|
|
|
|
|
- String type = getVideoContentListType(param.getType());
|
|
|
|
|
- String channel = getVideoContentListChannel(param.getSort(), user.getChannel());
|
|
|
|
|
- String strategy = param.getSort() == 3 ? "recommend" : "normal";
|
|
|
|
|
List<ContentPlatformVideo> videoList = planMapperExt.getVideoList(param, dt, datastatDt, type, channel, strategy,
|
|
List<ContentPlatformVideo> videoList = planMapperExt.getVideoList(param, dt, datastatDt, type, channel, strategy,
|
|
|
- videoMinScore, offset, param.getPageSize(), sort);
|
|
|
|
|
- List<VideoContentItemVO> list = buildVideoContentItemVOList(videoList, type, "sum", user.getChannel(), datastatDt);
|
|
|
|
|
|
|
+ videoMinScore, user.getId(), excludeVideoRecentNotUsed, tagFilterSql, offset, param.getPageSize(), sort);
|
|
|
|
|
+ List<VideoContentItemVO> list = buildVideoContentItemVOList(videoList, type, "sum", user.getChannel(), dt, datastatDt);
|
|
|
result.setObjs(list);
|
|
result.setObjs(list);
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private String getVideoContentListType(Integer type) {
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public String getVideoContentListTagFilterSql(List<Integer> tags, Long accountId, String type, String channel) {
|
|
|
|
|
+ if (CollectionUtils.isEmpty(tags)) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ StringBuilder sql = new StringBuilder("(");
|
|
|
|
|
+ for (Integer tag : tags) {
|
|
|
|
|
+ String item;
|
|
|
|
|
+ switch (tag) {
|
|
|
|
|
+ case 1:
|
|
|
|
|
+ item = "videoTag.platform = 'platform'";
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 2:
|
|
|
|
|
+ item = "videoTag.type = '" + type + "'";
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 3:
|
|
|
|
|
+ item = "videoTag.channel = '" + channel + "'";
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 4:
|
|
|
|
|
+ item = "videoTag.account_id = " + accountId;
|
|
|
|
|
+ break;
|
|
|
|
|
+ default:
|
|
|
|
|
+ item = null;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (Objects.nonNull(item)) {
|
|
|
|
|
+ sql.append(item).append(" and ");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (sql.length() > 1) {
|
|
|
|
|
+ sql.setLength(sql.length() - 5);
|
|
|
|
|
+ }
|
|
|
|
|
+ sql.append(")");
|
|
|
|
|
+ return sql.toString();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Long getVideoExcludeRecentNotUsed(Integer recentNotUsed) {
|
|
|
|
|
+ VideoRecentNotUsedEnum videoRecentNotUsedEnum = VideoRecentNotUsedEnum.getByVal(recentNotUsed);
|
|
|
|
|
+ if (Objects.isNull(videoRecentNotUsedEnum)) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (videoRecentNotUsedEnum == VideoRecentNotUsedEnum.HISTORY) {
|
|
|
|
|
+ return 0L;
|
|
|
|
|
+ }
|
|
|
|
|
+ return DateUtils.todayBegin().getTime() - videoRecentNotUsedEnum.getDays() * 24 * 60 * 60 * 1000;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public String getVideoContentListType(Integer type) {
|
|
|
switch (type) {
|
|
switch (type) {
|
|
|
case 0:
|
|
case 0:
|
|
|
return "自动回复";
|
|
return "自动回复";
|
|
@@ -510,14 +573,19 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private String getVideoContentListChannel(Integer sort, String channel) {
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public String getVideoContentListChannel(Integer sort, String channel) {
|
|
|
if (sort == 2 || sort == 3) {
|
|
if (sort == 2 || sort == 3) {
|
|
|
return channel;
|
|
return channel;
|
|
|
}
|
|
}
|
|
|
return "sum";
|
|
return "sum";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private String getVideoContentListSort(Integer sort) {
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public String getVideoContentListSort(Integer sortType, Integer sort) {
|
|
|
|
|
+ if (sortType == 1) {
|
|
|
|
|
+ return "video.last_dt desc, video.score desc";
|
|
|
|
|
+ }
|
|
|
switch (sort) {
|
|
switch (sort) {
|
|
|
case 0:
|
|
case 0:
|
|
|
return "video.score desc";
|
|
return "video.score desc";
|
|
@@ -533,10 +601,15 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private List<VideoContentItemVO> buildVideoContentItemVOList(List<ContentPlatformVideo> videoList,
|
|
private List<VideoContentItemVO> buildVideoContentItemVOList(List<ContentPlatformVideo> videoList,
|
|
|
- String type, String channel, String userChannel, String datastatDt) {
|
|
|
|
|
|
|
+ String type,
|
|
|
|
|
+ String channel,
|
|
|
|
|
+ String userChannel,
|
|
|
|
|
+ String dt,
|
|
|
|
|
+ String datastatDt) {
|
|
|
if (CollectionUtils.isEmpty(videoList)) {
|
|
if (CollectionUtils.isEmpty(videoList)) {
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
+ ContentPlatformAccount user = LoginUserContext.getUser();
|
|
|
List<Long> videoIds = videoList.stream()
|
|
List<Long> videoIds = videoList.stream()
|
|
|
.map(ContentPlatformVideo::getVideoId).distinct().collect(Collectors.toList());
|
|
.map(ContentPlatformVideo::getVideoId).distinct().collect(Collectors.toList());
|
|
|
List<Long> getCoverVideoIds = videoList.stream()
|
|
List<Long> getCoverVideoIds = videoList.stream()
|
|
@@ -551,16 +624,24 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
|
|
|
type, Arrays.asList("sum", userChannel), videoIds);
|
|
type, Arrays.asList("sum", userChannel), videoIds);
|
|
|
Map<Long, Double> typeVideoScoreMap = videoDataStatAggList.stream()
|
|
Map<Long, Double> typeVideoScoreMap = videoDataStatAggList.stream()
|
|
|
.filter(o -> channel.equals(o.getChannel()) && "normal".equals(o.getStrategy())).collect(Collectors.toMap(
|
|
.filter(o -> channel.equals(o.getChannel()) && "normal".equals(o.getStrategy())).collect(Collectors.toMap(
|
|
|
- ContentPlatformVideoDataStatAgg::getVideoId, ContentPlatformVideoDataStatAgg::getFissionRate));
|
|
|
|
|
|
|
+ ContentPlatformVideoDataStatAgg::getVideoId, ContentPlatformVideoDataStatAgg::getFissionRate));
|
|
|
Map<Long, Double> channelVideoScoreMap = videoDataStatAggList.stream()
|
|
Map<Long, Double> channelVideoScoreMap = videoDataStatAggList.stream()
|
|
|
.filter(o -> userChannel.equals(o.getChannel()) && "normal".equals(o.getStrategy())).collect(Collectors.toMap(
|
|
.filter(o -> userChannel.equals(o.getChannel()) && "normal".equals(o.getStrategy())).collect(Collectors.toMap(
|
|
|
- ContentPlatformVideoDataStatAgg::getVideoId, ContentPlatformVideoDataStatAgg::getFissionRate));
|
|
|
|
|
|
|
+ ContentPlatformVideoDataStatAgg::getVideoId, ContentPlatformVideoDataStatAgg::getFissionRate));
|
|
|
Map<Long, Double> recommendTypeVideoScoreMap = videoDataStatAggList.stream()
|
|
Map<Long, Double> recommendTypeVideoScoreMap = videoDataStatAggList.stream()
|
|
|
.filter(o -> channel.equals(o.getChannel()) && "recommend".equals(o.getStrategy())).collect(Collectors.toMap(
|
|
.filter(o -> channel.equals(o.getChannel()) && "recommend".equals(o.getStrategy())).collect(Collectors.toMap(
|
|
|
- ContentPlatformVideoDataStatAgg::getVideoId, ContentPlatformVideoDataStatAgg::getFissionRate));
|
|
|
|
|
|
|
+ ContentPlatformVideoDataStatAgg::getVideoId, ContentPlatformVideoDataStatAgg::getFissionRate));
|
|
|
Map<Long, Double> recommendChannelVideoScoreMap = videoDataStatAggList.stream()
|
|
Map<Long, Double> recommendChannelVideoScoreMap = videoDataStatAggList.stream()
|
|
|
.filter(o -> userChannel.equals(o.getChannel()) && "recommend".equals(o.getStrategy())).collect(Collectors.toMap(
|
|
.filter(o -> userChannel.equals(o.getChannel()) && "recommend".equals(o.getStrategy())).collect(Collectors.toMap(
|
|
|
- ContentPlatformVideoDataStatAgg::getVideoId, ContentPlatformVideoDataStatAgg::getFissionRate));
|
|
|
|
|
|
|
+ ContentPlatformVideoDataStatAgg::getVideoId, ContentPlatformVideoDataStatAgg::getFissionRate));
|
|
|
|
|
+ // tag
|
|
|
|
|
+ List<ContentPlatformVideoTag> videoTagList = planMapperExt.getVideoTagList(dt, videoIds, user.getId(), type, userChannel);
|
|
|
|
|
+ Map<Long, List<ContentPlatformVideoTag>> videoTagMap = videoTagList.stream()
|
|
|
|
|
+ .collect(Collectors.groupingBy(ContentPlatformVideoTag::getVideoId));
|
|
|
|
|
+ // collect
|
|
|
|
|
+ List<ContentPlatformVideoCollect> collectVideoList = collectService.getCollectVideoList(user.getId(), videoIds);
|
|
|
|
|
+ Map<Long, ContentPlatformVideoCollect> collectVideoMap = collectVideoList.stream()
|
|
|
|
|
+ .collect(Collectors.toMap(ContentPlatformVideoCollect::getVideoId, o -> o));
|
|
|
List<VideoContentItemVO> result = new ArrayList<>();
|
|
List<VideoContentItemVO> result = new ArrayList<>();
|
|
|
for (ContentPlatformVideo video : videoList) {
|
|
for (ContentPlatformVideo video : videoList) {
|
|
|
VideoContentItemVO item = new VideoContentItemVO();
|
|
VideoContentItemVO item = new VideoContentItemVO();
|
|
@@ -580,6 +661,19 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
|
|
|
if (Objects.isNull(item.getRecommendScore())) {
|
|
if (Objects.isNull(item.getRecommendScore())) {
|
|
|
item.setRecommendScore(recommendTypeVideoScoreMap.get(video.getVideoId()));
|
|
item.setRecommendScore(recommendTypeVideoScoreMap.get(video.getVideoId()));
|
|
|
}
|
|
}
|
|
|
|
|
+ List<ContentPlatformVideoTag> videoTags = videoTagMap.get(video.getVideoId());
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(videoTags)) {
|
|
|
|
|
+ List<Integer> tags = new ArrayList<>();
|
|
|
|
|
+ for (ContentPlatformVideoTag videoTag : videoTags) {
|
|
|
|
|
+ VideoTagEnum tagEnum = VideoTagEnum.from(videoTag.getTag());
|
|
|
|
|
+ tags.add(tagEnum.getVal());
|
|
|
|
|
+ }
|
|
|
|
|
+ item.setTags(tags);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (collectVideoMap.containsKey(video.getVideoId())) {
|
|
|
|
|
+ item.setCollect(1);
|
|
|
|
|
+ }
|
|
|
|
|
+ item.setStatus(1);
|
|
|
result.add(item);
|
|
result.add(item);
|
|
|
}
|
|
}
|
|
|
return result;
|
|
return result;
|
|
@@ -587,9 +681,9 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public List<ContentPlatformVideoDataStatAgg> getTypeChannelVideoDataStatAggList(String datastatDt,
|
|
public List<ContentPlatformVideoDataStatAgg> getTypeChannelVideoDataStatAggList(String datastatDt,
|
|
|
- String type,
|
|
|
|
|
- List<String> channels,
|
|
|
|
|
- List<Long> videoIds) {
|
|
|
|
|
|
|
+ String type,
|
|
|
|
|
+ List<String> channels,
|
|
|
|
|
+ List<Long> videoIds) {
|
|
|
ContentPlatformVideoDataStatAggExample example = new ContentPlatformVideoDataStatAggExample();
|
|
ContentPlatformVideoDataStatAggExample example = new ContentPlatformVideoDataStatAggExample();
|
|
|
example.createCriteria().andVideoIdIn(videoIds).andDtEqualTo(datastatDt).andTypeEqualTo(type)
|
|
example.createCriteria().andVideoIdIn(videoIds).andDtEqualTo(datastatDt).andTypeEqualTo(type)
|
|
|
.andChannelIn(channels);
|
|
.andChannelIn(channels);
|
|
@@ -608,12 +702,53 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
|
|
|
result.setObjs(new ArrayList<>());
|
|
result.setObjs(new ArrayList<>());
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
- String sort = getVideoContentListSort(param.getSort());
|
|
|
|
|
|
|
+ String sort = getVideoContentListSort(param.getSortType(), param.getSort());
|
|
|
String type = getVideoContentListType(param.getType());
|
|
String type = getVideoContentListType(param.getType());
|
|
|
String channel = getVideoContentListChannel(param.getSort(), user.getChannel());
|
|
String channel = getVideoContentListChannel(param.getSort(), user.getChannel());
|
|
|
List<ContentPlatformVideo> videoList = planMapperExt.getUploadVideoList(param, user.getId(), datastatDt,
|
|
List<ContentPlatformVideo> videoList = planMapperExt.getUploadVideoList(param, user.getId(), datastatDt,
|
|
|
type, channel, "normal", offset, param.getPageSize(), sort);
|
|
type, channel, "normal", offset, param.getPageSize(), sort);
|
|
|
- List<VideoContentItemVO> list = buildVideoContentItemVOList(videoList, type, channel, user.getChannel(), datastatDt);
|
|
|
|
|
|
|
+ List<VideoContentItemVO> list = buildVideoContentItemVOList(videoList, type, channel, user.getChannel(), datastatDt, datastatDt);
|
|
|
|
|
+ result.setObjs(list);
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Page<VideoContentItemVO> getCollectVideoContentList(VideoContentListParam param) {
|
|
|
|
|
+ ContentPlatformAccount user = LoginUserContext.getUser();
|
|
|
|
|
+ Page<VideoContentItemVO> result = new Page<>(param.getPageNum(), param.getPageSize());
|
|
|
|
|
+ int offset = (param.getPageNum() - 1) * param.getPageSize();
|
|
|
|
|
+ String dt = planMapperExt.getVideoMaxDt();
|
|
|
|
|
+ String datastatDt = planMapperExt.getVideoDatastatMaxDt();
|
|
|
|
|
+ String sort = getVideoContentListSort(param.getSortType(), param.getSort());
|
|
|
|
|
+ String type = getVideoContentListType(param.getType());
|
|
|
|
|
+ String channel = getVideoContentListChannel(param.getSort(), user.getChannel());
|
|
|
|
|
+ String strategy = param.getSort() == 3 ? "recommend" : "normal";
|
|
|
|
|
+ // 标签筛选
|
|
|
|
|
+ String tagFilterSql = getVideoContentListTagFilterSql(param.getTags(), user.getId(), type, user.getChannel());
|
|
|
|
|
+ // 近期未使用
|
|
|
|
|
+ Long excludeVideoRecentNotUsed = getVideoExcludeRecentNotUsed(param.getRecentNotUsed());
|
|
|
|
|
+
|
|
|
|
|
+ int count = planMapperExt.getCollectVideoCount(param, dt, datastatDt, type, channel, strategy,
|
|
|
|
|
+ videoMinScore, user.getId(), excludeVideoRecentNotUsed, tagFilterSql, 1);
|
|
|
|
|
+ result.setTotalSize(count);
|
|
|
|
|
+ if (count == 0) {
|
|
|
|
|
+ result.setObjs(new ArrayList<>());
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+ List<Long> videoIds = planMapperExt.getCollectVideoList(param, dt, datastatDt, type, channel,
|
|
|
|
|
+ strategy, videoMinScore, user.getId(), excludeVideoRecentNotUsed, tagFilterSql,
|
|
|
|
|
+ 1, offset, param.getPageSize(), sort);
|
|
|
|
|
+ List<ContentPlatformVideoAgg> videoAggList = getVideoAgg(dt, videoIds);
|
|
|
|
|
+ List<ContentPlatformVideo> videoList = videoAggList.stream().map(o -> {
|
|
|
|
|
+ ContentPlatformVideo item = new ContentPlatformVideo();
|
|
|
|
|
+ item.setVideoId(o.getVideoId());
|
|
|
|
|
+ item.setTitle(o.getTitle());
|
|
|
|
|
+ item.setCover(o.getCover());
|
|
|
|
|
+ item.setVideo(o.getVideo());
|
|
|
|
|
+ item.setScore(o.getScore());
|
|
|
|
|
+ return item;
|
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
|
+ List<VideoContentItemVO> list = buildVideoContentItemVOList(videoList, type, "sum", user.getChannel(), dt, datastatDt);
|
|
|
result.setObjs(list);
|
|
result.setObjs(list);
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
@@ -694,7 +829,7 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
|
|
|
@Override
|
|
@Override
|
|
|
public List<ContentPlatformQwPlanVideo> getQwPlanVideoList(List<Long> planIds) {
|
|
public List<ContentPlatformQwPlanVideo> getQwPlanVideoList(List<Long> planIds) {
|
|
|
ContentPlatformQwPlanVideoExample example = new ContentPlatformQwPlanVideoExample();
|
|
ContentPlatformQwPlanVideoExample example = new ContentPlatformQwPlanVideoExample();
|
|
|
- example.createCriteria().andPlanIdIn(planIds);
|
|
|
|
|
|
|
+ example.createCriteria().andPlanIdIn(planIds).andStatusEqualTo(VideoStatusEnum.NORMAL.getVal());
|
|
|
return qwPlanVideoMapper.selectByExample(example);
|
|
return qwPlanVideoMapper.selectByExample(example);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -703,7 +838,7 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
|
|
|
ContentPlatformVideoExample example = new ContentPlatformVideoExample();
|
|
ContentPlatformVideoExample example = new ContentPlatformVideoExample();
|
|
|
example.createCriteria().andVideoIdIn(videoIds);
|
|
example.createCriteria().andVideoIdIn(videoIds);
|
|
|
example.setOrderByClause("id asc");
|
|
example.setOrderByClause("id asc");
|
|
|
- return contentPlatformVideoMapper.selectByExample(example);
|
|
|
|
|
|
|
+ return videoMapper.selectByExample(example);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -711,7 +846,7 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
|
|
|
ContentPlatformVideoAggExample example = new ContentPlatformVideoAggExample();
|
|
ContentPlatformVideoAggExample example = new ContentPlatformVideoAggExample();
|
|
|
example.createCriteria().andVideoIdIn(videoIds);
|
|
example.createCriteria().andVideoIdIn(videoIds);
|
|
|
example.setOrderByClause("id asc");
|
|
example.setOrderByClause("id asc");
|
|
|
- return contentPlatformVideoAggMapper.selectByExample(example);
|
|
|
|
|
|
|
+ return videoAggMapper.selectByExample(example);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -752,6 +887,7 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
|
|
|
item.setTitle(videoParam.getTitle());
|
|
item.setTitle(videoParam.getTitle());
|
|
|
item.setCover(videoParam.getCover());
|
|
item.setCover(videoParam.getCover());
|
|
|
item.setVideo(videoParam.getVideo());
|
|
item.setVideo(videoParam.getVideo());
|
|
|
|
|
+ item.setStatus(VideoStatusEnum.NORMAL.getVal());
|
|
|
item.setCreateAccountId(loginAccountId);
|
|
item.setCreateAccountId(loginAccountId);
|
|
|
item.setCreateTimestamp(System.currentTimeMillis());
|
|
item.setCreateTimestamp(System.currentTimeMillis());
|
|
|
qwPlanVideoMapper.insertSelective(item);
|
|
qwPlanVideoMapper.insertSelective(item);
|
|
@@ -782,7 +918,7 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
|
|
|
@Override
|
|
@Override
|
|
|
public List<ContentPlatformQwPlanVideo> getQwPlanVideoListByPlanIds(List<Long> planIds) {
|
|
public List<ContentPlatformQwPlanVideo> getQwPlanVideoListByPlanIds(List<Long> planIds) {
|
|
|
ContentPlatformQwPlanVideoExample example = new ContentPlatformQwPlanVideoExample();
|
|
ContentPlatformQwPlanVideoExample example = new ContentPlatformQwPlanVideoExample();
|
|
|
- example.createCriteria().andPlanIdIn(planIds);
|
|
|
|
|
|
|
+ example.createCriteria().andPlanIdIn(planIds).andStatusEqualTo(VideoStatusEnum.NORMAL.getVal());
|
|
|
return qwPlanVideoMapper.selectByExample(example);
|
|
return qwPlanVideoMapper.selectByExample(example);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -793,7 +929,7 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
|
|
|
ContentPlatformAccount account = accountService.getAccountById(gzhAccount.getCreateAccountId());
|
|
ContentPlatformAccount account = accountService.getAccountById(gzhAccount.getCreateAccountId());
|
|
|
ContentPlatformGzhPlanExample example = new ContentPlatformGzhPlanExample();
|
|
ContentPlatformGzhPlanExample example = new ContentPlatformGzhPlanExample();
|
|
|
example.createCriteria().andCreateAccountIdEqualTo(account.getId()).andAccountIdEqualTo(gzhAccount.getId())
|
|
example.createCriteria().andCreateAccountIdEqualTo(account.getId()).andAccountIdEqualTo(gzhAccount.getId())
|
|
|
- .andStatusEqualTo(1).andTypeEqualTo(ContentPlatformGzhPlanTypeEnum.FWH_PUSH.getVal());
|
|
|
|
|
|
|
+ .andStatusEqualTo(AccountStatusEnum.NORMAL.getVal()).andTypeEqualTo(ContentPlatformGzhPlanTypeEnum.FWH_PUSH.getVal());
|
|
|
List<ContentPlatformGzhPlan> list = gzhPlanMapper.selectByExample(example);
|
|
List<ContentPlatformGzhPlan> list = gzhPlanMapper.selectByExample(example);
|
|
|
if (CollectionUtils.isNotEmpty(list)) {
|
|
if (CollectionUtils.isNotEmpty(list)) {
|
|
|
return account.getChannel();
|
|
return account.getChannel();
|
|
@@ -864,6 +1000,7 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
|
|
|
item.setTitle(videoDetail.getTitle());
|
|
item.setTitle(videoDetail.getTitle());
|
|
|
item.setCover(videoDetail.getCover());
|
|
item.setCover(videoDetail.getCover());
|
|
|
item.setVideo(videoDetail.getVideoPath());
|
|
item.setVideo(videoDetail.getVideoPath());
|
|
|
|
|
+ item.setStatus(VideoStatusEnum.NORMAL.getVal());
|
|
|
item.setCreateAccountId(account.getId());
|
|
item.setCreateAccountId(account.getId());
|
|
|
item.setCreateTimestamp(System.currentTimeMillis());
|
|
item.setCreateTimestamp(System.currentTimeMillis());
|
|
|
gzhPlanVideoMapper.insertSelective(item);
|
|
gzhPlanVideoMapper.insertSelective(item);
|
|
@@ -933,4 +1070,20 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<ContentPlatformVideoAgg> getVideoAgg(String dt, List<Long> videoIds) {
|
|
|
|
|
+ ContentPlatformVideoAggExample example = new ContentPlatformVideoAggExample();
|
|
|
|
|
+ example.createCriteria().andVideoIdIn(videoIds).andDtEqualTo(dt);
|
|
|
|
|
+ return videoAggMapper.selectByExample(example);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public ContentPlatformVideoAgg getVideoAgg(String dt, Long videoId) {
|
|
|
|
|
+ ContentPlatformVideoAggExample example = new ContentPlatformVideoAggExample();
|
|
|
|
|
+ example.createCriteria().andDtEqualTo(dt).andVideoIdEqualTo(videoId)
|
|
|
|
|
+ .andStatusEqualTo(VideoStatusEnum.NORMAL.getVal());
|
|
|
|
|
+ List<ContentPlatformVideoAgg> list = videoAggMapper.selectByExample(example);
|
|
|
|
|
+ return CollectionUtils.isEmpty(list) ? null : list.get(0);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|