feat(ip): 调整香港和澳门的行政区划层级结构
- 添加香港特别行政区和澳门特别行政区作为二级行政区 - 调整香港和澳门的行政区划层级结构 - 优化区域数据的层级映射规则pull/247/head
parent
7951011b9c
commit
d34f647040
|
|
@ -73,8 +73,13 @@ public class AreaDataConverterTest {
|
||||||
for (CsvRow row : rows) {
|
for (CsvRow row : rows) {
|
||||||
|
|
||||||
// id
|
// id
|
||||||
String idStr = String.format("%-6s", Integer.parseInt(row.get(0))).replace(' ', '0');
|
String id = row.get(0);
|
||||||
|
String idStr;
|
||||||
|
if (id.startsWith("8")) {//香港澳门特殊处理
|
||||||
|
idStr = id;
|
||||||
|
} else {
|
||||||
|
idStr = String.format("%-6s", Integer.parseInt(id)).replace(' ', '0');
|
||||||
|
}
|
||||||
// 转换层级
|
// 转换层级
|
||||||
int deep = Integer.parseInt(row.get(2));
|
int deep = Integer.parseInt(row.get(2));
|
||||||
int type = deep + 2; // 0->2省, 1->3市, 2->4区
|
int type = deep + 2; // 0->2省, 1->3市, 2->4区
|
||||||
|
|
@ -86,9 +91,14 @@ public class AreaDataConverterTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
//父id
|
//父id
|
||||||
String pidStr = String.format("%-6s", Integer.parseInt(row.get(1))).replace(' ', '0');
|
String pid = row.get(1);
|
||||||
if ("000000".equals(pidStr)) {
|
String pidStr;
|
||||||
|
if ("0".equals(pid)) {
|
||||||
pidStr = "1"; // 省级,父节点为中国
|
pidStr = "1"; // 省级,父节点为中国
|
||||||
|
} else if (pid.startsWith("8")) {//香港澳门特殊处理
|
||||||
|
pidStr = pid;
|
||||||
|
} else {
|
||||||
|
pidStr = String.format("%-6s", Integer.parseInt(pid)).replace(' ', '0');
|
||||||
}
|
}
|
||||||
|
|
||||||
areas.add(new AreaObj(Integer.parseInt(idStr), name, type, Integer.parseInt(pidStr)));
|
areas.add(new AreaObj(Integer.parseInt(idStr), name, type, Integer.parseInt(pidStr)));
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
id,name,type,parentId
|
id,name,type,parentId
|
||||||
1,中国,1,0
|
1,中国,1,0
|
||||||
|
81,香港特别行政区,2,1
|
||||||
|
82,澳门特别行政区,2,1
|
||||||
110000,北京市,2,1
|
110000,北京市,2,1
|
||||||
120000,天津市,2,1
|
120000,天津市,2,1
|
||||||
130000,河北省,2,1
|
130000,河北省,2,1
|
||||||
|
|
@ -32,8 +34,8 @@ id,name,type,parentId
|
||||||
640000,宁夏回族自治区,2,1
|
640000,宁夏回族自治区,2,1
|
||||||
650000,新疆维吾尔自治区,2,1
|
650000,新疆维吾尔自治区,2,1
|
||||||
710000,台湾省,2,1
|
710000,台湾省,2,1
|
||||||
810000,香港特别行政区,2,1
|
8100,香港特别行政区,3,81
|
||||||
820000,澳门特别行政区,2,1
|
8200,澳门特别行政区,3,82
|
||||||
110100,北京市,3,110000
|
110100,北京市,3,110000
|
||||||
120100,天津市,3,120000
|
120100,天津市,3,120000
|
||||||
130100,石家庄市,3,130000
|
130100,石家庄市,3,130000
|
||||||
|
|
@ -424,8 +426,6 @@ id,name,type,parentId
|
||||||
712500,台东县,3,710000
|
712500,台东县,3,710000
|
||||||
712600,花莲县,3,710000
|
712600,花莲县,3,710000
|
||||||
712700,澎湖县,3,710000
|
712700,澎湖县,3,710000
|
||||||
810000,香港特别行政区,3,810000
|
|
||||||
820000,澳门特别行政区,3,820000
|
|
||||||
110101,东城区,4,110100
|
110101,东城区,4,110100
|
||||||
110102,西城区,4,110100
|
110102,西城区,4,110100
|
||||||
110105,朝阳区,4,110100
|
110105,朝阳区,4,110100
|
||||||
|
|
@ -3601,8 +3601,8 @@ id,name,type,parentId
|
||||||
712710,七美乡,4,712700
|
712710,七美乡,4,712700
|
||||||
712711,白沙乡,4,712700
|
712711,白沙乡,4,712700
|
||||||
712712,湖西乡,4,712700
|
712712,湖西乡,4,712700
|
||||||
810000,香港特别行政区,4,810000
|
810000,香港特别行政区,4,8100
|
||||||
820000,澳门特别行政区,4,820000
|
820000,澳门特别行政区,4,8200
|
||||||
419001000,济源市,4,419001
|
419001000,济源市,4,419001
|
||||||
429004000,仙桃市,4,429004
|
429004000,仙桃市,4,429004
|
||||||
429005000,潜江市,4,429005
|
429005000,潜江市,4,429005
|
||||||
|
|
|
||||||
|
Loading…
Reference in New Issue