wlzboy
3 天以前 8cb5d3440208a3be3e772e65f1bd0ec63031ba62
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package com.ruoyi.payment.domain.enums;
 
/**
 * 订单状态枚举
 * 
 * @author ruoyi
 */
public enum OrderStatus {
    
    /** 初始化 */
    INIT("INIT", "初始化"),
    
    /** 待支付 */
    PENDING("PENDING", "待支付"),
    
    /** 支付成功 */
    SUCCEEDED("SUCCEEDED", "支付成功"),
    
    /** 支付失败 */
    FAILED("FAILED", "支付失败"),
    
    /** 已关闭 */
    CANCELED("CANCELED", "已关闭"),
    
    /** 已过期 */
    EXPIRED("EXPIRED", "已过期");
 
    private final String code;
    private final String desc;
 
    OrderStatus(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }
 
    public String getCode() {
        return code;
    }
 
    public String getDesc() {
        return desc;
    }
 
    public static OrderStatus fromCode(String code) {
        for (OrderStatus status : values()) {
            if (status.code.equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("未知的订单状态: " + code);
    }
}