|
@@ -30,9 +30,11 @@ import org.nutz.dao.pager.Pager;
|
|
|
import org.nutz.dao.sql.Criteria;
|
|
|
import org.nutz.dao.sql.Sql;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.StopWatch;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.time.LocalTime;
|
|
|
import java.util.*;
|
|
|
import java.util.function.Function;
|
|
@@ -56,6 +58,10 @@ public class RoleManageServiceImpl implements IRoleManageService {
|
|
|
@DubboReference(providedBy = ServerInfo.SERVER_DUBBO_NAME)
|
|
|
private ICPSendMsgRpc sendMsgRpc;
|
|
|
|
|
|
+ @Resource
|
|
|
+ @Lazy
|
|
|
+ private IRoleManageService baseService;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 角色充值排行榜
|
|
@@ -1064,10 +1070,11 @@ public class RoleManageServiceImpl implements IRoleManageService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Page<Map> roleIpDetailListOfPage(RoleIpInfoParamDTO dto) {
|
|
|
+ public Page<Map> roleIpDetailListOfPage2(RoleIpInfoParamDTO dto) {
|
|
|
if (dto.getRoleId() == null) {
|
|
|
throw new BaseException("角色id不能为空");
|
|
|
}
|
|
|
+
|
|
|
Criteria criteria = Cnd.cri();
|
|
|
criteria.where().andEquals("role_id", dto.getRoleId());
|
|
|
if (dto.getExcludeUserId() != null) {
|
|
@@ -1091,6 +1098,53 @@ public class RoleManageServiceImpl implements IRoleManageService {
|
|
|
return new Page<>(list, pager);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<Map> roleIpDetailListOfPage(RoleIpInfoParamDTO dto) {
|
|
|
+ if (dto.getRoleId() == null) {
|
|
|
+ throw new BaseException("角色id不能为空");
|
|
|
+ }
|
|
|
+ List<Map> maps = baseService.ipDetailList(dto);
|
|
|
+ if (CollectionUtils.isEmpty(maps)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ Map map = maps.get(0);
|
|
|
+ String ipCountIp = String.valueOf(map.get("ip_count_ip"));
|
|
|
+ if (StringUtils.isEmpty(ipCountIp)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ return baseService.ipCountList(Arrays.stream(ipCountIp.split(",")).map(String::trim).collect(Collectors.toList()));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<Map> ipDetailList(RoleIpInfoParamDTO dto) {
|
|
|
+ Criteria criteria = Cnd.cri();
|
|
|
+ criteria.where().andEquals("role_id", dto.getRoleId());
|
|
|
+ String ipDetailListSql = getIpDetailListSql(criteria);
|
|
|
+ Sql sql = Sqls.create(ipDetailListSql);
|
|
|
+ sql.setCallback(Sqls.callback.maps());
|
|
|
+ dao.execute(sql);
|
|
|
+ return sql.getList(Map.class);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<Map> ipCountList(List<String> ip) {
|
|
|
+ Criteria criteria = Cnd.cri();
|
|
|
+ criteria.where().andInStrList("ip", ip);
|
|
|
+ String ipCountList= getIpCountList(criteria);
|
|
|
+ Sql sql = Sqls.create(ipCountList);
|
|
|
+ sql.setCallback(Sqls.callback.maps());
|
|
|
+ dao.execute(sql);
|
|
|
+ return sql.getList(Map.class);
|
|
|
+ }
|
|
|
+
|
|
|
+ private String getIpCountList(Criteria criteria) {
|
|
|
+ return """
|
|
|
+ select ip,count(distinct role_id) as ipRoleCount from dm_game_order.t_user_login_log
|
|
|
+ """+criteria+"""
|
|
|
+ group by ip
|
|
|
+ """;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public Page<Map> roleDetailListOfPage(RoleIpInfoParamDTO dto) {
|
|
|
Criteria criteria = getRoleDetailSqlByQuery(dto);
|
|
@@ -1306,6 +1360,16 @@ public class RoleManageServiceImpl implements IRoleManageService {
|
|
|
""" + criteria;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * ipRoleCount 同ip的角色数量
|
|
|
+ */
|
|
|
+ private String getIpDetailListSql(Criteria criteria) {
|
|
|
+ return """
|
|
|
+ select * from game_ads.role_ip_monitor
|
|
|
+ """ + criteria;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
private String getCountryListSql(Criteria criteria) {
|
|
|
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
|
|
@@ -1341,11 +1405,11 @@ public class RoleManageServiceImpl implements IRoleManageService {
|
|
|
cri.where().andEquals("server_id", dto.getServerId());
|
|
|
}
|
|
|
cri.where().andInList("game_id", Arrays.asList(35L, 36L, 10035L));
|
|
|
- if(dto.getCountryLevel()!=null&&dto.getCountryLevel()==0){
|
|
|
- cri.where().andLTE("role_level",13);
|
|
|
+ if (dto.getCountryLevel() != null && dto.getCountryLevel() == 0) {
|
|
|
+ cri.where().andLTE("role_level", 13);
|
|
|
}
|
|
|
- if(dto.getCountryLevel()!=null&&dto.getCountryLevel()==1){
|
|
|
- cri.where().andGT("role_level",13);
|
|
|
+ if (dto.getCountryLevel() != null && dto.getCountryLevel() == 1) {
|
|
|
+ cri.where().andGT("role_level", 13);
|
|
|
}
|
|
|
return cri;
|
|
|
}
|