|
@@ -23,6 +23,7 @@ import cn.com.ctop.toutiao.modules.material.service.IByteDanceCreativeService;
|
|
|
import cn.com.ctop.toutiao.modules.report.service.IReportService;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.jeecg.common.util.DateUtils;
|
|
|
import org.junit.Test;
|
|
@@ -205,12 +206,12 @@ public class SampleTest {
|
|
|
|
|
|
@Test
|
|
|
public void testLoadBytedanceData() {
|
|
|
- List<UserAllocation> allocations = allocationService.getByParams(435L, null, 0);
|
|
|
+ List<UserAllocation> allocations = allocationService.getByParams(430L, null, 0);
|
|
|
for (UserAllocation allocation : allocations) {
|
|
|
- for (int i = 2; i < 10; i++) {
|
|
|
+ for (int i = 0; i < 10; i++) {
|
|
|
CtopOauthToken token = oauthTokenService.getTokenByAccountId(allocation.getAccountId());
|
|
|
Date getDate = DateUtils.addDay(new Date(), -i);
|
|
|
- reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
|
|
|
+ reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -266,34 +267,31 @@ public class SampleTest {
|
|
|
private IMusicKuaishouTypeService musicKuaishouTypeService;
|
|
|
@Test
|
|
|
public void loadKuaishouMusicInfo(){
|
|
|
-// String musicTypeString = crawlerService.getMusicTypeList("");
|
|
|
-// String llsid = JSONObject.parseObject(musicTypeString).getString("llsid");
|
|
|
-// System.out.println(llsid);
|
|
|
-// JSONArray channels = JSONObject.parseObject(musicTypeString).getJSONArray("channels");
|
|
|
-// if (null!=channels&&!channels.isEmpty()){
|
|
|
-// for(int i=0;i<channels.size();i++){
|
|
|
-// JSONObject object = channels.getJSONObject(i);
|
|
|
-// MusicKuaishouType kuaishouType = new MusicKuaishouType(object);
|
|
|
-// musicKuaishouTypeService.save(kuaishouType);
|
|
|
-// }
|
|
|
-// }
|
|
|
- List<MusicKuaishouType>musicKuaishouTypes = musicKuaishouTypeService.list();
|
|
|
+ String musicType = crawlerService.getMusicTypeList("");
|
|
|
+ String llsid = JSONObject.parseObject(musicType).getString("llsid");
|
|
|
+ QueryWrapper<MusicKuaishouType>queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.orderByDesc("id");
|
|
|
+ List<MusicKuaishouType>musicKuaishouTypes = musicKuaishouTypeService.list(queryWrapper);
|
|
|
if(null!=musicKuaishouTypes){
|
|
|
for (MusicKuaishouType type:musicKuaishouTypes) {
|
|
|
- String llsid = "2000106667298730337";
|
|
|
- String musicTypeString = crawlerService.getMusicList(type.getId()+"",llsid);
|
|
|
- System.out.println(musicTypeString);
|
|
|
- JSONArray musicList = JSONObject.parseObject(musicTypeString).getJSONArray("music");
|
|
|
- if(null!=musicList&&!musicList.isEmpty()){
|
|
|
- for(int i=0;i<musicList.size();i++){
|
|
|
- JSONObject music = musicList.getJSONObject(i);
|
|
|
- MusicInfoKuaishou musicInfoKuaishou = new MusicInfoKuaishou(music,type.getId());
|
|
|
- musicInfoKuaishouService.saveOrUpdate(musicInfoKuaishou);
|
|
|
- }
|
|
|
- }
|
|
|
+ loadMusicList(type,llsid);
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
+ public void loadMusicList(MusicKuaishouType musicKuaishouType,String llsid){
|
|
|
+ String musicTypeString = crawlerService.getMusicList(musicKuaishouType.getId()+"",llsid);
|
|
|
+ System.out.println(musicTypeString);
|
|
|
+ JSONArray musicList = JSONObject.parseObject(musicTypeString).getJSONArray("music");
|
|
|
+ String getLlsid = JSONObject.parseObject(musicTypeString).getString("llsid");
|
|
|
+ if(null!=musicList&&!musicList.isEmpty()){
|
|
|
+ for(int i=0;i<musicList.size();i++){
|
|
|
+ JSONObject music = musicList.getJSONObject(i);
|
|
|
+ MusicInfoKuaishou musicInfoKuaishou = new MusicInfoKuaishou(music,musicKuaishouType.getId());
|
|
|
+ musicInfoKuaishouService.saveOrUpdate(musicInfoKuaishou);
|
|
|
+ }
|
|
|
+// loadMusicList(musicKuaishouType,getLlsid);
|
|
|
+ }
|
|
|
}
|
|
|
@Autowired
|
|
|
private IMusicInfoKuaishouService musicInfoKuaishouService;
|