View Javadoc
1   package com.foxinmy.weixin4j.mp.type;
2   
3   import java.util.HashMap;
4   import java.util.Map;
5   
6   /**
7    * 模板消息所用到的行业信息
8    * 
9    * @className IndustryType
10   * @author jinyu(foxinmy@gmail.com)
11   * @date 2014年12月12日
12   * @since JDK 1.6
13   */
14  public enum IndustryType {
15  	ITKEJI_HULIANWANG$DIANZISHANGWU("IT科技", "互联网|电子商务", 1), ITKEJI_ITRUANJIANYUFUWU(
16  			"IT科技", "IT软件与服务", 2), ITKEJI_ITYINGJIANYUSHEBEI("IT科技", "IT硬件与设备",
17  			3), ITKEJI_DIANZIJISHU("IT科技", "电子技术", 4), ITKEJI_TONGXINYUYUNYINGSHANG(
18  			"IT科技", "通信与运营商", 5), ITKEJI_WANGLUOYOUXI("IT科技", "网络游戏", 6), JINRONGYE_YINHANG(
19  			"金融业", "银行", 7), JINRONGYE_JIJIN$LICAI$XINTUO("金融业", "基金|理财|信托", 8), JINRONGYE_BAOXIAN(
20  			"金融业", "保险", 9), CANYIN_CANYIN("餐饮", "餐饮", 10), JIUDIANLUYOU_JIUDIAN(
21  			"酒店旅游", "酒店", 11), JIUDIANLUYOU_LUYOU("酒店旅游", "旅游", 12), YUNSHUYUCANGCHU_KUAIDI(
22  			"运输与仓储", "快递", 13), YUNSHUYUCANGCHU_WULIU("运输与仓储", "物流", 14), YUNSHUYUCANGCHU_CANGCHU(
23  			"运输与仓储", "仓储", 15), JIAOYU_PEIXUN("教育", "培训", 16), JIAOYU_YUANXIAO(
24  			"教育", "院校", 17), ZHENGFUYUGONGGONGSHIYE_XUESHUKEYAN("政府与公共事业",
25  			"学术科研", 18), ZHENGFUYUGONGGONGSHIYE_JIAOJING("政府与公共事业", "交警", 19), ZHENGFUYUGONGGONGSHIYE_BOWUGUAN(
26  			"政府与公共事业", "博物馆", 20), ZHENGFUYUGONGGONGSHIYE_GONGGONGSHIYE$FEIYINGLIJIGOU(
27  			"政府与公共事业", "公共事业|非盈利机构", 21), YIYAOHULI_YIYAOYILIAO("医药护理", "医药医疗",
28  			22), YIYAOHULI_HULIMEIRONG("医药护理", "护理美容", 23), YIYAOHULI_BAOJIANYUWEISHENG(
29  			"医药护理", "保健与卫生", 24), JIAOTONGGONGJU_QICHEXIANGGUAN("交通工具", "汽车相关",
30  			25), JIAOTONGGONGJU_MOTUOCHEXIANGGUAN("交通工具", "摩托车相关", 26), JIAOTONGGONGJU_HUOCHEXIANGGUAN(
31  			"交通工具", "火车相关", 27), JIAOTONGGONGJU_FEIJIXIANGGUAN("交通工具", "飞机相关",
32  			28), FANGDICHAN_JIANZHU("房地产", "建筑", 29), FANGDICHAN_WUYE("房地产",
33  			"物业", 30), XIAOFEIPIN_XIAOFEIPIN("消费品", "消费品", 31), SHANGYEFUWU_FALU(
34  			"商业服务", "法律", 32), SHANGYEFUWU_HUIZHAN("商业服务", "会展", 33), SHANGYEFUWU_ZHONGJIEFUWU(
35  			"商业服务", "中介服务", 34), SHANGYEFUWU_RENZHENG("商业服务", "认证", 35), SHANGYEFUWU_SHENJI(
36  			"商业服务", "审计", 36), WENTIYULE_CHUANMEI("文体娱乐", "传媒", 37), WENTIYULE_TIYU(
37  			"文体娱乐", "体育", 38), WENTIYULE_YULEXIUXIAN("文体娱乐", "娱乐休闲", 39), YINSHUA_YINSHUA(
38  			"印刷", "印刷", 40), QITA_QITA("其它", "其它", 41);
39  
40  	private String primary;
41  	private String secondary;
42  	private int typeId;
43  
44  	IndustryType(String primary, String secondary, int typeId) {
45  		this.primary = primary;
46  		this.secondary = secondary;
47  		this.typeId = typeId;
48  	}
49  
50  	public String getPrimary() {
51  		return primary;
52  	}
53  
54  	public String getSecondary() {
55  		return secondary;
56  	}
57  
58  	public int getTypeId() {
59  		return typeId;
60  	}
61  
62  	private static final Map<String, IndustryType> INDUSTRYTYPEMAP;
63  	private static final String SEPARATOR;
64  	static {
65  		SEPARATOR = "-";
66  		INDUSTRYTYPEMAP = new HashMap<String, IndustryType>();
67  		for (IndustryType type : IndustryType.values()) {
68  			INDUSTRYTYPEMAP.put(
69  					String.format("%s%s%s", type.getPrimary(), SEPARATOR,
70  							type.getSecondary()), type);
71  		}
72  	}
73  
74  	public static IndustryType getIndustry(String primary, String secondary) {
75  		return INDUSTRYTYPEMAP.get(String.format("%s%s%s", primary, SEPARATOR,
76  				secondary));
77  	}
78  }