Przeglądaj źródła

Merge remote-tracking branch 'origin/master'

yumeng 3 lat temu
rodzic
commit
452e491502

+ 2 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/CtopOauthTokenMapper.java

@@ -59,4 +59,6 @@ public interface CtopOauthTokenMapper extends BaseMapper<CtopOauthToken> {
     List<CtopOauthToken> queryKsValidRuleAccountsToken();
 
     List<CtopOauthToken> queryTtValidRuleAccountsToken();
+
+    List<CtopOauthToken> selectTokensByProjectId(Long projectId);
 }

+ 10 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/CtopOauthTokenMapper.xml

@@ -159,4 +159,14 @@
               )
     </select>
 
+    <select id="selectTokensByProjectId" resultType="cn.com.ctop.common.module.entity.CtopOauthToken">
+        select t1.*
+        from ctop_oauth_token t1
+                 left join ctop_user_allocation t2
+                           on t1.account_id = t2.account_id
+        where t2.account_status = 0
+          and t2.project_id = #{projectId}
+        group by account_id
+    </select>
+
 </mapper>

+ 3 - 3
module-common/src/main/java/cn/com/ctop/common/module/service/impl/CtopOauthTokenServiceImpl.java

@@ -233,9 +233,9 @@ public class CtopOauthTokenServiceImpl extends ServiceImpl<CtopOauthTokenMapper,
 
     @Override
     public List<CtopOauthToken> getByProjectId(Long projectId) {
-        QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("project_id", projectId).eq("account_status", 0);
-        return this.list(queryWrapper);
+//        QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
+//        queryWrapper.eq("project_id", projectId).eq("account_status", 0);
+        return ctopOauthTokenMapper.selectTokensByProjectId(projectId);
     }
 
     @Override

+ 11 - 3
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyAudienceReportJob.java

@@ -1,7 +1,10 @@
 package cn.com.ctop.job.kuaishou.handler;
 
+import cn.com.ctop.alarm.modules.entity.RuleAccountTemplate;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.common.module.utils.HttpUtils2;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroup;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupService;
@@ -82,11 +85,16 @@ public class KuaishouDailyAudienceReportJob {
     }
 
 
-
+    String URLPREFIX = "http://api.tjyourong.com.cn/jeecg-boot/audienceReport/getOneAudienceDataNew?accountId=";
     @XxlJob("kuaishouDailyTaoTeAudienceReportJob")
     public void getTaoTeAudienceData() throws Exception {
-        String url = "http://api.tjyourong.com.cn/jeecg-boot/test/getAudienceDataNew";
-        HttpUtils2.httpGet(url, null, null);
+        List<CtopOauthToken> tokens = tokenService.getByProjectId(458L);    //淘特项目
+        if (!Check.isNull(tokens)) {
+            tokens.forEach(token -> {
+                String url = URLPREFIX + token.getAccountId();
+                HttpUtils.httpGet(url, null, null);
+            });
+        }
     }
 
     @XxlJob("kuaishouDailyTaoTeAudienceReportAggregationJob")

+ 8 - 6
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/agent/service/impl/AgentManagementServiceImpl.java

@@ -262,11 +262,12 @@ public class AgentManagementServiceImpl implements AgentManagementService {
         Calendar ca = Calendar.getInstance();
         ca.setTime(new Date());
         ca.add(Calendar.DATE, -1);
-        List<TransactionDay> transactionDetailsList = new ArrayList<>();
+
         try {
             List<String> accountIdList = ctopAgentAccountMapper.getAllAccountId();
             if (!accountIdList.isEmpty()) {
                 accountIdList.stream().forEach(str -> {
+                    List<TransactionDay> transactionDetailsList = new ArrayList<>();
                     if (!str.isEmpty()) {
                         //查询账号下充值的交易流水
                         JSONObject jsonObject = queryAccountTransactionDay(str, 1, 1000, startDate, endDate);
@@ -318,13 +319,14 @@ public class AgentManagementServiceImpl implements AgentManagementService {
                             }
                         }
                     }
+                    //保存数据
+                    if (!transactionDetailsList.isEmpty()) {
+                        ctopAccountTransactionDayMapper.saveAccountTransactionDay(transactionDetailsList, df.format(new Date()));
+                        log.info("新增日流水记录:{}条", transactionDetailsList.size());
+                    }
                 });
             }
-            //保存数据
-            if (!transactionDetailsList.isEmpty()) {
-                ctopAccountTransactionDayMapper.saveAccountTransactionDay(transactionDetailsList, df.format(new Date()));
-                log.info("新增日流水记录:{}条", transactionDetailsList.size());
-            }
+
             result.setSuccess(true);
             result.setMessage("success");
         } catch (Exception e) {