fix():格式规范修改
parent
a3538fde09
commit
e24bd88c16
|
@ -30,7 +30,7 @@ public class SpringDocConfig {
|
|||
}
|
||||
|
||||
@Bean
|
||||
public OpenAPI springShopOpenAPI() {
|
||||
public OpenAPI springShopOpenApi() {
|
||||
return new OpenAPI()
|
||||
.info(info())
|
||||
.externalDocs(externalDocumentation());
|
||||
|
|
|
@ -6,6 +6,11 @@ import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerIntercept
|
|||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* mybatis-plus配置类
|
||||
*
|
||||
* @author dongzeliang
|
||||
*/
|
||||
@Configuration
|
||||
public class MybatisPlusConfig {
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.muyu.common.core.constant;
|
||||
|
||||
/**
|
||||
* 文件常量
|
||||
* @author dongzeliang
|
||||
* @version 1.0
|
||||
* @description: 文件常量
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.muyu.common.core.constant;
|
||||
|
||||
/**
|
||||
* HTTP常量
|
||||
* @author dongzeliang
|
||||
* @version 1.0
|
||||
* @description: HTTP常量
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
package com.muyu.common.core.constant;
|
||||
|
||||
/**
|
||||
* 切割常量
|
||||
* @author dongzeliang
|
||||
* @version 1.0
|
||||
* @description: 切割常量
|
||||
* @date 2025/2/27 11:55
|
||||
*/
|
||||
public class SplitConstants {
|
||||
/**
|
||||
* 空字符串
|
||||
*/
|
||||
public static final String NULL_STR = "";
|
||||
|
||||
/**
|
||||
* 空串
|
||||
*/
|
||||
public static final String EMPTY_STR = " ";
|
||||
|
||||
/**
|
||||
* 下划线
|
||||
*/
|
||||
public static final char UNDERLINE = '_';
|
||||
|
||||
/**
|
||||
* 下划线
|
||||
*/
|
||||
public static final String UNDERLINE_STR = "_";
|
||||
|
||||
/**
|
||||
* 逗号
|
||||
*/
|
||||
public static final String COMMA_STR = ",";
|
||||
|
||||
/**
|
||||
* 点
|
||||
*/
|
||||
public static final String POINT_STR = ".";
|
||||
|
||||
/**
|
||||
* 加
|
||||
*/
|
||||
public static final String ADDITION_STR = "+";
|
||||
|
||||
/**
|
||||
* 横岗/减
|
||||
*/
|
||||
public static final String SUBTRACTION_STR = "-";
|
||||
|
||||
/**
|
||||
* 等于
|
||||
*/
|
||||
public static final String EQUAL_STR = "=";
|
||||
|
||||
/**
|
||||
* \@符号
|
||||
*/
|
||||
public static final String ANTE_STR = "@";
|
||||
|
||||
|
||||
}
|
|
@ -2,6 +2,8 @@ package com.muyu.common.core.exception.auth;
|
|||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import static com.muyu.common.core.constant.SplitConstants.*;
|
||||
|
||||
/**
|
||||
* 未能通过的权限认证异常
|
||||
*
|
||||
|
@ -15,6 +17,6 @@ public class NotPermissionException extends RuntimeException {
|
|||
}
|
||||
|
||||
public NotPermissionException (String[] permissions) {
|
||||
super(StringUtils.join(permissions, ","));
|
||||
super(StringUtils.join(permissions, COMMA_STR));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@ package com.muyu.common.core.exception.auth;
|
|||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import static com.muyu.common.core.constant.SplitConstants.*;
|
||||
|
||||
/**
|
||||
* 未能通过的角色认证异常
|
||||
*
|
||||
|
@ -15,6 +17,6 @@ public class NotRoleException extends RuntimeException {
|
|||
}
|
||||
|
||||
public NotRoleException (String[] roles) {
|
||||
super(StringUtils.join(roles, ","));
|
||||
super(StringUtils.join(roles, COMMA_STR));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,8 @@ import java.text.NumberFormat;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.muyu.common.core.constant.SplitConstants.*;
|
||||
|
||||
/**
|
||||
* 类型转换器
|
||||
*
|
||||
|
@ -266,7 +268,7 @@ public class Convert {
|
|||
* @return 结果
|
||||
*/
|
||||
public static Integer[] toIntArray (String str) {
|
||||
return toIntArray(",", str);
|
||||
return toIntArray(COMMA_STR, str);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -277,7 +279,7 @@ public class Convert {
|
|||
* @return 结果
|
||||
*/
|
||||
public static Long[] toLongArray (String str) {
|
||||
return toLongArray(",", str);
|
||||
return toLongArray(COMMA_STR, str);
|
||||
}
|
||||
/**
|
||||
* 转换为Long数组<br>
|
||||
|
@ -287,7 +289,7 @@ public class Convert {
|
|||
* @return 结果
|
||||
*/
|
||||
public static List<Long> toLongList (String str) {
|
||||
return List.of(toLongArray(",", str));
|
||||
return List.of(toLongArray(COMMA_STR, str));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -340,7 +342,7 @@ public class Convert {
|
|||
* @return 结果
|
||||
*/
|
||||
public static String[] toStrArray (String str) {
|
||||
return toStrArray(",", str);
|
||||
return toStrArray(COMMA_STR, str);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.nio.charset.StandardCharsets;
|
|||
import java.util.*;
|
||||
|
||||
import static com.muyu.common.core.constant.HttpConstants.*;
|
||||
import static com.muyu.common.core.constant.SplitConstants.*;
|
||||
import static org.springframework.http.HttpHeaders.ACCEPT;
|
||||
|
||||
/**
|
||||
|
@ -98,7 +99,7 @@ public class ServletUtils {
|
|||
public static Map<String, String> getParamMap (ServletRequest request) {
|
||||
Map<String, String> params = new HashMap<>(16);
|
||||
for (Map.Entry<String, String[]> entry : getParams(request).entrySet()) {
|
||||
params.put(entry.getKey(), StringUtils.join(entry.getValue(), ","));
|
||||
params.put(entry.getKey(), StringUtils.join(entry.getValue(), COMMA_STR));
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
|
|
@ -8,21 +8,14 @@ import java.util.Collection;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.muyu.common.core.constant.SplitConstants.*;
|
||||
|
||||
/**
|
||||
* 字符串工具类
|
||||
*
|
||||
* @author muyu
|
||||
*/
|
||||
public class StringUtils extends org.apache.commons.lang3.StringUtils {
|
||||
/**
|
||||
* 空字符串
|
||||
*/
|
||||
private static final String NULLSTR = "";
|
||||
|
||||
/**
|
||||
* 下划线
|
||||
*/
|
||||
private static final char SEPARATOR = '_';
|
||||
|
||||
/**
|
||||
* 获取参数不为空值
|
||||
|
@ -108,7 +101,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
|
|||
* @return true:为空 false:非空
|
||||
*/
|
||||
public static boolean isEmpty (String str) {
|
||||
return isNull(str) || NULLSTR.equals(str.trim());
|
||||
return isNull(str) || NULL_STR.equals(str.trim());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -172,7 +165,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
|
|||
*/
|
||||
public static String substring (final String str, int start) {
|
||||
if (str == null) {
|
||||
return NULLSTR;
|
||||
return NULL_STR;
|
||||
}
|
||||
|
||||
if (start < 0) {
|
||||
|
@ -183,7 +176,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
|
|||
start = 0;
|
||||
}
|
||||
if (start > str.length()) {
|
||||
return NULLSTR;
|
||||
return NULL_STR;
|
||||
}
|
||||
|
||||
return str.substring(start);
|
||||
|
@ -200,7 +193,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
|
|||
*/
|
||||
public static String substring (final String str, int start, int end) {
|
||||
if (str == null) {
|
||||
return NULLSTR;
|
||||
return NULL_STR;
|
||||
}
|
||||
|
||||
if (end < 0) {
|
||||
|
@ -215,7 +208,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
|
|||
}
|
||||
|
||||
if (start > end) {
|
||||
return NULLSTR;
|
||||
return NULL_STR;
|
||||
}
|
||||
|
||||
if (start < 0) {
|
||||
|
@ -331,9 +324,9 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
|
|||
}
|
||||
|
||||
if (preCharIsUpperCase && curreCharIsUpperCase && !nexteCharIsUpperCase) {
|
||||
sb.append(SEPARATOR);
|
||||
sb.append(UNDERLINE);
|
||||
} else if ((i != 0 && !preCharIsUpperCase) && curreCharIsUpperCase) {
|
||||
sb.append(SEPARATOR);
|
||||
sb.append(UNDERLINE);
|
||||
}
|
||||
sb.append(Character.toLowerCase(c));
|
||||
}
|
||||
|
@ -373,12 +366,12 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
|
|||
if (name == null || name.isEmpty()) {
|
||||
// 没必要转换
|
||||
return "";
|
||||
} else if (!name.contains("_")) {
|
||||
} else if (!name.contains(UNDERLINE_STR)) {
|
||||
// 不含下划线,仅将首字母大写
|
||||
return name.substring(0, 1).toUpperCase() + name.substring(1);
|
||||
}
|
||||
// 用下划线将原始字符串分割
|
||||
String[] camels = name.split("_");
|
||||
String[] camels = name.split(UNDERLINE_STR);
|
||||
for (String camel : camels) {
|
||||
// 跳过原始字符串中开头、结尾的下换线或双重下划线
|
||||
if (camel.isEmpty()) {
|
||||
|
@ -399,7 +392,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
|
|||
if (s == null) {
|
||||
return null;
|
||||
}
|
||||
if (s.indexOf(SEPARATOR) == -1) {
|
||||
if (s.indexOf(UNDERLINE) == -1) {
|
||||
return s;
|
||||
}
|
||||
s = s.toLowerCase();
|
||||
|
@ -408,7 +401,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
|
|||
for (int i = 0 ; i < s.length() ; i++) {
|
||||
char c = s.charAt(i);
|
||||
|
||||
if (c == SEPARATOR) {
|
||||
if (c == UNDERLINE) {
|
||||
upperCase = true;
|
||||
} else if (upperCase) {
|
||||
sb.append(Character.toUpperCase(c));
|
||||
|
|
|
@ -10,6 +10,8 @@ import java.io.*;
|
|||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import static com.muyu.common.core.constant.SplitConstants.*;
|
||||
|
||||
/**
|
||||
* 文件处理工具类
|
||||
*
|
||||
|
@ -124,7 +126,7 @@ public class FileUtils {
|
|||
if (agent.contains("MSIE")) {
|
||||
// IE浏览器
|
||||
filename = URLEncoder.encode(filename, StandardCharsets.UTF_8);
|
||||
filename = filename.replace("+", " ");
|
||||
filename = filename.replace(ADDITION_STR, EMPTY_STR);
|
||||
} else if (agent.contains("Firefox")) {
|
||||
// 火狐浏览器
|
||||
filename = new String(fileName.getBytes(), StandardCharsets.ISO_8859_1);
|
||||
|
|
|
@ -7,6 +7,8 @@ import jakarta.servlet.http.HttpServletRequest;
|
|||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import static com.muyu.common.core.constant.SplitConstants.*;
|
||||
|
||||
/**
|
||||
* 获取IP方法
|
||||
*
|
||||
|
@ -17,7 +19,7 @@ public class IpUtils {
|
|||
// 匹配 ip
|
||||
public final static String REGX_IP = "((" + REGX_0_255 + "\\.){3}" + REGX_0_255 + ")";
|
||||
// 匹配网段
|
||||
public final static String REGX_IP_SEG = "(" + REGX_IP + "-" + REGX_IP + ")";
|
||||
public final static String REGX_IP_SEG = "(" + REGX_IP + SUBTRACTION_STR + REGX_IP + ")";
|
||||
public final static String REGX_IP_WILDCARD = "(((\\*\\.){3}\\*)|(" + REGX_0_255 + "(\\.\\*){3})|(" + REGX_0_255 + "\\." + REGX_0_255 + ")(\\.\\*){2}" + "|((" + REGX_0_255 + "\\.){3}\\*))";
|
||||
|
||||
/**
|
||||
|
@ -221,8 +223,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(COMMA_STR) > 0) {
|
||||
final String[] ips = ip.trim().split(COMMA_STR);
|
||||
for (String subIp : ips) {
|
||||
if (!isUnknown(subIp)) {
|
||||
ip = subIp;
|
||||
|
|
|
@ -37,6 +37,9 @@ import java.time.LocalDateTime;
|
|||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.muyu.common.core.constant.SplitConstants.*;
|
||||
import static com.muyu.common.core.constant.SplitConstants.UNDERLINE_STR;
|
||||
|
||||
/**
|
||||
* Excel相关处理
|
||||
*
|
||||
|
@ -44,7 +47,7 @@ import java.util.stream.Collectors;
|
|||
*/
|
||||
public class ExcelUtil<T> {
|
||||
public static final String FORMULA_REGEX_STR = "=|-|\\+|@";
|
||||
public static final String[] FORMULA_STR = {"=", "-", "+", "@"};
|
||||
public static final String[] FORMULA_STR = {EQUAL_STR, SUBTRACTION_STR, ADDITION_STR, ANTE_STR};
|
||||
/**
|
||||
* Excel sheet最大行数,默认65536
|
||||
*/
|
||||
|
@ -148,9 +151,9 @@ 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(COMMA_STR);
|
||||
for (String item : convertSource) {
|
||||
String[] itemArray = item.split("=");
|
||||
String[] itemArray = item.split(EQUAL_STR);
|
||||
if (StringUtils.containsAny(propertyValue, separator)) {
|
||||
for (String value : propertyValue.split(separator)) {
|
||||
if (itemArray[0].equals(value)) {
|
||||
|
@ -178,9 +181,9 @@ 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(COMMA_STR);
|
||||
for (String item : convertSource) {
|
||||
String[] itemArray = item.split("=");
|
||||
String[] itemArray = item.split(EQUAL_STR);
|
||||
if (StringUtils.containsAny(propertyValue, separator)) {
|
||||
for (String value : propertyValue.split(separator)) {
|
||||
if (itemArray[1].equals(value)) {
|
||||
|
@ -852,7 +855,7 @@ public class ExcelUtil<T> {
|
|||
* @param endCol 结束列
|
||||
*/
|
||||
public void setXssfValidationWithHidden(Sheet sheet, String[] textList, String promptContent, int firstRow, int endRow, int firstCol, int endCol) {
|
||||
String hideSheetName = "combo_" + firstCol + "_" + endCol;
|
||||
String hideSheetName = "combo_" + firstCol + UNDERLINE_STR + endCol;
|
||||
// 用于存储 下拉菜单数据
|
||||
Sheet hideSheet = wb.createSheet(hideSheetName);
|
||||
for (int i = 0 ; i < textList.length ; i++) {
|
||||
|
|
|
@ -12,7 +12,7 @@ public class IdUtils {
|
|||
* @return 随机UUID
|
||||
*/
|
||||
public static String randomUuid() {
|
||||
return UUID.randomUUID().toString();
|
||||
return UUID.randomUuid().toString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -21,7 +21,7 @@ public class IdUtils {
|
|||
* @return 简化的UUID,去掉了横线
|
||||
*/
|
||||
public static String simpleUuid() {
|
||||
return UUID.randomUUID().toString(true);
|
||||
return UUID.randomUuid().toString(true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -30,7 +30,7 @@ public class IdUtils {
|
|||
* @return 随机UUID
|
||||
*/
|
||||
public static String fastUuid() {
|
||||
return UUID.fastUUID().toString();
|
||||
return UUID.fastUuid().toString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -39,6 +39,6 @@ public class IdUtils {
|
|||
* @return 简化的UUID,去掉了横线
|
||||
*/
|
||||
public static String fastSimpleUuid() {
|
||||
return UUID.fastUUID().toString(true);
|
||||
return UUID.fastUuid().toString(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@ import java.security.SecureRandom;
|
|||
import java.util.Random;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
import static com.muyu.common.core.constant.SplitConstants.*;
|
||||
|
||||
/**
|
||||
* 提供通用唯一识别码(universally unique identifier)(UUID)实现
|
||||
*
|
||||
|
@ -59,8 +61,8 @@ public final class UUID implements java.io.Serializable, Comparable<UUID> {
|
|||
*
|
||||
* @return 随机生成的 {@code UUID}
|
||||
*/
|
||||
public static UUID fastUUID () {
|
||||
return randomUUID(false);
|
||||
public static UUID fastUuid() {
|
||||
return randomUuid(false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -68,8 +70,8 @@ public final class UUID implements java.io.Serializable, Comparable<UUID> {
|
|||
*
|
||||
* @return 随机生成的 {@code UUID}
|
||||
*/
|
||||
public static UUID randomUUID () {
|
||||
return randomUUID(true);
|
||||
public static UUID randomUuid() {
|
||||
return randomUuid(true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -79,7 +81,7 @@ public final class UUID implements java.io.Serializable, Comparable<UUID> {
|
|||
*
|
||||
* @return 随机生成的 {@code UUID}
|
||||
*/
|
||||
public static UUID randomUUID (boolean isSecure) {
|
||||
public static UUID randomUuid(boolean isSecure) {
|
||||
final Random ng = isSecure ? Holder.numberGenerator : getRandom();
|
||||
|
||||
byte[] randomBytes = new byte[16];
|
||||
|
@ -131,7 +133,7 @@ public final class UUID implements java.io.Serializable, Comparable<UUID> {
|
|||
* @throws IllegalArgumentException 如果 name 与 {@link #toString} 中描述的字符串表示形式不符抛出此异常
|
||||
*/
|
||||
public static UUID fromString (String name) {
|
||||
String[] components = name.split("-");
|
||||
String[] components = name.split(SUBTRACTION_STR);
|
||||
if (components.length != 5) {
|
||||
throw new IllegalArgumentException("Invalid UUID string: " + name);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,8 @@ import lombok.Data;
|
|||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import static com.muyu.common.core.constant.SplitConstants.*;
|
||||
|
||||
/**
|
||||
* 分页数据
|
||||
*
|
||||
|
@ -45,7 +47,7 @@ public class PageReq {
|
|||
if (StringUtils.isEmpty(orderByColumn)) {
|
||||
return "";
|
||||
}
|
||||
return StringUtils.toUnderScoreCase(orderByColumn) + " " + isAsc;
|
||||
return StringUtils.toUnderScoreCase(orderByColumn) + EMPTY_STR + isAsc;
|
||||
}
|
||||
|
||||
public void setIsAsc (String isAsc) {
|
||||
|
|
|
@ -30,6 +30,8 @@ import jakarta.servlet.http.HttpServletResponse;
|
|||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.muyu.common.core.constant.SplitConstants.*;
|
||||
|
||||
/**
|
||||
* 操作日志记录处理
|
||||
*
|
||||
|
@ -167,19 +169,19 @@ public class LogAspect {
|
|||
* 参数拼装
|
||||
*/
|
||||
private String argsArrayToString (Object[] paramsArray, String[] excludeParamNames) {
|
||||
String params = "";
|
||||
StringBuilder params = new StringBuilder();
|
||||
if (paramsArray != null && paramsArray.length > 0) {
|
||||
for (Object o : paramsArray) {
|
||||
if (StringUtils.isNotNull(o) && !isFilterObject(o)) {
|
||||
try {
|
||||
String jsonObj = JSON.toJSONString(o, excludePropertyPreFilter(excludeParamNames));
|
||||
params += jsonObj.toString() + " ";
|
||||
params.append(jsonObj).append(EMPTY_STR);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return params.trim();
|
||||
return params.toString().trim();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,6 +19,8 @@ import java.util.Collection;
|
|||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.muyu.common.core.constant.SplitConstants.*;
|
||||
|
||||
/**
|
||||
* Token 权限验证,逻辑实现类
|
||||
*
|
||||
|
@ -127,7 +129,7 @@ public class AuthLogic {
|
|||
* @param requiresPermissions 注解对象
|
||||
*/
|
||||
public void checkPermi (RequiresPermissions requiresPermissions) {
|
||||
SecurityContextHolder.setPermission(StringUtils.join(requiresPermissions.value(), ","));
|
||||
SecurityContextHolder.setPermission(StringUtils.join(requiresPermissions.value(), COMMA_STR));
|
||||
if (requiresPermissions.logical() == Logical.AND) {
|
||||
checkPermiAnd(requiresPermissions.value());
|
||||
} else {
|
||||
|
|
|
@ -4,13 +4,15 @@ import com.google.code.kaptcha.text.impl.DefaultTextCreator;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import static com.muyu.common.core.constant.SplitConstants.*;
|
||||
|
||||
/**
|
||||
* 验证码文本生成器
|
||||
*
|
||||
* @author muyu
|
||||
*/
|
||||
public class KaptchaTextCreator extends DefaultTextCreator {
|
||||
private static final String[] CNUMBERS = "0,1,2,3,4,5,6,7,8,9,10".split(",");
|
||||
private static final String[] CNUMBERS = "0,1,2,3,4,5,6,7,8,9,10".split(COMMA_STR);
|
||||
|
||||
@Override
|
||||
public String getText () {
|
||||
|
@ -34,25 +36,25 @@ public class KaptchaTextCreator extends DefaultTextCreator {
|
|||
} else {
|
||||
result = x + y;
|
||||
suChinese.append(CNUMBERS[x]);
|
||||
suChinese.append("+");
|
||||
suChinese.append(ADDITION_STR);
|
||||
suChinese.append(CNUMBERS[y]);
|
||||
}
|
||||
} else if (randomoperands == 2) {
|
||||
if (x >= y) {
|
||||
result = x - y;
|
||||
suChinese.append(CNUMBERS[x]);
|
||||
suChinese.append("-");
|
||||
suChinese.append(SUBTRACTION_STR);
|
||||
suChinese.append(CNUMBERS[y]);
|
||||
} else {
|
||||
result = y - x;
|
||||
suChinese.append(CNUMBERS[y]);
|
||||
suChinese.append("-");
|
||||
suChinese.append(SUBTRACTION_STR);
|
||||
suChinese.append(CNUMBERS[x]);
|
||||
}
|
||||
} else {
|
||||
result = x + y;
|
||||
suChinese.append(CNUMBERS[x]);
|
||||
suChinese.append("+");
|
||||
suChinese.append(ADDITION_STR);
|
||||
suChinese.append(CNUMBERS[y]);
|
||||
}
|
||||
suChinese.append("=?@" + result);
|
||||
|
|
|
@ -22,6 +22,8 @@ import java.awt.image.BufferedImage;
|
|||
import java.io.IOException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static com.muyu.common.core.constant.SplitConstants.*;
|
||||
|
||||
/**
|
||||
* 验证码实现处理
|
||||
*
|
||||
|
@ -64,8 +66,8 @@ public class ValidateCodeServiceImpl implements ValidateCodeService {
|
|||
// 生成验证码
|
||||
if ("math".equals(captchaType)) {
|
||||
String capText = captchaProducerMath.createText();
|
||||
capStr = capText.substring(0, capText.lastIndexOf("@"));
|
||||
code = capText.substring(capText.lastIndexOf("@") + 1);
|
||||
capStr = capText.substring(0, capText.lastIndexOf(ANTE_STR));
|
||||
code = capText.substring(capText.lastIndexOf(ANTE_STR) + 1);
|
||||
image = captchaProducerMath.createImage(capStr);
|
||||
} else if ("char".equals(captchaType)) {
|
||||
capStr = code = captchaProducer.createText();
|
||||
|
|
|
@ -10,6 +10,9 @@ import lombok.experimental.SuperBuilder;
|
|||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
import static com.muyu.common.core.constant.SplitConstants.*;
|
||||
import static com.muyu.common.core.constant.SplitConstants.*;
|
||||
|
||||
/**
|
||||
* 代码生成业务字段表 gen_table_column
|
||||
*
|
||||
|
@ -343,11 +346,11 @@ public class GenTableColumn extends BaseEntity {
|
|||
String remarks = StringUtils.substringBetween(this.columnComment, "(", ")");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (StringUtils.isNotEmpty(remarks)) {
|
||||
for (String value : remarks.split(" ")) {
|
||||
for (String value : remarks.split(EMPTY_STR)) {
|
||||
if (StringUtils.isNotEmpty(value)) {
|
||||
Object startStr = value.subSequence(0, 1);
|
||||
String endStr = value.substring(1);
|
||||
sb.append(startStr).append("=").append(endStr).append(",");
|
||||
sb.append(startStr).append(EQUAL_STR).append(endStr).append(COMMA_STR);
|
||||
}
|
||||
}
|
||||
return sb.deleteCharAt(sb.length() - 1).toString();
|
||||
|
|
|
@ -9,6 +9,8 @@ import org.apache.commons.lang3.RegExUtils;
|
|||
|
||||
import java.util.Arrays;
|
||||
|
||||
import static com.muyu.common.core.constant.SplitConstants.*;
|
||||
|
||||
/**
|
||||
* 代码生成器 工具类
|
||||
*
|
||||
|
@ -54,7 +56,7 @@ public class GenUtils {
|
|||
column.setHtmlType(GenConstants.HTML_INPUT);
|
||||
|
||||
// 如果是浮点型 统一用BigDecimal
|
||||
String[] str = StringUtils.split(StringUtils.substringBetween(column.getColumnType(), "(", ")"), ",");
|
||||
String[] str = StringUtils.split(StringUtils.substringBetween(column.getColumnType(), "(", ")"), COMMA_STR);
|
||||
if (str != null && str.length == 2 && Integer.parseInt(str[1]) > 0) {
|
||||
column.setJavaType(GenConstants.TYPE_BIGDECIMAL);
|
||||
}
|
||||
|
@ -131,7 +133,7 @@ public class GenUtils {
|
|||
* @return 模块名
|
||||
*/
|
||||
public static String getModuleName (String packageName) {
|
||||
int lastIndex = packageName.lastIndexOf(".");
|
||||
int lastIndex = packageName.lastIndexOf(POINT_STR);
|
||||
int nameLength = packageName.length();
|
||||
return StringUtils.substring(packageName, lastIndex + 1, nameLength);
|
||||
}
|
||||
|
@ -144,7 +146,7 @@ public class GenUtils {
|
|||
* @return 业务名
|
||||
*/
|
||||
public static String getBusinessName (String tableName) {
|
||||
int lastIndex = tableName.lastIndexOf("_");
|
||||
int lastIndex = tableName.lastIndexOf(UNDERLINE_STR);
|
||||
int nameLength = tableName.length();
|
||||
return StringUtils.substring(tableName, lastIndex + 1, nameLength);
|
||||
}
|
||||
|
@ -160,7 +162,7 @@ public class GenUtils {
|
|||
boolean autoRemovePre = GenConfig.getAutoRemovePre();
|
||||
String tablePrefix = GenConfig.getTablePrefix();
|
||||
if (autoRemovePre && StringUtils.isNotEmpty(tablePrefix)) {
|
||||
String[] searchList = StringUtils.split(tablePrefix, ",");
|
||||
String[] searchList = StringUtils.split(tablePrefix, COMMA_STR);
|
||||
tableName = replaceFirst(tableName, searchList);
|
||||
}
|
||||
return StringUtils.convertToCamelCase(tableName);
|
||||
|
|
|
@ -459,7 +459,7 @@ export default {
|
|||
this.form = response.data;
|
||||
#foreach ($column in $columns)
|
||||
#if($column.htmlType == "checkbox")
|
||||
this.form.$column.javaField = this.form.${column.javaField}.split(",");
|
||||
this.form.$column.javaField = this.form.${column.javaField}.split(COMMA_STR);
|
||||
#end
|
||||
#end
|
||||
this.open = true;
|
||||
|
@ -472,7 +472,7 @@ export default {
|
|||
if (valid) {
|
||||
#foreach ($column in $columns)
|
||||
#if($column.htmlType == "checkbox")
|
||||
this.form.$column.javaField = this.form.${column.javaField}.join(",");
|
||||
this.form.$column.javaField = this.form.${column.javaField}.join(COMMA_STR);
|
||||
#end
|
||||
#end
|
||||
if (this.form.${pkColumn.javaField} != null) {
|
||||
|
|
|
@ -510,7 +510,7 @@ export default {
|
|||
this.form = response.data;
|
||||
#foreach ($column in $columns)
|
||||
#if($column.htmlType == "checkbox")
|
||||
this.form.$column.javaField = this.form.${column.javaField}.split(",");
|
||||
this.form.$column.javaField = this.form.${column.javaField}.split(COMMA_STR);
|
||||
#end
|
||||
#end
|
||||
#if($table.sub)
|
||||
|
@ -526,7 +526,7 @@ export default {
|
|||
if (valid) {
|
||||
#foreach ($column in $columns)
|
||||
#if($column.htmlType == "checkbox")
|
||||
this.form.$column.javaField = this.form.${column.javaField}.join(",");
|
||||
this.form.$column.javaField = this.form.${column.javaField}.join(COMMA_STR);
|
||||
#end
|
||||
#end
|
||||
#if($table.sub)
|
||||
|
|
|
@ -426,7 +426,7 @@ async function handleUpdate(row) {
|
|||
form.value = response.data;
|
||||
#foreach ($column in $columns)
|
||||
#if($column.htmlType == "checkbox")
|
||||
form.value.$column.javaField = form.value.${column.javaField}.split(",");
|
||||
form.value.$column.javaField = form.value.${column.javaField}.split(COMMA_STR);
|
||||
#end
|
||||
#end
|
||||
open.value = true;
|
||||
|
@ -440,7 +440,7 @@ function submitForm() {
|
|||
if (valid) {
|
||||
#foreach ($column in $columns)
|
||||
#if($column.htmlType == "checkbox")
|
||||
form.value.$column.javaField = form.value.${column.javaField}.join(",");
|
||||
form.value.$column.javaField = form.value.${column.javaField}.join(COMMA_STR);
|
||||
#end
|
||||
#end
|
||||
if (form.value.${pkColumn.javaField} != null) {
|
||||
|
|
|
@ -491,7 +491,7 @@ function handleUpdate(row) {
|
|||
form.value = response.data;
|
||||
#foreach ($column in $columns)
|
||||
#if($column.htmlType == "checkbox")
|
||||
form.value.$column.javaField = form.value.${column.javaField}.split(",");
|
||||
form.value.$column.javaField = form.value.${column.javaField}.split(COMMA_STR);
|
||||
#end
|
||||
#end
|
||||
#if($table.sub)
|
||||
|
@ -508,7 +508,7 @@ function submitForm() {
|
|||
if (valid) {
|
||||
#foreach ($column in $columns)
|
||||
#if($column.htmlType == "checkbox")
|
||||
form.value.$column.javaField = form.value.${column.javaField}.join(",");
|
||||
form.value.$column.javaField = form.value.${column.javaField}.join(COMMA_STR);
|
||||
#end
|
||||
#end
|
||||
#if($table.sub)
|
||||
|
|
|
@ -22,6 +22,8 @@ import org.springframework.web.bind.annotation.*;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import static com.muyu.common.core.constant.SplitConstants.*;
|
||||
|
||||
/**
|
||||
* 部门信息
|
||||
*
|
||||
|
@ -52,7 +54,7 @@ public class SysDeptController extends BaseController {
|
|||
@GetMapping("/list/exclude/{deptId}")
|
||||
public Result<List<SysDept>> excludeChild (@PathVariable(value = "deptId", required = false) Long deptId) {
|
||||
List<SysDept> deptList = deptService.queryList(SysDeptPageQueryModel.builder().build());
|
||||
deptList.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId));
|
||||
deptList.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), COMMA_STR), deptId));
|
||||
return success(deptList);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,8 @@ import org.springframework.stereotype.Service;
|
|||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.muyu.common.core.constant.SplitConstants.*;
|
||||
|
||||
/**
|
||||
* 菜单 业务层处理
|
||||
*
|
||||
|
@ -103,7 +105,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
Set<String> permsSet = new HashSet<>();
|
||||
for (String perm : perms) {
|
||||
if (StringUtils.isNotEmpty(perm)) {
|
||||
permsSet.addAll(Arrays.asList(perm.trim().split(",")));
|
||||
permsSet.addAll(Arrays.asList(perm.trim().split(COMMA_STR)));
|
||||
}
|
||||
}
|
||||
return permsSet;
|
||||
|
@ -122,7 +124,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
Set<String> permsSet = new HashSet<>();
|
||||
for (String perm : perms) {
|
||||
if (StringUtils.isNotEmpty(perm)) {
|
||||
permsSet.addAll(Arrays.asList(perm.trim().split(",")));
|
||||
permsSet.addAll(Arrays.asList(perm.trim().split(COMMA_STR)));
|
||||
}
|
||||
}
|
||||
return permsSet;
|
||||
|
|
|
@ -29,6 +29,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import java.util.*;
|
||||
|
||||
import static com.muyu.common.core.constant.SplitConstants.*;
|
||||
|
||||
/**
|
||||
* 角色 业务层处理
|
||||
*
|
||||
|
@ -109,7 +111,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|||
Set<String> permsSet = new HashSet<>();
|
||||
for (SysRole perm : perms) {
|
||||
if (StringUtils.isNotNull(perm)) {
|
||||
permsSet.addAll(Arrays.asList(perm.getRoleKey().trim().split(",")));
|
||||
permsSet.addAll(Arrays.asList(perm.getRoleKey().trim().split(COMMA_STR)));
|
||||
}
|
||||
}
|
||||
return permsSet;
|
||||
|
|
|
@ -37,6 +37,8 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.muyu.common.core.constant.SplitConstants.*;
|
||||
|
||||
/**
|
||||
* 用户 业务层处理
|
||||
*
|
||||
|
@ -140,7 +142,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
if (CollectionUtils.isEmpty(list)) {
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
return list.stream().map(SysRole::getRoleName).collect(Collectors.joining(","));
|
||||
return list.stream().map(SysRole::getRoleName).collect(Collectors.joining(COMMA_STR));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -156,7 +158,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
if (CollectionUtils.isEmpty(list)) {
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
return list.stream().map(SysPost::getPostName).collect(Collectors.joining(","));
|
||||
return list.stream().map(SysPost::getPostName).collect(Collectors.joining(COMMA_STR));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue