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

@@ -8,6 +8,10 @@ import io.jsonwebtoken.Claims;
* @author jsowell
*/
public class Constants {
// 默认分隔符
public static final String DEFAULT_DELIMITER = ",";
// 非法交易流水号 由充电桩启动的订单会传全是0的交易流水号
public static final String ILLEGAL_TRANSACTION_CODE = "00000000000000000000000000000000";

View File

@@ -1,5 +1,6 @@
package com.jsowell.common.core.text;
import com.jsowell.common.constant.Constants;
import com.jsowell.common.util.StringUtils;
import org.apache.commons.lang3.ArrayUtils;
@@ -252,7 +253,7 @@ public class Convert {
* @return 结果
*/
public static Integer[] toIntArray(String str) {
return toIntArray(",", str);
return toIntArray(Constants.DEFAULT_DELIMITER, str);
}
/**
@@ -262,7 +263,7 @@ public class Convert {
* @return 结果
*/
public static Long[] toLongArray(String str) {
return toLongArray(",", str);
return toLongArray(Constants.DEFAULT_DELIMITER, str);
}
/**
@@ -312,7 +313,7 @@ public class Convert {
* @return 结果
*/
public static String[] toStrArray(String str) {
return toStrArray(",", str);
return toStrArray(Constants.DEFAULT_DELIMITER, str);
}
/**

View File

@@ -1,5 +1,6 @@
package com.jsowell.common.filter;
import com.jsowell.common.constant.Constants;
import com.jsowell.common.enums.HttpMethod;
import com.jsowell.common.util.StringUtils;
@@ -25,7 +26,7 @@ public class XssFilter implements Filter {
public void init(FilterConfig filterConfig) throws ServletException {
String tempExcludes = filterConfig.getInitParameter("excludes");
if (StringUtils.isNotEmpty(tempExcludes)) {
String[] url = tempExcludes.split(",");
String[] url = tempExcludes.split(Constants.DEFAULT_DELIMITER);
for (int i = 0; url != null && i < url.length; i++) {
excludes.add(url[i]);
}

View File

@@ -2,6 +2,7 @@ package com.jsowell.common.util;
import com.alibaba.fastjson2.JSONArray;
import com.jsowell.common.constant.CacheConstants;
import com.jsowell.common.constant.Constants;
import com.jsowell.common.core.domain.entity.SysDictData;
import com.jsowell.common.core.redis.RedisCache;
import com.jsowell.common.util.spring.SpringUtils;
@@ -18,7 +19,7 @@ public class DictUtils {
/**
* 分隔符
*/
public static final String SEPARATOR = ",";
public static final String SEPARATOR = Constants.DEFAULT_DELIMITER;
/**
* 设置字典缓存

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;

View File

@@ -5,6 +5,7 @@ import com.jsowell.common.annotation.Excel.ColumnType;
import com.jsowell.common.annotation.Excel.Type;
import com.jsowell.common.annotation.Excels;
import com.jsowell.common.config.JsowellConfig;
import com.jsowell.common.constant.Constants;
import com.jsowell.common.core.domain.AjaxResult;
import com.jsowell.common.core.text.Convert;
import com.jsowell.common.exception.UtilException;
@@ -889,7 +890,7 @@ public class ExcelUtil<T> {
*/
public static String convertByExp(String propertyValue, String converterExp, String separator) {
StringBuilder propertyString = new StringBuilder();
String[] convertSource = converterExp.split(",");
String[] convertSource = converterExp.split(Constants.DEFAULT_DELIMITER);
for (String item : convertSource) {
String[] itemArray = item.split("=");
if (StringUtils.containsAny(propertyValue, separator)) {
@@ -918,7 +919,7 @@ public class ExcelUtil<T> {
*/
public static String reverseByExp(String propertyValue, String converterExp, String separator) {
StringBuilder propertyString = new StringBuilder();
String[] convertSource = converterExp.split(",");
String[] convertSource = converterExp.split(Constants.DEFAULT_DELIMITER);
for (String item : convertSource) {
String[] itemArray = item.split("=");
if (StringUtils.containsAny(propertyValue, separator)) {