update 默认分隔符

This commit is contained in:
2023-08-04 13:55:36 +08:00
parent 59d8737daa
commit bf1fa80497
13 changed files with 67 additions and 41 deletions

View File

@@ -69,7 +69,7 @@ public class AddressUtils {
if (StringUtils.isBlank(areaCode) || StringUtils.isBlank(address)) {
return null;
}
String[] split = StringUtils.split(areaCode, ",");
String[] split = StringUtils.split(areaCode, Constants.DEFAULT_DELIMITER);
String param = "key=" + AMAP_GET_LOCATION_KEY + "&city=" + split[2] + "&address=" + address;
String resultStr = HttpUtils.sendGet(AMAP_GET_LOCATION_URL, param, Constants.UTF8);
if (StringUtils.isNotBlank(resultStr)) {
@@ -81,7 +81,7 @@ public class AddressUtils {
Map<String, String> map = Maps.newHashMap();
JSONObject jsonObject = geocodes.getJSONObject(0);
String location = jsonObject.getString("location");
String[] strArr = StringUtils.split(location, ",");
String[] strArr = StringUtils.split(location, Constants.DEFAULT_DELIMITER);
map.put("lng", strArr[0]);
map.put("lat", strArr[1]);
return map;

View File

@@ -1,5 +1,6 @@
package com.jsowell.common.util.ip;
import com.jsowell.common.constant.Constants;
import com.jsowell.common.util.StringUtils;
import javax.servlet.http.HttpServletRequest;
@@ -200,8 +201,8 @@ public class IpUtils {
*/
public static String getMultistageReverseProxyIp(String ip) {
// 多级反向代理检测
if (ip != null && ip.indexOf(",") > 0) {
final String[] ips = ip.trim().split(",");
if (ip != null && ip.indexOf(Constants.DEFAULT_DELIMITER) > 0) {
final String[] ips = ip.trim().split(Constants.DEFAULT_DELIMITER);
for (String subIp : ips) {
if (false == isUnknown(subIp)) {
ip = subIp;