1.修改查询条件regionCode like截取

2.修改给招聘会提供的接口
This commit is contained in:
sh
2026-03-18 19:31:44 +08:00
parent 3d69e3d262
commit 7664af7251
5 changed files with 62 additions and 8 deletions

View File

@@ -344,4 +344,25 @@ public class StringUtil {
return "";
}
}
/**
* 截取行政区划
* @param code
* @return
*/
public static String autoXzqh(String code) {
if (code == null || code.length() != 12) return code;
int zeroCount = 0;
for (int i = 11; i >= 0; i--) {
if (code.charAt(i) == '0') zeroCount++;
else break;
}
switch (zeroCount) {
case 10: return code.substring(0, 2);
case 8: return code.substring(0, 4);
case 6: return code.substring(0, 6);
case 3: return code.substring(0, 9);
default: return code;
}
}
}