Explorar o código

:fix:
- 修改发送消息的游戏校验
- 修改流水监控sql

zhangxianyu hai 1 ano
pai
achega
43c0ea7523

+ 23 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/dto/SuperGameDTO.java

@@ -0,0 +1,23 @@
+package com.zanxiang.game.data.serve.pojo.dto;
+
+import lombok.Data;
+
+/**
+ * packageName com.zanxiang.game.data.serve.pojo.dto
+ *
+ * @author ZhangXianyu
+ * @date 2024/3/28
+ * @description 超父游戏dto
+ */
+@Data
+public class SuperGameDTO {
+
+    private Long id;
+
+    private String name;
+
+    private String cpSendMsgUrl;
+
+    private String cpSendMsgKey;
+
+}

+ 36 - 14
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/GameDataServiceImpl.java

@@ -8,6 +8,7 @@ import com.zanxiang.game.data.serve.pojo.entity.*;
 import com.zanxiang.game.data.serve.pojo.enums.OrderByEnum;
 import com.zanxiang.game.data.serve.pojo.vo.*;
 import com.zanxiang.game.data.serve.service.IGameDataService;
+import com.zanxiang.game.data.serve.service.IRoleManageService;
 import com.zanxiang.game.data.serve.utils.Page;
 import com.zanxiang.module.util.DateUtil;
 import com.zanxiang.module.util.exception.BaseException;
@@ -61,6 +62,8 @@ public class GameDataServiceImpl implements IGameDataService {
     @Resource
     private IGameDataService basicService;
 
+
+
     //用来存储映射
     private static final List<Tuple2<Field, Field>> dayNFieldMapList;
     private static final List<Tuple2<Field, Field>> dayNTotalFieldMapList;
@@ -5837,7 +5840,7 @@ public class GameDataServiceImpl implements IGameDataService {
                                 """ + cri + """
                                 and hour(order_create_time) < 10
                                 group by source_system, day, pitcher_id, order_agent_id, account_id, parent_game_id,
-                                         account_type) b
+                                         account_type,game_id) b
                                on a.source_system = b.source_system and a.day = b.day and a.agent_id = b.order_agent_id
                 and a.game_id=b.parent_game_id
                      left join (select source_system,
@@ -5852,7 +5855,7 @@ public class GameDataServiceImpl implements IGameDataService {
                                 """ + cri + """
                                 and hour(order_create_time) < 14
                                 group by source_system, day, pitcher_id, order_agent_id, account_id, parent_game_id,
-                                         account_type) c
+                                         account_type,game_id) c
                                on a.source_system = c.source_system and a.day = c.day and a.agent_id = c.order_agent_id
                 and a.game_id=c.parent_game_id
                      left join (select source_system,
@@ -5867,7 +5870,7 @@ public class GameDataServiceImpl implements IGameDataService {
                                 """ + cri + """
                                           and hour(order_create_time) < 17
                                           group by source_system, day, pitcher_id, order_agent_id, account_id, parent_game_id,
-                                                   account_type) d
+                                                   account_type,game_id) d
                                          on a.source_system = d.source_system and a.day = d.day and a.agent_id = d.order_agent_id
                           and a.game_id=d.parent_game_id
                 """
@@ -5897,7 +5900,7 @@ public class GameDataServiceImpl implements IGameDataService {
                                                                """ + cri + """
                          and order_agent_id = 0
                          group by source_system, day, pitcher_id, zx_pitcher_name, order_agent_id, agent_name,
-                                  account_id, parent_game_id, account_type
+                                  account_id, parent_game_id, account_type,game_id
                    )a
                 left join (
                              select
@@ -5913,7 +5916,7 @@ public class GameDataServiceImpl implements IGameDataService {
                            """ + cri + """
                                 and hour(order_create_time) < 10 and order_agent_id=0
                                 group by source_system, day, pitcher_id, order_agent_id, account_id, parent_game_id,
-                                         account_type) b
+                                         account_type,game_id) b
                                on a.source_system = b.source_system and a.day = b.day and a.order_agent_id = b.order_agent_id
                 and a.parent_game_id=b.parent_game_id
                      left join (select source_system,
@@ -5928,7 +5931,7 @@ public class GameDataServiceImpl implements IGameDataService {
                                 """ + cri + """
                                 and hour(order_create_time) < 14 and order_agent_id = 0
                                 group by source_system, day, pitcher_id, order_agent_id, account_id, parent_game_id,
-                                         account_type) c
+                                         account_type,game_id) c
                                on a.source_system = c.source_system and a.day = c.day and a.order_agent_id = c.order_agent_id
                 and a.parent_game_id=c.parent_game_id
                      left join (select source_system,
@@ -5943,7 +5946,7 @@ public class GameDataServiceImpl implements IGameDataService {
                                 """ + cri + """
                                                                          and hour(order_create_time) < 17 and order_agent_id = 0
                                                                          group by source_system, day, pitcher_id, order_agent_id, account_id, parent_game_id,
-                                                                                  account_type) d
+                                                                                  account_type,game_id) d
                                                                         on a.source_system = d.source_system and a.day = d.day and a.order_agent_id = d.order_agent_id
                                                          and a.parent_game_id=d.parent_game_id
                                 ) f
@@ -6040,7 +6043,7 @@ public class GameDataServiceImpl implements IGameDataService {
                                 """ + cri + """
                                 and hour(order_create_time) < 10
                                 group by source_system, day, pitcher_id, order_agent_id, account_id, parent_game_id,
-                                         account_type) b
+                                         account_type,game_id) b
                                on a.source_system = b.source_system and a.day = b.day and a.agent_id = b.order_agent_id
                 and a.game_id=b.parent_game_id
                      left join (select source_system,
@@ -6055,7 +6058,7 @@ public class GameDataServiceImpl implements IGameDataService {
                                 """ + cri + """
                                 and hour(order_create_time) < 14
                                 group by source_system, day, pitcher_id, order_agent_id, account_id, parent_game_id,
-                                         account_type) c
+                                         account_type,game_id) c
                                on a.source_system = c.source_system and a.day = c.day and a.agent_id = c.order_agent_id
                 and a.game_id=c.parent_game_id
                      left join (select source_system,
@@ -6070,7 +6073,7 @@ public class GameDataServiceImpl implements IGameDataService {
                                 """ + cri + """
                                 and hour(order_create_time) < 17
                                 group by source_system, day, pitcher_id, order_agent_id, account_id, parent_game_id,
-                                         account_type) d
+                                         account_type,game_id) d
                                on a.source_system = d.source_system and a.day = d.day and a.agent_id = d.order_agent_id
                 and a.game_id=d.parent_game_id
                 """
