2 Commits da332db334 ... 0c01e9919a

Author SHA1 Message Date
  Letianhua 0c01e9919a Merge remote-tracking branch 'origin/package' into package 1 year ago
  Letianhua 04c5a479db 用户详情-空结果处理;游戏权限修改-IOS通包 1 year ago

+ 53 - 9
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/component/DataPowerComponent.java

@@ -14,12 +14,16 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.dubbo.config.annotation.DubboReference;
+import org.nutz.dao.Cnd;
+import org.nutz.dao.Dao;
+import org.nutz.dao.Sqls;
+import org.nutz.dao.sql.Criteria;
+import org.nutz.dao.sql.Sql;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
+import java.util.*;
+import java.util.stream.Collectors;
 
 @Slf4j
 @Component
@@ -31,6 +35,9 @@ public class DataPowerComponent {
     @DubboReference(providedBy = ServerInfo.SERVER_DUBBO_NAME)
     private GameAuthRpc gameAuthRpc;
 
+    @Autowired
+    private Dao dao;
+
     public Tuple2<List<Long>, List<Long>> getPowerInfo() {
         return getPowerInfo("ZX_ONE");
     }
@@ -54,7 +61,9 @@ public class DataPowerComponent {
             return Tuple2.with(new ArrayList<>(subUserIds), null);
         }
         GameAuthUserVO userGameInfo = gameAuthRpc.getGameAuthByUserIds().getData();
-        if (CollectionUtils.isEmpty(userGameInfo.getGameIdList())) {
+        //原有的游戏ID添加通包游戏的权限
+        List<Long> gameIds = getFullGameIdList(userGameInfo.getGameIdList());
+        if (CollectionUtils.isEmpty(gameIds)) {
             throw new BaseException("没有游戏查看权限,请联系管理员指派游戏权限");
         }
         GameAuthEnum gameAuth = userGameInfo.getGameAuthEnum();
@@ -66,22 +75,22 @@ public class DataPowerComponent {
                 return Tuple2.with(null, null);
             } else if (gameAuth == GameAuthEnum.OPERATE || gameAuth == GameAuthEnum.CUSTOMER || gameAuth == GameAuthEnum.GS) {
                 // 运营
-                return Tuple2.with(null, userGameInfo.getGameIdList());
+                return Tuple2.with(null, gameIds);
             } else {
                 // 投手
-                return Tuple2.with(new ArrayList<>(subUserIds), userGameInfo.getGameIdList());
+                return Tuple2.with(new ArrayList<>(subUserIds), gameIds);
             }
         } else {
             if (gameAuth == GameAuthEnum.MANAGE) {
                 return Tuple2.with(null, null);
             } else if (gameAuth == GameAuthEnum.OPERATE || gameAuth == GameAuthEnum.CUSTOMER || gameAuth == GameAuthEnum.GS) {
                 // 运营组长
-                return Tuple2.with(null, userGameInfo.getGameIdList());
+                return Tuple2.with(null, gameIds);
             } else {
                 // 投手组长
                 // 自然量
                 subUserIds.add(0L);
-                return Tuple2.with(new ArrayList<>(subUserIds), userGameInfo.getGameIdList());
+                return Tuple2.with(new ArrayList<>(subUserIds), gameIds);
             }
         }
     }
@@ -127,4 +136,39 @@ public class DataPowerComponent {
         }
         return gameIdList;
     }
+
+    /**
+     * 获取全量的游戏ID(补全虚拟的IOS包游戏ID)
+     * @param gameIds 用户拥有的游戏权限的游戏ID
+     * @return 游戏ID
+     */
+    public List<Long> getFullGameIdList(List<Long> gameIds) {
+        //查询条件
+        Criteria cri = Cnd.cri();
+        if (CollectionUtils.isEmpty(gameIds)) {
+            return null;
+        } else {
+            cri.where().andInList("id", gameIds);
+        }
+        cri.where().andEquals("source_system", "ZX_ONE");
+        cri.where().andEquals("is_common_game", 1);
+        Sql sql = Sqls.create("""
+                SELECT
+                    guide_game_ids
+                FROM dm_game_order.t_game
+                """ + cri);
+        sql.setCallback(Sqls.callback.strList());
+        dao.execute(sql);
+        List<String> strList = sql.getList(String.class);
+        if (CollectionUtils.isEmpty(strList)) {
+            return gameIds;
+        }
+        for (String str : strList) {
+            gameIds.addAll(Arrays.stream(str.split(",")).
+                    map(gameId -> Long.parseLong(gameId) + 10000).toList());
+        }
+        return gameIds;
+    }
+
+
 }

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

@@ -31,7 +31,7 @@ public class GamePromoteDayDTO extends BasePage {
     private String cpName;
 
     @ApiModelProperty(notes = "游戏id")
-    private List<Long> gameId;
+    private Long gameId;
     @ApiModelProperty(notes = "游戏名")
     private String gameName;
     @ApiModelProperty(notes = "游戏应用类型")

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

@@ -29,7 +29,7 @@ public class GamePromoteDayTotalDTO {
     private String cpName;
 
     @ApiModelProperty(notes = "游戏id")
-    private List<Long> gameId;
+    private Long gameId;
 
     @ApiModelProperty(notes = "游戏名")
     private String gameName;

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

@@ -54,7 +54,7 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
     public Page<GamePromoteDayVO> accountAgentDay(GamePromoteDayDTO dto) {
         Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo(dto.getSourceSystem());
         List<Long> userIds = StringUtils.isBlank(dto.getSysUserId()) ? poerInfo.first : List.of(Long.valueOf(dto.getSysUserId()));
-        List<Long> gameIds = CollectionUtils.isEmpty(dto.getGameId()) ? poerInfo.second : dto.getGameId();
+        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : List.of(dto.getGameId());
 
         if (null == dto.getBeginDay() || null == dto.getEndDay()) {
             dto.setBeginDay(LocalDate.now());
@@ -265,7 +265,7 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
     public GamePromoteDayTotalVO accountAgentDayTotal(GamePromoteDayTotalDTO dto) {
         Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo(dto.getSourceSystem());
         List<Long> userIds = StringUtils.isBlank(dto.getSysUserId()) ? poerInfo.first : List.of(Long.valueOf(dto.getSysUserId()));
-        List<Long> gameIds = CollectionUtils.isEmpty(dto.getGameId()) ? poerInfo.second : dto.getGameId();
+        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : List.of(dto.getGameId());
 
         if (null == dto.getBeginDay() || null == dto.getEndDay()) {
             dto.setBeginDay(LocalDate.now());