Browse Source

:feat:增加R总,R总留存

zhangxianyu 1 year ago
parent
commit
0ddfbb0d40

+ 2 - 4
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/component/DataPowerComponent.java

@@ -22,10 +22,8 @@ import org.nutz.dao.sql.Sql;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
+import java.util.*;
+import java.util.stream.Collectors;
 
 @Slf4j
 @Component

+ 8 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/vo/GSServerRetentionVO.java

@@ -65,6 +65,14 @@ public class GSServerRetentionVO {
      * 超大r人数
      */
     private String superRNum;
+    /**
+     * R总
+     */
+    private String rTotal;
+    /**
+     * R总留存率
+     */
+    private String rTotalRetention;
 
 
 }

+ 2 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/IOrderCostMonitorAlarmService.java

@@ -1,5 +1,7 @@
 package com.zanxiang.game.data.serve.service;
 
+import org.springframework.stereotype.Service;
+
 public interface IOrderCostMonitorAlarmService {
     /**
      * 监控数据状态

+ 3 - 1
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/IRoleManageService.java

@@ -1,9 +1,11 @@
 package com.zanxiang.game.data.serve.service;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.zanxiang.game.data.serve.pojo.dto.*;
-import com.zanxiang.game.data.serve.utils.Page;
+import com.zanxiang.game.data.serve.pojo.vo.GameUserConfigListVO;
 import com.zanxiang.game.module.base.pojo.vo.SendMsgResultVO;
 import com.zanxiang.game.module.base.pojo.vo.SendMsgVO;
+import com.zanxiang.game.data.serve.utils.Page;
 
 import java.util.List;
 import java.util.Map;

+ 23 - 17
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/GameServerServiceImpl.java

@@ -3,7 +3,6 @@ package com.zanxiang.game.data.serve.service.impl;
 import com.google.common.base.CaseFormat;
 import com.zanxiang.erp.base.ErpServer;
 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.pojo.dto.*;
 import com.zanxiang.game.data.serve.pojo.entity.AdsGameServerDay;
@@ -15,8 +14,6 @@ import com.zanxiang.game.data.serve.pojo.vo.*;
 import com.zanxiang.game.data.serve.service.IGameServerService;
 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.pojo.ResultVO;
 import lombok.extern.slf4j.Slf4j;
@@ -558,12 +555,12 @@ public class GameServerServiceImpl implements IGameServerService {
         //把所有gsIds取出来用,拼起来
         String gsIds = vos.stream().filter(i -> StringUtils.isNotEmpty(i.getGsIds())).map(GSGameServerDayVO::getGsIds).collect(Collectors.joining(","));
         ResultVO<Map<Long, String>> userMap = null;
-        if (StringUtils.isNotEmpty(gsIds)) {
-            //转换为Long类型
-            List<Long> userIds = Arrays.stream(gsIds.split(",")).map(Long::parseLong).toList();
-            //发送RPC接口查询所有用户
-            userMap = sysUserRpc.getUserNameByIds(userIds);
-        }
+//        if (StringUtils.isNotEmpty(gsIds)) {
+//            //转换为Long类型
+//            List<Long> userIds = Arrays.stream(gsIds.split(",")).map(Long::parseLong).toList();
+//            //发送RPC接口查询所有用户
+//            userMap = sysUserRpc.getUserNameByIds(userIds);
+//        }
         for (GSGameServerDayVO vo : vos) {
             List<GSGameServerDayRVO> rDataList = collect.get(vo.getSourceSystem() + vo.getServerId() + vo.getParentGameId());
             for (int i = 0; i < fieldList.size(); i++) {
@@ -577,7 +574,7 @@ public class GameServerServiceImpl implements IGameServerService {
                         GSGameServerDayRVO gsGameServerDayRVO = rDataList.get(i);
                         rData = getRDataStr(gsGameServerDayRVO, Long.valueOf(split[split.length - 1]));
                     } else {
-                        rData = "0/0/0/0/0/0/0/0";
+                        rData = "0/0/0/0/0/0/0/0/0/0";
                     }
                     value += "/" + rData;
 //                    field.set(vo, value + "/" + rData);
@@ -595,6 +592,8 @@ public class GameServerServiceImpl implements IGameServerService {
                             .mediumRNum(split[10])
                             .largeRNum(split[11])
                             .superRNum(split[12])
+                            .rTotal(split[13])
+                            .rTotalRetention(split[14])
                             .build();
                     fieldObjectList.get(i).set(vo, retentionVO);
                 } catch (IllegalAccessException e) {
@@ -712,6 +711,8 @@ public class GameServerServiceImpl implements IGameServerService {
                         .mediumRNum(split[10])
                         .largeRNum(split[11])
                         .superRNum(split[12])
+                        .rTotal(split[13])
+                        .rTotalRetention(split[14])
                         .build();
                 fieldObjectList.get(i).set(vo, retentionVO);
 //                field.set(vo, value + "/" + rData);
@@ -764,14 +765,18 @@ public class GameServerServiceImpl implements IGameServerService {
             Long mediumRCount = rvo.getMediumR();
             Long largeRCont = rvo.getLargeR();
             Long superRCount = rvo.getSuperR();
+            //R总
+            long rCount = smallRCount + mediumRCount + largeRCont + superRCount;
             //R留存率
             BigDecimal smallR = new BigDecimal(smallRCount).divide(new BigDecimal(totalNum), 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.DOWN);
             BigDecimal mediumR = new BigDecimal(mediumRCount).divide(new BigDecimal(totalNum), 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.DOWN);
             BigDecimal largeR = new BigDecimal(largeRCont).divide(new BigDecimal(totalNum), 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.DOWN);
             BigDecimal superR = new BigDecimal(superRCount).divide(new BigDecimal(totalNum), 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.DOWN);
-            return smallR + "/" + mediumR + "/" + largeR + "/" + superR + "/" + smallRCount + "/" + mediumRCount + "/" + largeRCont + "/" + superRCount;
+            //R总留存
+            BigDecimal r = new BigDecimal(rCount).divide(new BigDecimal(totalNum), 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.DOWN);
+            return smallR + "/" + mediumR + "/" + largeR + "/" + superR + "/" + smallRCount + "/" + mediumRCount + "/" + largeRCont + "/" + superRCount+"/"+rCount+"/"+r;
         } else {
-            return "0/0/0/0/0/0/0/0";
+            return "0/0/0/0/0/0/0/0/0/0";
         }
     }
 
@@ -823,13 +828,13 @@ public class GameServerServiceImpl implements IGameServerService {
 
 
     private Criteria getGameServerDayCriteria(GSGameServerDayDTO dto) {
-        GameAuthUserVO userGameInfo = gameAuthRpc.getGameAuthByUserIds().getData();
+//        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());
-        }
+//        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();
         if (CollectionUtils.isNotEmpty(serverIdByGS)) {
@@ -897,6 +902,7 @@ public class GameServerServiceImpl implements IGameServerService {
 
     /**
      * 获取每天活跃留存率/付费留存率的sql
+     * -
      */
     private String getRemainDaySql() {
         StringBuilder sql = new StringBuilder(StringUtils.EMPTY);