yumeng 5 роки тому
батько
коміт
b8f2a26264

+ 14 - 3
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -1,8 +1,11 @@
 package org.jeecg;
 
+import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAccountMapper;
 import lombok.extern.slf4j.Slf4j;
+import org.junit.After;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringRunner;
@@ -18,6 +21,8 @@ public class SampleTest {
     @Value("${jeecg.path.chrome-driver}")
     private String chromeDriver;
 
+    @Autowired
+    private KuaishouReportDailyAccountMapper reportDailyAccountMapper;
     @Test
     public void kuaisShouReport() {
 
@@ -73,13 +78,13 @@ public class SampleTest {
             String result = HttpUtils.KuaiShouttpGetRequest(url, param,headers);*/
 
 
-            URL url = new URL("https://ad.e.kuaishou.com/rest/openapi/v1/async_task/download?task_id=1229917&advertiser_id=142402");
+            /*URL url = new URL("https://ad.e.kuaishou.com/rest/openapi/v1/async_task/download?task_id=1229917&advertiser_id=142402");
             HttpURLConnection conn = (HttpURLConnection) url.openConnection();
             //设置超时间为3秒
             conn.setConnectTimeout(10 * 1000);
             //防止屏蔽程序抓取而返回403错误
             conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
-            conn.setRequestProperty("Access-Token", "eb9a0d18072eabc339ee26ad010ecd6b");
+            conn.setRequestProperty("Access-Token", "0b5a280170a155f50636b2efd95def15");
             //得到输入流
             InputStream inputStream = conn.getInputStream();
             //获取自己数组
@@ -90,7 +95,8 @@ public class SampleTest {
             if (!saveDir.exists()) {
                 saveDir.mkdirs();
             }
-            File file = new File(saveDir + File.separator + "qqww.csv");
+            String fileName = "123.csv";
+            File file = new File(saveDir + File.separator + fileName);
             FileOutputStream fos = new FileOutputStream(file);
             fos.write(getData);
             if (fos != null) {
@@ -99,6 +105,11 @@ public class SampleTest {
             if (inputStream != null) {
                 inputStream.close();
             }
+*/
+            String localPath = "D:\\file\\123.csv";
+
+            reportDailyAccountMapper.loadAccountDailyReport(142402L,localPath);
+
 
 
         } catch (Exception e) {

+ 2 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyAccountMapper.java

@@ -1,8 +1,9 @@
 package cn.com.ctop.kuaishou.modules.report.mapper;
 
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccount;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyAccount;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
 
 public interface KuaishouReportDailyAccountMapper extends BaseMapper<KuaishouReportDailyAccount> {
+    void loadAccountDailyReport(@Param("accountId") Long accountId, @Param("localPath") String localPath);
 }

+ 66 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyAccountMapper.xml

@@ -1,5 +1,71 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
 <mapper namespace="cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAccountMapper">
 
+
+    <insert id="loadAccountDailyReport">
+		LOAD DATA local INFILE 'D://file//123.csv'
+		INTO TABLE ctop_kuaishou_report_daily_account_new CHARACTER SET utf8
+		FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n'
+		IGNORE 1 LINES
+		(
+		ad_scene,
+        charge,
+        photo_show,
+        aclick,
+        bclick,
+        share,
+        comment,
+        photo_like,
+        follow,
+        cancel_follow,
+        report,
+        block,
+        negative,
+        download_started,
+        download_completed,
+        activation,
+        submit,
+        stat_date,
+        stat_hour,
+        photo_click,
+        photo_click_ratio,
+        action_ratio,
+        impression_1k_cost,
+        photo_click_cost,
+        action_cost,
+        event_pay_first_day,
+        event_pay_purchase_amount_first_day,
+        event_pay_first_day_roi,
+        event_pay,
+        event_pay_purchase_amount,
+        event_pay_roi,event_register,
+        event_register_cost,
+        event_register_ratio,
+        event_jin_jian_app,
+        event_jin_jian_app_cost,
+        event_credit_grant_app,
+        event_credit_grant_app_cost,
+        event_credit_grant_app_ratio,
+        event_order_paid,
+        event_order_paid_purchase_amount,
+        event_order_paid_cost,
+        form_count,
+        form_cost,
+        form_action_ratio,
+        event_jin_jian_landing_page,
+        event_jin_jian_landing_page_cost,
+        event_credit_grant_landing_page,
+        event_credit_grant_landing_page_cost,
+        event_credit_grant_landing_ratio,
+        event_next_day_stay_cost,
+        event_next_day_stay_ratio,
+        event_next_day_stay,
+        play_3s_ratio
+         )
+          set account_id = 131332
+    </insert>
+
+
 </mapper>