|
|
@@ -82,12 +82,40 @@ public class TestController {
|
|
|
private MusicInfoService musicInfoService;
|
|
|
@Autowired
|
|
|
private IKuaiShouHistoryReportTaskService kuaiShouHistoryReportTaskService;
|
|
|
+ @Autowired
|
|
|
+ private IKuaiShouReportDailyMaterialService kuaiShouReportDailyMaterialService;
|
|
|
+
|
|
|
|
|
|
- static ExecutorService executorService = Executors.newFixedThreadPool(15);
|
|
|
+ static ExecutorService executorService = Executors.newFixedThreadPool(10);
|
|
|
static ExecutorService videoService = Executors.newFixedThreadPool(5);
|
|
|
static ExecutorService suzhaoService = Executors.newFixedThreadPool(10);
|
|
|
|
|
|
|
|
|
+ @GetMapping(value = "/getData")
|
|
|
+ public void getData() {
|
|
|
+ //1:查询当日数据
|
|
|
+ List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
|
|
|
+ Date endDate = new Date();
|
|
|
+ for (int i = 0; i < 8; i++) {
|
|
|
+ Date getStartDate = DateUtils.addDay(endDate, -i);
|
|
|
+ for (CtopOauthToken token : tokens) {
|
|
|
+ executorService.submit(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ kuaishouInterfaceService.getAdvertiserCampaignReportDaily(token, getStartDate, getStartDate);
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ String format = simpleDateFormat.format(getStartDate);
|
|
|
+ kuaiShouReportDailyMaterialService.getMaterialReportByAccountIdAndStatDate(token.getAccountId(), token.getAccessToken(), format, format, 1);
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
@GetMapping(value = "/dailyReport")
|
|
|
public void dailyReport() {
|
|
|
List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
|
|
|
@@ -100,19 +128,19 @@ public class TestController {
|
|
|
}
|
|
|
|
|
|
@GetMapping("getKuaishouPlanHourlyReport")
|
|
|
- public Map<String,Object> getKuaishouPlanHourlyReport(String params){
|
|
|
+ public Map<String, Object> getKuaishouPlanHourlyReport(String params) {
|
|
|
Long start = System.currentTimeMillis();
|
|
|
- Map<String,Object>result = new HashMap<>();
|
|
|
- if(null == params||params.trim().equals("")){
|
|
|
- ResultMapUtils.setResultMap(result,StatusCode.COMMON_PARAM_ERROR);
|
|
|
- result.put("message","COMMON_PARAM_ERROR");
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
+ if (null == params || params.trim().equals("")) {
|
|
|
+ ResultMapUtils.setResultMap(result, StatusCode.COMMON_PARAM_ERROR);
|
|
|
+ result.put("message", "COMMON_PARAM_ERROR");
|
|
|
return result;
|
|
|
}
|
|
|
Long accountId = Long.parseLong(params);
|
|
|
CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
|
|
|
- if(null == token){
|
|
|
- ResultMapUtils.setResultMap(result,StatusCode.COMMON_PARAM_ERROR);
|
|
|
- result.put("message","TOKEN_IS_NULL");
|
|
|
+ if (null == token) {
|
|
|
+ ResultMapUtils.setResultMap(result, StatusCode.COMMON_PARAM_ERROR);
|
|
|
+ result.put("message", "TOKEN_IS_NULL");
|
|
|
return result;
|
|
|
}
|
|
|
Date getDate = new Date();
|
|
|
@@ -125,22 +153,20 @@ public class TestController {
|
|
|
Date finalGetDate = getDate;
|
|
|
try {
|
|
|
kuaishouInterfaceService.getAdvertiserCampaignReportHourly(token, finalGetDate, finalGetDate);
|
|
|
- ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
|
|
|
- result.put("message","SUCCESS");
|
|
|
+ ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
|
|
|
+ result.put("message", "SUCCESS");
|
|
|
long end = System.currentTimeMillis();
|
|
|
- log.info("执行时长:{}毫秒",end-start);
|
|
|
+ log.info("执行时长:{}毫秒", end - start);
|
|
|
return result;
|
|
|
- }catch (Exception e){
|
|
|
+ } catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
- ResultMapUtils.setResultMap(result,StatusCode.COMMON_SERVER_ERROR);
|
|
|
- result.put("message","COMMON_SERVER_ERROR");
|
|
|
+ ResultMapUtils.setResultMap(result, StatusCode.COMMON_SERVER_ERROR);
|
|
|
+ result.put("message", "COMMON_SERVER_ERROR");
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
@GetMapping(value = "/getMd5")
|
|
|
public void getMd5() {
|
|
|
kuaiShouHistoryReportTaskService.getMd5(null, null);
|
|
|
@@ -1199,13 +1225,15 @@ public class TestController {
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
@Autowired
|
|
|
private IKuaiShouCommentService kuaiShouCommentService;
|
|
|
+
|
|
|
@GetMapping("deleteComment")
|
|
|
- public Map<String,Object>deleteComment(Long accountId){
|
|
|
- Map<String,Object>result = new HashMap<>();
|
|
|
+ public Map<String, Object> deleteComment(Long accountId) {
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
kuaiShouCommentService.shieldComment(accountId);
|
|
|
- ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
|
|
|
+ ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
|
|
|
return result;
|
|
|
}
|
|
|
}
|