|
@@ -14,12 +14,16 @@ import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
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 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
|
|
@Slf4j
|
|
@Component
|
|
@Component
|
|
@@ -31,6 +35,9 @@ public class DataPowerComponent {
|
|
@DubboReference(providedBy = ServerInfo.SERVER_DUBBO_NAME)
|
|
@DubboReference(providedBy = ServerInfo.SERVER_DUBBO_NAME)
|
|
private GameAuthRpc gameAuthRpc;
|
|
private GameAuthRpc gameAuthRpc;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private Dao dao;
|
|
|
|
+
|
|
public Tuple2<List<Long>, List<Long>> getPowerInfo() {
|
|
public Tuple2<List<Long>, List<Long>> getPowerInfo() {
|
|
return getPowerInfo("ZX_ONE");
|
|
return getPowerInfo("ZX_ONE");
|
|
}
|
|
}
|
|
@@ -54,7 +61,9 @@ public class DataPowerComponent {
|
|
return Tuple2.with(new ArrayList<>(subUserIds), null);
|
|
return Tuple2.with(new ArrayList<>(subUserIds), null);
|
|
}
|
|
}
|
|
GameAuthUserVO userGameInfo = gameAuthRpc.getGameAuthByUserIds().getData();
|
|
GameAuthUserVO userGameInfo = gameAuthRpc.getGameAuthByUserIds().getData();
|
|
- if (CollectionUtils.isEmpty(userGameInfo.getGameIdList())) {
|
|
|
|
|
|
+ //原有的游戏ID添加通包游戏的权限
|
|
|
|
+ List<Long> gameIds = getFullGameIdList(userGameInfo.getGameIdList());
|
|
|
|
+ if (CollectionUtils.isEmpty(gameIds)) {
|
|
throw new BaseException("没有游戏查看权限,请联系管理员指派游戏权限");
|
|
throw new BaseException("没有游戏查看权限,请联系管理员指派游戏权限");
|
|
}
|
|
}
|
|
GameAuthEnum gameAuth = userGameInfo.getGameAuthEnum();
|
|
GameAuthEnum gameAuth = userGameInfo.getGameAuthEnum();
|
|
@@ -66,22 +75,22 @@ public class DataPowerComponent {
|
|
return Tuple2.with(null, null);
|
|
return Tuple2.with(null, null);
|
|
} else if (gameAuth == GameAuthEnum.OPERATE || gameAuth == GameAuthEnum.CUSTOMER || gameAuth == GameAuthEnum.GS) {
|
|
} else if (gameAuth == GameAuthEnum.OPERATE || gameAuth == GameAuthEnum.CUSTOMER || gameAuth == GameAuthEnum.GS) {
|
|
// 运营
|
|
// 运营
|
|
- return Tuple2.with(null, userGameInfo.getGameIdList());
|
|
|
|
|
|
+ return Tuple2.with(null, gameIds);
|
|
} else {
|
|
} else {
|
|
// 投手
|
|
// 投手
|
|
- return Tuple2.with(new ArrayList<>(subUserIds), userGameInfo.getGameIdList());
|
|
|
|
|
|
+ return Tuple2.with(new ArrayList<>(subUserIds), gameIds);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
if (gameAuth == GameAuthEnum.MANAGE) {
|
|
if (gameAuth == GameAuthEnum.MANAGE) {
|
|
return Tuple2.with(null, null);
|
|
return Tuple2.with(null, null);
|
|
} else if (gameAuth == GameAuthEnum.OPERATE || gameAuth == GameAuthEnum.CUSTOMER || gameAuth == GameAuthEnum.GS) {
|
|
} else if (gameAuth == GameAuthEnum.OPERATE || gameAuth == GameAuthEnum.CUSTOMER || gameAuth == GameAuthEnum.GS) {
|
|
// 运营组长
|
|
// 运营组长
|
|
- return Tuple2.with(null, userGameInfo.getGameIdList());
|
|
|
|
|
|
+ return Tuple2.with(null, gameIds);
|
|
} else {
|
|
} else {
|
|
// 投手组长
|
|
// 投手组长
|
|
// 自然量
|
|
// 自然量
|
|
subUserIds.add(0L);
|
|
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;
|
|
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;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|