cjl
2023-07-11 fe324c8e431243186b2bd9e24db320f4cd5d5942
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
package com.moral.util;
 
/**
 * @ClassName RegionCodeUtils
 * @Description 地区码工具类
 * @Author 陈凯裕
 * @Date 2021/7/1 16:19
 * @Version TODO
 **/
public class RegionCodeUtils {
    /**
    * @Description: 将地区码转换为对应的定位级别
            * @Param: [RegionCode]
            * @return: java.lang.String
            * @Author: 陈凯裕
            * @Date: 2021/7/1
            */
    public static String regionCodeConvertToName(Integer RegionCode ) {
        String RegionCodeStr = String.valueOf(RegionCode);
        char third = RegionCodeStr.charAt(2);
        char fourth = RegionCodeStr.charAt(3);
        char fifth = RegionCodeStr.charAt(4);
        char sixth = RegionCodeStr.charAt(5);
 
        if(sixth=='0'&&fifth=='0'&&fourth=='0'&&third=='0')
            return "province_code";
        if(sixth=='0'&&fifth=='0')
            return "city_code";
        return "area_code";
    }
}