Browse Source

刷数据接口

master
nili 7 months ago
parent
commit
90654fa3b2
  1. 3
      game-dao/src/main/java/awesome/group/game/dao/mapper/MatrixAdvRecordMapper.java
  2. 125
      game-service/src/main/java/awesome/group/game/service/AdminService.java
  3. 4
      game-web/src/main/java/awesome/group/game/web/rest/matrix/AdminController.java

3
game-dao/src/main/java/awesome/group/game/dao/mapper/MatrixAdvRecordMapper.java

@ -21,4 +21,7 @@ public interface MatrixAdvRecordMapper extends BaseMapper<MatrixAdvRecord> {
@Select("select device_id from matrix_white_device") @Select("select device_id from matrix_white_device")
List<String> whiteList(); List<String> whiteList();
@Select("select device_id, device_brand, device_name, ip from matrix_adv_record where device_id in (select device_id from matrix_white_device where channel = #{channel}) group by device_id")
List<MatrixAdvRecord> getWhiteDevice(String channel);
} }

125
game-service/src/main/java/awesome/group/game/service/AdminService.java

@ -191,129 +191,16 @@ public class AdminService {
} }
@Async @Async
public void mockData(String appCode, long yuan) { public void mockData(String appCode, long yuan, String channel) {
MatrixApp app = appMapper.queryByCode(appCode); MatrixApp app = appMapper.queryByCode(appCode);
if (app == null) { if (app == null) {
return; return;
} }
String str = "[\n" +
" {\n" + List<MatrixAdvRecord> mockDevice = advRecordMapper.getWhiteDevice(channel);
" \"deviceId\": \"08F662623A20E39D47230CCA3C7CD01B589D9FDC\",\n" + if (CollectionUtils.isEmpty(mockDevice)) {
" \"deviceBrand\": \"HUAWEI\",\n" + return;
" \"deviceName\": \"NCO-AL00\",\n" + }
" \"ip\": \"223.160.189.157\"\n" +
" },\n" +
" {\n" +
" \"deviceId\": \"0AA84A49BE88FB0B3222333E62A7948A4614AF10\",\n" +
" \"deviceBrand\": \"HUAWEI\",\n" +
" \"deviceName\": \"NCO-AL00\",\n" +
" \"ip\": \"223.160.184.124\"\n" +
" },\n" +
" {\n" +
" \"deviceId\": \"25554364946807212ACA4634BB56DCC485A5B3D4\",\n" +
" \"deviceBrand\": \"OPPO\",\n" +
" \"deviceName\": \"PDKM00\",\n" +
" \"ip\": \"116.169.4.143\"\n" +
" },\n" +
" {\n" +
" \"deviceId\": \"30816052DC1079EA74996D14FEB8089AFBD3A86C\",\n" +
" \"deviceBrand\": \"HONOR\",\n" +
" \"deviceName\": \"ADT-AN00\",\n" +
" \"ip\": \"110.191.217.16\"\n" +
" },\n" +
" {\n" +
" \"deviceId\": \"338EC09FC55B68CBDF2FF288C7E240CA3518E40B\",\n" +
" \"deviceBrand\": \"OPPO\",\n" +
" \"deviceName\": \"PEMM00\",\n" +
" \"ip\": \"171.219.187.59\"\n" +
" },\n" +
" {\n" +
" \"deviceId\": \"360467864371C8FFC32C2FD3CBF19ED866AEFE45\",\n" +
" \"deviceBrand\": \"HUAWEI\",\n" +
" \"deviceName\": \"RTE-AL00\",\n" +
" \"ip\": \"116.169.6.151\"\n" +
" },\n" +
" {\n" +
" \"deviceId\": \"39147CCDB0F7B87C082B414B56AE108F79FC71EA\",\n" +
" \"deviceBrand\": \"HUAWEI\",\n" +
" \"deviceName\": \"ELE-AL00\",\n" +
" \"ip\": \"110.191.217.43\"\n" +
" },\n" +
" {\n" +
" \"deviceId\": \"3EAA7334E94764EB2B44829587116DE7CD3359A4\",\n" +
" \"deviceBrand\": \"HUAWEI\",\n" +
" \"deviceName\": \"RTE-AL00\",\n" +
" \"ip\": \"223.160.191.45\"\n" +
" },\n" +
" {\n" +
" \"deviceId\": \"78B8DF1B8D897476BB60BF0BE93393A27602CF51\",\n" +
" \"deviceBrand\": \"HUAWEI\",\n" +
" \"deviceName\": \"HMA-AL00\",\n" +
" \"ip\": \"171.212.241.181\"\n" +
" },\n" +
" {\n" +
" \"deviceId\": \"7CDF3CC5345149A978B9E66E50524A9DC9C7DEEE\",\n" +
" \"deviceBrand\": \"HUAWEI\",\n" +
" \"deviceName\": \"RTE-AL00\",\n" +
" \"ip\": \"116.169.80.96\"\n" +
" },\n" +
" {\n" +
" \"deviceId\": \"92549D031D5C97EBFA3674B280D692A896DC3F17\",\n" +
" \"deviceBrand\": \"HUAWEI\",\n" +
" \"deviceName\": \"ELE-AL00\",\n" +
" \"ip\": \"171.212.241.181\"\n" +
" },\n" +
" {\n" +
" \"deviceId\": \"A4D5BE85EB867507C2A712F9611198A331C5E0B1\",\n" +
" \"deviceBrand\": \"HUAWEI\",\n" +
" \"deviceName\": \"RTE-AL00\",\n" +
" \"ip\": \"116.169.80.199\"\n" +
" },\n" +
" {\n" +
" \"deviceId\": \"B381503F2EF5786E97111189FD60506D511FEC76\",\n" +
" \"deviceBrand\": \"HUAWEI\",\n" +
" \"deviceName\": \"RTE-AL00\",\n" +
" \"ip\": \"171.212.241.99\"\n" +
" },\n" +
" {\n" +
" \"deviceId\": \"BA8415B1260D17BED453412A8BDEB92B9EBC4591\",\n" +
" \"deviceBrand\": \"HUAWEI\",\n" +
" \"deviceName\": \"NCO-AL00\",\n" +
" \"ip\": \"171.216.234.101\"\n" +
" },\n" +
" {\n" +
" \"deviceId\": \"C3A4C960E65D29E442B58D1E6B1F264546B2FA8B\",\n" +
" \"deviceBrand\": \"HUAWEI\",\n" +
" \"deviceName\": \"NCO-AL00\",\n" +
" \"ip\": \"171.93.181.121\"\n" +
" },\n" +
" {\n" +
" \"deviceId\": \"C5B5B00BEA8A36CD946B4F5D6FE2EAE648BC6895\",\n" +
" \"deviceBrand\": \"OPPO\",\n" +
" \"deviceName\": \"PEMM00\",\n" +
" \"ip\": \"118.114.61.62\"\n" +
" },\n" +
" {\n" +
" \"deviceId\": \"DA8FE2D143218A095C04C864A8F3C8E40B53FA3B\",\n" +
" \"deviceBrand\": \"HUAWEI\",\n" +
" \"deviceName\": \"RTE-AL00\",\n" +
" \"ip\": \"116.169.10.217\"\n" +
" },\n" +
" {\n" +
" \"deviceId\": \"DC867C2DB33A8C7276F5F27558C783A21E398BE3\",\n" +
" \"deviceBrand\": \"HUAWEI\",\n" +
" \"deviceName\": \"ELE-AL00\",\n" +
" \"ip\": \"110.191.217.43\"\n" +
" },\n" +
" {\n" +
" \"deviceId\": \"E63144AB8D6702335C5440CE94B89FC3FF766C0D\",\n" +
" \"deviceBrand\": \"HUAWEI\",\n" +
" \"deviceName\": \"ELE-AL00\",\n" +
" \"ip\": \"171.212.241.181\"\n" +
" }\n" +
"]";
Gson gson = new Gson();
List<MatrixAdvRecord> mockDevice = gson.fromJson(str, new TypeToken<List<MatrixAdvRecord>>(){}.getType());
long income = 0; long income = 0;
long target = yuan * 100 * 1000; long target = yuan * 100 * 1000;
while (income < target) { while (income < target) {

4
game-web/src/main/java/awesome/group/game/web/rest/matrix/AdminController.java

@ -95,8 +95,8 @@ public class AdminController {
@GetMapping("/mockData") @GetMapping("/mockData")
@RestApi @RestApi
public R<Void> mockData(@RequestParam String appCode, @RequestParam long incomeYuan) { public R<Void> mockData(@RequestParam String appCode, @RequestParam long incomeYuan, @RequestParam String channel) {
adminService.mockData(appCode, incomeYuan); adminService.mockData(appCode, incomeYuan, channel);
return new R<>(R.CODE_SUCCESS, "ok", null); return new R<>(R.CODE_SUCCESS, "ok", null);
} }
} }

Loading…
Cancel
Save