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