订单
This commit is contained in:
@@ -36,7 +36,7 @@ public class OrderInfo extends BaseEntity
|
||||
private Long userId;
|
||||
|
||||
/** 金额 分 */
|
||||
@Excel(name = "金额 分")
|
||||
@Excel(name = "金额 元")
|
||||
private BigDecimal amount;
|
||||
|
||||
/** 支付方式 aliPay / wechatPay / applePay */
|
||||
|
||||
@@ -29,7 +29,7 @@ public class PaymentUtil {
|
||||
// 构建支付宝支付参数
|
||||
Map<String, Object> aliPayParams = new HashMap<>();
|
||||
aliPayParams.put("out_trade_no", orderInfo.getOrderId().toString());
|
||||
aliPayParams.put("total_amount", orderInfo.getAmount() / 100.0);
|
||||
aliPayParams.put("total_amount", orderInfo.getAmount());
|
||||
aliPayParams.put("subject", StringUtils.isNotEmpty(request.getSubject()) ? request.getSubject() : orderInfo.getOrderName());
|
||||
aliPayParams.put("body", StringUtils.isNotEmpty(request.getBody()) ? request.getBody() : "购买VIP会员服务");
|
||||
aliPayParams.put("timeout_express", (request.getTimeoutMinutes() != null ? request.getTimeoutMinutes() : 30) + "m");
|
||||
@@ -73,35 +73,6 @@ public class PaymentUtil {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理Apple Pay支付
|
||||
*/
|
||||
public Map<String, Object> processApplePay(OrderInfo orderInfo, PaymentRequest request) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
// TODO: 调用Apple Pay SDK进行支付
|
||||
// 这里只是模拟返回支付参数
|
||||
|
||||
// 构建Apple Pay支付参数
|
||||
Map<String, Object> applePayParams = new HashMap<>();
|
||||
applePayParams.put("orderId", orderInfo.getOrderId().toString());
|
||||
applePayParams.put("amount", orderInfo.getAmount() / 100.0);
|
||||
applePayParams.put("currency", "CNY");
|
||||
applePayParams.put("merchantIdentifier", StringUtils.isNotEmpty(request.getMerchantIdentifier()) ?
|
||||
request.getMerchantIdentifier() : "merchant.com.example");
|
||||
|
||||
if (StringUtils.isNotEmpty(request.getPaymentToken())) {
|
||||
applePayParams.put("paymentToken", request.getPaymentToken());
|
||||
}
|
||||
|
||||
result.put("paymentToken", "apple_payment_token_" + System.currentTimeMillis());
|
||||
result.put("orderId", orderInfo.getOrderId());
|
||||
result.put("amount", orderInfo.getAmount());
|
||||
result.put("payType", "applePay");
|
||||
result.put("params", applePayParams);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证支付回调
|
||||
|
||||
@@ -172,6 +172,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<select id="selectOrderInfoVOList" parameterType="OrderInfo" resultMap="OrderInfoVOResult">
|
||||
SELECT
|
||||
o.amount as amount_yuan,
|
||||
o.order_id,
|
||||
su.nickname as user_nickname,
|
||||
su.phone as phone,
|
||||
@@ -182,7 +183,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
WHEN o.package_type = '4' THEN '一年'
|
||||
ELSE '未知套餐'
|
||||
END as package_name,
|
||||
ROUND(o.amount / 100.0, 2) as amount_yuan,
|
||||
CASE
|
||||
WHEN o.pay_type = 'aliPay' THEN '支付宝'
|
||||
WHEN o.pay_type = 'wechatPay' THEN '微信支付'
|
||||
@@ -193,10 +193,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
o.end_time,
|
||||
CASE
|
||||
WHEN o.pay_status = 1 THEN '待支付'
|
||||
WHEN o.pay_status = 2 THEN '待出货'
|
||||
WHEN o.pay_status = 2 THEN '已完成'
|
||||
WHEN o.pay_status = 3 THEN '待退款'
|
||||
WHEN o.pay_status = 4 THEN '已退款'
|
||||
WHEN o.pay_status = 5 THEN '已完成'
|
||||
ELSE '未知状态'
|
||||
END as status_name,
|
||||
o.create_time
|
||||
|
||||
Reference in New Issue
Block a user