|
@@ -11,8 +11,10 @@ import com.ym.mec.common.controller.BaseController;
|
|
import com.ym.mec.common.entity.HttpResponseResult;
|
|
import com.ym.mec.common.entity.HttpResponseResult;
|
|
import com.ym.mec.common.exception.BizException;
|
|
import com.ym.mec.common.exception.BizException;
|
|
import com.yonge.cooleshow.mall.common.enums.OrderCacheEnum;
|
|
import com.yonge.cooleshow.mall.common.enums.OrderCacheEnum;
|
|
|
|
+import com.yonge.cooleshow.mbg.model.UserOrderPayment;
|
|
import com.yonge.cooleshow.portal.dto.OrderPayRes;
|
|
import com.yonge.cooleshow.portal.dto.OrderPayRes;
|
|
import com.yonge.cooleshow.portal.service.OmsPortalOrderService;
|
|
import com.yonge.cooleshow.portal.service.OmsPortalOrderService;
|
|
|
|
+import com.yonge.cooleshow.portal.service.UserOrderPaymentService;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import org.redisson.api.RLock;
|
|
import org.redisson.api.RLock;
|
|
@@ -52,6 +54,8 @@ public class PaymentController extends BaseController {
|
|
@Autowired
|
|
@Autowired
|
|
private RedissonClient redissonClient;
|
|
private RedissonClient redissonClient;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private UserOrderPaymentService userOrderPaymentService;
|
|
|
|
|
|
|
|
|
|
/***
|
|
/***
|
|
@@ -78,7 +82,14 @@ public class PaymentController extends BaseController {
|
|
String transType = request.getParameter("type");
|
|
String transType = request.getParameter("type");
|
|
|
|
|
|
|
|
|
|
- RLock lock = redissonClient.getLock(OrderCacheEnum.LOCK_ORDER_NO_MALL.getRedisKey(dataObj.getString("order_no")));
|
|
|
|
|
|
+ String paymentOrderNo = dataObj.getString("order_no");
|
|
|
|
+
|
|
|
|
+ UserOrderPayment userOrderPayment = userOrderPaymentService.getByAdapayNo(paymentOrderNo);
|
|
|
|
+ if (userOrderPayment == null) {
|
|
|
|
+ throw new BizException("订单不存在");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ RLock lock = redissonClient.getLock(OrderCacheEnum.LOCK_ORDER_NO_MALL.getRedisKey(userOrderPayment.getOrderNo()));
|
|
try {
|
|
try {
|
|
boolean b = lock.tryLock(60, TimeUnit.SECONDS);
|
|
boolean b = lock.tryLock(60, TimeUnit.SECONDS);
|
|
|
|
|
|
@@ -87,7 +98,7 @@ public class PaymentController extends BaseController {
|
|
switch (transType) {
|
|
switch (transType) {
|
|
case "payment.succeeded":// 支付成功
|
|
case "payment.succeeded":// 支付成功
|
|
|
|
|
|
- orderService.paymentSucceededHandle(dataObj.getString("order_no"),
|
|
|
|
|
|
+ orderService.paymentSucceededHandle(paymentOrderNo,
|
|
dataObj.getBigDecimal("pay_amt"),dataObj.getString("pay_channel"));
|
|
dataObj.getBigDecimal("pay_amt"),dataObj.getString("pay_channel"));
|
|
|
|
|
|
break;
|
|
break;
|
|
@@ -99,8 +110,8 @@ public class PaymentController extends BaseController {
|
|
notifyMap.put("channelType", dataObj.getString("pay_channel"));
|
|
notifyMap.put("channelType", dataObj.getString("pay_channel"));
|
|
notifyMap.put("tradeState", "0");
|
|
notifyMap.put("tradeState", "0");
|
|
notifyMap.put("totalMoney", dataObj.getString("pay_amt"));
|
|
notifyMap.put("totalMoney", dataObj.getString("pay_amt"));
|
|
- notifyMap.put("merOrderNo", dataObj.getString("order_no"));
|
|
|
|
- orderService.paymentFailedHandle(dataObj.getString("order_no"),notifyMap);
|
|
|
|
|
|
+ notifyMap.put("merOrderNo", paymentOrderNo);
|
|
|
|
+ orderService.paymentFailedHandle(paymentOrderNo,notifyMap);
|
|
|
|
|
|
break;
|
|
break;
|
|
case "payment_reverse.succeeded" :
|
|
case "payment_reverse.succeeded" :
|