|
@@ -3,6 +3,7 @@ package com.zanxiang.game.data.serve.service.impl;
|
|
import com.google.common.base.CaseFormat;
|
|
import com.google.common.base.CaseFormat;
|
|
import com.zanxiang.erp.base.ErpServer;
|
|
import com.zanxiang.erp.base.ErpServer;
|
|
import com.zanxiang.erp.base.rpc.ISysUserRpc;
|
|
import com.zanxiang.erp.base.rpc.ISysUserRpc;
|
|
|
|
+import com.zanxiang.erp.security.util.SecurityUtil;
|
|
import com.zanxiang.game.data.serve.component.DataPowerComponent;
|
|
import com.zanxiang.game.data.serve.component.DataPowerComponent;
|
|
import com.zanxiang.game.data.serve.pojo.dto.*;
|
|
import com.zanxiang.game.data.serve.pojo.dto.*;
|
|
import com.zanxiang.game.data.serve.pojo.entity.AdsGameServerDay;
|
|
import com.zanxiang.game.data.serve.pojo.entity.AdsGameServerDay;
|
|
@@ -13,6 +14,11 @@ import com.zanxiang.game.data.serve.pojo.enums.OrderByEnum;
|
|
import com.zanxiang.game.data.serve.pojo.vo.*;
|
|
import com.zanxiang.game.data.serve.pojo.vo.*;
|
|
import com.zanxiang.game.data.serve.service.IGameServerService;
|
|
import com.zanxiang.game.data.serve.service.IGameServerService;
|
|
import com.zanxiang.game.data.serve.utils.Page;
|
|
import com.zanxiang.game.data.serve.utils.Page;
|
|
|
|
+import com.zanxiang.game.module.base.ServerInfo;
|
|
|
|
+import com.zanxiang.game.module.base.pojo.enums.GameAuthEnum;
|
|
|
|
+import com.zanxiang.game.module.base.pojo.vo.GameAuthUserVO;
|
|
|
|
+import com.zanxiang.game.module.base.rpc.GameAuthRpc;
|
|
|
|
+import com.zanxiang.module.util.NumberUtil;
|
|
import com.zanxiang.module.util.pojo.ResultVO;
|
|
import com.zanxiang.module.util.pojo.ResultVO;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
@@ -50,6 +56,9 @@ public class GameServerServiceImpl implements IGameServerService {
|
|
@DubboReference(providedBy = ErpServer.SERVER_DUBBO_NAME)
|
|
@DubboReference(providedBy = ErpServer.SERVER_DUBBO_NAME)
|
|
private ISysUserRpc sysUserRpc;
|
|
private ISysUserRpc sysUserRpc;
|
|
|
|
|
|
|
|
+ @DubboReference(providedBy = ServerInfo.SERVER_DUBBO_NAME)
|
|
|
|
+ private GameAuthRpc gameAuthRpc;
|
|
|
|
+
|
|
//存储映射的List
|
|
//存储映射的List
|
|
private static final List<Tuple2<Field, Field>> dayNFieldMapList;
|
|
private static final List<Tuple2<Field, Field>> dayNFieldMapList;
|
|
private static final List<Tuple2<Field, Field>> dayNTotalFieldMapList;
|
|
private static final List<Tuple2<Field, Field>> dayNTotalFieldMapList;
|
|
@@ -549,13 +558,13 @@ public class GameServerServiceImpl implements IGameServerService {
|
|
.peek(field -> field.setAccessible(true))
|
|
.peek(field -> field.setAccessible(true))
|
|
.toList();
|
|
.toList();
|
|
//把所有gsIds取出来用,拼起来
|
|
//把所有gsIds取出来用,拼起来
|
|
- String gsIds = vos.stream().filter(i->StringUtils.isNotEmpty(i.getGsIds())).map(GSGameServerDayVO::getGsIds).collect(Collectors.joining(","));
|
|
|
|
|
|
+ String gsIds = vos.stream().filter(i -> StringUtils.isNotEmpty(i.getGsIds())).map(GSGameServerDayVO::getGsIds).collect(Collectors.joining(","));
|
|
ResultVO<Map<Long, String>> userMap = null;
|
|
ResultVO<Map<Long, String>> userMap = null;
|
|
- if(StringUtils.isNotEmpty(gsIds)){
|
|
|
|
|
|
+ if (StringUtils.isNotEmpty(gsIds)) {
|
|
//转换为Long类型
|
|
//转换为Long类型
|
|
List<Long> userIds = Arrays.stream(gsIds.split(",")).map(Long::parseLong).toList();
|
|
List<Long> userIds = Arrays.stream(gsIds.split(",")).map(Long::parseLong).toList();
|
|
//发送RPC接口查询所有用户
|
|
//发送RPC接口查询所有用户
|
|
- userMap = sysUserRpc.getUserNameByIds(userIds);
|
|
|
|
|
|
+ userMap = sysUserRpc.getUserNameByIds(userIds);
|
|
}
|
|
}
|
|
for (GSGameServerDayVO vo : vos) {
|
|
for (GSGameServerDayVO vo : vos) {
|
|
List<GSGameServerDayRVO> rDataList = collect.get(vo.getSourceSystem() + vo.getServerId() + vo.getParentGameId());
|
|
List<GSGameServerDayRVO> rDataList = collect.get(vo.getSourceSystem() + vo.getServerId() + vo.getParentGameId());
|
|
@@ -568,7 +577,7 @@ public class GameServerServiceImpl implements IGameServerService {
|
|
//累计的充值人数,为了/r数据
|
|
//累计的充值人数,为了/r数据
|
|
String[] split = value.split("/");
|
|
String[] split = value.split("/");
|
|
GSGameServerDayRVO gsGameServerDayRVO = rDataList.get(i);
|
|
GSGameServerDayRVO gsGameServerDayRVO = rDataList.get(i);
|
|
- rData = getRDataStr(gsGameServerDayRVO,Long.valueOf(split[split.length-1]));
|
|
|
|
|
|
+ rData = getRDataStr(gsGameServerDayRVO, Long.valueOf(split[split.length - 1]));
|
|
} else {
|
|
} else {
|
|
rData = "0/0/0/0/0/0/0/0";
|
|
rData = "0/0/0/0/0/0/0/0";
|
|
}
|
|
}
|
|
@@ -605,6 +614,23 @@ public class GameServerServiceImpl implements IGameServerService {
|
|
return new Page<>(vos, pager);
|
|
return new Page<>(vos, pager);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public List<String> getServerIdByGSId(Long gsId) {
|
|
|
|
+ if (gsId == null) {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ Sql sql = Sqls.create(getServerIdByGSIdSql(gsId));
|
|
|
|
+ sql.setCallback(Sqls.callback.strList());
|
|
|
|
+ dao.execute(sql);
|
|
|
|
+ List<String> list = sql.getList(String.class);
|
|
|
|
+ return list;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private String getServerIdByGSIdSql(Long gsId) {
|
|
|
|
+ String sql = "select server_id from dm_game_order.t_game_server_merge where find_in_set(" + gsId + ", gs_ids) ";
|
|
|
|
+ return sql;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
/**
|
|
/**
|
|
* 区服总数据
|
|
* 区服总数据
|
|
@@ -672,7 +698,7 @@ public class GameServerServiceImpl implements IGameServerService {
|
|
//总的累计数据
|
|
//总的累计数据
|
|
String[] split1 = value.split("/");
|
|
String[] split1 = value.split("/");
|
|
GSGameServerDayRVO gsGameServerDayRVO = dayRVOMap.get(i);
|
|
GSGameServerDayRVO gsGameServerDayRVO = dayRVOMap.get(i);
|
|
- String rData = getRDataStr(gsGameServerDayRVO, Long.valueOf(split1[split1.length-1]));
|
|
|
|
|
|
+ String rData = getRDataStr(gsGameServerDayRVO, Long.valueOf(split1[split1.length - 1]));
|
|
value += "/" + rData;
|
|
value += "/" + rData;
|
|
String[] split = value.split("/");
|
|
String[] split = value.split("/");
|
|
GSServerRetentionVO retentionVO = GSServerRetentionVO.builder()
|
|
GSServerRetentionVO retentionVO = GSServerRetentionVO.builder()
|
|
@@ -733,7 +759,7 @@ public class GameServerServiceImpl implements IGameServerService {
|
|
* @param rvo
|
|
* @param rvo
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- private String getRDataStr(GSGameServerDayRVO rvo,Long totalNum) {
|
|
|
|
|
|
+ private String getRDataStr(GSGameServerDayRVO rvo, Long totalNum) {
|
|
if (rvo != null && totalNum != null && totalNum != 0) {
|
|
if (rvo != null && totalNum != null && totalNum != 0) {
|
|
//R人数
|
|
//R人数
|
|
Long smallRCount = rvo.getSmallR();
|
|
Long smallRCount = rvo.getSmallR();
|
|
@@ -799,8 +825,18 @@ public class GameServerServiceImpl implements IGameServerService {
|
|
|
|
|
|
|
|
|
|
private Criteria getGameServerDayCriteria(GSGameServerDayDTO dto) {
|
|
private Criteria getGameServerDayCriteria(GSGameServerDayDTO dto) {
|
|
|
|
+ GameAuthUserVO userGameInfo = gameAuthRpc.getGameAuthByUserIds().getData();
|
|
|
|
+ List<Long> serverIdByGS = null;
|
|
|
|
+ //判断是不是GS
|
|
|
|
+ if (GameAuthEnum.getByValue(userGameInfo.getGameAuthEnum().getValue()) != null) {
|
|
|
|
+ //查询GS管理的区服列表
|
|
|
|
+ serverIdByGS = getServerIdByGSId(SecurityUtil.getUserId()).stream().filter(StringUtils::isNotEmpty).map(Long::parseLong).collect(Collectors.toList());
|
|
|
|
+ }
|
|
//创建查询条件
|
|
//创建查询条件
|
|
Criteria cri = Cnd.cri();
|
|
Criteria cri = Cnd.cri();
|
|
|
|
+ if (CollectionUtils.isNotEmpty(serverIdByGS)) {
|
|
|
|
+ cri.where().andInList("a.server_id", serverIdByGS);
|
|
|
|
+ }
|
|
if (StringUtils.isNotEmpty(dto.getSourceSystem())) {
|
|
if (StringUtils.isNotEmpty(dto.getSourceSystem())) {
|
|
cri.where().andEquals("a.source_system", dto.getSourceSystem());
|
|
cri.where().andEquals("a.source_system", dto.getSourceSystem());
|
|
}
|
|
}
|
|
@@ -863,14 +899,13 @@ public class GameServerServiceImpl implements IGameServerService {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取每天活跃留存率/付费留存率的sql
|
|
* 获取每天活跃留存率/付费留存率的sql
|
|
- *
|
|
|
|
*/
|
|
*/
|
|
private String getRemainDaySql() {
|
|
private String getRemainDaySql() {
|
|
StringBuilder sql = new StringBuilder(StringUtils.EMPTY);
|
|
StringBuilder sql = new StringBuilder(StringUtils.EMPTY);
|
|
for (int i = 1; i <= 90; i++) {
|
|
for (int i = 1; i <= 90; i++) {
|
|
sql.append("""
|
|
sql.append("""
|
|
concat(a.da%d,'/',IFNULL(c.da%d_role_num,0),'/',IFNULL(c.da%d_num,0),'/',IFNULL(c.da%d_total_num,0)) as da_str%d,
|
|
concat(a.da%d,'/',IFNULL(c.da%d_role_num,0),'/',IFNULL(c.da%d_num,0),'/',IFNULL(c.da%d_total_num,0)) as da_str%d,
|
|
- """.formatted(i, i, i, i,i));
|
|
|
|
|
|
+ """.formatted(i, i, i, i, i));
|
|
|
|
|
|
}
|
|
}
|
|
return sql.toString();
|
|
return sql.toString();
|
|
@@ -884,7 +919,7 @@ public class GameServerServiceImpl implements IGameServerService {
|
|
for (int i = 1; i <= 90; i++) {
|
|
for (int i = 1; i <= 90; i++) {
|
|
sql.append("""
|
|
sql.append("""
|
|
concat(ifnull(round(SUM(c.da%d_active_num) / SUM(e.new_da%d_total_num) ,4),0),'/',ifnull(round(sum(c.da%d_num)/sum(c.da%d_total_num),4),0),'/',IFNULL(SUM(c.da%d_role_num),0),'/',IFNULL(SUM(c.da%d_num),0),'/',IFNULL(sum(c.da%d_total_num),0)) as da_str%d,
|
|
concat(ifnull(round(SUM(c.da%d_active_num) / SUM(e.new_da%d_total_num) ,4),0),'/',ifnull(round(sum(c.da%d_num)/sum(c.da%d_total_num),4),0),'/',IFNULL(SUM(c.da%d_role_num),0),'/',IFNULL(SUM(c.da%d_num),0),'/',IFNULL(sum(c.da%d_total_num),0)) as da_str%d,
|
|
- """.formatted(i, i, i, i, i, i, i,i));
|
|
|
|
|
|
+ """.formatted(i, i, i, i, i, i, i, i));
|
|
}
|
|
}
|
|
return sql.toString();
|
|
return sql.toString();
|
|
}
|
|
}
|