| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- package com.goafanti.order.enums;
- import java.util.HashMap;
- import java.util.Map;
- public enum OrderState {
- /** 意向订单 **/
- INTENTION(0,"意向订单 "),
- /** 等待支付首付款 **/
- WAIT_FOR_FIRST_PAY(1,"等待支付首付"),
- /** 等待支付尾款 **/
- WAIT_FOR_LAST_PAY(2,"等待支付尾款"),
- /** 已完成 **/
- COMPLETED(3,"已完成"),
- /** 已取消 **/
- CANCELLED(4,"已取消"),
- /** 无效 **/
- INVALID(10, "无效");
-
- private OrderState(Integer code, String desc) {
- this.code = code;
- this.desc = desc;
- }
- private static Map<Integer, OrderState> status = new HashMap<Integer, OrderState>();
- static {
- for (OrderState value : OrderState.values()) {
- status.put(value.getCode(), value);
- }
- }
- public static OrderState getStatus(Integer code) {
- if (containsType(code)) {
- return status.get(code);
- }
- return INVALID;
- }
- public static boolean containsType(Integer code) {
- return status.containsKey(code);
- }
- private Integer code;
- private String desc;
- public Integer getCode() {
- return code;
- }
- public void setCode(Integer code) {
- this.code = code;
- }
- public String getDesc() {
- return desc;
- }
- public void setDesc(String desc) {
- this.desc = desc;
- }
-
- }
|