|
|
@ -122,10 +122,12 @@ public class ScreenService implements IScreenService{ |
|
|
|
gameGroupBlue.setId(snowflake.nextId()); |
|
|
|
gameGroupBlue.setRecordId(gameRecord.getId()); |
|
|
|
gameGroupBlue.setName("蓝队"); |
|
|
|
gameGroupDao.insertSelective(gameGroupBlue); |
|
|
|
GameGroup gameGroupRed = new GameGroup(); |
|
|
|
gameGroupRed.setId(snowflake.nextId()); |
|
|
|
gameGroupRed.setRecordId(gameRecord.getId()); |
|
|
|
gameGroupRed.setName("红队"); |
|
|
|
gameGroupDao.insertSelective(gameGroupRed); |
|
|
|
} |
|
|
|
|
|
|
|
//5、查询该游戏的规则
|
|
|
@ -336,13 +338,16 @@ public class ScreenService implements IScreenService{ |
|
|
|
List<GameGroup> gameGroupList = gameGroupDao.selectByExample(gameGroupExample); |
|
|
|
if(CollectionUtil.isNotEmpty(gameGroupList)){ |
|
|
|
for(GameGroup gameGroup : gameGroupList){ |
|
|
|
Map<String,Object> group = getGroupTotalScore(gameGroup.getId()); |
|
|
|
List<GameUserJoin> userJoinList = (List<GameUserJoin>) group.get("userJoinList"); |
|
|
|
ScreenVo.GroupVo groupVo = new ScreenVo.GroupVo(); |
|
|
|
groupVo.setGroupId(gameGroup.getId()); |
|
|
|
groupVo.setGroupName(gameGroup.getName()); |
|
|
|
|
|
|
|
Map<String,Object> group = getGroupTotalScore(gameGroup.getId()); |
|
|
|
if(CollectionUtil.isNotEmpty(group)){ |
|
|
|
List<GameUserJoin> userJoinList = (List<GameUserJoin>) group.get("userJoinList"); |
|
|
|
groupVo.setScore((Integer) group.get("totalScore")); |
|
|
|
groupVo.setTotalMembers(userJoinList.size()); |
|
|
|
} |
|
|
|
groupVoList.add(groupVo); |
|
|
|
} |
|
|
|
} |
|
|
@ -740,7 +745,7 @@ public class ScreenService implements IScreenService{ |
|
|
|
joinExample.createCriteria().andRecordIdEqualTo(gameRecord.getId()); |
|
|
|
List<GameUserJoin> userJoins = gameUserJoinDao.selectByExample(joinExample); |
|
|
|
|
|
|
|
if (CollectionUtil.isEmpty(userJoins)) { |
|
|
|
if (CollectionUtil.isNotEmpty(userJoins)) { |
|
|
|
userJoins.forEach( userJoin -> { |
|
|
|
ClientDto.RedisUser user = ClientDto.RedisUser.getInstance(userJoin); |
|
|
|
redisUtil.zsSet(GameConstant.generateGameKey(gameRecord.getId()), JSON.toJSONString(user), 0, GameConstant.REDIS_TIME); |
|
|
@ -822,4 +827,23 @@ public class ScreenService implements IScreenService{ |
|
|
|
} |
|
|
|
return gameTypeId; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<ScreenVo.Group> getGroupByRecordId(Long recordId) { |
|
|
|
List<ScreenVo.Group> groupList = null; |
|
|
|
//获取分组信息
|
|
|
|
GameGroupExample gameGroupExample = new GameGroupExample(); |
|
|
|
gameGroupExample.createCriteria().andRecordIdEqualTo(recordId); |
|
|
|
List<GameGroup> gameGroupList = gameGroupDao.selectByExample(gameGroupExample); |
|
|
|
if(CollectionUtil.isNotEmpty(gameGroupList)){ |
|
|
|
groupList = new ArrayList<>(); |
|
|
|
for(GameGroup gameGroup:gameGroupList){ |
|
|
|
ScreenVo.Group group = new ScreenVo.Group(); |
|
|
|
group.setGroupId(gameGroup.getId()); |
|
|
|
group.setGroupName(gameGroup.getName()); |
|
|
|
groupList.add(group); |
|
|
|
} |
|
|
|
} |
|
|
|
return groupList; |
|
|
|
} |
|
|
|
} |
|
|
|