|
@@ -71,22 +71,16 @@ public class GameServerServiceImpl extends ServiceImpl<GameServerMapper, GameSer
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public Boolean gameServerAssign(GameServerAssignParam param) {
|
|
|
- GameServer gameServer = super.getById(param.getId());
|
|
|
- if (gameServer == null) {
|
|
|
+ public Boolean gameServerAssignBatch(GameServerAssignParam param) {
|
|
|
+ List<GameServer> gameServerList = super.listByIds(param.getIdList());
|
|
|
+ if (CollectionUtils.isEmpty(gameServerList)) {
|
|
|
throw new BaseException("参数错误, 区服信息不存在");
|
|
|
}
|
|
|
- //删除指派的参数判断
|
|
|
- if (CollectionUtils.isEmpty(param.getAssignUserIdList())) {
|
|
|
- if (Objects.equals(param.getAssignType(), GameServerAssignEnum.GAME_SERVER_ASSIGN_GS)
|
|
|
- && Strings.isBlank(gameServer.getGsIds())) {
|
|
|
- throw new BaseException("无效操作, 区服GS指派为空, 不可更新为空");
|
|
|
- }
|
|
|
- if (Objects.equals(param.getAssignType(), GameServerAssignEnum.GAME_SERVER_ASSIGN_CUSTOMER)
|
|
|
- && Strings.isBlank(gameServer.getCustomerIds())) {
|
|
|
- throw new BaseException("无效操作, 区服客服指派为空, 不可更新为空");
|
|
|
- }
|
|
|
- }
|
|
|
+ gameServerList.forEach(gameServer -> this.gameServerAssign(param, gameServer));
|
|
|
+ return Boolean.TRUE;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void gameServerAssign(GameServerAssignParam param, GameServer gameServer) {
|
|
|
//老的指派人员id
|
|
|
String oldUserIds = null;
|
|
|
if (Objects.equals(param.getAssignType(), GameServerAssignEnum.GAME_SERVER_ASSIGN_GS)) {
|
|
@@ -104,13 +98,13 @@ public class GameServerServiceImpl extends ServiceImpl<GameServerMapper, GameSer
|
|
|
}
|
|
|
//更新区服信息
|
|
|
super.update(new LambdaUpdateWrapper<GameServer>()
|
|
|
- .eq(GameServer::getId, param.getId())
|
|
|
+ .eq(GameServer::getId, gameServer.getId())
|
|
|
.set(Objects.equals(param.getAssignType(), GameServerAssignEnum.GAME_SERVER_ASSIGN_GS),
|
|
|
GameServer::getGsIds, userIds)
|
|
|
.set(Objects.equals(param.getAssignType(), GameServerAssignEnum.GAME_SERVER_ASSIGN_CUSTOMER),
|
|
|
GameServer::getCustomerIds, userIds));
|
|
|
//新增保存指派记录
|
|
|
- return gameServerAssignLogService.save(GameServerAssignLog.builder()
|
|
|
+ gameServerAssignLogService.save(GameServerAssignLog.builder()
|
|
|
.serverId(gameServer.getServerId())
|
|
|
.assignType(param.getAssignType().getValue())
|
|
|
.oldUserIds(oldUserIds)
|