LiquidationNewState.java 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. package com.goafanti.order.enums;
  2. import java.util.HashMap;
  3. import java.util.Map;
  4. public enum LiquidationNewState {
  5. /** 首付待付清 **/
  6. WAIT_PAY_FIRST_BALANCE(0,"首付待付清"),
  7. /** 尾款待付清 **/
  8. WAIT_PAY_LAST_BALANCE(1,"尾款待付清"),
  9. /** 已付清 **/
  10. ALREADY_PAY(2,"已付清"),
  11. /** 退款待确认 **/
  12. REBATESQUAN(3,"退款待确认"),
  13. FULL_REFUND(4,"全部退款"),
  14. /** 无效 **/
  15. INVALID(10, "INVALID");
  16. private LiquidationNewState(Integer code, String desc) {
  17. this.code = code;
  18. this.desc = desc;
  19. }
  20. private static Map<Integer, LiquidationNewState> status = new HashMap<Integer, LiquidationNewState>();
  21. static {
  22. for (LiquidationNewState value : LiquidationNewState.values()) {
  23. status.put(value.getCode(), value);
  24. }
  25. }
  26. public static LiquidationNewState getStatus(Integer code) {
  27. if (containsType(code)) {
  28. return status.get(code);
  29. }
  30. return INVALID;
  31. }
  32. public static String getValueByCode(Integer code){
  33. for(LiquidationNewState liquidationNewState:LiquidationNewState.values()){
  34. if(code.equals(liquidationNewState.getCode())){
  35. return liquidationNewState.getDesc();
  36. }
  37. }
  38. return null;
  39. }
  40. public static boolean containsType(Integer code) {
  41. return status.containsKey(code);
  42. }
  43. private Integer code;
  44. private String desc;
  45. public Integer getCode() {
  46. return code;
  47. }
  48. public void setCode(Integer code) {
  49. this.code = code;
  50. }
  51. public String getDesc() {
  52. return desc;
  53. }
  54. public void setDesc(String desc) {
  55. this.desc = desc;
  56. }
  57. }