|
@@ -64,9 +64,6 @@ public class PerformOrderServiceImpl implements PerformOrderService {
|
|
@Autowired
|
|
@Autowired
|
|
private OrderCompleteService orderCompleteService;
|
|
private OrderCompleteService orderCompleteService;
|
|
|
|
|
|
- @Autowired
|
|
|
|
- private GameService gameService;
|
|
|
|
-
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private GamePayWayService gamePayWayService;
|
|
private GamePayWayService gamePayWayService;
|
|
|
|
|
|
@@ -81,17 +78,12 @@ public class PerformOrderServiceImpl implements PerformOrderService {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Boolean pushCp(PlatformOrderDTO orderInfo) {
|
|
public Boolean pushCp(PlatformOrderDTO orderInfo) {
|
|
- log.info("订单:{} 充值成功推送cp方回调 ----------start---------", orderInfo.getId());
|
|
|
|
|
|
+ log.info("充值回调CP, orderInfo : {} ----------start---------", JsonUtil.toString(orderInfo));
|
|
if (orderInfo.getCpStatus() == CpStatusEnum.SUCCESS.getCode()) {
|
|
if (orderInfo.getCpStatus() == CpStatusEnum.SUCCESS.getCode()) {
|
|
return true;
|
|
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;
|
|
|
|
- }
|
|
|
|
|
|
+ GameExt gameExt = gameExtService.getByGameId(orderInfo.getGameId());
|
|
|
|
+ String cpPaybackUrl = gameExt.getPayCallBackUrl();
|
|
//回调CP
|
|
//回调CP
|
|
Map<String, String> map = new HashMap<>(9);
|
|
Map<String, String> map = new HashMap<>(9);
|
|
map.put("userId", String.valueOf(orderInfo.getUserId()));
|
|
map.put("userId", String.valueOf(orderInfo.getUserId()));
|
|
@@ -105,12 +97,12 @@ public class PerformOrderServiceImpl implements PerformOrderService {
|
|
map.put("sign", this.paySign(orderInfo.getGameId(), map));
|
|
map.put("sign", this.paySign(orderInfo.getGameId(), map));
|
|
//url
|
|
//url
|
|
String url = URIUtil.fillUrlParams(cpPaybackUrl, map, false);
|
|
String url = URIUtil.fillUrlParams(cpPaybackUrl, map, false);
|
|
- log.error("回调Cp的请求地址, url : {}", url);
|
|
|
|
- String resultStr = null;
|
|
|
|
|
|
+ String resultStr;
|
|
try {
|
|
try {
|
|
resultStr = restTemplate.getForObject(url, String.class);
|
|
resultStr = restTemplate.getForObject(url, String.class);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- System.out.println("异常" + e.getMessage());
|
|
|
|
|
|
+ log.error("回调CP充值接口异常, orderInfo : {}, e : {}", JsonUtil.toString(orderInfo), e.getMessage());
|
|
|
|
+ throw new BaseException("回调CP充值接口异常");
|
|
}
|
|
}
|
|
Map<String, String> resultMap = JsonUtil.toMap(resultStr, Map.class, String.class, String.class);
|
|
Map<String, String> resultMap = JsonUtil.toMap(resultStr, Map.class, String.class, String.class);
|
|
boolean pushSuccess = Objects.equals(resultMap.get("result"), "200");
|
|
boolean pushSuccess = Objects.equals(resultMap.get("result"), "200");
|
|
@@ -131,8 +123,10 @@ public class PerformOrderServiceImpl implements PerformOrderService {
|
|
logPayCp.setParams(JsonUtil.toString(map));
|
|
logPayCp.setParams(JsonUtil.toString(map));
|
|
logPayCp.setExt(orderInfo.getExt());
|
|
logPayCp.setExt(orderInfo.getExt());
|
|
logPayCp.setNotifyCnt(orderInfo.getCpNotifyCnt() + 1);
|
|
logPayCp.setNotifyCnt(orderInfo.getCpNotifyCnt() + 1);
|
|
|
|
+ logPayCp.setCreateTime(LocalDateTime.now());
|
|
|
|
+ logPayCp.setUpdateTime(LocalDateTime.now());
|
|
logPayCpService.save(logPayCp);
|
|
logPayCpService.save(logPayCp);
|
|
- log.info("订单:{} 充值成功推送cp方回调 ----------end---------", orderInfo.getId());
|
|
|
|
|
|
+ log.info("充值回调CP----------end---------");
|
|
return pushSuccess;
|
|
return pushSuccess;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -149,9 +143,6 @@ public class PerformOrderServiceImpl implements PerformOrderService {
|
|
sb.append("&time=").append(map.get("time"));
|
|
sb.append("&time=").append(map.get("time"));
|
|
sb.append("&serverId=").append(map.get("serverId"));
|
|
sb.append("&serverId=").append(map.get("serverId"));
|
|
sb.append("&orderId=").append(map.get("orderId"));
|
|
sb.append("&orderId=").append(map.get("orderId"));
|
|
-
|
|
|
|
- log.error("支付回调参与加密参数, str : {}", sb.toString());
|
|
|
|
-
|
|
|
|
//加密
|
|
//加密
|
|
String sign;
|
|
String sign;
|
|
try {
|
|
try {
|
|
@@ -162,43 +153,6 @@ public class PerformOrderServiceImpl implements PerformOrderService {
|
|
return sign;
|
|
return sign;
|
|
}
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
|
- public void test() {
|
|
|
|
- String url = "https://api.vmicro.cn/pm/notify/ly.php?channel_id=61";
|
|
|
|
- long time = System.currentTimeMillis();
|
|
|
|
- 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("money", "10.0");
|
|
|
|
- map.put("time", String.valueOf(time));
|
|
|
|
- map.put("serverId", "60076");
|
|
|
|
- map.put("roleId", "635788e11100264a56573114");
|
|
|
|
- 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) {
|
|
log.info("订单:{} 创建订单宽表 ----------start---------", orderInfo.getId());
|
|
log.info("订单:{} 创建订单宽表 ----------start---------", orderInfo.getId());
|