|
@@ -1,33 +1,35 @@
|
|
package com.zanxiang.sdk.service.Impl;
|
|
package com.zanxiang.sdk.service.Impl;
|
|
|
|
|
|
-import com.alipay.easysdk.kernel.util.Signer;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
-import com.zanxiang.common.constant.Constants;
|
|
|
|
import com.zanxiang.common.enums.CpStatusEnum;
|
|
import com.zanxiang.common.enums.CpStatusEnum;
|
|
import com.zanxiang.common.enums.OrderStateEnum;
|
|
import com.zanxiang.common.enums.OrderStateEnum;
|
|
-import com.zanxiang.common.enums.ResEnum;
|
|
|
|
|
|
+import com.zanxiang.common.exception.BaseException;
|
|
import com.zanxiang.common.utils.DateUtils;
|
|
import com.zanxiang.common.utils.DateUtils;
|
|
-import com.zanxiang.common.utils.MD5Util;
|
|
|
|
import com.zanxiang.common.utils.StringUtils;
|
|
import com.zanxiang.common.utils.StringUtils;
|
|
import com.zanxiang.module.util.JsonUtil;
|
|
import com.zanxiang.module.util.JsonUtil;
|
|
|
|
+import com.zanxiang.module.web.util.URIUtil;
|
|
import com.zanxiang.mybatis.entity.*;
|
|
import com.zanxiang.mybatis.entity.*;
|
|
import com.zanxiang.sdk.domain.dto.PlatformOrderDTO;
|
|
import com.zanxiang.sdk.domain.dto.PlatformOrderDTO;
|
|
import com.zanxiang.sdk.domain.mapper.OrderCompleteCreateMapper;
|
|
import com.zanxiang.sdk.domain.mapper.OrderCompleteCreateMapper;
|
|
import com.zanxiang.sdk.service.*;
|
|
import com.zanxiang.sdk.service.*;
|
|
-import com.zanxiang.sdk.util.HttpUtil;
|
|
|
|
|
|
+import com.zanxiang.sdk.util.SignUtil;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
-import org.slf4j.Logger;
|
|
|
|
-import org.slf4j.LoggerFactory;
|
|
|
|
|
|
+import org.apache.logging.log4j.util.Strings;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
+import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
-import java.util.*;
|
|
|
|
|
|
+import java.util.Date;
|
|
|
|
+import java.util.HashMap;
|
|
|
|
+import java.util.Map;
|
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 订单履约逻辑
|
|
* 订单履约逻辑
|
|
@@ -41,8 +43,6 @@ import java.util.*;
|
|
@Transactional(rollbackFor = {RuntimeException.class, Exception.class})
|
|
@Transactional(rollbackFor = {RuntimeException.class, Exception.class})
|
|
public class PerformOrderServiceImpl implements PerformOrderService {
|
|
public class PerformOrderServiceImpl implements PerformOrderService {
|
|
|
|
|
|
- protected final Logger logger = LoggerFactory.getLogger(PlatformOrderServiceImpl.class);
|
|
|
|
-
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private PlatformOrderService platformOrderService;
|
|
private PlatformOrderService platformOrderService;
|
|
|
|
|
|
@@ -73,92 +73,135 @@ public class PerformOrderServiceImpl implements PerformOrderService {
|
|
@Autowired
|
|
@Autowired
|
|
private PayMerchantService payMerchantService;
|
|
private PayMerchantService payMerchantService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private RestTemplate restTemplate;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private GameExtService gameExtService;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public Boolean pushCp(PlatformOrderDTO orderInfo) {
|
|
public Boolean pushCp(PlatformOrderDTO orderInfo) {
|
|
- logger.info("订单:{} 充值成功推送cp方回调 ----------start---------", orderInfo.getId());
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- logger.error("推送CP方---------------------> " + JsonUtil.toString(orderInfo));
|
|
|
|
-
|
|
|
|
-// if (orderInfo.getCpStatus() == CpStatusEnum.SUCCESS.getCode()) {
|
|
|
|
-// return true;
|
|
|
|
-// }
|
|
|
|
-// //订单id
|
|
|
|
-// String orderId = orderInfo.getCpOrderId();
|
|
|
|
-// //获取游戏中的app_key与app_key信息
|
|
|
|
-// Game gameInfo = gameService.getById(orderInfo.getGameId());
|
|
|
|
-//
|
|
|
|
-// String appKey = gameInfo.getAppKey();
|
|
|
|
-// String cpPaybackUrl = gameInfo.getCpPaybackUrl();
|
|
|
|
-// if (StringUtils.isEmpty(gameInfo.getAppKey()) || StringUtils.isEmpty(gameInfo.getCpPaybackUrl())) {
|
|
|
|
-// logger.error("订单:{} 充值成功推送cp方回调失败,订单中GameId:{} 的游戏信息中,AppKey:{} 或 CpPaybackUrl:{} 为空", orderInfo.getId(), orderInfo.getGameId(), appKey, cpPaybackUrl);
|
|
|
|
-// return false;
|
|
|
|
-// }
|
|
|
|
-// HashMap<String, String> map = new HashMap<>();
|
|
|
|
-// map.put("app_id", String.valueOf(orderInfo.getGameId()));
|
|
|
|
-// map.put("cp_order_id", orderInfo.getCpOrderId());
|
|
|
|
-// map.put("mem_id", orderInfo.getMgUserId());
|
|
|
|
-// map.put("order_status", String.valueOf(orderInfo.getStatus()));
|
|
|
|
-// map.put("pay_time", String.valueOf(orderInfo.getPayTime()));
|
|
|
|
-// map.put("product_id", orderInfo.getProductId());
|
|
|
|
-// map.put("product_price", String.valueOf(orderInfo.getAmount()));
|
|
|
|
-// map.put("ext", orderInfo.getExt());
|
|
|
|
-// map.put("app_key", appKey);
|
|
|
|
-// TreeMap<String, String> keySort = new TreeMap<>(map);
|
|
|
|
-// //拼接字符串
|
|
|
|
-// String param = Signer.getSignCheckContent(keySort);
|
|
|
|
-// //拼接app_key
|
|
|
|
-// param += "&app_key=" + appKey;
|
|
|
|
-// //生成sign
|
|
|
|
-// String sign = MD5Util.MD5Encode(param, Constants.UTF8);
|
|
|
|
-// map.remove("app_key");
|
|
|
|
-// map.put("sign", sign);
|
|
|
|
-// //拼接sign请求
|
|
|
|
-// param += "&sign=" + sign;
|
|
|
|
-// try {
|
|
|
|
-// Integer i = orderInfo.getCpNotifyCnt() + 1;
|
|
|
|
-// String s = HttpUtil.postData(cpPaybackUrl, param);
|
|
|
|
-// boolean pushSuccess = s.trim().toLowerCase(Locale.ROOT).equals(ResEnum.SUCCESS.getMsg());
|
|
|
|
-// //更新订单状态
|
|
|
|
-// Order order = new Order();
|
|
|
|
-// order.setId(orderId);
|
|
|
|
-// order.setCpNotifyCnt(i);
|
|
|
|
-// order.setLastCpNotifyTime(LocalDateTime.now());
|
|
|
|
-// order.setCpStatus(pushSuccess ? CpStatusEnum.SUCCESS.getCode() : CpStatusEnum.FAILLE.getCode());
|
|
|
|
-// platformOrderService.updateById(order);
|
|
|
|
-// LogPayCp logPayCp = new LogPayCp();
|
|
|
|
-// logPayCp.setOrderId(orderId);
|
|
|
|
-// logPayCp.setCpOrderId(orderInfo.getCpOrderId());
|
|
|
|
-// logPayCp.setStatus(orderInfo.getStatus());
|
|
|
|
-// logPayCp.setCpStatus(pushSuccess ? CpStatusEnum.SUCCESS.getCode() : CpStatusEnum.FAILLE.getCode());
|
|
|
|
-// logPayCp.setCpPaybackUrl(cpPaybackUrl);
|
|
|
|
-// logPayCp.setParams(param);
|
|
|
|
-// logPayCp.setExt(orderInfo.getExt());
|
|
|
|
-// logPayCp.setNotifyCnt(i);
|
|
|
|
-// logPayCpService.save(logPayCp);
|
|
|
|
-// logger.info("订单:{} 充值成功推送cp方回调 ----------end---------", orderInfo.getId());
|
|
|
|
-// return true;
|
|
|
|
-// } catch (Exception e) {
|
|
|
|
-// logger.error("订单:{} 充值成功推送cp方回调 失败 e:{}", orderId, e);
|
|
|
|
-// }
|
|
|
|
- return true;
|
|
|
|
|
|
+ log.info("订单:{} 充值成功推送cp方回调 ----------start---------", orderInfo.getId());
|
|
|
|
+ if (orderInfo.getCpStatus() == CpStatusEnum.SUCCESS.getCode()) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ Game gameInfo = gameService.getById(orderInfo.getGameId());
|
|
|
|
+ String cpPaybackUrl = gameInfo.getCpPaybackUrl();
|
|
|
|
+ if (StringUtils.isEmpty(gameInfo.getCpPaybackUrl())) {
|
|
|
|
+ log.error("订单充值成功推送cp方回调失败, CP回调地址为空, orderInfo : {}, gameInfo : {}",
|
|
|
|
+ JsonUtil.toString(orderInfo), JsonUtil.toString(gameInfo));
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ //回调CP
|
|
|
|
+ Map<String, String> map = new HashMap<>(9);
|
|
|
|
+ map.put("userId", String.valueOf(orderInfo.getUserId()));
|
|
|
|
+ map.put("money", orderInfo.getAmount().stripTrailingZeros().toPlainString());
|
|
|
|
+ map.put("time", String.valueOf(System.currentTimeMillis()));
|
|
|
|
+ map.put("serverId", orderInfo.getServerId());
|
|
|
|
+ map.put("roleId", orderInfo.getRoleId());
|
|
|
|
+ map.put("roleName", orderInfo.getRoleName());
|
|
|
|
+ map.put("orderId", orderInfo.getCpOrderId());
|
|
|
|
+ map.put("ext", URIUtil.encodeURIComponent(orderInfo.getExt()));
|
|
|
|
+ map.put("sign", this.paySign(orderInfo.getGameId(), map));
|
|
|
|
+ //url
|
|
|
|
+ String url = URIUtil.fillUrlParams(cpPaybackUrl, map, false);
|
|
|
|
+ log.error("回调Cp的请求地址, url : {}", url);
|
|
|
|
+ String resultStr = null;
|
|
|
|
+ try {
|
|
|
|
+ resultStr = restTemplate.getForObject(url, String.class);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ System.out.println("异常" + e.getMessage());
|
|
|
|
+ }
|
|
|
|
+ Map<String, String> resultMap = JsonUtil.toMap(resultStr, Map.class, String.class, String.class);
|
|
|
|
+ boolean pushSuccess = Objects.equals(resultMap.get("result"), "200");
|
|
|
|
+ //更新订单信息
|
|
|
|
+ platformOrderService.update(new LambdaUpdateWrapper<Order>()
|
|
|
|
+ .set(Order::getCpNotifyCnt, orderInfo.getCpNotifyCnt() + 1)
|
|
|
|
+ .set(Order::getLastCpNotifyTime, LocalDateTime.now())
|
|
|
|
+ .set(Order::getCpStatus, pushSuccess ? CpStatusEnum.SUCCESS.getCode() : CpStatusEnum.FAILLE.getCode())
|
|
|
|
+ .eq(Order::getId, orderInfo.getId())
|
|
|
|
+ );
|
|
|
|
+ //更新回调记录
|
|
|
|
+ LogPayCp logPayCp = new LogPayCp();
|
|
|
|
+ logPayCp.setOrderId(orderInfo.getId());
|
|
|
|
+ logPayCp.setCpOrderId(orderInfo.getCpOrderId());
|
|
|
|
+ logPayCp.setStatus(orderInfo.getStatus());
|
|
|
|
+ logPayCp.setCpStatus(pushSuccess ? CpStatusEnum.SUCCESS.getCode() : CpStatusEnum.FAILLE.getCode());
|
|
|
|
+ logPayCp.setCpPaybackUrl(cpPaybackUrl);
|
|
|
|
+ logPayCp.setParams(JsonUtil.toString(map));
|
|
|
|
+ logPayCp.setExt(orderInfo.getExt());
|
|
|
|
+ logPayCp.setNotifyCnt(orderInfo.getCpNotifyCnt() + 1);
|
|
|
|
+ logPayCpService.save(logPayCp);
|
|
|
|
+ log.info("订单:{} 充值成功推送cp方回调 ----------end---------", orderInfo.getId());
|
|
|
|
+ return pushSuccess;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private String paySign(Long gameId, Map<String, String> map) {
|
|
|
|
+ //查询游戏
|
|
|
|
+ GameExt gameExt = gameExtService.getByGameId(gameId);
|
|
|
|
+ if (Strings.isBlank(gameExt.getPayKey())) {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
|
+ sb.append("payKey=").append(gameExt.getPayKey());
|
|
|
|
+ sb.append("&userId=").append(map.get("userId"));
|
|
|
|
+ sb.append("&money=").append(map.get("money"));
|
|
|
|
+ sb.append("&time=").append(map.get("time"));
|
|
|
|
+ sb.append("&serverId=").append(map.get("serverId"));
|
|
|
|
+ sb.append("&orderId=").append(map.get("orderId"));
|
|
|
|
+
|
|
|
|
+ log.error("支付回调参与加密参数, str : {}", sb.toString());
|
|
|
|
+
|
|
|
|
+ //加密
|
|
|
|
+ String sign;
|
|
|
|
+ try {
|
|
|
|
+ sign = SignUtil.MD5(sb.toString()).toUpperCase();
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ throw new BaseException("支付加密异常");
|
|
|
|
+ }
|
|
|
|
+ return sign;
|
|
}
|
|
}
|
|
|
|
|
|
- public void test(){
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public void test() {
|
|
String url = "https://api.vmicro.cn/pm/notify/ly.php?channel_id=61";
|
|
String url = "https://api.vmicro.cn/pm/notify/ly.php?channel_id=61";
|
|
|
|
+ long time = System.currentTimeMillis();
|
|
HashMap<String, String> map = new HashMap<>();
|
|
HashMap<String, String> map = new HashMap<>();
|
|
|
|
+ String ext = "{\"appid\":\"328\",\"mtype\":\"61\",\"agent_id\":\"445\",\"site_id\":\"3956\",\"order_id\":\"Y202210271116296076030\"}";
|
|
map.put("userId", "83");
|
|
map.put("userId", "83");
|
|
- map.put("money", "10");
|
|
|
|
- map.put("time", String.valueOf(System.currentTimeMillis()));
|
|
|
|
|
|
+ map.put("money", "10.0");
|
|
|
|
+ map.put("time", String.valueOf(time));
|
|
map.put("serverId", "60076");
|
|
map.put("serverId", "60076");
|
|
map.put("roleId", "635788e11100264a56573114");
|
|
map.put("roleId", "635788e11100264a56573114");
|
|
map.put("roleName", "付晓亦");
|
|
map.put("roleName", "付晓亦");
|
|
|
|
+ map.put("orderId", "Y202210271116296076030");
|
|
|
|
+ map.put("ext", URIUtil.encodeURIComponent(ext));
|
|
|
|
+
|
|
|
|
+ String str = "payKey=payKey789&userId=83&money=10.0&time=" + time + "&serverId=60076&orderId=Y202210271116296076030";
|
|
|
|
+ try {
|
|
|
|
+ String s = SignUtil.MD5(str).toUpperCase();
|
|
|
|
+ map.put("sign", s);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ String uri = URIUtil.fillUrlParams(url, map, false);
|
|
|
|
+
|
|
|
|
+ log.error("模拟请求支付成功, url : {}", uri);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ String object = null;
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ object = restTemplate.getForObject(uri, String.class);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ System.out.println("异常" + e.getMessage());
|
|
|
|
+ }
|
|
|
|
+ System.out.println(JsonUtil.toString(object));
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Boolean createOrderComplete(PlatformOrderDTO orderInfo) {
|
|
public Boolean createOrderComplete(PlatformOrderDTO orderInfo) {
|
|
- logger.info("订单:{} 创建订单宽表 ----------start---------", orderInfo.getId());
|
|
|
|
|
|
+ log.info("订单:{} 创建订单宽表 ----------start---------", orderInfo.getId());
|
|
try {
|
|
try {
|
|
OrderComplete orderComplete = orderCompleteMapper.info(orderInfo.getId());
|
|
OrderComplete orderComplete = orderCompleteMapper.info(orderInfo.getId());
|
|
orderComplete.setOrderDate(orderInfo.getCreateTime());
|
|
orderComplete.setOrderDate(orderInfo.getCreateTime());
|
|
@@ -175,23 +218,23 @@ public class PerformOrderServiceImpl implements PerformOrderService {
|
|
OrderComplete complete = orderCompleteService.getOne(new LambdaQueryWrapper<OrderComplete>().eq(OrderComplete::getOrderId, orderInfo.getId()));
|
|
OrderComplete complete = orderCompleteService.getOne(new LambdaQueryWrapper<OrderComplete>().eq(OrderComplete::getOrderId, orderInfo.getId()));
|
|
if (Objects.isNull(complete)) {
|
|
if (Objects.isNull(complete)) {
|
|
orderCompleteMapper.insert(orderComplete);
|
|
orderCompleteMapper.insert(orderComplete);
|
|
- logger.info("订单:{} 生成宽表数据成功", orderInfo.getId());
|
|
|
|
|
|
+ log.info("订单:{} 生成宽表数据成功", orderInfo.getId());
|
|
} else {
|
|
} else {
|
|
OrderComplete pa = new OrderComplete();
|
|
OrderComplete pa = new OrderComplete();
|
|
pa.setOrderId(complete.getOrderId());
|
|
pa.setOrderId(complete.getOrderId());
|
|
orderCompleteService.update(pa, new UpdateWrapper<OrderComplete>().setEntity(orderComplete));
|
|
orderCompleteService.update(pa, new UpdateWrapper<OrderComplete>().setEntity(orderComplete));
|
|
- logger.info("订单:{} 宽表数据更新成功", orderInfo.getId());
|
|
|
|
|
|
+ log.info("订单:{} 宽表数据更新成功", orderInfo.getId());
|
|
}
|
|
}
|
|
return true;
|
|
return true;
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- logger.error("订单:{} 生成宽表数据失败 e:{}", orderInfo.getId(), e);
|
|
|
|
|
|
+ log.error("订单:{} 生成宽表数据失败 e:{}", orderInfo.getId(), e);
|
|
}
|
|
}
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Boolean checkIsFirstRecharge(PlatformOrderDTO orderInfo) {
|
|
public Boolean checkIsFirstRecharge(PlatformOrderDTO orderInfo) {
|
|
- logger.info("订单:{} 检查更新用户是否为首充 ----------start---------", orderInfo.getId());
|
|
|
|
|
|
+ log.info("订单:{} 检查更新用户是否为首充 ----------start---------", orderInfo.getId());
|
|
try {
|
|
try {
|
|
Order one = platformOrderService.getOne(new QueryWrapper<Order>().lambda()
|
|
Order one = platformOrderService.getOne(new QueryWrapper<Order>().lambda()
|
|
.eq(Order::getUserId, orderInfo.getUserId())
|
|
.eq(Order::getUserId, orderInfo.getUserId())
|
|
@@ -202,18 +245,18 @@ public class PerformOrderServiceImpl implements PerformOrderService {
|
|
order.setId(order.getId());
|
|
order.setId(order.getId());
|
|
order.setIsFirstRecharge(1);
|
|
order.setIsFirstRecharge(1);
|
|
platformOrderService.updateById(order);
|
|
platformOrderService.updateById(order);
|
|
- logger.info("订单:{} 验证订单是否为首充成功", orderInfo.getId());
|
|
|
|
|
|
+ log.info("订单:{} 验证订单是否为首充成功", orderInfo.getId());
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- logger.error("订单:{} 验证订单是否为首充失败 e:{}", orderInfo.getId(), e);
|
|
|
|
|
|
+ log.error("订单:{} 验证订单是否为首充失败 e:{}", orderInfo.getId(), e);
|
|
}
|
|
}
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Boolean userRechargeTotal(PlatformOrderDTO orderInfo) {
|
|
public Boolean userRechargeTotal(PlatformOrderDTO orderInfo) {
|
|
- logger.info("订单:{} 更新用户充值统计 ----------start---------", orderInfo.getId());
|
|
|
|
|
|
+ log.info("订单:{} 更新用户充值统计 ----------start---------", orderInfo.getId());
|
|
try {
|
|
try {
|
|
//订单取消情况 做减法
|
|
//订单取消情况 做减法
|
|
float amount = orderInfo.getAmount().floatValue();
|
|
float amount = orderInfo.getAmount().floatValue();
|
|
@@ -233,12 +276,12 @@ public class PerformOrderServiceImpl implements PerformOrderService {
|
|
.setEntity(gameUserRole)
|
|
.setEntity(gameUserRole)
|
|
);
|
|
);
|
|
} else {
|
|
} else {
|
|
- logger.info("订单:{} 用户玩家角色RoleId为空,不进行gameUserRole充值统计汇总", orderInfo.getId());
|
|
|
|
|
|
+ log.info("订单:{} 用户玩家角色RoleId为空,不进行gameUserRole充值统计汇总", orderInfo.getId());
|
|
}
|
|
}
|
|
//游戏用户统计更新
|
|
//游戏用户统计更新
|
|
- if (StringUtils.isNotEmpty(orderInfo.getMgUserId()) && !"0".equals(orderInfo.getMgUserId())) {
|
|
|
|
|
|
+ if (orderInfo.getMgUserId() != null) {
|
|
GameUser gameUser = new GameUser();
|
|
GameUser gameUser = new GameUser();
|
|
- gameUser.setId(Long.valueOf(orderInfo.getMgUserId()));
|
|
|
|
|
|
+ gameUser.setId(orderInfo.getMgUserId());
|
|
gameUserService.update(gameUser, new UpdateWrapper<GameUser>().lambda()
|
|
gameUserService.update(gameUser, new UpdateWrapper<GameUser>().lambda()
|
|
.set(GameUser::getLastRechargeTime, orderInfo.getPayTime())
|
|
.set(GameUser::getLastRechargeTime, orderInfo.getPayTime())
|
|
.setSql("recharge_count=recharge_count+" + num)
|
|
.setSql("recharge_count=recharge_count+" + num)
|
|
@@ -246,12 +289,12 @@ public class PerformOrderServiceImpl implements PerformOrderService {
|
|
.setEntity(gameUser)
|
|
.setEntity(gameUser)
|
|
);
|
|
);
|
|
} else {
|
|
} else {
|
|
- logger.info("订单:{} 用户玩家MgUserId为空,不进行gameUser充值统计汇总", orderInfo.getId());
|
|
|
|
|
|
+ log.info("订单:{} 用户玩家MgUserId为空,不进行gameUser充值统计汇总", orderInfo.getId());
|
|
}
|
|
}
|
|
//用户统计更新
|
|
//用户统计更新
|
|
- if (StringUtils.isNotEmpty(orderInfo.getUserId()) && !"0".equals(orderInfo.getUserId())) {
|
|
|
|
|
|
+ if (orderInfo.getUserId() != null) {
|
|
User user = new User();
|
|
User user = new User();
|
|
- user.setId(Long.valueOf(orderInfo.getUserId()));
|
|
|
|
|
|
+ user.setId(orderInfo.getUserId());
|
|
userService.update(user, new UpdateWrapper<User>().lambda()
|
|
userService.update(user, new UpdateWrapper<User>().lambda()
|
|
.set(User::getLastRechargeTime, orderInfo.getPayTime())
|
|
.set(User::getLastRechargeTime, orderInfo.getPayTime())
|
|
.setSql("recharge_count=recharge_count+" + num)
|
|
.setSql("recharge_count=recharge_count+" + num)
|
|
@@ -259,35 +302,35 @@ public class PerformOrderServiceImpl implements PerformOrderService {
|
|
.setEntity(user)
|
|
.setEntity(user)
|
|
);
|
|
);
|
|
} else {
|
|
} else {
|
|
- logger.info("订单:{} 用户UserId为空,不进行User充值统计汇总", orderInfo.getId());
|
|
|
|
|
|
+ log.info("订单:{} 用户UserId为空,不进行User充值统计汇总", orderInfo.getId());
|
|
}
|
|
}
|
|
return true;
|
|
return true;
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- logger.error("订单:{} 用户充值统计逻辑操作失败 e:{}", orderInfo.getId(), e);
|
|
|
|
|
|
+ log.error("订单:{} 用户充值统计逻辑操作失败 e:{}", orderInfo.getId(), e);
|
|
}
|
|
}
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Boolean payMerchantTotal(PlatformOrderDTO orderInfo) {
|
|
public Boolean payMerchantTotal(PlatformOrderDTO orderInfo) {
|
|
- logger.info("订单:{} 更新商户号统计 ----------start---------", orderInfo.getId());
|
|
|
|
|
|
+ log.info("订单:{} 更新商户号统计 ----------start---------", orderInfo.getId());
|
|
try {
|
|
try {
|
|
if (StringUtils.isEmpty(orderInfo.getGamePaywayId())) {
|
|
if (StringUtils.isEmpty(orderInfo.getGamePaywayId())) {
|
|
- logger.error("订单:{} 更新商户号统计时,该订单GamePaywayId为空", orderInfo.getId());
|
|
|
|
|
|
+ log.error("订单:{} 更新商户号统计时,该订单GamePaywayId为空", orderInfo.getId());
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
GamePayWay gamePayWayInfo = gamePayWayService.getInfo(orderInfo.getGamePaywayId());
|
|
GamePayWay gamePayWayInfo = gamePayWayService.getInfo(orderInfo.getGamePaywayId());
|
|
if (Objects.isNull(gamePayWayInfo)) {
|
|
if (Objects.isNull(gamePayWayInfo)) {
|
|
- logger.error("订单:{} 更新商户号统计时,获取GamePayway表id:{}信息为空", orderInfo.getId(), orderInfo.getGamePaywayId());
|
|
|
|
|
|
+ log.error("订单:{} 更新商户号统计时,获取GamePayway表id:{}信息为空", orderInfo.getId(), orderInfo.getGamePaywayId());
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
if (gamePayWayInfo.getPayMerchantId() <= 0) {
|
|
if (gamePayWayInfo.getPayMerchantId() <= 0) {
|
|
- logger.error("订单:{} 更新商户号统计时,获取GamePayway表id:{}信息中PayMerchantId为空", orderInfo.getId(), orderInfo.getGamePaywayId());
|
|
|
|
|
|
+ log.error("订单:{} 更新商户号统计时,获取GamePayway表id:{}信息中PayMerchantId为空", orderInfo.getId(), orderInfo.getGamePaywayId());
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
PayMerchant payMerchantInfo = payMerchantService.getById(gamePayWayInfo.getPayMerchantId());
|
|
PayMerchant payMerchantInfo = payMerchantService.getById(gamePayWayInfo.getPayMerchantId());
|
|
if (Objects.isNull(payMerchantInfo)) {
|
|
if (Objects.isNull(payMerchantInfo)) {
|
|
- logger.error("订单:{} 更新商户号统计时,获取PayMerchant表id:{}信息为空", orderInfo.getId(), gamePayWayInfo.getPayMerchantId());
|
|
|
|
|
|
+ log.error("订单:{} 更新商户号统计时,获取PayMerchant表id:{}信息为空", orderInfo.getId(), gamePayWayInfo.getPayMerchantId());
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
BigDecimal amount = orderInfo.getAmount();
|
|
BigDecimal amount = orderInfo.getAmount();
|
|
@@ -321,10 +364,10 @@ public class PerformOrderServiceImpl implements PerformOrderService {
|
|
.setSql(dayPayAmount)
|
|
.setSql(dayPayAmount)
|
|
.setEntity(payMerchantInfo)
|
|
.setEntity(payMerchantInfo)
|
|
);
|
|
);
|
|
- logger.info("订单:{} 更新商户号统计 ----------end---------", orderInfo.getId());
|
|
|
|
|
|
+ log.info("订单:{} 更新商户号统计 ----------end---------", orderInfo.getId());
|
|
return true;
|
|
return true;
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- logger.error("订单:{} 更新商户号统计失败 e:{}", orderInfo.getId(), e);
|
|
|
|
|
|
+ log.error("订单:{} 更新商户号统计失败 e:{}", orderInfo.getId(), e);
|
|
}
|
|
}
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|