회원가입 추가, 역할 추가, spotlessApply 실행

This commit is contained in:
2025-12-02 18:27:12 +09:00
parent 2377f471d2
commit 7153497016
35 changed files with 1293 additions and 259 deletions

View File

@@ -10,30 +10,18 @@ import com.kamco.cd.kamcoback.mapsheet.dto.FileDto.SrchFoldersDto;
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
import com.kamco.cd.kamcoback.mapsheet.service.MapSheetMngService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@Tag(name = "영상 관리", description = "영상 관리 API")
@@ -59,44 +47,38 @@ public class MapSheetMngApiController {
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
})
@PostMapping("/getFolders")
public ApiResponseDto<List<FileDto.FolderDto>> getDir(
@RequestBody SrchFoldersDto srchDto
) {
public ApiResponseDto<List<FileDto.FolderDto>> getDir(@RequestBody SrchFoldersDto srchDto) {
return ApiResponseDto.createOK(mapSheetMngService.getFolderAll(srchDto));
}
@Operation(summary = "파일목록 조회", description = "파일목록 조회")
@ApiResponses(
value = {
@ApiResponse(
responseCode = "200",
description = "조회 성공",
content =
@Content(
mediaType = "application/json",
schema = @Schema(implementation = CommonCodeDto.Basic.class))),
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
})
value = {
@ApiResponse(
responseCode = "200",
description = "조회 성공",
content =
@Content(
mediaType = "application/json",
schema = @Schema(implementation = CommonCodeDto.Basic.class))),
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
})
@PostMapping("/getFiles")
public ApiResponseDto<FilesDto> getFiles(
@RequestBody SrchFilesDto srchDto
) {
public ApiResponseDto<FilesDto> getFiles(@RequestBody SrchFilesDto srchDto) {
return ApiResponseDto.createOK(mapSheetMngService.getFilesAll(srchDto));
}
/**
* 오류데이터 목록 조회
*
* @param searchReq
* @return
*/
@PostMapping("/error-list")
public ApiResponseDto<Page<MapSheetMngDto.ErrorDataDto>> findMapSheetErrorList(
@RequestBody
@Valid
MapSheetMngDto.searchReq searchReq
){
@RequestBody @Valid MapSheetMngDto.searchReq searchReq) {
return ApiResponseDto.ok(mapSheetMngService.findMapSheetErrorList(searchReq));
}
}

View File

