fix(订单中心):新增订单支付类型

This commit is contained in:
2025-09-01 14:13:39 +08:00
parent 20fa3ddd23
commit 925c915a9b
3 changed files with 83 additions and 0 deletions
@@ -0,0 +1,24 @@
package com.central.order.constants;
/**
* 支付类型常量
*
* @author system
* @date 2024-12-19
*/
public class PayTypeConstants {
/**
* 微信支付
*/
public static final Integer WECHAT_PAY = 1;
/**
* 优惠券支付
*/
public static final Integer COUPON_PAY = 2;
private PayTypeConstants() {
// 私有构造函数,防止实例化
}
}
@@ -0,0 +1,53 @@
package com.central.order.enums;
import lombok.Getter;
/**
* 支付类型枚举
*
* @author system
* @date 2024-12-19
*/
@Getter
public enum PayTypeEnum {
/**
* 微信支付
*/
WECHAT_PAY(1, "微信支付"),
/**
* 优惠券支付
*/
COUPON_PAY(2, "优惠券支付");
private final Integer code;
private final String desc;
PayTypeEnum(Integer code, String desc) {
this.code = code;
this.desc = desc;
}
/**
* 根据code获取枚举
*/
public static PayTypeEnum getByCode(Integer code) {
if (code == null) {
return null;
}
for (PayTypeEnum payType : values()) {
if (payType.getCode().equals(code)) {
return payType;
}
}
return null;
}
/**
* 判断code是否有效
*/
public static boolean isValidCode(Integer code) {
return getByCode(code) != null;
}
}
@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.central.common.model.SuperEntity;
import com.central.order.enums.PayTypeEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@@ -33,7 +35,11 @@ public class Order extends SuperEntity {
private String workspaceId;
private String orderAmount;
@Schema(description = "订单状态")
private Integer orderStatus;
@Schema(description = "支付类型(1:微信支付,2:优惠券支付)")
private Integer payType;
private Date payTime;