package com.winsun.constant;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

/**
 * 排序
 * @author Liph
 * @datetime 2019-09-19/9/27 11:19
 */
public enum OrderStatus {
    //
    PENDINGSUBMISSION("1", "待提交"),
    FILE("4", "已完成"),
    INVALID("5", "异常单"),
    PENDINGDISTRIBUTION("6", "待配送"),
    INLOGISTICSDISTRIBUTION("7", "已完成"),
    SUCCESSFULDISTRIBUTION("8", "已完成"),
    ACCEPTANCESUCCESSFUL("3", "已完成"),
    CHARGED("9", "已收费"),
    ACCEPTEXCEPTCION("10", "异常单"),
    PENDINGACCEPTANCE("2", "待受理"),
    NOTPAID("100", "未支付");
    OrderStatus(String id, String name) {
        this.id = id;
        this.name = name;
    };

    private static final Map<String, OrderStatus> DATAS = new HashMap<>();
    static {
        Arrays.asList(values()).forEach(data -> DATAS.put(data.getId(), data));
    }

    private String id;

    private String name;

    public String getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public static OrderStatus findById(String id) {
        return DATAS.getOrDefault(id, null);
    }
}