@@ -6102,7 +6105,7 @@ public class GameDataServiceImpl implements IGameDataService {
                                                                """ + cri + """
                          and order_agent_id = 0
                          group by source_system, day, pitcher_id, zx_pitcher_name, order_agent_id, agent_name,
-                                  account_id, parent_game_id, account_type
+                                  account_id, parent_game_id, account_type,game_id
                    )a
                 left join (
                              select
@@ -6118,7 +6121,7 @@ public class GameDataServiceImpl implements IGameDataService {
                            """ + cri + """
                                 and hour(order_create_time) < 10 and order_agent_id=0
                                 group by source_system, day, pitcher_id, order_agent_id, account_id, parent_game_id,
-                                         account_type) b
+                                         account_type,game_id) b
                                on a.source_system = b.source_system and a.day = b.day and a.order_agent_id = b.order_agent_id
                 and a.parent_game_id=b.parent_game_id
                      left join (select source_system,
@@ -6133,7 +6136,7 @@ public class GameDataServiceImpl implements IGameDataService {
                                 """ + cri + """
                                 and hour(order_create_time) < 14 and order_agent_id = 0
                                 group by source_system, day, pitcher_id, order_agent_id, account_id, parent_game_id,
-                                         account_type) c
+                                         account_type,game_id) c
                                on a.source_system = c.source_system and a.day = c.day and a.order_agent_id = c.order_agent_id
                 and a.parent_game_id=c.parent_game_id
                      left join (select source_system,
@@ -6148,7 +6151,7 @@ public class GameDataServiceImpl implements IGameDataService {
                                 """ + cri + """
                                 and hour(order_create_time) < 17 and order_agent_id = 0
                                 group by source_system, day, pitcher_id, order_agent_id, account_id, parent_game_id,
-                                         account_type) d
+                                         account_type,game_id) d
                                on a.source_system = d.source_system and a.day = d.day and a.order_agent_id = d.order_agent_id
                 and a.parent_game_id=d.parent_game_id
                 ) f
