🎨 代码格式化
This commit is contained in:
@@ -12,19 +12,20 @@ import com.hccake.ballcat.common.desensitize.DesensitizationHandlerHolder;
|
||||
import com.hccake.ballcat.common.desensitize.enums.RegexDesensitizationTypeEnum;
|
||||
import com.hccake.ballcat.common.util.IpUtils;
|
||||
import com.hccake.ballcat.common.util.JsonUtils;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.servlet.HandlerMapping;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 访问日志
|
||||
*
|
||||
@@ -36,7 +37,7 @@ import org.springframework.web.servlet.HandlerMapping;
|
||||
@RequiredArgsConstructor
|
||||
public class AdminAccessLogHandler implements AccessLogHandler<AdminAccessLog> {
|
||||
|
||||
private final static String APPLICATION_JSON = "application/json";
|
||||
private static final String APPLICATION_JSON = "application/json";
|
||||
|
||||
private final AccessLogAdminSaveThread accessLogAdminSaveThread;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.hccake.ballcat.admin.modules.log.model.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.hccake.ballcat.admin.modules.lov.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.hccake.ballcat.admin.modules.lov.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.hccake.ballcat.admin.modules.lov.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ public class Announcement {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public final static String TABLE_ALIAS = "a";
|
||||
public static final String TABLE_ALIAS = "a";
|
||||
|
||||
/**
|
||||
* ID
|
||||
|
||||
@@ -24,7 +24,7 @@ public class UserAnnouncement {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public final static String TABLE_ALIAS = "ua";
|
||||
public static final String TABLE_ALIAS = "ua";
|
||||
|
||||
/**
|
||||
* ID
|
||||
|
||||
@@ -36,7 +36,7 @@ public class SpecifyOrganizationRecipientFilter implements RecipientFilter {
|
||||
*/
|
||||
@Override
|
||||
public List<SysUser> filter(List<Object> filterCondition) {
|
||||
List<Integer> organizationIds = filterCondition.stream().map(x -> (Integer) x).collect(Collectors.toList());
|
||||
List<Integer> organizationIds = filterCondition.stream().map(Integer.class::cast).collect(Collectors.toList());
|
||||
return sysUserService.listByOrganizationIds(organizationIds);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public class SpecifyOrganizationRecipientFilter implements RecipientFilter {
|
||||
@Override
|
||||
public boolean match(Object filterAttr, List<Object> filterCondition) {
|
||||
Integer organizationId = (Integer) filterAttr;
|
||||
return filterCondition.stream().map(x -> (Integer) x).anyMatch(x -> x.equals(organizationId));
|
||||
return filterCondition.stream().map(Integer.class::cast).anyMatch(x -> x.equals(organizationId));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class SpecifyRoleRecipientFilter implements RecipientFilter {
|
||||
*/
|
||||
@Override
|
||||
public List<SysUser> filter(List<Object> filterCondition) {
|
||||
List<String> roleCodes = filterCondition.stream().map(x -> (String) x).collect(Collectors.toList());
|
||||
List<String> roleCodes = filterCondition.stream().map(String.class::cast).collect(Collectors.toList());
|
||||
return sysUserService.listByRoleCodes(roleCodes);
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ public class SpecifyRoleRecipientFilter implements RecipientFilter {
|
||||
* @return boolean true: 是否匹配
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public boolean match(Object filterAttr, List<Object> filterCondition) {
|
||||
if (!(filterAttr instanceof List)) {
|
||||
return false;
|
||||
@@ -67,7 +68,7 @@ public class SpecifyRoleRecipientFilter implements RecipientFilter {
|
||||
return false;
|
||||
}
|
||||
for (Object roleCode : roleCodes) {
|
||||
boolean matched = filterCondition.stream().map(x -> (String) x).anyMatch(x -> x.equals(roleCode));
|
||||
boolean matched = filterCondition.stream().map(String.class::cast).anyMatch(x -> x.equals(roleCode));
|
||||
if (matched) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class SpecifyUserRecipientFilter implements RecipientFilter {
|
||||
*/
|
||||
@Override
|
||||
public List<SysUser> filter(List<Object> filterCondition) {
|
||||
List<Integer> userIds = filterCondition.stream().map(x -> (Integer) x).collect(Collectors.toList());
|
||||
List<Integer> userIds = filterCondition.stream().map(Integer.class::cast).collect(Collectors.toList());
|
||||
return sysUserService.listByUserIds(userIds);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public class SpecifyUserRecipientFilter implements RecipientFilter {
|
||||
@Override
|
||||
public boolean match(Object filterAttr, List<Object> filterCondition) {
|
||||
Integer userId = (Integer) filterAttr;
|
||||
return filterCondition.stream().map(x -> (Integer) x).anyMatch(x -> x.equals(userId));
|
||||
return filterCondition.stream().map(Integer.class::cast).anyMatch(x -> x.equals(userId));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class SpecifyUserTypeRecipientFilter implements RecipientFilter {
|
||||
*/
|
||||
@Override
|
||||
public List<SysUser> filter(List<Object> filterCondition) {
|
||||
List<Integer> userTypes = filterCondition.stream().map(x -> (Integer) x).collect(Collectors.toList());
|
||||
List<Integer> userTypes = filterCondition.stream().map(Integer.class::cast).collect(Collectors.toList());
|
||||
return sysUserService.listByUserTypes(userTypes);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public class SpecifyUserTypeRecipientFilter implements RecipientFilter {
|
||||
@Override
|
||||
public boolean match(Object filterAttr, List<Object> filterCondition) {
|
||||
Integer type = (Integer) filterAttr;
|
||||
return filterCondition.stream().map(x -> (Integer) x).anyMatch(x -> x.equals(type));
|
||||
return filterCondition.stream().map(Integer.class::cast).anyMatch(x -> x.equals(type));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,8 +4,6 @@ import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* 角色查询对象
|
||||
*
|
||||
|
||||
@@ -15,8 +15,6 @@ import org.springframework.security.web.util.ThrowableAnalyzer;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author Hccake
|
||||
* @version 1.0
|
||||
@@ -60,7 +58,7 @@ public class CustomWebResponseExceptionTranslator implements WebResponseExceptio
|
||||
return handleOAuth2Exception(new ServerErrorException(HttpStatus.INTERNAL_SERVER_ERROR.getReasonPhrase(), e));
|
||||
}
|
||||
|
||||
private ResponseEntity<OAuth2Exception> handleOAuth2Exception(OAuth2Exception e) throws IOException {
|
||||
private ResponseEntity<OAuth2Exception> handleOAuth2Exception(OAuth2Exception e) {
|
||||
|
||||
int status = e.getHttpErrorCode();
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
|
||||
@@ -27,7 +27,7 @@ public class LoginCaptchaFilter extends OncePerRequestFilter {
|
||||
|
||||
private final CaptchaService captchaService;
|
||||
|
||||
private final static String CAPTCHA_VERIFICATION_PARAM = "captchaVerification";
|
||||
private static final String CAPTCHA_VERIFICATION_PARAM = "captchaVerification";
|
||||
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
|
||||
|
||||
@@ -50,9 +50,4 @@ public class MobileAuthenticationToken extends AbstractAuthenticationToken {
|
||||
super.setAuthenticated(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void eraseCredentials() {
|
||||
super.eraseCredentials();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public class MobileTokenGranter extends AbstractTokenGranter {
|
||||
@Override
|
||||
protected OAuth2Authentication getOAuth2Authentication(ClientDetails client, TokenRequest tokenRequest) {
|
||||
Map<String, String> parameters = new LinkedHashMap<>(tokenRequest.getRequestParameters());
|
||||
String mobile = parameters.get("mobile");
|
||||
String mobile = parameters.get(GRANT_TYPE);
|
||||
if (mobile == null) {
|
||||
mobile = "";
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ import org.springframework.data.redis.serializer.RedisSerializer;
|
||||
@RequiredArgsConstructor
|
||||
public class RedisWebsocketMessageListener implements MessageListener, MessageSender {
|
||||
|
||||
public final static String CHANNEL = "websocket-send";
|
||||
public static final String CHANNEL = "websocket-send";
|
||||
|
||||
private final StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.hccake.ballcat.common.conf.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author lingting 2020-10-13 22:39
|
||||
|
||||
@@ -5,7 +5,6 @@ import com.hccake.ballcat.common.core.exception.BusinessException;
|
||||
import com.hccake.ballcat.common.core.exception.handler.GlobalExceptionHandler;
|
||||
import com.hccake.ballcat.common.model.result.R;
|
||||
import com.hccake.ballcat.common.model.result.SystemResultCode;
|
||||
import javax.validation.ValidationException;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -22,6 +21,8 @@ import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
|
||||
|
||||
import javax.validation.ValidationException;
|
||||
|
||||
/**
|
||||
* 全局异常处理
|
||||
*
|
||||
@@ -37,9 +38,9 @@ public class GlobalExceptionHandlerResolver {
|
||||
@Value("${spring.profiles.active:prod}")
|
||||
private String profile;
|
||||
|
||||
public final static String PROD_ERR_MSG = "系统异常,请联系管理员";
|
||||
public static final String PROD_ERR_MSG = "系统异常,请联系管理员";
|
||||
|
||||
public final static String NLP_MSG = "空指针异常!";
|
||||
public static final String NLP_MSG = "空指针异常!";
|
||||
|
||||
/**
|
||||
* 全局异常捕获
|
||||
|
||||
@@ -62,10 +62,10 @@ public abstract class AbstractNoticeGlobalExceptionHandler extends Thread
|
||||
hostname = ia.getHostName();
|
||||
ip = ia.getHostAddress();
|
||||
|
||||
byte[] mac = NetworkInterface.getByInetAddress(ia).getHardwareAddress();
|
||||
byte[] macByte = NetworkInterface.getByInetAddress(ia).getHardwareAddress();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < mac.length; i++) {
|
||||
sb.append(String.format("%02X%s", mac[i], (i < mac.length - 1) ? "-" : ""));
|
||||
for (int i = 0; i < macByte.length; i++) {
|
||||
sb.append(String.format("%02X%s", macByte[i], (i < macByte.length - 1) ? "-" : ""));
|
||||
}
|
||||
this.mac = sb.toString();
|
||||
}
|
||||
@@ -131,7 +131,7 @@ public abstract class AbstractNoticeGlobalExceptionHandler extends Thread
|
||||
|
||||
public ExceptionMessage init(Throwable t) {
|
||||
return new ExceptionMessage().setNumber(1).setMac(mac).setApplicationName(applicationName).setHostname(hostname)
|
||||
.setIp(ip).setStack(ExceptionUtil.stacktraceToString(t, config.getLength()).replaceAll("\\r", ""))
|
||||
.setIp(ip).setStack(ExceptionUtil.stacktraceToString(t, config.getLength()).replace("\\r", ""))
|
||||
.setTime(DateUtil.now());
|
||||
}
|
||||
|
||||
|
||||
@@ -25,12 +25,12 @@ import java.util.List;
|
||||
@Slf4j
|
||||
public class PageParamArgumentResolver implements HandlerMethodArgumentResolver {
|
||||
|
||||
private final static String[] KEYWORDS = { "master", "truncate", "insert", "select", "delete", "update", "declare",
|
||||
private static final String[] KEYWORDS = { "master", "truncate", "insert", "select", "delete", "update", "declare",
|
||||
"alter", "drop", "sleep" };
|
||||
|
||||
private final static String FILED_NAME_REGEX = "[A-Za-z0-9_]+";
|
||||
private static final String FILED_NAME_REGEX = "[A-Za-z0-9_]+";
|
||||
|
||||
private final static String ASC = "asc";
|
||||
private static final String ASC = "asc";
|
||||
|
||||
/**
|
||||
* 判断Controller是否包含page 参数
|
||||
@@ -97,7 +97,8 @@ public class PageParamArgumentResolver implements HandlerMethodArgumentResolver
|
||||
return sorts;
|
||||
}
|
||||
|
||||
String field, order;
|
||||
String field;
|
||||
String order;
|
||||
for (int i = 0; i < fieldArr.length; i++) {
|
||||
field = fieldArr[i];
|
||||
order = orderArr[i];
|
||||
|
||||
@@ -19,7 +19,7 @@ public final class GlobalConstants {
|
||||
/**
|
||||
* 生产环境
|
||||
*/
|
||||
public final static String ENV_PROD = "prod";
|
||||
public static final String ENV_PROD = "prod";
|
||||
|
||||
/**
|
||||
* 树根节点ID
|
||||
|
||||
@@ -82,7 +82,7 @@ public class ActuatorAuthFilter extends OncePerRequestFilter {
|
||||
return false;
|
||||
}
|
||||
// 过期时间 30秒失效
|
||||
long expireTime = 30 * 1000;
|
||||
long expireTime = 30 * 1000L;
|
||||
long nowTime = System.currentTimeMillis();
|
||||
if (nowTime - Long.parseLong(reqTime) <= expireTime) {
|
||||
String reverse = StrUtil.reverse(reqTime);
|
||||
|
||||
@@ -37,7 +37,7 @@ public class NullSerializerModifier extends BeanSerializerModifier {
|
||||
writer.assignNullSerializer(this.nullArrayJsonSerializer);
|
||||
}
|
||||
else if (isMapType(writer)) {
|
||||
// null Map 转 {}
|
||||
// null Map 转 '{}'
|
||||
writer.assignNullSerializer(this.nullMapJsonSerializer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public class MarkdownBuilder {
|
||||
public MarkdownBuilder orderList(String content) {
|
||||
// 获取最后一个字符串
|
||||
String tmp = "";
|
||||
if (this.content.size() != 0) {
|
||||
if (!this.content.isEmpty()) {
|
||||
tmp = this.content.get(this.content.size() - 1);
|
||||
}
|
||||
// 索引
|
||||
@@ -241,7 +241,7 @@ public class MarkdownBuilder {
|
||||
public String build() {
|
||||
lineBreak();
|
||||
StringBuilder res = new StringBuilder();
|
||||
content.forEach(content -> res.append(content).append(" \n"));
|
||||
content.forEach(line -> res.append(line).append(" \n"));
|
||||
return res.toString();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.hccake.ballcat.common.core.thread;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* 抽象的线程类,主要用于汇聚详情数据 做一些基础的处理后 进行批量插入
|
||||
@@ -18,7 +18,7 @@ public abstract class AbstractBlockingQueueThread<T> extends AbstractQueueThread
|
||||
private final BlockingQueue<T> queue = new LinkedBlockingQueue<>();
|
||||
|
||||
@Override
|
||||
public void put(@NotNull T t) {
|
||||
public void put(T t) {
|
||||
if (t != null) {
|
||||
try {
|
||||
queue.put(t);
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package com.hccake.ballcat.common.core.thread;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 顶级队列线程类
|
||||
*
|
||||
@@ -16,17 +17,17 @@ public abstract class AbstractQueueThread<E> extends Thread implements Initializ
|
||||
/**
|
||||
* 默认缓存数据数量
|
||||
*/
|
||||
private final static int DEFAULT_BATCH_SIZE = 500;
|
||||
private static final int DEFAULT_BATCH_SIZE = 500;
|
||||
|
||||
/**
|
||||
* 默认等待时长 30秒;单位 毫秒
|
||||
*/
|
||||
private final static long DEFAULT_BATCH_TIMEOUT_MS = 30 * 1000L;
|
||||
private static final long DEFAULT_BATCH_TIMEOUT_MS = 30 * 1000L;
|
||||
|
||||
/**
|
||||
* 默认获取数据时的超时时间
|
||||
*/
|
||||
private final static long POLL_TIMEOUT_MS = 5 * 1000;
|
||||
private static final long POLL_TIMEOUT_MS = 5 * 1000L;
|
||||
|
||||
/**
|
||||
* 用于子类自定义缓存数据数量
|
||||
|
||||
@@ -19,9 +19,12 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
* @author Hccake 2021/1/22
|
||||
* @version 1.0
|
||||
*/
|
||||
public class DesensitizationHandlerHolder {
|
||||
public final class DesensitizationHandlerHolder {
|
||||
|
||||
private final static Map<Class<? extends DesensitizationHandler>, DesensitizationHandler> MAP = new ConcurrentHashMap<>();
|
||||
private DesensitizationHandlerHolder() {
|
||||
}
|
||||
|
||||
private static final Map<Class<? extends DesensitizationHandler>, DesensitizationHandler> MAP = new ConcurrentHashMap<>();
|
||||
|
||||
static {
|
||||
// 滑动脱敏处理器
|
||||
|
||||
@@ -11,12 +11,12 @@ import org.junit.jupiter.api.Test;
|
||||
* @version 1.0
|
||||
*/
|
||||
@Slf4j
|
||||
public class DesensitisedTest {
|
||||
class DesensitisedTest {
|
||||
|
||||
private final ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
@Test
|
||||
public void test1() throws JsonProcessingException {
|
||||
void test1() throws JsonProcessingException {
|
||||
DesensitizationUser user = new DesensitizationUser().setEmail("chengbohua@foxmail.com").setUsername("xiaoming")
|
||||
.setPassword("admina123456").setPhoneNumber("15800000000").setTestField("这是测试属性");
|
||||
String value = objectMapper.writeValueAsString(user);
|
||||
|
||||
@@ -41,7 +41,7 @@ public class TreeUtils {
|
||||
* @return 树列表
|
||||
*/
|
||||
public <T extends TreeNode<I>, I, R> List<T> buildTree(List<R> list, I rootId, Function<R, T> convertToTree) {
|
||||
if (list == null || list.size() == 0) {
|
||||
if (list == null || list.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
// 根据 parentId 进行分组
|
||||
|
||||
@@ -70,7 +70,7 @@ public class DingTalkActionCardMessage extends AbstractDingTalkMessage {
|
||||
.setBtnOrientation(orientation.getVal());
|
||||
|
||||
// 当 单按钮的 文本和链接都不为空时
|
||||
if (buttons.size() == 0) {
|
||||
if (buttons.isEmpty()) {
|
||||
card.setSingleTitle(singleTitle).setSingleUrl(singleUrl);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -78,7 +78,7 @@ public abstract class AbstractKeyValueStorePunctuator<K, V, R> extends AbstractP
|
||||
*/
|
||||
public void runHandle(long timestamp, List<R> list) {
|
||||
try {
|
||||
if (list.size() > 0) {
|
||||
if (!list.isEmpty()) {
|
||||
log.debug("任务执行中,类名 {}, 操作数据量: {}", this.getClass().getSimpleName(), list.size());
|
||||
handle(timestamp, list);
|
||||
}
|
||||
|
||||
@@ -51,17 +51,13 @@ public class KafkaKeyValueStore<K, V> implements KafkaWindow<V, KeyValueStore<K,
|
||||
|
||||
public List<K> keys() {
|
||||
List<K> list = new ArrayList<>();
|
||||
all().forEachRemaining(kv -> {
|
||||
list.add(kv.key);
|
||||
});
|
||||
all().forEachRemaining(kv -> list.add(kv.key));
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<V> values() {
|
||||
List<V> list = new ArrayList<>();
|
||||
all().forEachRemaining(kv -> {
|
||||
list.add(kv.value);
|
||||
});
|
||||
all().forEachRemaining(kv -> list.add(kv.value));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,10 @@ import org.apache.kafka.streams.processor.internals.ProcessorContextImpl;
|
||||
*
|
||||
* @author lingting 2020/6/23 18:00
|
||||
*/
|
||||
public class ProcessorContextUtil {
|
||||
public final class ProcessorContextUtil {
|
||||
|
||||
private ProcessorContextUtil() {
|
||||
}
|
||||
|
||||
public static String toLogString(ProcessorContext context) {
|
||||
String res = " 节点属性: application-id: " + context.applicationId();
|
||||
|
||||
@@ -3,7 +3,10 @@ package com.hccake.extend.kafka;
|
||||
/**
|
||||
* @author lingting 2020/6/19 16:48
|
||||
*/
|
||||
public class KafkaConstants {
|
||||
public final class KafkaConstants {
|
||||
|
||||
private KafkaConstants() {
|
||||
}
|
||||
|
||||
public static final String BOOTSTRAP_SERVERS_DELIMITER = ",";
|
||||
|
||||
|
||||
@@ -15,9 +15,9 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
*/
|
||||
public class TableAliasHelper {
|
||||
|
||||
private final static String COMMA = ",";
|
||||
private static final String COMMA = ",";
|
||||
|
||||
private final static String DOT = ".";
|
||||
private static final String DOT = ".";
|
||||
|
||||
/**
|
||||
* 存储类对应的表别名
|
||||
|
||||
@@ -14,12 +14,12 @@ import java.util.List;
|
||||
@RequiredArgsConstructor
|
||||
public class CustomSqlInjector extends DefaultSqlInjector {
|
||||
|
||||
private final List<AbstractMethod> list;
|
||||
private final List<AbstractMethod> methods;
|
||||
|
||||
@Override
|
||||
public List<AbstractMethod> getMethodList(Class<?> mapperClass) {
|
||||
List<AbstractMethod> list = super.getMethodList(mapperClass);
|
||||
list.addAll(this.list);
|
||||
list.addAll(this.methods);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -76,14 +76,14 @@ public abstract class BaseInsertBatch extends AbstractMethod {
|
||||
* @return java.lang.String
|
||||
* @author lingting 2020-06-09 20:38:54
|
||||
*/
|
||||
abstract protected String getSql();
|
||||
protected abstract String getSql();
|
||||
|
||||
/**
|
||||
* 获取脚本id 即 方法名
|
||||
* @return java.lang.String
|
||||
* @author lingting 2020-06-09 20:39:30
|
||||
*/
|
||||
abstract protected String getId();
|
||||
protected abstract String getId();
|
||||
|
||||
protected String prepareValuesSqlForMysqlBatch(TableInfo tableInfo) {
|
||||
return prepareValuesBuildSqlForMysqlBatch(tableInfo).toString();
|
||||
|
||||
@@ -11,7 +11,7 @@ public class InsertOrUpdateFieldByBatch extends BaseInsertBatch {
|
||||
|
||||
@Override
|
||||
protected String getSql() {
|
||||
return "<script>insert into %s %s values %s</script>";
|
||||
return SQL;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,6 +13,9 @@ import java.util.List;
|
||||
*/
|
||||
public final class PageUtil {
|
||||
|
||||
private PageUtil() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据 PageParam 生成一个 IPage 实例
|
||||
* @param pageParam 分页参数
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.hccake.starte.pay.wx;
|
||||
|
||||
import static com.hccake.starte.pay.wx.constants.WxPayConstant.HUNDRED;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.hccake.starte.pay.wx.constants.WxPayConstant;
|
||||
@@ -14,12 +12,15 @@ import com.hccake.starte.pay.wx.response.WxPayCallback;
|
||||
import com.hccake.starte.pay.wx.response.WxPayOrderQueryResponse;
|
||||
import com.hccake.starte.pay.wx.response.WxPayResponse;
|
||||
import com.hccake.starte.pay.wx.utils.WxPayUtil;
|
||||
import lombok.Data;
|
||||
import lombok.SneakyThrows;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import lombok.Data;
|
||||
import lombok.SneakyThrows;
|
||||
|
||||
import static com.hccake.starte.pay.wx.constants.WxPayConstant.HUNDRED;
|
||||
|
||||
/**
|
||||
* @author lingting 2021/1/26 15:54
|
||||
@@ -217,10 +218,7 @@ public class WxPay {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (WxPayUtil.sign(params, SignType.MD5, mckKey).equals(callback.getSign())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return WxPayUtil.sign(params, SignType.MD5, mckKey).equals(callback.getSign());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,12 +5,13 @@ import com.hccake.ballcat.common.util.JsonUtils;
|
||||
import com.hccake.starte.pay.wx.enums.ResponseCode;
|
||||
import com.hccake.starte.pay.wx.enums.TradeState;
|
||||
import com.hccake.starte.pay.wx.enums.TradeType;
|
||||
import java.math.BigInteger;
|
||||
import java.util.Map;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author lingting 2021/2/25 15:19
|
||||
*/
|
||||
@@ -98,11 +99,8 @@ public class WxPayOrderQueryResponse {
|
||||
*/
|
||||
public boolean isSuccess() {
|
||||
// 交易成功
|
||||
if (returnCode == ResponseCode.SUCCESS && resultCode == ResponseCode.SUCCESS
|
||||
&& tradeState == TradeState.SUCCESS) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return returnCode == ResponseCode.SUCCESS && resultCode == ResponseCode.SUCCESS
|
||||
&& tradeState == TradeState.SUCCESS;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,15 +4,14 @@ import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.hccake.starte.pay.wx.constants.WxPayConstant;
|
||||
import com.hccake.starte.pay.wx.enums.SignType;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.StringWriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.MessageDigest;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import javax.xml.XMLConstants;
|
||||
@@ -25,19 +24,24 @@ import javax.xml.transform.TransformerException;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.SAXException;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.StringWriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.MessageDigest;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author lingting 2021/1/26 16:04
|
||||
*/
|
||||
@Slf4j
|
||||
public class WxPayUtil {
|
||||
public final class WxPayUtil {
|
||||
|
||||
private WxPayUtil() {
|
||||
}
|
||||
|
||||
public static DocumentBuilder getDocumentBuilder() throws ParserConfigurationException {
|
||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
@@ -65,13 +69,13 @@ public class WxPayUtil {
|
||||
Document document = getDocument();
|
||||
Element root = document.createElement("xml");
|
||||
document.appendChild(root);
|
||||
for (String key : data.keySet()) {
|
||||
String value = data.get(key);
|
||||
for (Map.Entry<String, String> entry : data.entrySet()) {
|
||||
String value = entry.getValue();
|
||||
if (value == null) {
|
||||
value = "";
|
||||
}
|
||||
value = value.trim();
|
||||
Element filed = document.createElement(key);
|
||||
Element filed = document.createElement(entry.getKey());
|
||||
filed.appendChild(document.createTextNode(value));
|
||||
root.appendChild(filed);
|
||||
}
|
||||
|
||||
@@ -19,12 +19,12 @@ public abstract class AbstractDataPermissionHandler implements DataPermissionHan
|
||||
|
||||
private final List<DataScope> dataScopes;
|
||||
|
||||
private final static Map<String, DataPermission> DATA_PERMISSION_CACHE = new ConcurrentHashMap<>();
|
||||
private static final Map<String, DataPermission> DATA_PERMISSION_CACHE = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* 提供一个默认的空值注解,用于缓存空值占位使用
|
||||
*/
|
||||
private final static DataPermission EMPTY_DATA_PERMISSION = AbstractDataPermissionHandler.class
|
||||
private static final DataPermission EMPTY_DATA_PERMISSION = AbstractDataPermissionHandler.class
|
||||
.getAnnotation(DataPermission.class);
|
||||
|
||||
/**
|
||||
@@ -43,7 +43,7 @@ public abstract class AbstractDataPermissionHandler implements DataPermissionHan
|
||||
*/
|
||||
@Override
|
||||
public List<DataScope> filterDataScopes(String mappedStatementId) {
|
||||
if (this.dataScopes == null || this.dataScopes.size() == 0) {
|
||||
if (this.dataScopes == null || this.dataScopes.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
// 获取当前方法对应的权限注解,根据注解进行数据范围控制的过滤
|
||||
|
||||
@@ -12,7 +12,6 @@ import org.apache.ibatis.plugin.*;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* 数据权限拦截器
|
||||
@@ -46,7 +45,7 @@ public class DataPermissionInterceptor implements Interceptor {
|
||||
}
|
||||
|
||||
List<DataScope> dataScopes = dataPermissionHandler.filterDataScopes(mappedStatementId);
|
||||
if (dataScopes == null || dataScopes.size() == 0) {
|
||||
if (dataScopes == null || dataScopes.isEmpty()) {
|
||||
return invocation.proceed();
|
||||
}
|
||||
|
||||
@@ -69,9 +68,4 @@ public class DataPermissionInterceptor implements Interceptor {
|
||||
return target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProperties(Properties properties) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class DataScopeSqlProcessor extends JsqlParserSupport {
|
||||
|
||||
processSelectBody(select.getSelectBody(), dataScopes);
|
||||
List<WithItem> withItemsList = select.getWithItemsList();
|
||||
if (withItemsList != null && withItemsList.size() != 0) {
|
||||
if (withItemsList != null && !withItemsList.isEmpty()) {
|
||||
withItemsList.forEach(selectBody -> processSelectBody(selectBody, dataScopes));
|
||||
}
|
||||
}
|
||||
@@ -61,7 +61,7 @@ public class DataScopeSqlProcessor extends JsqlParserSupport {
|
||||
}
|
||||
else {
|
||||
SetOperationList operationList = (SetOperationList) selectBody;
|
||||
if (operationList.getSelects() != null && operationList.getSelects().size() > 0) {
|
||||
if (operationList.getSelects() != null && !operationList.getSelects().isEmpty()) {
|
||||
operationList.getSelects().forEach(item -> processSelectBody(item, dataScopes));
|
||||
}
|
||||
}
|
||||
@@ -112,7 +112,7 @@ public class DataScopeSqlProcessor extends JsqlParserSupport {
|
||||
processFromItem(fromItem, dataScopes);
|
||||
}
|
||||
List<Join> joins = plainSelect.getJoins();
|
||||
if (joins != null && joins.size() > 0) {
|
||||
if (joins != null && !joins.isEmpty()) {
|
||||
joins.forEach(j -> {
|
||||
processJoin(j, dataScopes);
|
||||
processFromItem(j.getRightItem(), dataScopes);
|
||||
|
||||
@@ -7,7 +7,10 @@ import java.lang.reflect.Method;
|
||||
* @author Hccake 2021/1/27
|
||||
* @version 1.0
|
||||
*/
|
||||
public class AnnotationUtil {
|
||||
public final class AnnotationUtil {
|
||||
|
||||
private AnnotationUtil() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据权限注解 优先获取方法上的注解,再获取类上的注解
|
||||
|
||||
@@ -19,10 +19,10 @@ import java.util.*;
|
||||
* @author Hccake 2020/9/28
|
||||
* @version 1.0
|
||||
*/
|
||||
public class SqlParseTest {
|
||||
class SqlParseTest {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
void test() {
|
||||
DataScope dataScope = new DataScope() {
|
||||
final String columnId = "order_id";
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ public class AccessLogFilter extends OncePerRequestFilter {
|
||||
/**
|
||||
* 针对需忽略的Url的规则匹配器
|
||||
*/
|
||||
private final static AntPathMatcher ANT_PATH_MATCHER = new AntPathMatcher();
|
||||
private static final AntPathMatcher ANT_PATH_MATCHER = new AntPathMatcher();
|
||||
|
||||
/**
|
||||
* Same contract as for {@code doFilter}, but guaranteed to be just invoked once per
|
||||
|
||||
@@ -8,7 +8,7 @@ package com.hccake.ballcat.commom.log.constant;
|
||||
public final class LogConstant {
|
||||
|
||||
private LogConstant() {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 跟踪ID,用于一次请求或执行方法时,产生的各种日志间的数据关联
|
||||
|
||||
@@ -90,7 +90,7 @@ public interface MailSender {
|
||||
boolean noTo = mailDetails.getTo() == null || mailDetails.getTo().length <= 0;
|
||||
boolean noCc = mailDetails.getCc() == null || mailDetails.getCc().length <= 0;
|
||||
boolean noBcc = mailDetails.getBcc() == null || mailDetails.getBcc().length <= 0;
|
||||
if (noTo && noCc & noBcc) {
|
||||
if (noTo && noCc && noBcc) {
|
||||
throw new MailSendException("The email should have at least one recipient");
|
||||
}
|
||||
if (!StringUtils.hasText(mailDetails.getSubject())) {
|
||||
|
||||
@@ -37,7 +37,7 @@ public class KeyGenerator {
|
||||
String joint = SpELUtil.parseValueToString(spElContext, spELExpressions);
|
||||
Assert.notNull(joint, "Key joint cannot be null!");
|
||||
|
||||
if (StringUtils.isEmpty(key)) {
|
||||
if (!StringUtils.hasText(key)) {
|
||||
return joint;
|
||||
}
|
||||
// 拼接后返回
|
||||
|
||||
@@ -65,7 +65,7 @@ public class TencentSenderImpl extends BaseServiceImpl implements SmsSender<SmsS
|
||||
if (StrUtil.isNotEmpty(tencent.getSign())) {
|
||||
json.put("Sign", tencent.getSign());
|
||||
}
|
||||
if (sp.getTemplateParam().size() != 0) {
|
||||
if (!sp.getTemplateParam().isEmpty()) {
|
||||
json.put("TemplateParamSet", sp.getTemplateParam());
|
||||
}
|
||||
SendSmsRequest req = SendSmsRequest.fromJsonString(om.writeValueAsString(json), SendSmsRequest.class);
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.springframework.web.filter.CorsFilter;
|
||||
@ConditionalOnProperty(name = "ballcat.swagger.enabled", havingValue = "true", matchIfMissing = true)
|
||||
public class SwaggerProviderAutoConfiguration {
|
||||
|
||||
private final static String ALL = "*";
|
||||
private static final String ALL = "*";
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
|
||||
@@ -9,7 +9,10 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
* @author Hccake 2021/1/4
|
||||
* @version 1.0
|
||||
*/
|
||||
public class JsonMessageHandlerHolder {
|
||||
public final class JsonMessageHandlerHolder {
|
||||
|
||||
private JsonMessageHandlerHolder() {
|
||||
}
|
||||
|
||||
private static final Map<String, JsonMessageHandler> MESSAGE_HANDLER_MAP = new ConcurrentHashMap<>();
|
||||
|
||||
|
||||
@@ -13,7 +13,10 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
* @author Hccake 2021/1/4
|
||||
* @version 1.0
|
||||
*/
|
||||
public class WebSocketSessionHolder {
|
||||
public final class WebSocketSessionHolder {
|
||||
|
||||
private WebSocketSessionHolder() {
|
||||
}
|
||||
|
||||
private static final Map<Object, WebSocketSession> USER_SESSION_MAP = new ConcurrentHashMap<>();
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ package com.hccake.ballcat.common.websocket.message;
|
||||
*/
|
||||
public abstract class AbstractJsonWebSocketMessage implements JsonWebSocketMessage {
|
||||
|
||||
public final static String TYPE_FIELD = "type";
|
||||
public static final String TYPE_FIELD = "type";
|
||||
|
||||
private final String type;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user