Quellcode durchsuchen

Merge branch 'package' of GameCenter/game-center into dev

zhimo vor 1 Jahr
Ursprung
Commit
051e8a6339
38 geänderte Dateien mit 1131 neuen und 182 gelöschten Zeilen
  1. 49 1
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/component/DataPowerComponent.java
  2. 1 1
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/controller/PlayerDataController.java
  3. 2 1
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/dto/AdsAgentRechargeRankingListDTO.java
  4. 8 0
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/dto/GameServerDayDTO.java
  5. 8 0
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/dto/GameServerDayTotalDTO.java
  6. 2 1
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/dto/PlayerDataListDTO.java
  7. 2 1
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/dto/PlayerRoleDataListDTO.java
  8. 72 0
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/vo/GameServerTrendVO.java
  9. 1 1
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/IPlayerDataService.java
  10. 13 8
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/AccountAgentDayServiceImpl.java
  11. 4 3
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/AdsAccountRechargeRankingServiceImpl.java
  12. 5 5
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/AdsAgentRechargeRankingServiceImpl.java
  13. 18 12
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/AdsOrderDetailService.java
  14. 22 11
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/GameDataServiceImpl.java
  15. 505 30
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/GameServerServiceImpl.java
  16. 4 2
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/IActiveDataServiceImpl.java
  17. 28 16
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/IMediaDataServiceImpl.java
  18. 8 10
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/OverallSummaryServiceImpl.java
  19. 20 12
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/PitcherDataServiceImpl.java
  20. 46 30
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/PlayerDataServiceImpl.java
  21. 24 16
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/PromotionDayServiceImpl.java
  22. 5 2
      game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/RankingServiceImpl.java
  23. 25 1
      game-module/game-module-base/src/main/java/com/zanxiang/game/module/base/pojo/vo/GameAuthUserVO.java
  24. 1 1
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/ManageApplication.java
  25. 18 2
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/params/GameAuthAddParam.java
  26. 7 0
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/params/GameAuthUpdateParam.java
  27. 6 0
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/vo/GameAuthVO.java
  28. 7 0
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/rpc/impl/GameAuthRpcImpl.java
  29. 8 6
      game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/GameAuthServiceImpl.java
  30. 5 0
      game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/entity/GameAppletShell.java
  31. 5 0
      game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/entity/GameAuth.java
  32. 1 1
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/SDKApplication.java
  33. 5 2
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/controller/InitController.java
  34. 134 0
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/pojo/result/IpCheckResult.java
  35. 4 1
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/IGameAppletShellService.java
  36. 9 0
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/IUserCardService.java
  37. 18 1
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/GameAppletShellServiceImpl.java
  38. 31 4
      game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/UserCardServiceImpl.java

+ 49 - 1
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/component/DataPowerComponent.java

@@ -1,9 +1,12 @@
 package com.zanxiang.game.data.serve.component;
 
+import com.github.sd4324530.jtuple.Tuple2;
 import com.zanxiang.erp.base.ErpServer;
 import com.zanxiang.erp.base.rpc.ISysGameUserGroupRpc;
 import com.zanxiang.erp.security.util.SecurityUtil;
 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.JsonUtil;
 import com.zanxiang.module.util.exception.BaseException;
@@ -26,6 +29,51 @@ public class DataPowerComponent {
     @DubboReference(providedBy = ServerInfo.SERVER_DUBBO_NAME)
     private GameAuthRpc gameAuthRpc;
 
+
+
+    /**
+     * 获取当前登录用户有权限查看的用户列表
+     * 1:普通用户-投手:自己
+     * 1:普通用户-运营:游戏数据
+     * 2:投手组长:自己+组员+自然量
+     * 3:管理员/超管:所有数据
+     */
+    public Tuple2<List<Long>, List<Long>> getPowerInfo() {
+        if (SecurityUtil.isAdmin()) {
+            return Tuple2.with(null, null);
+        }
+        GameAuthUserVO userGameInfo = gameAuthRpc.getGameAuthByUserIds().getData();
+        if(CollectionUtils.isEmpty(userGameInfo.getGameIdList())) {
+            throw new BaseException("没有游戏查看权限,请联系管理员指派游戏权限");
+        }
+        GameAuthEnum gameAuth = userGameInfo.getGameAuthEnum();
+        Collection<Long> subUserIds = sysGameUserGroupRpc.memberUserIds(SecurityUtil.getCompanyId(), SecurityUtil.getUserId()).getData();
+        if(CollectionUtils.isEmpty(subUserIds)) {
+            throw new BaseException("服务异常,获取用户列表失败!!");
+        }
+        if (subUserIds.size() == 1) {
+            if(gameAuth == GameAuthEnum.OPERATE) {
+                // 运营
+                return Tuple2.with(null, userGameInfo.getGameIdList());
+            } else {
+                // 投手
+                return Tuple2.with(new ArrayList<>(subUserIds), userGameInfo.getGameIdList());
+            }
+        } else {
+            // 组长
+            if(gameAuth == GameAuthEnum.OPERATE) {
+                // 运营组长
+                return Tuple2.with(null, userGameInfo.getGameIdList());
+            } else {
+                // 投手组长
+                // 自然量
+                subUserIds.add(0L);
+                return Tuple2.with(new ArrayList<>(subUserIds), userGameInfo.getGameIdList());
+            }
+        }
+    }
+
+
     /**
      * 获取当前登录用户有权限查看的用户列表
      * 1:普通用户-投手:自己
@@ -41,7 +89,7 @@ public class DataPowerComponent {
         Collection<Long> subUserIds = sysGameUserGroupRpc.memberUserIds(SecurityUtil.getCompanyId(), SecurityUtil.getUserId()).getData();
         if (subUserIds.size() > 1) {
             // 自然量
-            subUserIds.add(-2L);
+            subUserIds.add(0L);
         }
         log.error("1111--------->" + JsonUtil.toString(subUserIds));
         return new ArrayList<>(subUserIds);

+ 1 - 1
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/controller/PlayerDataController.java

@@ -52,7 +52,7 @@ public class PlayerDataController {
     @ApiOperation("玩家角色列表总计一栏")
     @PreAuthorize(permissionKey = "playerData:role:total")
     @PostMapping("/role/total")
-    public ResultVO<Map> getPlayerRoleTotalData(@RequestBody PlayerRoleDataListDTO dto) {
+    public ResultVO<PlayerRoleDataVO> getPlayerRoleTotalData(@RequestBody PlayerRoleDataListDTO dto) {
         return ResultVO.ok(playerDataService.getPlayerRoleTotalData(dto));
     }
 

+ 2 - 1
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/dto/AdsAgentRechargeRankingListDTO.java

@@ -4,6 +4,7 @@ import com.zanxiang.game.data.serve.pojo.base.BasePage;
 import lombok.Data;
 
 import java.time.LocalDate;
+import java.util.List;
 
 @Data
 public class AdsAgentRechargeRankingListDTO extends BasePage {
@@ -14,7 +15,7 @@ public class AdsAgentRechargeRankingListDTO extends BasePage {
 
     private String sourceSystem;
 
-    private String agentId;
+    private List<String> agentId;
 
     private Long pitcherId;
 

+ 8 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/dto/GameServerDayDTO.java

@@ -69,4 +69,12 @@ public class GameServerDayDTO extends BasePage {
     @ApiModelProperty(notes = "排序方式:升序asc;降序desc")
     private String sortType;
 
+    /**
+     * 选择留存数据的类型
+     */
+    @ApiModelProperty(notes = """
+            选择留存数据的类型:reg -> 注册留存 ; role -> 角色留存 ; amount -> 付费留存
+            """)
+    private String activeTypes;
+
 }

+ 8 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/dto/GameServerDayTotalDTO.java

@@ -55,4 +55,12 @@ public class GameServerDayTotalDTO {
     @ApiModelProperty(value = "SDK来源")
     private String sourceSystem;
 
+    /**
+     * 选择留存数据的类型
+     */
+    @ApiModelProperty(notes = """
+            选择留存数据的类型:reg -> 注册留存 ; role -> 角色留存 ; amount -> 付费留存
+            """)
+    private String activeTypes;
+
 }

+ 2 - 1
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/dto/PlayerDataListDTO.java

@@ -7,6 +7,7 @@ import lombok.Data;
 import org.springframework.format.annotation.DateTimeFormat;
 
 import java.time.LocalDate;
+import java.util.List;
 
 /**
  * @author tianhua
@@ -104,7 +105,7 @@ public class PlayerDataListDTO extends BasePage {
      * 注册渠道对应的id
      */
     @ApiModelProperty(notes = "注册渠道对应的id")
-    private Long channelId;
+    private List<String> channelId;
 
     /**
      * 归因推广账号

+ 2 - 1
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/dto/PlayerRoleDataListDTO.java

@@ -7,6 +7,7 @@ import lombok.Data;
 import org.springframework.format.annotation.DateTimeFormat;
 
 import java.time.LocalDate;
+import java.util.List;
 
 /**
  * @author tianhua
@@ -80,7 +81,7 @@ public class PlayerRoleDataListDTO extends BasePage {
      * 注册渠道对应的id
      */
     @ApiModelProperty(notes = "注册渠道对应的id")
-    private Long channelId;
+    private List<String> channelId;
 
     /**
      * 归因推广账号

+ 72 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/vo/GameServerTrendVO.java

@@ -68,4 +68,76 @@ public class GameServerTrendVO {
     @ApiModelProperty(notes = "滚服付费占比")
     private BigDecimal rollServerAmountRate;
 
+    /**
+     * 注册留存DayN活跃人数(注册留存数据)
+     */
+    @ApiModelProperty(notes = "注册留存DayN活跃人数(注册留存数据)")
+    private Long regActiveNum;
+
+    /**
+     * 注册留存率(注册留存数据)
+     */
+    @ApiModelProperty(notes = "注册留存率(注册留存数据)")
+    private BigDecimal regActiveRate;
+
+    /**
+     * 第N天的新增付费用户(付费留存数据)
+     */
+    @ApiModelProperty(notes = "第N天的新增付费用户(付费留存数据)")
+    private Long newUserAmountNum;
+
+    /**
+     * 第N天的老活跃用户数(付费留存数据)
+     */
+    @ApiModelProperty(notes = "第N天的老活跃用户数(付费留存数据)")
+    private Long oldActiveUserNum;
+
+    /**
+     * 累计到第N天的付费用户数(付费留存数据)
+     */
+    @ApiModelProperty(notes = "累计到第N天的付费用户数(付费留存数据)")
+    private Long newUserTotalAmountNum;
+
+    /**
+     * 累计到第N天的活跃用户数(付费留存数据)
+     */
+    @ApiModelProperty(notes = "累计到第N天的活跃用户数(付费留存数据)")
+    private Long newActiveUserTotalNum;
+
+    /**
+     * 付费留存率(付费留存数据)
+     */
+    @ApiModelProperty(notes = "付费留存率(付费留存数据)")
+    private BigDecimal amountActiveRate;
+
+    /**
+     * 第N天的新增创角用户数(创角留存数据)
+     */
+    @ApiModelProperty(notes = "第N天的新增创角用户数(创角留存数据)")
+    private Long roleNewUserNum;
+
+    /**
+     * 第N天的老活跃用户数(创角留存数据)
+     */
+    @ApiModelProperty(notes = "第N天的老活跃用户数(创角留存数据)")
+    private Long roleOldActiveUserNum;
+
+    /**
+     * 累计到第N天的创角用户数(创角留存数据)
+     */
+    @ApiModelProperty(notes = "累计到第N天的创角用户数(创角留存数据)")
+    private Long roleNewUserTotalNum;
+
+    /**
+     * 累计到第N天的活跃用户数(创角留存数据)
+     */
+    @ApiModelProperty(notes = "累计到第N天的活跃用户数(创角留存数据)")
+    private Long roleNewActiveUserTotalNum;
+
+    /**
+     * 创角留存率(创角留存数据)
+     */
+    @ApiModelProperty(notes = "创角留存率(创角留存数据)")
+    private BigDecimal roleActiveRate;
+
 }

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

