Prechádzať zdrojové kódy

修改代理商数据获取逻辑

yumeng 3 rokov pred
rodič
commit
e976c15469

+ 16 - 9
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -2,8 +2,10 @@ package org.jeecg;
 
 import cn.com.ctop.common.module.entity.BindAccountLogin;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.entity.OauthAgentToken;
 import cn.com.ctop.common.module.service.IBindAccountLoginService;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.service.IOauthAgentTokenService;
 import cn.com.ctop.common.module.service.ISendMessageService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
@@ -20,6 +22,7 @@ import cn.com.ctop.kuaishou.modules.dimension.service.IKuaiShouDimensionVariable
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
 import cn.com.ctop.kuaishou.modules.material.service.IEtlKuaishouVideoInfoService;
 import cn.com.ctop.kuaishou.modules.report.mapper.EtlKuaishouAccountMaterialReportDailyMapper;
+import cn.com.ctop.kuaishou.modules.report.mapper.KuaiShouDailyAgentMapper;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouAudienceReportDailyService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyImageService;
 import cn.com.ctop.kuaishou.modules.report.service.IRuleKuaiShouPlanService;
@@ -104,18 +107,22 @@ public class SampleTest {
     private ISendMessageService sendMessageService;
     @Autowired
     private IKuaishouProgramCreativeService kuaishouProgramCreativeService;
-
+    @Autowired
+    private IOauthAgentTokenService agentTokenService;
+    @Autowired
+    private KuaiShouDailyAgentMapper agentMapper;
 
     @Test
     public void loadKuaishouCookie() throws ParseException {
-      /*  CtopOauthToken oauthToken = tokenService.getTokenByAccountId(10571378L);
-        ruleKuaiShouPlanService.cleanRuleDataTarget(10571378L, oauthToken.getAccessToken(), 1);*/
-
-     //   sendMessageService.sendMessage("eb003a809ff44ee6bd1d9be5384ef4b8","测试发送消息");
-        CtopOauthToken oauthToken = tokenService.getTokenByAccountId(10838846L);
-        kuaishouProgramCreativeService.getProgramCreative(oauthToken.getAccountId(),  536025521L, oauthToken.getAccessToken(), null, null, 1);
-
-        //   iKuaishouInterfaceService.getVideoList(oauthToken,null,null);
+        List<Long> appList = new ArrayList<>();
+        appList.add(27L);
+        appList.add(165893351L);
+        for (int i = 0; i < appList.size(); i++) {
+            Long appId = appList.get(i);
+            OauthAgentToken agentToken = agentTokenService.getTokenByAppId(appId);
+            System.err.println(agentToken);
+           // getAgentReport(agentToken.getAccessToken(), agentToken.getAgentId(), startDate, endDate, 1);
+        }
     }
 
 

+ 1 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IOauthAgentTokenService.java

@@ -11,4 +11,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface IOauthAgentTokenService extends IService<OauthAgentToken> {
 
+    OauthAgentToken getTokenByAppId(Long appId);
 }

+ 9 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/OauthAgentTokenServiceImpl.java

@@ -3,6 +3,7 @@ package cn.com.ctop.common.module.service.impl;
 import cn.com.ctop.common.module.entity.OauthAgentToken;
 import cn.com.ctop.common.module.mapper.OauthAgentTokenMapper;
 import cn.com.ctop.common.module.service.IOauthAgentTokenService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
@@ -16,4 +17,12 @@ import org.springframework.stereotype.Service;
 @Service
 public class OauthAgentTokenServiceImpl extends ServiceImpl<OauthAgentTokenMapper, OauthAgentToken> implements IOauthAgentTokenService {
 
+    @Override
+    public OauthAgentToken getTokenByAppId(Long appId) {
+        QueryWrapper<OauthAgentToken> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("app_id",appId);
+        queryWrapper.last("limit 1");
+        OauthAgentToken one = this.getOne(queryWrapper);
+        return one;
+    }
 }

+ 7 - 8
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaiShouDailyAgentServiceImpl.java

@@ -11,7 +11,6 @@ import cn.com.ctop.kuaishou.modules.report.mapper.KuaiShouDailyAgentMapper;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouDailyAgentService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -40,13 +39,13 @@ public class KuaiShouDailyAgentServiceImpl extends ServiceImpl<KuaiShouDailyAgen
 
     @Override
     public void getAgentReportByPage(String startDate, String endDate) {
-        QueryWrapper<OauthAgentToken> agentTokenQueryWrapper = new QueryWrapper<>();
-        agentTokenQueryWrapper.eq("media_id", 2);
-        List<OauthAgentToken> list = agentTokenService.list(agentTokenQueryWrapper);
-        if (!Check.isNull(list)) {
-            for (OauthAgentToken agentToken : list) {
-                getAgentReport(agentToken.getAccessToken(), agentToken.getAgentId(), startDate, endDate, 1);
-            }
+        List<Long> appList = new ArrayList<>();
+        appList.add(27L);
+        appList.add(165893351L);
+        for (int i = 0; i < appList.size(); i++) {
+            Long appId = appList.get(i);
+            OauthAgentToken agentToken = agentTokenService.getTokenByAppId(appId);
+            getAgentReport(agentToken.getAccessToken(), agentToken.getAgentId(), startDate, endDate, 1);
         }
     }