puzhibing
2023-06-30 f58cca364b731eac2d60a440ffaa804be3cd43fd
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
53
54
55
56
57
58
59
60
61
62
package com.stylefeng.guns.modular.system.enums;
 
 
 
/**
 * @Description 订单状态枚举
 * @Author xiaochen
 * @Date 2023/02/15 9:42
 */
public enum OrderStateEnum {
 
    /*订单状态(101=待接单,102=已接单,103=前往预约点,104=到达预约点,105=开始服务,106=到达目的地,107=待支付,108=待评价,109=已完成,201=转单中,301=已取消,401=等待中)*/
 
    PENDING_ORDER(101, "待接单"),
    ORDER_RECEIVED(102, "已接单"),
    GO_APPOINTMENT_POINT(103, "前往预约点"),
    ARRIVE_APPOINTMENT_POINT(104, "到达预约点"),
    START_SERVICE(105, "开始服务"),
    ARRIVE_IN(106, "到达目的地"),
    WAIT_PAY(107,"待支付"),
    WAIT_EVALUATED(108, "待评价"),
    FINISH(109, "已完成"),
    TRANSFERRING(201, "转单中"),
    CANCELED(301,"已取消"),
    WAITING(401,"等待中");
 
    private String desc;
 
 
    private int code;
 
 
    OrderStateEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }
 
    public String getDesc() {
        return desc;
    }
 
    public int getCode() {
        return code;
    }
 
    /**
     * 通过code获取枚举
     *
     * @param code
     * @return
     */
    public static OrderStateEnum fromCode(Integer code) {
        OrderStateEnum[] resultTypes = OrderStateEnum.values();
        for (OrderStateEnum resultType : resultTypes) {
            if (code.equals(resultType.getCode())) {
                return resultType;
            }
        }
        return null;
    }
 
}