package com.goafanti.order.enums;

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

/**
 * 回款状态
 *
 */
public enum ReceivablesStatus {
	ZC(0,"正常"),
	CF(1,"重复"),
	DDYC(2,"订单异常"),
	JEYC(3,"金额异常"),
	MCYC(4,"名称异常"),
	YSK(5,"已收款"),
	BGSD(6,"变更锁定");
	
	private ReceivablesStatus(Integer code, String desc) {
		this.code = code;
		this.desc = desc;
	}

	private static Map<Integer, ReceivablesStatus> status = new HashMap<Integer, ReceivablesStatus>();

	static {
		for (ReceivablesStatus value : ReceivablesStatus.values()) {
			status.put(value.getCode(), value);
		}
	}
	public static ReceivablesStatus getStatus(Integer code) {
		if (containsType(code)) {
			return status.get(code);
		}
		return ZC;
	}
	public static boolean containsType(Integer code) {
		return status.containsKey(code);
	}
	public static String getValueByCode(Integer code){
        for(ReceivablesStatus bonusSubject:ReceivablesStatus.values()){
            if(code.equals(bonusSubject.getCode())){
                return bonusSubject.getDesc();
            }
        }
        return  null;
    }
	
	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;
	}
}
