|
@@ -81,6 +81,88 @@ public class AppGameBettingTask {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ if(type == 4){
|
|
|
+
|
|
|
+ String gameCode = null;
|
|
|
+ String gameDate = null;
|
|
|
+ String gameLotteryBet = null;
|
|
|
+ for (int i = 0; i < dataArry.size(); i++) {
|
|
|
+ JSONObject jsonObject = dataArry.getJSONObject(i);
|
|
|
+ if(jsonObject.containsKey("id")){
|
|
|
+ gameCode = jsonObject.getString("id");
|
|
|
+ }
|
|
|
+ if(jsonObject.containsKey("gameDate")){
|
|
|
+ gameDate = jsonObject.getString("gameDate");
|
|
|
+ }
|
|
|
+ if(jsonObject.containsKey("gameLotteryBet")){
|
|
|
+ gameLotteryBet = jsonObject.getString("gameLotteryBet");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isBlank(gameCode)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isBlank(gameDate)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isBlank(gameLotteryBet)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ AppGame appGame = appGameService.selectAppGameByCode(gameCode);
|
|
|
+ if(appGame == null){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ String redisKey = CacheConstants.GAME_LOTTERY_ITEM_MULTIPLE.concat(appGame.getId() + ":" + gameCode);
|
|
|
+ if(!redisCache.redisTemplate.opsForValue().setIfAbsent(redisKey, 1)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+
|
|
|
+ gameLotteryBet = gameLotteryBet.replace(" ", "").trim();
|
|
|
+ JSONArray items = JSONArray.parseArray(gameLotteryBet);
|
|
|
+ if(items == null || items.isEmpty()){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ AppGameItem appGameItem = new AppGameItem();
|
|
|
+ appGameItem.setGameId(appGame.getId());
|
|
|
+ List<AppGameItem> itemList = appGameItemService.selectAppGameItemList(appGameItem);
|
|
|
+
|
|
|
+ if(itemList == null || itemList.isEmpty()){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(itemList.size() != items.size()){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ AppGameItemMultiple appGameItemMultiple = new AppGameItemMultiple();
|
|
|
+ appGameItemMultiple.setGameId(appGame.getId());
|
|
|
+ appGameItemMultiple.setGameDate(gameDate);
|
|
|
+ appGameItemMultiple.setItemMultiple(gameLotteryBet.substring(1, gameLotteryBet.length() - 1));
|
|
|
+ appGameItemMultipleService.save(appGameItemMultiple);
|
|
|
+
|
|
|
+
|
|
|
+ itemList.stream().sorted(Comparator.comparing(AppGameItem::getItemLocation));
|
|
|
+
|
|
|
+ for (int j = 0; j < itemList.size(); j++) {
|
|
|
+ AppGameItem gameItem = itemList.get(j);
|
|
|
+ gameItem.setItemMultiple(items.getDouble(j));
|
|
|
+ appGameItemService.updateAppGameItem(gameItem);
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }finally {
|
|
|
+ redisCache.redisTemplate.delete(redisKey);
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
if(type == 1){
|
|
|
|
|
@@ -218,64 +300,6 @@ public class AppGameBettingTask {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- if(type == 4){
|
|
|
-
|
|
|
- String redisKey = CacheConstants.GAME_LOTTERY_ITEM_MULTIPLE.concat(appGame.getId() + ":" + gameCode);
|
|
|
- if(!redisCache.redisTemplate.opsForValue().setIfAbsent(redisKey, 1)){
|
|
|
- continue;
|
|
|
- }
|
|
|
- try {
|
|
|
-
|
|
|
- if(gameCode.equals(Common.GAME_ONE_CODE)){
|
|
|
-
|
|
|
- String gameLotteryBet = gameLotteryObject.getString("gameLotteryBet");
|
|
|
- if(StringUtils.isBlank(gameLotteryBet)){
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- gameLotteryBet = gameLotteryBet.replace(" ", "").trim();
|
|
|
- JSONArray items = JSONArray.parseArray(gameLotteryBet);
|
|
|
- if(items == null || items.isEmpty()){
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- AppGameItem appGameItem = new AppGameItem();
|
|
|
- appGameItem.setGameId(appGame.getId());
|
|
|
- List<AppGameItem> itemList = appGameItemService.selectAppGameItemList(appGameItem);
|
|
|
-
|
|
|
- if(itemList == null || itemList.isEmpty()){
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- if(itemList.size() != items.size()){
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- AppGameItemMultiple appGameItemMultiple = new AppGameItemMultiple();
|
|
|
- appGameItemMultiple.setGameId(appGame.getId());
|
|
|
- appGameItemMultiple.setGameDate(gameDate);
|
|
|
- appGameItemMultiple.setItemMultiple(gameLotteryBet.substring(1, gameLotteryBet.length() - 1));
|
|
|
- appGameItemMultipleService.save(appGameItemMultiple);
|
|
|
-
|
|
|
-
|
|
|
- itemList.stream().sorted(Comparator.comparing(AppGameItem::getItemLocation));
|
|
|
-
|
|
|
- for (int j = 0; j < itemList.size(); j++) {
|
|
|
- AppGameItem gameItem = itemList.get(j);
|
|
|
- gameItem.setItemMultiple(items.getDouble(j));
|
|
|
- appGameItemService.updateAppGameItem(gameItem);
|
|
|
- }
|
|
|
- }
|
|
|
- }catch (Exception e){
|
|
|
- e.printStackTrace();
|
|
|
- }finally {
|
|
|
- redisCache.redisTemplate.delete(redisKey);
|
|
|
- }
|
|
|
-
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
if(type == 3){
|
|
|
|
|
|
String redisKey = CacheConstants.GAME_LOTTERY_TASK_CREATE.concat(appGame.getId() + ":" + gameCode);
|