Explorar o código

Merge branch 'master' into 20250609-wyp-price

wangyunpeng hai 1 mes
pai
achega
866ad84877

+ 3 - 3
api-module/src/main/java/com/tzld/piaoquan/api/job/ContentPlatformDatastatJob.java

@@ -71,7 +71,7 @@ public class ContentPlatformDatastatJob {
                 "left join loghubods.out_channel_mid_split_total fission " +
                 "on first_level.channel_shortname = fission.channel_shortname and first_level.subchannel = fission.subchannel and first_level.dt = fission.dt " +
                 "and first_level.type = fission.type and first_level.tag = fission.tag " +
-                "WHERE   first_level.dt = %s and first_level.type = '公众号即时回复' and first_level.tag = '投放渠道内分客户分账号去重';", dt);
+                "WHERE   first_level.dt = %s and first_level.type = '公众号即时回复' and first_level.tag = '投放渠道客户分账号去重';", dt);
         List<Record> dataList = OdpsUtil.getOdpsData(sql);
         // 所有公众号
         List<ContentPlatformGzhAccount> accountList = getAllGzhAccount();
@@ -201,7 +201,7 @@ public class ContentPlatformDatastatJob {
                 "left join loghubods.out_channel_mid_split_total fission " +
                 "on first_level.subchannel = fission.subchannel and first_level.dt = fission.dt " +
                 "and first_level.type = fission.type and first_level.tag = fission.tag " +
-                "WHERE   first_level.dt = %s and first_level.type = '服务号代运营' and first_level.tag = '投放渠道内分客户分账号去重' ;", dt);
+                "WHERE   first_level.dt = %s and first_level.type = '服务号代运营' and first_level.tag = '投放渠道客户分账号去重' ;", dt);
         List<Record> dataList = OdpsUtil.getOdpsData(sql);
         // 所有公众号
         List<ContentPlatformGzhAccount> accountList = getAllGzhAccount();
@@ -571,7 +571,7 @@ public class ContentPlatformDatastatJob {
                 "left join loghubods.out_channel_mid_split_total fission " +
                 "on first_level.channel_shortname = fission.channel_shortname and first_level.subchannel = fission.subchannel and first_level.dt = fission.dt " +
                 "and first_level.type = fission.type and first_level.tag = fission.tag " +
-                "WHERE   first_level.dt = %s and first_level.type = '企微外部' and first_level.tag = '投放渠道内分客户分账号去重' ;", dt);
+                "WHERE   first_level.dt = %s and first_level.type = '企微外部' and first_level.tag = '投放渠道客户分账号去重' ;", dt);
         List<Record> outDataList = OdpsUtil.getOdpsData(outSql);
         List<ContentPlatformAccount> accountList = getAllAccount();
         Map<String, ContentPlatformAccount> accountMap = accountList.stream()

+ 1 - 1
api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/ContentPlatformPlanService.java

@@ -23,7 +23,7 @@ public interface ContentPlatformPlanService {
         if (StringUtils.hasText(video.getCustomCover())) {
             return video.getCustomCover();
         }
-        return video.getCover();
+        return video.getCover().substring(0, video.getCover().indexOf("?"));
     }
 
     Page<GzhPlanItemVO> gzhPlanList(GzhPlanListParam param);

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

