|
@@ -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 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:普通用户-投手:自己
|