|
@@ -9,6 +9,7 @@ import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAgentMapper
|
|
import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAgentSumMapper;
|
|
import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAgentSumMapper;
|
|
import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAgentService;
|
|
import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAgentService;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
+import com.fasterxml.jackson.databind.DeserializationFeature;
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import org.apache.http.client.CookieStore;
|
|
import org.apache.http.client.CookieStore;
|
|
@@ -27,6 +28,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
|
@@ -53,7 +55,7 @@ public class KuaishouReportDailyAgentServiceImpl extends ServiceImpl<KuaishouRep
|
|
|
|
|
|
public boolean loginAgent(){
|
|
public boolean loginAgent(){
|
|
boolean loginStatus = false;
|
|
boolean loginStatus = false;
|
|
- System.getProperties().setProperty("webdriver.chrome.driver", "D:/chromedriver.exe");
|
|
|
|
|
|
+ System.getProperties().setProperty("webdriver.chrome.driver", chromeDriver);
|
|
String url = "https://agent.e.kuaishou.com";
|
|
String url = "https://agent.e.kuaishou.com";
|
|
ChromeOptions chromeOptions = new ChromeOptions();
|
|
ChromeOptions chromeOptions = new ChromeOptions();
|
|
chromeOptions.addArguments("--headless");
|
|
chromeOptions.addArguments("--headless");
|
|
@@ -115,8 +117,10 @@ public class KuaishouReportDailyAgentServiceImpl extends ServiceImpl<KuaishouRep
|
|
public boolean getAccount(int currentPage){
|
|
public boolean getAccount(int currentPage){
|
|
boolean hasNextPage = false;
|
|
boolean hasNextPage = false;
|
|
try {
|
|
try {
|
|
- if (!loginAgent()){
|
|
|
|
- return hasNextPage;
|
|
|
|
|
|
+ if(currentPage == 1){
|
|
|
|
+ if (!loginAgent()){
|
|
|
|
+ return hasNextPage;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
Map<String,String> headerMap = new HashMap<String,String>();
|
|
Map<String,String> headerMap = new HashMap<String,String>();
|
|
headerMap.put("Accept","application/json");
|
|
headerMap.put("Accept","application/json");
|
|
@@ -127,10 +131,11 @@ public class KuaishouReportDailyAgentServiceImpl extends ServiceImpl<KuaishouRep
|
|
headerMap.put("Referer","https://agent.e.kuaishou.com/");
|
|
headerMap.put("Referer","https://agent.e.kuaishou.com/");
|
|
headerMap.put("Content-Type","application/json;charset=utf-8");
|
|
headerMap.put("Content-Type","application/json;charset=utf-8");
|
|
headerMap.put("User-Agent",HttpUtils2.USER_AGENT);
|
|
headerMap.put("User-Agent",HttpUtils2.USER_AGENT);
|
|
- String postData = "{\"pageInfo\":{\"currentPage\":"+currentPage+",\"pageSize\":20,\"total\":1000},\"reviewStatus\":\"-1\",\"selectType\":1,\"selectValue\":\"\",\"createBeginTime\":0,\"createEndTime\":0}";
|
|
|
|
|
|
+ String postData = "{\"pageInfo\":{\"currentPage\":"+currentPage+",\"pageSize\":200,\"total\":1000},\"reviewStatus\":\"-1\",\"selectType\":1,\"selectValue\":\"\",\"createBeginTime\":0,\"createEndTime\":0}";
|
|
String listUrl = "https://agent.e.kuaishou.com/rest/dsp/agent/account/list";
|
|
String listUrl = "https://agent.e.kuaishou.com/rest/dsp/agent/account/list";
|
|
String result = HttpUtils2.httpPostRequestTest(listUrl,postData,headerMap);
|
|
String result = HttpUtils2.httpPostRequestTest(listUrl,postData,headerMap);
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
|
|
+ mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
|
|
JsonNode resultNode = mapper.readTree(result);
|
|
JsonNode resultNode = mapper.readTree(result);
|
|
Integer code = resultNode.get("result").intValue();
|
|
Integer code = resultNode.get("result").intValue();
|
|
if(code == 1) {
|
|
if(code == 1) {
|
|
@@ -141,6 +146,16 @@ public class KuaishouReportDailyAgentServiceImpl extends ServiceImpl<KuaishouRep
|
|
hasNextPage = true;
|
|
hasNextPage = true;
|
|
JsonNode dataNode = iterator1.next();
|
|
JsonNode dataNode = iterator1.next();
|
|
KuaishouAgentAccount agentAccount = mapper.readValue(dataNode.toString(),KuaishouAgentAccount.class);
|
|
KuaishouAgentAccount agentAccount = mapper.readValue(dataNode.toString(),KuaishouAgentAccount.class);
|
|
|
|
+ agentAccount.setBalance(agentAccount.getBalance().divide(new BigDecimal(1000)));
|
|
|
|
+ agentAccount.setContractRebate(agentAccount.getContractRebate().divide(new BigDecimal(1000)));
|
|
|
|
+ agentAccount.setCreditBalance(agentAccount.getCreditBalance().divide(new BigDecimal(1000)));
|
|
|
|
+ agentAccount.setDirectRebate(agentAccount.getDirectRebate().divide(new BigDecimal(1000)));
|
|
|
|
+ agentAccount.setExtendedBalance(agentAccount.getExtendedBalance().divide(new BigDecimal(1000)));
|
|
|
|
+ agentAccount.setKuaibiBalance(agentAccount.getKuaibiBalance().divide(new BigDecimal(1000)));
|
|
|
|
+ agentAccount.setPreRebate(agentAccount.getPreRebate().divide(new BigDecimal(1000)));
|
|
|
|
+ agentAccount.setPushBalance(agentAccount.getPushBalance().divide(new BigDecimal(1000)));
|
|
|
|
+ agentAccount.setRebate(agentAccount.getRebate().divide(new BigDecimal(1000)));
|
|
|
|
+ agentAccount.setTotalBalance(agentAccount.getTotalBalance().divide(new BigDecimal(1000)));
|
|
accountList.add(agentAccount);
|
|
accountList.add(agentAccount);
|
|
}
|
|
}
|
|
if (accountList != null && accountList.size() > 0){
|
|
if (accountList != null && accountList.size() > 0){
|