@@ -6815,6 +6818,18 @@ public class GameDataServiceImpl implements IGameDataService {
         return cri;
     }
 
+    /**
+     * 获取子游戏id
+     */
+    public List<Long> getSubGameId(){
+        //默认子游戏
+        Sql sql = Sqls.create("select id from dm_game_order.t_game where source_system= 'ZX_ONE'");
+        sql.setCallback(Sqls.callback.longs());
+        dao.execute(sql);
+        return sql.getList(Long.class);
+    }
+
+
     /**
      * 拼接查询条件
      *
@@ -6824,6 +6839,13 @@ public class GameDataServiceImpl implements IGameDataService {
     public Criteria getOrderQueryStr(FlowMonitorDTO dto) {
         Criteria cri = Cnd.cri();
 
+        //如果选择子游戏维度,并且没有选择游戏那么就查询所有游戏拼上条件
+        if(dto.getGameDimension()==1&&CollectionUtils.isEmpty(dto.getGameId())){
+           //查询游戏列表
+            List<Long> subGameId = getSubGameId();
+            dto.setGameId(subGameId);
+        }
+
         //SDK类型
         if (StringUtils.isNotBlank(dto.getSourceSystem())) {
             cri.where().andEquals("source_system", dto.getSourceSystem());

+ 32 - 1
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/RoleManageServiceImpl.java

@@ -484,7 +484,10 @@ public class RoleManageServiceImpl implements IRoleManageService {
         //校验游戏id的超父不为2的不让发消息,cp方未提供此功能
         Map<Long, GameDTO> parentGameMap = getParentGameMap();
         GameDTO gameDTO = parentGameMap.get(dto.getGameId());
-        if(gameDTO!=null && gameDTO.getSuperGameId()!=2){
+        Map<Long, SuperGameDTO> superGameMap = getSuperGameMap();
+        SuperGameDTO superGameDTO = superGameMap.get(gameDTO.getSuperGameId());
+        if(superGameDTO!=null
+                && (StringUtils.isEmpty(superGameDTO.getCpSendMsgKey())||StringUtils.isEmpty(superGameDTO.getCpSendMsgUrl()))){
             throw new BaseException(gameDTO.getGameName()+">该游戏不支持发送消息");
         }
         //获取当前用户id
@@ -771,6 +774,20 @@ public class RoleManageServiceImpl implements IRoleManageService {
         return gameDtoList.stream().collect(Collectors.toMap(GameDTO::getId, Function.identity()));
     }
 
+
+    /**
+     * 获取超父游戏列表
+     */
+    private Map<Long, SuperGameDTO> getSuperGameMap(){
+        Sql sql = Sqls.create(getSuperGameSql());
+        sql.setCallback(Sqls.callback.entities());
+        sql.setEntity(dao.getEntity(SuperGameDTO.class));
+        dao.execute(sql);
+        List<SuperGameDTO> gameDtoList = sql.getList(SuperGameDTO.class);
+        //将游戏拼成map key为游戏id,value为游戏名称
+        return gameDtoList.stream().collect(Collectors.toMap(SuperGameDTO::getId, Function.identity()));
+    }
+
     /**
      * 查询发送消息任务结果
      * @param msgTaskResultDto msgTaskResultDto
@@ -864,6 +881,20 @@ public class RoleManageServiceImpl implements IRoleManageService {
                 """;
     }
 
+
+    /**
+     * 查询超父游戏sql
+     * @return String
+     */
+    private String getSuperGameSql() {
+        return """
+                 SELECT
+                            *
+                        FROM dm_game_order.t_game_super
+                        where source_system = 'ZX_ONE'
+                """;
+    }
+
     /**
      * 原始服-父游戏
      * @param dto RoleCombatRankingDTO