|
@@ -32,6 +32,9 @@ public class TestController {
|
|
@Autowired
|
|
@Autowired
|
|
private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
|
|
private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private CtopOauthTokenMapper oauthTokenMapper;
|
|
|
|
+
|
|
@PostMapping(value = "/create")
|
|
@PostMapping(value = "/create")
|
|
public Map<String, Object> authorization(@RequestBody JSONObject jsonObject) {
|
|
public Map<String, Object> authorization(@RequestBody JSONObject jsonObject) {
|
|
return createInternalService.createInternal(jsonObject);
|
|
return createInternalService.createInternal(jsonObject);
|
|
@@ -122,8 +125,7 @@ public class TestController {
|
|
return "Success";
|
|
return "Success";
|
|
}
|
|
}
|
|
|
|
|
|
- @Autowired
|
|
|
|
- private CtopOauthTokenMapper oauthTokenMapper;
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/gerCreative")
|
|
@GetMapping(value = "/gerCreative")
|
|
@@ -136,7 +138,7 @@ public class TestController {
|
|
@Override
|
|
@Override
|
|
public void run() {
|
|
public void run() {
|
|
try {
|
|
try {
|
|
- System.err.println("获取创意,accountId:" +token.getAccountId() );
|
|
|
|
|
|
+ System.err.println("获取创意,accountId:" + token.getAccountId());
|
|
kuaishouInterfaceService.getCreativeList(token, null, null);
|
|
kuaishouInterfaceService.getCreativeList(token, null, null);
|
|
// kuaishouInterfaceService.getVideoList2(token, null, null,1);
|
|
// kuaishouInterfaceService.getVideoList2(token, null, null,1);
|
|
//3: 获取图片信息数据
|
|
//3: 获取图片信息数据
|
|
@@ -182,4 +184,63 @@ public class TestController {
|
|
};
|
|
};
|
|
thread.start();
|
|
thread.start();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @GetMapping(value = "/gerCreativeByAccount")
|
|
|
|
+ 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);
|
|
|
|
+ executorService.submit(new Runnable() {
|
|
|
|
+ @Override
|
|
|
|
+ public void run() {
|
|
|
|
+ try {
|
|
|
|
+ System.err.println("获取创意,accountId:" + token.getAccountId());
|
|
|
|
+ kuaishouInterfaceService.getCreativeList(token, null, null);
|
|
|
|
+ // kuaishouInterfaceService.getVideoList2(token, null, null,1);
|
|
|
|
+ //3: 获取图片信息数据
|
|
|
|
+ // kuaishouInterfaceService.getImageList2(token, null, null,1);
|
|
|
|
+ Thread.sleep(1 * 200);
|
|
|
|
+ // kuaishouInterfaceService.getAppList(token.getAccountId(), token.getAccessToken());
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @GetMapping(value = "/gerCreativeReportByAccount")
|
|
|
|
+ public void gerCreativeReportByAccount(Long accountId, String startDateStr, String endDateStr, QueryWrapper<CtopOauthToken> account_id) {
|
|
|
|
+ Thread thread = new Thread() {
|
|
|
|
+ @SneakyThrows
|
|
|
|
+ @Override
|
|
|
|
+ public void run() {
|
|
|
|
+ SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
+ Date startDate = sim.parse(startDateStr);
|
|
|
|
+ Date endDate = sim.parse(endDateStr);
|
|
|
|
+ //1:查询当日数据
|
|
|
|
+ //executorService = Executors.newFixedThreadPool(3);
|
|
|
|
+ QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ oauthTokenQueryWrapper.eq("media_id", 2);
|
|
|
|
+ oauthTokenQueryWrapper.eq("account_id", accountId);
|
|
|
|
+ CtopOauthToken ctopOauthToken = oauthTokenMapper.selectOne(oauthTokenQueryWrapper);
|
|
|
|
+ System.err.println("创意报表accountId:" + ctopOauthToken.getAccountId());
|
|
|
|
+ kuaishouInterfaceService.getAdvertiserCreativeReportDaily(ctopOauthToken, startDate, endDate);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ thread.start();
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|