Просмотр исходного кода

getCgiReplyBucketData withCustomTitleCover

wangyunpeng 2 дней назад
Родитель
Сommit
a76ed29013

+ 10 - 4
api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/impl/ContentPlatformPlanServiceImpl.java

@@ -193,11 +193,17 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
     private String buildCustomPageUrl(GzhPlanVideoContentItemVO videoItemVO, ContentPlatformGzhPlanVideo video) {
         String pageUrl = videoItemVO.getPageUrl();
         try {
-            if (Objects.nonNull(video.getCustomTitleId()) && StringUtils.hasText(videoItemVO.getCustomTitle())) {
-                pageUrl += URLEncoder.encode("&shareTitleId=" + video.getCustomTitleId() + "&shareTitle=" + video.getCustomTitle(), "UTF-8");
+            if (StringUtils.hasText(videoItemVO.getCustomTitle()) && !pageUrl.contains("shareTitle")) {
+                if (Objects.nonNull(video.getCustomTitleId())) {
+                    pageUrl += URLEncoder.encode("&shareTitleId=" + video.getCustomTitleId(), "UTF-8");
+                }
+                pageUrl += URLEncoder.encode("&shareTitle=" + video.getCustomTitle(), "UTF-8");
             }
-            if (Objects.nonNull(video.getCustomCoverId()) && StringUtils.hasText(videoItemVO.getCustomCover())) {
-                pageUrl += URLEncoder.encode("&shareImageId=" + video.getCustomCoverId() + "&shareImageUrl=" + URLEncoder.encode(video.getCustomCover(), "UTF-8"), "UTF-8");
+            if (StringUtils.hasText(videoItemVO.getCustomCover()) && !pageUrl.contains("shareImageUrl")) {
+                if (Objects.nonNull(video.getCustomCoverId())) {
+                    pageUrl += URLEncoder.encode("&shareImageId=" + video.getCustomCoverId(), "UTF-8");
+                }
+                pageUrl += URLEncoder.encode("&shareImageUrl=" +  URLEncoder.encode(video.getCustomCover(), "UTF-8"), "UTF-8");
             }
             return pageUrl;
         } catch (UnsupportedEncodingException e) {

+ 25 - 0
api-module/src/main/java/com/tzld/piaoquan/api/service/strategy/impl/ThirdPartyPushMessageStrategyV1.java

@@ -27,6 +27,7 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
+import java.net.URLEncoder;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -163,8 +164,32 @@ public class ThirdPartyPushMessageStrategyV1 implements ReplyStrategyService {
                 cgiReplyBucketData.setIsDelete(1);
                 cgiReplyBucketDataMapper.updateByPrimaryKeySelective(cgiReplyBucketData);
             }
+            List<ContentPlatformGzhPlanVideo> gzhPlanVideoList = contentPlatformPlanService.getGzhPlanVideoListByCooperateAccountId(bucketDataParam.getGhId());
+            Map<Long, ContentPlatformGzhPlanVideo> gzhPlanVideoMap = gzhPlanVideoList.stream()
+                    .collect(Collectors.toMap(ContentPlatformGzhPlanVideo::getVideoId, x -> x, (a, b) -> b));
             // 入库
             for (CgiReplyBucketData cgiReplyBucketData : collect) {
+                ContentPlatformGzhPlanVideo gzhPlanVideo = gzhPlanVideoMap.get(cgiReplyBucketData.getMiniVideoId());
+                if (Objects.nonNull(gzhPlanVideo)) {
+                    try {
+                        String pageUrl = cgiReplyBucketData.getMiniPagePath();
+                        if (org.springframework.util.StringUtils.hasText(gzhPlanVideo.getCustomTitle()) && !pageUrl.contains("shareTitle")) {
+                            if (Objects.nonNull(gzhPlanVideo.getCustomTitleId())) {
+                                pageUrl += URLEncoder.encode("&shareTitleId=" + gzhPlanVideo.getCustomTitleId(), "UTF-8");
+                            }
+                            pageUrl += URLEncoder.encode("&shareTitle=" + gzhPlanVideo.getCustomTitle(), "UTF-8");
+                        }
+                        if (org.springframework.util.StringUtils.hasText(gzhPlanVideo.getCustomCover()) && !pageUrl.contains("shareImageUrl")) {
+                            if (Objects.nonNull(gzhPlanVideo.getCustomCoverId())) {
+                                pageUrl += URLEncoder.encode("&shareImageId=" + gzhPlanVideo.getCustomCoverId(), "UTF-8");
+                            }
+                            pageUrl += URLEncoder.encode("&shareImageUrl=" + URLEncoder.encode(gzhPlanVideo.getCustomCover(), "UTF-8"), "UTF-8");
+                        }
+                        cgiReplyBucketData.setMiniPagePath(pageUrl);
+                    } catch (Exception e) {
+                        log.error("ThirdPartyPushMessageStrategyV1 insertSmallData setPageUrlCustomCoverTitle error,data:" + JSON.toJSONString(cgiReplyBucketData));
+                    }
+                }
                 cgiReplyBucketDataMapper.insertSelective(cgiReplyBucketData);
                 String redisKey = "auto_reply_video_detail_" + cgiReplyBucketData.getRootSourceId();
                 VideoCharacteristicVO vo = new VideoCharacteristicVO();