@@ -313,20 +313,25 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
     }
 
     private void updateCgiReplyBucketData(String ghId, List<GzhPlanVideoContentItemParam> videoList) {
-        for (GzhPlanVideoContentItemParam video : videoList) {
-            if (!StringUtils.hasText(video.getCustomCover()) && !StringUtils.hasText(video.getCustomTitle())) {
-                continue;
-            }
-            List<CgiReplyBucketData> dataList = cgiReplyService.getCgiReplyBucketDataListByVideoId(video.getVideoId());
-            if (CollectionUtils.isEmpty(dataList)) {
-                continue;
-            }
-            String existsCover = dataList.get(0).getCoverUrl();
-            String coverSuffix = existsCover.substring(existsCover.indexOf("?"));
-            cgiReplyBucketDataMapperExt.updateBucketDataTitleCoverByGhId(ghId, video.getVideoId(),
-                    StringUtils.hasText(video.getCustomTitle()) ? video.getCustomTitle() : video.getTitle(),
-                    StringUtils.hasText(video.getCustomCover()) ? video.getCustomCover() : video.getCover() + coverSuffix);
-        }
+        cgiReplyBucketDataMapperExt.deleteBucketDataByGhId(ghId);
+//        for (GzhPlanVideoContentItemParam video : videoList) {
+//            if (!StringUtils.hasText(video.getCustomCover()) && !StringUtils.hasText(video.getCustomTitle())) {
+//                continue;
+//            }
+//            List<CgiReplyBucketData> dataList = cgiReplyService.getCgiReplyBucketDataListByVideoId(video.getVideoId());
+//            if (CollectionUtils.isEmpty(dataList)) {
+//                continue;
+//            }
+//            String existsCover = dataList.get(0).getCoverUrl();
+//            if (!existsCover.contains("?")) {
+//                continue;
+//            }
+//            String coverSuffix = existsCover.substring(existsCover.indexOf("?"));
+//            String cover = video.getCover().substring(0, existsCover.indexOf("?"));
+//            cgiReplyBucketDataMapperExt.updateBucketDataTitleCoverByGhId(ghId, video.getVideoId(),
+//                    StringUtils.hasText(video.getCustomTitle()) ? video.getCustomTitle() : video.getTitle(),
+//                    StringUtils.hasText(video.getCustomCover()) ? video.getCustomCover() : cover + coverSuffix);
+//        }
     }
 
     private void saveGzhPlanVideo(GzhPlanSaveParam param, List<Long> videoIds, Long planId,

+ 4 - 31
api-module/src/test/java/com/tzld/piaoquan/api/ContentPlatformTest.java

@@ -1,56 +1,29 @@
 package com.tzld.piaoquan.api;
 
 import com.tzld.piaoquan.api.job.ContentPlatformDatastatJob;
-import com.tzld.piaoquan.api.service.contentplatform.ContentPlatformCooperateAccountService;
-import com.tzld.piaoquan.api.service.contentplatform.ContentPlatformPlanService;
 import com.tzld.piaoquan.growth.common.utils.DateUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.junit.jupiter.api.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 
-import java.util.Arrays;
 import java.util.List;
 
 @SpringBootTest(classes = GrowthServerApplication.class)
 @Slf4j
 public class ContentPlatformTest {
 
-    @Autowired
-    ContentPlatformCooperateAccountService cooperateAccountService;
-
-    @Autowired
-    ContentPlatformPlanService planService;
-
     @Autowired
     ContentPlatformDatastatJob datastatJob;
 
-    @Test
-    public void testImportGzhAccount() {
-        List<String> channels = Arrays.asList("ml","yy","zh","llf","wxm","hc","xs","wx","yqst","lq","bh","qd","bz","sw","pj","cy","xsy","ls","zqh");
-        cooperateAccountService.gzhImport(channels);
-    }
-
-    @Test
-    public void testImportGzhPlan() {
-        List<String> channels = Arrays.asList("ml","yy","zh","llf","wxm","hc","xs","wx","yqst","lq","bh","qd","bz","sw","pj","cy","xsy","ls","zqh");
-        planService.gzhPlanImport(channels);
-    }
-
-    @Test
-    public void testImportQwPlan() {
-        List<String> channels = Arrays.asList("ml2025", "mj", "nh", "qc", "tczy", "wb", "xj", "wxm", "xycsd", "shy");
-        planService.qwPlanImport(channels);
-    }
-
-
     @Test
     public void testSyncContentPlatformQwDatastatReplyTotalJob() {
-        List<String> dtList = DateUtil.getBeforeDays(14);
+        List<String> dtList = DateUtil.getBeforeDays(1);
         for (String dt : dtList) {
-            datastatJob.syncContentPlatformQwDatastatReplyTotalJob(dt);
+            datastatJob.syncContentPlatformGzhDatastatJob(dt);
+            datastatJob.syncContentPlatformFwhDatastatJob(dt);
+            datastatJob.syncContentPlatformQwDatastatSubChannelJob(dt);
         }
     }
 
-
 }

+ 2 - 0
common-module/src/main/java/com/tzld/piaoquan/growth/common/dao/mapper/ext/CgiReplyBucketDataMapperExt.java

@@ -10,4 +10,6 @@ public interface CgiReplyBucketDataMapperExt {
                                           @Param("videoId") Long videoId,
                                           @Param("title") String title,
                                           @Param("cover") String cover);
+
+    void deleteBucketDataByGhId(@Param("ghId") String ghId);
 }

+ 7 - 0
common-module/src/main/resources/mapper/ext/CgiReplyBucketDataMapperExt.xml

@@ -11,4 +11,11 @@
         and is_delete = 0
   </update>
 
+  <update id="deleteBucketDataByGhId">
+      update cgi_reply_bucket_data
+      set is_delete = 1
+      where gh_id = #{ghId}
+        and is_delete = 0
+  </update>
+
 </mapper>