|
@@ -1038,17 +1038,18 @@ public class RoleManageServiceImpl implements IRoleManageService {
|
|
|
countSql.setCallback(Sqls.callback.integer());
|
|
|
dao.execute(countSql);
|
|
|
pager.setRecordCount(countSql.getInt());
|
|
|
+ Criteria orderCri = Cnd.cri();
|
|
|
//主表添加排序条件
|
|
|
if (StringUtils.isBlank(dto.getSortType())) {
|
|
|
dto.setSortType(OrderByEnum.DESC.getOrderType());
|
|
|
}
|
|
|
if (StringUtils.isBlank(dto.getSortFiled())) {
|
|
|
- criA.getOrderBy().orderBy("roleTotalAmount", dto.getSortType());
|
|
|
+ orderCri.getOrderBy().orderBy("roleTotalAmount", dto.getSortType());
|
|
|
} else {
|
|
|
- criA.getOrderBy().orderBy(dto.getSortFiled(), dto.getSortType());
|
|
|
+ orderCri.getOrderBy().orderBy(dto.getSortFiled(), dto.getSortType());
|
|
|
}
|
|
|
//列表sql
|
|
|
- String gameCountryRoleListSql = getGameCountryRoleListSql(criA);
|
|
|
+ String gameCountryRoleListSql = getGameCountryRoleListSql(criA,orderCri);
|
|
|
Sql sql = Sqls.create(gameCountryRoleListSql);
|
|
|
sql.setCallback(Sqls.callback.maps());
|
|
|
sql.setPager(pager);
|
|
@@ -1096,7 +1097,7 @@ public class RoleManageServiceImpl implements IRoleManageService {
|
|
|
public List<Map> ipDetailList(RoleIpInfoParamDTO dto) {
|
|
|
Criteria criteria = Cnd.cri();
|
|
|
criteria.where().andEquals("role_id", dto.getRoleId());
|
|
|
- if(CollectionUtils.isNotEmpty(dto.getGameId())){
|
|
|
+ if (CollectionUtils.isNotEmpty(dto.getGameId())) {
|
|
|
criteria.where().andInList("game_id", dto.getGameId());
|
|
|
}
|
|
|
String ipDetailListSql = getIpDetailListSql(criteria);
|
|
@@ -1111,11 +1112,11 @@ public class RoleManageServiceImpl implements IRoleManageService {
|
|
|
Criteria criteria = Cnd.cri();
|
|
|
criteria.where().andInStrList("ip", ip);
|
|
|
criteria.where().andNotIsNull("ip");
|
|
|
- criteria.where().andNotEquals("ip","null");
|
|
|
- criteria.where().andNotEquals("ip","");
|
|
|
+ criteria.where().andNotEquals("ip", "null");
|
|
|
+ criteria.where().andNotEquals("ip", "");
|
|
|
criteria.where().andNotIsNull("role_id");
|
|
|
- criteria.where().andNotEquals("role_id","null");
|
|
|
- criteria.where().andNotEquals("role_id","");
|
|
|
+ criteria.where().andNotEquals("role_id", "null");
|
|
|
+ criteria.where().andNotEquals("role_id", "");
|
|
|
String ipCountList = getIpCountList(criteria);
|
|
|
Sql sql = Sqls.create(ipCountList);
|
|
|
sql.setCallback(Sqls.callback.maps());
|
|
@@ -1290,23 +1291,25 @@ public class RoleManageServiceImpl implements IRoleManageService {
|
|
|
""" + criteria;
|
|
|
}
|
|
|
|
|
|
- private String getGameCountryRoleListSql(Criteria criA) {
|
|
|
+ private String getGameCountryRoleListSql(Criteria criA,Criteria orderCri) {
|
|
|
return """
|
|
|
- select a.country as country,a.role_id as roleId,a.user_id as userId ,a.role_name as roleName ,a.role_level as roleLevel ,combat_num as combatNum,
|
|
|
- a.server_id as serverId ,a.server_name as serverName ,create_time as createTime,IFNULL(b.amount,0) as roleTotalAmount
|
|
|
- from dm_game_order.t_game_user_role a
|
|
|
- left join game_dw.dw_order_day_amount b on a.role_id = b.role_id
|
|
|
- """ + criA;
|
|
|
+ select a.country as country,a.role_id as roleId,a.user_id as userId ,any_value(a.role_name) as roleName ,any_value(a.role_level) as roleLevel ,any_value(combat_num) as combatNum,
|
|
|
+ a.server_id as serverId ,any_value(a.server_name) as serverName ,any_value(create_time) as createTime,SUM(IFNULL(b.amount,0)) as roleTotalAmount
|
|
|
+ from dm_game_order.t_game_user_role a
|
|
|
+ left join game_dw.dw_order_day_amount b on a.role_id = b.role_id
|
|
|
+ """ + criA + """
|
|
|
+ GROUP BY a.country, a.role_id, a.user_id, a.server_id
|
|
|
+ """+ orderCri;
|
|
|
}
|
|
|
|
|
|
private String getGameCountryRoleCountSql(Criteria criA) {
|
|
|
return """
|
|
|
- select count(1) from ( select a.country as country,a.role_id as roleId,a.user_id as userId ,a.role_name as roleName ,a.role_level as roleLevel ,a.combat_num as combatNum,
|
|
|
- a.server_id as serverId ,a.server_name as serverName ,a.create_time as createTime,IFNULL(b.amount,0) as roleTotalAmount
|
|
|
- from dm_game_order.t_game_user_role a
|
|
|
- left join game_dw.dw_order_day_amount b on a.role_id = b.role_id
|
|
|
- """ + criA + """
|
|
|
- ) a
|
|
|
+ select count(1) from (select a.country as country,a.role_id as roleId,a.user_id as userId ,any_value(a.role_name) as roleName ,any_value(a.role_level) as roleLevel ,any_value(combat_num) as combatNum,
|
|
|
+ a.server_id as serverId ,any_value(a.server_name) as serverName ,any_value(create_time) as createTime,SUM(IFNULL(b.amount,0)) as roleTotalAmount
|
|
|
+ from dm_game_order.t_game_user_role a
|
|
|
+ left join game_dw.dw_order_day_amount b on a.role_id = b.role_id
|
|
|
+ """ + criA + """
|
|
|
+ GROUP BY a.country, a.role_id, a.user_id, a.server_id) a
|
|
|
""";
|
|
|
}
|
|
|
|
|
@@ -1355,32 +1358,32 @@ public class RoleManageServiceImpl implements IRoleManageService {
|
|
|
private String getGameCountryListSql(Criteria criA) {
|
|
|
return """
|
|
|
select country,
|
|
|
- country_level,
|
|
|
- sum(role_total_amount) as role_total_amount,
|
|
|
- count(1) as role_count,
|
|
|
- sum(active) as active_count,
|
|
|
- server_id,
|
|
|
- ANY_VALUE(cs) cs,
|
|
|
- ANY_VALUE(game_id) gameId,
|
|
|
- ANY_VALUE(server_name) serverName
|
|
|
- from (select a.country,
|
|
|
- a.game_id,
|
|
|
- a.server_name,
|
|
|
- IFNULL(c.amount, 0) as role_total_amount,
|
|
|
- if(b.role_level <= 13, 0, 1) as country_level,
|
|
|
- if(d.role_id is not null, 1, 0) as active,
|
|
|
- a.server_id,
|
|
|
- concat(a.country,',',a.server_id) as cs
|
|
|
- from dm_game_order.t_server_country a
|
|
|
- left join dm_game_order.t_game_user_role b on a.country = b.country and a.server_id = b.server_id
|
|
|
- left join game_dw.dw_order_day_amount c on c.role_id = b.role_id
|
|
|
- left join (
|
|
|
- select role_id,ROW_NUMBER()over(partition by role_id) as num from game_dw.dw_active_log
|
|
|
- where game_id in (35,36,10035)
|
|
|
- and dt = Date(NOW()) ) d on b.role_id = d.role_id and d.num = 1
|
|
|
- ) a
|
|
|
- """ + criA + """
|
|
|
- group by country_level,country,server_id order by role_count desc
|
|
|
+ country_level,
|
|
|
+ sum(role_total_amount) as role_total_amount,
|
|
|
+ count(role_id) as role_count,
|
|
|
+ sum(active) as active_count,
|
|
|
+ server_id,
|
|
|
+ ANY_VALUE(cs) cs,
|
|
|
+ ANY_VALUE(game_id) gameId,
|
|
|
+ ANY_VALUE(server_name) serverName
|
|
|
+ from (select a.country,
|
|
|
+ a.game_id,
|
|
|
+ a.server_name,
|
|
|
+ (select IFNULL(sum(amount),0) as amount from game_dw.dw_order_day_amount where role_id = b.role_id) as role_total_amount,
|
|
|
+ if(b.role_level <= 13, 0, 1) as country_level,
|
|
|
+ if(d.role_id is not null, 1, 0) as active,
|
|
|
+ a.server_id,
|
|
|
+ concat(a.country,',',a.server_id) as cs,
|
|
|
+ b.role_id role_id
|
|
|
+ from dm_game_order.t_server_country a
|
|
|
+ left join dm_game_order.t_game_user_role b on a.country = b.country and a.server_id = b.server_id
|
|
|
+ left join (
|
|
|
+ select role_id,ROW_NUMBER()over(partition by role_id) as num from game_dw.dw_active_log
|
|
|
+ where game_id in (35,36,10035)
|
|
|
+ and dt = Date(NOW()) ) d on b.role_id = d.role_id and d.num = 1
|
|
|
+ ) a
|
|
|
+ """ + criA + """
|
|
|
+ group by country_level,country,server_id order by role_count desc
|
|
|
""";
|
|
|
}
|
|
|
|