wangyunpeng 15 часов назад
Родитель
Сommit
27585af824

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

@@ -0,0 +1,29 @@
+package com.tzld.piaoquan.api.common.enums.contentplatform;
+
+import lombok.Getter;
+
+@Getter
+public enum ContentPlatformAccountTypeEnum {
+    PARTNER(1, "合作方"),
+    INTERNAL(2, "内部账号"),
+    AGENT(3, "代理商"),
+
+    other(999, "其他");
+
+    private final int val;
+    private final String description;
+
+    ContentPlatformAccountTypeEnum(int val, String description) {
+        this.val = val;
+        this.description = description;
+    }
+
+    public static ContentPlatformAccountTypeEnum from(int val) {
+        for (ContentPlatformAccountTypeEnum typeEnum : ContentPlatformAccountTypeEnum.values()) {
+            if (typeEnum.getVal() == val) {
+                return typeEnum;
+            }
+        }
+        return other;
+    }
+}

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

@@ -575,8 +575,8 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
     private void updateGhDetail(ContentPlatformGzhAccount account, Integer selectVideoType, List<Long> videoIds,
                                 Map<Long, String> videoIdTestIdMap) {
         ContentPlatformAccount loginUser = LoginUserContext.getUser();
-        // 根据 content_platform_account 的 type 判断公众号类型:type=2 内部账号 -> 内部公众号,否则 -> 外部公众号
-        Integer ghType = Objects.equals(loginUser.getType(), 2) ? GhTypeEnum.GH.type : GhTypeEnum.THIRD_PARTY_GH.type;
+        // 根据 content_platform_account 的 type 判断公众号类型:内部账号 -> 内部公众号,否则 -> 外部公众号
+        Integer ghType = Objects.equals(loginUser.getType(), ContentPlatformAccountTypeEnum.INTERNAL.getVal()) ? GhTypeEnum.GH.type : GhTypeEnum.THIRD_PARTY_GH.type;
         GhDetail ghDetail = ghDetailService.getGhDetailByGhIdType(account.getGhId(), ghType);
         GhDetailVo detailVo = new GhDetailVo();
         Integer strategyStatus = selectVideoType == 0 ? StrategyStatusEnum.DEFAULT.status : StrategyStatusEnum.STRATEGY.status;
@@ -2066,7 +2066,8 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
     @Override
     public List<XcxPlanItemVO> xcxPlanSave(XcxPlanSaveParam param) {
         ContentPlatformAccount loginUser = LoginUserContext.getUser();
-        if (!Objects.equals(loginUser.getType(), 2) && !Objects.equals(loginUser.getType(), 3)) {
+        if (!Objects.equals(loginUser.getType(), ContentPlatformAccountTypeEnum.INTERNAL.getVal())
+                && !Objects.equals(loginUser.getType(), ContentPlatformAccountTypeEnum.AGENT.getVal())) {
             throw new CommonException(ExceptionEnum.XCX_PLAN_INTERNAL_ONLY);
         }
         Long now = System.currentTimeMillis();
@@ -2099,7 +2100,8 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
     @Override
     public void xcxPlanDelete(Long id) {
         ContentPlatformAccount loginUser = LoginUserContext.getUser();
-        if (!Objects.equals(loginUser.getType(), 2) && !Objects.equals(loginUser.getType(), 3)) {
+        if (!Objects.equals(loginUser.getType(), ContentPlatformAccountTypeEnum.INTERNAL.getVal())
+                && !Objects.equals(loginUser.getType(), ContentPlatformAccountTypeEnum.AGENT.getVal())) {
             throw new CommonException(ExceptionEnum.XCX_PLAN_INTERNAL_ONLY);
         }
         ContentPlatformXcxPlan plan = xcxPlanMapper.selectByPrimaryKey(id);
@@ -2114,7 +2116,8 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
     @Override
     public List<XcxPlanItemVO> xcxPlanMultiLink(XcxPlanMultiLinkParam param) {
         ContentPlatformAccount loginUser = LoginUserContext.getUser();
-        if (!Objects.equals(loginUser.getType(), 2) && !Objects.equals(loginUser.getType(), 3)) {
+        if (!Objects.equals(loginUser.getType(), ContentPlatformAccountTypeEnum.INTERNAL.getVal())
+                && !Objects.equals(loginUser.getType(), ContentPlatformAccountTypeEnum.AGENT.getVal())) {
             throw new CommonException(ExceptionEnum.XCX_PLAN_INTERNAL_ONLY);
         }
         if (Objects.isNull(param.getPlanId()) || Objects.isNull(param.getCount())