陶杰
2024-12-22 cd53b98d57136461f1ec84632218654f7c037b80
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
package com.mzl.flower.dto.map.gaode;
 
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.google.gson.annotations.JsonAdapter;
import com.mzl.flower.dto.map.tengxun.TengxunLocation;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
 
import java.util.List;
 
// 行政区划对象
 
/**
 * 代码共6位,前两位代表省(一级)、中间两位为市/地区(二级),最后两位为区县(三级)
 *  1)省级:前两位有值,后4位置0,如,河北省:130000
 *  2)市/地区:前4四位有值,包含省代码与市代码,最后两位置0,如河北省保定市:130600
 *  3)区县:6位全有值,包含前4位省市代码及区县代码,河北省保定市涿州市:130681
 *  4)直辖市、香港、澳门:
 *       同省级,在行政区划接口(ws/district/v1/list)中,其下直接为区级(没有二级结构填充)
 *       例:北京,东城区 (而非:“北京,北京,东城区”)
 *  5)直辖县:第3、4位为90的,为省直辖县
 *  6)中国范围内,省市区行政区划以外的区域值为999999(如中国东海)
 *  7)东莞市、中山市、儋州市、嘉峪关市 因其下无区县级,因此增加了末位为99代码的同名子级,用于补齐到三级区划的结构
 *
 * 如何获取城市编码(city_code):
 * 1)编码前4位不为0,第5、6位为0的,为常规城市,可直接取用
 * 2)北京、上海、重庆、天津、香港、澳门,编码和省一致,需要单独提出
 * 3)第3、4位为90的为省直辖县,一般当做城市来应用,也需要单独提出
 */
 
@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class GaodeDistrict {
 
    private String id;
    /**
     * 城市编码
     */
    @JsonAdapter(CityCodeTypeAdapter.class)
    private String citycode;
    /**
     * 区域编码
     * 街道没有独有的 adcode,均继承父类(区县)的 adcode
     */
    private String adcode;
    /**
     * 行政区名称
     */
    private String name;
 
    /**
     * 行政区边界坐标点
     * 当一个行政区范围,由完全分隔两块或者多块的地块组
     *
     * 成,每块地的 polyline 坐标串以 | 分隔 。
     *
     * 如北京 的 朝阳区
     *
     */
    private String polyline;
 
 
    /**
     *
     * 区域中心点
     * 乡镇级别返回的center是边界线上的形点,其他行政级别返回的center不一定是中心点,若政府机构位于面内,则返回政府坐标,政府不在面内,则返回繁华点坐标
     */
    private String center;
 
    /**
     * 行政区划级别
     *
     * country:国家
     *
     * province:省份(直辖市会在province显示)
     *
     * city:市(直辖市会在province显示)
     *
     * district:区县
     *
     * street:街道
     *
     */
    private String level;
 
    /**
     * 下级行政区列表,包含 district 元素
     */
    private List<GaodeDistrict> districts;
 
    /**
     * 行政区划父级别唯一标识(adcode)
     */
    private String parentId;
}