Bläddra i källkod

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

zhimo 11 månader sedan
förälder
incheckning
d5c0d59fe7

+ 17 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/vo/PitcherDataTotalSumVO.java

@@ -121,6 +121,23 @@ public class PitcherDataTotalSumVO {
     @ApiModelProperty(value = "新用户充值金额")
     private BigDecimal newUserAmount;
 
+    /**
+     * 支付宝金额
+     */
+    @ApiModelProperty(value = "支付宝金额")
+    private BigDecimal alipayAmount;
+    /**
+     * 微信金额
+     */
+    @ApiModelProperty(value = "微信金额")
+    private BigDecimal wxAmount;
+    /**
+     * 米大师金额
+     */
+    @ApiModelProperty(value = "米大师金额")
+    private BigDecimal miMasterAmount;
+
+
     /**
      * 新增付费次数(首日新用户充值次数)
      */

+ 16 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/vo/PitcherDataTotalVO.java

@@ -121,6 +121,22 @@ public class PitcherDataTotalVO {
     @ApiModelProperty(value = "新用户充值次数")
     private Long newUserAmountCount;
 
+    /**
+     * 支付宝金额
+     */
+    @ApiModelProperty(value = "支付宝金额")
+    private BigDecimal alipayAmount;
+    /**
+     * 微信金额
+     */
+    @ApiModelProperty(value = "微信金额")
+    private BigDecimal wxAmount;
+    /**
+     * 米大师金额
+     */
+    @ApiModelProperty(value = "米大师金额")
+    private BigDecimal miMasterAmount;
+
     /**
      * 新用户充值人数
      */

+ 26 - 7
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/PitcherDataServiceImpl.java

@@ -535,12 +535,18 @@ public class PitcherDataServiceImpl implements IPitcherDataService {
             String dayNStr = pitcherDataTotalDayNMap.get(vo.getPitcherId().toString());
             //如果为空或不存在
             if (StringUtils.isBlank(dayNStr)) {
-                dayNStr = "0.00-0";
+                dayNStr = "0.00-0.00-0.00-0.00-0-0-0";
             }
             //新用户充值金额
             vo.setNewUserAmount(new BigDecimal(dayNStr.split("-")[0]));
+            //支付宝充值金额
+            vo.setAlipayAmount(new BigDecimal(dayNStr.split("-")[1]));
+            //微信充值金额
+            vo.setWxAmount(new BigDecimal(dayNStr.split("-")[2]));
+            //米大师充值金额
+            vo.setMiMasterAmount(new BigDecimal(dayNStr.split("-")[3]));
             //新用户充值次数
-            vo.setNewUserAmountCount(Long.parseLong(dayNStr.split("-")[1]));
+            vo.setNewUserAmountCount(Long.parseLong(dayNStr.split("-")[4]));
             //老用户充值人数、次数、金额
             vo.setOldAmount(vo.getAmount().subtract(vo.getNewUserAmount()));
             vo.setOldAmountCount(vo.getAmountCount() - vo.getNewUserAmountCount());
@@ -572,6 +578,7 @@ public class PitcherDataServiceImpl implements IPitcherDataService {
     public PitcherDataTotalSumVO getPitcherDataTotalSum(PitcherDataTotalSumDTO dto) {
         com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo(dto.getSourceSystem());
         List<Long> userIds = CollectionUtils.isEmpty(dto.getPitcherId()) ? poerInfo.first : dto.getPitcherId();
+//        List<Long> userIds = dto.getPitcherId();
         //如果注册时间参数为空,默认设置查询当天数据
         if (dto.getBeginDate() == null || dto.getEndDate() == null) {
             dto.setBeginDate(LocalDate.now());
@@ -641,8 +648,14 @@ public class PitcherDataServiceImpl implements IPitcherDataService {
         String dayNStr = tempDayNDataTotalPitcher(totalDTO, userIds);
         //新用户充值金额
         vo.setNewUserAmount(new BigDecimal(dayNStr.split("-")[0]));
+        //支付宝充值金额
+        vo.setAlipayAmount(new BigDecimal(dayNStr.split("-")[1]));
+        //微信充值金额
+        vo.setWxAmount(new BigDecimal(dayNStr.split("-")[2]));
+        //米大师充值金额
+        vo.setMiMasterAmount(new BigDecimal(dayNStr.split("-")[3]));
         //新用户充值次数
-        vo.setNewUserAmountCount(Long.parseLong(dayNStr.split("-")[1]));
+        vo.setNewUserAmountCount(Long.parseLong(dayNStr.split("-")[4]));
         //老用户充值人数、次数、金额
         vo.setOldAmount(vo.getAmount().subtract(vo.getNewUserAmount()));
         vo.setOldAmountCount(vo.getAmountCount() - vo.getNewUserAmountCount());
@@ -1692,7 +1705,7 @@ public class PitcherDataServiceImpl implements IPitcherDataService {
         for (AdsPitcherDayn adsPitcherDayn : list) {
             if (!tempMap.containsKey(adsPitcherDayn.getPitcherId())) {
                 //Map中没有该投手的相关数据,初始化tempMap
-                tempMap.put(adsPitcherDayn.getPitcherId(), "0.00-0");
+                tempMap.put(adsPitcherDayn.getPitcherId(), "0.00-0.00-0.00-0.00-0-0-0");
             }
             //解析每个 adsPitcherGameDayn 的 dayN
             parseJsonDataPitcher(adsPitcherDayn, tempMap, dto);
@@ -1831,7 +1844,7 @@ public class PitcherDataServiceImpl implements IPitcherDataService {
         List<AdsPitcherDayn> list = dayNSql.getList(AdsPitcherDayn.class);
         //初始化dayN结果
         Map<String, String> resMap = new HashMap<>();
-        resMap.put("dayN", "0.00-0");
+        resMap.put("dayN", "0.00-0.00-0.00-0.00-0-0-0");
 
         //循环遍历 list 按照 gameId 进行存储
         for (AdsPitcherDayn adsPitcherDayn : list) {
@@ -1946,10 +1959,16 @@ public class PitcherDataServiceImpl implements IPitcherDataService {
                 }
                 //充值的金额
                 BigDecimal chargeMoney = new BigDecimal(oldValues[0]).add(new BigDecimal(resValues[0])).setScale(2, RoundingMode.HALF_UP);
+                //支付宝金额
+                BigDecimal alipayMoney = new BigDecimal(oldValues[1]).add(new BigDecimal(resValues[1])).setScale(2, RoundingMode.HALF_UP);
+                //微信金额
+                BigDecimal wechatMoney = new BigDecimal(oldValues[2]).add(new BigDecimal(resValues[2])).setScale(2, RoundingMode.HALF_UP);
+                //米大师金额
+                BigDecimal miMasterMoney = new BigDecimal(oldValues[3]).add(new BigDecimal(resValues[3])).setScale(2, RoundingMode.HALF_UP);
                 //充值的次数
-                long count = Long.parseLong(oldValues[1]) + Long.parseLong(resValues[1]);
+                long count = Long.parseLong(oldValues[4]) + Long.parseLong(resValues[4]);
                 //合并成字符串 更新dayN的值
-                String newValue = chargeMoney + "-" + count;
+                String newValue = chargeMoney + "-" + alipayMoney + "-" + wechatMoney + "-" + miMasterMoney + "-" + count;
                 if (resMap.containsKey("dayN")) {
                     resMap.put("dayN", newValue);
                 } else {

+ 10 - 2
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/RoleManageServiceImpl.java

@@ -121,7 +121,7 @@ public class RoleManageServiceImpl implements IRoleManageService {
                 map.put("role_amount", str.replaceAll("[\\[\\]]", ""));
             }
             //去除‘null’字符串
-            List<String> nullStringKeys = Arrays.asList("add_corp_user_id", "user_wechat", "remark", "user_phone", "country");
+            List<String> nullStringKeys = Arrays.asList("add_corp_user_id", "user_wechat", "remark", "user_phone", "country","corpId","external_user_id","gsAccount");
             nullStringKeys.stream()
                     .filter(key -> "null".equals(map.get(key)))
                     .forEach(key -> map.put(key, null));
@@ -1554,7 +1554,10 @@ public class RoleManageServiceImpl implements IRoleManageService {
                         IFNULL(j.is_remove_game,2) as is_remove_game, -- 是否退游 1-是;0-否;null-代表未操作数据
                 		IFNULL(j.is_wake_up,2) as is_wake_up, -- 是否唤醒 1-是;0-否 2-未操作
                 		j.remark as remark, -- 备注
-                		j.gs_id as gs_id, -- GS_ID
+                		j.gs_id as gsId, -- GS_ID
+                		j.corp_id as corpId, -- 企业id
+                		j.gs_account as gsAccount, -- GS账号
+                        j.external_user_id as external_user_id, -- 企微客户id
                 		j.customer_service_id as customer_service_id, -- 客服ID
                 		j.oper_user_id as oper_user_id, -- 运营ID
                 		j.create_time as create_time, -- 创建时间
@@ -1803,6 +1806,9 @@ public class RoleManageServiceImpl implements IRoleManageService {
                             send_gift_id, -- 最新发送礼包id
                             is_change_game_type, -- 是否转端 1-是;0-否
                             is_add_corp_wechat, -- 是否添加企微 1-是; 0-否
+                            corp_id, -- 企业id
+                            external_user_id, -- 企微客户id
+                            gs_account,  -- GS账号
                             add_corp_user_id, -- 企微号
                             user_wechat, -- 客户微信号
                             user_phone, -- 客户手机号
@@ -2355,6 +2361,7 @@ public class RoleManageServiceImpl implements IRoleManageService {
                         IFNULL(j.is_change_game_type,2) as is_change_game_type, -- 是否转端 1-是;0-否
                         IFNULL(j.is_add_corp_wechat,2) as is_add_corp_wechat, -- 是否添加企微 1-是; 0-否
                         j.user_phone as user_phone, -- 客户手机号
+                        j.user_wechat as user_wechat, -- 客户微信号
                         IF(TIMESTAMPDIFF(HOUR, g.update_time, NOW()) > 72,
                         IF(TIMESTAMPDIFF(HOUR, f.pay_time, NOW()) < 72 , 0, 1) , 0) as is_remove_game_for_system, -- 是否退游 1-是;0-否(系统判定)
                         IFNULL(j.is_remove_game,2) as is_remove_game, -- 是否退游 1-是;0-否;2-代表未操作数据
@@ -2486,6 +2493,7 @@ public class RoleManageServiceImpl implements IRoleManageService {
                                 server_id,
                                 game_id,
                                 user_phone, -- 客户手机号
+                                user_wechat, -- 客户微信号
                                 is_send_mail, -- 是否发送邮件
                                 send_gift_id, -- 最新发送礼包id
                                 is_change_game_type, -- 是否转端 1-是;0-否

+ 41 - 0
game-module/game-module-base/src/main/java/com/zanxiang/game/module/base/pojo/dto/GameDTO.java

@@ -0,0 +1,41 @@
+package com.zanxiang.game.module.base.pojo.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author : lingfeng
+ * @time : 2024-05-23
+ * @description : 游戏信息
+ */
+@Data
+public class GameDTO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 游戏ID
+     */
+    private Long id;
+
+    /**
+     * 游戏名称
+     */
+    private String name;
+
+    /**
+     * 游戏类型
+     */
+    private Long category;
+
+    /**
+     * 父游戏id
+     */
+    private Long parentId;
+
+    /**
+     * 超父游戏id
+     */
+    private Long superGameId;
+}

+ 138 - 0
game-module/game-module-base/src/main/java/com/zanxiang/game/module/base/pojo/dto/GameServerDTO.java

@@ -0,0 +1,138 @@
+package com.zanxiang.game.module.base.pojo.dto;
+
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * @author : lingfeng
+ * @time : 2024-05-23
+ * @description : 游戏区服
+ */
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class GameServerDTO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 超父游戏区服列表
+     */
+    public List<SuperGameServerBean> superGameServerList;
+
+    /**
+     * 通过游戏id,区服id获取区服
+     *
+     * @param gameId   : 游戏id
+     * @param serverId : 区服id
+     * @return : 返回区服信息
+     */
+    public GameServerBean getGameServerByGameId(Long gameId, String serverId) {
+        if (CollectionUtils.isEmpty(this.superGameServerList)) {
+            return null;
+        }
+        SuperGameServerBean superGameServer = this.superGameServerList.stream()
+                .filter(superGameServerBean -> superGameServerBean.getGameIdList().contains(gameId))
+                .findFirst().orElse(null);
+        if (superGameServer == null) {
+            return null;
+        }
+        return superGameServer.getSourceGameServerList().stream()
+                .filter(gameServerBean -> Objects.equals(gameServerBean.getServerId(), serverId))
+                .findFirst().orElse(null);
+    }
+
+    /**
+     * 通过游戏id,区服id获取区服
+     *
+     * @param superGameId : 超父游戏id
+     * @param serverId    : 区服id
+     * @return : 返回区服信息
+     */
+    public GameServerBean getGameServerBySupperGameId(Long superGameId, String serverId) {
+        if (CollectionUtils.isEmpty(this.superGameServerList)) {
+            return null;
+        }
+        SuperGameServerBean superGameServer = this.superGameServerList.stream()
+                .filter(superGameServerBean -> Objects.equals(superGameId, superGameServerBean.getSuperGameId()))
+                .findFirst().orElse(null);
+        if (superGameServer == null) {
+            return null;
+        }
+        return superGameServer.getSourceGameServerList().stream()
+                .filter(gameServerBean -> Objects.equals(gameServerBean.getServerId(), serverId))
+                .findFirst().orElse(null);
+    }
+
+    @Data
+    @Builder
+    @NoArgsConstructor
+    @AllArgsConstructor
+    public static class SuperGameServerBean implements Serializable {
+
+        private static final long serialVersionUID = 1L;
+
+        /**
+         * 超父游戏id
+         */
+        private Long superGameId;
+
+        /**
+         * 游戏id列表
+         */
+        private List<Long> gameIdList;
+
+        /**
+         * 原始区服列表
+         */
+        private List<GameServerBean> sourceGameServerList;
+    }
+
+    @Data
+    @Builder
+    @NoArgsConstructor
+    @AllArgsConstructor
+    public static class GameServerBean implements Serializable {
+
+        private static final long serialVersionUID = 1L;
+
+        /**
+         * 主键id
+         */
+        private Long id;
+
+        /**
+         * 游戏id
+         */
+        private Long gameId;
+
+        /**
+         * 区服id
+         */
+        private String serverId;
+
+        /**
+         * 区服名称
+         */
+        private String serverName;
+
+        /**
+         * 区服冠名
+         */
+        private String nickName;
+
+        /**
+         * 开服时间
+         */
+        private LocalDateTime startTime;
+    }
+}

+ 21 - 0
game-module/game-module-base/src/main/java/com/zanxiang/game/module/base/rpc/IGameRpc.java

@@ -0,0 +1,21 @@
+package com.zanxiang.game.module.base.rpc;
+
+import com.zanxiang.game.module.base.pojo.dto.GameDTO;
+import com.zanxiang.module.util.pojo.ResultVO;
+
+import java.util.List;
+
+/**
+ * @author : lingfeng
+ * @time : 2024-05-23
+ * @description : 游戏相关接口
+ */
+public interface IGameRpc {
+
+    /**
+     * 获取所有游戏
+     *
+     * @return : 返回游戏列表
+     */
+    ResultVO<List<GameDTO>> getAllGameList();
+}

+ 19 - 0
game-module/game-module-base/src/main/java/com/zanxiang/game/module/base/rpc/IGameServerRpc.java

@@ -0,0 +1,19 @@
+package com.zanxiang.game.module.base.rpc;
+
+import com.zanxiang.game.module.base.pojo.dto.GameServerDTO;
+import com.zanxiang.module.util.pojo.ResultVO;
+
+/**
+ * @author : lingfeng
+ * @time : 2024-05-23
+ * @description : 游戏区服
+ */
+public interface IGameServerRpc {
+
+    /**
+     * 获取游戏所有区服
+     *
+     * @return : 返回游戏区服对象
+     */
+    ResultVO<GameServerDTO> getAllServerList();
+}

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

@@ -23,7 +23,7 @@ public class ManageApplication {
 
     public static void main(String[] args) {
         SpringApplication.run(ManageApplication.class, args);
-        System.out.println("赞象Manage服务启动成功 < (角色操作表新增字段´・・)ノ(._.`) \n" +
+        System.out.println("赞象Manage服务启动成功 < (新增游戏和区服rpc接口´・・)ノ(._.`) \n" +
                 "___  ___  ___   _   _   ___  _____  _____ \n" +
                 "|  \\/  | / _ \\ | \\ | | / _ \\|  __ \\|  ___|\n" +
                 "| .  . |/ /_\\ \\|  \\| |/ /_\\ \\ |  \\/| |__  \n" +

+ 36 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/rpc/impl/GameRpcImpl.java

@@ -0,0 +1,36 @@
+package com.zanxiang.game.module.manage.rpc.impl;
+
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.zanxiang.game.module.base.pojo.dto.GameDTO;
+import com.zanxiang.game.module.base.rpc.IGameRpc;
+import com.zanxiang.game.module.manage.service.IGameService;
+import com.zanxiang.game.module.mybatis.entity.Game;
+import com.zanxiang.module.util.bean.BeanUtil;
+import com.zanxiang.module.util.pojo.ResultVO;
+import org.apache.dubbo.config.annotation.DubboService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @author : lingfeng
+ * @time : 2024-05-23
+ * @description : 游戏相关接口
+ */
+@DubboService
+public class GameRpcImpl implements IGameRpc {
+
+    @Autowired
+    private IGameService gameService;
+
+    @Override
+    public ResultVO<List<GameDTO>> getAllGameList() {
+        List<Game> gameList = gameService.list();
+        if (CollectionUtils.isEmpty(gameList)) {
+            return ResultVO.ok(Collections.emptyList());
+        }
+        return ResultVO.ok(gameList.stream().map(game -> BeanUtil.copy(game, GameDTO.class)).collect(Collectors.toList()));
+    }
+}

+ 67 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/rpc/impl/GameServerRpcImpl.java

@@ -0,0 +1,67 @@
+package com.zanxiang.game.module.manage.rpc.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.zanxiang.game.module.base.pojo.dto.GameServerDTO;
+import com.zanxiang.game.module.base.rpc.IGameServerRpc;
+import com.zanxiang.game.module.manage.service.IGameServerService;
+import com.zanxiang.game.module.manage.service.IGameService;
+import com.zanxiang.game.module.manage.service.IGameSupperService;
+import com.zanxiang.game.module.mybatis.entity.Game;
+import com.zanxiang.game.module.mybatis.entity.GameServer;
+import com.zanxiang.game.module.mybatis.entity.GameSupper;
+import com.zanxiang.module.util.bean.BeanUtil;
+import com.zanxiang.module.util.pojo.ResultVO;
+import org.apache.dubbo.config.annotation.DubboService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @author : lingfeng
+ * @time : 2024-05-23
+ * @description : 游戏区服接口
+ */
+@DubboService
+public class GameServerRpcImpl implements IGameServerRpc {
+
+    @Autowired
+    private IGameSupperService gameSupperService;
+
+    @Autowired
+    private IGameService gameService;
+
+    @Autowired
+    private IGameServerService gameServerService;
+
+    @Override
+    public ResultVO<GameServerDTO> getAllServerList() {
+        //超父游戏列表
+        List<Long> supperGameIdList = gameSupperService.list(new LambdaQueryWrapper<GameSupper>()
+                .select(GameSupper::getId)
+        ).stream().map(GameSupper::getId).collect(Collectors.toList());
+        //区服列表
+        List<GameServerDTO.SuperGameServerBean> superGameServerList = new ArrayList<>();
+        supperGameIdList.forEach(supperGameId -> {
+            //查询超父对应的子游戏
+            List<Long> gameIdList = gameService.list(new LambdaQueryWrapper<Game>()
+                    .select(Game::getId)
+                    .eq(Game::getSuperGameId, supperGameId)
+            ).stream().map(Game::getId).collect(Collectors.toList());
+            //超父对应的区服
+            List<GameServerDTO.GameServerBean> gameServerBeanList = gameServerService.list(new LambdaQueryWrapper<GameServer>()
+                    .eq(GameServer::getGameId, supperGameId)
+                    .eq(GameServer::getIsSourceServer, Boolean.TRUE)
+            ).stream().map(gameServer -> BeanUtil.copy(gameServer, GameServerDTO.GameServerBean.class)).collect(Collectors.toList());
+            //添加到集合
+            superGameServerList.add(GameServerDTO.SuperGameServerBean.builder()
+                    .superGameId(supperGameId)
+                    .gameIdList(gameIdList)
+                    .sourceGameServerList(gameServerBeanList)
+                    .build());
+        });
+        //返回
+        return ResultVO.ok(GameServerDTO.builder().superGameServerList(superGameServerList).build());
+    }
+}