Selaa lähdekoodia

Merge remote-tracking branch 'origin/master'

syh 4 vuotta sitten
vanhempi
commit
ee59a478aa

+ 46 - 19
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java

@@ -14,6 +14,7 @@ import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouDailyAgentService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
 import cn.com.ctop.toutiao.modules.material.service.IBytedanceEffectVideoInfoService;
 import cn.com.ctop.toutiao.modules.report.service.*;
+import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
@@ -86,11 +87,55 @@ public class TestController {
 
     static ExecutorService executorService = Executors.newFixedThreadPool(15);
     static ExecutorService videoService = Executors.newFixedThreadPool(5);
-    static ExecutorService suzhaoService = Executors.newFixedThreadPool(10);
+    static ExecutorService suzhaoService = Executors.newFixedThreadPool(5);
     @Autowired
     private IKuaiShouDailyAgentService dailyAgentService;
 
 
+    @GetMapping(value = "/getCreativeByProjectId")
+    public void gerCreative(Long projectId, String startDate, String endDate) {
+
+        Result<String> result = new Result<>();
+        try {
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+            Date start = simpleDateFormat.parse(startDate);
+            Date end = simpleDateFormat.parse(endDate);
+            QueryWrapper<UserAllocation> userAllocationQueryWrapper = new QueryWrapper<>();
+            userAllocationQueryWrapper.eq("project_id", projectId);
+            List<UserAllocation> list = userAllocationService.list(userAllocationQueryWrapper);
+            if (!Check.isNull(list)) {
+                for (UserAllocation allocation : list) {
+                    Long accountId = allocation.getAccountId();
+                    QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
+                    tokenQueryWrapper.eq("media_id", 2);
+                    tokenQueryWrapper.eq("account_id", accountId);
+                    CtopOauthToken token = oauthTokenMapper.selectOne(tokenQueryWrapper);
+                    if (!Check.isNull(token)) {
+                        suzhaoService.submit(new Runnable() {
+                            @Override
+                            public void run() {
+                                JSONArray arr = new JSONArray();
+                                kuaishouInterfaceService.getAdvertiserCreativeReportDaily(token, start, end, arr, arr);
+
+                            }
+                        });
+
+
+                    }
+                }
+
+            }
+
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+        }
+
+
+    }
+
+
     @GetMapping(value = "/agentReport")
     public void agentReport(String startDate, String endDate) {
         dailyAgentService.getAgentReportByPage(startDate, endDate);
@@ -886,24 +931,6 @@ public class TestController {
     }
 
 
-    @GetMapping(value = "/getCreativeByAccount")
-    public void gerCreative(Long accountId) {
-        QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
-        oauthTokenQueryWrapper.eq("media_id", 2);
-        oauthTokenQueryWrapper.eq("account_id", accountId);
-        oauthTokenQueryWrapper.last("limit 1");
-        CtopOauthToken token = oauthTokenMapper.selectOne(oauthTokenQueryWrapper);
-
-        try {
-            kuaishouInterfaceService.getCreativeList(token, null, null);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-
-
-    }
-
-
     @Autowired
     private IBytedancePlanDailyReportService planDailyReportService;
     @Autowired

+ 7 - 11
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java

@@ -698,10 +698,10 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             var creative = JSONObject.toJavaObject(detailJson, KuaishouReportDailyCreative.class);
             creative.setAccountId(token.getAccountId());
             // 取得MD5
-            String signature = creativeService.getCodeByCreativeId(creative.getCreativeId());
+         /*   String signature = creativeService.getCodeByCreativeId(creative.getCreativeId());
             if (!Check.isNull(signature)) {
                 creative.setSignature(signature);
-            }
+            }*/
             dailyCreativeService.saveOrUpdate(creative);
         }
         getAdvertiserCreativeReportDailyByPage(token, startDate, endDate, campaignIds, creativeIds, page + 1);
@@ -1155,7 +1155,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     }
 
 
-
     /**
      * 获取 单条 广告计划数据
      *
@@ -1222,7 +1221,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     }
 
     public JSONArray getGroupList(CtopOauthToken token, Long campaignId, Date startDate,
-                                  Date endDate,int time_filter_type){
+                                  Date endDate, int time_filter_type) {
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.GROUP_LIST;
         JSONObject param = new JSONObject();
         param.put("advertiser_id", token.getAccountId());
@@ -1231,7 +1230,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             param.put("end_date", DateUtils.formatDate(endDate));
         }
 
-        param.put("campaign_id",campaignId);
+        param.put("campaign_id", campaignId);
 
         Map<String, String> headers = new HashMap<>();
         headers.put("Access-Token", token.getAccessToken());
@@ -1257,7 +1256,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     }
 
 
-
     @Override
     public void getGroupList(CtopOauthToken token, Date startDate, Date endDate) {
         getGroupListByPage(token, startDate, endDate, 1);
@@ -1418,8 +1416,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     }
 
 
-
-    public JSONArray getCreativeList(CtopOauthToken token, Long unitId, Date startDate, Date endDate,int timeFilterType){
+    public JSONArray getCreativeList(CtopOauthToken token, Long unitId, Date startDate, Date endDate, int timeFilterType) {
         Long advertiserId = token.getAccountId();
         String accessToken = token.getAccessToken();
 
@@ -1434,8 +1431,8 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             param.put("end_date", DateUtils.formatDate(endDate));
         }
 
-        param.put("unit_id",unitId);
-        param.put("time_filter_type",timeFilterType);
+        param.put("unit_id", unitId);
+        param.put("time_filter_type", timeFilterType);
 
         String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
         JSONObject resultJson = JSONObject.parseObject(result);
@@ -1457,7 +1454,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     }
 
 
-
     @Override
     public void getCreativeList(CtopOauthToken token, Date startDate, Date endDate) {
         getCreativeListByPage(token.getAccessToken(), token.getAccountId(), startDate, endDate, 1);