Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1eac5db02d | |||
| ed41ef24cb |
@@ -0,0 +1,34 @@
|
||||
plugins {
|
||||
id 'java-library'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api 'org.springframework.boot:spring-boot-starter'
|
||||
api 'org.springframework.boot:spring-boot-starter-web'
|
||||
api 'org.springframework.boot:spring-boot-starter-validation'
|
||||
api 'org.springframework.boot:spring-boot-starter-security'
|
||||
api 'org.mybatis.spring.boot:mybatis-spring-boot-starter:3.0.3'
|
||||
|
||||
api 'io.swagger.core.v3:swagger-annotations-jakarta:2.2.27'
|
||||
|
||||
implementation 'io.jsonwebtoken:jjwt-api:0.11.5'
|
||||
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.5'
|
||||
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.11.5'
|
||||
|
||||
implementation 'org.bgee.log4jdbc-log4j2:log4jdbc-log4j2-jdbc4.1:1.16'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
|
||||
|
||||
runtimeOnly 'org.mariadb.jdbc:mariadb-java-client'
|
||||
runtimeOnly 'com.microsoft.sqlserver:mssql-jdbc:12.8.1.jre11'
|
||||
|
||||
compileOnly 'org.projectlombok:lombok'
|
||||
annotationProcessor 'org.projectlombok:lombok'
|
||||
|
||||
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
|
||||
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||
}
|
||||
|
||||
jar {
|
||||
enabled = true
|
||||
}
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package com.alist.api.config.exception;
|
||||
package com.alist.api.core.common.exception;
|
||||
|
||||
import com.alist.api.common.response.ApiResponse;
|
||||
import com.alist.api.common.response.ApiResponseCode;
|
||||
import com.alist.api.core.common.response.ApiResponse;
|
||||
import com.alist.api.core.common.response.ApiResponseCode;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.javassist.NotFoundException;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
+155
@@ -0,0 +1,155 @@
|
||||
package com.alist.api.core.common.file.service;
|
||||
|
||||
import com.alist.api.core.config.file.FileUploadProperties;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.imageio.IIOImage;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.imageio.ImageWriteParam;
|
||||
import javax.imageio.ImageWriter;
|
||||
import javax.imageio.stream.ImageOutputStream;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Iterator;
|
||||
|
||||
@Service
|
||||
public class FileImageService {
|
||||
public record ImageSize(int width, int height) {
|
||||
}
|
||||
|
||||
public ImageSize resizeAndSave(MultipartFile multipartFile, Path savePath, FileUploadProperties.Resize resize, String extension) throws IOException {
|
||||
BufferedImage source = ImageIO.read(multipartFile.getInputStream());
|
||||
|
||||
if (source == null) {
|
||||
throw new IllegalArgumentException("invalid image");
|
||||
}
|
||||
|
||||
BufferedImage target;
|
||||
|
||||
if (resize.getWidth() != null && resize.getHeight() != null) {
|
||||
target = cropAndResize(source, resize.getWidth(), resize.getHeight());
|
||||
} else if (resize.getMaxWidth() != null && source.getWidth() > resize.getMaxWidth()) {
|
||||
target = resizeByMaxWidth(source, resize.getMaxWidth());
|
||||
} else {
|
||||
target = source;
|
||||
}
|
||||
|
||||
writeImage(target, imageFormat(extension), savePath, resize.getQuality());
|
||||
|
||||
return new ImageSize(target.getWidth(), target.getHeight());
|
||||
}
|
||||
|
||||
public ImageSize readSize(Path path) throws IOException {
|
||||
BufferedImage image = ImageIO.read(path.toFile());
|
||||
|
||||
if (image == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ImageSize(image.getWidth(), image.getHeight());
|
||||
}
|
||||
|
||||
private BufferedImage cropAndResize(BufferedImage source, int targetWidth, int targetHeight) {
|
||||
double targetRatio = (double) targetWidth / targetHeight;
|
||||
int sourceWidth = source.getWidth();
|
||||
int sourceHeight = source.getHeight();
|
||||
double sourceRatio = (double) sourceWidth / sourceHeight;
|
||||
int cropWidth = sourceWidth;
|
||||
int cropHeight = sourceHeight;
|
||||
|
||||
if (sourceRatio > targetRatio) {
|
||||
cropWidth = (int) Math.round(sourceHeight * targetRatio);
|
||||
} else {
|
||||
cropHeight = (int) Math.round(sourceWidth / targetRatio);
|
||||
}
|
||||
|
||||
BufferedImage cropped = source.getSubimage(
|
||||
(sourceWidth - cropWidth) / 2
|
||||
, (sourceHeight - cropHeight) / 2
|
||||
, cropWidth
|
||||
, cropHeight
|
||||
);
|
||||
|
||||
return resize(cropped, targetWidth, targetHeight);
|
||||
}
|
||||
|
||||
private BufferedImage resizeByMaxWidth(BufferedImage source, int maxWidth) {
|
||||
int targetWidth = maxWidth;
|
||||
int targetHeight = (int) Math.round((double) source.getHeight() * targetWidth / source.getWidth());
|
||||
|
||||
return resize(source, targetWidth, targetHeight);
|
||||
}
|
||||
|
||||
private BufferedImage resize(BufferedImage source, int width, int height) {
|
||||
BufferedImage target = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
|
||||
Graphics2D graphics = target.createGraphics();
|
||||
|
||||
graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
|
||||
graphics.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
|
||||
graphics.drawImage(source, 0, 0, width, height, null);
|
||||
graphics.dispose();
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
private void writeImage(BufferedImage image, String format, Path savePath, Float quality) throws IOException {
|
||||
if (!"jpeg".equals(format)) {
|
||||
boolean written = ImageIO.write(image, format, savePath.toFile());
|
||||
|
||||
if (!written) {
|
||||
throw new IllegalArgumentException("unsupported image format");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Iterator<ImageWriter> writers = ImageIO.getImageWritersByFormatName("jpeg");
|
||||
|
||||
if (!writers.hasNext()) {
|
||||
throw new IllegalArgumentException("unsupported image format");
|
||||
}
|
||||
|
||||
ImageWriter writer = writers.next();
|
||||
ImageWriteParam parameter = writer.getDefaultWriteParam();
|
||||
|
||||
if (parameter.canWriteCompressed()) {
|
||||
parameter.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
|
||||
parameter.setCompressionQuality(normalizeQuality(quality));
|
||||
}
|
||||
|
||||
try (ImageOutputStream output = ImageIO.createImageOutputStream(savePath.toFile())) {
|
||||
writer.setOutput(output);
|
||||
writer.write(null, new IIOImage(image, null, null), parameter);
|
||||
} finally {
|
||||
writer.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private float normalizeQuality(Float quality) {
|
||||
if (quality == null) {
|
||||
return 0.9f;
|
||||
}
|
||||
|
||||
if (quality < 0.0f) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
if (quality > 1.0f) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
return quality;
|
||||
}
|
||||
|
||||
private String imageFormat(String extension) {
|
||||
if ("jpg".equalsIgnoreCase(extension)) {
|
||||
return "jpeg";
|
||||
}
|
||||
|
||||
return extension.toLowerCase();
|
||||
}
|
||||
}
|
||||
+288
@@ -0,0 +1,288 @@
|
||||
package com.alist.api.core.common.file.service;
|
||||
|
||||
import com.alist.api.core.common.file.vo.FileStorageUploadVo;
|
||||
import com.alist.api.core.config.file.FileUploadProperties;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.io.InputStreamResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.http.ContentDisposition;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
|
||||
@Service
|
||||
public class FileStorageService {
|
||||
private static final String PUBLIC_PREFIX = "/uploads";
|
||||
|
||||
@Value("${file.storage.root-path}")
|
||||
private String rootPath;
|
||||
|
||||
@Value("${file.storage.view-domain}")
|
||||
private String viewDomain;
|
||||
|
||||
private final FileUploadProperties fileUploadProperties;
|
||||
private final FileImageService fileImageService;
|
||||
|
||||
public FileStorageService(FileUploadProperties fileUploadProperties, FileImageService fileImageService) {
|
||||
this.fileUploadProperties = fileUploadProperties;
|
||||
this.fileImageService = fileImageService;
|
||||
}
|
||||
|
||||
public FileStorageUploadVo saveFileUpload(String folder, MultipartFile multipartFile) {
|
||||
if (folder == null || folder.isBlank()) {
|
||||
throw new IllegalArgumentException("invalid folder");
|
||||
}
|
||||
|
||||
if (multipartFile == null || multipartFile.isEmpty()) {
|
||||
throw new IllegalArgumentException("empty file");
|
||||
}
|
||||
|
||||
FileUploadProperties.UploadType uploadType = resolveUploadType(folder);
|
||||
String originalFileName = cleanFileName(multipartFile.getOriginalFilename());
|
||||
String extension = extractExtension(originalFileName);
|
||||
|
||||
validateExtension(extension);
|
||||
validateSize(multipartFile.getSize(), uploadType);
|
||||
|
||||
boolean image = isImageExtension(extension);
|
||||
|
||||
if (uploadType.isImageOnly() && !image) {
|
||||
throw new IllegalArgumentException("image only");
|
||||
}
|
||||
|
||||
LocalDate today = LocalDate.now();
|
||||
String storedFileName = UUID.randomUUID().toString().replace("-", "") + "." + extension;
|
||||
Path savePath = Paths.get(
|
||||
rootPath
|
||||
, uploadType.getFolder()
|
||||
, String.valueOf(today.getYear())
|
||||
, "%02d".formatted(today.getMonthValue())
|
||||
, "%02d".formatted(today.getDayOfMonth())
|
||||
, storedFileName
|
||||
).normalize().toAbsolutePath();
|
||||
|
||||
ensureUnderRoot(savePath);
|
||||
|
||||
try {
|
||||
Files.createDirectories(savePath.getParent());
|
||||
|
||||
FileImageService.ImageSize imageSize = null;
|
||||
|
||||
if (image && uploadType.getResize() != null && uploadType.getResize().isEnabled()) {
|
||||
imageSize = fileImageService.resizeAndSave(multipartFile, savePath, uploadType.getResize(), extension);
|
||||
} else {
|
||||
multipartFile.transferTo(savePath);
|
||||
|
||||
if (image) {
|
||||
imageSize = fileImageService.readSize(savePath);
|
||||
}
|
||||
}
|
||||
|
||||
FileStorageUploadVo fileStorageUploadVo = new FileStorageUploadVo();
|
||||
fileStorageUploadVo.setUploadPath(toUploadPath(savePath));
|
||||
fileStorageUploadVo.setOriginalFileName(originalFileName);
|
||||
fileStorageUploadVo.setStoredFileName(storedFileName);
|
||||
fileStorageUploadVo.setFileExtension(extension);
|
||||
fileStorageUploadVo.setContentType(multipartFile.getContentType());
|
||||
fileStorageUploadVo.setFileSize(Files.size(savePath));
|
||||
fileStorageUploadVo.setWidth(imageSize == null ? null : imageSize.width());
|
||||
fileStorageUploadVo.setHeight(imageSize == null ? null : imageSize.height());
|
||||
|
||||
return fileStorageUploadVo;
|
||||
} catch (IOException exception) {
|
||||
throw new IllegalStateException("file save failed", exception);
|
||||
}
|
||||
}
|
||||
|
||||
public ResponseEntity<Resource> loadFileResource(String uploadPath, boolean inline) {
|
||||
try {
|
||||
Path filePath = resolveUploadPath(uploadPath);
|
||||
|
||||
if (!Files.exists(filePath) || !Files.isRegularFile(filePath)) {
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
|
||||
String contentType = Files.probeContentType(filePath);
|
||||
|
||||
if (contentType == null || contentType.isBlank()) {
|
||||
contentType = MediaType.APPLICATION_OCTET_STREAM_VALUE;
|
||||
}
|
||||
|
||||
ContentDisposition contentDisposition = inline
|
||||
? ContentDisposition.inline().filename(filePath.getFileName().toString(), StandardCharsets.UTF_8).build()
|
||||
: ContentDisposition.attachment().filename(filePath.getFileName().toString(), StandardCharsets.UTF_8).build();
|
||||
|
||||
return ResponseEntity.ok()
|
||||
.contentType(MediaType.parseMediaType(contentType))
|
||||
.contentLength(Files.size(filePath))
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION, contentDisposition.toString())
|
||||
.body(new InputStreamResource(Files.newInputStream(filePath)));
|
||||
} catch (IOException exception) {
|
||||
throw new IllegalStateException("file read failed", exception);
|
||||
}
|
||||
}
|
||||
|
||||
public String buildFileViewUrl(String uploadPath) {
|
||||
if (viewDomain == null || viewDomain.isBlank()) {
|
||||
throw new IllegalStateException("file.storage.view-domain is empty");
|
||||
}
|
||||
|
||||
String fileDomain = viewDomain.endsWith("/")
|
||||
? viewDomain.substring(0, viewDomain.length() - 1)
|
||||
: viewDomain;
|
||||
String normalizedUploadPath = uploadPath.startsWith("/") ? uploadPath : "/" + uploadPath;
|
||||
|
||||
return fileDomain + normalizedUploadPath;
|
||||
}
|
||||
|
||||
private Path resolveUploadPath(String uploadPath) {
|
||||
if (uploadPath == null || uploadPath.isBlank()) {
|
||||
throw new IllegalArgumentException("empty path");
|
||||
}
|
||||
|
||||
String normalizedUploadPath = uploadPath.trim().replace("\\", "/");
|
||||
|
||||
if (!normalizedUploadPath.startsWith(PUBLIC_PREFIX + "/")) {
|
||||
throw new IllegalArgumentException("invalid path");
|
||||
}
|
||||
|
||||
String relativePath = normalizedUploadPath.substring((PUBLIC_PREFIX + "/").length());
|
||||
|
||||
if (relativePath.contains("..") || relativePath.startsWith("/") || relativePath.contains(":")) {
|
||||
throw new IllegalArgumentException("invalid path");
|
||||
}
|
||||
|
||||
Path rootPath = rootPath();
|
||||
Path resolvedPath = rootPath.resolve(relativePath).normalize().toAbsolutePath();
|
||||
|
||||
if (!resolvedPath.startsWith(rootPath)) {
|
||||
throw new IllegalArgumentException("invalid path");
|
||||
}
|
||||
|
||||
return resolvedPath;
|
||||
}
|
||||
|
||||
private String toUploadPath(Path savePath) {
|
||||
Path rootPath = rootPath();
|
||||
Path absolutePath = savePath.normalize().toAbsolutePath();
|
||||
|
||||
if (!absolutePath.startsWith(rootPath)) {
|
||||
throw new IllegalArgumentException("invalid path");
|
||||
}
|
||||
|
||||
return PUBLIC_PREFIX + "/" + rootPath.relativize(absolutePath).toString().replace("\\", "/");
|
||||
}
|
||||
|
||||
private void ensureUnderRoot(Path path) {
|
||||
if (!path.startsWith(rootPath())) {
|
||||
throw new IllegalArgumentException("invalid save path");
|
||||
}
|
||||
}
|
||||
|
||||
private Path rootPath() {
|
||||
return Paths.get(rootPath).normalize().toAbsolutePath();
|
||||
}
|
||||
|
||||
private void validateSize(long fileSize, FileUploadProperties.UploadType uploadType) {
|
||||
long maxSize = uploadType.getMaxSize() == null
|
||||
? fileUploadProperties.getMaxSize().toBytes()
|
||||
: uploadType.getMaxSize().toBytes();
|
||||
|
||||
if (fileSize > maxSize) {
|
||||
throw new IllegalArgumentException("file size exceeded");
|
||||
}
|
||||
}
|
||||
|
||||
private void validateExtension(String extension) {
|
||||
if (extension.isBlank() || fileUploadProperties.getAllowedExtensions().stream().noneMatch(extension::equalsIgnoreCase)) {
|
||||
throw new IllegalArgumentException("invalid extension");
|
||||
}
|
||||
}
|
||||
|
||||
private String cleanFileName(String fileName) {
|
||||
if (fileName == null || fileName.isBlank()) {
|
||||
throw new IllegalArgumentException("empty file name");
|
||||
}
|
||||
|
||||
return Paths.get(fileName).getFileName().toString();
|
||||
}
|
||||
|
||||
private String extractExtension(String fileName) {
|
||||
int extensionIndex = fileName.lastIndexOf('.');
|
||||
|
||||
if (extensionIndex < 0 || extensionIndex == fileName.length() - 1) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return fileName.substring(extensionIndex + 1).trim().toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
private boolean isImageExtension(String extension) {
|
||||
return "jpg".equals(extension)
|
||||
|| "jpeg".equals(extension)
|
||||
|| "png".equals(extension)
|
||||
|| "gif".equals(extension);
|
||||
}
|
||||
|
||||
private FileUploadProperties.UploadType resolveUploadType(String folder) {
|
||||
String normalizedFolder = normalizeFolder(folder);
|
||||
FileUploadProperties.UploadType uploadType = fileUploadProperties.getTypes() == null
|
||||
? null
|
||||
: fileUploadProperties.getTypes().get(normalizedFolder);
|
||||
|
||||
if (uploadType != null) {
|
||||
uploadType.setFolder(normalizeFolder(uploadType.getFolder()));
|
||||
return uploadType;
|
||||
}
|
||||
|
||||
FileUploadProperties.UploadType fallbackUploadType = new FileUploadProperties.UploadType();
|
||||
fallbackUploadType.setFolder(normalizedFolder);
|
||||
fallbackUploadType.setMaxSize(null);
|
||||
fallbackUploadType.setImageOnly(false);
|
||||
fallbackUploadType.setResize(new FileUploadProperties.Resize());
|
||||
fallbackUploadType.getResize().setEnabled(false);
|
||||
|
||||
return fallbackUploadType;
|
||||
}
|
||||
|
||||
private String normalizeFolder(String folder) {
|
||||
if (folder == null || folder.isBlank()) {
|
||||
throw new IllegalArgumentException("invalid folder");
|
||||
}
|
||||
|
||||
String normalizedFolder = folder.trim().replace("\\", "/");
|
||||
|
||||
while (normalizedFolder.startsWith("/")) {
|
||||
normalizedFolder = normalizedFolder.substring(1);
|
||||
}
|
||||
|
||||
while (normalizedFolder.endsWith("/")) {
|
||||
normalizedFolder = normalizedFolder.substring(0, normalizedFolder.length() - 1);
|
||||
}
|
||||
|
||||
if (normalizedFolder.isBlank()
|
||||
|| normalizedFolder.contains("..")
|
||||
|| normalizedFolder.contains(":")
|
||||
|| normalizedFolder.startsWith("http://")
|
||||
|| normalizedFolder.startsWith("https://")) {
|
||||
throw new IllegalArgumentException("invalid folder");
|
||||
}
|
||||
|
||||
if (!normalizedFolder.matches("^[a-zA-Z0-9/_-]+$")) {
|
||||
throw new IllegalArgumentException("invalid folder");
|
||||
}
|
||||
|
||||
return normalizedFolder;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.alist.api.core.common.file.vo;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class FileStorageUploadVo {
|
||||
private String uploadPath;
|
||||
private String originalFileName;
|
||||
private String storedFileName;
|
||||
private String fileExtension;
|
||||
private String contentType;
|
||||
private Long fileSize;
|
||||
private Integer width;
|
||||
private Integer height;
|
||||
}
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package com.alist.api.config.jwt;
|
||||
package com.alist.api.core.common.jwt;
|
||||
|
||||
import com.alist.api.common.response.ApiResponse;
|
||||
import com.alist.api.common.response.ApiResponseCode;
|
||||
import com.alist.api.core.common.response.ApiResponse;
|
||||
import com.alist.api.core.common.response.ApiResponseCode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package com.alist.api.config.jwt;
|
||||
package com.alist.api.core.common.jwt;
|
||||
|
||||
import com.alist.api.common.response.ApiResponse;
|
||||
import com.alist.api.common.response.ApiResponseCode;
|
||||
import com.alist.api.core.common.response.ApiResponse;
|
||||
import com.alist.api.core.common.response.ApiResponseCode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.alist.api.core.common.jwt;
|
||||
|
||||
import jakarta.servlet.FilterChain;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.http.Cookie;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
|
||||
import org.springframework.web.filter.OncePerRequestFilter;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public class JwtAuthenticationFilter extends OncePerRequestFilter {
|
||||
private final JwtTokenProvider jwtTokenProvider;
|
||||
private final String requiredScope;
|
||||
private final String accessTokenCookieName;
|
||||
|
||||
public JwtAuthenticationFilter(
|
||||
JwtTokenProvider jwtTokenProvider,
|
||||
String requiredScope,
|
||||
String accessTokenCookieName
|
||||
) {
|
||||
this.jwtTokenProvider = jwtTokenProvider;
|
||||
this.requiredScope = requiredScope;
|
||||
this.accessTokenCookieName = accessTokenCookieName;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doFilterInternal(
|
||||
HttpServletRequest request,
|
||||
HttpServletResponse response,
|
||||
FilterChain filterChain
|
||||
) throws ServletException, IOException {
|
||||
try {
|
||||
String token = resolveToken(request);
|
||||
|
||||
if (token != null && jwtTokenProvider.validateToken(token)) {
|
||||
String principal = jwtTokenProvider.getUserTokenIdx(token);
|
||||
String role = jwtTokenProvider.getRole(token);
|
||||
String scope = jwtTokenProvider.getScope(token);
|
||||
String tokenType = jwtTokenProvider.getTokenType(token);
|
||||
|
||||
boolean authenticatable =
|
||||
requiredScope.equals(scope)
|
||||
&& role != null
|
||||
&& "ACCESS".equals(tokenType);
|
||||
|
||||
if (authenticatable) {
|
||||
UsernamePasswordAuthenticationToken authentication =
|
||||
new UsernamePasswordAuthenticationToken(
|
||||
principal,
|
||||
null,
|
||||
List.of(new SimpleGrantedAuthority("ROLE_" + role))
|
||||
);
|
||||
|
||||
authentication.setDetails(
|
||||
new WebAuthenticationDetailsSource().buildDetails(request)
|
||||
);
|
||||
|
||||
SecurityContextHolder.getContext().setAuthentication(authentication);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
SecurityContextHolder.clearContext();
|
||||
}
|
||||
|
||||
filterChain.doFilter(request, response);
|
||||
}
|
||||
|
||||
private String resolveToken(HttpServletRequest request) {
|
||||
String bearer = request.getHeader(HttpHeaders.AUTHORIZATION);
|
||||
if (bearer != null && bearer.startsWith("Bearer ")) {
|
||||
String token = bearer.substring(7).trim();
|
||||
if (!token.isEmpty()) {
|
||||
return token;
|
||||
}
|
||||
}
|
||||
|
||||
Cookie[] cookies = request.getCookies();
|
||||
if (cookies == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (Cookie cookie : cookies) {
|
||||
if (accessTokenCookieName.equals(cookie.getName())) {
|
||||
String token = cookie.getValue();
|
||||
|
||||
if (token != null && !token.isBlank()) {
|
||||
return token.trim();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+17
-13
@@ -1,11 +1,11 @@
|
||||
package com.alist.api.config.jwt;
|
||||
package com.alist.api.core.common.jwt;
|
||||
|
||||
import com.alist.api.config.properties.JwtProperties;
|
||||
import io.jsonwebtoken.Claims;
|
||||
import io.jsonwebtoken.JwtException;
|
||||
import io.jsonwebtoken.Jwts;
|
||||
import io.jsonwebtoken.SignatureAlgorithm;
|
||||
import io.jsonwebtoken.security.Keys;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.crypto.SecretKey;
|
||||
@@ -15,21 +15,25 @@ import java.util.Date;
|
||||
|
||||
@Component
|
||||
public class JwtTokenProvider {
|
||||
private final JwtProperties jwtProperties;
|
||||
private final SecretKey secretKey;
|
||||
private final long accessTokenValiditySeconds;
|
||||
private final long refreshTokenValiditySeconds;
|
||||
|
||||
public JwtTokenProvider(JwtProperties jwtProperties) {
|
||||
this.jwtProperties = jwtProperties;
|
||||
this.secretKey = Keys.hmacShaKeyFor(
|
||||
jwtProperties.getSecret().getBytes(StandardCharsets.UTF_8)
|
||||
);
|
||||
public JwtTokenProvider(
|
||||
@Value("${jwt.secret}") String secret,
|
||||
@Value("${jwt.access-token-validity-seconds}") long accessTokenValiditySeconds,
|
||||
@Value("${jwt.refresh-token-validity-seconds}") long refreshTokenValiditySeconds
|
||||
) {
|
||||
this.secretKey = Keys.hmacShaKeyFor(secret.getBytes(StandardCharsets.UTF_8));
|
||||
this.accessTokenValiditySeconds = accessTokenValiditySeconds;
|
||||
this.refreshTokenValiditySeconds = refreshTokenValiditySeconds;
|
||||
}
|
||||
|
||||
/** 토큰생성 **/
|
||||
public String createToken(String userId) {
|
||||
Date now = new Date();
|
||||
Date expiry = new Date(
|
||||
now.getTime() + jwtProperties.getAccessTokenValiditySeconds() * 1000
|
||||
now.getTime() + accessTokenValiditySeconds * 1000
|
||||
);
|
||||
|
||||
return Jwts.builder()
|
||||
@@ -46,7 +50,7 @@ public class JwtTokenProvider {
|
||||
/* 엑세스 토큰 생성 */
|
||||
public String createAccessToken(Integer userTokenIdx, String role) {
|
||||
Instant now = Instant.now();
|
||||
Instant expiry = now.plusSeconds(jwtProperties.getAccessTokenValiditySeconds());
|
||||
Instant expiry = now.plusSeconds(accessTokenValiditySeconds);
|
||||
|
||||
return Jwts.builder()
|
||||
.setSubject(String.valueOf(userTokenIdx))
|
||||
@@ -62,7 +66,7 @@ public class JwtTokenProvider {
|
||||
/* 리프레시 토큰 생성 */
|
||||
public String createRefreshToken(Integer userTokenIdx) {
|
||||
Instant now = Instant.now();
|
||||
Instant expiry = now.plusSeconds(jwtProperties.getRefreshTokenValiditySeconds());
|
||||
Instant expiry = now.plusSeconds(refreshTokenValiditySeconds);
|
||||
|
||||
return Jwts.builder()
|
||||
.setSubject(String.valueOf(userTokenIdx))
|
||||
@@ -122,7 +126,7 @@ public class JwtTokenProvider {
|
||||
|
||||
public String createAdminAccessToken(long userTokenIdx) {
|
||||
Instant now = Instant.now();
|
||||
Instant expiry = now.plusSeconds(jwtProperties.getAccessTokenValiditySeconds());
|
||||
Instant expiry = now.plusSeconds(accessTokenValiditySeconds);
|
||||
|
||||
return Jwts.builder()
|
||||
.setSubject(String.valueOf(userTokenIdx))
|
||||
@@ -137,7 +141,7 @@ public class JwtTokenProvider {
|
||||
|
||||
public String createAdminRefreshToken(long userTokenIdx) {
|
||||
Instant now = Instant.now();
|
||||
Instant expiry = now.plusSeconds(jwtProperties.getRefreshTokenValiditySeconds());
|
||||
Instant expiry = now.plusSeconds(refreshTokenValiditySeconds);
|
||||
|
||||
return Jwts.builder()
|
||||
.setSubject(String.valueOf(userTokenIdx))
|
||||
+3
-3
@@ -1,11 +1,11 @@
|
||||
package com.alist.api.common.paging;
|
||||
package com.alist.api.core.common.paging;
|
||||
|
||||
import com.alist.api.common.utils.PagingUtil;
|
||||
import com.alist.api.core.common.utils.PagingUtil;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Setter;
|
||||
|
||||
@Setter
|
||||
public class PageRequest {
|
||||
public class PagingRequest {
|
||||
@Schema(description = "페이지 번호", example = "1")
|
||||
private Integer page;
|
||||
|
||||
+8
-8
@@ -1,13 +1,13 @@
|
||||
package com.alist.api.common.paging;
|
||||
package com.alist.api.core.common.paging;
|
||||
|
||||
import com.alist.api.common.utils.PagingUtil;
|
||||
import com.alist.api.core.common.utils.PagingUtil;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class PageResponse {
|
||||
public class PagingResponse {
|
||||
@Schema(description = "현재 페이지 번호", example = "1")
|
||||
private int page;
|
||||
|
||||
@@ -26,11 +26,11 @@ public class PageResponse {
|
||||
)
|
||||
private int rowStartNum;
|
||||
|
||||
public void setPaging(PageRequest pageRequest, int totalCount) {
|
||||
this.page = pageRequest.getPage();
|
||||
this.size = pageRequest.getSize();
|
||||
public void setPaging(PagingRequest pagingRequest, int totalCount) {
|
||||
this.page = pagingRequest.getPage();
|
||||
this.size = pagingRequest.getSize();
|
||||
this.totalCount = totalCount;
|
||||
this.totalPage = PagingUtil.getTotalPage(totalCount, pageRequest.getSize());
|
||||
this.rowStartNum = PagingUtil.getRowStartNum(totalCount, pageRequest.getPage(), pageRequest.getSize());
|
||||
this.totalPage = PagingUtil.getTotalPage(totalCount, pagingRequest.getSize());
|
||||
this.rowStartNum = PagingUtil.getRowStartNum(totalCount, pagingRequest.getPage(), pagingRequest.getSize());
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.alist.api.common.response;
|
||||
package com.alist.api.core.common.response;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.alist.api.common.response;
|
||||
package com.alist.api.core.common.response;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.alist.api.common.utils;
|
||||
package com.alist.api.core.common.utils;
|
||||
|
||||
import java.security.SecureRandom;
|
||||
import java.util.Base64;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.alist.api.common.utils;
|
||||
package com.alist.api.core.common.utils;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.MessageDigest;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.alist.api.common.utils;
|
||||
package com.alist.api.core.common.utils;
|
||||
|
||||
public final class PagingUtil {
|
||||
private static final int DEFAULT_PAGE = 1;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.alist.api.common.utils;
|
||||
package com.alist.api.core.common.utils;
|
||||
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.alist.api.common.utils;
|
||||
package com.alist.api.core.common.utils;
|
||||
|
||||
import jakarta.servlet.http.Cookie;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.alist.api.core.config;
|
||||
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@ComponentScan("com.alist.api.core")
|
||||
public class ApiCoreConfig {
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.alist.api.core.config.cors;
|
||||
|
||||
import com.alist.api.core.modules.standard.testCorsAllowedList.service.TestCorsAllowedListService;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class CorsCache {
|
||||
public static final String REDIS_KEY = "alist:cors:allow-origins";
|
||||
|
||||
private final StringRedisTemplate stringRedisTemplate;
|
||||
private final ObjectMapper objectMapper;
|
||||
private final TestCorsAllowedListService testCorsAllowedListService;
|
||||
|
||||
private volatile List<String> allowedOriginList = List.of();
|
||||
|
||||
public CorsCache(StringRedisTemplate stringRedisTemplate, ObjectMapper objectMapper, TestCorsAllowedListService testCorsAllowedListService) {
|
||||
this.stringRedisTemplate = stringRedisTemplate;
|
||||
this.objectMapper = objectMapper;
|
||||
this.testCorsAllowedListService = testCorsAllowedListService;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void initialize() {
|
||||
refreshFromRedis();
|
||||
}
|
||||
|
||||
@Scheduled(fixedDelayString = "${cors.cache.redis-refresh-interval-ms:60000}")
|
||||
public void refreshFromRedis() {
|
||||
String allowedOriginJson = stringRedisTemplate.opsForValue().get(REDIS_KEY);
|
||||
|
||||
if (allowedOriginJson == null || allowedOriginJson.isBlank()) {
|
||||
allowedOriginList = List.of();
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
List<String> redisAllowedOriginList = objectMapper.readValue(allowedOriginJson, new TypeReference<List<String>>() {
|
||||
});
|
||||
|
||||
allowedOriginList = redisAllowedOriginList.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.map(String::trim)
|
||||
.filter(allowedOrigin -> !allowedOrigin.isEmpty())
|
||||
.distinct()
|
||||
.toList();
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error("CORS Redis cache JSON parsing failed.", e);
|
||||
}
|
||||
}
|
||||
|
||||
public void syncFromDatabase() {
|
||||
List<String> databaseAllowedOriginList = testCorsAllowedListService.selectTestCorsAllowedListAllowedOriginList();
|
||||
List<String> allowedOriginList = new ArrayList<>();
|
||||
|
||||
for (String allowedOrigin : databaseAllowedOriginList) {
|
||||
if (allowedOrigin != null && !allowedOrigin.isBlank()) {
|
||||
allowedOriginList.add(allowedOrigin.trim());
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
String allowedOriginJson = objectMapper.writeValueAsString(allowedOriginList);
|
||||
stringRedisTemplate.opsForValue().set(REDIS_KEY, allowedOriginJson);
|
||||
this.allowedOriginList = List.copyOf(allowedOriginList);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new IllegalStateException("CORS Redis cache JSON creation failed.", e);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isAllowed(String origin) {
|
||||
return allowedOriginList.contains("*") || allowedOriginList.contains(origin);
|
||||
}
|
||||
|
||||
public List<String> getAllowedOriginList() {
|
||||
return List.copyOf(allowedOriginList);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.alist.api.core.config.cors;
|
||||
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class CorsCachePublisher {
|
||||
public static final String CHANNEL = "alist:cors:allow-origins:changed";
|
||||
|
||||
private final StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
public CorsCachePublisher(StringRedisTemplate stringRedisTemplate) {
|
||||
this.stringRedisTemplate = stringRedisTemplate;
|
||||
}
|
||||
|
||||
public void publishReload() {
|
||||
stringRedisTemplate.convertAndSend(CHANNEL, "reload");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.alist.api.core.config.cors;
|
||||
|
||||
public class CorsCacheRefreshEvent {
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.alist.api.core.config.cors;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.event.TransactionPhase;
|
||||
import org.springframework.transaction.event.TransactionalEventListener;
|
||||
|
||||
@Component
|
||||
public class CorsCacheRefreshEventListener {
|
||||
private final CorsCache corsCache;
|
||||
private final CorsCachePublisher corsCachePublisher;
|
||||
|
||||
public CorsCacheRefreshEventListener(CorsCache corsCache, CorsCachePublisher corsCachePublisher) {
|
||||
this.corsCache = corsCache;
|
||||
this.corsCachePublisher = corsCachePublisher;
|
||||
}
|
||||
|
||||
@TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT)
|
||||
public void refreshCorsCache(CorsCacheRefreshEvent corsCacheRefreshEvent) {
|
||||
corsCache.syncFromDatabase();
|
||||
corsCachePublisher.publishReload();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.alist.api.core.config.cors;
|
||||
|
||||
import org.springframework.data.redis.connection.Message;
|
||||
import org.springframework.data.redis.connection.MessageListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class CorsCacheSubscriber implements MessageListener {
|
||||
private final CorsCache corsCache;
|
||||
|
||||
public CorsCacheSubscriber(CorsCache corsCache) {
|
||||
this.corsCache = corsCache;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessage(Message message, byte[] pattern) {
|
||||
corsCache.refreshFromRedis();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.alist.api.core.config.cors;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.listener.ChannelTopic;
|
||||
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
@Configuration
|
||||
@EnableScheduling
|
||||
public class CorsRedisConfig {
|
||||
@Bean
|
||||
public RedisMessageListenerContainer corsRedisMessageListenerContainer(RedisConnectionFactory redisConnectionFactory, CorsCacheSubscriber corsCacheSubscriber) {
|
||||
RedisMessageListenerContainer redisMessageListenerContainer = new RedisMessageListenerContainer();
|
||||
redisMessageListenerContainer.setConnectionFactory(redisConnectionFactory);
|
||||
redisMessageListenerContainer.addMessageListener(corsCacheSubscriber, new ChannelTopic(CorsCachePublisher.CHANNEL));
|
||||
|
||||
return redisMessageListenerContainer;
|
||||
}
|
||||
}
|
||||
+10
-4
@@ -1,4 +1,4 @@
|
||||
package com.alist.api.config.migration;
|
||||
package com.alist.api.core.config.datasource;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@@ -8,6 +8,7 @@ import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.mybatis.spring.SqlSessionFactoryBean;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.jdbc.DataSourceBuilder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -16,8 +17,13 @@ import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnProperty(
|
||||
prefix = "migration.datasource.alist"
|
||||
, name = "enabled"
|
||||
, havingValue = "true"
|
||||
)
|
||||
@MapperScan(
|
||||
basePackages = "com.alist.api.modules.migration.alist",
|
||||
basePackages = "com.alist.api.core.modules.migration.alist",
|
||||
sqlSessionFactoryRef = "migrationAlistSqlSessionFactory"
|
||||
)
|
||||
public class AlistDataSourceConfig {
|
||||
@@ -36,11 +42,11 @@ public class AlistDataSourceConfig {
|
||||
) throws Exception {
|
||||
SqlSessionFactoryBean factoryBean = new SqlSessionFactoryBean();
|
||||
factoryBean.setDataSource(migrationAlistDataSource);
|
||||
factoryBean.setTypeAliasesPackage("com.alist.api.modules.migration.alist");
|
||||
factoryBean.setTypeAliasesPackage("com.alist.api.core.modules.migration.alist");
|
||||
factoryBean.setConfiguration(mybatisConfiguration());
|
||||
factoryBean.setMapperLocations(
|
||||
new PathMatchingResourcePatternResolver()
|
||||
.getResources("classpath:mapper/migration/alist/**/*.xml")
|
||||
.getResources("classpath*:mapper/migration/alist/**/*.xml")
|
||||
);
|
||||
return factoryBean.getObject();
|
||||
}
|
||||
+10
-4
@@ -1,4 +1,4 @@
|
||||
package com.alist.api.config.migration;
|
||||
package com.alist.api.core.config.datasource;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@@ -8,6 +8,7 @@ import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.mybatis.spring.SqlSessionFactoryBean;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.jdbc.DataSourceBuilder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -16,8 +17,13 @@ import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnProperty(
|
||||
prefix = "migration.datasource.eltown"
|
||||
, name = "enabled"
|
||||
, havingValue = "true"
|
||||
)
|
||||
@MapperScan(
|
||||
basePackages = "com.alist.api.modules.migration.eltown",
|
||||
basePackages = "com.alist.api.core.modules.migration.eltown",
|
||||
sqlSessionFactoryRef = "migrationEltownSqlSessionFactory"
|
||||
)
|
||||
public class EltownDataSourceConfig {
|
||||
@@ -36,11 +42,11 @@ public class EltownDataSourceConfig {
|
||||
) throws Exception {
|
||||
SqlSessionFactoryBean factoryBean = new SqlSessionFactoryBean();
|
||||
factoryBean.setDataSource(migrationEltownDataSource);
|
||||
factoryBean.setTypeAliasesPackage("com.alist.api.modules.migration.eltown");
|
||||
factoryBean.setTypeAliasesPackage("com.alist.api.core.modules.migration.eltown");
|
||||
factoryBean.setConfiguration(mybatisConfiguration());
|
||||
factoryBean.setMapperLocations(
|
||||
new PathMatchingResourcePatternResolver()
|
||||
.getResources("classpath:mapper/migration/eltown/**/*.xml")
|
||||
.getResources("classpath*:mapper/migration/eltown/**/*.xml")
|
||||
);
|
||||
return factoryBean.getObject();
|
||||
}
|
||||
+12
-9
@@ -1,4 +1,4 @@
|
||||
package com.alist.api.config;
|
||||
package com.alist.api.core.config.datasource;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@@ -23,7 +23,10 @@ import java.util.stream.Stream;
|
||||
|
||||
@Configuration
|
||||
@MapperScan(
|
||||
basePackages = "com.alist.api.modules",
|
||||
basePackages = {
|
||||
"com.alist.api.core.modules.standard",
|
||||
"com.alist.api.core.modules.bespoke"
|
||||
},
|
||||
annotationClass = Mapper.class,
|
||||
sqlSessionFactoryRef = "mainSqlSessionFactory"
|
||||
)
|
||||
@@ -53,18 +56,18 @@ public class MainDataSourceConfig {
|
||||
) throws Exception {
|
||||
SqlSessionFactoryBean factoryBean = new SqlSessionFactoryBean();
|
||||
factoryBean.setDataSource(mainDataSource);
|
||||
factoryBean.setTypeAliasesPackage("com.alist.api");
|
||||
factoryBean.setTypeAliasesPackage("com.alist.api.core");
|
||||
factoryBean.setConfiguration(mybatisConfiguration());
|
||||
|
||||
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
|
||||
|
||||
Resource[] commonMappers = resolver.getResources("classpath:mapper/*/*.xml");
|
||||
Resource[] adminMappers = resolver.getResources("classpath:mapper/admin/**/*.xml");
|
||||
Resource[] frontMappers = resolver.getResources("classpath:mapper/front/**/*.xml");
|
||||
Resource[] standardMappers = resolver.getResources("classpath*:mapper/standard/**/*.xml");
|
||||
|
||||
Resource[] bespokeMappers = resolver.getResources("classpath*:mapper/bespoke/**/*.xml");
|
||||
|
||||
Resource[] mapperLocations = Stream.of(
|
||||
Arrays.stream(commonMappers)
|
||||
, Arrays.stream(adminMappers)
|
||||
, Arrays.stream(frontMappers)
|
||||
Arrays.stream(standardMappers)
|
||||
, Arrays.stream(bespokeMappers)
|
||||
).flatMap(stream -> stream).toArray(Resource[]::new);
|
||||
|
||||
factoryBean.setMapperLocations(mapperLocations);
|
||||
+2
-3
@@ -1,10 +1,9 @@
|
||||
package com.alist.api.modules.file.config;
|
||||
package com.alist.api.core.config.file;
|
||||
|
||||
import com.alist.api.modules.file.properties.FileUploadProperties;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@EnableConfigurationProperties(FileUploadProperties.class)
|
||||
@Configuration
|
||||
@EnableConfigurationProperties(FileUploadProperties.class)
|
||||
public class FileUploadConfig {
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.alist.api.core.config.file;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.util.unit.DataSize;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ConfigurationProperties(prefix = "file.upload")
|
||||
public class FileUploadProperties {
|
||||
private DataSize maxSize;
|
||||
private List<String> allowedExtensions;
|
||||
private Map<String, UploadType> types;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static class UploadType {
|
||||
private String folder;
|
||||
private DataSize maxSize;
|
||||
private boolean imageOnly;
|
||||
private Resize resize = new Resize();
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static class Resize {
|
||||
private boolean enabled;
|
||||
private Integer width;
|
||||
private Integer height;
|
||||
private Integer maxWidth;
|
||||
private Float quality = 0.9f;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.alist.api.core.config.filter;
|
||||
|
||||
import com.alist.api.core.config.cors.CorsCache;
|
||||
import jakarta.servlet.FilterChain;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.filter.OncePerRequestFilter;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@Component
|
||||
@Order(Ordered.HIGHEST_PRECEDENCE)
|
||||
public class DynamicCorsFilter extends OncePerRequestFilter {
|
||||
private final CorsCache corsCache;
|
||||
|
||||
public DynamicCorsFilter(CorsCache corsCache) {
|
||||
this.corsCache = corsCache;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
|
||||
String origin = request.getHeader("Origin");
|
||||
|
||||
if (origin != null && corsCache.isAllowed(origin)) {
|
||||
response.setHeader("Access-Control-Allow-Origin", origin);
|
||||
response.setHeader("Access-Control-Allow-Credentials", "true");
|
||||
response.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, PATCH, OPTIONS");
|
||||
response.setHeader("Access-Control-Allow-Headers", "Content-Type, Authorization, X-Requested-With, Accept, Origin, Referer, Content-Disposition, Content-Length");
|
||||
response.setHeader("Access-Control-Expose-Headers", "Authorization, Set-Cookie");
|
||||
response.setHeader("Access-Control-Max-Age", "3600");
|
||||
}
|
||||
|
||||
if ("OPTIONS".equalsIgnoreCase(request.getMethod())) {
|
||||
response.setStatus(HttpServletResponse.SC_OK);
|
||||
return;
|
||||
}
|
||||
|
||||
filterChain.doFilter(request, response);
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.alist.api.core.modules.bespoke.fileDetail.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class FileDetailTusFileAuthDto {
|
||||
private Integer userTokenIdx;
|
||||
private String fileUuid;
|
||||
private String originName;
|
||||
private Long sizeBytes;
|
||||
private String contentType;
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.alist.api.core.modules.bespoke.fileDetail.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class FileDetailTusFileListDto {
|
||||
private Long fileMasterIdx;
|
||||
private Integer userTokenIdx;
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.alist.api.core.modules.bespoke.fileDetail.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class FileDetailTusFileViewDto {
|
||||
private String fileUuid;
|
||||
private Integer userTokenIdx;
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.alist.api.core.modules.bespoke.fileDetail.mapper;
|
||||
|
||||
import com.alist.api.core.modules.bespoke.fileDetail.dto.FileDetailTusFileAuthDto;
|
||||
import com.alist.api.core.modules.bespoke.fileDetail.dto.FileDetailTusFileListDto;
|
||||
import com.alist.api.core.modules.bespoke.fileDetail.dto.FileDetailTusFileViewDto;
|
||||
import com.alist.api.core.modules.bespoke.fileDetail.vo.FileDetailTusFileListItemVo;
|
||||
import com.alist.api.core.modules.bespoke.fileDetail.vo.FileDetailTusFileViewVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface FileDetailTusFileMapper {
|
||||
int fileDetailTusFileUploadAuthCount(FileDetailTusFileAuthDto fileDetailTusFileAuthDto);
|
||||
|
||||
FileDetailTusFileViewVo fileDetailTusFileMetaView(FileDetailTusFileViewDto fileDetailTusFileViewDto);
|
||||
|
||||
FileDetailTusFileViewVo fileDetailTusFileMoveView(FileDetailTusFileViewDto fileDetailTusFileViewDto);
|
||||
|
||||
FileDetailTusFileViewVo fileDetailTusFileUploadCancelView(FileDetailTusFileViewDto fileDetailTusFileViewDto);
|
||||
|
||||
List<FileDetailTusFileListItemVo> fileDetailTusFileList(FileDetailTusFileListDto fileDetailTusFileListDto);
|
||||
|
||||
FileDetailTusFileViewVo fileDetailTusFileView(FileDetailTusFileViewDto fileDetailTusFileViewDto);
|
||||
|
||||
FileDetailTusFileViewVo fileDetailTusFileDeleteView(FileDetailTusFileViewDto fileDetailTusFileViewDto);
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
package com.alist.api.core.modules.bespoke.fileDetail.service;
|
||||
|
||||
import com.alist.api.core.modules.bespoke.fileDetail.dto.FileDetailTusFileAuthDto;
|
||||
import com.alist.api.core.modules.bespoke.fileDetail.dto.FileDetailTusFileListDto;
|
||||
import com.alist.api.core.modules.bespoke.fileDetail.dto.FileDetailTusFileViewDto;
|
||||
import com.alist.api.core.modules.bespoke.fileDetail.mapper.FileDetailTusFileMapper;
|
||||
import com.alist.api.core.modules.bespoke.fileDetail.vo.FileDetailTusFileListItemVo;
|
||||
import com.alist.api.core.modules.bespoke.fileDetail.vo.FileDetailTusFileViewVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class FileDetailTusFileService {
|
||||
private final FileDetailTusFileMapper fileDetailTusFileMapper;
|
||||
|
||||
public FileDetailTusFileService(FileDetailTusFileMapper fileDetailTusFileMapper) {
|
||||
this.fileDetailTusFileMapper = fileDetailTusFileMapper;
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public int fileDetailTusFileUploadAuthCount(FileDetailTusFileAuthDto fileDetailTusFileAuthDto) {
|
||||
return fileDetailTusFileMapper.fileDetailTusFileUploadAuthCount(fileDetailTusFileAuthDto);
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public FileDetailTusFileViewVo fileDetailTusFileMetaView(FileDetailTusFileViewDto fileDetailTusFileViewDto) {
|
||||
return fileDetailTusFileMapper.fileDetailTusFileMetaView(fileDetailTusFileViewDto);
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public FileDetailTusFileViewVo fileDetailTusFileMoveView(FileDetailTusFileViewDto fileDetailTusFileViewDto) {
|
||||
return fileDetailTusFileMapper.fileDetailTusFileMoveView(fileDetailTusFileViewDto);
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public FileDetailTusFileViewVo fileDetailTusFileUploadCancelView(FileDetailTusFileViewDto fileDetailTusFileViewDto) {
|
||||
return fileDetailTusFileMapper.fileDetailTusFileUploadCancelView(fileDetailTusFileViewDto);
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public List<FileDetailTusFileListItemVo> fileDetailTusFileList(FileDetailTusFileListDto fileDetailTusFileListDto) {
|
||||
return fileDetailTusFileMapper.fileDetailTusFileList(fileDetailTusFileListDto);
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public FileDetailTusFileViewVo fileDetailTusFileView(FileDetailTusFileViewDto fileDetailTusFileViewDto) {
|
||||
return fileDetailTusFileMapper.fileDetailTusFileView(fileDetailTusFileViewDto);
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public FileDetailTusFileViewVo fileDetailTusFileDeleteView(FileDetailTusFileViewDto fileDetailTusFileViewDto) {
|
||||
return fileDetailTusFileMapper.fileDetailTusFileDeleteView(fileDetailTusFileViewDto);
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.alist.api.core.modules.bespoke.fileDetail.vo;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class FileDetailTusFileListItemVo {
|
||||
private Long fileDetailIdx;
|
||||
private Long fileMasterIdx;
|
||||
private String fileUuid;
|
||||
private String originName;
|
||||
private String contentType;
|
||||
private Long sizeBytes;
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package com.alist.api.core.modules.bespoke.fileDetail.vo;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class FileDetailTusFileViewVo {
|
||||
private Long fileDetailIdx;
|
||||
private Long fileMasterIdx;
|
||||
private String fileUuid;
|
||||
private String originName;
|
||||
private String contentType;
|
||||
private Long sizeBytes;
|
||||
private Long uploadedBytes;
|
||||
private String tusUploadId;
|
||||
private String folderPath;
|
||||
private String saveName;
|
||||
private String savePath;
|
||||
private String ext;
|
||||
private String moveYn;
|
||||
private Integer moveTryCount;
|
||||
private Integer status;
|
||||
private Integer userIdx;
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.alist.api.core.modules.bespoke.fileMaster.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class FileMasterTusFileModifyDto {
|
||||
private String fileUuid;
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package com.alist.api.core.modules.bespoke.fileMaster.mapper;
|
||||
|
||||
import com.alist.api.core.modules.bespoke.fileMaster.dto.FileMasterTusFileModifyDto;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface FileMasterTusFileMapper {
|
||||
int fileMasterTusFileAggregateModify(FileMasterTusFileModifyDto fileMasterTusFileModifyDto);
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.alist.api.core.modules.bespoke.fileMaster.service;
|
||||
|
||||
import com.alist.api.core.modules.bespoke.fileMaster.dto.FileMasterTusFileModifyDto;
|
||||
import com.alist.api.core.modules.bespoke.fileMaster.mapper.FileMasterTusFileMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class FileMasterTusFileService {
|
||||
private final FileMasterTusFileMapper fileMasterTusFileMapper;
|
||||
|
||||
public FileMasterTusFileService(FileMasterTusFileMapper fileMasterTusFileMapper) {
|
||||
this.fileMasterTusFileMapper = fileMasterTusFileMapper;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public int fileMasterTusFileAggregateModify(FileMasterTusFileModifyDto fileMasterTusFileModifyDto) {
|
||||
return fileMasterTusFileMapper.fileMasterTusFileAggregateModify(fileMasterTusFileModifyDto);
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,12 +1,12 @@
|
||||
package com.alist.api.modules.admin.notice.dto;
|
||||
package com.alist.api.core.modules.bespoke.notice.dto;
|
||||
|
||||
import com.alist.api.common.paging.PageRequest;
|
||||
import com.alist.api.core.common.paging.PagingRequest;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class AdminNoticeListDto extends PageRequest {
|
||||
public class NoticeNoticeListDto extends PagingRequest {
|
||||
private String keyword;
|
||||
private String noticeType;
|
||||
private String targetScope;
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.alist.api.core.modules.bespoke.notice.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class NoticeNoticeViewDto {
|
||||
private Long noticeIdx;
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package com.alist.api.core.modules.bespoke.notice.mapper;
|
||||
|
||||
import com.alist.api.core.modules.bespoke.notice.dto.NoticeNoticeListDto;
|
||||
import com.alist.api.core.modules.bespoke.notice.dto.NoticeNoticeViewDto;
|
||||
import com.alist.api.core.modules.bespoke.notice.vo.NoticeNoticeCampusListItemVo;
|
||||
import com.alist.api.core.modules.bespoke.notice.vo.NoticeNoticeFileListItemVo;
|
||||
import com.alist.api.core.modules.bespoke.notice.vo.NoticeNoticeListItemVo;
|
||||
import com.alist.api.core.modules.bespoke.notice.vo.NoticeNoticeViewVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface NoticeNoticeMapper {
|
||||
int noticeNoticeListCount(NoticeNoticeListDto noticeNoticeListDto);
|
||||
|
||||
List<NoticeNoticeListItemVo> noticeNoticeList(NoticeNoticeListDto noticeNoticeListDto);
|
||||
|
||||
NoticeNoticeViewVo noticeNoticeView(NoticeNoticeViewDto noticeNoticeViewDto);
|
||||
|
||||
List<NoticeNoticeCampusListItemVo> noticeNoticeCampusList(NoticeNoticeViewDto noticeNoticeViewDto);
|
||||
|
||||
List<NoticeNoticeFileListItemVo> noticeNoticeFileList(NoticeNoticeViewDto noticeNoticeViewDto);
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
package com.alist.api.core.modules.bespoke.notice.service;
|
||||
|
||||
import com.alist.api.core.modules.bespoke.notice.dto.NoticeNoticeListDto;
|
||||
import com.alist.api.core.modules.bespoke.notice.dto.NoticeNoticeViewDto;
|
||||
import com.alist.api.core.modules.bespoke.notice.mapper.NoticeNoticeMapper;
|
||||
import com.alist.api.core.modules.bespoke.notice.vo.NoticeNoticeCampusListItemVo;
|
||||
import com.alist.api.core.modules.bespoke.notice.vo.NoticeNoticeFileListItemVo;
|
||||
import com.alist.api.core.modules.bespoke.notice.vo.NoticeNoticeListItemVo;
|
||||
import com.alist.api.core.modules.bespoke.notice.vo.NoticeNoticeViewVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class NoticeNoticeService {
|
||||
private final NoticeNoticeMapper noticeNoticeMapper;
|
||||
|
||||
public NoticeNoticeService(NoticeNoticeMapper noticeNoticeMapper) {
|
||||
this.noticeNoticeMapper = noticeNoticeMapper;
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public int noticeNoticeListCount(NoticeNoticeListDto noticeNoticeListDto) {
|
||||
return noticeNoticeMapper.noticeNoticeListCount(noticeNoticeListDto);
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public List<NoticeNoticeListItemVo> noticeNoticeList(NoticeNoticeListDto noticeNoticeListDto) {
|
||||
return noticeNoticeMapper.noticeNoticeList(noticeNoticeListDto);
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public NoticeNoticeViewVo noticeNoticeView(NoticeNoticeViewDto noticeNoticeViewDto) {
|
||||
return noticeNoticeMapper.noticeNoticeView(noticeNoticeViewDto);
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public List<NoticeNoticeCampusListItemVo> noticeNoticeCampusList(NoticeNoticeViewDto noticeNoticeViewDto) {
|
||||
return noticeNoticeMapper.noticeNoticeCampusList(noticeNoticeViewDto);
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public List<NoticeNoticeFileListItemVo> noticeNoticeFileList(NoticeNoticeViewDto noticeNoticeViewDto) {
|
||||
return noticeNoticeMapper.noticeNoticeFileList(noticeNoticeViewDto);
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.alist.api.core.modules.bespoke.notice.vo;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class NoticeNoticeCampusListItemVo {
|
||||
private Long noticeCampusIdx;
|
||||
private Long campusIdx;
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.alist.api.core.modules.bespoke.notice.vo;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class NoticeNoticeFileListItemVo {
|
||||
private Long noticeFileIdx;
|
||||
private Long noticeIdx;
|
||||
private String fileOriginalName;
|
||||
private String fileSaveName;
|
||||
private String filePath;
|
||||
private Long fileSize;
|
||||
private String fileExt;
|
||||
private Integer sortOrder;
|
||||
private LocalDateTime createDate;
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.alist.api.core.modules.bespoke.notice.vo;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class NoticeNoticeListItemVo {
|
||||
private Long noticeIdx;
|
||||
private String noticeType;
|
||||
private String targetScope;
|
||||
private String title;
|
||||
private String pinYn;
|
||||
private LocalDateTime startDate;
|
||||
private LocalDateTime endDate;
|
||||
private Integer viewCount;
|
||||
private String useYn;
|
||||
private LocalDateTime createDate;
|
||||
private LocalDateTime updateDate;
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.alist.api.core.modules.bespoke.notice.vo;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class NoticeNoticeViewVo {
|
||||
private Long noticeIdx;
|
||||
private String noticeType;
|
||||
private String targetScope;
|
||||
private String title;
|
||||
private String content;
|
||||
private String pinYn;
|
||||
private LocalDateTime startDate;
|
||||
private LocalDateTime endDate;
|
||||
private Integer viewCount;
|
||||
private String useYn;
|
||||
private LocalDateTime createDate;
|
||||
private Long createMember;
|
||||
private LocalDateTime updateDate;
|
||||
private Long updateMember;
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.alist.api.core.modules.bespoke.testUser.dto;
|
||||
|
||||
import com.alist.api.core.common.paging.PagingRequest;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class TestUserAdminMemberListDto extends PagingRequest {
|
||||
private String keyword;
|
||||
private String userRole;
|
||||
private String userType;
|
||||
private String dormantYn;
|
||||
private String withdrawStatus;
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.alist.api.core.modules.bespoke.testUser.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class TestUserAdminMemberViewDto {
|
||||
private Integer userIdx;
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.alist.api.core.modules.bespoke.testUser.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class TestUserLoginViewDto {
|
||||
private String id;
|
||||
private String userType;
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.alist.api.core.modules.bespoke.testUser.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class TestUserSsoLoginViewDto {
|
||||
private String id;
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.alist.api.core.modules.bespoke.testUser.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class TestUserUserPasswordViewDto {
|
||||
private Integer userTokenIdx;
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.alist.api.core.modules.bespoke.testUser.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class TestUserUserProfileViewDto {
|
||||
private Integer userTokenIdx;
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.alist.api.core.modules.bespoke.testUser.mapper;
|
||||
|
||||
import com.alist.api.core.modules.bespoke.testUser.dto.TestUserAdminMemberListDto;
|
||||
import com.alist.api.core.modules.bespoke.testUser.dto.TestUserAdminMemberViewDto;
|
||||
import com.alist.api.core.modules.bespoke.testUser.vo.TestUserAdminMemberListItemVo;
|
||||
import com.alist.api.core.modules.bespoke.testUser.vo.TestUserAdminMemberViewVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface TestUserAdminMemberMapper {
|
||||
int testUserAdminMemberCount(TestUserAdminMemberListDto testUserAdminMemberListDto);
|
||||
|
||||
List<TestUserAdminMemberListItemVo> testUserAdminMemberList(TestUserAdminMemberListDto testUserAdminMemberListDto);
|
||||
|
||||
TestUserAdminMemberViewVo testUserAdminMemberView(TestUserAdminMemberViewDto testUserAdminMemberViewDto);
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.alist.api.core.modules.bespoke.testUser.mapper;
|
||||
|
||||
import com.alist.api.core.modules.bespoke.testUser.dto.TestUserLoginViewDto;
|
||||
import com.alist.api.core.modules.bespoke.testUser.vo.TestUserLoginViewVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface TestUserAuthMapper {
|
||||
TestUserLoginViewVo testUserLoginView(TestUserLoginViewDto testUserLoginViewDto);
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.alist.api.core.modules.bespoke.testUser.mapper;
|
||||
|
||||
import com.alist.api.core.modules.bespoke.testUser.dto.TestUserSsoLoginViewDto;
|
||||
import com.alist.api.core.modules.bespoke.testUser.vo.TestUserSsoLoginViewVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface TestUserSsoMapper {
|
||||
TestUserSsoLoginViewVo testUserSsoLoginView(TestUserSsoLoginViewDto testUserSsoLoginViewDto);
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.alist.api.core.modules.bespoke.testUser.mapper;
|
||||
|
||||
import com.alist.api.core.modules.bespoke.testUser.dto.TestUserUserPasswordViewDto;
|
||||
import com.alist.api.core.modules.bespoke.testUser.dto.TestUserUserProfileViewDto;
|
||||
import com.alist.api.core.modules.bespoke.testUser.vo.TestUserUserPasswordViewVo;
|
||||
import com.alist.api.core.modules.bespoke.testUser.vo.TestUserUserProfileViewVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface TestUserUserMapper {
|
||||
TestUserUserPasswordViewVo testUserUserPasswordView(TestUserUserPasswordViewDto testUserUserPasswordViewDto);
|
||||
|
||||
TestUserUserProfileViewVo testUserUserProfileView(TestUserUserProfileViewDto testUserUserProfileViewDto);
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package com.alist.api.core.modules.bespoke.testUser.service;
|
||||
|
||||
import com.alist.api.core.modules.bespoke.testUser.dto.TestUserAdminMemberListDto;
|
||||
import com.alist.api.core.modules.bespoke.testUser.dto.TestUserAdminMemberViewDto;
|
||||
import com.alist.api.core.modules.bespoke.testUser.mapper.TestUserAdminMemberMapper;
|
||||
import com.alist.api.core.modules.bespoke.testUser.vo.TestUserAdminMemberListItemVo;
|
||||
import com.alist.api.core.modules.bespoke.testUser.vo.TestUserAdminMemberViewVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
@Service
|
||||
public class TestUserAdminMemberService {
|
||||
private final TestUserAdminMemberMapper testUserBackOfficeMapper;
|
||||
|
||||
public TestUserAdminMemberService(TestUserAdminMemberMapper testUserBackOfficeMapper) {
|
||||
this.testUserBackOfficeMapper = testUserBackOfficeMapper;
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public int testUserAdminMemberCount(TestUserAdminMemberListDto testUserAdminMemberListDto) {
|
||||
return testUserBackOfficeMapper.testUserAdminMemberCount(testUserAdminMemberListDto);
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public List<TestUserAdminMemberListItemVo> testUserAdminMemberList(TestUserAdminMemberListDto testUserAdminMemberListDto) {
|
||||
return testUserBackOfficeMapper.testUserAdminMemberList(testUserAdminMemberListDto);
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public TestUserAdminMemberViewVo testUserAdminMemberView(TestUserAdminMemberViewDto testUserAdminMemberViewDto) {
|
||||
return testUserBackOfficeMapper.testUserAdminMemberView(testUserAdminMemberViewDto);
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.alist.api.core.modules.bespoke.testUser.service;
|
||||
|
||||
import com.alist.api.core.modules.bespoke.testUser.dto.TestUserLoginViewDto;
|
||||
import com.alist.api.core.modules.bespoke.testUser.mapper.TestUserAuthMapper;
|
||||
import com.alist.api.core.modules.bespoke.testUser.vo.TestUserLoginViewVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class TestUserAuthService {
|
||||
private final TestUserAuthMapper testUserAuthMapper;
|
||||
|
||||
public TestUserAuthService(TestUserAuthMapper testUserAuthMapper) {
|
||||
this.testUserAuthMapper = testUserAuthMapper;
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public TestUserLoginViewVo testUserLoginView(TestUserLoginViewDto testUserLoginViewDto) {
|
||||
return testUserAuthMapper.testUserLoginView(testUserLoginViewDto);
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.alist.api.core.modules.bespoke.testUser.service;
|
||||
|
||||
import com.alist.api.core.modules.bespoke.testUser.dto.TestUserSsoLoginViewDto;
|
||||
import com.alist.api.core.modules.bespoke.testUser.mapper.TestUserSsoMapper;
|
||||
import com.alist.api.core.modules.bespoke.testUser.vo.TestUserSsoLoginViewVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class TestUserSsoService {
|
||||
private final TestUserSsoMapper testUserSsoMapper;
|
||||
|
||||
public TestUserSsoService(TestUserSsoMapper testUserSsoMapper) {
|
||||
this.testUserSsoMapper = testUserSsoMapper;
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public TestUserSsoLoginViewVo testUserSsoLoginView(TestUserSsoLoginViewDto testUserSsoLoginViewDto) {
|
||||
return testUserSsoMapper.testUserSsoLoginView(testUserSsoLoginViewDto);
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package com.alist.api.core.modules.bespoke.testUser.service;
|
||||
|
||||
import com.alist.api.core.modules.bespoke.testUser.dto.TestUserUserPasswordViewDto;
|
||||
import com.alist.api.core.modules.bespoke.testUser.dto.TestUserUserProfileViewDto;
|
||||
import com.alist.api.core.modules.bespoke.testUser.mapper.TestUserUserMapper;
|
||||
import com.alist.api.core.modules.bespoke.testUser.vo.TestUserUserPasswordViewVo;
|
||||
import com.alist.api.core.modules.bespoke.testUser.vo.TestUserUserProfileViewVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class TestUserUserService {
|
||||
private final TestUserUserMapper testUserUserMapper;
|
||||
|
||||
public TestUserUserService(TestUserUserMapper testUserUserMapper) {
|
||||
this.testUserUserMapper = testUserUserMapper;
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public TestUserUserPasswordViewVo testUserUserPasswordView(TestUserUserPasswordViewDto testUserUserPasswordViewDto) {
|
||||
return testUserUserMapper.testUserUserPasswordView(testUserUserPasswordViewDto);
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public TestUserUserProfileViewVo testUserUserProfileView(TestUserUserProfileViewDto testUserUserProfileViewDto) {
|
||||
return testUserUserMapper.testUserUserProfileView(testUserUserProfileViewDto);
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.alist.api.core.modules.bespoke.testUser.vo;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class TestUserAdminMemberListItemVo {
|
||||
private Integer userIdx;
|
||||
private Integer userTokenIdx;
|
||||
private String id;
|
||||
private String email;
|
||||
private String hp;
|
||||
private String userRole;
|
||||
private String userType;
|
||||
private String dormantYn;
|
||||
private LocalDateTime dormantAt;
|
||||
private String withdrawStatus;
|
||||
private LocalDateTime withdrawAt;
|
||||
private LocalDateTime createAt;
|
||||
private LocalDateTime updateAt;
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
package com.alist.api.core.modules.bespoke.testUser.vo;
|
||||
|
||||
public class TestUserAdminMemberViewVo extends TestUserAdminMemberListItemVo {
|
||||
}
|
||||
+4
-2
@@ -1,13 +1,15 @@
|
||||
package com.alist.api.modules.admin.member.dto;
|
||||
package com.alist.api.core.modules.bespoke.testUser.vo;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class AdminMemberAddDto {
|
||||
public class TestUserLoginViewVo {
|
||||
private Integer userIdx;
|
||||
private String id;
|
||||
private String password;
|
||||
private Integer userTokenIdx;
|
||||
private String userRole;
|
||||
private String userType;
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.alist.api.core.modules.bespoke.testUser.vo;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class TestUserSsoLoginViewVo {
|
||||
private Integer userIdx;
|
||||
private Integer userTokenIdx;
|
||||
private String id;
|
||||
private String password;
|
||||
private String userRole;
|
||||
private String userType;
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.alist.api.core.modules.bespoke.testUser.vo;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class TestUserUserPasswordViewVo {
|
||||
private Integer userIdx;
|
||||
private String password;
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.alist.api.core.modules.bespoke.testUser.vo;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class TestUserUserProfileViewVo {
|
||||
private Integer userIdx;
|
||||
private String id;
|
||||
private String email;
|
||||
private String hp;
|
||||
private String userRole;
|
||||
private String userType;
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.alist.api.core.modules.bespoke.testUserToken.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class TestUserTokenApiKeyLoginViewDto {
|
||||
private String userApiKey;
|
||||
private String userType;
|
||||
private List<String> userTypes;
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.alist.api.core.modules.bespoke.testUserToken.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class TestUserTokenLoginCheckedViewDto {
|
||||
private Integer userTokenIdx;
|
||||
private String userType;
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.alist.api.core.modules.bespoke.testUserToken.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class TestUserTokenRefreshViewDto {
|
||||
private Integer userTokenIdx;
|
||||
private String userType;
|
||||
private List<String> userTypes;
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.alist.api.core.modules.bespoke.testUserToken.mapper;
|
||||
|
||||
import com.alist.api.core.modules.bespoke.testUserToken.dto.TestUserTokenApiKeyLoginViewDto;
|
||||
import com.alist.api.core.modules.bespoke.testUserToken.dto.TestUserTokenLoginCheckedViewDto;
|
||||
import com.alist.api.core.modules.bespoke.testUserToken.dto.TestUserTokenRefreshViewDto;
|
||||
import com.alist.api.core.modules.bespoke.testUserToken.vo.TestUserTokenApiKeyLoginViewVo;
|
||||
import com.alist.api.core.modules.bespoke.testUserToken.vo.TestUserTokenLoginCheckedViewVo;
|
||||
import com.alist.api.core.modules.bespoke.testUserToken.vo.TestUserTokenRefreshViewVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface TestUserTokenAuthMapper {
|
||||
TestUserTokenApiKeyLoginViewVo testUserTokenApiKeyLoginView(TestUserTokenApiKeyLoginViewDto testUserTokenApiKeyLoginViewDto);
|
||||
|
||||
TestUserTokenLoginCheckedViewVo testUserTokenLoginCheckedView(TestUserTokenLoginCheckedViewDto testUserTokenLoginCheckedViewDto);
|
||||
|
||||
TestUserTokenRefreshViewVo testUserTokenRefreshView(TestUserTokenRefreshViewDto testUserTokenRefreshViewDto);
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package com.alist.api.core.modules.bespoke.testUserToken.service;
|
||||
|
||||
import com.alist.api.core.modules.bespoke.testUserToken.dto.TestUserTokenApiKeyLoginViewDto;
|
||||
import com.alist.api.core.modules.bespoke.testUserToken.dto.TestUserTokenLoginCheckedViewDto;
|
||||
import com.alist.api.core.modules.bespoke.testUserToken.dto.TestUserTokenRefreshViewDto;
|
||||
import com.alist.api.core.modules.bespoke.testUserToken.mapper.TestUserTokenAuthMapper;
|
||||
import com.alist.api.core.modules.bespoke.testUserToken.vo.TestUserTokenApiKeyLoginViewVo;
|
||||
import com.alist.api.core.modules.bespoke.testUserToken.vo.TestUserTokenLoginCheckedViewVo;
|
||||
import com.alist.api.core.modules.bespoke.testUserToken.vo.TestUserTokenRefreshViewVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class TestUserTokenAuthService {
|
||||
private final TestUserTokenAuthMapper testUserTokenAuthMapper;
|
||||
|
||||
public TestUserTokenAuthService(TestUserTokenAuthMapper testUserTokenAuthMapper) {
|
||||
this.testUserTokenAuthMapper = testUserTokenAuthMapper;
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public TestUserTokenApiKeyLoginViewVo testUserTokenApiKeyLoginView(TestUserTokenApiKeyLoginViewDto testUserTokenApiKeyLoginViewDto) {
|
||||
return testUserTokenAuthMapper.testUserTokenApiKeyLoginView(testUserTokenApiKeyLoginViewDto);
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public TestUserTokenLoginCheckedViewVo testUserTokenLoginCheckedView(TestUserTokenLoginCheckedViewDto testUserTokenLoginCheckedViewDto) {
|
||||
return testUserTokenAuthMapper.testUserTokenLoginCheckedView(testUserTokenLoginCheckedViewDto);
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public TestUserTokenRefreshViewVo testUserTokenRefreshView(TestUserTokenRefreshViewDto testUserTokenRefreshViewDto) {
|
||||
return testUserTokenAuthMapper.testUserTokenRefreshView(testUserTokenRefreshViewDto);
|
||||
}
|
||||
}
|
||||
+6
-7
@@ -1,15 +1,14 @@
|
||||
package com.alist.api.modules.front.user.dto;
|
||||
package com.alist.api.core.modules.bespoke.testUserToken.vo;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
public class UserTokenDto {
|
||||
private Integer userTokenIdx;
|
||||
@Setter
|
||||
public class TestUserTokenApiKeyLoginViewVo {
|
||||
private Integer userIdx;
|
||||
private String userApiKey;
|
||||
private String id;
|
||||
private Integer userTokenIdx;
|
||||
private String userRole;
|
||||
private String userType;
|
||||
private int resultCode;
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.alist.api.core.modules.bespoke.testUserToken.vo;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class TestUserTokenLoginCheckedViewVo {
|
||||
private Integer userIdx;
|
||||
private String id;
|
||||
private Integer userTokenIdx;
|
||||
private String userRole;
|
||||
private String userType;
|
||||
}
|
||||
+4
-11
@@ -1,22 +1,15 @@
|
||||
package com.alist.api.modules.front.auth.vo;
|
||||
package com.alist.api.core.modules.bespoke.testUserToken.vo;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class LoginVo {
|
||||
public class TestUserTokenRefreshViewVo {
|
||||
private Integer userIdx;
|
||||
private String id;
|
||||
private String password;
|
||||
|
||||
private String accessToken;
|
||||
private String refreshToken;
|
||||
private Integer userTokenIdx;
|
||||
private String refreshToken;
|
||||
private String userRole;
|
||||
private String userType;
|
||||
private Instant expiresAt;
|
||||
private int resultCode;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
package com.alist.api.modules.migration.alist.user.dto;
|
||||
package com.alist.api.core.modules.migration.alist.user.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class AlistUserDto {
|
||||
public class AlistUserMigrationDto {
|
||||
private String id;
|
||||
private String password;
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package com.alist.api.core.modules.migration.alist.user.mapper;
|
||||
|
||||
import com.alist.api.core.modules.migration.alist.user.dto.AlistUserMigrationDto;
|
||||
import com.alist.api.core.modules.migration.alist.user.vo.AlistUserMigrationVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface AlistUserMigrationMapper {
|
||||
List<AlistUserMigrationVo> selectAlistUserMigrationList(AlistUserMigrationDto alistUserMigrationDto);
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.alist.api.core.modules.migration.alist.user.service;
|
||||
|
||||
import com.alist.api.core.modules.migration.alist.user.dto.AlistUserMigrationDto;
|
||||
import com.alist.api.core.modules.migration.alist.user.mapper.AlistUserMigrationMapper;
|
||||
import com.alist.api.core.modules.migration.alist.user.vo.AlistUserMigrationVo;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@ConditionalOnProperty(
|
||||
prefix = "migration.datasource.alist",
|
||||
name = "enabled",
|
||||
havingValue = "true"
|
||||
)
|
||||
public class AlistUserMigrationService {
|
||||
private final AlistUserMigrationMapper alistUserMigrationMapper;
|
||||
|
||||
public AlistUserMigrationService(AlistUserMigrationMapper alistUserMigrationMapper) {
|
||||
this.alistUserMigrationMapper = alistUserMigrationMapper;
|
||||
}
|
||||
|
||||
public List<AlistUserMigrationVo> selectAlistUserMigrationList(AlistUserMigrationDto alistUserMigrationDto) {
|
||||
return alistUserMigrationMapper.selectAlistUserMigrationList(alistUserMigrationDto);
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.alist.api.core.modules.migration.alist.user.vo;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class AlistUserMigrationVo {
|
||||
private String id;
|
||||
private String name;
|
||||
private String hp;
|
||||
private String email;
|
||||
private String type;
|
||||
private String joinDate;
|
||||
}
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
package com.alist.api.modules.migration.eltown.user.dto;
|
||||
package com.alist.api.core.modules.migration.eltown.user.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class EltownUserDto {
|
||||
public class EltownUserMigrationDto {
|
||||
private String id;
|
||||
private String password;
|
||||
private String md5Password;
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package com.alist.api.core.modules.migration.eltown.user.mapper;
|
||||
|
||||
import com.alist.api.core.modules.migration.eltown.user.dto.EltownUserMigrationDto;
|
||||
import com.alist.api.core.modules.migration.eltown.user.vo.EltownUserMigrationVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface EltownUserMigrationMapper {
|
||||
List<EltownUserMigrationVo> selectEltownUserMigrationList(EltownUserMigrationDto eltownUserMigrationDto);
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.alist.api.core.modules.migration.eltown.user.service;
|
||||
|
||||
import com.alist.api.core.common.utils.HashUtils;
|
||||
import com.alist.api.core.modules.migration.eltown.user.dto.EltownUserMigrationDto;
|
||||
import com.alist.api.core.modules.migration.eltown.user.mapper.EltownUserMigrationMapper;
|
||||
import com.alist.api.core.modules.migration.eltown.user.vo.EltownUserMigrationVo;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@ConditionalOnProperty(
|
||||
prefix = "migration.datasource.eltown",
|
||||
name = "enabled",
|
||||
havingValue = "true"
|
||||
)
|
||||
public class EltownUserMigrationService {
|
||||
private final EltownUserMigrationMapper eltownUserMigrationMapper;
|
||||
|
||||
public EltownUserMigrationService(EltownUserMigrationMapper eltownUserMigrationMapper) {
|
||||
this.eltownUserMigrationMapper = eltownUserMigrationMapper;
|
||||
}
|
||||
|
||||
public List<EltownUserMigrationVo> selectEltownUserMigrationList(EltownUserMigrationDto eltownUserMigrationDto) {
|
||||
eltownUserMigrationDto.setMd5Password(HashUtils.md5(eltownUserMigrationDto.getPassword()));
|
||||
|
||||
return eltownUserMigrationMapper.selectEltownUserMigrationList(eltownUserMigrationDto);
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.alist.api.core.modules.migration.eltown.user.vo;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class EltownUserMigrationVo {
|
||||
private String id;
|
||||
private String name;
|
||||
private String hp;
|
||||
private String email;
|
||||
private String type;
|
||||
private String joinDate;
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.alist.api.core.modules.standard.alCalendar.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class AlCalendarAddDto {
|
||||
private String yyyymmdd;
|
||||
private String yyyy;
|
||||
private String mm;
|
||||
private String dd;
|
||||
private Short weekNo;
|
||||
private String weekNm;
|
||||
private String holidayYn;
|
||||
private String holidayNm;
|
||||
private LocalDate formatDate;
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.alist.api.core.modules.standard.alCalendar.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class AlCalendarDeleteDto {
|
||||
private String yyyymmdd;
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.alist.api.core.modules.standard.alCalendar.dto;
|
||||
|
||||
import com.alist.api.core.common.paging.PagingRequest;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class AlCalendarListDto extends PagingRequest {
|
||||
private String yyyymmdd;
|
||||
private String yyyy;
|
||||
private String mm;
|
||||
private String holidayYn;
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package com.alist.api.core.modules.standard.alCalendar.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class AlCalendarModifyDto {
|
||||
private String yyyymmdd;
|
||||
private String yyyy;
|
||||
private String mm;
|
||||
private String dd;
|
||||
private Short weekNo;
|
||||
private String weekNm;
|
||||
private String holidayYn;
|
||||
private String holidayNm;
|
||||
private LocalDate formatDate;
|
||||
|
||||
public boolean hasModifyValue() {
|
||||
return yyyy != null
|
||||
|| mm != null
|
||||
|| dd != null
|
||||
|| weekNo != null
|
||||
|| weekNm != null
|
||||
|| holidayYn != null
|
||||
|| holidayNm != null
|
||||
|| formatDate != null;
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.alist.api.core.modules.standard.alCalendar.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class AlCalendarViewDto {
|
||||
private String yyyymmdd;
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.alist.api.core.modules.standard.alCalendar.mapper;
|
||||
|
||||
import com.alist.api.core.modules.standard.alCalendar.dto.AlCalendarAddDto;
|
||||
import com.alist.api.core.modules.standard.alCalendar.dto.AlCalendarDeleteDto;
|
||||
import com.alist.api.core.modules.standard.alCalendar.dto.AlCalendarListDto;
|
||||
import com.alist.api.core.modules.standard.alCalendar.dto.AlCalendarModifyDto;
|
||||
import com.alist.api.core.modules.standard.alCalendar.dto.AlCalendarViewDto;
|
||||
import com.alist.api.core.modules.standard.alCalendar.vo.AlCalendarListItemVo;
|
||||
import com.alist.api.core.modules.standard.alCalendar.vo.AlCalendarViewVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface AlCalendarMapper {
|
||||
int selectAlCalendarListCount(AlCalendarListDto alCalendarListDto);
|
||||
|
||||
List<AlCalendarListItemVo> selectAlCalendarList(AlCalendarListDto alCalendarListDto);
|
||||
|
||||
AlCalendarViewVo selectAlCalendarView(AlCalendarViewDto alCalendarViewDto);
|
||||
|
||||
int insertAlCalendarAdd(AlCalendarAddDto alCalendarAddDto);
|
||||
|
||||
int updateAlCalendarModify(AlCalendarModifyDto alCalendarModifyDto);
|
||||
|
||||
int deleteAlCalendarDelete(AlCalendarDeleteDto alCalendarDeleteDto);
|
||||
}
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
package com.alist.api.core.modules.standard.alCalendar.service;
|
||||
|
||||
import com.alist.api.core.modules.standard.alCalendar.dto.AlCalendarAddDto;
|
||||
import com.alist.api.core.modules.standard.alCalendar.dto.AlCalendarDeleteDto;
|
||||
import com.alist.api.core.modules.standard.alCalendar.dto.AlCalendarListDto;
|
||||
import com.alist.api.core.modules.standard.alCalendar.dto.AlCalendarModifyDto;
|
||||
import com.alist.api.core.modules.standard.alCalendar.dto.AlCalendarViewDto;
|
||||
import com.alist.api.core.modules.standard.alCalendar.mapper.AlCalendarMapper;
|
||||
import com.alist.api.core.modules.standard.alCalendar.vo.AlCalendarAddVo;
|
||||
import com.alist.api.core.modules.standard.alCalendar.vo.AlCalendarDeleteVo;
|
||||
import com.alist.api.core.modules.standard.alCalendar.vo.AlCalendarListVo;
|
||||
import com.alist.api.core.modules.standard.alCalendar.vo.AlCalendarModifyVo;
|
||||
import com.alist.api.core.modules.standard.alCalendar.vo.AlCalendarViewVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class AlCalendarService {
|
||||
private final AlCalendarMapper alCalendarMapper;
|
||||
|
||||
public AlCalendarService(AlCalendarMapper alCalendarMapper) {
|
||||
this.alCalendarMapper = alCalendarMapper;
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public AlCalendarListVo selectAlCalendarList(AlCalendarListDto alCalendarListDto) {
|
||||
int totalCount = alCalendarMapper.selectAlCalendarListCount(alCalendarListDto);
|
||||
|
||||
AlCalendarListVo alCalendarListVo = new AlCalendarListVo();
|
||||
alCalendarListVo.setAlCalendarList(alCalendarMapper.selectAlCalendarList(alCalendarListDto));
|
||||
alCalendarListVo.setPaging(alCalendarListDto, totalCount);
|
||||
|
||||
return alCalendarListVo;
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public AlCalendarViewVo selectAlCalendarView(AlCalendarViewDto alCalendarViewDto) {
|
||||
return alCalendarMapper.selectAlCalendarView(alCalendarViewDto);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public AlCalendarAddVo insertAlCalendarAdd(AlCalendarAddDto alCalendarAddDto) {
|
||||
int insertCount = alCalendarMapper.insertAlCalendarAdd(alCalendarAddDto);
|
||||
|
||||
AlCalendarAddVo alCalendarAddVo = new AlCalendarAddVo();
|
||||
alCalendarAddVo.setAdded(insertCount > 0);
|
||||
alCalendarAddVo.setYyyymmdd(alCalendarAddDto.getYyyymmdd());
|
||||
alCalendarAddVo.setResultCode(insertCount > 0 ? 2002 : 500);
|
||||
|
||||
return alCalendarAddVo;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public AlCalendarModifyVo updateAlCalendarModify(AlCalendarModifyDto alCalendarModifyDto) {
|
||||
AlCalendarModifyVo alCalendarModifyVo = new AlCalendarModifyVo();
|
||||
alCalendarModifyVo.setYyyymmdd(alCalendarModifyDto.getYyyymmdd());
|
||||
|
||||
if (!alCalendarModifyDto.hasModifyValue()) {
|
||||
alCalendarModifyVo.setUpdated(false);
|
||||
alCalendarModifyVo.setResultCode(4001);
|
||||
return alCalendarModifyVo;
|
||||
}
|
||||
|
||||
int updateCount = alCalendarMapper.updateAlCalendarModify(alCalendarModifyDto);
|
||||
alCalendarModifyVo.setUpdated(updateCount > 0);
|
||||
alCalendarModifyVo.setResultCode(updateCount > 0 ? 2005 : 2003);
|
||||
|
||||
return alCalendarModifyVo;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public AlCalendarDeleteVo deleteAlCalendarDelete(AlCalendarDeleteDto alCalendarDeleteDto) {
|
||||
int deleteCount = alCalendarMapper.deleteAlCalendarDelete(alCalendarDeleteDto);
|
||||
|
||||
AlCalendarDeleteVo alCalendarDeleteVo = new AlCalendarDeleteVo();
|
||||
alCalendarDeleteVo.setDeleted(deleteCount > 0);
|
||||
alCalendarDeleteVo.setYyyymmdd(alCalendarDeleteDto.getYyyymmdd());
|
||||
alCalendarDeleteVo.setResultCode(deleteCount > 0 ? 2005 : 2003);
|
||||
|
||||
return alCalendarDeleteVo;
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.alist.api.core.modules.standard.alCalendar.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class AlCalendarAddVo {
|
||||
private boolean added;
|
||||
private String yyyymmdd;
|
||||
@JsonIgnore
|
||||
private Integer resultCode;
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.alist.api.core.modules.standard.alCalendar.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class AlCalendarDeleteVo {
|
||||
private boolean deleted;
|
||||
private String yyyymmdd;
|
||||
@JsonIgnore
|
||||
private Integer resultCode;
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.alist.api.core.modules.standard.alCalendar.vo;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class AlCalendarListItemVo {
|
||||
private String yyyymmdd;
|
||||
private String yyyy;
|
||||
private String mm;
|
||||
private String dd;
|
||||
private Short weekNo;
|
||||
private String weekNm;
|
||||
private String holidayYn;
|
||||
private String holidayNm;
|
||||
private LocalDate formatDate;
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package com.alist.api.core.modules.standard.alCalendar.vo;
|
||||
|
||||
import com.alist.api.core.common.paging.PagingResponse;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class AlCalendarListVo extends PagingResponse {
|
||||
private List<AlCalendarListItemVo> alCalendarList;
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.alist.api.core.modules.standard.alCalendar.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class AlCalendarModifyVo {
|
||||
private boolean updated;
|
||||
private String yyyymmdd;
|
||||
@JsonIgnore
|
||||
private Integer resultCode;
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.alist.api.core.modules.standard.alCalendar.vo;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class AlCalendarViewVo {
|
||||
private String yyyymmdd;
|
||||
private String yyyy;
|
||||
private String mm;
|
||||
private String dd;
|
||||
private Short weekNo;
|
||||
private String weekNm;
|
||||
private String holidayYn;
|
||||
private String holidayNm;
|
||||
private LocalDate formatDate;
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package com.alist.api.core.modules.standard.fileDetail.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class FileDetailAddDto {
|
||||
private Long fileDetailIdx;
|
||||
private Long fileMasterIdx;
|
||||
private Integer fileSeq;
|
||||
private String fileUuid;
|
||||
private String itemKey;
|
||||
private String originName;
|
||||
private String saveName;
|
||||
private String savePath;
|
||||
private String contentType;
|
||||
private String ext;
|
||||
private Long sizeBytes;
|
||||
private Long uploadedBytes;
|
||||
private String tusUploadId;
|
||||
private LocalDateTime uploadTokenExpireAt;
|
||||
private String checksumSha256;
|
||||
private String moveYn;
|
||||
private Integer moveTryCount;
|
||||
private String moveLastError;
|
||||
private LocalDateTime moveLockAt;
|
||||
private LocalDateTime moveDate;
|
||||
private String moveLockOwner;
|
||||
private Short status;
|
||||
private Integer createMember;
|
||||
private Integer updateMember;
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.alist.api.core.modules.standard.fileDetail.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class FileDetailDeleteDto {
|
||||
private Long fileDetailIdx;
|
||||
private Integer updateMember;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user