|
@@ -277,16 +277,25 @@ public class BuckStrategyV1 implements ReplyStrategyService {
|
|
if (CollectionUtils.isEmpty(smallDataCgiReplyList)) {
|
|
if (CollectionUtils.isEmpty(smallDataCgiReplyList)) {
|
|
return smallDataCgiReplyList;
|
|
return smallDataCgiReplyList;
|
|
}
|
|
}
|
|
|
|
+ boolean hasPage = true;
|
|
|
|
+ for (CgiReplyBucketData cgiReplyBucketData : smallDataCgiReplyList) {
|
|
|
|
+ if (StringUtils.isEmpty(cgiReplyBucketData.getMiniPagePath())) {
|
|
|
|
+ hasPage = false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (hasPage) {
|
|
|
|
+ return smallDataCgiReplyList;
|
|
|
|
+ }
|
|
String putScene = "touliu";
|
|
String putScene = "touliu";
|
|
String channel = "tencentgzh";
|
|
String channel = "tencentgzh";
|
|
String ghId1 = smallDataCgiReplyList.get(0).getGhId();
|
|
String ghId1 = smallDataCgiReplyList.get(0).getGhId();
|
|
JSONObject rootSourceConfigs = JSON.parseObject(rootSourceConfig);
|
|
JSONObject rootSourceConfigs = JSON.parseObject(rootSourceConfig);
|
|
JSONObject jsonObject1 = rootSourceConfigs.getJSONObject(ghId1);
|
|
JSONObject jsonObject1 = rootSourceConfigs.getJSONObject(ghId1);
|
|
- if(jsonObject1 != null){
|
|
|
|
- if(StringUtils.isNotEmpty(jsonObject1.getString("putScene"))){
|
|
|
|
|
|
+ if (jsonObject1 != null) {
|
|
|
|
+ if (StringUtils.isNotEmpty(jsonObject1.getString("putScene"))) {
|
|
putScene = jsonObject1.getString("putScene");
|
|
putScene = jsonObject1.getString("putScene");
|
|
}
|
|
}
|
|
- if(StringUtils.isNotEmpty(jsonObject1.getString("channel"))){
|
|
|
|
|
|
+ if (StringUtils.isNotEmpty(jsonObject1.getString("channel"))) {
|
|
channel = jsonObject1.getString("channel");
|
|
channel = jsonObject1.getString("channel");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -381,7 +390,7 @@ public class BuckStrategyV1 implements ReplyStrategyService {
|
|
|
|
|
|
private List<CgiReplyBucketData> getDefaultData(BucketDataParam bucketDataParam, String key) {
|
|
private List<CgiReplyBucketData> getDefaultData(BucketDataParam bucketDataParam, String key) {
|
|
List<CgiReplyBucketData> result = new ArrayList<>();
|
|
List<CgiReplyBucketData> result = new ArrayList<>();
|
|
- if (CollectionUtils.isEmpty(bucketDataParam.getVideos())) {
|
|
|
|
|
|
+ if (CollectionUtils.isEmpty(bucketDataParam.getVideos()) && CollectionUtils.isEmpty(bucketDataParam.getMiniPageDatas())) {
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -389,58 +398,95 @@ public class BuckStrategyV1 implements ReplyStrategyService {
|
|
countExample.createCriteria().andIsDeleteEqualTo(0).andStrategyEqualTo(key)
|
|
countExample.createCriteria().andIsDeleteEqualTo(0).andStrategyEqualTo(key)
|
|
.andGhIdEqualTo(bucketDataParam.getGhId());
|
|
.andGhIdEqualTo(bucketDataParam.getGhId());
|
|
long allCount = cgiReplyBucketDataMapper.countByExample(countExample);
|
|
long allCount = cgiReplyBucketDataMapper.countByExample(countExample);
|
|
- if (allCount == bucketDataParam.getVideos().size()) {
|
|
|
|
- int existNum = 0;
|
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(bucketDataParam.getVideos())) {
|
|
|
|
+ if (allCount == bucketDataParam.getVideos().size()) {
|
|
|
|
+ int existNum = 0;
|
|
|
|
+ for (int i = 0; i < bucketDataParam.getVideos().size(); i++) {
|
|
|
|
+ int sort = i + 1;
|
|
|
|
+ Long videoId = bucketDataParam.getVideos().get(i);
|
|
|
|
+ CgiReplyBucketDataExample cgiReplyBucketDataExample = new CgiReplyBucketDataExample();
|
|
|
|
+ cgiReplyBucketDataExample.createCriteria().andIsDeleteEqualTo(0).andStrategyEqualTo(key)
|
|
|
|
+ .andGhIdEqualTo(bucketDataParam.getGhId()).andMiniVideoIdEqualTo(videoId).andSortEqualTo(sort);
|
|
|
|
+ long count = cgiReplyBucketDataMapper.countByExample(cgiReplyBucketDataExample);
|
|
|
|
+ if (count > 0) {
|
|
|
|
+ existNum++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (existNum == bucketDataParam.getVideos().size()) {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
for (int i = 0; i < bucketDataParam.getVideos().size(); i++) {
|
|
for (int i = 0; i < bucketDataParam.getVideos().size(); i++) {
|
|
int sort = i + 1;
|
|
int sort = i + 1;
|
|
Long videoId = bucketDataParam.getVideos().get(i);
|
|
Long videoId = bucketDataParam.getVideos().get(i);
|
|
- CgiReplyBucketDataExample cgiReplyBucketDataExample = new CgiReplyBucketDataExample();
|
|
|
|
- cgiReplyBucketDataExample.createCriteria().andIsDeleteEqualTo(0).andStrategyEqualTo(key)
|
|
|
|
- .andGhIdEqualTo(bucketDataParam.getGhId()).andMiniVideoIdEqualTo(videoId).andSortEqualTo(sort);
|
|
|
|
- long count = cgiReplyBucketDataMapper.countByExample(cgiReplyBucketDataExample);
|
|
|
|
- if (count > 0) {
|
|
|
|
- existNum++;
|
|
|
|
|
|
+ Map<Long, VideoDetail> videoDetailMap = touLiuHttpClient.getVideoDetailRequest(bucketDataParam.getVideos());
|
|
|
|
+ List<ContentPlatformGzhPlanVideo> gzhPlanVideoList = contentPlatformPlanService.getGzhPlanVideoListByCooperateAccountId(bucketDataParam.getGhId());
|
|
|
|
+ Map<Long, ContentPlatformGzhPlanVideo> gzhPlanVideoMap = gzhPlanVideoList.stream().collect(Collectors.toMap(ContentPlatformGzhPlanVideo::getVideoId, x -> x));
|
|
|
|
+ CgiReplyBucketData cgiReplyBucketData = new CgiReplyBucketData();
|
|
|
|
+ cgiReplyBucketData.setStrategy(key);
|
|
|
|
+ cgiReplyBucketData.setSort(sort);
|
|
|
|
+ cgiReplyBucketData.setGhId(bucketDataParam.getGhId());
|
|
|
|
+ cgiReplyBucketData.setMsgType(1);
|
|
|
|
+ VideoDetail videoDetail = videoDetailMap.get(videoId);
|
|
|
|
+ ContentPlatformGzhPlanVideo gzhPlanVideo = gzhPlanVideoMap.get(videoId);
|
|
|
|
+ // 内容合作平台视频标题和封面
|
|
|
|
+ if (Objects.nonNull(gzhPlanVideo) && Objects.nonNull(videoDetail)) {
|
|
|
|
+ cgiReplyBucketData.setTitle(ContentPlatformPlanService.getVideoTitle(gzhPlanVideo));
|
|
|
|
+ String cover = ContentPlatformPlanService.getVideoCover(gzhPlanVideo);
|
|
|
|
+ if (StringUtils.isNotEmpty(cover)) {
|
|
|
|
+ String coverSuffix = videoDetail.getCover().substring(videoDetail.getCover().indexOf("?"));
|
|
|
|
+ if (cover.contains("?") && cover.contains("image/resize")) {
|
|
|
|
+ coverSuffix = videoDetail.getCover().substring(videoDetail.getCover().indexOf("/watermark"));
|
|
|
|
+ }
|
|
|
|
+ cgiReplyBucketData.setCoverUrl(cover + coverSuffix);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ if (videoDetail != null && StringUtils.isNotEmpty(videoDetail.getCover())) {
|
|
|
|
+ cgiReplyBucketData.setCoverUrl(videoDetail.getCover());
|
|
|
|
+ }
|
|
|
|
+ if (videoDetail != null && StringUtils.isNotEmpty(videoDetail.getTitle())) {
|
|
|
|
+ cgiReplyBucketData.setTitle(videoDetail.getTitle());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ cgiReplyBucketData.setMiniAppId(SMALL_APP_Id);
|
|
|
|
+ cgiReplyBucketData.setMiniVideoId(videoId);
|
|
|
|
+ result.add(cgiReplyBucketData);
|
|
}
|
|
}
|
|
- if (existNum == bucketDataParam.getVideos().size()) {
|
|
|
|
- return null;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- for (int i = 0; i < bucketDataParam.getVideos().size(); i++) {
|
|
|
|
- int sort = i + 1;
|
|
|
|
- Long videoId = bucketDataParam.getVideos().get(i);
|
|
|
|
- Map<Long, VideoDetail> videoDetailMap = touLiuHttpClient.getVideoDetailRequest(bucketDataParam.getVideos());
|
|
|
|
- List<ContentPlatformGzhPlanVideo> gzhPlanVideoList = contentPlatformPlanService.getGzhPlanVideoListByCooperateAccountId(bucketDataParam.getGhId());
|
|
|
|
- Map<Long, ContentPlatformGzhPlanVideo> gzhPlanVideoMap = gzhPlanVideoList.stream().collect(Collectors.toMap(ContentPlatformGzhPlanVideo::getVideoId, x -> x));
|
|
|
|
- CgiReplyBucketData cgiReplyBucketData = new CgiReplyBucketData();
|
|
|
|
- cgiReplyBucketData.setStrategy(key);
|
|
|
|
- cgiReplyBucketData.setSort(sort);
|
|
|
|
- cgiReplyBucketData.setGhId(bucketDataParam.getGhId());
|
|
|
|
- cgiReplyBucketData.setMsgType(1);
|
|
|
|
- VideoDetail videoDetail = videoDetailMap.get(videoId);
|
|
|
|
- ContentPlatformGzhPlanVideo gzhPlanVideo = gzhPlanVideoMap.get(videoId);
|
|
|
|
- // 内容合作平台视频标题和封面
|
|
|
|
- if (Objects.nonNull(gzhPlanVideo) && Objects.nonNull(videoDetail)) {
|
|
|
|
- cgiReplyBucketData.setTitle(ContentPlatformPlanService.getVideoTitle(gzhPlanVideo));
|
|
|
|
- String cover = ContentPlatformPlanService.getVideoCover(gzhPlanVideo);
|
|
|
|
- if (StringUtils.isNotEmpty(cover)) {
|
|
|
|
- String coverSuffix = videoDetail.getCover().substring(videoDetail.getCover().indexOf("?"));
|
|
|
|
- if (cover.contains("?") && cover.contains("image/resize")) {
|
|
|
|
- coverSuffix = videoDetail.getCover().substring(videoDetail.getCover().indexOf("/watermark"));
|
|
|
|
|
|
+ } else if (!CollectionUtils.isEmpty(bucketDataParam.getMiniPageDatas())) {
|
|
|
|
+ if (allCount == bucketDataParam.getVideos().size()) {
|
|
|
|
+ int existNum = 0;
|
|
|
|
+ for (int i = 0; i < bucketDataParam.getMiniPageDatas().size(); i++) {
|
|
|
|
+ int sort = i + 1;
|
|
|
|
+ MiniPageData miniPageData = bucketDataParam.getMiniPageDatas().get(i);
|
|
|
|
+ CgiReplyBucketDataExample cgiReplyBucketDataExample = new CgiReplyBucketDataExample();
|
|
|
|
+ cgiReplyBucketDataExample.createCriteria().andIsDeleteEqualTo(0).andStrategyEqualTo(key)
|
|
|
|
+ .andGhIdEqualTo(bucketDataParam.getGhId()).andMiniPagePathEqualTo(miniPageData.getPage()).andSortEqualTo(sort);
|
|
|
|
+ long count = cgiReplyBucketDataMapper.countByExample(cgiReplyBucketDataExample);
|
|
|
|
+ if (count > 0) {
|
|
|
|
+ existNum++;
|
|
}
|
|
}
|
|
- cgiReplyBucketData.setCoverUrl(cover + coverSuffix);
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- if (videoDetail != null && StringUtils.isNotEmpty(videoDetail.getCover())) {
|
|
|
|
- cgiReplyBucketData.setCoverUrl(videoDetail.getCover());
|
|
|
|
}
|
|
}
|
|
- if (videoDetail != null && StringUtils.isNotEmpty(videoDetail.getTitle())) {
|
|
|
|
- cgiReplyBucketData.setTitle(videoDetail.getTitle());
|
|
|
|
|
|
+ if (existNum == bucketDataParam.getMiniPageDatas().size()) {
|
|
|
|
+ return null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- cgiReplyBucketData.setMiniAppId(SMALL_APP_Id);
|
|
|
|
- cgiReplyBucketData.setMiniVideoId(videoId);
|
|
|
|
- result.add(cgiReplyBucketData);
|
|
|
|
|
|
+
|
|
|
|
+ for (int i = 0; i < bucketDataParam.getMiniPageDatas().size(); i++) {
|
|
|
|
+ int sort = i + 1;
|
|
|
|
+ MiniPageData miniPageData = bucketDataParam.getMiniPageDatas().get(i);
|
|
|
|
+ CgiReplyBucketData cgiReplyBucketData = new CgiReplyBucketData();
|
|
|
|
+ cgiReplyBucketData.setStrategy(key);
|
|
|
|
+ cgiReplyBucketData.setSort(sort);
|
|
|
|
+ cgiReplyBucketData.setGhId(bucketDataParam.getGhId());
|
|
|
|
+ cgiReplyBucketData.setMsgType(1);
|
|
|
|
+ cgiReplyBucketData.setCoverUrl(miniPageData.getCover());
|
|
|
|
+ cgiReplyBucketData.setTitle(miniPageData.getTitle());
|
|
|
|
+ cgiReplyBucketData.setMiniPagePath(miniPageData.getPage());
|
|
|
|
+ cgiReplyBucketData.setMiniAppId(SMALL_APP_Id);
|
|
|
|
+ result.add(cgiReplyBucketData);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ return null;
|
|
}
|
|
}
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|