|
|
@ -109,14 +109,16 @@ public class ScreenService implements IScreenService{ |
|
|
|
gameUserPayDao.insertSelective(gameUserPay); |
|
|
|
} |
|
|
|
//查询该任务下的游戏记录信息
|
|
|
|
GameRecordExample recordExample = new GameRecordExample(); |
|
|
|
recordExample.createCriteria().andTaskIdEqualTo(memberGame.getTaskId()); |
|
|
|
recordExample.setOrderByClause("created_at DESC"); |
|
|
|
List<GameRecord> recordList = gameRecordDao.selectByExample(recordExample); |
|
|
|
if(CollectionUtil.isNotEmpty(recordList)){ |
|
|
|
GameRecord record = recordList.get(0); |
|
|
|
if(record.getGameStatus() != GameConstant.GAME_COMPLETED){ |
|
|
|
throw new BaseException(CodeEnum.GAME_NO_END); |
|
|
|
if(ObjectUtil.isNotNull(memberGame.getTaskId())) { |
|
|
|
GameRecordExample recordExample = new GameRecordExample(); |
|
|
|
recordExample.createCriteria().andTaskIdEqualTo(memberGame.getTaskId()); |
|
|
|
recordExample.setOrderByClause("created_at DESC"); |
|
|
|
List<GameRecord> recordList = gameRecordDao.selectByExample(recordExample); |
|
|
|
if (CollectionUtil.isNotEmpty(recordList)) { |
|
|
|
GameRecord record = recordList.get(0); |
|
|
|
if (record.getGameStatus() != GameConstant.GAME_COMPLETED) { |
|
|
|
throw new BaseException(CodeEnum.GAME_NO_END); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -138,7 +140,7 @@ public class ScreenService implements IScreenService{ |
|
|
|
GameGroup gameGroupBlue = new GameGroup(); |
|
|
|
gameGroupBlue.setId(snowflake.nextId()); |
|
|
|
gameGroupBlue.setRecordId(gameRecord.getId()); |
|
|
|
gameGroupBlue.setName(memberGame.getFirstTeam()); |
|
|
|
gameGroupBlue.setName(memberGame.getSecondTeam()); |
|
|
|
gameGroupDao.insertSelective(gameGroupBlue); |
|
|
|
} |
|
|
|
|
|
|
@ -863,7 +865,7 @@ public class ScreenService implements IScreenService{ |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public ScreenVo.RecordInfo getRecordByTaskId(Long taskId) { |
|
|
|
public ScreenVo.RecordInfo getRecordByTaskId(Long taskId,String gameType) { |
|
|
|
ScreenVo.RecordInfo recordInfo = new ScreenVo.RecordInfo(); |
|
|
|
|
|
|
|
GameRecordExample recordExample = new GameRecordExample(); |
|
|
@ -871,8 +873,22 @@ public class ScreenService implements IScreenService{ |
|
|
|
recordExample.setOrderByClause("created_at DESC"); |
|
|
|
List<GameRecord> gameRecordList = gameRecordDao.selectByExample(recordExample); |
|
|
|
if(CollectionUtil.isNotEmpty(gameRecordList)){ |
|
|
|
recordInfo.setId(gameRecordList.get(0).getId()); |
|
|
|
recordInfo.setGameStatus(gameRecordList.get(0).getGameStatus()); |
|
|
|
if(StrUtil.isNotEmpty(gameType)) { |
|
|
|
for (GameRecord record : gameRecordList) { |
|
|
|
GameUserPay gameUserPay = gameUserPayDao.selectByPrimaryKey(record.getUserPayId()); |
|
|
|
if (ObjectUtil.isNotNull(gameUserPay)) { |
|
|
|
GameType gameType1 = gameTypeDao.selectByPrimaryKey(gameUserPay.getGameTypeId()); |
|
|
|
if (ObjectUtil.isNotNull(gameType1) && gameType.equalsIgnoreCase(gameType1.getCode())) { |
|
|
|
recordInfo.setId(record.getId()); |
|
|
|
recordInfo.setGameStatus(record.getGameStatus()); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}else { |
|
|
|
recordInfo.setId(gameRecordList.get(0).getId()); |
|
|
|
recordInfo.setGameStatus(gameRecordList.get(0).getGameStatus()); |
|
|
|
} |
|
|
|
} |
|
|
|
return recordInfo; |
|
|
|
} |
|
|
|