|
@@ -26,10 +26,9 @@ import org.apache.logging.log4j.util.Strings;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.time.LocalDateTime;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Objects;
|
|
|
+import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
/**
|
|
@@ -79,13 +78,32 @@ public class CallBackServiceImpl implements ICallBackService {
|
|
|
|
|
|
@Override
|
|
|
public Map<String, Object> callBackJudge(CallBackControlParam param, UserData userData) {
|
|
|
- log.error("事件回传判断, param : {}, userData : {}", JsonUtil.toString(param), JsonUtil.toString(userData));
|
|
|
+ log.error("事件回传判断请求, param : {}, userData : {}", JsonUtil.toString(param), JsonUtil.toString(userData));
|
|
|
Map<String, Object> resultMap = new HashMap<>(7);
|
|
|
resultMap.put("callBackTypeEnum", param.getCallBackTypeEnum().getValue());
|
|
|
resultMap.put("userId", userData.getUserId());
|
|
|
resultMap.put("gameId", userData.getGameId());
|
|
|
+
|
|
|
+
|
|
|
+ List<BigDecimal> amountList = new ArrayList<>();
|
|
|
+ amountList.add(new BigDecimal("10.00"));
|
|
|
+ amountList.add(new BigDecimal("20.00"));
|
|
|
+ amountList.add(new BigDecimal("30.00"));
|
|
|
+ resultMap.put("amount", amountList);
|
|
|
+
|
|
|
+
|
|
|
//事件类型枚举
|
|
|
CallBackTypeEnum callBackTypeEnum = param.getCallBackTypeEnum();
|
|
|
+ Game game = gameService.getById(userData.getGameId());
|
|
|
+ //判断游戏状态, 对接上包过程中, 全量回传
|
|
|
+ if (Objects.equals(game.getStatus(), 2)) {
|
|
|
+ resultMap.put("callBack", Boolean.TRUE);
|
|
|
+ if (Objects.equals(callBackTypeEnum, CallBackTypeEnum.CALL_BACK_PAY_ORDER)) {
|
|
|
+ PlatformOrderDTO platformOrderDTO = orderService.getByOrderId(param.getOrderId());
|
|
|
+ resultMap.put("amount", Collections.singletonList(platformOrderDTO.getAmount()));
|
|
|
+ }
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
//线程锁
|
|
|
String lockKey = RedisKeyConstant.CALL_BACK_JUDGE_LOCK + callBackTypeEnum.getValue() + "_" + userData.getUserId();
|
|
|
if (Objects.equals(callBackTypeEnum, CallBackTypeEnum.CALL_BACK_ACTIVATE)) {
|
|
@@ -100,16 +118,6 @@ public class CallBackServiceImpl implements ICallBackService {
|
|
|
resultMap.put("callBack", Boolean.FALSE);
|
|
|
return resultMap;
|
|
|
}
|
|
|
- Game game = gameService.getById(userData.getGameId());
|
|
|
- //判断游戏状态, 对接上包过程中, 全量回传
|
|
|
- if (Objects.equals(game.getStatus(), 2)) {
|
|
|
- resultMap.put("callBack", Boolean.TRUE);
|
|
|
- if (Objects.equals(callBackTypeEnum, CallBackTypeEnum.CALL_BACK_PAY_ORDER)) {
|
|
|
- PlatformOrderDTO platformOrderDTO = orderService.getByOrderId(param.getOrderId());
|
|
|
- resultMap.put("amount", platformOrderDTO.getAmount());
|
|
|
- }
|
|
|
- return resultMap;
|
|
|
- }
|
|
|
//查询玩家
|
|
|
User user = userService.getById(userData.getUserId());
|
|
|
//不存在渠道
|
|
@@ -127,7 +135,6 @@ public class CallBackServiceImpl implements ICallBackService {
|
|
|
resultMap.put("callBack", Boolean.FALSE);
|
|
|
}
|
|
|
//返回结果
|
|
|
- log.error("事件回传判断, param : {}, 返回结果 resultMap : {}", JsonUtil.toString(param), JsonUtil.toString(resultMap));
|
|
|
return resultMap;
|
|
|
}
|
|
|
|