|
@@ -10,7 +10,6 @@ import com.zanxiang.common.enums.OrderStateEnum;
|
|
import com.zanxiang.common.enums.ResEnum;
|
|
import com.zanxiang.common.enums.ResEnum;
|
|
import com.zanxiang.common.utils.DateUtils;
|
|
import com.zanxiang.common.utils.DateUtils;
|
|
import com.zanxiang.common.utils.MD5Util;
|
|
import com.zanxiang.common.utils.MD5Util;
|
|
-import com.zanxiang.common.utils.ObjectUtil;
|
|
|
|
import com.zanxiang.common.utils.StringUtils;
|
|
import com.zanxiang.common.utils.StringUtils;
|
|
import com.zanxiang.mybatis.entity.*;
|
|
import com.zanxiang.mybatis.entity.*;
|
|
import com.zanxiang.sdk.common.util.HttpUtil;
|
|
import com.zanxiang.sdk.common.util.HttpUtil;
|
|
@@ -40,6 +39,7 @@ import java.util.*;
|
|
@Service
|
|
@Service
|
|
@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);
|
|
protected final Logger logger = LoggerFactory.getLogger(PlatformOrderServiceImpl.class);
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
@@ -72,6 +72,7 @@ public class PerformOrderServiceImpl implements PerformOrderService {
|
|
@Autowired
|
|
@Autowired
|
|
private PayMerchantService payMerchantService;
|
|
private PayMerchantService payMerchantService;
|
|
|
|
|
|
|
|
+ @Override
|
|
public Boolean pushCp(PlatformOrderDTO orderInfo) {
|
|
public Boolean pushCp(PlatformOrderDTO orderInfo) {
|
|
logger.info("订单:{} 充值成功推送cp方回调 ----------start---------", orderInfo.getId());
|
|
logger.info("订单:{} 充值成功推送cp方回调 ----------start---------", orderInfo.getId());
|
|
if (orderInfo.getCpStatus() == CpStatusEnum.SUCCESS.getCode()) {
|
|
if (orderInfo.getCpStatus() == CpStatusEnum.SUCCESS.getCode()) {
|
|
@@ -89,10 +90,10 @@ public class PerformOrderServiceImpl implements PerformOrderService {
|
|
logger.error("订单:{} 充值成功推送cp方回调失败,订单中GameId:{} 的游戏信息未找到", orderInfo.getId(), orderInfo.getGameId());
|
|
logger.error("订单:{} 充值成功推送cp方回调失败,订单中GameId:{} 的游戏信息未找到", orderInfo.getId(), orderInfo.getGameId());
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
- String app_key = gameInfo.getAppKey();
|
|
|
|
|
|
+ String appKey = gameInfo.getAppKey();
|
|
String cpPaybackUrl = gameInfo.getCpPaybackUrl();
|
|
String cpPaybackUrl = gameInfo.getCpPaybackUrl();
|
|
if (StringUtils.isEmpty(gameInfo.getAppKey()) || StringUtils.isEmpty(gameInfo.getCpPaybackUrl())) {
|
|
if (StringUtils.isEmpty(gameInfo.getAppKey()) || StringUtils.isEmpty(gameInfo.getCpPaybackUrl())) {
|
|
- logger.error("订单:{} 充值成功推送cp方回调失败,订单中GameId:{} 的游戏信息中,AppKey:{} 或 CpPaybackUrl:{} 为空", orderInfo.getId(), orderInfo.getGameId(), app_key, cpPaybackUrl);
|
|
|
|
|
|
+ logger.error("订单:{} 充值成功推送cp方回调失败,订单中GameId:{} 的游戏信息中,AppKey:{} 或 CpPaybackUrl:{} 为空", orderInfo.getId(), orderInfo.getGameId(), appKey, cpPaybackUrl);
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
HashMap<String, String> map = new HashMap<>();
|
|
HashMap<String, String> map = new HashMap<>();
|
|
@@ -104,12 +105,12 @@ public class PerformOrderServiceImpl implements PerformOrderService {
|
|
map.put("product_id", orderInfo.getProductId());
|
|
map.put("product_id", orderInfo.getProductId());
|
|
map.put("product_price", String.valueOf(orderInfo.getAmount()));
|
|
map.put("product_price", String.valueOf(orderInfo.getAmount()));
|
|
map.put("ext", orderInfo.getExt());
|
|
map.put("ext", orderInfo.getExt());
|
|
- map.put("app_key", app_key);
|
|
|
|
|
|
+ map.put("app_key", appKey);
|
|
TreeMap<String, String> keySort = new TreeMap<>(map);
|
|
TreeMap<String, String> keySort = new TreeMap<>(map);
|
|
//拼接字符串
|
|
//拼接字符串
|
|
String param = Signer.getSignCheckContent(keySort);
|
|
String param = Signer.getSignCheckContent(keySort);
|
|
//拼接app_key
|
|
//拼接app_key
|
|
- param += "&app_key=" + app_key;
|
|
|
|
|
|
+ param += "&app_key=" + appKey;
|
|
//生成sign
|
|
//生成sign
|
|
String sign = MD5Util.MD5Encode(param, Constants.UTF8);
|
|
String sign = MD5Util.MD5Encode(param, Constants.UTF8);
|
|
map.remove("app_key");
|
|
map.remove("app_key");
|
|
@@ -119,17 +120,14 @@ public class PerformOrderServiceImpl implements PerformOrderService {
|
|
try {
|
|
try {
|
|
Integer i = orderInfo.getCpNotifyCnt() + 1;
|
|
Integer i = orderInfo.getCpNotifyCnt() + 1;
|
|
String s = HttpUtil.postData(cpPaybackUrl, param);
|
|
String s = HttpUtil.postData(cpPaybackUrl, param);
|
|
- Boolean pushSuccess = false;
|
|
|
|
- if (s.trim().toLowerCase(Locale.ROOT).equals(ResEnum.SUCCESS.getMsg())) {
|
|
|
|
- pushSuccess = true;
|
|
|
|
- //更新订单状态
|
|
|
|
- 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);
|
|
|
|
- }
|
|
|
|
|
|
+ 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 logPayCp = new LogPayCp();
|
|
logPayCp.setOrderId(orderId);
|
|
logPayCp.setOrderId(orderId);
|
|
logPayCp.setCpOrderId(orderInfo.getCpOrderId());
|
|
logPayCp.setCpOrderId(orderInfo.getCpOrderId());
|