-
大小: 199KB文件类型: .java金币: 2下载: 1 次发布日期: 2021-06-18
- 语言: Java
- 标签: GetAreaByCod
资源简介
之前上传的的资源中缺少将行政区域代码转成地区信息的工具类,进行补充,希望可以帮到大家 。
代码片段和文件信息
package com.ctsing.psss.module.atest.util;
public class GetAreaByCode {
public static String getNativePlace(int nativePlaceCode) {
int shengCode = nativePlaceCode / 10000;
int shiCode = nativePlaceCode / 100;
int quxianCode = nativePlaceCode;
String sheng = getNameString(shengCode);
String shi = getNameString(shiCode);
String quxian = getNameString(quxianCode);
String nativePlace = ““;
if (sheng != null) {
nativePlace += sheng;
}
if (shi != null) {
nativePlace += shi;
}
if (quxian != null) {
nativePlace += quxian;
}
return nativePlace;
}
private static String getNameString(int code) {
switch (code) {
case 11:
return “北京市“;
case 1101:
return “市辖区“;
case 110101:
return “东城区“;
case 110102:
return “西城区“;
case 110105:
return “朝阳区“;
case 110106:
return “丰台区“;
case 110107:
return “石景山区“;
case 110108:
return “海淀区“;
case 110109:
return “门头沟区“;
case 110111:
return “房山区“;
case 110112:
return “通州区“;
case 110113:
return “顺义区“;
case 110114:
return “昌平区“;
case 110115:
return “大兴区“;
case 110116:
return “怀柔区“;
case 110117:
return “平谷区“;
case 1102:
return “县“;
case 110228:
return “密云县“;
case 110229:
return “延庆县“;
case 12:
return “天津市“;
case 1201:
return “市辖区“;
case 120101:
return “和平区“;
case 120102:
return “河东区“;
case 120103:
return “河西区“;
case 120104:
return “南开区“;
case 120105:
return “河北区“;
case 120106:
return “红桥区“;
case 120110:
return “东丽区“;
case 120111:
return “西青区“;
case 120112:
return “津南区“;
case 120113:
return “北辰区“;
case 120114:
return “武清区“;
case 120115:
return “宝坻区“;
case 120116:
return “滨海新区“;
case 1202:
return “县“;
case 120221:
return “宁河县“;
case 120223:
return “静海县“;
case 120225:
return “蓟县“;
case 13:
return “河北省“;
case 1301:
return “石家庄市“;
case 130101:
return “市辖区“;
case 130102:
return “长安区“;
case 130104:
return “桥西区“;
- 上一篇:0基础java笔记自记
- 下一篇:南大数据库-gba
se
评论
共有 条评论