|
@@ -12,6 +12,9 @@ import com.zanxiang.advertising.tencent.base.rpc.IUserActionSetRpc;
|
|
import com.zanxiang.erp.base.ErpServer;
|
|
import com.zanxiang.erp.base.ErpServer;
|
|
import com.zanxiang.erp.base.rpc.ISysUserRpc;
|
|
import com.zanxiang.erp.base.rpc.ISysUserRpc;
|
|
import com.zanxiang.erp.security.util.SecurityUtil;
|
|
import com.zanxiang.erp.security.util.SecurityUtil;
|
|
|
|
+import com.zanxiang.game.back.base.ServerInfo;
|
|
|
|
+import com.zanxiang.game.back.base.pojo.vo.GameBackPolicyRpcVO;
|
|
|
|
+import com.zanxiang.game.back.base.rpc.IGameBackPolicyRpc;
|
|
import com.zanxiang.game.module.manage.pojo.dto.AgentDTO;
|
|
import com.zanxiang.game.module.manage.pojo.dto.AgentDTO;
|
|
import com.zanxiang.game.module.manage.pojo.enums.AccountTypeEnum;
|
|
import com.zanxiang.game.module.manage.pojo.enums.AccountTypeEnum;
|
|
import com.zanxiang.game.module.manage.pojo.params.AgentAddParam;
|
|
import com.zanxiang.game.module.manage.pojo.params.AgentAddParam;
|
|
@@ -59,6 +62,9 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
|
|
@DubboReference(providedBy = ErpServer.SERVER_DUBBO_NAME)
|
|
@DubboReference(providedBy = ErpServer.SERVER_DUBBO_NAME)
|
|
private ISysUserRpc sysUserRpc;
|
|
private ISysUserRpc sysUserRpc;
|
|
|
|
|
|
|
|
+ @DubboReference(providedBy = ServerInfo.SERVER_DUBBO_NAME)
|
|
|
|
+ private IGameBackPolicyRpc gameBackPolicyRpc;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public IPage<AgentVO> listOfPage(AgentListParam param) {
|
|
public IPage<AgentVO> listOfPage(AgentListParam param) {
|
|
IPage<Agent> agentIPage = page(param.toPage(), new LambdaQueryWrapper<Agent>()
|
|
IPage<Agent> agentIPage = page(param.toPage(), new LambdaQueryWrapper<Agent>()
|
|
@@ -110,7 +116,7 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
|
|
return update(new LambdaUpdateWrapper<Agent>()
|
|
return update(new LambdaUpdateWrapper<Agent>()
|
|
.set(Agent::getPutStatus, putStatus)
|
|
.set(Agent::getPutStatus, putStatus)
|
|
.set(Agent::getUpdateBy, SecurityUtil.getUserId())
|
|
.set(Agent::getUpdateBy, SecurityUtil.getUserId())
|
|
- .set(Agent::getUpdateTime, agentIdList)
|
|
|
|
|
|
+ .set(Agent::getUpdateTime, LocalDateTime.now())
|
|
.in(Agent::getId, agentIdList)
|
|
.in(Agent::getId, agentIdList)
|
|
);
|
|
);
|
|
}
|
|
}
|
|
@@ -121,7 +127,7 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
|
|
return update(new LambdaUpdateWrapper<Agent>()
|
|
return update(new LambdaUpdateWrapper<Agent>()
|
|
.set(Agent::getBackPolicyId, backPolicyId)
|
|
.set(Agent::getBackPolicyId, backPolicyId)
|
|
.set(Agent::getUpdateBy, SecurityUtil.getUserId())
|
|
.set(Agent::getUpdateBy, SecurityUtil.getUserId())
|
|
- .set(Agent::getUpdateTime, agentIdList)
|
|
|
|
|
|
+ .set(Agent::getUpdateTime, LocalDateTime.now())
|
|
.in(Agent::getId, agentIdList)
|
|
.in(Agent::getId, agentIdList)
|
|
);
|
|
);
|
|
}
|
|
}
|
|
@@ -133,12 +139,16 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
|
|
Set<Long> gameIds = new HashSet<>(agentList.size());
|
|
Set<Long> gameIds = new HashSet<>(agentList.size());
|
|
Set<Long> txAccountIds = new HashSet<>(agentList.size());
|
|
Set<Long> txAccountIds = new HashSet<>(agentList.size());
|
|
Set<Long> userIds = new HashSet<>(1);
|
|
Set<Long> userIds = new HashSet<>(1);
|
|
|
|
+ Set<Long> backPolicyIds = new HashSet<>();
|
|
agentList.forEach(agent -> {
|
|
agentList.forEach(agent -> {
|
|
gameIds.add(agent.getGameId());
|
|
gameIds.add(agent.getGameId());
|
|
if (AccountTypeEnum.TENCENT.getValue().equals(agent.getAccountType())) {
|
|
if (AccountTypeEnum.TENCENT.getValue().equals(agent.getAccountType())) {
|
|
txAccountIds.add(agent.getAccountId());
|
|
txAccountIds.add(agent.getAccountId());
|
|
}
|
|
}
|
|
userIds.add(agent.getCreateBy());
|
|
userIds.add(agent.getCreateBy());
|
|
|
|
+ if (agent.getBackPolicyId() != null) {
|
|
|
|
+ backPolicyIds.add(agent.getBackPolicyId());
|
|
|
|
+ }
|
|
});
|
|
});
|
|
Map<String, UserActionSetRpcVO> userActionSetMap = new HashMap<>();
|
|
Map<String, UserActionSetRpcVO> userActionSetMap = new HashMap<>();
|
|
if (CollectionUtils.isNotEmpty(txAccountIds)) {
|
|
if (CollectionUtils.isNotEmpty(txAccountIds)) {
|
|
@@ -150,6 +160,10 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
|
|
userActionSetMap.putAll(userActionSetList.stream().collect(Collectors.toMap(obj -> obj.getAccountId() + "_" + obj.getUserActionSetId(), Function.identity())));
|
|
userActionSetMap.putAll(userActionSetList.stream().collect(Collectors.toMap(obj -> obj.getAccountId() + "_" + obj.getUserActionSetId(), Function.identity())));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ Map<Long, GameBackPolicyRpcVO> backPolicyMap = new HashMap<>(0);
|
|
|
|
+ if (CollectionUtils.isNotEmpty(backPolicyIds)) {
|
|
|
|
+ backPolicyMap.putAll(gameBackPolicyRpc.listByIds(new ArrayList<>(backPolicyIds)).getData());
|
|
|
|
+ }
|
|
Map<Long, GameInfoVO> gameMap = gameService.infoByIds(gameIds).stream().collect(Collectors.toMap(GameInfoVO::getId, Function.identity()));
|
|
Map<Long, GameInfoVO> gameMap = gameService.infoByIds(gameIds).stream().collect(Collectors.toMap(GameInfoVO::getId, Function.identity()));
|
|
Map<Long, String> userMap = sysUserRpc.getUserNameByIds(new ArrayList<>(userIds)).getData();
|
|
Map<Long, String> userMap = sysUserRpc.getUserNameByIds(new ArrayList<>(userIds)).getData();
|
|
return agentList.stream().map(agent -> {
|
|
return agentList.stream().map(agent -> {
|
|
@@ -159,6 +173,9 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
|
|
vo.setUserActionSet(userActionSetMap.get(agent.getAccountId() + "_" + agent.getUserActionSetId()));
|
|
vo.setUserActionSet(userActionSetMap.get(agent.getAccountId() + "_" + agent.getUserActionSetId()));
|
|
}
|
|
}
|
|
vo.setCreateByName(userMap.get(agent.getCreateBy()));
|
|
vo.setCreateByName(userMap.get(agent.getCreateBy()));
|
|
|
|
+ if (agent.getBackPolicyId() != null) {
|
|
|
|
+ vo.setBackPolicyInfo(backPolicyMap.get(agent.getBackPolicyId()));
|
|
|
|
+ }
|
|
return vo;
|
|
return vo;
|
|
}).collect(Collectors.toList());
|
|
}).collect(Collectors.toList());
|
|
}
|
|
}
|
|
@@ -167,7 +184,7 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
|
|
public List<AgentDTO> listUserAgent(String account, String pitcherId, Long agentId) {
|
|
public List<AgentDTO> listUserAgent(String account, String pitcherId, Long agentId) {
|
|
List<Agent> agentList;
|
|
List<Agent> agentList;
|
|
//超管权限
|
|
//超管权限
|
|
- if (SecurityUtil.isAdmin()) {
|
|
|
|
|
|
+ if (SecurityUtil.isManager()) {
|
|
agentList = super.list(new LambdaQueryWrapper<Agent>()
|
|
agentList = super.list(new LambdaQueryWrapper<Agent>()
|
|
.eq(Strings.isNotBlank(account), Agent::getAccountId, account)
|
|
.eq(Strings.isNotBlank(account), Agent::getAccountId, account)
|
|
.eq(Strings.isNotBlank(pitcherId), Agent::getCreateBy, pitcherId)
|
|
.eq(Strings.isNotBlank(pitcherId), Agent::getCreateBy, pitcherId)
|
|
@@ -194,7 +211,7 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
|
|
@Override
|
|
@Override
|
|
public List<AgentAccountChoiceVO> agentAccountChoiceList() {
|
|
public List<AgentAccountChoiceVO> agentAccountChoiceList() {
|
|
return super.list(new LambdaQueryWrapper<Agent>()
|
|
return super.list(new LambdaQueryWrapper<Agent>()
|
|
- .eq(!SecurityUtil.isAdmin(), Agent::getCreateBy, SecurityUtil.getUserId())
|
|
|
|
|
|
+ .eq(!SecurityUtil.isManager(), Agent::getCreateBy, SecurityUtil.getUserId())
|
|
).stream().map(agent -> BeanUtil.copy(agent, AgentAccountChoiceVO.class)).collect(Collectors.toList());
|
|
).stream().map(agent -> BeanUtil.copy(agent, AgentAccountChoiceVO.class)).collect(Collectors.toList());
|
|
}
|
|
}
|
|
}
|
|
}
|