会员
This commit is contained in:
@@ -1,62 +1,62 @@
|
||||
package com.ruoyi.common.config;
|
||||
|
||||
import com.alipay.easysdk.factory.Factory;
|
||||
import com.alipay.easysdk.kernel.Config;
|
||||
import lombok.Getter;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 描述:
|
||||
*
|
||||
* @author menxipeng by 2023/12/15
|
||||
*/
|
||||
@Getter
|
||||
@Component
|
||||
public class AliPayConfig {
|
||||
|
||||
@Value("${alipay.gateway}")
|
||||
private String aliPayGateway;
|
||||
@Value("${alipay.appid}")
|
||||
private String aliPayAppid;
|
||||
@Value("${alipay.privateKey}")
|
||||
private String aliPayPrivateKey;
|
||||
@Value("${alipay.publicKey}")
|
||||
private String aliPayPublicKey;
|
||||
@Value("${alipay.merchantCertPath}")
|
||||
private String merchantCertPath;
|
||||
@Value("${alipay.alipayCertPath}")
|
||||
private String alipayCertPath;
|
||||
@Value("${alipay.alipayRootCertPath}")
|
||||
private String alipayRootCertPath;
|
||||
@Value("${alipay.notifyUrl}")
|
||||
private String aliPayNotifyUrl;
|
||||
@Value("${alipay.authUrl}")
|
||||
private String aliPayAuthUrl;
|
||||
@Value("${alipay.timeout}")
|
||||
private Integer aliTimeOut;
|
||||
|
||||
|
||||
@Bean
|
||||
public void init() {
|
||||
Config config = new Config();
|
||||
config.protocol = "https";
|
||||
config.gatewayHost = "openapi.alipay.com";
|
||||
config.signType = "RSA2";
|
||||
|
||||
config.appId = aliPayAppid;
|
||||
// 为避免私钥随源码泄露,推荐从文件中读取私钥字符串而不是写入源码中
|
||||
config.merchantPrivateKey = aliPayPrivateKey;
|
||||
//注:证书文件路径支持设置为文件系统中的路径或CLASS_PATH中的路径,优先从文件系统中加载,加载失败后会继续尝试从CLASS_PATH中加载
|
||||
config.merchantCertPath = merchantCertPath;
|
||||
config.alipayCertPath = alipayCertPath;
|
||||
config.alipayRootCertPath = alipayRootCertPath;
|
||||
//注:如果采用非证书模式,则无需赋值上面的三个证书路径,改为赋值如下的支付宝公钥字符串即可
|
||||
//可设置异步通知接收服务地址(可选)
|
||||
config.notifyUrl = aliPayNotifyUrl;
|
||||
|
||||
Factory.setOptions(config);
|
||||
}
|
||||
|
||||
}
|
||||
//package com.ruoyi.common.config;
|
||||
//
|
||||
//import com.alipay.easysdk.factory.Factory;
|
||||
//import com.alipay.easysdk.kernel.Config;
|
||||
//import lombok.Getter;
|
||||
//import org.springframework.beans.factory.annotation.Value;
|
||||
//import org.springframework.context.annotation.Bean;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//
|
||||
///**
|
||||
// * 描述:
|
||||
// *
|
||||
// * @author menxipeng by 2023/12/15
|
||||
// */
|
||||
//@Getter
|
||||
//@Component
|
||||
//public class AliPayConfig {
|
||||
//
|
||||
// @Value("${alipay.gateway}")
|
||||
// private String aliPayGateway;
|
||||
// @Value("${alipay.appid}")
|
||||
// private String aliPayAppid;
|
||||
// @Value("${alipay.privateKey}")
|
||||
// private String aliPayPrivateKey;
|
||||
// @Value("${alipay.publicKey}")
|
||||
// private String aliPayPublicKey;
|
||||
// @Value("${alipay.merchantCertPath}")
|
||||
// private String merchantCertPath;
|
||||
// @Value("${alipay.alipayCertPath}")
|
||||
// private String alipayCertPath;
|
||||
// @Value("${alipay.alipayRootCertPath}")
|
||||
// private String alipayRootCertPath;
|
||||
// @Value("${alipay.notifyUrl}")
|
||||
// private String aliPayNotifyUrl;
|
||||
// @Value("${alipay.authUrl}")
|
||||
// private String aliPayAuthUrl;
|
||||
// @Value("${alipay.timeout}")
|
||||
// private Integer aliTimeOut;
|
||||
//
|
||||
//
|
||||
// @Bean
|
||||
// public void init() {
|
||||
// Config config = new Config();
|
||||
// config.protocol = "https";
|
||||
// config.gatewayHost = "openapi.alipay.com";
|
||||
// config.signType = "RSA2";
|
||||
//
|
||||
// config.appId = aliPayAppid;
|
||||
// // 为避免私钥随源码泄露,推荐从文件中读取私钥字符串而不是写入源码中
|
||||
// config.merchantPrivateKey = aliPayPrivateKey;
|
||||
// //注:证书文件路径支持设置为文件系统中的路径或CLASS_PATH中的路径,优先从文件系统中加载,加载失败后会继续尝试从CLASS_PATH中加载
|
||||
// config.merchantCertPath = merchantCertPath;
|
||||
// config.alipayCertPath = alipayCertPath;
|
||||
// config.alipayRootCertPath = alipayRootCertPath;
|
||||
// //注:如果采用非证书模式,则无需赋值上面的三个证书路径,改为赋值如下的支付宝公钥字符串即可
|
||||
// //可设置异步通知接收服务地址(可选)
|
||||
// config.notifyUrl = aliPayNotifyUrl;
|
||||
//
|
||||
// Factory.setOptions(config);
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.ruoyi.common.core.domain.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 订单创建请求DTO
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-01-27
|
||||
*/
|
||||
public class OrderCreateRequest implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 订单名称 */
|
||||
private String orderName;
|
||||
|
||||
/** 金额(分) */
|
||||
private Long amount;
|
||||
|
||||
/** 支付方式 aliPay/wechatPay/applePay */
|
||||
private String payType;
|
||||
|
||||
/** 套餐类型 1包月 3包季度 6半年 12一年 */
|
||||
private String packageType;
|
||||
|
||||
/** 设备类型 android/ios */
|
||||
private String deviceType;
|
||||
|
||||
/** 客户端IP */
|
||||
private String clientIp;
|
||||
|
||||
public String getOrderName() {
|
||||
return orderName;
|
||||
}
|
||||
|
||||
public void setOrderName(String orderName) {
|
||||
this.orderName = orderName;
|
||||
}
|
||||
|
||||
public Long getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void setAmount(Long amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public String getPayType() {
|
||||
return payType;
|
||||
}
|
||||
|
||||
public void setPayType(String payType) {
|
||||
this.payType = payType;
|
||||
}
|
||||
|
||||
public String getPackageType() {
|
||||
return packageType;
|
||||
}
|
||||
|
||||
public void setPackageType(String packageType) {
|
||||
this.packageType = packageType;
|
||||
}
|
||||
|
||||
public String getDeviceType() {
|
||||
return deviceType;
|
||||
}
|
||||
|
||||
public void setDeviceType(String deviceType) {
|
||||
this.deviceType = deviceType;
|
||||
}
|
||||
|
||||
public String getClientIp() {
|
||||
return clientIp;
|
||||
}
|
||||
|
||||
public void setClientIp(String clientIp) {
|
||||
this.clientIp = clientIp;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
package com.ruoyi.common.core.domain.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 支付请求DTO
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-01-27
|
||||
*/
|
||||
public class PaymentRequest implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 订单ID */
|
||||
private String orderId;
|
||||
|
||||
/** 支付方式 aliPay/wechatPay/applePay */
|
||||
private String payType;
|
||||
|
||||
/** 设备类型 android/ios */
|
||||
private String deviceType;
|
||||
|
||||
/** 商品标题 */
|
||||
private String subject;
|
||||
|
||||
/** 商品描述 */
|
||||
private String body;
|
||||
|
||||
/** 附加数据 */
|
||||
private String attach;
|
||||
|
||||
/** 用户openid(微信支付专用) */
|
||||
private String openid;
|
||||
|
||||
/** 商户标识符(Apple Pay专用) */
|
||||
private String merchantIdentifier;
|
||||
|
||||
/** 支付令牌(Apple Pay专用) */
|
||||
private String paymentToken;
|
||||
|
||||
/** 订单超时时间(分钟) */
|
||||
private Integer timeoutMinutes;
|
||||
|
||||
public String getOrderId() {
|
||||
return orderId;
|
||||
}
|
||||
|
||||
public void setOrderId(String orderId) {
|
||||
this.orderId = orderId;
|
||||
}
|
||||
|
||||
public String getPayType() {
|
||||
return payType;
|
||||
}
|
||||
|
||||
public void setPayType(String payType) {
|
||||
this.payType = payType;
|
||||
}
|
||||
|
||||
public String getDeviceType() {
|
||||
return deviceType;
|
||||
}
|
||||
|
||||
public void setDeviceType(String deviceType) {
|
||||
this.deviceType = deviceType;
|
||||
}
|
||||
|
||||
public String getSubject() {
|
||||
return subject;
|
||||
}
|
||||
|
||||
public void setSubject(String subject) {
|
||||
this.subject = subject;
|
||||
}
|
||||
|
||||
public String getBody() {
|
||||
return body;
|
||||
}
|
||||
|
||||
public void setBody(String body) {
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
public String getAttach() {
|
||||
return attach;
|
||||
}
|
||||
|
||||
public void setAttach(String attach) {
|
||||
this.attach = attach;
|
||||
}
|
||||
|
||||
public String getOpenid() {
|
||||
return openid;
|
||||
}
|
||||
|
||||
public void setOpenid(String openid) {
|
||||
this.openid = openid;
|
||||
}
|
||||
|
||||
public String getMerchantIdentifier() {
|
||||
return merchantIdentifier;
|
||||
}
|
||||
|
||||
public void setMerchantIdentifier(String merchantIdentifier) {
|
||||
this.merchantIdentifier = merchantIdentifier;
|
||||
}
|
||||
|
||||
public String getPaymentToken() {
|
||||
return paymentToken;
|
||||
}
|
||||
|
||||
public void setPaymentToken(String paymentToken) {
|
||||
this.paymentToken = paymentToken;
|
||||
}
|
||||
|
||||
public Integer getTimeoutMinutes() {
|
||||
return timeoutMinutes;
|
||||
}
|
||||
|
||||
public void setTimeoutMinutes(Integer timeoutMinutes) {
|
||||
this.timeoutMinutes = timeoutMinutes;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.ruoyi.common.core.domain.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 退款请求DTO
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-01-27
|
||||
*/
|
||||
public class RefundRequest implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 订单ID */
|
||||
private String orderId;
|
||||
|
||||
/** 退款金额(分) */
|
||||
private Long refundAmount;
|
||||
|
||||
/** 退款原因 */
|
||||
private String refundReason;
|
||||
|
||||
/** 退款方式 1全额退款 2部分退款 */
|
||||
private Integer refundType;
|
||||
|
||||
public String getOrderId() {
|
||||
return orderId;
|
||||
}
|
||||
|
||||
public void setOrderId(String orderId) {
|
||||
this.orderId = orderId;
|
||||
}
|
||||
|
||||
public Long getRefundAmount() {
|
||||
return refundAmount;
|
||||
}
|
||||
|
||||
public void setRefundAmount(Long refundAmount) {
|
||||
this.refundAmount = refundAmount;
|
||||
}
|
||||
|
||||
public String getRefundReason() {
|
||||
return refundReason;
|
||||
}
|
||||
|
||||
public void setRefundReason(String refundReason) {
|
||||
this.refundReason = refundReason;
|
||||
}
|
||||
|
||||
public Integer getRefundType() {
|
||||
return refundType;
|
||||
}
|
||||
|
||||
public void setRefundType(Integer refundType) {
|
||||
this.refundType = refundType;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package com.ruoyi.common.core.domain.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 订单信息VO
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-01-27
|
||||
*/
|
||||
public class OrderInfoVO {
|
||||
|
||||
/** 订单号 */
|
||||
@Excel(name = "订单号")
|
||||
private Long orderId;
|
||||
|
||||
/** 用户昵称 */
|
||||
@Excel(name = "用户昵称")
|
||||
private String userNickname;
|
||||
|
||||
/** 套餐名称 */
|
||||
@Excel(name = "套餐名称")
|
||||
private String packageName;
|
||||
|
||||
/** 支付金额(元) */
|
||||
@Excel(name = "支付金额(元)")
|
||||
private BigDecimal amountYuan;
|
||||
|
||||
/** 支付方式 */
|
||||
@Excel(name = "支付方式")
|
||||
private String payTypeName;
|
||||
|
||||
/** 开通时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "开通时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date startTime;
|
||||
|
||||
/** 到期时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "到期时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date endTime;
|
||||
|
||||
/** 订单状态 */
|
||||
@Excel(name = "订单状态")
|
||||
private String statusName;
|
||||
|
||||
/** 创建时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
public Long getOrderId() {
|
||||
return orderId;
|
||||
}
|
||||
|
||||
public void setOrderId(Long orderId) {
|
||||
this.orderId = orderId;
|
||||
}
|
||||
|
||||
public String getUserNickname() {
|
||||
return userNickname;
|
||||
}
|
||||
|
||||
public void setUserNickname(String userNickname) {
|
||||
this.userNickname = userNickname;
|
||||
}
|
||||
|
||||
public String getPackageName() {
|
||||
return packageName;
|
||||
}
|
||||
|
||||
public void setPackageName(String packageName) {
|
||||
this.packageName = packageName;
|
||||
}
|
||||
|
||||
public BigDecimal getAmountYuan() {
|
||||
return amountYuan;
|
||||
}
|
||||
|
||||
public void setAmountYuan(BigDecimal amountYuan) {
|
||||
this.amountYuan = amountYuan;
|
||||
}
|
||||
|
||||
public String getPayTypeName() {
|
||||
return payTypeName;
|
||||
}
|
||||
|
||||
public void setPayTypeName(String payTypeName) {
|
||||
this.payTypeName = payTypeName;
|
||||
}
|
||||
|
||||
public Date getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(Date startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public Date getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(Date endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public String getStatusName() {
|
||||
return statusName;
|
||||
}
|
||||
|
||||
public void setStatusName(String statusName) {
|
||||
this.statusName = statusName;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.ruoyi.common.enums;
|
||||
|
||||
/**
|
||||
* 订单状态枚举
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-01-27
|
||||
*/
|
||||
public enum OrderStatus {
|
||||
|
||||
CREATED(1L, "已创建"),
|
||||
PAID(2L, "已支付"),
|
||||
COMPLETED(3L, "已完成"),
|
||||
REFUNDED(4L, "已退款"),
|
||||
CANCELLED(5L, "已取消");
|
||||
|
||||
private final Long code;
|
||||
private final String description;
|
||||
|
||||
OrderStatus(Long code, String description) {
|
||||
this.code = code;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Long getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public static OrderStatus getByCode(Long code) {
|
||||
for (OrderStatus status : values()) {
|
||||
if (status.getCode().equals(code)) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user