@@ -2,17 +2,14 @@ package com.kamco.cd.kamcoback.mapsheet.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
public class FileDto {
@Getter
@Setter
@NoArgsConstructor
@@ -45,14 +42,13 @@ public class FileDto {
private final String lastModified;
public FolderDto(
String folderNm,
String parentFolderNm,
String parentPath,
String fullPath,
int depth,
long childCnt,
String lastModified
) {
String folderNm,
String parentFolderNm,
String parentPath,
String fullPath,
int depth,
long childCnt,
String lastModified) {
this.folderNm = folderNm;
this.parentFolderNm = parentFolderNm;
this.parentPath = parentPath;
@@ -61,7 +57,6 @@ public class FileDto {
this.childCnt = childCnt;
this.lastModified = lastModified;
}
}
@Schema(name = "File Basic", description = "파일 기본 정보")
@@ -75,12 +70,7 @@ public class FileDto {
private final String lastModified;
public Basic(
String fileNm,
String filePath,
String extension,
long fileSize,
String lastModified
) {
String fileNm, String filePath, String extension, long fileSize, String lastModified) {
this.fileNm = fileNm;
this.filePath = filePath;
this.extension = extension;
@@ -97,19 +87,12 @@ public class FileDto {
private final long fileTotSize;
private final List<Basic> files;
public FilesDto(
String dirPath,
int fileTotCnt,
long fileTotSize,
List<Basic> files
public FilesDto(String dirPath, int fileTotCnt, long fileTotSize, List<Basic> files) {
) {
this.dirPath = dirPath;
this.fileTotCnt = fileTotCnt;
this.fileTotSize = fileTotSize;
this.files = files;
}
}
}

View File

@@ -10,8 +10,6 @@ import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import java.time.ZonedDateTime;
public class MapSheetMngDto {
@Schema(name = "searchReq", description = "영상관리 오류데이터 검색 요청")
@@ -33,7 +31,7 @@ public class MapSheetMngDto {
String[] sortParams = sort.split(",");
String property = sortParams[0];
Sort.Direction direction =
sortParams.length > 1 ? Sort.Direction.fromString(sortParams[1]) : Sort.Direction.ASC;
sortParams.length > 1 ? Sort.Direction.fromString(sortParams[1]) : Sort.Direction.ASC;
return PageRequest.of(page, size, Sort.by(direction, property));
}
return PageRequest.of(page, size);
@@ -45,7 +43,7 @@ public class MapSheetMngDto {
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class ErrorDataDto{
public static class ErrorDataDto {
private Long hstUid;
private Integer rowNum;
private String map50kName;

View File

@@ -5,6 +5,9 @@ import com.kamco.cd.kamcoback.mapsheet.dto.FileDto.FilesDto;
import com.kamco.cd.kamcoback.mapsheet.dto.FileDto.FolderDto;
import com.kamco.cd.kamcoback.mapsheet.dto.FileDto.SrchFilesDto;
import com.kamco.cd.kamcoback.mapsheet.dto.FileDto.SrchFoldersDto;
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
import com.kamco.cd.kamcoback.postgres.core.MapSheetMngCoreService;
import jakarta.validation.Valid;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
@@ -19,10 +22,6 @@ import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
import com.kamco.cd.kamcoback.postgres.core.MapSheetMngCoreService;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.apache.commons.io.FilenameUtils;
import org.springframework.data.domain.Page;
@@ -46,68 +45,66 @@ public class MapSheetMngService {
List<FolderDto> folderDtoList = List.of();
SimpleDateFormat dttmFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try (Stream<Path> stream = Files.walk(startPath, maxDepth)) {
folderDtoList = stream
// 1. 디렉토리만 필터링
.filter(Files::isDirectory)
.filter(p -> !p.toString().equals(dirPath))
.map(path -> {
folderDtoList =
stream
// 1. 디렉토리만 필터링
.filter(Files::isDirectory)
.filter(p -> !p.toString().equals(dirPath))
.map(
path -> {
int depth = path.getNameCount();
int depth = path.getNameCount();
String folderNm = path.getFileName().toString();
String parentFolderNm = path.getParent().getFileName().toString();
String parentPath = path.getParent().toString();
String fullPath = path.toAbsolutePath().toString();
String folderNm = path.getFileName().toString();
String parentFolderNm = path.getParent().getFileName().toString();
String parentPath = path.getParent().toString();
String fullPath = path.toAbsolutePath().toString();
File directory = new File(fullPath);
File[] childFolders = directory.listFiles(File::isDirectory);
File directory = new File(fullPath);
File[] childFolders = directory.listFiles(File::isDirectory);
long childCnt = 0;
if (childFolders != null) {
childCnt = childFolders.length;
}
long childCnt = 0;
if (childFolders != null) {
childCnt = childFolders.length;
}
FileTime time = null;
try {
time = Files.getLastModifiedTime(path);
} catch (IOException e) {
throw new RuntimeException(e);
}
FileTime time = null;
try {
time = Files.getLastModifiedTime(path);
} catch (IOException e) {
throw new RuntimeException(e);
}
String lastModified = dttmFormat.format(new Date(time.toMillis()));
String lastModified = dttmFormat.format(new Date(time.toMillis()));
FolderDto folderDto =
new FolderDto(
folderNm,
parentFolderNm,
parentPath,
fullPath,
depth,
childCnt,
lastModified);
return folderDto;
})
.collect(Collectors.toList());
FolderDto folderDto = new FolderDto(
folderNm,
parentFolderNm,
parentPath,
fullPath,
depth,
childCnt,
lastModified
);
return folderDto;
})
.collect(Collectors.toList());
folderDtoList.sort(Comparator.comparing(
FolderDto::getFolderNm,
String.CASE_INSENSITIVE_ORDER // 대소문자 구분 없이
).reversed());
folderDtoList.sort(
Comparator.comparing(
FolderDto::getFolderNm, String.CASE_INSENSITIVE_ORDER // 대소문자 구분 없이
)
.reversed());
} catch (IOException e) {
throw new RuntimeException(e);
}
return folderDtoList;
}
public FilesDto getFilesAll(SrchFilesDto srchDto) {
String dirPath = srchDto.getDirPath();
@@ -125,22 +122,20 @@ public class MapSheetMngService {
int fileTotCnt = 0;
long fileTotSize = 0;
if( fileList != null )
{
if( sortType.equals("name")){
if (fileList != null) {
if (sortType.equals("name")) {
Arrays.sort(fileList);
}
else if( sortType.equals("date")){
} else if (sortType.equals("date")) {
Arrays.sort(fileList, Comparator.comparingLong(File::lastModified));
}
for (File file : fileList) {
if (file.isFile() ) { // 파일인 경우만
if( extension.equals("*") || file.getName().endsWith("."+extension) ) {
if (file.isFile()) { // 파일인 경우만
if (extension.equals("*") || file.getName().endsWith("." + extension)) {
fileListPos = fileListPos + 1;
if( startPos <= fileListPos && endPos >= fileListPos ) {
if (startPos <= fileListPos && endPos >= fileListPos) {
// 생성자를 통해 객체를 만들고 리스트에 추가
String fileName = file.getName();
@@ -153,28 +148,19 @@ public class MapSheetMngService {
fileTotCnt = fileTotCnt + 1;
fileTotSize = fileTotSize + fileSize;
}
}
}
}
}
FilesDto filesDto = new FilesDto(
dirPath,
fileTotCnt,
fileTotSize,
files);
FilesDto filesDto = new FilesDto(dirPath, fileTotCnt, fileTotSize, files);
return filesDto;
}
public Page<MapSheetMngDto.ErrorDataDto> findMapSheetErrorList(MapSheetMngDto.@Valid searchReq searchReq) {
public Page<MapSheetMngDto.ErrorDataDto> findMapSheetErrorList(
MapSheetMngDto.@Valid searchReq searchReq) {
return mapSheetMngCoreService.findMapSheetErrorList(searchReq);
}
}