|
|
@ -7,6 +7,7 @@ import cn.hutool.core.lang.Snowflake; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.ccsens.cloudutil.bean.tall.dto.WpsDto; |
|
|
|
import com.ccsens.cloudutil.feign.TallFeignClient; |
|
|
|
import com.ccsens.game.bean.dto.ClientDto; |
|
|
@ -253,13 +254,13 @@ public class ScreenService implements IScreenService { |
|
|
|
if(ObjectUtil.isNotNull(groupRow)){ |
|
|
|
String groupName = ExcelUtil.getCellValue(groupRow.getCell(0)); |
|
|
|
String groupUrl = ExcelUtil.getCellValue(groupRow.getCell(1)); |
|
|
|
if(ObjectUtil.isNotNull(groupName)){ |
|
|
|
if(StrUtil.isNotEmpty(groupName)){ |
|
|
|
GameGroup gameGroup = new GameGroup(); |
|
|
|
gameGroup.setId(snowflake.nextId()); |
|
|
|
gameGroup.setRecordId(gameRecord.getId()); |
|
|
|
gameGroup.setName(groupName); |
|
|
|
// gameGroup.setCode(GameConstant.FIRST_GROUP);
|
|
|
|
if(ObjectUtil.isNotNull(groupUrl)){ |
|
|
|
if(StrUtil.isNotEmpty(groupUrl)){ |
|
|
|
gameGroup.setHeadPortraitUrl(groupUrl); |
|
|
|
} |
|
|
|
gameGroupDao.insertSelective(gameGroup); |
|
|
@ -280,14 +281,16 @@ public class ScreenService implements IScreenService { |
|
|
|
recordExample.setOrderByClause("created_at DESC"); |
|
|
|
List<GameRecord> recordList = gameRecordDao.selectByExample(recordExample); |
|
|
|
if (CollectionUtil.isNotEmpty(recordList)) { |
|
|
|
GameRecord record1 = new GameRecord(); |
|
|
|
GameRecord record = recordList.get(0); |
|
|
|
if(record.getGameStatus() == GameConstant.GAME_PREPARATION || |
|
|
|
record.getGameStatus() == GameConstant.GAME_PROCESSING){ |
|
|
|
throw new BaseException(CodeEnum.GAME_NO_END); |
|
|
|
} |
|
|
|
if(record.getGameStatus() == GameConstant.GAME_PENDING){ |
|
|
|
record.setGameStatus(GameConstant.GAME_COMPLETED); |
|
|
|
gameRecordDao.updateByPrimaryKeySelective(record); |
|
|
|
record1.setId(record.getId()); |
|
|
|
record1.setGameStatus(GameConstant.GAME_COMPLETED); |
|
|
|
gameRecordDao.updateByPrimaryKeySelective(record1); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -590,6 +593,22 @@ public class ScreenService implements IScreenService { |
|
|
|
* 进行中查询每个组的信息 |
|
|
|
*/ |
|
|
|
private List<ScreenVo.GroupVo> getGroupScore2(GameRecord gameRecord) { |
|
|
|
String groupKey = gameRecord.getId() + "_group"; |
|
|
|
Set<ZSetOperations.TypedTuple<Object>> typedTuples = redisUtil.zsRevGetWithScore(groupKey, 0, -1); |
|
|
|
if(CollectionUtil.isNotEmpty(typedTuples)){ |
|
|
|
List<ScreenVo.GroupVo> vos = new ArrayList<>(); |
|
|
|
typedTuples.forEach(type -> { |
|
|
|
GameGroup gameGroup = JSON.parseObject((String)type.getValue(), GameGroup.class); |
|
|
|
int score = type.getScore().intValue(); |
|
|
|
ScreenVo.GroupVo groupVo = new ScreenVo.GroupVo(); |
|
|
|
groupVo.setGroupId(gameGroup.getId()); |
|
|
|
groupVo.setGroupName(gameGroup.getName()); |
|
|
|
groupVo.setScore(score); |
|
|
|
groupVo.setHeadPortraitUrl(gameGroup.getHeadPortraitUrl()); |
|
|
|
vos.add(groupVo); |
|
|
|
}); |
|
|
|
return vos; |
|
|
|
} |
|
|
|
List<ScreenVo.GroupVo> vos = gameGroupDao.queryGroups(gameRecord.getId()); |
|
|
|
if (CollectionUtil.isEmpty(vos) || gameRecord.getRankRule() == GameConstant.RANK_RULE_TOTAL) { |
|
|
|
return vos; |
|
|
@ -1028,6 +1047,15 @@ public class ScreenService implements IScreenService { |
|
|
|
gameRecordDao.updateByPrimaryKeySelective(gameRecord); |
|
|
|
//设置redis 游戏状态 准备中
|
|
|
|
redisUtil.set(GameConstant.generateGameStatusKey(gameRecord.getId()), JSON.toJSONString(gameRecord), GameConstant.REDIS_TIME); |
|
|
|
String groupKey = gameRecord.getId() + "_group"; |
|
|
|
GameGroupExample groupExample = new GameGroupExample(); |
|
|
|
groupExample.createCriteria().andRecordIdEqualTo(gameRecord.getId()); |
|
|
|
List<GameGroup> gameGroupList = gameGroupDao.selectByExample(groupExample); |
|
|
|
if(CollectionUtil.isNotEmpty(gameGroupList)){ |
|
|
|
gameGroupList.forEach(gameGroup -> { |
|
|
|
redisUtil.zsSet(groupKey, JSONObject.toJSONString(gameGroup),0,600); |
|
|
|
}); |
|
|
|
} |
|
|
|
//再玩一次
|
|
|
|
if (start.getStartStatus() != null && start.getStartStatus().byteValue() == GameConstant.GAME_RESTART_STATUS) { |
|
|
|
//再玩一次,设置参见的用户为无效用户
|
|
|
@ -1200,7 +1228,7 @@ public class ScreenService implements IScreenService { |
|
|
|
|
|
|
|
GameRecordExample recordExample = new GameRecordExample(); |
|
|
|
recordExample.createCriteria().andTaskIdEqualTo(taskId); |
|
|
|
recordExample.setOrderByClause("created_at DESC"); |
|
|
|
recordExample.setOrderByClause("id DESC"); |
|
|
|
List<GameRecord> gameRecordList = gameRecordDao.selectByExample(recordExample); |
|
|
|
if (CollectionUtil.isNotEmpty(gameRecordList)) { |
|
|
|
if (StrUtil.isNotEmpty(gameType)) { |
|
|
|