|
@@ -25,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -57,6 +58,9 @@ public class AppGameBettingController extends BaseController{
|
|
|
@Autowired
|
|
|
private AppAgentGameBettingTask appAgentGameBettingTask;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IAppGameMoneyService appGameMoneyService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private RedisCache redisCache;
|
|
|
|
|
@@ -85,6 +89,20 @@ public class AppGameBettingController extends BaseController{
|
|
|
gameBetting.setBettingGameType(0);
|
|
|
}
|
|
|
|
|
|
+ if(gameBetting.getMoneyId() == null){
|
|
|
+ return HttpRet.fail("金额ID为空。");
|
|
|
+ }
|
|
|
+
|
|
|
+ AppGameMoney appGameMoney = appGameMoneyService.selectAppGameMoneyById(gameBetting.getId());
|
|
|
+
|
|
|
+ if(appGameMoney == null){
|
|
|
+ return HttpRet.fail("金额对象不存在。");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(appGameMoney.getBettingMoney().doubleValue() != gameBetting.getBettingAmount().doubleValue()){
|
|
|
+ return HttpRet.fail("投注金额不匹配,无法下单。");
|
|
|
+ }
|
|
|
+
|
|
|
AppGameClassify appGameClassify = appGameClassifyService.selectAppGameClassifyById(gameBetting.getClassId());
|
|
|
if(appGameClassify == null){
|
|
|
return HttpRet.fail("游戏平台不存在。");
|
|
@@ -99,6 +117,10 @@ public class AppGameBettingController extends BaseController{
|
|
|
return HttpRet.fail("游戏已下线,无法下单。");
|
|
|
}
|
|
|
|
|
|
+ if(appGame.getEnable() == 1){
|
|
|
+ return HttpRet.fail("游戏已禁用,无法下单。");
|
|
|
+ }
|
|
|
+
|
|
|
if(StringUtils.isBlank(appGame.getGameDate())){
|
|
|
return HttpRet.fail("游戏期号不存在,无法下单。");
|
|
|
}
|
|
@@ -117,8 +139,17 @@ public class AppGameBettingController extends BaseController{
|
|
|
return HttpRet.fail("游戏已封盘,无法下单。");
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ Integer bettingCount = appGameBettingService.getBettingCount(gameBetting.getUserId(), gameBetting.getGameId(), gameBetting.getGameDate());
|
|
|
+ if(bettingCount != null && bettingCount > 0){
|
|
|
+ if(bettingCount.intValue() > appGame.getBettingCount().intValue()){
|
|
|
+ return HttpRet.fail("投注次数已超过限额,无法下单。");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 单选
|
|
|
if(gameBetting.getBettingGameType() == 0){
|
|
|
+
|
|
|
AppGameItem appGameItem = appGameItemService.selectAppGameItemByGameIdAndItemLocation(appGame.getId(), gameBetting.getBettingItem());
|
|
|
if(appGameItem == null){
|
|
|
return HttpRet.fail("游戏选项不存在,无法下单。");
|
|
@@ -132,6 +163,13 @@ public class AppGameBettingController extends BaseController{
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ BigDecimal bettingAmountCheck = new BigDecimal(appGameItem.getBettingMoney() + "");
|
|
|
+ BigDecimal bettingAmountSum = appGameBettingService.getBettingAmount(gameBetting.getUserId(), gameBetting.getGameId(), gameBetting.getGameDate(), gameBetting.getBettingItem());
|
|
|
+ BigDecimal bettingAmountAdd = bettingAmountSum.add(new BigDecimal(gameBetting.getBettingAmount() + ""));
|
|
|
+ if(bettingAmountAdd.compareTo(bettingAmountCheck) == 1){
|
|
|
+ return HttpRet.fail("投注金额已超过限额,无法下单。");
|
|
|
+ }
|
|
|
+
|
|
|
gameBetting.setBettingMultiple(appGameItem.getItemMultiple());
|
|
|
// 多选
|
|
|
}else if(gameBetting.getBettingGameType() == 1 || gameBetting.getBettingGameType() == 2){
|