|
@@ -1049,11 +1049,11 @@ public class RoleManageServiceImpl implements IRoleManageService {
|
|
@Override
|
|
@Override
|
|
public List<Map> gameCountryList(GameCountryParamDTO dto) {
|
|
public List<Map> gameCountryList(GameCountryParamDTO dto) {
|
|
Criteria cri = Cnd.cri();
|
|
Criteria cri = Cnd.cri();
|
|
- if(CollectionUtils.isNotEmpty(dto.getServerId())){
|
|
|
|
- cri.where().andInStrList("server_id",dto.getServerId());
|
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(dto.getServerId())) {
|
|
|
|
+ cri.where().andInStrList("server_id", dto.getServerId());
|
|
}
|
|
}
|
|
- if(CollectionUtils.isNotEmpty(dto.getGameId())){
|
|
|
|
- cri.where().andInList("parent_game_id",dto.getGameId());
|
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(dto.getGameId())) {
|
|
|
|
+ cri.where().andInList("parent_game_id", dto.getGameId());
|
|
}
|
|
}
|
|
String countryListSql = getCountryListSql(cri);
|
|
String countryListSql = getCountryListSql(cri);
|
|
Sql sql = Sqls.create(countryListSql);
|
|
Sql sql = Sqls.create(countryListSql);
|
|
@@ -1063,6 +1063,94 @@ public class RoleManageServiceImpl implements IRoleManageService {
|
|
return list;
|
|
return list;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public Page<Map> roleIpDetailListOfPage(RoleIpInfoParamDTO dto) {
|
|
|
|
+ if (dto.getRoleId() == null) {
|
|
|
|
+ throw new BaseException("角色id不能为空");
|
|
|
|
+ }
|
|
|
|
+ Criteria criteria = Cnd.cri();
|
|
|
|
+ criteria.where().andEquals("role_id", dto.getRoleId());
|
|
|
|
+
|
|
|
|
+ //分页对象
|
|
|
|
+ Pager pager = dao.createPager(dto.getPageNum(), dto.getPageSize());
|
|
|
|
+ //查询总记录数
|
|
|
|
+ Sql countSql = Sqls.create(getRoleIpDetailListCountSql(criteria));
|
|
|
|
+ countSql.setCallback(Sqls.callback.integer());
|
|
|
|
+ dao.execute(countSql);
|
|
|
|
+ pager.setRecordCount(countSql.getInt());
|
|
|
|
+ String roleIpDetailListSql = getRoleIpDetailListSql(criteria);
|
|
|
|
+ Sql sql = Sqls.create(roleIpDetailListSql);
|
|
|
|
+ sql.setCallback(Sqls.callback.maps());
|
|
|
|
+ sql.setPager(pager);
|
|
|
|
+ dao.execute(sql);
|
|
|
|
+ //查询结果
|
|
|
|
+ List<Map> list = sql.getList(Map.class);
|
|
|
|
+ return new Page<>(list, pager);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Page<Map> roleDetailListOfPage(RoleIpInfoParamDTO dto) {
|
|
|
|
+ Criteria criteria = getRoleDetailSqlByQuery(dto);
|
|
|
|
+ //分页对象
|
|
|
|
+ Pager pager = dao.createPager(dto.getPageNum(), dto.getPageSize());
|
|
|
|
+ //查询总记录数
|
|
|
|
+ Sql countSql = Sqls.create(getRoleDetailCountSql(criteria));
|
|
|
|
+ countSql.setCallback(Sqls.callback.integer());
|
|
|
|
+ dao.execute(countSql);
|
|
|
|
+ pager.setRecordCount(countSql.getInt());
|
|
|
|
+ String roleIpDetailListSql = getRoleDetailList(criteria);
|
|
|
|
+ Sql sql = Sqls.create(roleIpDetailListSql);
|
|
|
|
+ sql.setCallback(Sqls.callback.maps());
|
|
|
|
+ sql.setPager(pager);
|
|
|
|
+ dao.execute(sql);
|
|
|
|
+ //查询结果
|
|
|
|
+ List<Map> list = sql.getList(Map.class);
|
|
|
|
+ return new Page<>(list, pager);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private String getRoleDetailCountSql(Criteria criteria) {
|
|
|
|
+ return """
|
|
|
|
+ select count(1) from ( select role_id roleId ,any_value(role_name) roleNmae,game_id gameId,any_value(game_name) gameName,ip,server_id serverId,any_value(server_name) serverName,user_id userId,any_value(user_name) userName from game_ads.role_ip_monitor
|
|
|
|
+ """ + criteria + """
|
|
|
|
+ group by role_id,game_id,ip,server_id,user_id)a
|
|
|
|
+ """;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private String getRoleDetailList(Criteria criteria) {
|
|
|
|
+ return """
|
|
|
|
+ select role_id roleId ,any_value(role_name) roleNmae,game_id gameId,any_value(game_name) gameName,ip,server_id serverId,any_value(server_name) serverName,user_id userId,any_value(user_name) userName from game_ads.role_ip_monitor
|
|
|
|
+ """ + criteria + """
|
|
|
|
+ group by role_id,game_id,ip,server_id,user_id;
|
|
|
|
+ """;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private Criteria getRoleDetailSqlByQuery(RoleIpInfoParamDTO dto) {
|
|
|
|
+ Criteria criteria = Cnd.cri();
|
|
|
|
+ if (StringUtils.isNotEmpty(dto.getRegIp())) {
|
|
|
|
+ criteria.where().andEquals("ip", dto.getRegIp());
|
|
|
|
+ }
|
|
|
|
+ return criteria;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private String getRoleIpDetailListCountSql(Criteria criteria) {
|
|
|
|
+ return """
|
|
|
|
+ select count(1) from (select distinct a.ip,(select count(distinct role_id) from dm_game_order.t_user_login_log where ip = a.ip) from dm_game_order.t_user_login_log a
|
|
|
|
+ """
|
|
|
|
+ + criteria +
|
|
|
|
+ """
|
|
|
|
+ ) a
|
|
|
|
+ """;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * ipRoleCount 同ip的角色数量
|
|
|
|
+ */
|
|
|
|
+ private String getRoleIpDetailListSql(Criteria criteria) {
|
|
|
|
+ return """
|
|
|
|
+ select distinct a.ip,(select count(distinct role_id) from dm_game_order.t_user_login_log where ip = a.ip) as ipRoleCount from dm_game_order.t_user_login_log a
|
|
|
|
+ """ + criteria;
|
|
|
|
+ }
|
|
|
|
+
|
|
private String getCountryListSql(Criteria criteria) {
|
|
private String getCountryListSql(Criteria criteria) {
|
|
return """
|
|
return """
|
|
select country,server_id as serverId,parent_name as gameName,server_name as serverName,parent_game_id as gameId from dm_game_order.t_server_country
|
|
select country,server_id as serverId,parent_name as gameName,server_name as serverName,parent_game_id as gameId from dm_game_order.t_server_country
|
|
@@ -1159,9 +1247,16 @@ public class RoleManageServiceImpl implements IRoleManageService {
|
|
if (CollectionUtils.isNotEmpty(dto.getServerId())) {
|
|
if (CollectionUtils.isNotEmpty(dto.getServerId())) {
|
|
criA.where().andInStrList("server_id", dto.getServerId());
|
|
criA.where().andInStrList("server_id", dto.getServerId());
|
|
}
|
|
}
|
|
|
|
+ criA.where().andNotIsNull("country");
|
|
|
|
+ criA.where().andNotEquals("country","");
|
|
|
|
+ criA.where().andNotEquals("country","null");
|
|
|
|
+ criA.where().andInList("game_id",Arrays.asList(35L,36L,10035L));
|
|
return """
|
|
return """
|
|
- select concat(country,',',server_id) from dm_game_order.t_game_user_role where country is not null and country != '' and country !='null' and game_id in(35,36,1003) group by country,server_id order by count(role_id) desc limit 4;
|
|
|
|
- """ + criA;
|
|
|
|
|
|
+ select concat(country,',',server_id)
|
|
|
|
+ from dm_game_order.t_game_user_role
|
|
|
|
+ """+criA+"""
|
|
|
|
+ group by country,server_id order by count(role_id) desc limit 4
|
|
|
|
+ """;
|
|
}
|
|
}
|
|
|
|
|
|
private String getIpInfoListSql(Criteria criA) {
|
|
private String getIpInfoListSql(Criteria criA) {
|