diff --git a/austin-cron/src/main/java/com/java3y/austin/cron/xxl/utils/XxlJobUtils.java b/austin-cron/src/main/java/com/java3y/austin/cron/xxl/utils/XxlJobUtils.java index f10bf8d..77d984b 100644 --- a/austin-cron/src/main/java/com/java3y/austin/cron/xxl/utils/XxlJobUtils.java +++ b/austin-cron/src/main/java/com/java3y/austin/cron/xxl/utils/XxlJobUtils.java @@ -84,7 +84,7 @@ public class XxlJobUtils { if (Objects.isNull(basicResultVO.getData())) { XxlJobGroup xxlJobGroup = XxlJobGroup.builder().appname(appName).title(jobHandlerName).addressType(CommonConstant.FALSE).build(); if (RespStatusEnum.SUCCESS.getCode().equals(cronTaskService.createGroup(xxlJobGroup).getStatus())) { - return (int) cronTaskService.getGroupId(appName, jobHandlerName).getData(); + return (Integer) cronTaskService.getGroupId(appName, jobHandlerName).getData(); } } return basicResultVO.getData(); diff --git a/austin-handler/src/main/java/com/java3y/austin/handler/domain/sms/LinTongSendResult.java b/austin-handler/src/main/java/com/java3y/austin/handler/domain/sms/LinTongSendResult.java index 8229f57..27d682d 100644 --- a/austin-handler/src/main/java/com/java3y/austin/handler/domain/sms/LinTongSendResult.java +++ b/austin-handler/src/main/java/com/java3y/austin/handler/domain/sms/LinTongSendResult.java @@ -32,7 +32,7 @@ public class LinTongSendResult { @Data @AllArgsConstructor @NoArgsConstructor - public class DataDTO { + public static class DataDTO { Integer code; String message; Long msgId; diff --git a/austin-service-api-impl/src/main/java/com/java3y/austin/service/api/impl/action/send/SendAfterCheckAction.java b/austin-service-api-impl/src/main/java/com/java3y/austin/service/api/impl/action/send/SendAfterCheckAction.java index b6da121..9213a7c 100644 --- a/austin-service-api-impl/src/main/java/com/java3y/austin/service/api/impl/action/send/SendAfterCheckAction.java +++ b/austin-service-api-impl/src/main/java/com/java3y/austin/service/api/impl/action/send/SendAfterCheckAction.java @@ -31,11 +31,14 @@ public class SendAfterCheckAction implements BusinessProcess { /** * 邮件和手机号正则 */ - protected static final Map CHANNEL_REGEX_EXP = new HashMap<>(); + protected static final Map CHANNEL_REGEX_EXP; static { - CHANNEL_REGEX_EXP.put(IdType.PHONE.getCode(), PHONE_REGEX_EXP); - CHANNEL_REGEX_EXP.put(IdType.EMAIL.getCode(), EMAIL_REGEX_EXP); + Map tempMap = new HashMap<>(); + tempMap.put(IdType.PHONE.getCode(), PHONE_REGEX_EXP); + tempMap.put(IdType.EMAIL.getCode(), EMAIL_REGEX_EXP); + // 初始化为不可变集合,避免被恶意修改 + CHANNEL_REGEX_EXP = Collections.unmodifiableMap(tempMap); } diff --git a/austin-stream/src/main/java/com/java3y/austin/stream/utils/LettuceRedisUtils.java b/austin-stream/src/main/java/com/java3y/austin/stream/utils/LettuceRedisUtils.java index 0639839..f156909 100644 --- a/austin-stream/src/main/java/com/java3y/austin/stream/utils/LettuceRedisUtils.java +++ b/austin-stream/src/main/java/com/java3y/austin/stream/utils/LettuceRedisUtils.java @@ -27,7 +27,7 @@ public class LettuceRedisUtils { static { RedisURI redisUri = RedisURI.Builder.redis(AustinFlinkConstant.REDIS_IP) - .withPort(Integer.valueOf(AustinFlinkConstant.REDIS_PORT)) + .withPort(Integer.parseInt(AustinFlinkConstant.REDIS_PORT)) .withPassword(AustinFlinkConstant.REDIS_PASSWORD.toCharArray()) .build(); redisClient = RedisClient.create(redisUri); diff --git a/austin-web/src/main/java/com/java3y/austin/web/utils/SpringFileUtils.java b/austin-web/src/main/java/com/java3y/austin/web/utils/SpringFileUtils.java index 8af9482..021845a 100644 --- a/austin-web/src/main/java/com/java3y/austin/web/utils/SpringFileUtils.java +++ b/austin-web/src/main/java/com/java3y/austin/web/utils/SpringFileUtils.java @@ -1,18 +1,19 @@ package com.java3y.austin.web.utils; +import lombok.extern.slf4j.Slf4j; import org.springframework.web.multipart.MultipartFile; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; -import java.util.Objects; /** * @author 3y * multipartFile 转成 File 对象 */ +@Slf4j public class SpringFileUtils { private SpringFileUtils() { } @@ -26,23 +27,14 @@ public class SpringFileUtils { public static File getFile(MultipartFile multipartFile) { String fileName = multipartFile.getOriginalFilename(); File file = new File(fileName); - OutputStream out = null; - try { - out = new FileOutputStream(file); + try (OutputStream out = new FileOutputStream(file)){ byte[] ss = multipartFile.getBytes(); for (int i = 0; i < ss.length; i++) { out.write(ss[i]); } } catch (IOException e) { - e.printStackTrace(); - } finally { - if (Objects.nonNull(out)) { - try { - out.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } + log.error("SpringFileUtils#getFile multipartFile is converted to File error:{}", e); + return null; } return file; }