|
|
@ -156,6 +156,10 @@ public class ScreenService implements IScreenService { |
|
|
|
}else if( GameConstant.GAME_TYPE_BH.equalsIgnoreCase(memberGame.getGameType())){ |
|
|
|
businessType = 10; |
|
|
|
} |
|
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
|
map.put("businessId",memberGame.getTaskId()); |
|
|
|
map.put("businessType",businessType); |
|
|
|
// String wpsFilePath = (String)RestTemplateUtil.getForEntity(PropUtil.gatewayUrl + PropUtil.getWpsFilePath, map, String.class);
|
|
|
|
String wpsFilePath = tallFeignClient.getWpsFilePath(memberGame.getTaskId(),businessType); |
|
|
|
log.info("游戏配置表的路径:{}",wpsFilePath); |
|
|
|
if(StrUtil.isNotEmpty(wpsFilePath)){ |
|
|
@ -350,118 +354,6 @@ public class ScreenService implements IScreenService { |
|
|
|
return gameUserPay; |
|
|
|
} |
|
|
|
|
|
|
|
// @Override
|
|
|
|
// public ScreenVo.UrlVo getScreenUrl(QueryDto<ScreenDto.MemberGame> params) throws Exception {
|
|
|
|
// ScreenDto.MemberGame memberGame = params.getParam();
|
|
|
|
// //查找游戏
|
|
|
|
// GameType gameType = null;
|
|
|
|
// GameTypeExample gameTypeExample = new GameTypeExample();
|
|
|
|
// gameTypeExample.createCriteria().andCodeEqualTo(memberGame.getGameType());
|
|
|
|
// List<GameType> gameTypeList = gameTypeDao.selectByExample(gameTypeExample);
|
|
|
|
// if (CollectionUtil.isNotEmpty(gameTypeList)) {
|
|
|
|
// gameType = gameTypeList.get(0);
|
|
|
|
// }
|
|
|
|
// if (ObjectUtil.isNull(gameType)) {
|
|
|
|
// throw new BaseException(CodeEnum.NOT_GAME_TYPE);
|
|
|
|
// }
|
|
|
|
// //2、查找此用户购买的此游戏的信息,若没有则添加一条记录,默认已付款,结束时间为添加后的一个月,默认次数为10次
|
|
|
|
// GameUserPay gameUserPay = null;
|
|
|
|
// GameUserPayExample gameUserPayExample = new GameUserPayExample();
|
|
|
|
// gameUserPayExample.createCriteria().andUserIdEqualTo(params.getUserId()).andGameTypeIdEqualTo(gameType.getId());
|
|
|
|
// List<GameUserPay> gameUserPayList = gameUserPayDao.selectByExample(gameUserPayExample);
|
|
|
|
// if (CollectionUtil.isNotEmpty(gameUserPayList)) {
|
|
|
|
// gameUserPay = gameUserPayList.get(0);
|
|
|
|
// } else {
|
|
|
|
// gameUserPay = new GameUserPay();
|
|
|
|
// gameUserPay.setId(snowflake.nextId());
|
|
|
|
// gameUserPay.setUserId(params.getUserId());
|
|
|
|
// gameUserPay.setGameTypeId(gameType.getId());
|
|
|
|
// gameUserPay.setTotalCount(10);
|
|
|
|
// gameUserPay.setUsedCount(0);
|
|
|
|
// gameUserPay.setCreatedTime(System.currentTimeMillis());
|
|
|
|
// gameUserPay.setDueTime(gameUserPay.getCreatedTime() + (3600 * 24 * 30));
|
|
|
|
// gameUserPayDao.insertSelective(gameUserPay);
|
|
|
|
// }
|
|
|
|
// //查询该任务下的游戏记录信息
|
|
|
|
// 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_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);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// //3、根据用户购买的记录,添加一场新的游戏记录
|
|
|
|
// GameRecord gameRecord = new GameRecord();
|
|
|
|
// gameRecord.setId(snowflake.nextId());
|
|
|
|
// gameRecord.setUserPayId(gameUserPay.getId());
|
|
|
|
// gameRecord.setTaskId(memberGame.getTaskId());
|
|
|
|
// //添加路径
|
|
|
|
// String gameUrl = WebConstant.TEST_URL_GAME_SQ;
|
|
|
|
// switch (gameType.getCode()){
|
|
|
|
// case GameConstant.GAME_TYPE_SQ: break;
|
|
|
|
// case GameConstant.GAME_TYPE_SP: gameUrl = WebConstant.TEST_URL_GAME_SP; break;
|
|
|
|
// case GameConstant.GAME_TYPE_BH: gameUrl = WebConstant.TEST_URL_GAME_BH; break;
|
|
|
|
// default:break;
|
|
|
|
// }
|
|
|
|
// gameRecord.setUrl(gameUrl + gameType.getScreenUrl() + "?id=" + gameRecord.getId());
|
|
|
|
// gameRecord.setQrCodeUrl(gameUrl + gameRecord.getId() + File.separator + gameType.getClientUrl());
|
|
|
|
// gameRecordDao.insertSelective(gameRecord);
|
|
|
|
// //4、 判断是否有分组,如果是分组游戏,添加两条分组信息
|
|
|
|
// if (gameType.getIsGroup() == 1) {
|
|
|
|
// GameGroup gameGroupRed = new GameGroup();
|
|
|
|
// gameGroupRed.setId(snowflake.nextId());
|
|
|
|
// gameGroupRed.setRecordId(gameRecord.getId());
|
|
|
|
// gameGroupRed.setName(memberGame.getFirstTeam());
|
|
|
|
// gameGroupRed.setCode(GameConstant.FIRST_GROUP);
|
|
|
|
// gameGroupDao.insertSelective(gameGroupRed);
|
|
|
|
// GameGroup gameGroupBlue = new GameGroup();
|
|
|
|
// gameGroupBlue.setId(snowflake.nextId());
|
|
|
|
// gameGroupBlue.setRecordId(gameRecord.getId());
|
|
|
|
// gameGroupBlue.setName(memberGame.getSecondTeam());
|
|
|
|
// gameGroupBlue.setCode(GameConstant.SECOND_GROUP);
|
|
|
|
// gameGroupDao.insertSelective(gameGroupBlue);
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// //5、查询该游戏的规则
|
|
|
|
// List<String> ruleList = getGameActivityRule(gameType.getId());
|
|
|
|
// //6、返回
|
|
|
|
// ScreenVo.UrlVo urlVo = new ScreenVo.UrlVo();
|
|
|
|
// urlVo.setId(gameRecord.getId());
|
|
|
|
// urlVo.setUrl(gameRecord.getUrl());
|
|
|
|
// urlVo.setRuleList(ruleList);
|
|
|
|
//
|
|
|
|
// //路径(添加项目id)
|
|
|
|
// String url = gameRecord.getUrl() + "&projectId=" + memberGame.getProjectId();
|
|
|
|
// //给所有人发送消息发送消息
|
|
|
|
// ChromeMessageDto chromeMessageDto = new ChromeMessageDto(url, gameRecord.getId(), memberGame.getProjectId(),gameType.getCode());
|
|
|
|
// BaseMessageDto.MessageUser messageUser = null;
|
|
|
|
// List<BaseMessageDto.MessageUser> messageUserList = new ArrayList<>();
|
|
|
|
// //获取项目下所有成员
|
|
|
|
// List<Long> memberIdList = tallFeignClient.getMemberIdListByProject(memberGame.getProjectId());
|
|
|
|
// if (CollectionUtil.isNotEmpty(memberIdList)) {
|
|
|
|
// for (Long memberId : memberIdList) {
|
|
|
|
// messageUser = new BaseMessageDto.MessageUser();
|
|
|
|
// messageUser.setUserId(memberId);
|
|
|
|
// messageUserList.add(messageUser);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// chromeMessageDto.setReceivers(messageUserList);
|
|
|
|
// messageService.sendGameMessageWithGetUrl(chromeMessageDto);
|
|
|
|
//
|
|
|
|
// return urlVo;
|
|
|
|
// }
|
|
|
|
|
|
|
|
/** |
|
|
|
* 获取游戏基本信息 |
|
|
|
* @return 返回游戏基本信息 |
|
|
@ -1384,11 +1276,19 @@ public class ScreenService implements IScreenService { |
|
|
|
businessType = 10; |
|
|
|
} |
|
|
|
//查询该任务是否已有创建的游戏配置
|
|
|
|
List<String> wpsPath; |
|
|
|
List<String> wpsPath = new ArrayList<>(); |
|
|
|
WpsDto.VisitWpsUrl visitWpsUrl = new WpsDto.VisitWpsUrl(); |
|
|
|
visitWpsUrl.setBusinessId(getConfig.getTaskId()); |
|
|
|
visitWpsUrl.setBusinessType(businessType); |
|
|
|
visitWpsUrl.setUserId(params.getUserId()); |
|
|
|
|
|
|
|
// String result = RestTemplateUtil.postBody(PropUtil.gatewayUrl + PropUtil.queryVisitUrls, visitWpsUrl);
|
|
|
|
// log.info("调用tall查看游戏已有配置表:{}",result);
|
|
|
|
// if(StrUtil.isNotEmpty(result)){
|
|
|
|
// JSONObject json = JSONObject.parseObject(result);
|
|
|
|
// wpsPath.add(result);
|
|
|
|
//// wpsPath = (List<String>) json;
|
|
|
|
// }
|
|
|
|
wpsPath = tallFeignClient.queryVisitUrls(visitWpsUrl); |
|
|
|
log.info("是否已有创建的游戏配置:{}",wpsPath); |
|
|
|
//有配置直接返回
|
|
|
@ -1434,7 +1334,13 @@ public class ScreenService implements IScreenService { |
|
|
|
business.setFileSize(tmpFile.length()); |
|
|
|
business.setOperation(WebConstant.Wps.USER_OPERATION_NEW); |
|
|
|
business.setPrivilege(WebConstant.Wps.PROJECT_PRIVILEGE_WRITE); |
|
|
|
// RestTemplateUtil.postBody(PropUtil.gatewayUrl + PropUtil.saveWpsFile, business);
|
|
|
|
tallFeignClient.saveWpsFile(business); |
|
|
|
// String s = RestTemplateUtil.postBody(PropUtil.gatewayUrl + PropUtil.queryVisitUrls, visitWpsUrl);
|
|
|
|
// if(StrUtil.isNotEmpty(s)){
|
|
|
|
// JSONObject json = JSONObject.parseObject(s);
|
|
|
|
// wpsPath = (List<String>) json;
|
|
|
|
// }
|
|
|
|
wpsPath = tallFeignClient.queryVisitUrls(visitWpsUrl); |
|
|
|
return wpsPath; |
|
|
|
} |
|
|
|