瀏覽代碼

公众号计划修改

wangyunpeng 2 月之前
父節點
當前提交
31cefbdcc6

+ 31 - 0
api-module/src/main/java/com/tzld/piaoquan/api/common/enums/contentplatform/ContentPlatformGzhPlanTypeEnum.java

@@ -0,0 +1,31 @@
+package com.tzld.piaoquan.api.common.enums.contentplatform;
+
+import lombok.Getter;
+
+@Getter
+public enum ContentPlatformGzhPlanTypeEnum {
+    AUTO_REPLY(0, "自动回复"),
+    FWH_PUSH(1, "服务号推送"),
+
+    other(999, "其他");
+
+    // 0-自动回复、1-服务号推送
+    private final int val;
+    private final String description;
+
+    ContentPlatformGzhPlanTypeEnum(int val, String description) {
+        this.val = val;
+        this.description = description;
+    }
+
+    public static ContentPlatformGzhPlanTypeEnum from(int val) {
+        for (ContentPlatformGzhPlanTypeEnum typeEnum : ContentPlatformGzhPlanTypeEnum.values()) {
+            if (typeEnum.getVal() == val) {
+                return typeEnum;
+            }
+        }
+        return other;
+    }
+
+
+}

+ 1 - 1
api-module/src/main/java/com/tzld/piaoquan/api/common/enums/contentplatform/PublishStageEnum.java

@@ -5,7 +5,7 @@ import lombok.Getter;
 @Getter
 public enum PublishStageEnum {
     PLATFORM(0, "平台发布"),
-    USER(1, "用户发布"),
+    USER(1, "用户获取路径"),
 
     other(999, "其他");
 

+ 2 - 0
api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/ContentPlatformAccountService.java

@@ -22,4 +22,6 @@ public interface ContentPlatformAccountService {
     List<ContentPlatformAccount> getAccountListByChannels(List<String> channels);
 
     ContentPlatformAccount getAccountByChannel(String channel);
+
+    ContentPlatformAccount getAccountById(Long id);
 }

+ 2 - 0
api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/ContentPlatformCooperateAccountService.java

@@ -34,4 +34,6 @@ public interface ContentPlatformCooperateAccountService {
     List<ContentPlatformGzhAccount> getCooperateAccountListByGhIds(Long loginAccountId, List<String> ghIds);
 
     void gzhImport(List<String> channels);
+
+    ContentPlatformGzhAccount getGzhAccount(String ghId);
 }

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

@@ -69,4 +69,6 @@ public interface ContentPlatformPlanService {
     void qwPlanImport(List<String> channels);
 
     void gzhUpdateStagePublishStatus(Long id, Integer stagePublishStatus);
+
+    String getGzhChannel(String ghId);
 }

+ 5 - 0
api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/impl/ContentPlatformAccountServiceImpl.java

@@ -245,4 +245,9 @@ public class ContentPlatformAccountServiceImpl implements ContentPlatformAccount
         }
         return null;
     }
+
+    @Override
+    public ContentPlatformAccount getAccountById(Long id) {
+        return accountMapper.selectByPrimaryKey(id);
+    }
 }

+ 11 - 0
api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/impl/ContentPlatformCooperateAccountServiceImpl.java

@@ -237,4 +237,15 @@ public class ContentPlatformCooperateAccountServiceImpl implements ContentPlatfo
             }
         }
     }
+
+    @Override
+    public ContentPlatformGzhAccount getGzhAccount(String ghId) {
+        ContentPlatformGzhAccountExample example = new ContentPlatformGzhAccountExample();
+        example.createCriteria().andGhIdEqualTo(ghId).andStatusEqualTo(1);
+        List<ContentPlatformGzhAccount> accountList = gzhAccountMapper.selectByExample(example);
+        if (CollectionUtils.isNotEmpty(accountList)) {
+            return accountList.get(0);
+        }
+        return null;
+    }
 }

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

@@ -3,6 +3,7 @@ package com.tzld.piaoquan.api.service.contentplatform.impl;
 import com.alibaba.fastjson.JSONObject;
 import com.google.common.collect.Lists;
 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.exception.CommonException;
@@ -574,6 +575,22 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
         return qwPlanVideoMapper.selectByExample(example);
     }
 
+    @Override
+    public String getGzhChannel(String ghId) {
+        ContentPlatformGzhAccount gzhAccount = cooperateAccountService.getGzhAccount(ghId);
+        if (Objects.nonNull(gzhAccount)) {
+            ContentPlatformAccount account = accountService.getAccountById(gzhAccount.getCreateAccountId());
+            ContentPlatformGzhPlanExample example = new ContentPlatformGzhPlanExample();
+            example.createCriteria().andCreateAccountIdEqualTo(account.getId()).andAccountIdEqualTo(gzhAccount.getId())
+                    .andStatusEqualTo(1).andTypeEqualTo(ContentPlatformGzhPlanTypeEnum.FWH_PUSH.getVal());
+            List<ContentPlatformGzhPlan> list = gzhPlanMapper.selectByExample(example);
+            if (CollectionUtils.isNotEmpty(list)) {
+                return account.getChannel();
+            }
+        }
+        return null;
+    }
+
     @Override
     public void gzhPlanImport(List<String> channels) {
         List<ContentPlatformAccount> accountList = accountService.getAccountListByChannels(channels);

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

@@ -183,7 +183,15 @@ public class ThirdPartyPushMessageStrategyV1 implements ReplyStrategyService {
             SmallPageUrlDetail smallPageUrlDetail = new SmallPageUrlDetail();
             if (CollectionUtils.isEmpty(cgiReplyBucketData)) {
                 // 库里不存在,调用新生成
-                String response = touLiuHttpClient.sendAdFlowAddRequest(GET_SMALL_PAGE_URL, videoId, "dyyjs", channel, "自动", "公众号", "自动回复小程序", "位置" + sort, ghId);
+                String fwhChannel = contentPlatformPlanService.getGzhChannel(ghId);
+                String response;
+                if (StringUtils.isNotEmpty(fwhChannel)) {
+                    response = touLiuHttpClient.sendAdFlowAddRequest(GET_SMALL_PAGE_URL, videoId, "fwhdyy", fwhChannel,
+                            "自动", "公众号", "文章插小程序", "文字和小程序", ghId);
+                } else {
+                    response = touLiuHttpClient.sendAdFlowAddRequest(GET_SMALL_PAGE_URL, videoId, "dyyjs",
+                            channel, "自动", "公众号", "自动回复小程序", "位置" + sort, ghId);
+                }
                 JSONObject jsonObject = JSON.parseObject(response);
                 if (jsonObject.getInteger("code").equals(0)) {
                     smallPageUrlDetail = jsonObject.getObject("data", SmallPageUrlDetail.class);