|
@@ -3,8 +3,12 @@ package com.yonge.cooleshow.biz.dal.service.impl;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.google.common.collect.Lists;
|
|
|
+import com.microsvc.toolkit.config.jwt.utils.JwtUserInfo;
|
|
|
+import com.microsvc.toolkit.middleware.payment.common.api.entity.PaymentResp;
|
|
|
+import com.microsvc.toolkit.middleware.payment.common.api.enums.PaymentStatus;
|
|
|
import com.yonge.cooleshow.biz.dal.dao.UserOrderDao;
|
|
|
import com.yonge.cooleshow.biz.dal.dto.UserAccountRecordDto;
|
|
|
import com.yonge.cooleshow.biz.dal.dto.req.OrderPayReq;
|
|
@@ -329,13 +333,48 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
|
|
|
|| OrderStatusEnum.PAYING.equals(detail.getStatus())) {
|
|
|
|
|
|
if (OrderStatusEnum.CLOSE.equals(orderStatus)) {
|
|
|
- doOrderCancel(detail, orderStatus, "测试接口-订单关闭");
|
|
|
+ if (detail.getPaymentVersion().equals(EPaymentVersion.V1))
|
|
|
+ doOrderCancel(detail, orderStatus, "测试接口-订单关闭");
|
|
|
+ else {
|
|
|
+ // 用户取消支付
|
|
|
+ userPaymentCoreService.cancelPayment(JwtUserInfo.builder().userId(detail.getUserId().toString())
|
|
|
+ .clientType(detail.getPaymentClient()).build(), orderNo);
|
|
|
+ }
|
|
|
}
|
|
|
if (OrderStatusEnum.FAIL.equals(orderStatus)) {
|
|
|
- doOrderCancel(detail, orderStatus, "测试接口-订单交易失败");
|
|
|
+ if (detail.getPaymentVersion().equals(EPaymentVersion.V1))
|
|
|
+ doOrderCancel(detail, orderStatus, "测试接口-订单交易失败");
|
|
|
+ else {
|
|
|
+ // 用户取消支付
|
|
|
+ PaymentResp resp = new PaymentResp();
|
|
|
+ resp.setMerOrderNo(orderNo);
|
|
|
+ resp.setPaymentStatus(PaymentStatus.FAILED);
|
|
|
+ resp.setTriggerTime(new Date());
|
|
|
+ resp.setTransNo(detail.getTransNo());
|
|
|
+ resp.setPaymentAmount(detail.getActualPrice());
|
|
|
+ resp.setPaymentChannel(detail.getPaymentChannel());
|
|
|
+ resp.setMsg("测试订单失败");
|
|
|
+ // 执行支付回调流程
|
|
|
+ userPaymentCoreService.executePaymentCallback(resp);
|
|
|
+ }
|
|
|
}
|
|
|
if (OrderStatusEnum.PAID.equals(orderStatus)) {
|
|
|
- testOrderSuccess(detail.getOrderNo());
|
|
|
+ if (detail.getPaymentVersion().equals(EPaymentVersion.V1))
|
|
|
+ testOrderSuccess(detail.getOrderNo());
|
|
|
+ else {
|
|
|
+ // 用户取消支付
|
|
|
+ PaymentResp resp = new PaymentResp();
|
|
|
+ resp.setMerOrderNo(orderNo);
|
|
|
+ resp.setPaymentStatus(PaymentStatus.SUCCESSED);
|
|
|
+ resp.setTriggerTime(new Date());
|
|
|
+ resp.setTransNo(detail.getTransNo());
|
|
|
+ resp.setPaymentAmount(detail.getActualPrice());
|
|
|
+ resp.setServiceCharge(BigDecimal.ZERO);
|
|
|
+ resp.setPaymentChannel(detail.getPaymentChannel());
|
|
|
+ resp.setMsg("测试订单成功");
|
|
|
+ // 执行支付回调流程
|
|
|
+ userPaymentCoreService.executePaymentCallback(resp);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return true;
|