Commit 62041049 by 涂亚平

优化后版本,跑数据脚本

1 parent 9e3c2b72
...@@ -65,7 +65,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper, ...@@ -65,7 +65,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
public void dataFix() { public void dataFix() {
//班级ids //班级ids
List<String> classIds = Arrays.asList(new String[]{"28"}); List<String> classIds = Arrays.asList(new String[]{"17","28"});
Random random = new Random(); Random random = new Random();
...@@ -105,16 +105,18 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper, ...@@ -105,16 +105,18 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
//时间点 //时间点
VodPlayHistoryDO vodPlayHistoryDO1 = vodPlayHistoryDOS.get(0); VodPlayHistoryDO vodPlayHistoryDO1 = vodPlayHistoryDOS.get(0);
int total = 0; int total = 0;
int playCounts = random.nextInt(vodDictDOS.size()); int playCounts = random.nextInt(2)+1;
for (int i = 0; i < playCounts; i++) { for (int i = 0; i < playCounts; i++) {
VodPlayHistoryDO vodPlayHistoryDO = new VodPlayHistoryDO(); VodPlayHistoryDO vodPlayHistoryDO = new VodPlayHistoryDO();
Random random1 = new Random();
int j = random1.nextInt(vodDictDOS.size());
vodPlayHistoryDO.setPlayCount(1); vodPlayHistoryDO.setPlayCount(1);
vodPlayHistoryDO.setClassId(Long.valueOf(str)); vodPlayHistoryDO.setClassId(Long.valueOf(str));
vodPlayHistoryDO.setMemberId(classMemberMappingDO.getMemberId()); vodPlayHistoryDO.setMemberId(classMemberMappingDO.getMemberId());
vodPlayHistoryDO.setPlayRecord(random.nextInt(vodDictDOS.get(i).getVodLength()-10)+1); vodPlayHistoryDO.setPlayRecord(random.nextInt(vodDictDOS.get(j).getVodLength()-10)+1);
vodPlayHistoryDO.setPlayLength(random.nextInt(vodPlayHistoryDO.getPlayRecord())); vodPlayHistoryDO.setPlayLength(random.nextInt(vodPlayHistoryDO.getPlayRecord()));
vodPlayHistoryDO.setVodId(vodDictDOS.get(i).getId()); vodPlayHistoryDO.setVodId(vodDictDOS.get(j).getId());
total += vodPlayHistoryDO.getPlayLength()+random.nextInt(10); total += vodPlayHistoryDO.getPlayLength()+random.nextInt(10);
vodPlayHistoryDO.setPlayDate(vodPlayHistoryDO1.getPlayDate().plusSeconds(total)); vodPlayHistoryDO.setPlayDate(vodPlayHistoryDO1.getPlayDate().plusSeconds(total));
vodPlayHistoryMapper.insert(vodPlayHistoryDO); vodPlayHistoryMapper.insert(vodPlayHistoryDO);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!