New file |
| | |
| | | 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"; |
| | | } |
| | | } |