|
@@ -1,5 +1,6 @@
|
|
|
package com.zanxiang.game.back.serve.service.impl;
|
|
|
|
|
|
+import cn.hutool.http.HttpStatus;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -26,6 +27,7 @@ import com.zanxiang.game.back.serve.service.IGameTencentUserService;
|
|
|
import com.zanxiang.game.back.serve.utils.BackPolicyUtil;
|
|
|
import com.zanxiang.module.util.bean.BeanUtil;
|
|
|
import com.zanxiang.module.util.exception.BaseException;
|
|
|
+import com.zanxiang.module.util.pojo.ResultVO;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
@@ -84,6 +86,7 @@ public class GameBackPolicyServiceImpl extends ServiceImpl<GameBackPolicyMapper,
|
|
|
.createTime(LocalDateTime.now())
|
|
|
.isBack(BackStatusEnum.NO.getBackStatus())
|
|
|
.backPolicyId(dto.getBackPolicyId())
|
|
|
+ .userActionSetId(dto.getUserActionSetId())
|
|
|
.build();
|
|
|
gameTencentOrderService.save(gameTencentOrder);
|
|
|
if (!dto.getOrderStatus().equals(COMPLETE_ORDER) && !dto.getOrderStatus().equals(PURCHASE)) {
|
|
@@ -94,6 +97,7 @@ public class GameBackPolicyServiceImpl extends ServiceImpl<GameBackPolicyMapper,
|
|
|
ActionTypeEnum.PURCHASE.getActionType() : ActionTypeEnum.COMPLETE_ORDER.getActionType();
|
|
|
DataReportOfAppIdRpcDTO dataReportOfAppIdRpcDTO = DataReportOfAppIdRpcDTO.builder()
|
|
|
.appId(dto.getWechatAppId())
|
|
|
+ .userActionSetId(dto.getUserActionSetId())
|
|
|
.action(UserActionRpcDTO.builder()
|
|
|
.actionTime(dto.getOrderStatus().equals(PURCHASE) ? dto.getPayTime() : dto.getRechargeTime())
|
|
|
.actionType(actionType)
|
|
@@ -113,6 +117,7 @@ public class GameBackPolicyServiceImpl extends ServiceImpl<GameBackPolicyMapper,
|
|
|
.orderId(dto.getOrderId())
|
|
|
.wechatAppId(dto.getWechatAppId())
|
|
|
.wechatOpenid(dto.getWechatOpenid())
|
|
|
+ .userActionSetId(dto.getUserActionSetId())
|
|
|
.build();
|
|
|
|
|
|
boolean doBack;
|
|
@@ -132,24 +137,23 @@ public class GameBackPolicyServiceImpl extends ServiceImpl<GameBackPolicyMapper,
|
|
|
).stream().filter(order -> order.getIsBack().equals(BackStatusEnum.SUCCESS.getBackStatus())).count()
|
|
|
).intValue());
|
|
|
}
|
|
|
-
|
|
|
- try {
|
|
|
- if (dto.getOrderStatus().equals(COMPLETE_ORDER) || doBack) {
|
|
|
- userActionSetRpc.reportByAppId(dataReportOfAppIdRpcDTO);
|
|
|
+ if (dto.getOrderStatus().equals(COMPLETE_ORDER) || doBack) {
|
|
|
+ ResultVO<Boolean> result = userActionSetRpc.reportByAppId(dataReportOfAppIdRpcDTO);
|
|
|
+ if (result.getCode() == HttpStatus.HTTP_OK) {
|
|
|
gameTencentOrder.setIsBack(BackStatusEnum.FAILED.getBackStatus());
|
|
|
gameTencentOrderService.updateById(gameTencentOrder);
|
|
|
|
|
|
gameTencentBackLogService.save(gameTencentBackLog);
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("回传腾讯订单失败,失败原因:{}", e.getMessage());
|
|
|
- gameTencentOrder.setBackLog(e.getMessage());
|
|
|
- gameTencentOrder.setIsBack(BackStatusEnum.FAILED.getBackStatus());
|
|
|
- gameTencentOrderService.updateById(gameTencentOrder);
|
|
|
+ } else {
|
|
|
+ log.error("回传腾讯订单失败,失败原因:{}", result.getMsg());
|
|
|
+ gameTencentOrder.setBackLog(result.getMsg());
|
|
|
+ gameTencentOrder.setIsBack(BackStatusEnum.FAILED.getBackStatus());
|
|
|
+ gameTencentOrderService.updateById(gameTencentOrder);
|
|
|
|
|
|
- gameTencentBackLog.setBackLog(e.getMessage());
|
|
|
- gameTencentBackLogService.saveOrUpdate(gameTencentBackLog);
|
|
|
- return false;
|
|
|
+ gameTencentBackLog.setBackLog(result.getMsg());
|
|
|
+ gameTencentBackLogService.saveOrUpdate(gameTencentBackLog);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
@@ -175,6 +179,7 @@ public class GameBackPolicyServiceImpl extends ServiceImpl<GameBackPolicyMapper,
|
|
|
.wechatAppId(dto.getWechatAppId())
|
|
|
.wechatOpenid(dto.getWechatOpenid())
|
|
|
.isBack(BackStatusEnum.NO.getBackStatus())
|
|
|
+ .userActionSetId(dto.getUserActionSetId())
|
|
|
.createTime(LocalDateTime.now())
|
|
|
.build();
|
|
|
gameTencentUserService.save(gameTencentUser);
|
|
@@ -182,6 +187,7 @@ public class GameBackPolicyServiceImpl extends ServiceImpl<GameBackPolicyMapper,
|
|
|
|
|
|
DataReportOfAppIdRpcDTO dataReportOfAppIdRpcDTO = DataReportOfAppIdRpcDTO.builder()
|
|
|
.appId(dto.getWechatAppId())
|
|
|
+ .userActionSetId(dto.getUserActionSetId())
|
|
|
.action(UserActionRpcDTO.builder()
|
|
|
.actionTime(dto.getRegisterTime())
|
|
|
.actionType(ActionTypeEnum.REGISTER.getActionType())
|
|
@@ -200,23 +206,23 @@ public class GameBackPolicyServiceImpl extends ServiceImpl<GameBackPolicyMapper,
|
|
|
.actionType(ActionTypeEnum.REGISTER.getActionType())
|
|
|
.wechatAppId(dto.getWechatAppId())
|
|
|
.wechatOpenid(dto.getWechatOpenid())
|
|
|
+ .userActionSetId(dto.getUserActionSetId())
|
|
|
.build();
|
|
|
- try {
|
|
|
- userActionSetRpc.reportByAppId(dataReportOfAppIdRpcDTO);
|
|
|
- gameTencentUser.setIsBack(BackStatusEnum.SUCCESS.getBackStatus());
|
|
|
- gameTencentUserService.updateById(gameTencentUser);
|
|
|
+ ResultVO<Boolean> result = userActionSetRpc.reportByAppId(dataReportOfAppIdRpcDTO);
|
|
|
+ if (result.getCode() == HttpStatus.HTTP_OK) {
|
|
|
+ gameTencentUser.setIsBack(BackStatusEnum.SUCCESS.getBackStatus());
|
|
|
+ gameTencentUserService.updateById(gameTencentUser);
|
|
|
|
|
|
- gameTencentBackLogService.save(gameTencentBackLog);
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("回传腾讯用户失败,失败原因:{}", e.getMessage());
|
|
|
- gameTencentUser.setBackLog(e.getMessage());
|
|
|
- gameTencentUser.setIsBack(BackStatusEnum.FAILED.getBackStatus());
|
|
|
- gameTencentUserService.updateById(gameTencentUser);
|
|
|
+ gameTencentBackLogService.save(gameTencentBackLog);
|
|
|
+ } else {
|
|
|
+ log.error("回传腾讯用户失败,失败原因:{}", result.getMsg());
|
|
|
+ gameTencentUser.setBackLog(result.getMsg());
|
|
|
+ gameTencentUser.setIsBack(BackStatusEnum.FAILED.getBackStatus());
|
|
|
+ gameTencentUserService.updateById(gameTencentUser);
|
|
|
|
|
|
- gameTencentBackLog.setBackLog(e.getMessage());
|
|
|
- gameTencentBackLogService.saveOrUpdate(gameTencentBackLog);
|
|
|
- return false;
|
|
|
- }
|
|
|
+ gameTencentBackLog.setBackLog(result.getMsg());
|
|
|
+ gameTencentBackLogService.saveOrUpdate(gameTencentBackLog);
|
|
|
+ }
|
|
|
return true;
|
|
|
|
|
|
}
|