|
|
@ -5,10 +5,10 @@ import awesome.group.game.dao.mapper.*; |
|
|
|
import awesome.group.game.service.bo.AddMockScheduleReq; |
|
|
|
import awesome.group.game.service.bo.matrix.AppNormalConfig; |
|
|
|
import awesome.group.game.service.bo.matrix.WhiteUserBo; |
|
|
|
import awesome.group.game.service.cache.CacheKey; |
|
|
|
import awesome.group.game.service.cache.JedisManager; |
|
|
|
import awesome.group.game.service.common.log.L; |
|
|
|
import awesome.group.game.service.util.Constants; |
|
|
|
import awesome.group.game.service.util.DateUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
@ -27,6 +27,7 @@ import java.util.concurrent.ThreadLocalRandom; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
import static awesome.group.game.service.util.Constants.SUPER_ADMIN; |
|
|
|
import static java.util.concurrent.ThreadLocalRandom.current; |
|
|
|
|
|
|
|
@Service |
|
|
|
public class SuperAdminService { |
|
|
@ -62,6 +63,9 @@ public class SuperAdminService { |
|
|
|
@Autowired |
|
|
|
private JedisManager jedisManager; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private AdminService adminService; |
|
|
|
|
|
|
|
public List<MatrixEvilApp> evilAppList() { |
|
|
|
List<MatrixEvilApp> app = evilAppMapper.selectList(null); |
|
|
|
Collections.reverse(app); |
|
|
@ -176,6 +180,51 @@ public class SuperAdminService { |
|
|
|
res.forEach(x -> superAdminService.mockData(x.getId())); |
|
|
|
} |
|
|
|
|
|
|
|
public void mockDay(int date, String appCode) { |
|
|
|
MatrixApp app = appMapper.queryByCode(appCode); |
|
|
|
long beginTime = 32400_000L + current().nextInt(0, 7200000);//9点到11点之间随机
|
|
|
|
beginTime += DateUtil.date2Long(date) + beginTime; |
|
|
|
int total = ThreadLocalRandom.current().nextInt(1000_000_00, 1500_000_00); |
|
|
|
int current = 0; |
|
|
|
List<Integer> userIds = innerUserMapper.queryByAppId(app.getId()); |
|
|
|
if (CollectionUtils.isEmpty(userIds)) { |
|
|
|
return; |
|
|
|
} |
|
|
|
List<MatrixUser> users = userMapper.selectBatchIds(userIds); |
|
|
|
Map<Integer, MatrixAdvRecord> map = new HashMap<>(); |
|
|
|
for (MatrixUser x : users) { |
|
|
|
MatrixAdvRecord record = advRecordMapper.queryByUidOld(x.getId()); |
|
|
|
map.put(x.getId(), record); |
|
|
|
} |
|
|
|
while (current < total) { |
|
|
|
int ecpm = 3000_00 + ThreadLocalRandom.current().nextInt(3000_00); |
|
|
|
current += ecpm; |
|
|
|
MatrixUser u = users.get(ThreadLocalRandom.current().nextInt(0, users.size())); |
|
|
|
MatrixAdvRecord record = map.get(u.getId()); |
|
|
|
MatrixAdvRecord newRecord = new MatrixAdvRecord(); |
|
|
|
newRecord.setDeviceId(record.getDeviceId()); |
|
|
|
newRecord.setAppId(app.getId()); |
|
|
|
newRecord.setAdvId(null); |
|
|
|
newRecord.setPlatform(2); |
|
|
|
newRecord.setAdvType(Constants.VIDEO); |
|
|
|
newRecord.setEcpm((long) ecpm); |
|
|
|
AppNormalConfig config = AppNormalConfig.getConfig(app); |
|
|
|
long ecpmReal = config.getEcpmReal(ecpm, u); |
|
|
|
newRecord.setEcpmReal(ecpmReal); |
|
|
|
newRecord.setUserId(u.getId()); |
|
|
|
newRecord.setDeviceName(record.getDeviceName()); |
|
|
|
newRecord.setDeviceBrand(record.getDeviceBrand()); |
|
|
|
newRecord.setIp(record.getIp()); |
|
|
|
newRecord.setAdminId(null); |
|
|
|
newRecord.setCreatedAt(new Timestamp(beginTime)); |
|
|
|
advRecordMapper.insert(newRecord); |
|
|
|
|
|
|
|
beginTime += ThreadLocalRandom.current().nextInt(3000, 10000); |
|
|
|
} |
|
|
|
|
|
|
|
adminService.calcTargetDate(date); |
|
|
|
} |
|
|
|
|
|
|
|
@Async |
|
|
|
public void mockData(Integer scheduleId) { |
|
|
|
MatrixMockScheduleV2 schedule = mockScheduleV2Mapper.selectById(scheduleId); |
|
|
|