Browse Source

fix 处理常驻人口居住地址数据

tjf 3 năm trước cách đây
mục cha
commit
7db576a455

+ 2 - 2
boman-web-core/src/main/java/com/boman/web/core/controller/TestController.java

@@ -556,13 +556,13 @@ public class TestController {
     }
 
     public static Map<String, String> addressResolutionMap(String address) {
-        String regex = "(?<town>[^区]+区|.+镇|.+乡)?(?<village>.[^村]+村|.+委会|.+乡)";
+        String regex = "(?<town>[^区]+区|.+镇|.+乡)?(?<village>.[^村]+村|.+委会|.+乡)";
         Matcher m = Pattern.compile(regex).matcher(address);
         String province = null, city = null, county = null, town = null, village = null;
         List<Map<String, String>> table = new ArrayList<Map<String, String>>();
         Map<String, String> row = null;
         String result = null;
-        while (m.find()) {
+        if (m.find()) {
             row = new LinkedHashMap<String, String>();
             town = m.group("town");
             row.put("town", town == null ? "" : town.trim());