package com.goafanti.organization.bo; import java.util.HashMap; import java.util.Map; public enum ThirdPartyError { unitPrice("unitPrice","单价"), totalAmount("totalAmount","总价"), partyAmount("partyAmount","付款金额"), not("not","未知"); private ThirdPartyError(String code, String desc) { this.code = code; this.desc = desc; } private static Map status = new HashMap(); static { for (ThirdPartyError value : ThirdPartyError.values()) { status.put(value.getCode(), value); } } public static boolean containsType(Integer code) { return status.containsKey(code); } private String code; private String desc; public String getCode() { return code; } public String getDesc() { return desc; } public static String getValueByCode(String code){ for(ThirdPartyError thirdPartyError:ThirdPartyError.values()){ if(code.equals(thirdPartyError.getCode())){ return thirdPartyError.getDesc(); } } return not.getDesc(); } }