package com.goafanti.evaluation.enums; import java.util.HashMap; import java.util.Map; public enum ProfitRate { CJ(1, "采掘", 2, 6), HG(2, "化工", 2, 3.5), GT(3, "钢铁", 2, 6), JZCL(4, "建筑材料", 2, 6), JZZS(5, "建筑装饰", 2, 6), DQSB(6, "电气设备", 3, 4.5), JXSB(7, "机械设备", 1.5, 3), GFJG(8, "国防军工", 2, 6), QC(9, "汽车", 2, 6), JYDQ(10, "家用电器", 1, 2.5), FZFZ(11, "纺织服装", 1, 2.5), QGZZ(12, "轻工制造", 2, 6), SYMY(13, "商业贸易", 1, 2.5), NLMY(14, "农林牧渔", 2, 6), SPYL(15, "食品饮料", 1, 2.5), XXFW(16, "休闲服务", 1, 2.5), YYSW(17, "医药生物", 2.5, 4), GGSY(18, "公用事业", 2, 6), JTYS(19, "交通运输", 2, 6), FDC(20, "房地产", 2, 6), DZ(21, "电子", 7, 10), JSJ(22, "计算机", 4, 5.5), CM(23, "传媒", 2, 6), TX(24, "通信", 2, 6), YH(25, "银行", 2, 6); private Integer id; private String desc; private double minRate; private double maxRate; private static Map map = new HashMap(); private ProfitRate(Integer id, String desc, double minRate, double maxRate) { this.id = id; this.desc = desc; this.minRate = minRate; this.maxRate = maxRate; } static { for (ProfitRate value : ProfitRate.values()) { map.put(value.getId(), value); } } public static ProfitRate getProfitRate(Integer code) { return map.get(code); } public static String getFieldDesc(Integer code) { return containsType(code) ? getProfitRate(code).getDesc() : ""; } public static boolean containsType(Integer code) { return map.containsKey(code); } public Integer getId() { return id; } public String getDesc() { return desc; } public double getMinRate() { return minRate; } public double getMaxRate() { return maxRate; } }