ThirdPartyError.java 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. package com.goafanti.organization.bo;
  2. import java.util.HashMap;
  3. import java.util.Map;
  4. public enum ThirdPartyError {
  5. unitPrice("unitPrice","单价"),
  6. totalAmount("totalAmount","总价"),
  7. partyAmount("partyAmount","付款金额"),
  8. not("not","未知");
  9. private ThirdPartyError(String code, String desc) {
  10. this.code = code;
  11. this.desc = desc;
  12. }
  13. private static Map<String, ThirdPartyError> status = new HashMap<String, ThirdPartyError>();
  14. static {
  15. for (ThirdPartyError value : ThirdPartyError.values()) {
  16. status.put(value.getCode(), value);
  17. }
  18. }
  19. public static boolean containsType(Integer code) {
  20. return status.containsKey(code);
  21. }
  22. private String code;
  23. private String desc;
  24. public String getCode() {
  25. return code;
  26. }
  27. public String getDesc() {
  28. return desc;
  29. }
  30. public static String getValueByCode(String code){
  31. for(ThirdPartyError thirdPartyError:ThirdPartyError.values()){
  32. if(code.equals(thirdPartyError.getCode())){
  33. return thirdPartyError.getDesc();
  34. }
  35. }
  36. return not.getDesc();
  37. }
  38. }