mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-14 21:52:07 +08:00
sonar代码规范问题修复
This commit is contained in:
@@ -376,16 +376,6 @@
|
|||||||
<groupId>org.apache.skywalking</groupId>
|
<groupId>org.apache.skywalking</groupId>
|
||||||
<artifactId>apm-toolkit-opentracing</artifactId>
|
<artifactId>apm-toolkit-opentracing</artifactId>
|
||||||
<version>${skywalking.version}</version>
|
<version>${skywalking.version}</version>
|
||||||
<!-- <exclusions>-->
|
|
||||||
<!-- <exclusion>-->
|
|
||||||
<!-- <artifactId>opentracing-api</artifactId>-->
|
|
||||||
<!-- <groupId>io.opentracing</groupId>-->
|
|
||||||
<!-- </exclusion>-->
|
|
||||||
<!-- <exclusion>-->
|
|
||||||
<!-- <artifactId>opentracing-util</artifactId>-->
|
|
||||||
<!-- <groupId>io.opentracing</groupId>-->
|
|
||||||
<!-- </exclusion>-->
|
|
||||||
<!-- </exclusions>-->
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.opentracing</groupId>
|
<groupId>io.opentracing</groupId>
|
||||||
|
|||||||
+10
-13
@@ -7,30 +7,27 @@ package com.cf.imes.framework.common.enums;
|
|||||||
*
|
*
|
||||||
* @author 晨丰科技
|
* @author 晨丰科技
|
||||||
*/
|
*/
|
||||||
public interface WebFilterOrderEnum {
|
public class WebFilterOrderEnum {
|
||||||
|
|
||||||
int CORS_FILTER = Integer.MIN_VALUE;
|
public static int CORS_FILTER = Integer.MIN_VALUE;
|
||||||
|
|
||||||
int TRACE_FILTER = CORS_FILTER + 1;
|
public static int TRACE_FILTER = CORS_FILTER + 1;
|
||||||
|
|
||||||
int ENV_TAG_FILTER = TRACE_FILTER + 1;
|
public static int ENV_TAG_FILTER = TRACE_FILTER + 1;
|
||||||
|
|
||||||
int REQUEST_BODY_CACHE_FILTER = Integer.MIN_VALUE + 500;
|
public static int REQUEST_BODY_CACHE_FILTER = Integer.MIN_VALUE + 500;
|
||||||
|
|
||||||
// OrderedRequestContextFilter 默认为 -105,用于国际化上下文等等
|
// OrderedRequestContextFilter 默认为 -105,用于国际化上下文等等
|
||||||
|
|
||||||
int TENANT_CONTEXT_FILTER = - 104; // 需要保证在 ApiAccessLogFilter 前面
|
public static int TENANT_CONTEXT_FILTER = - 104; // 需要保证在 ApiAccessLogFilter 前面
|
||||||
|
|
||||||
int API_ACCESS_LOG_FILTER = -103; // 需要保证在 RequestBodyCacheFilter 后面
|
public static int API_ACCESS_LOG_FILTER = -103; // 需要保证在 RequestBodyCacheFilter 后面
|
||||||
|
|
||||||
int XSS_FILTER = -102; // 需要保证在 RequestBodyCacheFilter 后面
|
public static int XSS_FILTER = -102; // 需要保证在 RequestBodyCacheFilter 后面
|
||||||
|
|
||||||
// Spring Security Filter 默认为 -100,可见 org.springframework.boot.autoconfigure.security.SecurityProperties 配置属性类
|
// Spring Security Filter 默认为 -100,可见 org.springframework.boot.autoconfigure.security.SecurityProperties 配置属性类
|
||||||
|
|
||||||
int TENANT_SECURITY_FILTER = -99; // 需要保证在 Spring Security 过滤器后面
|
public static int TENANT_SECURITY_FILTER = -99; // 需要保证在 Spring Security 过滤器后面
|
||||||
|
|
||||||
int FLOWABLE_FILTER = -98; // 需要保证在 Spring Security 过滤后面
|
|
||||||
|
|
||||||
int DEMO_FILTER = Integer.MAX_VALUE;
|
|
||||||
|
|
||||||
|
public static int FLOWABLE_FILTER = -98; // 需要保证在 Spring Security 过滤后面
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
package com.cf.imes.framework.common.util.number;
|
package com.cf.imes.framework.common.util.number;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.text.CharSequenceUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数字的工具类,补全 {@link cn.hutool.core.util.NumberUtil} 的功能
|
* 数字的工具类,补全 {@link cn.hutool.core.util.NumberUtil} 的功能
|
||||||
@@ -10,7 +10,7 @@ import cn.hutool.core.util.StrUtil;
|
|||||||
public class NumberUtils {
|
public class NumberUtils {
|
||||||
|
|
||||||
public static Long parseLong(String str) {
|
public static Long parseLong(String str) {
|
||||||
return StrUtil.isNotEmpty(str) ? Long.valueOf(str) : null;
|
return CharSequenceUtil.isNotEmpty(str) ? Long.valueOf(str) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
package com.cf.imes.framework.common.util.servlet;
|
package com.cf.imes.framework.common.util.servlet;
|
||||||
|
|
||||||
import cn.hutool.core.io.IoUtil;
|
import cn.hutool.core.io.IoUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.text.CharSequenceUtil;
|
||||||
import cn.hutool.extra.servlet.ServletUtil;
|
import cn.hutool.extra.servlet.ServletUtil;
|
||||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
@@ -89,7 +89,7 @@ public class ServletUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isJsonRequest(ServletRequest request) {
|
public static boolean isJsonRequest(ServletRequest request) {
|
||||||
return StrUtil.startWithIgnoreCase(request.getContentType(), MediaType.APPLICATION_JSON_VALUE);
|
return CharSequenceUtil.startWithIgnoreCase(request.getContentType(), MediaType.APPLICATION_JSON_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getBody(HttpServletRequest request) {
|
public static String getBody(HttpServletRequest request) {
|
||||||
|
|||||||
+7
-7
@@ -1,7 +1,7 @@
|
|||||||
package com.cf.imes.framework.common.util.string;
|
package com.cf.imes.framework.common.util.string;
|
||||||
|
|
||||||
|
import cn.hutool.core.text.CharSequenceUtil;
|
||||||
import cn.hutool.core.util.ArrayUtil;
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@@ -16,7 +16,7 @@ import java.util.stream.Collectors;
|
|||||||
public class StrUtils {
|
public class StrUtils {
|
||||||
|
|
||||||
public static String maxLength(CharSequence str, int maxLength) {
|
public static String maxLength(CharSequence str, int maxLength) {
|
||||||
return StrUtil.maxLength(str, maxLength - 3); // -3 的原因,是该方法会补充 ... 恰好
|
return CharSequenceUtil.maxLength(str, maxLength - 3); // -3 的原因,是该方法会补充 ... 恰好
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -28,12 +28,12 @@ public class StrUtils {
|
|||||||
* @since 3.0.6
|
* @since 3.0.6
|
||||||
*/
|
*/
|
||||||
public static boolean startWithAny(String str, Collection<String> prefixes) {
|
public static boolean startWithAny(String str, Collection<String> prefixes) {
|
||||||
if (StrUtil.isEmpty(str) || ArrayUtil.isEmpty(prefixes)) {
|
if (CharSequenceUtil.isEmpty(str) || ArrayUtil.isEmpty(prefixes)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (CharSequence suffix : prefixes) {
|
for (CharSequence suffix : prefixes) {
|
||||||
if (StrUtil.startWith(str, suffix, false)) {
|
if (CharSequenceUtil.startWith(str, suffix, false)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -41,12 +41,12 @@ public class StrUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static List<Long> splitToLong(String value, CharSequence separator) {
|
public static List<Long> splitToLong(String value, CharSequence separator) {
|
||||||
long[] longs = StrUtil.splitToLong(value, separator);
|
long[] longs = CharSequenceUtil.splitToLong(value, separator);
|
||||||
return Arrays.stream(longs).boxed().collect(Collectors.toList());
|
return Arrays.stream(longs).boxed().collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Integer> splitToInteger(String value, CharSequence separator) {
|
public static List<Integer> splitToInteger(String value, CharSequence separator) {
|
||||||
int[] integers = StrUtil.splitToInt(value, separator);
|
int[] integers = CharSequenceUtil.splitToInt(value, separator);
|
||||||
return Arrays.stream(integers).boxed().collect(Collectors.toList());
|
return Arrays.stream(integers).boxed().collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ public class StrUtils {
|
|||||||
* @return 移除后的字符串
|
* @return 移除后的字符串
|
||||||
*/
|
*/
|
||||||
public static String removeLineContains(String content, String sequence) {
|
public static String removeLineContains(String content, String sequence) {
|
||||||
if (StrUtil.isEmpty(content) || StrUtil.isEmpty(sequence)) {
|
if (CharSequenceUtil.isEmpty(content) || CharSequenceUtil.isEmpty(sequence)) {
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
return Arrays.stream(content.split("\n"))
|
return Arrays.stream(content.split("\n"))
|
||||||
|
|||||||
+1
-1
@@ -34,7 +34,7 @@ public class InEnumCollectionValidator implements ConstraintValidator<InEnum, Co
|
|||||||
// 校验不通过,自定义提示语句(因为,注解上的 value 是枚举类,无法获得枚举类的实际值)
|
// 校验不通过,自定义提示语句(因为,注解上的 value 是枚举类,无法获得枚举类的实际值)
|
||||||
context.disableDefaultConstraintViolation(); // 禁用默认的 message 的值
|
context.disableDefaultConstraintViolation(); // 禁用默认的 message 的值
|
||||||
context.buildConstraintViolationWithTemplate(context.getDefaultConstraintMessageTemplate()
|
context.buildConstraintViolationWithTemplate(context.getDefaultConstraintMessageTemplate()
|
||||||
.replaceAll("\\{value}", CollUtil.join(list, ","))).addConstraintViolation(); // 重新添加错误提示语句
|
.replace("\\{value}", CollUtil.join(list, ","))).addConstraintViolation(); // 重新添加错误提示语句
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -36,7 +36,7 @@ public class InEnumValidator implements ConstraintValidator<InEnum, Integer> {
|
|||||||
// 校验不通过,自定义提示语句(因为,注解上的 value 是枚举类,无法获得枚举类的实际值)
|
// 校验不通过,自定义提示语句(因为,注解上的 value 是枚举类,无法获得枚举类的实际值)
|
||||||
context.disableDefaultConstraintViolation(); // 禁用默认的 message 的值
|
context.disableDefaultConstraintViolation(); // 禁用默认的 message 的值
|
||||||
context.buildConstraintViolationWithTemplate(context.getDefaultConstraintMessageTemplate()
|
context.buildConstraintViolationWithTemplate(context.getDefaultConstraintMessageTemplate()
|
||||||
.replaceAll("\\{value}", values.toString())).addConstraintViolation(); // 重新添加错误提示语句
|
.replace("\\{value}", values.toString())).addConstraintViolation(); // 重新添加错误提示语句
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-6
@@ -1,6 +1,6 @@
|
|||||||
package com.cf.imes.framework.common.validation;
|
package com.cf.imes.framework.common.validation;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.text.CharSequenceUtil;
|
||||||
import com.cf.imes.framework.common.util.validation.ValidationUtils;
|
import com.cf.imes.framework.common.util.validation.ValidationUtils;
|
||||||
|
|
||||||
import javax.validation.ConstraintValidator;
|
import javax.validation.ConstraintValidator;
|
||||||
@@ -8,14 +8,10 @@ import javax.validation.ConstraintValidatorContext;
|
|||||||
|
|
||||||
public class MobileValidator implements ConstraintValidator<Mobile, String> {
|
public class MobileValidator implements ConstraintValidator<Mobile, String> {
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initialize(Mobile annotation) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isValid(String value, ConstraintValidatorContext context) {
|
public boolean isValid(String value, ConstraintValidatorContext context) {
|
||||||
// 如果手机号为空,默认不校验,即校验通过
|
// 如果手机号为空,默认不校验,即校验通过
|
||||||
if (StrUtil.isEmpty(value)) {
|
if (CharSequenceUtil.isEmpty(value)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// 校验手机
|
// 校验手机
|
||||||
|
|||||||
-4
@@ -8,10 +8,6 @@ import javax.validation.ConstraintValidatorContext;
|
|||||||
|
|
||||||
public class TelephoneValidator implements ConstraintValidator<Telephone, String> {
|
public class TelephoneValidator implements ConstraintValidator<Telephone, String> {
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initialize(Telephone annotation) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isValid(String value, ConstraintValidatorContext context) {
|
public boolean isValid(String value, ConstraintValidatorContext context) {
|
||||||
// 如果手机号为空,默认不校验,即校验通过
|
// 如果手机号为空,默认不校验,即校验通过
|
||||||
|
|||||||
+3
-3
@@ -1,8 +1,8 @@
|
|||||||
package com.cf.imes.framework.datapermission.core.rule.dept;
|
package com.cf.imes.framework.datapermission.core.rule.dept;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.text.CharSequenceUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.cf.imes.framework.common.enums.UserTypeEnum;
|
import com.cf.imes.framework.common.enums.UserTypeEnum;
|
||||||
import com.cf.imes.framework.common.util.collection.CollectionUtils;
|
import com.cf.imes.framework.common.util.collection.CollectionUtils;
|
||||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||||
@@ -147,7 +147,7 @@ public class DeptDataPermissionRule implements DataPermissionRule {
|
|||||||
private Expression buildDeptExpression(String tableName, Alias tableAlias, Set<Long> deptIds) {
|
private Expression buildDeptExpression(String tableName, Alias tableAlias, Set<Long> deptIds) {
|
||||||
// 如果不存在配置,则无需作为条件
|
// 如果不存在配置,则无需作为条件
|
||||||
String columnName = deptColumns.get(tableName);
|
String columnName = deptColumns.get(tableName);
|
||||||
if (StrUtil.isEmpty(columnName)) {
|
if (CharSequenceUtil.isEmpty(columnName)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// 如果为空,则无条件
|
// 如果为空,则无条件
|
||||||
@@ -165,7 +165,7 @@ public class DeptDataPermissionRule implements DataPermissionRule {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
String columnName = userColumns.get(tableName);
|
String columnName = userColumns.get(tableName);
|
||||||
if (StrUtil.isEmpty(columnName)) {
|
if (CharSequenceUtil.isEmpty(columnName)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// 拼接条件
|
// 拼接条件
|
||||||
|
|||||||
+5
-6
@@ -2,9 +2,8 @@ package com.cf.imes.framework.operatelog.core.aop;
|
|||||||
|
|
||||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
import cn.hutool.core.exceptions.ExceptionUtil;
|
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||||
|
import cn.hutool.core.text.CharSequenceUtil;
|
||||||
import cn.hutool.core.util.ArrayUtil;
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.cf.imes.framework.common.enums.UserTypeEnum;
|
|
||||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||||
import com.cf.imes.framework.common.util.monitor.TracerUtils;
|
import com.cf.imes.framework.common.util.monitor.TracerUtils;
|
||||||
@@ -172,15 +171,15 @@ public class OperateLogAspect {
|
|||||||
if (operateLog != null) {
|
if (operateLog != null) {
|
||||||
operateLogObj.setModule(operateLog.module());
|
operateLogObj.setModule(operateLog.module());
|
||||||
}
|
}
|
||||||
if (StrUtil.isEmpty(operateLogObj.getModule())) {
|
if (CharSequenceUtil.isEmpty(operateLogObj.getModule())) {
|
||||||
Tag tag = getClassAnnotation(joinPoint, Tag.class);
|
Tag tag = getClassAnnotation(joinPoint, Tag.class);
|
||||||
if (tag != null) {
|
if (tag != null) {
|
||||||
// 优先读取 @Tag 的 name 属性
|
// 优先读取 @Tag 的 name 属性
|
||||||
if (StrUtil.isNotEmpty(tag.name())) {
|
if (CharSequenceUtil.isNotEmpty(tag.name())) {
|
||||||
operateLogObj.setModule(tag.name());
|
operateLogObj.setModule(tag.name());
|
||||||
}
|
}
|
||||||
// 没有的话,读取 @API 的 description 属性
|
// 没有的话,读取 @API 的 description 属性
|
||||||
if (StrUtil.isEmpty(operateLogObj.getModule()) && ArrayUtil.isNotEmpty(tag.description())) {
|
if (CharSequenceUtil.isEmpty(operateLogObj.getModule()) && ArrayUtil.isNotEmpty(tag.description())) {
|
||||||
operateLogObj.setModule(tag.description());
|
operateLogObj.setModule(tag.description());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -189,7 +188,7 @@ public class OperateLogAspect {
|
|||||||
if (operateLog != null) {
|
if (operateLog != null) {
|
||||||
operateLogObj.setName(operateLog.name());
|
operateLogObj.setName(operateLog.name());
|
||||||
}
|
}
|
||||||
if (StrUtil.isEmpty(operateLogObj.getName()) && operation != null) {
|
if (CharSequenceUtil.isEmpty(operateLogObj.getName()) && operation != null) {
|
||||||
operateLogObj.setName(operation.summary());
|
operateLogObj.setName(operation.summary());
|
||||||
}
|
}
|
||||||
// type 属性
|
// type 属性
|
||||||
|
|||||||
Reference in New Issue
Block a user