Prechádzať zdrojové kódy

渠道号。。。详情页添加排序

zhaoxian 4 rokov pred
rodič
commit
27082bfb73

+ 2 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouAdvertiserStrategy.java

@@ -388,6 +388,8 @@ public class AiKuaishouAdvertiserStrategy {
     private Integer historyTop;
     private Integer multipleBids;
     private Integer systemOptimization;
+    private String usageLevel;
+    private Integer useChannel;
 
 
     @TableField(exist = false)

+ 17 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/controller/KuaishouChannelController.java

@@ -271,6 +271,23 @@ public class KuaishouChannelController {
     }
 
     /**
+     * 通过账户查询渠道号级别
+     */
+    @GetMapping(value = "/queryChannelLevel")
+    public Result<Object> queryChannelLevel(Long accountId) {
+        try {
+            if (Check.isNull(accountId)) {
+                return Result.error("缺失参数");
+            }
+            return kuaishouChannelService.queryChannelLevel(accountId);
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("通过账户查询渠道号级别异常", e);
+            return Result.error("通过账户查询渠道号级别失败," + e.getMessage());
+        }
+    }
+
+    /**
      * 通过id删除
      *
      * @param id

+ 2 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/mapper/KuaishouChannelMapper.java

@@ -43,4 +43,6 @@ public interface KuaishouChannelMapper extends BaseMapper<KuaishouChannel> {
     List<Integer> queryUsedLevel(@Param("strategys") List<KuaishouChannelCreateStrategy> strategys);
 
     List<KuaishouChannel> queryChannelByHaveCycleTimes(@Param("haveCycleTimes") Integer haveCycleTimes, @Param("usageLevel") String usageLevel, @Param("strategys") List<KuaishouChannelCreateStrategy> strategys);
+
+    List<JSONObject> queryItemsListByAccountId(@Param("accountId") Long accountId);
 }

+ 17 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/mapper/xml/KuaishouChannelMapper.xml

@@ -160,7 +160,8 @@
         SELECT id,
                channel_code,
                usage_level,
-               usage_range
+               usage_range,
+               is_have_item
         FROM `ctop_kuaishou_channel`
         WHERE account_id = #{accountId}
         ORDER BY usage_range limit 1
@@ -224,4 +225,19 @@
         group by have_cycle_times
     </select>
 
+    <select id="queryItemsListByAccountId" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+            tt2.item_name as 'itemName',
+            tt1.channel_code as 'channelCode',
+            tt4.app_name as 'appName'
+        FROM
+            ctop_kuaishou_channel_rel tt1
+                INNER JOIN ( SELECT t3.item_name, t1.channel_code FROM ctop_kuaishou_channel t1 INNER JOIN ctop_kuaishou_channel_items_rel t2 ON t1.id = t2.channel_id LEFT JOIN ctop_kuaishou_channel_items t3 ON t2.item_id = t3.id WHERE t1.is_have_item = 1 AND t3.item_name IS NOT NULL ) tt2 ON tt2.channel_code = tt1.channel_code
+                INNER JOIN ctop_kuaishou_channel_app_info tt4 ON tt1.app_id = tt4.app_id
+        WHERE
+            tt1.account_id = #{accountId}
+        GROUP BY
+            tt2.item_name
+    </select>
+
 </mapper>

+ 2 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/service/IKuaishouChannelService.java

@@ -30,4 +30,6 @@ public interface IKuaishouChannelService extends IService<KuaishouChannel> {
     Result<Object> customizedCreate(JSONObject request,Integer createType) throws Exception;
 
     Result<Object> queryChannel(Long accountId, String usageLevel) throws Exception;
+
+    Result<Object> queryChannelLevel(Long accountId);
 }

+ 20 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/service/impl/KuaishouChannelServiceImpl.java

@@ -115,8 +115,8 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
 
 
     @Override
-    public Result<Object> channelManagementHome(Long productId, Long projectId, Long accountId,String userId) {
-        List<JSONObject> list = channelMapper.channelManagementHome(productId, projectId, accountId,userId);
+    public Result<Object> channelManagementHome(Long productId, Long projectId, Long accountId, String userId) {
+        List<JSONObject> list = channelMapper.channelManagementHome(productId, projectId, accountId, userId);
         return Result.ok(new PageInfo<>(list));
     }
 
@@ -386,10 +386,12 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
             String newFileUrl = kuaishouAppPackageService.getDownloadPath(appIconUrl);
             if (Check.isNull(newFileUrl)) {
                 log.error("下载图片失败,原路径:" + appIconUrl);
+                obj.put("message","下载图片失败,原路径:" + appIconUrl);
                 return obj;
             }
             if (Check.isNull(token)) {
                 log.error("根据图片路径获取md5,获取token失败");
+                obj.put("message","根据图片路径获取md5,获取token失败");
                 return obj;
             }
             String md5 = null;
@@ -400,6 +402,7 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
             }
             if (Check.isNull(md5)) {
                 log.error("获取MD5签名失败,路径:" + newFileUrl);
+                obj.put("message","获取MD5签名失败,路径:" + newFileUrl);
                 return obj;
             }
             //获取图片MD5
@@ -912,6 +915,21 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
         return Result.error("未查到渠道号");
     }
 
+    @Override
+    public Result<Object> queryChannelLevel(Long accountId) {
+        KuaishouChannel channel = channelMapper.queryByAccountId(accountId);
+        if (Check.isNull(channel)) {
+            return Result.ok("没有渠道号");
+        }
+        JSONObject request = new JSONObject();
+        if (channel.getIsHaveItem() == 1) {
+            List<JSONObject> list = channelMapper.queryItemsListByAccountId(accountId);
+            request.put("list", list);
+        }
+        request.put("channel", channel);
+        return Result.ok(request);
+    }
+
     private Result<Object> doAccountRangeAccountLevel(Long accountId, List<KuaishouChannelCreateStrategy> strategys) throws Exception {
         List<KuaishouChannel> channelList = channelMapper.queryByAccountIdLevel(accountId, "account");
         if (!Check.isNull(channelList)) {