升级JDK到21
This commit is contained in:
@@ -1,313 +1,325 @@
|
||||
package com.ai.da.common.utils;
|
||||
|
||||
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ai.da.common.config.exception.BusinessException;
|
||||
import com.ai.da.model.vo.FileVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.*;
|
||||
import java.net.URL;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
public class FileUtil extends cn.hutool.core.io.FileUtil {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(com.ai.da.common.utils.FileUtil.class);
|
||||
|
||||
/**
|
||||
* 系统临时目录
|
||||
* <br>
|
||||
* windows 包含路径分割符,但Linux 不包含,
|
||||
* 在windows \\==\ 前提下,
|
||||
* 为安全起见 同意拼装 路径分割符,
|
||||
* <pre>
|
||||
* java.io.tmpdir
|
||||
* windows : C:\Users/xxx\AppData\Local\Temp\
|
||||
* linux: /temp
|
||||
* </pre>
|
||||
*/
|
||||
public static final String SYS_TEM_DIR = System.getProperty("java.io.tmpdir") + File.separator;
|
||||
/**
|
||||
* 定义GB的计算常量
|
||||
*/
|
||||
private static final int GB = 1024 * 1024 * 1024;
|
||||
/**
|
||||
* 定义MB的计算常量
|
||||
*/
|
||||
private static final int MB = 1024 * 1024;
|
||||
/**
|
||||
* 定义KB的计算常量
|
||||
*/
|
||||
private static final int KB = 1024;
|
||||
|
||||
/**
|
||||
* 格式化小数
|
||||
*/
|
||||
private static final DecimalFormat DF = new DecimalFormat("0.00");
|
||||
|
||||
public static final String IMAGE = "图片";
|
||||
public static final String TXT = "文档";
|
||||
public static final String MUSIC = "音乐";
|
||||
public static final String VIDEO = "视频";
|
||||
public static final String OTHER = "其他";
|
||||
|
||||
|
||||
/**
|
||||
* MultipartFile转File
|
||||
*/
|
||||
public static File toFile(MultipartFile multipartFile) {
|
||||
// 获取文件名
|
||||
String fileName = multipartFile.getOriginalFilename();
|
||||
// 获取文件后缀
|
||||
String prefix = "." + getExtensionName(fileName);
|
||||
File file = null;
|
||||
try {
|
||||
// 用uuid作为文件名,防止生成的临时文件重复
|
||||
file = new File(SYS_TEM_DIR + IdUtil.simpleUUID() + prefix);
|
||||
// MultipartFile to File
|
||||
multipartFile.transferTo(file);
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
return file;
|
||||
}
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// File file = new File(
|
||||
// "http://18.162.111.141:5568/download/202211/userFile/collection/Printboard/1/a3c9838c-2171-44d7-af54-c94ee6affcd9print_2.jpg.png");
|
||||
// FileUtil.getFileSize()
|
||||
// }
|
||||
|
||||
/**
|
||||
* 获取文件扩展名,不带 .
|
||||
*/
|
||||
public static String getExtensionName(String filename) {
|
||||
if ((filename != null) && (filename.length() > 0)) {
|
||||
int dot = filename.lastIndexOf('.');
|
||||
if ((dot > -1) && (dot < (filename.length() - 1))) {
|
||||
return filename.substring(dot + 1);
|
||||
}
|
||||
}
|
||||
return filename;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* inputStream 转 File
|
||||
*/
|
||||
static File inputStreamToFile(InputStream ins, String name) {
|
||||
File file = new File(SYS_TEM_DIR + name);
|
||||
if (file.exists()) {
|
||||
return file;
|
||||
}
|
||||
OutputStream os = null;
|
||||
try {
|
||||
os = new FileOutputStream(file);
|
||||
int bytesRead;
|
||||
int len = 8192;
|
||||
byte[] buffer = new byte[len];
|
||||
while ((bytesRead = ins.read(buffer, 0, len)) != -1) {
|
||||
os.write(buffer, 0, bytesRead);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
CloseUtil.close(os);
|
||||
CloseUtil.close(ins);
|
||||
}
|
||||
return file;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件尺寸
|
||||
*/
|
||||
public static FileVO getFileSize(MultipartFile file) {
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
try {
|
||||
// 图片对象
|
||||
BufferedImage bufferedImage = ImageIO.read(file.getInputStream());
|
||||
// 宽度
|
||||
width = bufferedImage.getWidth();
|
||||
// 高度
|
||||
height = bufferedImage.getHeight();
|
||||
} catch (IOException ioException) {
|
||||
log.error("获取文件尺寸异常###{}", ExceptionUtil.stacktraceToString(ioException));
|
||||
}
|
||||
return new FileVO(height, width);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件尺寸
|
||||
*/
|
||||
public static FileVO getFileSize(InputStream inputStream) {
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
try {
|
||||
// 图片对象
|
||||
BufferedImage bufferedImage = ImageIO.read(inputStream);
|
||||
// 宽度
|
||||
width = bufferedImage.getWidth();
|
||||
// 高度
|
||||
height = bufferedImage.getHeight();
|
||||
} catch (IOException ioException) {
|
||||
log.error("获取文件尺寸异常###{}", ExceptionUtil.stacktraceToString(ioException));
|
||||
}
|
||||
return new FileVO(height, width);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取远程文件流
|
||||
*/
|
||||
public static InputStream getOriginFile(String path) {
|
||||
|
||||
try {
|
||||
//远程
|
||||
URL url = new URL(path);
|
||||
return url.openStream();
|
||||
} catch (IOException ioException) {
|
||||
log.error("获取源文件异常###{}###path##{}", ExceptionUtil.stacktraceToString(ioException), path);
|
||||
throw new BusinessException("get.file.failed");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将文件名解析成文件的上传路径
|
||||
*/
|
||||
public static File upload(MultipartFile file, String filePath) {
|
||||
Date date = new Date();
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddhhmmssS");
|
||||
String suffix = getExtensionName(file.getOriginalFilename());
|
||||
String nowStr = format.format(date) + "-";
|
||||
try {
|
||||
String fileName = file.getOriginalFilename();
|
||||
String fileSuffix = fileName.substring(fileName.lastIndexOf("."));
|
||||
String path = filePath + fileSuffix;
|
||||
// getCanonicalFile 可解析正确各种路径
|
||||
File dest = new File(path).getCanonicalFile();
|
||||
// 检测是否存在目录
|
||||
if (!dest.getParentFile().exists()) {
|
||||
if (!dest.getParentFile().mkdirs()) {
|
||||
System.out.println("was not successful.");
|
||||
}
|
||||
}
|
||||
// 文件写入
|
||||
file.transferTo(dest);
|
||||
return dest;
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将文件名解析成文件的上传路径
|
||||
*/
|
||||
public static File upload2(MultipartFile file, String filePath) {
|
||||
Date date = new Date();
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddhhmmssS");
|
||||
String suffix = getExtensionName(file.getOriginalFilename());
|
||||
String nowStr = format.format(date) + "-";
|
||||
try {
|
||||
String fileName = file.getOriginalFilename();
|
||||
String path = filePath + fileName;
|
||||
// getCanonicalFile 可解析正确各种路径
|
||||
File dest = new File(path).getCanonicalFile();
|
||||
// 检测是否存在目录
|
||||
if (!dest.getParentFile().exists()) {
|
||||
if (!dest.getParentFile().mkdirs()) {
|
||||
System.out.println("was not successful.");
|
||||
}
|
||||
}
|
||||
// 文件写入
|
||||
file.transferTo(dest);
|
||||
return dest;
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文件
|
||||
*/
|
||||
public static boolean delete(String path) {
|
||||
File file = new File(path);
|
||||
if (file.exists()) {
|
||||
return file.delete();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定文件夹下所有文件,不含文件夹里的文件
|
||||
*
|
||||
* @param dirFilePath 文件夹路径
|
||||
* @return
|
||||
*/
|
||||
public static List<File> getAllFile(String dirFilePath) {
|
||||
if (StrUtil.isBlank(dirFilePath)) {
|
||||
return null;
|
||||
}
|
||||
return getAllFile(new File(dirFilePath));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定文件夹下所有文件,不含文件夹里的文件
|
||||
*
|
||||
* @param dirFile 文件夹
|
||||
* @return
|
||||
*/
|
||||
public static List<File> getAllFile(File dirFile) {
|
||||
// 如果文件夹不存在或着不是文件夹,则返回 null
|
||||
if (Objects.isNull(dirFile) || !dirFile.exists() || dirFile.isFile()) {
|
||||
return null;
|
||||
}
|
||||
File[] childrenFiles = dirFile.listFiles();
|
||||
if (Objects.isNull(childrenFiles) || childrenFiles.length == 0) {
|
||||
return null;
|
||||
}
|
||||
List<File> files = new ArrayList<>();
|
||||
for (File childFile : childrenFiles) {
|
||||
// 如果是文件,直接添加到结果集合
|
||||
if (childFile.isFile()) {
|
||||
files.add(childFile);
|
||||
}
|
||||
//以下几行代码取消注释后可以将所有子文件夹里的文件也获取到列表里
|
||||
else {
|
||||
// 如果是文件夹,则将其内部文件添加进结果集合
|
||||
List<File> cFiles = getAllFile(childFile);
|
||||
if (Objects.isNull(cFiles) || cFiles.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
files.addAll(cFiles);
|
||||
}
|
||||
}
|
||||
return files;
|
||||
}
|
||||
|
||||
// 判断文件是否存在
|
||||
public static boolean isFileExists(String filePath) {
|
||||
File file = new File(filePath);
|
||||
return file.exists() && file.isFile();
|
||||
}
|
||||
|
||||
// 根据路径获取文件
|
||||
public static File getFile(String filePath) {
|
||||
File file = new File(filePath);
|
||||
if (file.exists() && file.isFile()) {
|
||||
return file;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
package com.ai.da.common.utils;
|
||||
|
||||
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ai.da.common.config.exception.BusinessException;
|
||||
import com.ai.da.model.vo.FileVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.*;
|
||||
import java.net.URL;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
public class FileUtil extends cn.hutool.core.io.FileUtil {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(com.ai.da.common.utils.FileUtil.class);
|
||||
|
||||
/**
|
||||
* 系统临时目录
|
||||
* <br>
|
||||
* windows 包含路径分割符,但Linux 不包含,
|
||||
* 在windows \\==\ 前提下,
|
||||
* 为安全起见 同意拼装 路径分割符,
|
||||
* <pre>
|
||||
* java.io.tmpdir
|
||||
* windows : C:\Users/xxx\AppData\Local\Temp\
|
||||
* linux: /temp
|
||||
* </pre>
|
||||
*/
|
||||
public static final String SYS_TEM_DIR = System.getProperty("java.io.tmpdir") + File.separator;
|
||||
/**
|
||||
* 定义GB的计算常量
|
||||
*/
|
||||
private static final int GB = 1024 * 1024 * 1024;
|
||||
/**
|
||||
* 定义MB的计算常量
|
||||
*/
|
||||
private static final int MB = 1024 * 1024;
|
||||
/**
|
||||
* 定义KB的计算常量
|
||||
*/
|
||||
private static final int KB = 1024;
|
||||
|
||||
/**
|
||||
* 格式化小数
|
||||
*/
|
||||
private static final DecimalFormat DF = new DecimalFormat("0.00");
|
||||
|
||||
public static final String IMAGE = "图片";
|
||||
public static final String TXT = "文档";
|
||||
public static final String MUSIC = "音乐";
|
||||
public static final String VIDEO = "视频";
|
||||
public static final String OTHER = "其他";
|
||||
|
||||
|
||||
/**
|
||||
* MultipartFile转File
|
||||
*/
|
||||
public static File toFile(MultipartFile multipartFile) {
|
||||
// 获取文件名
|
||||
String fileName = multipartFile.getOriginalFilename();
|
||||
// 获取文件后缀
|
||||
String prefix = "." + getExtensionName(fileName);
|
||||
File file = null;
|
||||
try {
|
||||
// 用uuid作为文件名,防止生成的临时文件重复
|
||||
file = new File(SYS_TEM_DIR + IdUtil.simpleUUID() + prefix);
|
||||
// MultipartFile to File
|
||||
multipartFile.transferTo(file);
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
return file;
|
||||
}
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// File file = new File(
|
||||
// "http://18.162.111.141:5568/download/202211/userFile/collection/Printboard/1/a3c9838c-2171-44d7-af54-c94ee6affcd9print_2.jpg.png");
|
||||
// FileUtil.getFileSize()
|
||||
// }
|
||||
|
||||
/**
|
||||
* 获取文件扩展名,不带 .
|
||||
*/
|
||||
public static String getExtensionName(String filename) {
|
||||
if ((filename != null) && (filename.length() > 0)) {
|
||||
int dot = filename.lastIndexOf('.');
|
||||
if ((dot > -1) && (dot < (filename.length() - 1))) {
|
||||
return filename.substring(dot + 1);
|
||||
}
|
||||
}
|
||||
return filename;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* inputStream 转 File
|
||||
*/
|
||||
static File inputStreamToFile(InputStream ins, String name) {
|
||||
File file = new File(SYS_TEM_DIR + name);
|
||||
if (file.exists()) {
|
||||
return file;
|
||||
}
|
||||
OutputStream os = null;
|
||||
try {
|
||||
os = new FileOutputStream(file);
|
||||
int bytesRead;
|
||||
int len = 8192;
|
||||
byte[] buffer = new byte[len];
|
||||
while ((bytesRead = ins.read(buffer, 0, len)) != -1) {
|
||||
os.write(buffer, 0, bytesRead);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
CloseUtil.close(os);
|
||||
CloseUtil.close(ins);
|
||||
}
|
||||
return file;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件尺寸
|
||||
*/
|
||||
public static FileVO getFileSize(MultipartFile file) {
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
try {
|
||||
// 图片对象
|
||||
BufferedImage bufferedImage = ImageIO.read(file.getInputStream());
|
||||
// 宽度
|
||||
width = bufferedImage.getWidth();
|
||||
// 高度
|
||||
height = bufferedImage.getHeight();
|
||||
} catch (IOException ioException) {
|
||||
log.error("获取文件尺寸异常###{}", ExceptionUtil.stacktraceToString(ioException));
|
||||
}
|
||||
return new FileVO(height, width);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件尺寸
|
||||
*/
|
||||
public static FileVO getFileSize(InputStream inputStream) {
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
try {
|
||||
// 图片对象
|
||||
BufferedImage bufferedImage = ImageIO.read(inputStream);
|
||||
// 宽度
|
||||
width = bufferedImage.getWidth();
|
||||
// 高度
|
||||
height = bufferedImage.getHeight();
|
||||
} catch (IOException ioException) {
|
||||
log.error("获取文件尺寸异常###{}", ExceptionUtil.stacktraceToString(ioException));
|
||||
}
|
||||
return new FileVO(height, width);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取远程文件流
|
||||
*/
|
||||
public static InputStream getOriginFile(String path) {
|
||||
|
||||
try {
|
||||
//远程
|
||||
URL url = new URL(path);
|
||||
return url.openStream();
|
||||
} catch (IOException ioException) {
|
||||
log.error("获取源文件异常###{}###path##{}", ExceptionUtil.stacktraceToString(ioException), path);
|
||||
throw new BusinessException("get.file.failed");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将文件名解析成文件的上传路径
|
||||
*/
|
||||
public static File upload(MultipartFile file, String filePath) {
|
||||
Date date = new Date();
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddhhmmssS");
|
||||
String suffix = getExtensionName(file.getOriginalFilename());
|
||||
String nowStr = format.format(date) + "-";
|
||||
try {
|
||||
String fileName = file.getOriginalFilename();
|
||||
String fileSuffix = fileName.substring(fileName.lastIndexOf("."));
|
||||
String path = filePath + fileSuffix;
|
||||
// getCanonicalFile 可解析正确各种路径
|
||||
File dest = new File(path).getCanonicalFile();
|
||||
// 检测是否存在目录
|
||||
if (!dest.getParentFile().exists()) {
|
||||
if (!dest.getParentFile().mkdirs()) {
|
||||
System.out.println("was not successful.");
|
||||
}
|
||||
}
|
||||
// 文件写入
|
||||
file.transferTo(dest);
|
||||
return dest;
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将文件名解析成文件的上传路径
|
||||
*/
|
||||
public static File upload2(MultipartFile file, String filePath) {
|
||||
Date date = new Date();
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddhhmmssS");
|
||||
String suffix = getExtensionName(file.getOriginalFilename());
|
||||
String nowStr = format.format(date) + "-";
|
||||
try {
|
||||
String fileName = file.getOriginalFilename();
|
||||
String path = filePath + fileName;
|
||||
// getCanonicalFile 可解析正确各种路径
|
||||
File dest = new File(path).getCanonicalFile();
|
||||
// 检测是否存在目录
|
||||
if (!dest.getParentFile().exists()) {
|
||||
if (!dest.getParentFile().mkdirs()) {
|
||||
System.out.println("was not successful.");
|
||||
}
|
||||
}
|
||||
// 文件写入
|
||||
file.transferTo(dest);
|
||||
return dest;
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文件
|
||||
*/
|
||||
public static boolean delete(String path) {
|
||||
File file = new File(path);
|
||||
if (file.exists()) {
|
||||
return file.delete();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定文件夹下所有文件,不含文件夹里的文件
|
||||
*
|
||||
* @param dirFilePath 文件夹路径
|
||||
* @return
|
||||
*/
|
||||
public static List<File> getAllFile(String dirFilePath) {
|
||||
if (StrUtil.isBlank(dirFilePath)) {
|
||||
return null;
|
||||
}
|
||||
return getAllFile(new File(dirFilePath));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定文件夹下所有文件,不含文件夹里的文件
|
||||
*
|
||||
* @param dirFile 文件夹
|
||||
* @return
|
||||
*/
|
||||
public static List<File> getAllFile(File dirFile) {
|
||||
// 如果文件夹不存在或着不是文件夹,则返回 null
|
||||
if (Objects.isNull(dirFile) || !dirFile.exists() || dirFile.isFile()) {
|
||||
return null;
|
||||
}
|
||||
File[] childrenFiles = dirFile.listFiles();
|
||||
if (Objects.isNull(childrenFiles) || childrenFiles.length == 0) {
|
||||
return null;
|
||||
}
|
||||
List<File> files = new ArrayList<>();
|
||||
for (File childFile : childrenFiles) {
|
||||
// 如果是文件,直接添加到结果集合
|
||||
if (childFile.isFile()) {
|
||||
files.add(childFile);
|
||||
}
|
||||
//以下几行代码取消注释后可以将所有子文件夹里的文件也获取到列表里
|
||||
else {
|
||||
// 如果是文件夹,则将其内部文件添加进结果集合
|
||||
List<File> cFiles = getAllFile(childFile);
|
||||
if (Objects.isNull(cFiles) || cFiles.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
files.addAll(cFiles);
|
||||
}
|
||||
}
|
||||
return files;
|
||||
}
|
||||
|
||||
// 判断文件是否存在
|
||||
public static boolean isFileExists(String filePath) {
|
||||
File file = new File(filePath);
|
||||
return file.exists() && file.isFile();
|
||||
}
|
||||
|
||||
// 根据路径获取文件
|
||||
public static File getFile(String filePath) {
|
||||
File file = new File(filePath);
|
||||
if (file.exists() && file.isFile()) {
|
||||
return file;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将 FileItem 转换为 MultipartFile
|
||||
* 用于 Spring Boot 3.x 兼容性(CommonsMultipartFile 已移除)
|
||||
*/
|
||||
public static MultipartFile fileItemToMultipartFile(org.apache.commons.fileupload.FileItem fileItem) {
|
||||
String fieldName = fileItem.getFieldName();
|
||||
String fileName = fileItem.getName();
|
||||
String contentType = fileItem.getContentType();
|
||||
byte[] content = fileItem.get();
|
||||
return new MockMultipartFile(fieldName, fileName, contentType, content);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.ai.da.common.response.Response;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.servlet.ServletResponse;
|
||||
import jakarta.servlet.ServletResponse;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
|
||||
|
||||
@@ -15,9 +15,9 @@ import org.springframework.stereotype.Component;
|
||||
import org.thymeleaf.TemplateEngine;
|
||||
import org.thymeleaf.context.Context;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.internet.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.mail.MessagingException;
|
||||
import jakarta.mail.internet.*;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@ package com.ai.da.common.utils;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.servlet.ReadListener;
|
||||
import javax.servlet.ServletInputStream;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletRequestWrapper;
|
||||
import jakarta.servlet.ReadListener;
|
||||
import jakarta.servlet.ServletInputStream;
|
||||
import jakarta.servlet.ServletRequest;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletRequestWrapper;
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Enumeration;
|
||||
|
||||
@@ -3,10 +3,10 @@ package com.ai.da.common.utils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.WriteListener;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpServletResponseWrapper;
|
||||
import jakarta.servlet.ServletOutputStream;
|
||||
import jakarta.servlet.WriteListener;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.http.HttpServletResponseWrapper;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
|
||||
@@ -16,7 +16,7 @@ import org.springframework.data.redis.core.script.DefaultRedisScript;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import jakarta.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.Duration;
|
||||
|
||||
@@ -13,8 +13,8 @@ import org.springframework.data.redis.core.script.DefaultRedisScript;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.Resource;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import jakarta.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.ai.da.common.utils;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
|
||||
@@ -19,7 +19,7 @@ import software.amazon.awssdk.services.s3.presigner.S3Presigner;
|
||||
import software.amazon.awssdk.services.s3.presigner.model.GetObjectPresignRequest;
|
||||
import software.amazon.awssdk.services.s3.presigner.model.PresignedGetObjectRequest;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import java.io.*;
|
||||
import java.time.Duration;
|
||||
import java.util.*;
|
||||
|
||||
Reference in New Issue
Block a user