ProfitRate.java 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. package com.goafanti.evaluation.enums;
  2. import java.util.HashMap;
  3. import java.util.Map;
  4. public enum ProfitRate {
  5. CJ(1, "采掘", 2, 6),
  6. HG(2, "化工", 2, 3.5),
  7. GT(3, "钢铁", 2, 6),
  8. JZCL(4, "建筑材料", 2, 6),
  9. JZZS(5, "建筑装饰", 2, 6),
  10. DQSB(6, "电气设备", 3, 4.5),
  11. JXSB(7, "机械设备", 1.5, 3),
  12. GFJG(8, "国防军工", 2, 6),
  13. QC(9, "汽车", 2, 6),
  14. JYDQ(10, "家用电器", 1, 2.5),
  15. FZFZ(11, "纺织服装", 1, 2.5),
  16. QGZZ(12, "轻工制造", 2, 6),
  17. SYMY(13, "商业贸易", 1, 2.5),
  18. NLMY(14, "农林牧渔", 2, 6),
  19. SPYL(15, "食品饮料", 1, 2.5),
  20. XXFW(16, "休闲服务", 1, 2.5),
  21. YYSW(17, "医药生物", 2.5, 4),
  22. GGSY(18, "公用事业", 2, 6),
  23. JTYS(19, "交通运输", 2, 6),
  24. FDC(20, "房地产", 2, 6),
  25. DZ(21, "电子", 7, 10),
  26. JSJ(22, "计算机", 4, 5.5),
  27. CM(23, "传媒", 2, 6),
  28. TX(24, "通信", 2, 6),
  29. YH(25, "银行", 2, 6);
  30. private Integer id;
  31. private String desc;
  32. private double minRate;
  33. private double maxRate;
  34. private static Map<Integer, ProfitRate> map = new HashMap<Integer, ProfitRate>();
  35. private ProfitRate(Integer id, String desc, double minRate, double maxRate) {
  36. this.id = id;
  37. this.desc = desc;
  38. this.minRate = minRate;
  39. this.maxRate = maxRate;
  40. }
  41. static {
  42. for (ProfitRate value : ProfitRate.values()) {
  43. map.put(value.getId(), value);
  44. }
  45. }
  46. public static ProfitRate getProfitRate(Integer code) {
  47. return map.get(code);
  48. }
  49. public static String getFieldDesc(Integer code) {
  50. return containsType(code) ? getProfitRate(code).getDesc() : "";
  51. }
  52. public static boolean containsType(Integer code) {
  53. return map.containsKey(code);
  54. }
  55. public Integer getId() {
  56. return id;
  57. }
  58. public String getDesc() {
  59. return desc;
  60. }
  61. public double getMinRate() {
  62. return minRate;
  63. }
  64. public double getMaxRate() {
  65. return maxRate;
  66. }
  67. }