Selaa lähdekoodia

添加广告组学习状态字段----优化更新头条素材类型sql执行速度

syh 4 vuotta sitten
vanhempi
commit
d4a813c7d6

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

@@ -23,7 +23,6 @@ import cn.com.ctop.toutiao.modules.report.service.*;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.xxl.job.core.context.XxlJobHelper;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.ibatis.annotations.Param;
@@ -1367,35 +1366,16 @@ public class TestController {
         return result;
     }
 
-    private ExecutorService executor = Executors.newFixedThreadPool(10);
-    private CountDownLatch countDownLatch;
     @Autowired
     IBytedanceVideoReportService bytedanceVideoReportService;
     @Autowired
     IETLReportBytedanceVideoService etlReportBytedanceVideoService;
     @GetMapping("execute")
-    public Map<String,Object> execute(String date) throws Exception {
+    public Map<String,Object> execute(Long accountId) throws Exception {
         Map<String,Object>result = new HashMap<>();
-//        List<CtopOauthToken> tokens = oauthTokenService.selectToutiaoToken();
-//        countDownLatch = new CountDownLatch(tokens.size());
-//        tokens.forEach(token -> executor.submit(() -> {
-//            try {
-//                bytedanceVideoReportService.pullVideoReport(token,date,date,1);
-//            } catch (Exception e) {
-//                XxlJobHelper.log("头条视频报表基础数据拉取异常:{}",e.getMessage());
-//            } finally {
-//                countDownLatch.countDown();
-//            }
-//        }));
-//        try {
-//            countDownLatch.await();
-//        } catch (InterruptedException e) {
-//            e.printStackTrace();
-//        }
-        Map<String,Object> params = new HashMap<>();
-        params.put("stat_datetime",date);
-        etlReportBytedanceVideoService.removeByMap(params);
-        etlReportBytedanceVideoService.cleanETL(date);
+        CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
+        kuaishouInterfaceService.getGroupList(token,new Date(),new Date());
+        kuaishouInterfaceService.getAdvertiserGroupReportDaily(token,new Date(),new Date());
         ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
         return result;
     }

+ 10 - 10
jeecg-boot-module-system/src/main/resources/application-wps.yml

@@ -95,21 +95,21 @@ spring:
         # 通过connectProperties属性来打开mergeSql功能;慢SQL记录
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
-        master:
-          url: jdbc:mysql://139.186.27.96:4000/jiaoyang?characterEncoding=UTF-8&useUnicode=true&useSSL=false
-          username: data
-          password: hcst@2021
-          driver-class-name: com.mysql.jdbc.Driver
+#        master:
+#          url: jdbc:mysql://139.186.27.96:4000/jiaoyang?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+#          username: data
+#          password: hcst@2021
+#          driver-class-name: com.mysql.jdbc.Driver
 #        master:
 #          url: jdbc:mysql://139.186.151.174:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true
 #          username: hcst
 #          password: hcst@2020
 #          driver-class-name: com.mysql.jdbc.Driver
-#        master:
-#          url: jdbc:mysql://139.186.27.96:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
-#          username: data
-#          password: hcst@2021
-#          driver-class-name: com.mysql.jdbc.Driver
+        master:
+          url: jdbc:mysql://139.186.27.96:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+          username: data
+          password: hcst@2021
+          driver-class-name: com.mysql.jdbc.Driver
   #redis 配置
   redis:
     database: 0

+ 2 - 5
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -583,10 +583,7 @@ public class SampleTest {
     private IEtlKuaishouVideoInfoService videoEtlInfoService;
     @Test
     public void etlKuaishouVideoInfo(){
-        Date startDate = DateUtils.parseDate("2019-09-11","yyyy-MM-dd");
-        for(int i=0;i<1000;i++){
-//            dailyService.etlKuaishouAccountMaterialReportDailyData(DateUtils.formatDate(DateUtils.addDay(startDate,i)));
-            videoEtlInfoService.etlKuaishouVideoInfo(DateUtils.formatDate(DateUtils.addDay(startDate,i)));
-        }
+        CtopOauthToken token = tokenService.getTokenByAccountId(9792538L);
+        kuaishouInterfaceService.getGroupList(token,new Date(),new Date());
     }
 }

+ 4 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouGroupMapper.xml

@@ -36,7 +36,8 @@
         group_create_time,
         group_update_time,
         create_time,
-        update_time)
+        update_time,
+        study_status)
         values
         <foreach collection="groups" item="getGroup" separator=",">
             (
@@ -73,7 +74,8 @@
             #{getGroup.groupCreateTime},
             #{getGroup.groupUpdateTime},
             #{getGroup.createTime},
-            #{getGroup.updateTime})
+            #{getGroup.updateTime},
+            #{getGroup.studyStatus})
         </foreach>
     </insert>
 

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

@@ -1121,6 +1121,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     }
 
 
+    @Override
     public JSONArray getCampaignList(CtopOauthToken token, Date startDate, Date endDate, int timeFilterType) {
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.CAMPAIGN_LIST;
         Map<String, String> headers = new HashMap<>();
@@ -1372,6 +1373,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                     group.setUnitName(unit_name);
                     group.setStatus(status);
                     group.setPutStatus(put_status);
+                    group.setStudyStatus(detail.getInteger("study_status"));
                     group.setCreateChannel(detail.getInteger("create_channel"));
                     group.setReviewDetail(detail.getString("review_detail"));
                     group.setBidType(bid_type);