@@ -36,7 +36,7 @@ public interface IPlayerDataService {
      * @param dto PlayerRoleDataListDTO
      * @return Map
      */
-    Map getPlayerRoleTotalData(PlayerRoleDataListDTO dto);
+    PlayerRoleDataVO getPlayerRoleTotalData(PlayerRoleDataListDTO dto);
 
     /**
      * 玩家登陆日志列表

+ 13 - 8
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/AccountAgentDayServiceImpl.java

@@ -1,5 +1,6 @@
 package com.zanxiang.game.data.serve.service.impl;
 
+import com.github.sd4324530.jtuple.Tuple2;
 import com.google.common.base.CaseFormat;
 import com.google.gson.Gson;
 import com.zanxiang.game.data.serve.component.DataPowerComponent;
@@ -50,8 +51,9 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
 
     @Override
     public Page<GamePromoteDayVO> accountAgentDay(GamePromoteDayDTO dto) {
-        List<Long> userIds = dto.getSysUserId() == null ? dataPowerComponent.getSubUserIdList() : Collections.singletonList(dto.getSysUserId());
-        List<Long> gameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(dto.getGameId());
+        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> userIds = dto.getSysUserId() == null ? poerInfo.first : Collections.singletonList(dto.getSysUserId());
+        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
 
         /*Long sysUserId = SecurityUtil.isAdmin() ? null : SecurityUtil.getUserId();
         sysUserId = null == dto.getSysUserId() ? sysUserId : dto.getSysUserId();
@@ -244,8 +246,9 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
 
     @Override
     public GamePromoteDayTotalVO accountAgentDayTotal(GamePromoteDayTotalDTO dto) {
-        List<Long> userIds = dto.getSysUserId() == null ? dataPowerComponent.getSubUserIdList() : Collections.singletonList(dto.getSysUserId());
-        List<Long> gameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(dto.getGameId());
+        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> userIds = dto.getSysUserId() == null ? poerInfo.first : Collections.singletonList(dto.getSysUserId());
+        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
 
         /*Long sysUserId = SecurityUtil.isAdmin() ? null : SecurityUtil.getUserId();
         sysUserId = null == dto.getSysUserId() ? sysUserId : dto.getSysUserId();
@@ -451,8 +454,9 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
 
     @Override
     public Page<GamePromoteTotalVO> accountAgentTotal(GamePromoteTotalDTO dto) {
-        List<Long> userIds = dto.getSysUserId() == null ? dataPowerComponent.getSubUserIdList() : Collections.singletonList(dto.getSysUserId());
-        List<Long> gameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(dto.getGameId());
+        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> userIds = dto.getSysUserId() == null ? poerInfo.first : Collections.singletonList(dto.getSysUserId());
+        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
         /*Long sysUserId = SecurityUtil.isAdmin() ? null : SecurityUtil.getUserId();
         sysUserId = null == dto.getSysUserId() ? sysUserId : dto.getSysUserId();
         dto.setSysUserId(sysUserId);*/
@@ -850,8 +854,9 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
 
     @Override
     public GamePromoteTotalSumVO accountAgentTotalSum(GamePromoteTotalSumDTO dto) {
-        List<Long> userIds = dto.getSysUserId() == null ? dataPowerComponent.getSubUserIdList() : Collections.singletonList(dto.getSysUserId());
-        List<Long> gameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(dto.getGameId());
+        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> userIds = dto.getSysUserId() == null ? poerInfo.first : Collections.singletonList(dto.getSysUserId());
+        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
         /*Long sysUserId = SecurityUtil.isAdmin() ? null : SecurityUtil.getUserId();
         sysUserId = null == dto.getSysUserId() ? sysUserId : dto.getSysUserId();
         dto.setSysUserId(sysUserId);*/

+ 4 - 3
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/AdsAccountRechargeRankingServiceImpl.java

@@ -1,7 +1,7 @@
 package com.zanxiang.game.data.serve.service.impl;
 
+import com.github.sd4324530.jtuple.Tuple2;
 import com.google.common.base.CaseFormat;
-import com.zanxiang.erp.security.util.SecurityUtil;
 import com.zanxiang.game.data.serve.component.DataPowerComponent;
 import com.zanxiang.game.data.serve.pojo.dto.AdsAccountRechargeRankingListDTO;
 import com.zanxiang.game.data.serve.pojo.vo.AdsAccountRechargeRankingVO;
@@ -38,8 +38,9 @@ public class AdsAccountRechargeRankingServiceImpl implements IAdsAccountRecharge
 
     @Override
     public Page<AdsAccountRechargeRankingVO> listOfPage(AdsAccountRechargeRankingListDTO dto) {
-        List<Long> userIds = dto.getPitcherId() == null ? dataPowerComponent.getSubUserIdList() : Collections.singletonList(dto.getPitcherId());
-        List<Long> gameIds = dto.getPitcherId() == null ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(dto.getGameId());
+        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
+        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
         if (StringUtils.isBlank(dto.getSortFiled())) {
             dto.setSortFiled("cost");
         }

+ 5 - 5
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/AdsAgentRechargeRankingServiceImpl.java

@@ -1,10 +1,9 @@
 package com.zanxiang.game.data.serve.service.impl;
 
+import com.github.sd4324530.jtuple.Tuple2;
 import com.google.common.base.CaseFormat;
-import com.zanxiang.erp.security.util.SecurityUtil;
 import com.zanxiang.game.data.serve.component.DataPowerComponent;
 import com.zanxiang.game.data.serve.pojo.dto.AdsAgentRechargeRankingListDTO;
-import com.zanxiang.game.data.serve.pojo.entity.AdsAgentRechargeRanking;
 import com.zanxiang.game.data.serve.pojo.vo.AdsAgentRechargeRankingVO;
 import com.zanxiang.game.data.serve.service.IAdsAgentRechargeRankingService;
 import com.zanxiang.game.data.serve.utils.Page;
@@ -38,7 +37,8 @@ public class AdsAgentRechargeRankingServiceImpl implements IAdsAgentRechargeRank
     private DataPowerComponent dataPowerComponent;
 
     public Page<AdsAgentRechargeRankingVO> listOfPage(AdsAgentRechargeRankingListDTO dto) {
-        List<Long> userIds = dto.getPitcherId() == null ? dataPowerComponent.getSubUserIdList() : Collections.singletonList(dto.getPitcherId());
+        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
         if (StringUtils.isBlank(dto.getSortFiled())) {
             dto.setSortFiled("today_amount");
         }
@@ -61,8 +61,8 @@ public class AdsAgentRechargeRankingServiceImpl implements IAdsAgentRechargeRank
         if (null != dto.getBeginDay() && null != dto.getEndDay()) {
             cri.where().and("dt", ">=", dto.getBeginDay()).and("dt", "<=", dto.getEndDay());
         }
-        if (StringUtils.isNotBlank(dto.getAgentId())) {
-            cri.where().and("agent_id", "=", dto.getAgentId());
+        if (CollectionUtils.isNotEmpty(dto.getAgentId())) {
+            cri.where().andIn("agent_id", dto.getAgentId().toArray(String[]::new));
         }
         if (userIds != null) {
             cri.where().andInList("pitcher_id", userIds);

+ 18 - 12
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/AdsOrderDetailService.java

@@ -1,5 +1,6 @@
 package com.zanxiang.game.data.serve.service.impl;
 
+import com.github.sd4324530.jtuple.Tuple2;
 import com.google.common.base.CaseFormat;
 import com.zanxiang.erp.security.util.SecurityUtil;
 import com.zanxiang.game.data.serve.component.DataPowerComponent;
@@ -42,8 +43,9 @@ public class AdsOrderDetailService implements IAdsOrderDetailService {
 
     @Override
     public Page<AdsOrderDetailVO> listOfPage(AdsOrderDetailListDTO dto) {
-        List<Long> userIds = dto.getPitcherId() == null ? dataPowerComponent.getSubUserIdList() : Collections.singletonList(Long.parseLong(dto.getPitcherId()));
-        List<Long> gameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : dto.getGameId();
+        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(Long.parseLong(dto.getPitcherId()));
+        List<Long> gameIds = CollectionUtils.isEmpty(dto.getGameId()) ? poerInfo.second : dto.getGameId();
         if (StringUtils.isBlank(dto.getPitcherId()) && !SecurityUtil.isManager()) {
             // 只有管理员才能查看全部数据
             dto.setPitcherId(SecurityUtil.getUserId().toString());
@@ -154,8 +156,9 @@ public class AdsOrderDetailService implements IAdsOrderDetailService {
 
     @Override
     public AdsOrderDetailTotalVO orderTotal(AdsOrderDetailTotalDTO dto) {
-        List<Long> userIds = dto.getPitcherId() == null ? dataPowerComponent.getSubUserIdList() : Collections.singletonList(Long.parseLong(dto.getPitcherId()));
-        List<Long> gameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : dto.getGameId();
+        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(Long.parseLong(dto.getPitcherId()));
+        List<Long> gameIds = CollectionUtils.isEmpty(dto.getGameId()) ? poerInfo.second : dto.getGameId();
         /*if (StringUtils.isBlank(dto.getPitcherId()) && !SecurityUtil.isManager()) {
             // 只有管理员才能查看全部数据
             dto.setPitcherId(SecurityUtil.getUserId().toString());
@@ -221,11 +224,11 @@ public class AdsOrderDetailService implements IAdsOrderDetailService {
         }
         if (dto.getRegTimeStart() != null && dto.getRegTimeEnd() != null) {
             //玩家注册时间
-            cri.where().andBetween("reg_time", dto.getRegTimeStart(), dto.getRegTimeEnd());
+            cri.where().andBetween("DATE(reg_time)", dto.getRegTimeStart(), dto.getRegTimeEnd());
         }
         if (dto.getPayTimeStart() != null && dto.getPayTimeEnd() != null) {
             //支付时间,订单充值时间
-            cri.where().andBetween("pay_time", dto.getPayTimeStart(), dto.getPayTimeEnd());
+            cri.where().andBetween("DATE(pay_time)", dto.getPayTimeStart(), dto.getPayTimeEnd());
         }
         if (dto.getRegPayIntervalTimeMin() != null) {
             cri.where().andGTE("TIMESTAMPDIFF(MINUTE, reg_time, pay_time)", dto.getRegPayIntervalTimeMin());
@@ -308,6 +311,7 @@ public class AdsOrderDetailService implements IAdsOrderDetailService {
                 		b.username , -- 玩家账号
                 		b.nickname , -- 玩家昵称
                 		b.create_time as reg_time, -- 玩家注册时间
+                		c.account_id , -- 广告账号
                 		a.agent_id , -- 玩家注册渠道ID
                 		IF(a.agent_id = 0, '自然量', c.agent_name) as agent_name,-- 注册渠道名
                 		b.game_id , -- 玩家注册游戏ID
@@ -315,8 +319,8 @@ public class AdsOrderDetailService implements IAdsOrderDetailService {
                 		g.classify , -- 玩家注册游戏类型
                 		a.cp_id , -- CPID
                 		e.cp_name ,-- cp名
-                		c.pitcher_id as zx_pitcher_id, -- 投手ID
-                		d.zx_pitcher_name , -- 投手名
+                		IFNULL(c.pitcher_id, 0) as zx_pitcher_id, -- 投手ID
+                  		IFNULL(d.zx_pitcher_name, '自然量') as zx_pitcher_name, -- 投手名
                 		a.game_id as order_game_id, -- 玩家充值游戏ID
                 		f.game_name as order_game_name,-- 玩家充值游戏名
                 		f.classify as order_game_classify,-- 玩家充值游戏类型
@@ -386,6 +390,7 @@ public class AdsOrderDetailService implements IAdsOrderDetailService {
                 		b.username , -- 玩家账号
                 		b.nickname , -- 玩家昵称
                 		b.create_time as reg_time, -- 玩家注册时间
+                		c.account_id , -- 广告账号
                 		a.agent_id , -- 玩家注册渠道ID
                 		IF(a.agent_id = 0, '自然量', c.agent_name) as agent_name,-- 注册渠道名
                 		b.game_id , -- 玩家注册游戏ID
@@ -393,8 +398,8 @@ public class AdsOrderDetailService implements IAdsOrderDetailService {
                 		g.classify , -- 玩家注册游戏类型
                 		a.cp_id , -- CPID
                 		e.cp_name ,-- cp名
-                		c.pitcher_id as zx_pitcher_id, -- 投手ID
-                		d.zx_pitcher_name , -- 投手名
+                		IFNULL(c.pitcher_id, 0) as zx_pitcher_id, -- 投手ID
+                  		IFNULL(d.zx_pitcher_name, '自然量') as zx_pitcher_name, -- 投手名
                 		a.game_id as order_game_id, -- 玩家充值游戏ID
                 		f.game_name as order_game_name,-- 玩家充值游戏名
                 		f.classify as order_game_classify,-- 玩家充值游戏类型
@@ -465,6 +470,7 @@ public class AdsOrderDetailService implements IAdsOrderDetailService {
                 		b.username , -- 玩家账号
                 		b.nickname , -- 玩家昵称
                 		b.create_time as reg_time, -- 玩家注册时间
+                		c.account_id , -- 广告账号
                 		a.agent_id , -- 玩家注册渠道ID
                 		IF(a.agent_id = 0, '自然量', c.agent_name) as agent_name,-- 注册渠道名
                 		b.game_id , -- 玩家注册游戏ID
@@ -472,8 +478,8 @@ public class AdsOrderDetailService implements IAdsOrderDetailService {
                 		g.classify , -- 玩家注册游戏类型
                 		a.cp_id , -- CPID
                 		e.cp_name ,-- cp名
-                		c.pitcher_id as zx_pitcher_id, -- 投手ID
-                		d.zx_pitcher_name , -- 投手名
+                		IFNULL(c.pitcher_id, 0) as zx_pitcher_id, -- 投手ID
+                  		IFNULL(d.zx_pitcher_name, '自然量') as zx_pitcher_name, -- 投手名
                 		a.game_id as order_game_id, -- 玩家充值游戏ID
                 		f.game_name as order_game_name,-- 玩家充值游戏名
                 		f.classify as order_game_classify,-- 玩家充值游戏类型

+ 22 - 11
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/GameDataServiceImpl.java

@@ -195,7 +195,8 @@ public class GameDataServiceImpl implements IGameDataService {
      */
     @Override
     public Page<GameDataDayVO> getGameDataDay(GameDataDayDTO dto) {
-        List<Long> gameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(dto.getGameId());
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
 
         //默认查询 total 总量数据
         if (StringUtils.isBlank(dto.getTableTypes())) {
@@ -263,7 +264,8 @@ public class GameDataServiceImpl implements IGameDataService {
      * @return 返回给前端的总计数据实体
      */
     public GameDataDayTotalVO getGameDataDayTotal(GameDataDayTotalDTO dto) {
-        List<Long> gameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(dto.getGameId());
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
 
         //默认查询 total 总量数据
         if (StringUtils.isBlank(dto.getTableTypes())) {
@@ -314,7 +316,8 @@ public class GameDataServiceImpl implements IGameDataService {
      */
     @Override
     public Page<GameDataTotalVO> getGameDataTotal(GameDataTotalDTO dto) {
-        List<Long> gameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(dto.getGameId());
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
         //如果注册时间参数为空,默认设置查询当天数据
         if (dto.getRegisteredBeginDate() == null || dto.getRegisteredEndDate() == null) {
             dto.setRegisteredBeginDate(LocalDate.now());
@@ -435,7 +438,8 @@ public class GameDataServiceImpl implements IGameDataService {
      * @return 返回给前端额数据
      */
     public GameDataTotalTotalVO getGameDataTotalTotal(GameDataTotalTotalDTO dto) {
-        List<Long> gameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(dto.getGameId());
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
         //如果注册时间参数为空,默认设置查询当天数据
         if (dto.getRegisteredBeginDate() == null || dto.getRegisteredEndDate() == null) {
             dto.setRegisteredBeginDate(LocalDate.now());
@@ -654,7 +658,8 @@ public class GameDataServiceImpl implements IGameDataService {
      */
     @Override
     public Page<GameDataWaterVO> getGameDataWater(GameDataWaterDTO dto) {
-        List<Long> userGameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(dto.getGameId());
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> userGameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
         if (null == dto.getRechargeDate()) {
             dto.setRechargeDate(LocalDate.now());
         }
@@ -762,7 +767,8 @@ public class GameDataServiceImpl implements IGameDataService {
      */
     @Override
     public Map<LocalDate, List<GameDataAgainDayVO>> getGameDataAgainDay(GameDataAgainDayDTO dto) {
-        List<Long> userGameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(dto.getGameId());
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> userGameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
 
         //如果查询时间不传递默认从今天开始查询
         if (dto.getBeginDate() == null) {
@@ -2832,7 +2838,8 @@ public class GameDataServiceImpl implements IGameDataService {
 
     @Override
     public Page<GameDataH5VO> getH5Recharge(GameDataH5DTO dto) {
-        List<Long> gameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(dto.getGameId());
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
         if (null == dto.getCostBeginDate() || null == dto.getCostEndDate()) {
             dto.setCostEndDate(LocalDate.now());
             dto.setCostBeginDate(LocalDate.now());
@@ -2991,7 +2998,8 @@ public class GameDataServiceImpl implements IGameDataService {
      */
     @Override
     public Page<LtvDataVO> getLtvData(LtvDataDTO dto) {
-        List<Long> userGameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(dto.getGameId());
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> userGameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
         if (dto.getRegisteredBeginDate() == null || dto.getRegisteredEndDate() == null) {
             //查询时间不传递默认传递当天
             dto.setRegisteredBeginDate(LocalDate.now());
@@ -3057,7 +3065,8 @@ public class GameDataServiceImpl implements IGameDataService {
      */
     @Override
     public LtvDataTotalVO getLtvTotalData(LtvDataTotalDTO dto) {
-        List<Long> userGameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(dto.getGameId());
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> userGameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
         //如果没有传入查询时间默认查询当天
         if (dto.getRegisteredBeginDate() == null || dto.getRegisteredEndDate() == null) {
             dto.setRegisteredBeginDate(LocalDate.now());
@@ -3118,7 +3127,8 @@ public class GameDataServiceImpl implements IGameDataService {
      */
     @Override
     public Page<GameDataFirstNewUserAgainVO> getFirstNewUserAgain(GameDataFirstNewUserAgainDTO dto) {
-        List<Long> userGameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(dto.getGameId());
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> userGameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
         if (dto.getRegisteredBeginDate() == null || dto.getRegisteredEndDate() == null) {
             //查询时间不传递默认传递当天
             dto.setRegisteredBeginDate(LocalDate.now());
@@ -3202,7 +3212,8 @@ public class GameDataServiceImpl implements IGameDataService {
      */
     @Override
     public GameDataFirstNewUserAgainTotalVO getFirstNewUserAgainTotal(GameDataFirstNewUserAgainTotalDTO dto) {
-        List<Long> userGameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(dto.getGameId());
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> userGameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
         //如果没有传入查询时间默认查询当天
         if (dto.getRegisteredBeginDate() == null || dto.getRegisteredEndDate() == null) {
             dto.setRegisteredBeginDate(LocalDate.now());

+ 505 - 30
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/GameServerServiceImpl.java

@@ -128,7 +128,8 @@ public class GameServerServiceImpl implements IGameServerService {
      */
     @Override
     public Page<GameServerDayVO> getGameServerDataDay(GameServerDayDTO dto) {
-        List<Long> gameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(dto.getGameId());
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
 
         //创建查询条件
         Criteria cri = Cnd.cri();
@@ -192,7 +193,12 @@ public class GameServerServiceImpl implements IGameServerService {
      */
     @Override
     public GameServerDayTotalVO getGameServerDataDayTotal(GameServerDayTotalDTO dto) {
-        List<Long> gameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(dto.getGameId());
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
+        //默认查询注册留存数据
+        if (StringUtils.isBlank(dto.getActiveTypes())) {
+            dto.setActiveTypes("reg");
+        }
         //创建查询条件
         Criteria cri = Cnd.cri();
         if (gameIds != null) {
@@ -216,7 +222,7 @@ public class GameServerServiceImpl implements IGameServerService {
             cri.where().andEquals("source_system", dto.getSourceSystem());
         }
         //创建sql语句查询数据
-        Sql sql = Sqls.create(gameServerDayTotalSql() + cri);
+        Sql sql = Sqls.create(gameServerDayTotalSql(dto.getActiveTypes()) + cri);
         //设置自定义回传对象
         sql.setCallback(Sqls.callback.entity());
         sql.setEntity(dao.getEntity(GameServerDayTotalVO.class));
@@ -225,7 +231,7 @@ public class GameServerServiceImpl implements IGameServerService {
         //得到查询的结果
         GameServerDayTotalVO vo = sql.getObject(GameServerDayTotalVO.class);
         if (StringUtils.isNotBlank(vo.getDa1())) {
-            formatTotalDayN(vo);
+            formatTotalDayN(vo, dto.getActiveTypes());
         }
         //返回结果
         return vo;
@@ -252,6 +258,18 @@ public class GameServerServiceImpl implements IGameServerService {
                         .rollServerAmountNum(Long.parseLong(temps[6]))
                         .rollServerAmount(new BigDecimal(temps[7]))
                         .rollServerAmountRate(new BigDecimal(temps[8]))
+                        .regActiveNum(Long.parseLong(temps[9]))
+                        .regActiveRate(new BigDecimal(temps[10]))
+                        .newUserAmountNum(Long.parseLong(temps[11]))
+                        .oldActiveUserNum(Long.parseLong(temps[12]))
+                        .newUserTotalAmountNum(Long.parseLong(temps[13]))
+                        .newActiveUserTotalNum(Long.parseLong(temps[14]))
+                        .amountActiveRate(new BigDecimal(temps[15]))
+                        .roleNewUserNum(Long.parseLong(temps[16]))
+                        .roleOldActiveUserNum(Long.parseLong(temps[17]))
+                        .roleNewUserTotalNum(Long.parseLong(temps[18]))
+                        .roleNewActiveUserTotalNum(Long.parseLong(temps[19]))
+                        .roleActiveRate(new BigDecimal(temps[20]))
                         .build()
                 );
             } catch (IllegalAccessException e) {
@@ -264,32 +282,99 @@ public class GameServerServiceImpl implements IGameServerService {
     /**
      * 将vo中的原始String数据修改为一个对象
      * @param vo 展示给前端的游戏区服数据总计
+     * @param activeType 查询的留存类型 reg -> 注册留存 ; role -> 角色留存 ; amount -> 付费留存
      */
-    private void formatTotalDayN(GameServerDayTotalVO vo) {
+    private void formatTotalDayN(GameServerDayTotalVO vo, String activeType) {
         if (CollectionUtils.isEmpty(dayNTotalFieldMapList)) {
             return;
         }
         dayNTotalFieldMapList.forEach(dayNTotalFieldMap -> {
             try {
+                /*注册人数0/创角人数1/活跃人数2/付费人数3/付费金额4/滚服人数5/滚服付费人数6/滚服付费金额7/ (游戏区服数据)*/
                 String[] temps = ((String) dayNTotalFieldMap.getT1().get(vo)).split("/");
                 //付费金额
                 BigDecimal amount = new BigDecimal(temps[4]);
                 //滚服付费金额
                 BigDecimal rollServerAmount = new BigDecimal(temps[7]);
-                //设置trend对象
-                dayNTotalFieldMap.getT2().set(vo, GameServerTrendVO.builder()
-                        .regNum(Long.parseLong(temps[0]))
-                        .roleNum(Long.parseLong(temps[1]))
-                        .activeNum(Long.parseLong(temps[2]))
-                        .amountNum(Long.parseLong(temps[3]))
-                        .amount(amount)
-                        .rollServerNum(Long.parseLong(temps[5]))
-                        .rollServerAmountNum(Long.parseLong(temps[6]))
-                        .rollServerAmount(rollServerAmount)
-                        .rollServerAmountRate(amount.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
-                                rollServerAmount.divide(amount, 4, RoundingMode.HALF_UP))
-                        .build()
-                );
+                //不同留存数据
+                if ("reg".equals(activeType)) {
+                    //注册留存
+                    /* DayN活跃人数8/ (注册留存数据)/ 注册人数9(去除时间未到的数据)*/
+                    //活跃人数(注册留存数据)
+                    Long regActiveNum = Long.valueOf(temps[8]);
+                    //注册人数(注册留存数据)
+                    Long regNum = Long.valueOf(temps[9]);
+                    //设置trend对象
+                    dayNTotalFieldMap.getT2().set(vo, GameServerTrendVO.builder()
+                            .regNum(Long.parseLong(temps[0]))
+                            .roleNum(Long.parseLong(temps[1]))
+                            .activeNum(Long.parseLong(temps[2]))
+                            .amountNum(Long.parseLong(temps[3]))
+                            .amount(amount)
+                            .rollServerNum(Long.parseLong(temps[5]))
+                            .rollServerAmountNum(Long.parseLong(temps[6]))
+                            .rollServerAmount(rollServerAmount)
+                            .rollServerAmountRate(amount.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
+                                    rollServerAmount.divide(amount, 4, RoundingMode.HALF_UP))
+                            .regActiveNum(regActiveNum)
+                            .regActiveRate(regNum == 0L ? BigDecimal.ZERO :
+                                    BigDecimal.valueOf(regActiveNum.doubleValue() / regNum.doubleValue()).setScale(4, RoundingMode.HALF_UP))
+                            .build());
+                } else if ("amount".equals(activeType)) {
+                    //付费留存
+                    /* 第N天的新增付费用户8/第N天的老活跃用户9/第N天的累计付费用户10/第N天的累计活跃用户11/(付费留存数据)*/
+                    //累计到第N天的付费人数(付费留存数据)
+                    Long amountTotalNum = Long.parseLong(temps[10]);
+                    //累计到第N天的活跃人数(付费留存数据)
+                    Long amountActiveTotalNum = Long.valueOf(temps[11]);
+                    //设置trend对象
+                    dayNTotalFieldMap.getT2().set(vo, GameServerTrendVO.builder()
+                            .regNum(Long.parseLong(temps[0]))
+                            .roleNum(Long.parseLong(temps[1]))
+                            .activeNum(Long.parseLong(temps[2]))
+                            .amountNum(Long.parseLong(temps[3]))
+                            .amount(amount)
+                            .rollServerNum(Long.parseLong(temps[5]))
+                            .rollServerAmountNum(Long.parseLong(temps[6]))
+                            .rollServerAmount(rollServerAmount)
+                            .rollServerAmountRate(amount.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
+                                    rollServerAmount.divide(amount, 4, RoundingMode.HALF_UP))
+                            .newUserAmountNum(Long.parseLong(temps[8]))
+                            .oldActiveUserNum(Long.valueOf(temps[9]))
+                            .newUserTotalAmountNum(amountTotalNum)
+                            .newActiveUserTotalNum(amountActiveTotalNum)
+                            .amountActiveRate(amountTotalNum == 0L ? BigDecimal.ZERO :
+                                    BigDecimal.valueOf(amountActiveTotalNum.doubleValue() / amountTotalNum.doubleValue())
+                                            .setScale(4, RoundingMode.HALF_UP))
+                            .build());
+                } else {
+                    /* 第N天的新增创角用户8/第N天的老活跃用户9/第N天的累计创角用户10/第N天的累计活跃用户11/(创角留存数据)*/
+                    //创角留存
+                    //累计到第N天的创角用户数
+                    Long roleActiveTotalNum = Long.valueOf(temps[10]);
+                    //累计到第N天的活跃人数(活跃人数)
+                    Long roleActiveUserNum = Long.valueOf(temps[11]);
+                    //设置trend对象
+                    dayNTotalFieldMap.getT2().set(vo, GameServerTrendVO.builder()
+                            .regNum(Long.parseLong(temps[0]))
+                            .roleNum(Long.parseLong(temps[1]))
+                            .activeNum(Long.parseLong(temps[2]))
+                            .amountNum(Long.parseLong(temps[3]))
+                            .amount(amount)
+                            .rollServerNum(Long.parseLong(temps[5]))
+                            .rollServerAmountNum(Long.parseLong(temps[6]))
+                            .rollServerAmount(rollServerAmount)
+                            .rollServerAmountRate(amount.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
+                                    rollServerAmount.divide(amount, 4, RoundingMode.HALF_UP))
+                            .roleNewUserNum(Long.valueOf(temps[8]))
+                            .roleOldActiveUserNum(Long.valueOf(temps[9]))
+                            .roleNewUserTotalNum(roleActiveTotalNum)
+                            .roleNewActiveUserTotalNum(roleActiveUserNum)
+                            .roleActiveRate(roleActiveTotalNum == 0L ? BigDecimal.ZERO :
+                                    BigDecimal.valueOf(roleActiveUserNum.doubleValue() / roleActiveTotalNum.doubleValue())
+                                            .setScale(4, RoundingMode.HALF_UP))
+                            .build());
+                }
             } catch (IllegalAccessException e) {
                 e.printStackTrace();
             }
@@ -299,7 +384,10 @@ public class GameServerServiceImpl implements IGameServerService {
 
     /**
      * 计算总计一栏的daN数据
-     * @return String
+     * 注册人数/创角人数/活跃人数/付费人数/付费金额/滚服人数/滚服付费人数/滚服付费金额/ (游戏区服数据)
+     * DayN活跃人数/ (注册留存数据)/ 注册人数(去除时间未到的数据)
+     * 第N天的新增付费用户/第N天的老活跃用户/第N天的累计付费用户/第N天的累计活跃用户/ (付费留存数据)
+     * 第N天的新增创角用户/第N天的老活跃用户/第N天的累计创角用户/第N天的累计活跃用户/ (创角留存数据)
      */
     private String trendDay() {
         StringBuilder daySql = new StringBuilder(StringUtils.EMPTY);
@@ -314,9 +402,15 @@ public class GameServerServiceImpl implements IGameServerService {
                     	SUM(SPLIT_PART(da%s, '/', 5)), '/',
                     	SUM(SPLIT_PART(da%s, '/', 6)), '/',
                     	SUM(SPLIT_PART(da%s, '/', 7)), '/',
-                    	SUM(SPLIT_PART(da%s, '/', 8))
+                    	SUM(SPLIT_PART(da%s, '/', 8)), '/',
+                    	SUM(SPLIT_PART(da%s, '/', 10)), '/',
+                        SUM(IF(DATE_ADD(dt, INTERVAL %s day) <= Local.now(), total_reg_num, 0)), '/',
+                        SUM(SPLIT_PART(da%s, '/', 12)), '/',
+                        SUM(SPLIT_PART(da%s, '/', 13)), '/',
+                        SUM(IF(DATE_ADD(dt, INTERVAL %s day) <= Local.now(), SPLIT_PART(da%s, '/', 14), 0)), '/',
+                        SUM(IF(DATE_ADD(dt, INTERVAL %s day) <= Local.now(), SPLIT_PART(da%s, '/', 15), 0))
                     ) as da%s ,
-                    """.formatted(i, i, i, i, i, i, i, i, i));
+                    """.formatted(i, i, i, i, i, i, i, i, i, i-1,i ,i, i-1, i, i-1, i, i ));
         }
         //拼接m4-m12 sql
         for (int i = 4; i <= 12; i++) {
@@ -329,9 +423,15 @@ public class GameServerServiceImpl implements IGameServerService {
                     	SUM(SPLIT_PART(m%s, '/', 5)), '/',
                     	SUM(SPLIT_PART(m%s, '/', 6)), '/',
                     	SUM(SPLIT_PART(m%s, '/', 7)), '/',
-                    	SUM(SPLIT_PART(m%s, '/', 8))
+                    	SUM(SPLIT_PART(m%s, '/', 8)), '/',
+                    	SUM(SPLIT_PART(m%s, '/', 10)), '/',
+                        SUM(IF(DATE_ADD(dt, INTERVAL %s month) <= Local.now(), total_reg_num, 0)), '/',
+                        SUM(SPLIT_PART(m%s, '/', 12)), '/',
+                        SUM(SPLIT_PART(m%s, '/', 13)), '/',
+                        SUM(IF(DATE_ADD(dt, INTERVAL %s month) <= Local.now(), SPLIT_PART(m%s, '/', 14), 0)), '/',
+                        SUM(IF(DATE_ADD(dt, INTERVAL %s month) <= Local.now(), SPLIT_PART(m%s, '/', 15), 0))
                     ) as m%s ,
-                    """.formatted(i, i, i, i, i, i, i, i, i));
+                    """.formatted(i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i));
         }
         //拼接total
         daySql.append("""
@@ -343,13 +443,268 @@ public class GameServerServiceImpl implements IGameServerService {
                     	SUM(SPLIT_PART(total, '/', 5)), '/',
                     	SUM(SPLIT_PART(total, '/', 6)), '/',
                     	SUM(SPLIT_PART(total, '/', 7)), '/',
-                    	SUM(SPLIT_PART(total, '/', 8))
+                    	SUM(SPLIT_PART(total, '/', 8)), '/',
+                    	SUM(SPLIT_PART(total, '/', 10)), '/',
+                        SUM(total_reg_num), '/',
+                        SUM(SPLIT_PART(total, '/', 12)), '/',
+                        SUM(SPLIT_PART(total, '/', 13)), '/',
+                        SUM(SPLIT_PART(total, '/', 14)), '/',
+                        SUM(SPLIT_PART(total, '/', 15))
+                    ) as total
+                    """);
+
+        return daySql.toString();
+    }
+
+    private String trendDayDemo1() {
+        StringBuilder daySql = new StringBuilder(StringUtils.EMPTY);
+        //拼接da1-da90 sql
+        for (int i = 1; i <= 90; i++) {
+            daySql.append("""
+                    CONCAT(
+                    	SUM(da%s[1]), '/',
+                    	SUM(da%s[2]), '/',
+                    	SUM(da%s[3]), '/',
+                    	SUM(da%s[4]), '/',
+                    	SUM(da%s[5]), '/',
+                    	SUM(da%s[6]), '/',
+                    	SUM(da%s[7]), '/',
+                    	SUM(da%s[8]), '/',
+                    	SUM(da%s[10]), '/',
+                        SUM(IF(DATE_ADD(dt, INTERVAL %s day) <= Local.now(), total_reg_num, 0)), '/',
+                        SUM(da%s[12]), '/',
+                        SUM(da%s[13]), '/',
+                        SUM(IF(DATE_ADD(dt, INTERVAL %s day) <= Local.now(), da%s[14], 0)), '/',
+                        SUM(IF(DATE_ADD(dt, INTERVAL %s day) <= Local.now(), da%s[15], 0))
+                    ) as da%s ,
+                    """.formatted(i, i, i, i, i, i, i, i, i, i-1,i ,i, i-1, i, i-1, i, i ));
+        }
+        //拼接m4-m12 sql
+        for (int i = 4; i <= 12; i++) {
+            daySql.append("""
+                    CONCAT(
+                    	SUM(m%s[1]), '/',
+                    	SUM(m%s[2]), '/',
+                    	SUM(m%s[3]), '/',
+                    	SUM(m%s[4]), '/',
+                    	SUM(m%s[5]), '/',
+                    	SUM(m%s[6]), '/',
+                    	SUM(m%s[7]), '/',
+                    	SUM(m%s[8]), '/',
+                    	SUM(m%s[10]), '/',
+                        SUM(IF(DATE_ADD(dt, INTERVAL %s month) <= Local.now(), total_reg_num, 0)), '/',
+                        SUM(m%s[12]), '/',
+                        SUM(m%s[13]), '/',
+                        SUM(IF(DATE_ADD(dt, INTERVAL %s month) <= Local.now(), m%s[14], 0)), '/',
+                        SUM(IF(DATE_ADD(dt, INTERVAL %s month) <= Local.now(), m%s[15], 0))
+                    ) as m%s ,
+                    """.formatted(i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i));
+        }
+        //拼接total
+        daySql.append("""
+                    CONCAT(
+                    	SUM(total[1]), '/',
+                    	SUM(total[2]), '/',
+                    	SUM(total[3]), '/',
+                    	SUM(total[4]), '/',
+                    	SUM(total[5]), '/',
+                    	SUM(total[6]), '/',
+                    	SUM(total[7]), '/',
+                    	SUM(total[8]), '/',
+                    	SUM(total[10]), '/',
+                        SUM(total_reg_num), '/',
+                        SUM(total[12]), '/',
+                        SUM(total[13]), '/',
+                        SUM(total[14]), '/',
+                        SUM(total[15])
                     ) as total
                     """);
 
         return daySql.toString();
     }
 
+    /**
+     * 计算总计一栏的daN数据
+     * 注册人数/创角人数/活跃人数/付费人数/付费金额/滚服人数/滚服付费人数/滚服付费金额/ (游戏区服数据)
+     * DayN活跃人数/ (注册留存数据)/ 注册人数(去除时间未到的数据)
+     * 第N天的新增付费用户/第N天的老活跃用户/第N天的累计付费用户/第N天的累计活跃用户/ (付费留存数据)
+     * 第N天的新增创角用户/第N天的老活跃用户/第N天的累计创角用户/第N天的累计活跃用户/ (创角留存数据)
+     * @param activeType reg -> 注册留存 ; role -> 角色留存 ; amount -> 付费留存
+     *
+     * @return String
+     */
+    private String trendDayDemo2(String activeType) {
+        StringBuilder daySql = new StringBuilder(StringUtils.EMPTY);
+        //注册留存数据
+        if ("reg".equals(activeType)) {
+            //拼接da1-da90 sql
+            for (int i = 1; i <= 90; i++) {
+                daySql.append("""
+                    CONCAT(
+                    	SUM(da%s[1]), '/',
+                    	SUM(da%s[2]), '/',
+                    	SUM(da%s[3]), '/',
+                    	SUM(da%s[4]), '/',
+                    	SUM(da%s[5]), '/',
+                    	SUM(da%s[6]), '/',
+                    	SUM(da%s[7]), '/',
+                    	SUM(da%s[8]), '/',
+                    	SUM(da%s[10]), '/',
+                        SUM(IF(DATE_ADD(dt, INTERVAL %s day) <= Local.now(), total_reg_num, 0))
+                    ) as da%s ,
+                    """.formatted(i, i, i, i, i, i, i, i, i, i-1, i));
+            }
+            //拼接m4-m12 sql
+            for (int i = 4; i <= 12; i++) {
+                daySql.append("""
+                    CONCAT(
+                    	SUM(m%s[1]), '/',
+                    	SUM(m%s[2]), '/',
+                    	SUM(m%s[3]), '/',
+                    	SUM(m%s[4]), '/',
+                    	SUM(m%s[5]), '/',
+                    	SUM(m%s[6]), '/',
+                    	SUM(m%s[7]), '/',
+                    	SUM(m%s[8]), '/',
+                    	SUM(m%s[10]), '/',
+                        SUM(IF(DATE_ADD(dt, INTERVAL %s month) <= Local.now(), total_reg_num, 0))
+                    ) as m%s ,
+                    """.formatted(i, i, i, i, i, i, i, i, i, i, i));
+            }
+            //拼接total
+            daySql.append("""
+                    CONCAT(
+                    	SUM(total[1]), '/',
+                    	SUM(total[2]), '/',
+                    	SUM(total[3]), '/',
+                    	SUM(total[4]), '/',
+                    	SUM(total[5]), '/',
+                    	SUM(total[6]), '/',
+                    	SUM(total[7]), '/',
+                    	SUM(total[8]), '/',
+                    	SUM(total[10]), '/',
+                        SUM(total_reg_num)
+                    ) as total
+                    """);
+        } else if ("amount".equals(activeType)) {
+            //付费留存数据
+            //拼接da1-da90 sql
+            for (int i = 1; i <= 90; i++) {
+                daySql.append("""
+                    CONCAT(
+                    	SUM(da%s[1]), '/',
+                    	SUM(da%s[2]), '/',
+                    	SUM(da%s[3]), '/',
+                    	SUM(da%s[4]), '/',
+                    	SUM(da%s[5]), '/',
+                    	SUM(da%s[6]), '/',
+                    	SUM(da%s[7]), '/',
+                    	SUM(da%s[8]), '/',
+                        SUM(da%s[12]), '/',
+                        SUM(da%s[13]), '/',
+                        SUM(IF(DATE_ADD(dt, INTERVAL %s day) <= Local.now(), da%s[14], 0)), '/',
+                        SUM(IF(DATE_ADD(dt, INTERVAL %s day) <= Local.now(), da%s[15], 0))
+                    ) as da%s ,
+                    """.formatted(i, i, i, i, i, i, i, i, i ,i, i-1, i, i-1, i, i ));
+            }
+            //拼接m4-m12 sql
+            for (int i = 4; i <= 12; i++) {
+                daySql.append("""
+                    CONCAT(
+                    	SUM(m%s[1]), '/',
+                    	SUM(m%s[2]), '/',
+                    	SUM(m%s[3]), '/',
+                    	SUM(m%s[4]), '/',
+                    	SUM(m%s[5]), '/',
+                    	SUM(m%s[6]), '/',
+                    	SUM(m%s[7]), '/',
+                    	SUM(m%s[8]), '/',
+                        SUM(m%s[12]), '/',
+                        SUM(m%s[13]), '/',
+                        SUM(IF(DATE_ADD(dt, INTERVAL %s month) <= Local.now(), m%s[14], 0)), '/',
+                        SUM(IF(DATE_ADD(dt, INTERVAL %s month) <= Local.now(), m%s[15], 0))
+                    ) as m%s ,
+                    """.formatted(i, i, i, i, i, i, i, i, i, i, i, i, i, i, i));
+            }
+            //拼接total
+            daySql.append("""
+                    CONCAT(
+                    	SUM(total[1]), '/',
+                    	SUM(total[2]), '/',
+                    	SUM(total[3]), '/',
+                    	SUM(total[4]), '/',
+                    	SUM(total[5]), '/',
+                    	SUM(total[6]), '/',
+                    	SUM(total[7]), '/',
+                    	SUM(total[8]), '/',
+                        SUM(total[12]), '/',
+                        SUM(total[13]), '/',
+                        SUM(total[14]), '/',
+                        SUM(total[15])
+                    ) as total
+                    """);
+        } else {
+            //创角留存数据
+            //拼接da1-da90 sql
+            for (int i = 1; i <= 90; i++) {
+                daySql.append("""
+                    CONCAT(
+                    	SUM(da%s[1]), '/',
+                    	SUM(da%s[2]), '/',
+                    	SUM(da%s[3]), '/',
+                    	SUM(da%s[4]), '/',
+                    	SUM(da%s[5]), '/',
+                    	SUM(da%s[6]), '/',
+                    	SUM(da%s[7]), '/',
+                    	SUM(da%s[8]), '/',
+                        SUM(da%s[17]), '/',
+                        SUM(da%s[18]), '/',
+                        SUM(IF(DATE_ADD(dt, INTERVAL %s day) <= Local.now(), da%s[19], 0)), '/',
+                        SUM(IF(DATE_ADD(dt, INTERVAL %s day) <= Local.now(), da%s[20], 0))
+                    ) as da%s ,
+                    """.formatted(i, i, i, i, i, i, i, i, i ,i, i-1, i, i-1, i, i ));
+            }
+            //拼接m4-m12 sql
+            for (int i = 4; i <= 12; i++) {
+                daySql.append("""
+                    CONCAT(
+                    	SUM(m%s[1]), '/',
+                    	SUM(m%s[2]), '/',
+                    	SUM(m%s[3]), '/',
+                    	SUM(m%s[4]), '/',
+                    	SUM(m%s[5]), '/',
+                    	SUM(m%s[6]), '/',
+                    	SUM(m%s[7]), '/',
+                    	SUM(m%s[8]), '/',
+                        SUM(m%s[17]), '/',
+                        SUM(m%s[18]), '/',
+                        SUM(IF(DATE_ADD(dt, INTERVAL %s month) <= Local.now(), m%s[19], 0)), '/',
+                        SUM(IF(DATE_ADD(dt, INTERVAL %s month) <= Local.now(), m%s[20], 0))
+                    ) as m%s ,
+                    """.formatted(i, i, i, i, i, i, i, i, i, i, i, i, i, i, i));
+            }
+            //拼接total
+            daySql.append("""
+                    CONCAT(
+                    	SUM(total[1]), '/',
+                    	SUM(total[2]), '/',
+                    	SUM(total[3]), '/',
+                    	SUM(total[4]), '/',
+                    	SUM(total[5]), '/',
+                    	SUM(total[6]), '/',
+                    	SUM(total[7]), '/',
+                    	SUM(total[8]), '/',
+                        SUM(total[17]), '/',
+                        SUM(total[18]), '/',
+                        SUM(total[19]), '/',
+                        SUM(total[20])
+                    ) as total
+                    """);
+        }
+
+        return daySql.toString();
+    }
+
     /**
      * 游戏区服数据SQL
      * @return String
@@ -479,9 +834,11 @@ public class GameServerServiceImpl implements IGameServerService {
 
     /**
      * 游戏区服数据总计SQL
+     * @param activeType 查询的留存类型 reg -> 注册留存 ; role -> 角色留存 ; amount -> 付费留存
+     *
      * @return String
      */
-    private String gameServerDayTotalSql() {
+    private String gameServerDayTotalSql(String activeType) {
         return """
                 SELECT
                     IFNULL(SUM(out_total_num), 0) as out_total_num,
@@ -492,11 +849,129 @@ public class GameServerServiceImpl implements IGameServerService {
                     IFNULL(SUM(total_reg_num), 0) as total_reg_num,
                     IFNULL(SUM(total_amount_num), 0) as total_amount_num,
                     IFNULL(SUM(total_amount), 0) as total_amount,
-                """ + trendDay() +
+                """ + trendDayDemo2(activeType) +
                 """
-                FROM
-                    game_ads.ads_game_server_day
-                """;
+                FROM (
+                    SELECT
+                        dt,
+                        source_system,
+                        server_id,
+                        server_name,
+                        game_id,
+                        game_name,
+                        classify,
+                        out_total_num,
+                        out_total_amount_num,
+                        out_total_amount,
+                        out_total_rate,
+                        total_role_num,
+                        total_reg_num,
+                        total_amount_num,
+                        total_amount,
+                        SPLIT(da1, '/') as da1,
+                        SPLIT(da2, '/') as da2,
+                        SPLIT(da3, '/') as da3,
+                        SPLIT(da4, '/') as da4,
+                        SPLIT(da5, '/') as da5,
+                        SPLIT(da6, '/') as da6,
+                        SPLIT(da7, '/') as da7,
+                        SPLIT(da8, '/') as da8,
+                        SPLIT(da9, '/') as da9,
+                        SPLIT(da10, '/') as da10,
+                        SPLIT(da11, '/') as da11,
+                        SPLIT(da12, '/') as da12,
+                        SPLIT(da13, '/') as da13,
+                        SPLIT(da14, '/') as da14,
+                        SPLIT(da15, '/') as da15,
+                        SPLIT(da16, '/') as da16,
+                        SPLIT(da17, '/') as da17,
+                        SPLIT(da18, '/') as da18,
+                        SPLIT(da19, '/') as da19,
+                        SPLIT(da20, '/') as da20,
+                        SPLIT(da21, '/') as da21,
+                        SPLIT(da22, '/') as da22,
+                        SPLIT(da23, '/') as da23,
+                        SPLIT(da24, '/') as da24,
+                        SPLIT(da25, '/') as da25,
+                        SPLIT(da26, '/') as da26,
+                        SPLIT(da27, '/') as da27,
+                        SPLIT(da28, '/') as da28,
+                        SPLIT(da29, '/') as da29,
+                        SPLIT(da30, '/') as da30,
+                        SPLIT(da31, '/') as da31,
+                        SPLIT(da32, '/') as da32,
+                        SPLIT(da33, '/') as da33,
+                        SPLIT(da34, '/') as da34,
+                        SPLIT(da35, '/') as da35,
+                        SPLIT(da36, '/') as da36,
+                        SPLIT(da37, '/') as da37,
+                        SPLIT(da38, '/') as da38,
+                        SPLIT(da39, '/') as da39,
+                        SPLIT(da40, '/') as da40,
+                        SPLIT(da41, '/') as da41,
+                        SPLIT(da42, '/') as da42,
+                        SPLIT(da43, '/') as da43,
+                        SPLIT(da44, '/') as da44,
+                        SPLIT(da45, '/') as da45,
+                        SPLIT(da46, '/') as da46,
+                        SPLIT(da47, '/') as da47,
+                        SPLIT(da48, '/') as da48,
+                        SPLIT(da49, '/') as da49,
+                        SPLIT(da50, '/') as da50,
+                        SPLIT(da51, '/') as da51,
+                        SPLIT(da52, '/') as da52,
+                        SPLIT(da53, '/') as da53,
+                        SPLIT(da54, '/') as da54,
+                        SPLIT(da55, '/') as da55,
+                        SPLIT(da56, '/') as da56,
+                        SPLIT(da57, '/') as da57,
+                        SPLIT(da58, '/') as da58,
+                        SPLIT(da59, '/') as da59,
+                        SPLIT(da60, '/') as da60,
+                        SPLIT(da61, '/') as da61,
+                        SPLIT(da62, '/') as da62,
+                        SPLIT(da63, '/') as da63,
+                        SPLIT(da64, '/') as da64,
+                        SPLIT(da65, '/') as da65,
+                        SPLIT(da66, '/') as da66,
+                        SPLIT(da67, '/') as da67,
+                        SPLIT(da68, '/') as da68,
+                        SPLIT(da69, '/') as da69,
+                        SPLIT(da70, '/') as da70,
+                        SPLIT(da71, '/') as da71,
+                        SPLIT(da72, '/') as da72,
+                        SPLIT(da73, '/') as da73,
+                        SPLIT(da74, '/') as da74,
+                        SPLIT(da75, '/') as da75,
+                        SPLIT(da76, '/') as da76,
+                        SPLIT(da77, '/') as da77,
+                        SPLIT(da78, '/') as da78,
+                        SPLIT(da79, '/') as da79,
+                        SPLIT(da80, '/') as da80,
+                        SPLIT(da81, '/') as da81,
+                        SPLIT(da82, '/') as da82,
+                        SPLIT(da83, '/') as da83,
+                        SPLIT(da84, '/') as da84,
+                        SPLIT(da85, '/') as da85,
+                        SPLIT(da86, '/') as da86,
+                        SPLIT(da87, '/') as da87,
+                        SPLIT(da88, '/') as da88,
+                        SPLIT(da89, '/') as da89,
+                        SPLIT(da90, '/') as da90,
+                        SPLIT(m4, '/') as m4,
+                        SPLIT(m5, '/') as m5,
+                        SPLIT(m6, '/') as m6,
+                        SPLIT(m7, '/') as m7,
+                        SPLIT(m8, '/') as m8,
+                        SPLIT(m9, '/') as m9,
+                        SPLIT(m10, '/') as m10,
+                        SPLIT(m11, '/') as m11,
+                        SPLIT(m12, '/') as m12,
+                        SPLIT(total, '/') as total
+                    FROM
+                        game_ads.ads_game_server_day
+                ) a
+                        """;
     }
 
 

+ 4 - 2
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/IActiveDataServiceImpl.java

@@ -126,7 +126,8 @@ public class IActiveDataServiceImpl implements IActiveDataService {
      */
     @Override
     public Page<ActiveDataDayVO> getActiveDataDay(ActiveDataDayDTO dto) {
-        List<Long> userGameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(dto.getGameId());
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> userGameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
         //默认查询总数据
         if (StringUtils.isBlank(dto.getTableTypes())) {
             dto.setTableTypes("total");
@@ -217,7 +218,8 @@ public class IActiveDataServiceImpl implements IActiveDataService {
      */
     @Override
     public ActiveDataTotalVO getActiveDataTotal(ActiveDataTotalDTO dto) {
-        List<Long> gameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(dto.getGameId());
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
         //默认查询总数据
         if (StringUtils.isBlank(dto.getTableTypes())) {
             dto.setTableTypes("total");

+ 28 - 16
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/IMediaDataServiceImpl.java

@@ -156,8 +156,9 @@ public class IMediaDataServiceImpl implements IMediaDataService {
     @Override
     public Page<PitcherGameMediaDataDayVO> getPitcherGameMediaDataDay(PitcherGameMediaDataDayDTO dto) {
         //添加权限
-        List<Long> pitcherIds = dto.getPitcherId() == null ? dataPowerComponent.getSubUserIdList() : Collections.singletonList(dto.getPitcherId());
-        List<Long> gameIds = StringUtils.isBlank(dto.getGameId()) ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(Long.parseLong(dto.getGameId()));
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> pitcherIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
+        List<Long> gameIds = StringUtils.isBlank(dto.getGameId()) ? poerInfo.second : Collections.singletonList(Long.parseLong(dto.getGameId()));
         //创建查询条件
         Criteria cri = Cnd.cri();
         if (pitcherIds != null) {
@@ -223,8 +224,9 @@ public class IMediaDataServiceImpl implements IMediaDataService {
     @Override
     public PitcherGameMediaDataDayVO getPitcherGameMediaDataDayTotal(PitcherGameMediaDataDayTotalDTO dto) {
         //添加权限
-        List<Long> pitcherIds = dto.getPitcherId() == null ? dataPowerComponent.getSubUserIdList() : Collections.singletonList(dto.getPitcherId());
-        List<Long> gameIds = StringUtils.isBlank(dto.getGameId()) ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(Long.parseLong(dto.getGameId()));
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> pitcherIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
+        List<Long> gameIds = StringUtils.isBlank(dto.getGameId()) ? poerInfo.second : Collections.singletonList(Long.parseLong(dto.getGameId()));
         //创建查询条件
         Criteria cri = Cnd.cri();
         if (pitcherIds != null) {
@@ -271,8 +273,9 @@ public class IMediaDataServiceImpl implements IMediaDataService {
     @Override
     public Page<PitcherGameMediaDataTotalVO> getPitcherGameMediaDataTotal(PitcherGameMediaDataTotalDTO dto) {
         //添加权限
-        List<Long> pitcherIds = dto.getPitcherId() == null ? dataPowerComponent.getSubUserIdList() : List.of(dto.getPitcherId());
-        List<Long> gameIds = StringUtils.isBlank(dto.getGameId()) ? dataPowerComponent.getSubGameIdList() : List.of(Long.parseLong(dto.getGameId()));
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> pitcherIds = dto.getPitcherId() == null ? poerInfo.first : List.of(dto.getPitcherId());
+        List<Long> gameIds = StringUtils.isBlank(dto.getGameId()) ? poerInfo.second : List.of(Long.parseLong(dto.getGameId()));
         //如果注册时间参数为空,默认设置查询当天数据
         if (dto.getBeginDate() == null || dto.getEndDate() == null) {
             dto.setBeginDate(LocalDate.now());
@@ -366,8 +369,9 @@ public class IMediaDataServiceImpl implements IMediaDataService {
      */
     @Override
     public PitcherGameMediaDataTotalVO getPitcherGameMediaDataTotalSum(PitcherGameMediaDataTotalSumDTO dto) {
-        List<Long> pitcherId = dto.getPitcherId() == null ? dataPowerComponent.getSubUserIdList() : Collections.singletonList(dto.getPitcherId());
-        List<Long> gameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(Long.parseLong(dto.getGameId()));
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> pitcherId = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
+        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(Long.parseLong(dto.getGameId()));
         //如果注册时间参数为空,默认设置查询当天数据
         if (dto.getBeginDate() == null || dto.getEndDate() == null) {
             dto.setBeginDate(LocalDate.now());
@@ -457,7 +461,8 @@ public class IMediaDataServiceImpl implements IMediaDataService {
     @Override
     public Page<PitcherMediaDataDayVO> getPitcherMediaDataDay(PitcherMediaDataDayDTO dto) {
         //添加权限
-        List<Long> pitcherIds = dto.getPitcherId() == null ? dataPowerComponent.getSubUserIdList() : Collections.singletonList(dto.getPitcherId());
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> pitcherIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
         //创建查询条件
         Criteria cri = Cnd.cri();
         if (pitcherIds != null) {
@@ -514,7 +519,8 @@ public class IMediaDataServiceImpl implements IMediaDataService {
     @Override
     public PitcherMediaDataDayVO getPitcherMediaDataDayTotal(PitcherMediaDataDayTotalDTO dto) {
         //添加权限
-        List<Long> pitcherIds = dto.getPitcherId() == null ? dataPowerComponent.getSubUserIdList() : Collections.singletonList(dto.getPitcherId());
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> pitcherIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
         //创建查询条件
         Criteria cri = Cnd.cri();
         if (pitcherIds != null) {
@@ -552,7 +558,8 @@ public class IMediaDataServiceImpl implements IMediaDataService {
     @Override
     public Page<PitcherMediaDataTotalVO> getPitcherMediaDataTotal(PitcherMediaDataTotalDTO dto) {
         //添加权限
-        List<Long> pitcherIds = dto.getPitcherId() == null ? dataPowerComponent.getSubUserIdList() : List.of(dto.getPitcherId());
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> pitcherIds = dto.getPitcherId() == null ? poerInfo.first : List.of(dto.getPitcherId());
         //如果注册时间参数为空,默认设置查询当天数据
         if (dto.getBeginDate() == null || dto.getEndDate() == null) {
             dto.setBeginDate(LocalDate.now());
@@ -646,7 +653,8 @@ public class IMediaDataServiceImpl implements IMediaDataService {
      */
     @Override
     public PitcherMediaDataTotalVO getPitcherMediaDataTotalSum(PitcherMediaDataTotalSumDTO dto) {
-        List<Long> pitcherId = dto.getPitcherId() == null ? dataPowerComponent.getSubUserIdList() : Collections.singletonList(dto.getPitcherId());
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> pitcherId = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
         //如果注册时间参数为空,默认设置查询当天数据
         if (dto.getBeginDate() == null || dto.getEndDate() == null) {
             dto.setBeginDate(LocalDate.now());
@@ -736,7 +744,8 @@ public class IMediaDataServiceImpl implements IMediaDataService {
     @Override
     public Page<GameMediaDataDayVO> getGameMediaDataDay(GameMediaDataDayDTO dto) {
         //添加权限
-        List<Long> gameIds = StringUtils.isBlank(dto.getGameId()) ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(Long.parseLong(dto.getGameId()));
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> gameIds = StringUtils.isBlank(dto.getGameId()) ? poerInfo.second : Collections.singletonList(Long.parseLong(dto.getGameId()));
         //创建查询条件
         Criteria cri = Cnd.cri();
         if (gameIds != null) {
@@ -799,7 +808,8 @@ public class IMediaDataServiceImpl implements IMediaDataService {
     @Override
     public GameMediaDataDayVO getGameMediaDataDayTotal(GameMediaDataDayTotalDTO dto) {
         //添加权限
-        List<Long> gameIds = StringUtils.isBlank(dto.getGameId()) ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(Long.parseLong(dto.getGameId()));
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> gameIds = StringUtils.isBlank(dto.getGameId()) ? poerInfo.second : Collections.singletonList(Long.parseLong(dto.getGameId()));
         //创建查询条件
         Criteria cri = Cnd.cri();
         if (gameIds != null) {
@@ -843,7 +853,8 @@ public class IMediaDataServiceImpl implements IMediaDataService {
     @Override
     public Page<GameMediaDataTotalVO> getGameMediaDataTotal(GameMediaDataTotalDTO dto) {
         //添加权限
-        List<Long> gameIds = StringUtils.isBlank(dto.getGameId()) ? dataPowerComponent.getSubGameIdList() : List.of(Long.parseLong(dto.getGameId()));
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> gameIds = StringUtils.isBlank(dto.getGameId()) ? poerInfo.second : List.of(Long.parseLong(dto.getGameId()));
         //如果注册时间参数为空,默认设置查询当天数据
         if (dto.getBeginDate() == null || dto.getEndDate() == null) {
             dto.setBeginDate(LocalDate.now());
@@ -937,7 +948,8 @@ public class IMediaDataServiceImpl implements IMediaDataService {
      */
     @Override
     public GameMediaDataTotalVO getGameMediaDataTotalSum(GameMediaDataTotalSumDTO dto) {
-        List<Long> gameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(Long.parseLong(dto.getGameId()));
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(Long.parseLong(dto.getGameId()));
         //如果注册时间参数为空,默认设置查询当天数据
         if (dto.getBeginDate() == null || dto.getEndDate() == null) {
             dto.setBeginDate(LocalDate.now());

+ 8 - 10
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/OverallSummaryServiceImpl.java

@@ -1,6 +1,6 @@
 package com.zanxiang.game.data.serve.service.impl;
 
-import com.zanxiang.erp.security.util.SecurityUtil;
+import com.github.sd4324530.jtuple.Tuple2;
 import com.zanxiang.game.data.serve.component.DataPowerComponent;
 import com.zanxiang.game.data.serve.pojo.dto.OverallSummaryDTO;
 import com.zanxiang.game.data.serve.pojo.vo.OverallSummaryAmountLineDataVO;
@@ -23,11 +23,7 @@ import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.time.LocalDate;
 import java.time.temporal.ChronoUnit;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * @author tianhua
@@ -51,8 +47,9 @@ public class OverallSummaryServiceImpl implements IOverallSummaryService {
      */
     @Override
     public OverallSummaryVO getOverallSummaryTotalData(OverallSummaryDTO dto) {
-        List<Long> userIds = dto.getPitcherId() == null ? dataPowerComponent.getSubUserIdList() : Collections.singletonList(dto.getPitcherId());
-        List<Long> gameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(dto.getGameId());
+        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
+        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
 
         //创建返回给前端的对象
         OverallSummaryVO overallSummaryVO = new OverallSummaryVO();
@@ -150,8 +147,9 @@ public class OverallSummaryServiceImpl implements IOverallSummaryService {
      */
     @Override
     public Map<String, List> getOverallSummaryLineData(OverallSummaryDTO dto) {
-        List<Long> userIds = dto.getPitcherId() == null ? dataPowerComponent.getSubUserIdList() : Collections.singletonList(dto.getPitcherId());
-        List<Long> gameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(dto.getGameId());
+        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
+        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
 
         //根据条件获取数据
         Condition lineCon = myCondition(userIds, gameIds, dto, true, true, -1);

+ 20 - 12
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/PitcherDataServiceImpl.java

@@ -202,7 +202,8 @@ public class PitcherDataServiceImpl implements IPitcherDataService {
      */
     @Override
     public Page<PitcherDataDayVO> getPitcherDataDay(PitcherDataDayDTO dto) {
-        List<Long> userIds = dto.getPitcherId() == null ? dataPowerComponent.getSubUserIdList() : Collections.singletonList(dto.getPitcherId());
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
         //不传递时间,默认查询当天
         if (dto.getBeginDate() == null || dto.getEndDate() == null) {
             dto.setBeginDate(LocalDate.now());
@@ -260,7 +261,8 @@ public class PitcherDataServiceImpl implements IPitcherDataService {
      */
     @Override
     public PitcherDataDayTotalVO getPitcherDataDayTotal(PitcherDataDayTotalDTO dto) {
-        List<Long> userIds = dto.getPitcherId() == null ? dataPowerComponent.getSubUserIdList() : Collections.singletonList(dto.getPitcherId());
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
         //不传递时间,默认查询当天
         if (dto.getBeginDate() == null || dto.getEndDate() == null) {
             dto.setBeginDate(LocalDate.now());
@@ -301,7 +303,8 @@ public class PitcherDataServiceImpl implements IPitcherDataService {
      */
     @Override
     public Page<PitcherDataTotalVO> getPitcherDataTotal(PitcherDataTotalDTO dto) {
-        List<Long> userIds = dto.getPitcherId() == null ? dataPowerComponent.getSubUserIdList() : Collections.singletonList(dto.getPitcherId());
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
         //如果注册时间参数为空,默认设置查询当天数据
         if (dto.getBeginDate() == null || dto.getEndDate() == null) {
             dto.setBeginDate(LocalDate.now());
@@ -392,7 +395,8 @@ public class PitcherDataServiceImpl implements IPitcherDataService {
      */
     @Override
     public PitcherDataTotalSumVO getPitcherDataTotalSum(PitcherDataTotalSumDTO dto) {
-        List<Long> userIds = dto.getPitcherId() == null ? dataPowerComponent.getSubUserIdList() : Collections.singletonList(dto.getPitcherId());
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
         //如果注册时间参数为空,默认设置查询当天数据
         if (dto.getBeginDate() == null || dto.getEndDate() == null) {
             dto.setBeginDate(LocalDate.now());
@@ -482,8 +486,9 @@ public class PitcherDataServiceImpl implements IPitcherDataService {
      */
     @Override
     public Page<PitcherGameDataDayVO> getPitcherGameDataDay(PitcherGameDataDayDTO dto) {
-        List<Long> userIds = dto.getPitcherId() == null ? dataPowerComponent.getSubUserIdList() : Collections.singletonList(dto.getPitcherId());
-        List<Long> gameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(Long.parseLong(dto.getGameId()));
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
+        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(Long.parseLong(dto.getGameId()));
         //不传递时间,默认查询当天
         if (dto.getBeginDate() == null || dto.getEndDate() == null) {
             dto.setBeginDate(LocalDate.now());
@@ -551,8 +556,9 @@ public class PitcherDataServiceImpl implements IPitcherDataService {
      */
     @Override
     public PitcherGameDataDayTotalVO getPitcherGameDataDayTotal(PitcherGameDataDayTotalDTO dto) {
-        List<Long> userIds = dto.getPitcherId() == null ? dataPowerComponent.getSubUserIdList() : Collections.singletonList(dto.getPitcherId());
-        List<Long> gameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(Long.parseLong(dto.getGameId()));
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
+        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(Long.parseLong(dto.getGameId()));
         //不传递时间,默认查询当天
         if (dto.getBeginDate() == null || dto.getEndDate() == null) {
             dto.setBeginDate(LocalDate.now());
@@ -602,8 +608,9 @@ public class PitcherDataServiceImpl implements IPitcherDataService {
      */
     @Override
     public Page<PitcherGameDataTotalVO> getPitcherGameDataTotal(PitcherGameDataTotalDTO dto) {
-        List<Long> userIds = dto.getPitcherId() == null ? dataPowerComponent.getSubUserIdList() : Collections.singletonList(dto.getPitcherId());
-        List<Long> gameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(Long.parseLong(dto.getGameId()));
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
+        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(Long.parseLong(dto.getGameId()));
         //如果注册时间参数为空,默认设置查询当天数据
         if (dto.getBeginDate() == null || dto.getEndDate() == null) {
             dto.setBeginDate(LocalDate.now());
@@ -700,8 +707,9 @@ public class PitcherDataServiceImpl implements IPitcherDataService {
      */
     @Override
     public PitcherGameDataTotalSumVO getPitcherGameDataTotalSum(PitcherGameDataTotalSumDTO dto) {
-        List<Long> userIds = dto.getPitcherId() == null ? dataPowerComponent.getSubUserIdList() : Collections.singletonList(dto.getPitcherId());
-        List<Long> gameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(Long.parseLong(dto.getGameId()));
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
+        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(Long.parseLong(dto.getGameId()));
         //如果注册时间参数为空,默认设置查询当天数据
         if (dto.getBeginDate() == null || dto.getEndDate() == null) {
             dto.setBeginDate(LocalDate.now());

+ 46 - 30
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/PlayerDataServiceImpl.java

@@ -1,5 +1,6 @@
 package com.zanxiang.game.data.serve.service.impl;
 
+import com.github.sd4324530.jtuple.Tuple2;
 import com.zanxiang.game.data.serve.component.DataPowerComponent;
 import com.zanxiang.game.data.serve.pojo.dto.PlayerBannedListDTO;
 import com.zanxiang.game.data.serve.pojo.dto.PlayerDataListDTO;
@@ -53,8 +54,9 @@ public class PlayerDataServiceImpl implements IPlayerDataService {
      */
     @Override
     public Page<PlayerDataVO> getPlayerDataList(PlayerDataListDTO dto) {
-        List<Long> gameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(dto.getGameId());
-        List<Long> pitcherIds = StringUtils.isBlank(dto.getPitcherId()) ? dataPowerComponent.getSubUserIdList() : Collections.singletonList(Long.valueOf(dto.getPitcherId()));
+        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> pitcherIds = StringUtils.isBlank(dto.getPitcherId()) ? poerInfo.first : Collections.singletonList(Long.valueOf(dto.getPitcherId()));
+        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
 
         //创建查询条件
         Criteria cri = Cnd.cri();
@@ -125,7 +127,7 @@ public class PlayerDataServiceImpl implements IPlayerDataService {
         }
         if (dto.getChannelId() != null) {
             //渠道id
-            cri.where().andEquals("agent_id", dto.getChannelId());
+            cri.where().andIn("agent_id", dto.getChannelId().toArray(String[]::new));
         }
         if (StringUtils.isNotBlank(dto.getAccountId())) {
             cri.where().andEquals("account_id", dto.getAccountId());
@@ -208,6 +210,9 @@ public class PlayerDataServiceImpl implements IPlayerDataService {
      */
     @Override
     public Page<PlayerRoleDataVO> getPlayerRoleDataList(PlayerRoleDataListDTO dto) {
+        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> pitcherIds = StringUtils.isBlank(dto.getPitcherId()) ? poerInfo.first : Collections.singletonList(Long.valueOf(dto.getPitcherId()));
+        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
         //查询条件
         Criteria cri = Cnd.cri();
         if (dto.getUserId() != null) {
@@ -238,9 +243,6 @@ public class PlayerDataServiceImpl implements IPlayerDataService {
         if (dto.getCpId() != null) {
             cri.where().andEquals("cp_id", dto.getCpId());
         }
-        if (dto.getGameId() != null) {
-            cri.where().andEquals("game_id", dto.getGameId());
-        }
         if (dto.getGameCategoryId() != null) {
             //游戏应用类型
             cri.where().andEquals("game_category_id", dto.getGameCategoryId());
@@ -251,10 +253,13 @@ public class PlayerDataServiceImpl implements IPlayerDataService {
         }
         if (dto.getChannelId() != null) {
             //渠道ID
-            cri.where().andEquals("agent_id", dto.getChannelId());
+            cri.where().andIn("agent_id", dto.getChannelId().toArray(String[]::new));
         }
-        if (StringUtils.isNotBlank(dto.getPitcherId())) {
-            cri.where().andEquals("pitcher_id", dto.getPitcherId());
+        if (pitcherIds != null) {
+            cri.where().andInList("pitcher_id", pitcherIds);
+        }
+        if (gameIds != null) {
+            cri.where().andInList("game_id", gameIds);
         }
         if (StringUtils.isNotBlank(dto.getOs())) {
             cri.where().andEquals("os", dto.getOs());
@@ -338,8 +343,16 @@ public class PlayerDataServiceImpl implements IPlayerDataService {
         return new Page<>(list, pager);
     }
 
+    /**
+     * 玩家角色列表总计一栏
+     * @param dto PlayerRoleDataListDTO
+     * @return PlayerRoleDataVO
+     */
     @Override
-    public Map getPlayerRoleTotalData(PlayerRoleDataListDTO dto) {
+    public PlayerRoleDataVO getPlayerRoleTotalData(PlayerRoleDataListDTO dto) {
+        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> pitcherIds = StringUtils.isBlank(dto.getPitcherId()) ? poerInfo.first : Collections.singletonList(Long.valueOf(dto.getPitcherId()));
+        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
         //查询条件
         Criteria cri = Cnd.cri();
         if (dto.getUserId() != null) {
@@ -370,9 +383,6 @@ public class PlayerDataServiceImpl implements IPlayerDataService {
         if (dto.getCpId() != null) {
             cri.where().andEquals("cp_id", dto.getCpId());
         }
-        if (dto.getGameId() != null) {
-            cri.where().andEquals("game_id", dto.getGameId());
-        }
         if (dto.getGameCategoryId() != null) {
             //游戏应用类型
             cri.where().andEquals("game_category_id", dto.getGameCategoryId());
@@ -383,10 +393,13 @@ public class PlayerDataServiceImpl implements IPlayerDataService {
         }
         if (dto.getChannelId() != null) {
             //渠道ID
-            cri.where().andEquals("agent_id", dto.getChannelId());
+            cri.where().andIn("agent_id", dto.getChannelId().toArray(String[]::new));
         }
-        if (StringUtils.isNotBlank(dto.getPitcherId())) {
-            cri.where().andEquals("pitcher_id", dto.getPitcherId());
+        if (pitcherIds != null) {
+            cri.where().andInList("pitcher_id", pitcherIds);
+        }
+        if (gameIds != null) {
+            cri.where().andInList("game_id", gameIds);
         }
         if (StringUtils.isNotBlank(dto.getOs())) {
             cri.where().andEquals("os", dto.getOs());
@@ -436,11 +449,12 @@ public class PlayerDataServiceImpl implements IPlayerDataService {
         }
         //查询sql
         Sql sql = Sqls.create(getUserRoleDataTotalSql() + cri);
-        sql.setCallback(Sqls.callback.map());
+        sql.setCallback(Sqls.callback.entities());
+        sql.setEntity(dao.getEntity(PlayerRoleDataVO.class));
         //执行sql 得到结果
         dao.execute(sql);
 
-        return sql.getObject(Map.class);
+        return sql.getObject(PlayerRoleDataVO.class);
     }
 
     /**
@@ -450,6 +464,8 @@ public class PlayerDataServiceImpl implements IPlayerDataService {
      */
     @Override
     public Page<Map> getPlayerLoginLogDataList(PlayerLoginLogDataListDTO dto) {
+        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
         //查询条件
         Criteria cri = Cnd.cri();
         if (StringUtils.isNotBlank(dto.getSourceSystem())) {
@@ -465,8 +481,8 @@ public class PlayerDataServiceImpl implements IPlayerDataService {
         if (dto.getUserId() != null) {
             cri.where().andEquals("user_id", dto.getUserId());
         }
-        if (dto.getGameId() != null) {
-            cri.where().andEquals("game_id", dto.getGameId());
+        if (gameIds != null) {
+            cri.where().andInList("game_id", gameIds);
         }
         if (dto.getGameClassify() != null) {
             cri.where().andEquals("classify", dto.getGameClassify());
@@ -604,8 +620,8 @@ public class PlayerDataServiceImpl implements IPlayerDataService {
                         a.game_id as game_id ,
                         e.game_name as game_name ,
                         e.classify as game_category_id ,
-                        d.zx_pitcher_name as pitcher_name ,
-                        d.zx_pitcher_id as pitcher_id ,
+                        IFNULL(d.zx_pitcher_name, '自然量') as pitcher_name ,
+                        IFNULL(d.zx_pitcher_id, 0) as pitcher_id ,
                         c.account_id as account_id,
                         c.account_type as account_type,
                         a.mobile as mobile ,
@@ -704,8 +720,8 @@ public class PlayerDataServiceImpl implements IPlayerDataService {
                         a.game_id as game_id ,
                         e.game_name as game_name ,
                         e.classify as game_category_id ,
-                        d.zx_pitcher_name as pitcher_name ,
-                        d.zx_pitcher_id as pitcher_id ,
+                        IFNULL(d.zx_pitcher_name, '自然量') as pitcher_name ,
+                        IFNULL(d.zx_pitcher_id, 0) as pitcher_id ,
                         c.account_id as account_id,
                         c.account_type as account_type,
                         a.mobile as mobile ,
@@ -800,8 +816,8 @@ public class PlayerDataServiceImpl implements IPlayerDataService {
                 		b.create_time as reg_time, -- 玩家注册时间
                 		b.agent_id , -- 注册渠道ID
                 		IF(b.agent_id = 0, '自然量', c.agent_name) as agent_name , -- 注册渠道名
-                		c.pitcher_id , -- 投手ID
-                		d.zx_pitcher_name as pitcher_name, -- 投手名
+                		IFNULL(c.pitcher_id, 0) as pitcher_id , -- 投手ID
+                  		IFNULL(d.zx_pitcher_name, '自然量') as pitcher_name, -- 投手名
                 		c.account_id , -- 推广账号ID
                 		c.account_name , -- 推广账号名
                 		c.account_type , -- 推广账号类型
@@ -910,8 +926,8 @@ public class PlayerDataServiceImpl implements IPlayerDataService {
                 		b.create_time as reg_time, -- 玩家注册时间
                 		b.agent_id , -- 注册渠道ID
                 		IF(b.agent_id = 0, '自然量', c.agent_name) as agent_name , -- 注册渠道名
-                		c.pitcher_id , -- 投手ID
-                		d.zx_pitcher_name as pitcher_name, -- 投手名
+                		IFNULL(c.pitcher_id, 0) as pitcher_id , -- 投手ID
+                  		IFNULL(d.zx_pitcher_name, '自然量') as pitcher_name, -- 投手名
                 		c.account_id , -- 推广账号ID
                 		c.account_name , -- 推广账号名
                 		c.account_type , -- 推广账号类型
@@ -1021,8 +1037,8 @@ public class PlayerDataServiceImpl implements IPlayerDataService {
                 		b.create_time as reg_time, -- 玩家注册时间
                 		b.agent_id , -- 注册渠道ID
                 		IF(b.agent_id = 0, '自然量', c.agent_name) as agent_name , -- 注册渠道名
-                		c.pitcher_id , -- 投手ID
-                		d.zx_pitcher_name as pitcher_name, -- 投手名
+                		IFNULL(c.pitcher_id, 0) as pitcher_id , -- 投手ID
+                  		IFNULL(d.zx_pitcher_name, '自然量') as pitcher_name, -- 投手名
                 		c.account_id , -- 推广账号ID
                 		c.account_name , -- 推广账号名
                 		c.account_type , -- 推广账号类型

+ 24 - 16
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/PromotionDayServiceImpl.java

@@ -1,5 +1,6 @@
 package com.zanxiang.game.data.serve.service.impl;
 
+import com.github.sd4324530.jtuple.Tuple2;
 import com.google.common.base.CaseFormat;
 import com.zanxiang.game.data.serve.component.DataPowerComponent;
 import com.zanxiang.game.data.serve.pojo.dto.PromotionDayDTO;
@@ -11,6 +12,7 @@ import com.zanxiang.game.data.serve.pojo.vo.*;
 import com.zanxiang.game.data.serve.service.IAdsPromotionDayService;
 import com.zanxiang.game.data.serve.utils.Page;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.nutz.dao.Cnd;
 import org.nutz.dao.Dao;
@@ -52,8 +54,9 @@ public class PromotionDayServiceImpl implements IAdsPromotionDayService {
      * @return
      */
     public Page<PromotionDayVO> getPromotionDayListData(PromotionDayDTO dto) {
-        List<Long> userIds = dto.getPitcherId() == null ? dataPowerComponent.getSubUserIdList() : Collections.singletonList(dto.getPitcherId());
-        List<Long> gameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(dto.getGameId());
+        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
+        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
         //如果没有排序条件给默认值
         if (StringUtils.isBlank(dto.getSortFiled())) {
             dto.setSortFiled("dt");
@@ -138,8 +141,9 @@ public class PromotionDayServiceImpl implements IAdsPromotionDayService {
      */
     @Override
     public Page<PromotionDayVO> getPromotionDayData(PromotionDayDTO dto) {
-        List<Long> userIds = dto.getPitcherId() == null ? dataPowerComponent.getSubUserIdList() : Collections.singletonList(dto.getPitcherId());
-        List<Long> gameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(dto.getGameId());
+        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
+        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
         //如果没有排序条件给默认值
         if (StringUtils.isBlank(dto.getSortFiled())) {
             dto.setSortFiled("today_cost");
@@ -220,8 +224,9 @@ public class PromotionDayServiceImpl implements IAdsPromotionDayService {
      */
     @Override
     public PromotionDayTotalVO getPromotionDayTotalData(PromotionDayTotalDTO dto) {
-        List<Long> userIds = dto.getPitcherId() == null ? dataPowerComponent.getSubUserIdList() : Collections.singletonList(dto.getPitcherId());
-        List<Long> gameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(dto.getGameId());
+        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
+        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
         //创建查询条件
         Criteria cri = Cnd.cri();
         if (dto.getAccountId() != null) {
@@ -239,7 +244,7 @@ public class PromotionDayServiceImpl implements IAdsPromotionDayService {
         if (userIds != null) {
             cri.where().andInList("pitcher_id", userIds);
         }
-        if (dto.getAgentId() != null) {
+        if (ArrayUtils.isNotEmpty(dto.getAgentId())) {
             cri.where().andInList("agent_id", Arrays.asList(dto.getAgentId()));
         }
         if (StringUtils.isNotBlank(dto.getCpName())) {
@@ -410,8 +415,9 @@ public class PromotionDayServiceImpl implements IAdsPromotionDayService {
      * @return
      */
     public Page<TencentPromotionDayVO> getTencentPromotionDayListData(TencentPromotionDayDTO dto) {
-        List<Long> userIds = dto.getPitcherId() == null ? dataPowerComponent.getSubUserIdList() : Collections.singletonList(dto.getPitcherId());
-        List<Long> gameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(dto.getGameId());
+        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
+        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
         //如果没有排序条件给默认值
         if (StringUtils.isBlank(dto.getSortFiled())) {
             dto.setSortFiled("dt");
@@ -496,8 +502,9 @@ public class PromotionDayServiceImpl implements IAdsPromotionDayService {
      */
     @Override
     public Page<TencentPromotionDayVO> getTencentPromotionDayData(TencentPromotionDayDTO dto) {
-        List<Long> userIds = dto.getPitcherId() == null ? dataPowerComponent.getSubUserIdList() : Collections.singletonList(dto.getPitcherId());
-        List<Long> gameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(dto.getGameId());
+        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
+        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
         //如果没有排序条件给默认值
         if (StringUtils.isBlank(dto.getSortFiled())) {
             dto.setSortFiled("today_cost");
@@ -578,8 +585,9 @@ public class PromotionDayServiceImpl implements IAdsPromotionDayService {
      */
     @Override
     public TencentPromotionDayTotalVO getTencentPromotionDayTotalData(TencentPromotionDayTotalDTO dto) {
-        List<Long> userIds = dto.getPitcherId() == null ? dataPowerComponent.getSubUserIdList() : Collections.singletonList(dto.getPitcherId());
-        List<Long> gameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(dto.getGameId());
+        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
+        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
         //创建查询条件
         Criteria cri = Cnd.cri();
         if (dto.getAccountId() != null) {
@@ -597,7 +605,7 @@ public class PromotionDayServiceImpl implements IAdsPromotionDayService {
         if (userIds != null) {
             cri.where().andInList("pitcher_id", userIds);
         }
-        if (dto.getAgentId() != null) {
+        if (ArrayUtils.isNotEmpty(dto.getAgentId())) {
             cri.where().andInList("agent_id", Arrays.asList(dto.getAgentId()));
         }
         if (StringUtils.isNotBlank(dto.getCpName())) {
@@ -779,7 +787,7 @@ public class PromotionDayServiceImpl implements IAdsPromotionDayService {
         if (userIds != null) {
             cri.where().andInList("pitcher_id", userIds);
         }
-        if (dto.getAgentId() != null) {
+        if (ArrayUtils.isNotEmpty(dto.getAgentId())) {
             cri.where().andInList("agent_id", Arrays.asList(dto.getAgentId()));
         }
         if (StringUtils.isNotBlank(dto.getCpName())) {
@@ -852,7 +860,7 @@ public class PromotionDayServiceImpl implements IAdsPromotionDayService {
         if (userIds != null) {
             cri.where().andInList("pitcher_id", userIds);
         }
-        if (dto.getAgentId() != null) {
+        if (ArrayUtils.isNotEmpty(dto.getAgentId())) {
             cri.where().andInList("agent_id", Arrays.asList(dto.getAgentId()));
         }
         if (StringUtils.isNotBlank(dto.getCpName())) {

+ 5 - 2
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/RankingServiceImpl.java

@@ -1,5 +1,6 @@
 package com.zanxiang.game.data.serve.service.impl;
 
+import com.github.sd4324530.jtuple.Tuple2;
 import com.google.common.base.CaseFormat;
 import com.zanxiang.game.data.serve.component.DataPowerComponent;
 import com.zanxiang.game.data.serve.pojo.dto.RechargeRankingDTO;
@@ -34,7 +35,8 @@ public class RankingServiceImpl implements IRankingService {
 
     @Override
     public Page<GameRechargeRankingVO> gameRanking(RechargeRankingDTO dto) {
-        List<Long> gameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(dto.getGameId());
+        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
         if (StringUtils.isBlank(dto.getSortFiled())){
             dto.setSortFiled("totalAmount");
         }
@@ -94,7 +96,8 @@ public class RankingServiceImpl implements IRankingService {
 
     @Override
     public Page<PlayerRechargeRankingVO> playerRanking(RechargeRankingDTO dto) {
-        List<Long> gameIds = dto.getGameId() == null ? dataPowerComponent.getSubGameIdList() : Collections.singletonList(dto.getGameId());
+        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
         if (StringUtils.isBlank(dto.getSortFiled())){
             dto.setSortFiled("totalAmount");
         }

+ 25 - 1
game-module/game-module-base/src/main/java/com/zanxiang/game/module/base/pojo/vo/GameAuthUserVO.java

@@ -33,12 +33,36 @@ public class GameAuthUserVO implements Serializable {
     private GameAuthEnum gameAuthEnum;
 
     /**
-     * 游戏id列表
+     * 角色授权
+     */
+    private String gameAuth;
+
+    /**
+     * 授权游戏id列表
      */
     private List<Long> gameIdList;
 
+    /**
+     * 授权游戏列表
+     */
+    private List<GameAuthBean> gameAuthBeanList;
+
     /**
      * 投手列表
      */
     private List<Long> pitcherList;
+
+    @Data
+    public static class GameAuthBean {
+
+        /**
+         * 游戏id
+         */
+        private Long gameId;
+
+        /**
+         * 是否包含自然量
+         */
+        private Boolean defaultAgent;
+    }
 }

+ 1 - 1
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/ManageApplication.java

@@ -21,7 +21,7 @@ public class ManageApplication {
 
     public static void main(String[] args) {
         SpringApplication.run(ManageApplication.class, args);
-        System.out.println("赞象Manage服务启动成功 <区服新增excel方式上线> ( ´・・)ノ(._.`) \n" +
+        System.out.println("赞象Manage服务启动成功 <游戏授权模块修改1> ( ´・・)ノ(._.`) \n" +
                 "___  ___  ___   _   _   ___  _____  _____ \n" +
                 "|  \\/  | / _ \\ | \\ | | / _ \\|  __ \\|  ___|\n" +
                 "| .  . |/ /_\\ \\|  \\| |/ /_\\ \\ |  \\/| |__  \n" +

+ 18 - 2
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/params/GameAuthAddParam.java

@@ -30,9 +30,25 @@ public class GameAuthAddParam {
     private List<Long> userIdList;
 
     /**
-     * 游戏id列表
+     * 游戏授权列表
      */
     @NotNull(message = "游戏id列表不可为空")
     @ApiModelProperty(notes = "游戏id列表, 所有游戏下拉选择")
-    private List<Long> gameIdList;
+    private List<GameAuthBean> gameAuthList;
+
+    @Data
+    public static class GameAuthBean {
+
+        /**
+         * 游戏id
+         */
+        @ApiModelProperty(notes = "游戏id")
+        private Long gameId;
+
+        /**
+         * 是否包含自然量
+         */
+        @ApiModelProperty(notes = "是否包含自然量")
+        private Boolean defaultAgent;
+    }
 }

+ 7 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/params/GameAuthUpdateParam.java

@@ -33,4 +33,11 @@ public class GameAuthUpdateParam {
     @NotNull(message = "用户id不可为空")
     @ApiModelProperty(notes = "用户id")
     private Long userId;
+
+    /**
+     * 是否包含自然量
+     */
+    @NotNull(message = "用户id不可为空")
+    @ApiModelProperty(notes = "是否包含自然量")
+    private Boolean defaultAgent;
 }

+ 6 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/vo/GameAuthVO.java

@@ -26,6 +26,12 @@ public class GameAuthVO {
     @ApiModelProperty(notes = "游戏id")
     private Long gameId;
 
+    /**
+     * 是否包含自然量
+     */
+    @ApiModelProperty(notes = "是否包含自然量")
+    private Boolean defaultAgent;
+
     /**
      * 游戏名称
      */

+ 7 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/rpc/impl/GameAuthRpcImpl.java

@@ -12,6 +12,7 @@ import com.zanxiang.game.module.manage.service.IGameAuthRoleService;
 import com.zanxiang.game.module.manage.service.IGameAuthService;
 import com.zanxiang.game.module.mybatis.entity.GameAuth;
 import com.zanxiang.game.module.mybatis.entity.GameAuthRole;
+import com.zanxiang.module.util.bean.BeanUtil;
 import com.zanxiang.module.util.exception.BaseException;
 import com.zanxiang.module.util.pojo.ResultVO;
 import org.apache.dubbo.config.annotation.DubboReference;
@@ -84,12 +85,18 @@ public class GameAuthRpcImpl implements GameAuthRpc {
                 && !pitcherList.contains(SecurityUtil.getUserId())) {
             pitcherList.add(SecurityUtil.getUserId());
         }
+        //游戏授权列表
+        List<GameAuthUserVO.GameAuthBean> gameAuthBeanList = gameAuthService.list(new LambdaQueryWrapper<GameAuth>()
+                .eq(GameAuth::getUserId, SecurityUtil.getUserId()).in(GameAuth::getGameId, tuple2.getT2())
+        ).stream().map(gameAuth -> BeanUtil.copy(gameAuth, GameAuthUserVO.GameAuthBean.class)).collect(Collectors.toList());
         //构造返回
         return ResultVO.ok(GameAuthUserVO.builder()
                 .userId(SecurityUtil.getUserId())
                 .gameIdList(tuple2.getT2())
                 .gameAuthEnum(gameAuthEnum)
+                .gameAuth(gameAuthEnum.getValue())
                 .pitcherList(pitcherList)
+                .gameAuthBeanList(gameAuthBeanList)
                 .build());
     }
 }

+ 8 - 6
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/GameAuthServiceImpl.java

@@ -64,7 +64,7 @@ public class GameAuthServiceImpl extends ServiceImpl<GameAuthMapper, GameAuth> i
     @Transactional(rollbackFor = Exception.class)
     public boolean gameAuthAdd(GameAuthAddParam param) {
         List<Long> userIdList = param.getUserIdList();
-        List<Long> gameIdList = param.getGameIdList();
+        List<GameAuthAddParam.GameAuthBean> gameAuthList = param.getGameAuthList();
         List<GameAuth> addList = new ArrayList<>();
         userIdList.forEach(userId -> {
             //判断角色是否正确
@@ -75,15 +75,15 @@ public class GameAuthServiceImpl extends ServiceImpl<GameAuthMapper, GameAuth> i
                 throw new BaseException("参数错误, 提交得用户存在权限不匹配");
             }
             //循环添加
-            gameIdList.forEach(gameId -> {
+            gameAuthList.forEach(gameAuthBean -> {
                 //判断提交的参数数据是否已经存在
                 if (super.count(new LambdaQueryWrapper<GameAuth>()
-                        .eq(GameAuth::getGameId, gameId)
+                        .eq(GameAuth::getGameId, gameAuthBean.getGameId())
                         .eq(GameAuth::getUserId, userId)
                 ) > 0) {
                     throw new BaseException("参数错误, 提交的用户存在重复权限");
                 }
-                addList.add(this.transform(gameId, userId));
+                addList.add(this.transform(gameAuthBean, userId));
             });
         });
         if (addList.isEmpty()) {
@@ -92,15 +92,16 @@ public class GameAuthServiceImpl extends ServiceImpl<GameAuthMapper, GameAuth> i
         return super.saveBatch(addList);
     }
 
-    private GameAuth transform(Long gameId, Long userId) {
+    private GameAuth transform(GameAuthAddParam.GameAuthBean gameAuthBean, Long userId) {
         return GameAuth.builder()
-                .gameId(gameId)
+                .gameId(gameAuthBean.getGameId())
                 .userId(userId)
                 .isDelete(DeleteEnum.NO.getCode())
                 .createBy(SecurityUtil.getUserId())
                 .createTime(LocalDateTime.now())
                 .updateBy(SecurityUtil.getUserId())
                 .updateTime(LocalDateTime.now())
+                .defaultAgent(gameAuthBean.getDefaultAgent())
                 .build();
     }
 
@@ -117,6 +118,7 @@ public class GameAuthServiceImpl extends ServiceImpl<GameAuthMapper, GameAuth> i
         //修改
         return super.update(new LambdaUpdateWrapper<GameAuth>()
                 .set(GameAuth::getGameId, param.getGameId())
+                .set(GameAuth::getDefaultAgent, param.getDefaultAgent())
                 .set(GameAuth::getUpdateBy, SecurityUtil.getUserId())
                 .set(GameAuth::getUpdateTime, LocalDateTime.now())
                 .eq(GameAuth::getId, param.getId()));

+ 5 - 0
game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/entity/GameAppletShell.java

@@ -99,4 +99,9 @@ public class GameAppletShell implements Serializable {
      */
     private String testVersion;
 
+    /**
+     * 省份屏蔽
+     */
+    private String provShield;
+
 }

+ 5 - 0
game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/entity/GameAuth.java

@@ -65,4 +65,9 @@ public class GameAuth implements Serializable {
      * 更新时间
      */
     private LocalDateTime updateTime;
+
+    /**
+     * 是否包含自然量
+     */
+    private Boolean defaultAgent;
 }

+ 1 - 1
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/SDKApplication.java

@@ -23,7 +23,7 @@ public class SDKApplication {
 
     public static void main(String[] args) {
         SpringApplication.run(SDKApplication.class, args);
-        System.out.println("赞象SDK服务启动成功 <壳包控制兼容多版本测试> ( ´・・)ノ(._.`) \n" +
+        System.out.println("赞象SDK服务启动成功 <壳包屏蔽省份1> ( ´・・)ノ(._.`) \n" +
                 " ___________ _   __\n" +
                 "/  ___|  _  \\ | / /\n" +
                 "\\ `--.| | | | |/ / \n" +

+ 5 - 2
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/controller/InitController.java

@@ -14,6 +14,8 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletRequest;
+
 /**
  * @author : lingfeng
  * @time : 2023-01-03
@@ -43,8 +45,9 @@ public class InitController {
     @ApiOperation(value = "微信小游戏壳包控制开关")
     @GetMapping("/shell/switch")
     @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = Boolean.class)})
-    public ResultVO<Integer> getShellSwitch(@RequestParam String appId, @RequestParam String version) {
-        Integer shellSwitch = gameAppletShellService.getShellSwitch(appId, version);
+    public ResultVO<Integer> getShellSwitch(@RequestParam String appId, @RequestParam String version,
+                                            HttpServletRequest request) {
+        Integer shellSwitch = gameAppletShellService.getShellSwitch(appId, version, request);
         log.error("客保控制开关返回值, shellSwitch : {}", shellSwitch);
         return ResultVO.ok(shellSwitch);
     }

+ 134 - 0
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/pojo/result/IpCheckResult.java

@@ -0,0 +1,134 @@
+package com.zanxiang.game.module.sdk.pojo.result;
+
+import lombok.Data;
+
+/**
+ * @author : lingfeng
+ * @time : 2023-10-13
+ * @description : ip检测
+ */
+@Data
+public class IpCheckResult {
+
+    /**
+     * 消息
+     */
+    private String msg;
+
+    /**
+     * 是否成功
+     */
+    private boolean success;
+
+    /**
+     * 错误码
+     */
+    private Integer code;
+
+    /**
+     * 数据
+     */
+    private DataBean data;
+
+    @Data
+    public static class DataBean {
+
+        /**
+         * 订单号
+         */
+        private String orderNo;
+
+        /**
+         * 结果
+         */
+        private IpCheckResult.ResultBean result;
+    }
+
+    @Data
+    public static class ResultBean {
+
+        /**
+         * 大洲
+         */
+        private String continent;
+
+        /**
+         * 所属机构
+         */
+        private String owner;
+
+        /**
+         * 国家
+         */
+        private String country;
+
+        /**
+         * 经度
+         */
+        private String lng;
+
+        /**
+         * 行政编码
+         */
+        private String adcode;
+
+        /**
+         * 城市
+         */
+        private String city;
+
+        /**
+         * 时区
+         */
+        private String timezone;
+
+        /**
+         * 运营商
+         */
+        private String isp;
+
+        /**
+         * 精度
+         */
+        private String accuracy;
+
+        /**
+         * 采集方式
+         */
+        private String source;
+
+        /**
+         * 自治域编码
+         */
+        private String asnumber;
+
+        /**
+         * 国家编码
+         */
+        private String areacode;
+
+        /**
+         * 邮编
+         */
+        private String zipcode;
+
+        /**
+         * 定位半径
+         */
+        private String radius;
+
+        /**
+         * 省份
+         */
+        private String prov;
+
+        /**
+         * 纬度
+         */
+        private String lat;
+    }
+
+    public Boolean isFail() {
+        return this.code != 200;
+    }
+}

+ 4 - 1
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/IGameAppletShellService.java

@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.zanxiang.game.module.mybatis.entity.GameAppletShell;
 import com.zanxiang.game.module.mybatis.entity.User;
 
+import javax.servlet.http.HttpServletRequest;
+
 /**
  * @author : lingfeng
  * @time : 2023-07-06
@@ -16,9 +18,10 @@ public interface IGameAppletShellService extends IService<GameAppletShell> {
      *
      * @param appId   应用程序id
      * @param version 版本
+     * @param request 网络请求
      * @return {@link Integer}
      */
-    Integer getShellSwitch(String appId, String version);
+    Integer getShellSwitch(String appId, String version, HttpServletRequest request);
 
     /**
      * 获取用户壳开关

+ 9 - 0
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/IUserCardService.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.zanxiang.game.module.mybatis.entity.UserCard;
 import com.zanxiang.game.module.sdk.pojo.param.UserCardUpdateParam;
 import com.zanxiang.game.module.sdk.pojo.param.UserData;
+import com.zanxiang.game.module.sdk.pojo.result.IpCheckResult;
 import com.zanxiang.module.util.pojo.ResultVO;
 
 /**
@@ -21,4 +22,12 @@ public interface IUserCardService extends IService<UserCard> {
      * @return {@link ResultVO}<{@link Boolean}>
      */
     ResultVO<Boolean> userAuthentication(UserCardUpdateParam param, UserData userData);
+
+    /**
+     * ip监测
+     *
+     * @param ip : 网络地址
+     * @return {@link IpCheckResult}
+     */
+    IpCheckResult userIpCheck(String ip);
 }

+ 18 - 1
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/GameAppletShellServiceImpl.java

@@ -10,16 +10,20 @@ import com.zanxiang.game.module.mybatis.entity.GameUserRole;
 import com.zanxiang.game.module.mybatis.entity.User;
 import com.zanxiang.game.module.mybatis.mapper.GameAppletShellMapper;
 import com.zanxiang.game.module.sdk.enums.ShellSwitchEnum;
+import com.zanxiang.game.module.sdk.pojo.result.IpCheckResult;
 import com.zanxiang.game.module.sdk.service.IGameAppletShellService;
 import com.zanxiang.game.module.sdk.service.IGameExtService;
 import com.zanxiang.game.module.sdk.service.IGameUserRoleService;
+import com.zanxiang.game.module.sdk.service.IUserCardService;
 import com.zanxiang.module.util.JsonUtil;
 import com.zanxiang.module.util.exception.BaseException;
+import com.zanxiang.module.web.util.IpUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.logging.log4j.util.Strings;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.servlet.http.HttpServletRequest;
 import java.util.Comparator;
 import java.util.List;
 import java.util.Objects;
@@ -39,8 +43,11 @@ public class GameAppletShellServiceImpl extends ServiceImpl<GameAppletShellMappe
     @Autowired
     private IGameUserRoleService gameUserRoleService;
 
+    @Autowired
+    private IUserCardService userCardService;
+
     @Override
-    public Integer getShellSwitch(String appId, String version) {
+    public Integer getShellSwitch(String appId, String version, HttpServletRequest request) {
         log.error("壳包接口收到请求, appId : {}, version : {}", appId, version);
         GameExt gameExt = gameExtService.getByGameAppId(appId);
         if (gameExt == null) {
@@ -55,6 +62,16 @@ public class GameAppletShellServiceImpl extends ServiceImpl<GameAppletShellMappe
         if (Objects.equals(gameAppletShell.getArraignVersion(), version)) {
             return ShellSwitchEnum.SHELL_SWITCH_OPEN.getShellSwitch();
         }
+        //省份屏蔽
+        if (Strings.isNotBlank(gameAppletShell.getProvShield())) {
+            try {
+                IpCheckResult result = userCardService.userIpCheck(IpUtil.getRealIp(request));
+                if (result.getData().getResult().getProv().contains(gameAppletShell.getProvShield())) {
+                    return ShellSwitchEnum.SHELL_SWITCH_OPEN.getShellSwitch();
+                }
+            } catch (Exception ignored) {
+            }
+        }
         //线上版本
         if (Objects.equals(gameAppletShell.getProVersion(), version)) {
             //申诉中, 返回申诉状态

+ 31 - 4
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/UserCardServiceImpl.java

@@ -11,6 +11,7 @@ import com.zanxiang.game.module.sdk.constant.RegexConstant;
 import com.zanxiang.game.module.sdk.pojo.param.UserCardUpdateParam;
 import com.zanxiang.game.module.sdk.pojo.param.UserData;
 import com.zanxiang.game.module.sdk.pojo.result.CardCheckResult;
+import com.zanxiang.game.module.sdk.pojo.result.IpCheckResult;
 import com.zanxiang.game.module.sdk.service.IUserCardService;
 import com.zanxiang.game.module.sdk.service.IUserService;
 import com.zanxiang.module.util.JsonUtil;
@@ -20,15 +21,13 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.logging.log4j.util.Strings;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.ResponseEntity;
+import org.springframework.http.*;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.LinkedMultiValueMap;
 import org.springframework.util.MultiValueMap;
 import org.springframework.web.client.RestTemplate;
+import org.springframework.web.util.UriComponentsBuilder;
 import reactor.util.function.Tuple2;
 import reactor.util.function.Tuples;
 
@@ -227,4 +226,32 @@ public class UserCardServiceImpl extends ServiceImpl<UserCardMapper, UserCard> i
         log.error("实名认证结果, result : {}", JsonUtil.toString(result));
         return Tuples.of(result.past(), result.getAddress());
     }
+
+    @Override
+    public IpCheckResult userIpCheck(String ip) {
+        String url = "https://ipcity.market.alicloudapi.com/ip/city/query";
+        String appCode = "f395b1587fc04a49a975f908660fb1e9";
+        //构造请求参数
+        UriComponentsBuilder uriBuilder = UriComponentsBuilder.fromHttpUrl(url).queryParam("ip", ip);
+        //请求头
+        HttpHeaders headers = new HttpHeaders();
+        headers.set("Authorization", "APPCODE " + appCode);
+        RequestEntity<Object> requestEntity = new RequestEntity<>(headers, HttpMethod.GET, uriBuilder.build().toUri());
+        //请求
+        IpCheckResult result;
+        try {
+            ResponseEntity<String> responseEntity = restTemplate.exchange(requestEntity, String.class);
+            String body = responseEntity.getBody();
+            result = JsonUtil.toObj(body, IpCheckResult.class);
+        } catch (Exception e) {
+            log.error("请求阿里ip检测接口异常, ip : {}, e : {}", ip, e.getMessage());
+            throw new BaseException("请求阿里ip监测接口异常");
+        }
+        if (result == null || result.isFail()) {
+            log.error("请求阿里ip检测接口返回值为空, ip : {}, result : {}", ip, JsonUtil.toString(result));
+            throw new BaseException("请求阿里ip检测接口返回值为空");
+        }
+        log.error("ip检测结果, result : {}", JsonUtil.toString(result));
+        return result;
+    }
 }