Merge pull request 'feat/dev_251201' (#78) from feat/dev_251201 into develop
Reviewed-on: https://kamco.gitea.gs.dabeeo.com/dabeeo/kamco-dabeeo-backoffice/pulls/78
This commit is contained in:
@@ -22,6 +22,7 @@ import java.util.Comparator;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.function.Predicate;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@@ -290,11 +291,13 @@ public class FIleChecker {
|
|||||||
int maxDepth,
|
int maxDepth,
|
||||||
String sortType,
|
String sortType,
|
||||||
int startPos,
|
int startPos,
|
||||||
int limit) {
|
int endPos) {
|
||||||
|
|
||||||
Path startPath = Paths.get(dir);
|
Path startPath = Paths.get(dir);
|
||||||
String dirPath = dir;
|
String dirPath = dir;
|
||||||
|
|
||||||
|
int limit = endPos - startPos + 1;
|
||||||
|
|
||||||
Set<String> targetExtensions = createExtensionSet(extension);
|
Set<String> targetExtensions = createExtensionSet(extension);
|
||||||
|
|
||||||
List<Basic> fileList = new ArrayList<>();
|
List<Basic> fileList = new ArrayList<>();
|
||||||
@@ -303,6 +306,16 @@ public class FIleChecker {
|
|||||||
// int fileTotCnt = 0;
|
// int fileTotCnt = 0;
|
||||||
// long fileTotSize = 0;
|
// long fileTotSize = 0;
|
||||||
|
|
||||||
|
Predicate<Path> isTarget =
|
||||||
|
p -> {
|
||||||
|
if (targetFileNm == null
|
||||||
|
|| targetFileNm.trim().isEmpty()
|
||||||
|
|| targetFileNm.trim().equals("*")) {
|
||||||
|
return true; // 전체 파일 허용
|
||||||
|
}
|
||||||
|
return p.getFileName().toString().contains(targetFileNm);
|
||||||
|
};
|
||||||
|
|
||||||
try (Stream<Path> stream = Files.walk(startPath, maxDepth)) {
|
try (Stream<Path> stream = Files.walk(startPath, maxDepth)) {
|
||||||
|
|
||||||
fileList =
|
fileList =
|
||||||
@@ -315,7 +328,7 @@ public class FIleChecker {
|
|||||||
|| extension.equals("*")
|
|| extension.equals("*")
|
||||||
|| targetExtensions.contains(extractExtension(p)))
|
|| targetExtensions.contains(extractExtension(p)))
|
||||||
.sorted(getFileComparator(sortType))
|
.sorted(getFileComparator(sortType))
|
||||||
.filter(p -> p.getFileName().toString().contains(targetFileNm))
|
.filter(isTarget)
|
||||||
.skip(startPos)
|
.skip(startPos)
|
||||||
.limit(limit)
|
.limit(limit)
|
||||||
.map(
|
.map(
|
||||||
@@ -344,6 +357,16 @@ public class FIleChecker {
|
|||||||
return fileList;
|
return fileList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Long getFileTotSize(List<FIleChecker.Basic> files) {
|
||||||
|
|
||||||
|
Long fileTotSize = 0L;
|
||||||
|
if (files != null || files.size() > 0) {
|
||||||
|
fileTotSize = files.stream().mapToLong(FIleChecker.Basic::getFileSize).sum();
|
||||||
|
}
|
||||||
|
|
||||||
|
return fileTotSize;
|
||||||
|
}
|
||||||
|
|
||||||
public static Set<String> createExtensionSet(String extensionString) {
|
public static Set<String> createExtensionSet(String extensionString) {
|
||||||
if (extensionString == null || extensionString.isBlank()) {
|
if (extensionString == null || extensionString.isBlank()) {
|
||||||
return Set.of();
|
return Set.of();
|
||||||
|
|||||||
@@ -17,4 +17,6 @@ public class FileConfig {
|
|||||||
|
|
||||||
private String rootSyncDir = "/app/original-images/";
|
private String rootSyncDir = "/app/original-images/";
|
||||||
private String tmpSyncDir = rootSyncDir + "tmp/";
|
private String tmpSyncDir = rootSyncDir + "tmp/";
|
||||||
|
|
||||||
|
private String syncFileExt = "tfw,tif";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.kamco.cd.kamcoback.mapsheet.dto;
|
package com.kamco.cd.kamcoback.mapsheet.dto;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.common.utils.FIleChecker;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -142,9 +143,10 @@ public class FileDto {
|
|||||||
private final String dirPath;
|
private final String dirPath;
|
||||||
private final int fileTotCnt;
|
private final int fileTotCnt;
|
||||||
private final long fileTotSize;
|
private final long fileTotSize;
|
||||||
private final List<Basic> files;
|
private final List<FIleChecker.Basic> files;
|
||||||
|
|
||||||
public FilesDto(String dirPath, int fileTotCnt, long fileTotSize, List<Basic> files) {
|
public FilesDto(
|
||||||
|
String dirPath, int fileTotCnt, long fileTotSize, List<FIleChecker.Basic> files) {
|
||||||
|
|
||||||
this.dirPath = dirPath;
|
this.dirPath = dirPath;
|
||||||
this.fileTotCnt = fileTotCnt;
|
this.fileTotCnt = fileTotCnt;
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import com.kamco.cd.kamcoback.common.exception.ValidationException;
|
|||||||
import com.kamco.cd.kamcoback.common.utils.FIleChecker;
|
import com.kamco.cd.kamcoback.common.utils.FIleChecker;
|
||||||
import com.kamco.cd.kamcoback.common.utils.NameValidator;
|
import com.kamco.cd.kamcoback.common.utils.NameValidator;
|
||||||
import com.kamco.cd.kamcoback.config.FileConfig;
|
import com.kamco.cd.kamcoback.config.FileConfig;
|
||||||
import com.kamco.cd.kamcoback.mapsheet.dto.FileDto;
|
|
||||||
import com.kamco.cd.kamcoback.mapsheet.dto.FileDto.FilesDto;
|
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.FolderDto;
|
||||||
import com.kamco.cd.kamcoback.mapsheet.dto.FileDto.FoldersDto;
|
import com.kamco.cd.kamcoback.mapsheet.dto.FileDto.FoldersDto;
|
||||||
@@ -141,123 +140,47 @@ public class MapSheetMngFileCheckerService {
|
|||||||
public FilesDto getFilesAll(SrchFilesDto srchDto) {
|
public FilesDto getFilesAll(SrchFilesDto srchDto) {
|
||||||
|
|
||||||
String dirPath = srchDto.getDirPath();
|
String dirPath = srchDto.getDirPath();
|
||||||
String extension = srchDto.getExtension();
|
|
||||||
String sortType = srchDto.getSortType();
|
|
||||||
int startPos = srchDto.getStartPos();
|
int startPos = srchDto.getStartPos();
|
||||||
int endPos = srchDto.getEndPos();
|
int endPos = srchDto.getEndPos();
|
||||||
File dir = new File(dirPath);
|
|
||||||
File[] fileList = dir.listFiles();
|
|
||||||
|
|
||||||
List<FileDto.Basic> files = new ArrayList<>();
|
List<FIleChecker.Basic> files =
|
||||||
SimpleDateFormat dttmFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
FIleChecker.getFilesFromAllDepth(
|
||||||
|
srchDto.getDirPath(),
|
||||||
|
"*",
|
||||||
|
srchDto.getExtension(),
|
||||||
|
1,
|
||||||
|
srchDto.getSortType(),
|
||||||
|
startPos,
|
||||||
|
endPos);
|
||||||
|
|
||||||
int fileListPos = 0;
|
int fileListPos = 0;
|
||||||
int fileTotCnt = 0;
|
int fileTotCnt = files.size();
|
||||||
long fileTotSize = 0;
|
long fileTotSize = FIleChecker.getFileTotSize(files);
|
||||||
|
|
||||||
if (fileList != null) {
|
|
||||||
if (sortType.equals("name")) {
|
|
||||||
Arrays.sort(fileList);
|
|
||||||
} 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)) {
|
|
||||||
|
|
||||||
fileListPos = fileListPos + 1;
|
|
||||||
|
|
||||||
if (startPos <= fileListPos && endPos >= fileListPos) {
|
|
||||||
|
|
||||||
// 생성자를 통해 객체를 만들고 리스트에 추가
|
|
||||||
String fileName = file.getName();
|
|
||||||
String parentPath = file.getParent();
|
|
||||||
String fullPath = file.getAbsolutePath();
|
|
||||||
String ext = FilenameUtils.getExtension(fileName);
|
|
||||||
|
|
||||||
Path path = Paths.get(parentPath);
|
|
||||||
String parentFolderNm = path.getFileName().toString();
|
|
||||||
|
|
||||||
long fileSize = file.length();
|
|
||||||
String lastModified = dttmFormat.format(new Date(file.lastModified()));
|
|
||||||
|
|
||||||
files.add(
|
|
||||||
new FileDto.Basic(
|
|
||||||
fileName, parentFolderNm, parentPath, fullPath, ext, fileSize, lastModified));
|
|
||||||
|
|
||||||
fileTotCnt = fileTotCnt + 1;
|
|
||||||
fileTotSize = fileTotSize + fileSize;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return new FilesDto(dirPath, fileTotCnt, fileTotSize, files);
|
return new FilesDto(dirPath, fileTotCnt, fileTotSize, files);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FilesDto getFilesDepthAll(SrchFilesDepthDto srchDto) {
|
public FilesDto getFilesDepthAll(SrchFilesDepthDto srchDto) {
|
||||||
|
|
||||||
Path startPath = Paths.get(srchDto.getDirPath());
|
|
||||||
int maxDepth = srchDto.getMaxDepth();
|
|
||||||
String dirPath = srchDto.getDirPath();
|
String dirPath = srchDto.getDirPath();
|
||||||
String extension = srchDto.getExtension();
|
|
||||||
String sortType = srchDto.getSortType();
|
|
||||||
|
|
||||||
int startPos = srchDto.getStartPos();
|
int startPos = srchDto.getStartPos();
|
||||||
int endPos = srchDto.getEndPos();
|
int endPos = srchDto.getEndPos();
|
||||||
int limit = endPos - startPos + 1;
|
|
||||||
|
|
||||||
Set<String> targetExtensions = createExtensionSet(extension);
|
List<FIleChecker.Basic> files =
|
||||||
|
FIleChecker.getFilesFromAllDepth(
|
||||||
|
srchDto.getDirPath(),
|
||||||
|
"*",
|
||||||
|
srchDto.getExtension(),
|
||||||
|
srchDto.getMaxDepth(),
|
||||||
|
srchDto.getSortType(),
|
||||||
|
startPos,
|
||||||
|
endPos);
|
||||||
|
|
||||||
List<FileDto.Basic> fileDtoList = new ArrayList<>();
|
int fileListPos = 0;
|
||||||
SimpleDateFormat dttmFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
int fileTotCnt = files.size();
|
||||||
|
long fileTotSize = FIleChecker.getFileTotSize(files);
|
||||||
|
|
||||||
int fileTotCnt = 0;
|
return new FilesDto(dirPath, fileTotCnt, fileTotSize, files);
|
||||||
long fileTotSize = 0;
|
|
||||||
|
|
||||||
try (Stream<Path> stream = Files.walk(startPath, maxDepth)) {
|
|
||||||
|
|
||||||
fileDtoList =
|
|
||||||
stream
|
|
||||||
.filter(Files::isRegularFile)
|
|
||||||
.filter(
|
|
||||||
p ->
|
|
||||||
extension == null
|
|
||||||
|| extension.equals("")
|
|
||||||
|| extension.equals("*")
|
|
||||||
|| targetExtensions.contains(extractExtension(p)))
|
|
||||||
.sorted(getFileComparator(sortType))
|
|
||||||
.skip(startPos)
|
|
||||||
.limit(limit)
|
|
||||||
.map(
|
|
||||||
path -> {
|
|
||||||
int depth = path.getNameCount();
|
|
||||||
|
|
||||||
String fileNm = path.getFileName().toString();
|
|
||||||
String ext = FilenameUtils.getExtension(fileNm);
|
|
||||||
String parentFolderNm = path.getParent().getFileName().toString();
|
|
||||||
String parentPath = path.getParent().toString();
|
|
||||||
String fullPath = path.toAbsolutePath().toString();
|
|
||||||
|
|
||||||
File file = new File(fullPath);
|
|
||||||
long fileSize = file.length();
|
|
||||||
String lastModified = dttmFormat.format(new Date(file.lastModified()));
|
|
||||||
|
|
||||||
return new FileDto.Basic(
|
|
||||||
fileNm, parentFolderNm, parentPath, fullPath, ext, fileSize, lastModified);
|
|
||||||
})
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
fileTotCnt = fileDtoList.size();
|
|
||||||
fileTotSize = fileDtoList.stream().mapToLong(FileDto.Basic::getFileSize).sum();
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
System.err.println("파일 I/O 오류 발생: " + e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
return new FilesDto(dirPath, fileTotCnt, fileTotSize, fileDtoList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<String> createExtensionSet(String extensionString) {
|
public Set<String> createExtensionSet(String extensionString) {
|
||||||
|
|||||||
@@ -1,13 +1,7 @@
|
|||||||
package com.kamco.cd.kamcoback.mapsheet.service;
|
package com.kamco.cd.kamcoback.mapsheet.service;
|
||||||
|
|
||||||
import static java.lang.String.CASE_INSENSITIVE_ORDER;
|
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.common.utils.FIleChecker;
|
import com.kamco.cd.kamcoback.common.utils.FIleChecker;
|
||||||
import com.kamco.cd.kamcoback.config.FileConfig;
|
import com.kamco.cd.kamcoback.config.FileConfig;
|
||||||
import com.kamco.cd.kamcoback.mapsheet.dto.FileDto.Basic;
|
|
||||||
import com.kamco.cd.kamcoback.mapsheet.dto.FileDto.FilesDto;
|
|
||||||
import com.kamco.cd.kamcoback.mapsheet.dto.FileDto.SrchFilesDepthDto;
|
|
||||||
import com.kamco.cd.kamcoback.mapsheet.dto.FileDto.SrchFilesDto;
|
|
||||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
||||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.AddReq;
|
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.AddReq;
|
||||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.DmlReturn;
|
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.DmlReturn;
|
||||||
@@ -23,18 +17,8 @@ import java.nio.file.Files;
|
|||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.nio.file.StandardCopyOption;
|
import java.nio.file.StandardCopyOption;
|
||||||
import java.nio.file.attribute.FileTime;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.commons.io.FilenameUtils;
|
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -48,181 +32,6 @@ public class MapSheetMngService {
|
|||||||
private final MapSheetMngCoreService mapSheetMngCoreService;
|
private final MapSheetMngCoreService mapSheetMngCoreService;
|
||||||
private final FileConfig fileConfig;
|
private final FileConfig fileConfig;
|
||||||
|
|
||||||
public FilesDto getFilesAll(SrchFilesDto srchDto) {
|
|
||||||
|
|
||||||
String dirPath = srchDto.getDirPath();
|
|
||||||
String extension = srchDto.getExtension();
|
|
||||||
String sortType = srchDto.getSortType();
|
|
||||||
int startPos = srchDto.getStartPos();
|
|
||||||
int endPos = srchDto.getEndPos();
|
|
||||||
File dir = new File(dirPath);
|
|
||||||
File[] fileList = dir.listFiles();
|
|
||||||
|
|
||||||
List<Basic> files = new ArrayList<>();
|
|
||||||
SimpleDateFormat dttmFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
||||||
|
|
||||||
int fileListPos = 0;
|
|
||||||
int fileTotCnt = 0;
|
|
||||||
long fileTotSize = 0;
|
|
||||||
|
|
||||||
if (fileList != null) {
|
|
||||||
if (sortType.equals("name")) {
|
|
||||||
Arrays.sort(fileList);
|
|
||||||
} 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)) {
|
|
||||||
|
|
||||||
fileListPos = fileListPos + 1;
|
|
||||||
|
|
||||||
if (startPos <= fileListPos && endPos >= fileListPos) {
|
|
||||||
|
|
||||||
// 생성자를 통해 객체를 만들고 리스트에 추가
|
|
||||||
String fileName = file.getName();
|
|
||||||
String parentPath = file.getParent();
|
|
||||||
String fullPath = file.getAbsolutePath();
|
|
||||||
String ext = FilenameUtils.getExtension(fileName);
|
|
||||||
|
|
||||||
Path path = Paths.get(parentPath);
|
|
||||||
String parentFolderNm = path.getFileName().toString();
|
|
||||||
|
|
||||||
long fileSize = file.length();
|
|
||||||
String lastModified = dttmFormat.format(new Date(file.lastModified()));
|
|
||||||
|
|
||||||
files.add(
|
|
||||||
new Basic(
|
|
||||||
fileName, parentFolderNm, parentPath, fullPath, ext, fileSize, lastModified));
|
|
||||||
|
|
||||||
fileTotCnt = fileTotCnt + 1;
|
|
||||||
fileTotSize = fileTotSize + fileSize;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return new FilesDto(dirPath, fileTotCnt, fileTotSize, files);
|
|
||||||
}
|
|
||||||
|
|
||||||
public FilesDto getFilesDepthAll(SrchFilesDepthDto srchDto) {
|
|
||||||
|
|
||||||
Path startPath = Paths.get(srchDto.getDirPath());
|
|
||||||
int maxDepth = srchDto.getMaxDepth();
|
|
||||||
String dirPath = srchDto.getDirPath();
|
|
||||||
String extension = srchDto.getExtension();
|
|
||||||
String sortType = srchDto.getSortType();
|
|
||||||
|
|
||||||
int startPos = srchDto.getStartPos();
|
|
||||||
int endPos = srchDto.getEndPos();
|
|
||||||
int limit = endPos - startPos + 1;
|
|
||||||
|
|
||||||
Set<String> targetExtensions = createExtensionSet(extension);
|
|
||||||
|
|
||||||
List<Basic> fileDtoList = new ArrayList<>();
|
|
||||||
SimpleDateFormat dttmFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
||||||
|
|
||||||
int fileTotCnt = 0;
|
|
||||||
long fileTotSize = 0;
|
|
||||||
|
|
||||||
try (Stream<Path> stream = Files.walk(startPath, maxDepth)) {
|
|
||||||
|
|
||||||
fileDtoList =
|
|
||||||
stream
|
|
||||||
.filter(Files::isRegularFile)
|
|
||||||
.filter(
|
|
||||||
p ->
|
|
||||||
extension == null
|
|
||||||
|| extension.equals("")
|
|
||||||
|| extension.equals("*")
|
|
||||||
|| targetExtensions.contains(extractExtension(p)))
|
|
||||||
.sorted(getFileComparator(sortType))
|
|
||||||
.skip(startPos)
|
|
||||||
.limit(limit)
|
|
||||||
.map(
|
|
||||||
path -> {
|
|
||||||
int depth = path.getNameCount();
|
|
||||||
|
|
||||||
String fileNm = path.getFileName().toString();
|
|
||||||
String ext = FilenameUtils.getExtension(fileNm);
|
|
||||||
String parentFolderNm = path.getParent().getFileName().toString();
|
|
||||||
String parentPath = path.getParent().toString();
|
|
||||||
String fullPath = path.toAbsolutePath().toString();
|
|
||||||
|
|
||||||
File file = new File(fullPath);
|
|
||||||
long fileSize = file.length();
|
|
||||||
String lastModified = dttmFormat.format(new Date(file.lastModified()));
|
|
||||||
|
|
||||||
return new Basic(
|
|
||||||
fileNm, parentFolderNm, parentPath, fullPath, ext, fileSize, lastModified);
|
|
||||||
})
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
fileTotCnt = fileDtoList.size();
|
|
||||||
fileTotSize = fileDtoList.stream().mapToLong(Basic::getFileSize).sum();
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
System.err.println("파일 I/O 오류 발생: " + e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
return new FilesDto(dirPath, fileTotCnt, fileTotSize, fileDtoList);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<String> createExtensionSet(String extensionString) {
|
|
||||||
if (extensionString == null || extensionString.isBlank()) {
|
|
||||||
return Set.of();
|
|
||||||
}
|
|
||||||
|
|
||||||
// "java, class" -> ["java", " class"] -> [".java", ".class"]
|
|
||||||
return Arrays.stream(extensionString.split(","))
|
|
||||||
.map(ext -> ext.trim())
|
|
||||||
.filter(ext -> !ext.isEmpty())
|
|
||||||
.map(ext -> "." + ext.toLowerCase())
|
|
||||||
.collect(Collectors.toSet());
|
|
||||||
}
|
|
||||||
|
|
||||||
public String extractExtension(Path path) {
|
|
||||||
String filename = path.getFileName().toString();
|
|
||||||
int lastDotIndex = filename.lastIndexOf('.');
|
|
||||||
|
|
||||||
// 확장자가 없거나 파일명이 .으로 끝나는 경우
|
|
||||||
if (lastDotIndex == -1 || lastDotIndex == filename.length() - 1) {
|
|
||||||
return ""; // 빈 문자열 반환
|
|
||||||
}
|
|
||||||
|
|
||||||
// 확장자 추출 및 소문자 변환
|
|
||||||
return filename.substring(lastDotIndex).toLowerCase();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Comparator<Path> getFileComparator(String sortType) {
|
|
||||||
|
|
||||||
// 파일 이름 비교 기본 Comparator (대소문자 무시)
|
|
||||||
Comparator<Path> nameComparator =
|
|
||||||
Comparator.comparing(path -> path.getFileName().toString(), CASE_INSENSITIVE_ORDER);
|
|
||||||
|
|
||||||
Comparator<Path> dateComparator =
|
|
||||||
Comparator.comparing(
|
|
||||||
path -> {
|
|
||||||
try {
|
|
||||||
return Files.getLastModifiedTime(path);
|
|
||||||
} catch (IOException e) {
|
|
||||||
return FileTime.fromMillis(0);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if ("name desc".equalsIgnoreCase(sortType)) {
|
|
||||||
return nameComparator.reversed();
|
|
||||||
} else if ("date".equalsIgnoreCase(sortType)) {
|
|
||||||
return dateComparator;
|
|
||||||
} else if ("date desc".equalsIgnoreCase(sortType)) {
|
|
||||||
return dateComparator.reversed();
|
|
||||||
} else {
|
|
||||||
return nameComparator;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<MngDto> findMapSheetMngList() {
|
public List<MngDto> findMapSheetMngList() {
|
||||||
return mapSheetMngCoreService.findMapSheetMngList();
|
return mapSheetMngCoreService.findMapSheetMngList();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package com.kamco.cd.kamcoback.postgres.core;
|
|||||||
|
|
||||||
import com.kamco.cd.kamcoback.model.dto.ModelMngDto;
|
import com.kamco.cd.kamcoback.model.dto.ModelMngDto;
|
||||||
import com.kamco.cd.kamcoback.model.dto.ModelVerDto;
|
import com.kamco.cd.kamcoback.model.dto.ModelVerDto;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.ModelMngEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.ModelMngBakEntity;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.ModelVerEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.ModelVerEntity;
|
||||||
import com.kamco.cd.kamcoback.postgres.repository.model.ModelMngRepository;
|
import com.kamco.cd.kamcoback.postgres.repository.model.ModelMngRepository;
|
||||||
import com.kamco.cd.kamcoback.postgres.repository.model.ModelVerRepository;
|
import com.kamco.cd.kamcoback.postgres.repository.model.ModelVerRepository;
|
||||||
@@ -22,7 +22,7 @@ public class ModelMngCoreService {
|
|||||||
private final ModelVerRepository modelVerRepository;
|
private final ModelVerRepository modelVerRepository;
|
||||||
|
|
||||||
public List<ModelMngDto.Basic> findModelMngAll() {
|
public List<ModelMngDto.Basic> findModelMngAll() {
|
||||||
return modelMngRepository.findModelMngAll().stream().map(ModelMngEntity::toDto).toList();
|
return modelMngRepository.findModelMngAll().stream().map(ModelMngBakEntity::toDto).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<ModelMngDto.FinalModelDto> getFinalModelInfo() {
|
public Optional<ModelMngDto.FinalModelDto> getFinalModelInfo() {
|
||||||
@@ -30,8 +30,8 @@ public class ModelMngCoreService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ModelVerDto.Basic save(ModelMngDto.AddReq addReq) {
|
public ModelVerDto.Basic save(ModelMngDto.AddReq addReq) {
|
||||||
ModelMngEntity modelMngEntity =
|
ModelMngBakEntity modelMngBakEntity =
|
||||||
new ModelMngEntity(
|
new ModelMngBakEntity(
|
||||||
addReq.getModelNm(),
|
addReq.getModelNm(),
|
||||||
addReq.getModelCate(),
|
addReq.getModelCate(),
|
||||||
addReq.getModelPath(),
|
addReq.getModelPath(),
|
||||||
@@ -39,7 +39,7 @@ public class ModelMngCoreService {
|
|||||||
1L,
|
1L,
|
||||||
addReq.getModelCntnt()); // TODO: 로그인 기능 붙이면 Uid 넣어야 함
|
addReq.getModelCntnt()); // TODO: 로그인 기능 붙이면 Uid 넣어야 함
|
||||||
|
|
||||||
ModelMngEntity saved = modelMngRepository.save(modelMngEntity);
|
ModelMngBakEntity saved = modelMngRepository.save(modelMngBakEntity);
|
||||||
ModelVerEntity modelVerEntity =
|
ModelVerEntity modelVerEntity =
|
||||||
new ModelVerEntity(
|
new ModelVerEntity(
|
||||||
saved.getId(),
|
saved.getId(),
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.entity;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@Entity
|
|
||||||
@Table(name = "tb_model_class_count")
|
|
||||||
public class ModelClassCountEntity {
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
@Column(name = "count_uid")
|
|
||||||
private Integer countUid;
|
|
||||||
|
|
||||||
@Column(name = "model_uid")
|
|
||||||
private Integer modelUid;
|
|
||||||
|
|
||||||
@Column(name = "class_cd")
|
|
||||||
private String classCd;
|
|
||||||
|
|
||||||
@Column(name = "obj_cnt")
|
|
||||||
private Integer objCnt;
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.entity;
|
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
|
||||||
import jakarta.persistence.EmbeddedId;
|
|
||||||
import jakarta.persistence.Entity;
|
|
||||||
import jakarta.persistence.Table;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@Entity
|
|
||||||
@Table(name = "tb_model_dataset_mapp")
|
|
||||||
public class ModelDatasetMappEntity {
|
|
||||||
|
|
||||||
@EmbeddedId private ModelDatasetMappEntityId id;
|
|
||||||
|
|
||||||
@Column(name = "dataset_type")
|
|
||||||
private String datasetType;
|
|
||||||
}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.entity;
|
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
|
||||||
import jakarta.persistence.Embeddable;
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Objects;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
import org.hibernate.Hibernate;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@Embeddable
|
|
||||||
public class ModelDatasetMappEntityId implements Serializable {
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Column(name = "model_uid", nullable = false)
|
|
||||||
private Integer modelUid;
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Column(name = "dataset_uid", nullable = false)
|
|
||||||
private Integer datasetUid;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object o) {
|
|
||||||
if (this == o) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
ModelDatasetMappEntityId entity = (ModelDatasetMappEntityId) o;
|
|
||||||
return Objects.equals(this.modelUid, entity.modelUid)
|
|
||||||
&& Objects.equals(this.datasetUid, entity.datasetUid);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hash(modelUid, modelUid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.entity;
|
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
|
||||||
import jakarta.persistence.Entity;
|
|
||||||
import jakarta.persistence.Id;
|
|
||||||
import jakarta.persistence.Table;
|
|
||||||
import java.time.ZonedDateTime;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@Entity
|
|
||||||
@Table(name = "tb_model_hyper_param")
|
|
||||||
public class ModelHyperParamEntity {
|
|
||||||
@Id
|
|
||||||
@Column(name = "hyper_ver")
|
|
||||||
private String hyperVer;
|
|
||||||
|
|
||||||
@Column(name = "learning_rate")
|
|
||||||
private Double learningRate;
|
|
||||||
|
|
||||||
@Column(name = "batch_size")
|
|
||||||
private Integer batchSize;
|
|
||||||
|
|
||||||
@Column(name = "dropout_ratio")
|
|
||||||
private Double dropoutRatio;
|
|
||||||
|
|
||||||
@Column(name = "cnn_filter_cnt")
|
|
||||||
private Integer cnnFilterCnt;
|
|
||||||
|
|
||||||
@Column(name = "memo", columnDefinition = "TEXT")
|
|
||||||
private String memo;
|
|
||||||
|
|
||||||
@Column(name = "del_yn")
|
|
||||||
private Character delYn;
|
|
||||||
|
|
||||||
@Column(name = "created_dttm")
|
|
||||||
private ZonedDateTime createdDttm;
|
|
||||||
}
|
|
||||||
@@ -12,16 +12,12 @@ import org.hibernate.annotations.ColumnDefault;
|
|||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "tb_model_mng")
|
@Table(name = "tb_model_mng_bak")
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class ModelMngEntity extends CommonDateEntity {
|
public class ModelMngBakEntity extends CommonDateEntity {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "tb_model_mng_id_gen")
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
@SequenceGenerator(
|
|
||||||
name = "tb_model_mng_id_gen",
|
|
||||||
sequenceName = "tb_model_mng_model_uid",
|
|
||||||
allocationSize = 1)
|
|
||||||
@Column(name = "model_uid", nullable = false)
|
@Column(name = "model_uid", nullable = false)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@@ -52,7 +48,7 @@ public class ModelMngEntity extends CommonDateEntity {
|
|||||||
@Column(name = "bbone_ver")
|
@Column(name = "bbone_ver")
|
||||||
private String bboneVer;
|
private String bboneVer;
|
||||||
|
|
||||||
public ModelMngEntity(
|
public ModelMngBakEntity(
|
||||||
String modelNm,
|
String modelNm,
|
||||||
String modelCate,
|
String modelCate,
|
||||||
String modelPath,
|
String modelPath,
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.entity;
|
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.postgres.CommonDateEntity;
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.time.ZonedDateTime;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@Entity
|
|
||||||
@Table(name = "tb_model_train_master")
|
|
||||||
public class ModelTrainMasterEntity extends CommonDateEntity {
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
@Column(name = "model_uid", nullable = false)
|
|
||||||
private Integer modelUid;
|
|
||||||
|
|
||||||
@Column(name = "model_ver")
|
|
||||||
private String modelVer;
|
|
||||||
|
|
||||||
@Column(name = "hyper_ver")
|
|
||||||
private String hyperVer;
|
|
||||||
|
|
||||||
@Column(name = "epoch_ver")
|
|
||||||
private String epochVer;
|
|
||||||
|
|
||||||
@Column(name = "process_step")
|
|
||||||
private String processStep;
|
|
||||||
|
|
||||||
@Column(name = "status_cd")
|
|
||||||
private String statsusCd;
|
|
||||||
|
|
||||||
@Column(name = "train_start_dttm")
|
|
||||||
private ZonedDateTime trainStartDttm;
|
|
||||||
|
|
||||||
@Column(name = "epoch_cnt")
|
|
||||||
private Integer epochCnt;
|
|
||||||
|
|
||||||
@Column(name = "dataset_ratio")
|
|
||||||
private String datasetRatio;
|
|
||||||
|
|
||||||
@Column(name = "best_epoch")
|
|
||||||
private Integer bestEpoch;
|
|
||||||
|
|
||||||
@Column(name = "step1_end_dttm")
|
|
||||||
private ZonedDateTime step1EndDttm;
|
|
||||||
|
|
||||||
@Column(name = "step1_duration")
|
|
||||||
private String step1Duration;
|
|
||||||
|
|
||||||
@Column(name = "step2_end_dttm")
|
|
||||||
private ZonedDateTime step2EndDttm;
|
|
||||||
|
|
||||||
@Column(name = "step2_duration")
|
|
||||||
private String step2Duration;
|
|
||||||
|
|
||||||
@Column(name = "del_yn")
|
|
||||||
private Character delYn;
|
|
||||||
|
|
||||||
@Column(name = "created_uid")
|
|
||||||
private Long createdUid;
|
|
||||||
|
|
||||||
@Column(name = "updated_uid")
|
|
||||||
private Long updatedUid;
|
|
||||||
}
|
|
||||||
@@ -3,14 +3,7 @@ package com.kamco.cd.kamcoback.postgres.repository.Inference;
|
|||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.Dashboard;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.Dashboard;
|
||||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.SearchGeoReq;
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.SearchGeoReq;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.*;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataGeomEntity;
|
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataEntity;
|
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataGeomEntity;
|
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalEntity;
|
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalSttcEntity;
|
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.QModelMngEntity;
|
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.QModelVerEntity;
|
|
||||||
import com.querydsl.core.BooleanBuilder;
|
import com.querydsl.core.BooleanBuilder;
|
||||||
import com.querydsl.core.types.Order;
|
import com.querydsl.core.types.Order;
|
||||||
import com.querydsl.core.types.OrderSpecifier;
|
import com.querydsl.core.types.OrderSpecifier;
|
||||||
@@ -36,7 +29,7 @@ import org.springframework.stereotype.Repository;
|
|||||||
public class InferenceResultRepositoryImpl implements InferenceResultRepositoryCustom {
|
public class InferenceResultRepositoryImpl implements InferenceResultRepositoryCustom {
|
||||||
|
|
||||||
private final JPAQueryFactory queryFactory;
|
private final JPAQueryFactory queryFactory;
|
||||||
private final QModelMngEntity tmm = QModelMngEntity.modelMngEntity;
|
private final QModelMngBakEntity tmm = QModelMngBakEntity.modelMngBakEntity;
|
||||||
private final QModelVerEntity tmv = QModelVerEntity.modelVerEntity;
|
private final QModelVerEntity tmv = QModelVerEntity.modelVerEntity;
|
||||||
private final QMapSheetAnalEntity mapSheetAnalEntity = QMapSheetAnalEntity.mapSheetAnalEntity;
|
private final QMapSheetAnalEntity mapSheetAnalEntity = QMapSheetAnalEntity.mapSheetAnalEntity;
|
||||||
private final QMapSheetAnalDataEntity mapSheetAnalDataEntity =
|
private final QMapSheetAnalDataEntity mapSheetAnalDataEntity =
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.repository.model;
|
package com.kamco.cd.kamcoback.postgres.repository.model;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.ModelMngEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.ModelMngBakEntity;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
public interface ModelMngRepository
|
public interface ModelMngRepository
|
||||||
extends JpaRepository<ModelMngEntity, Long>, ModelMngRepositoryCustom {}
|
extends JpaRepository<ModelMngBakEntity, Long>, ModelMngRepositoryCustom {}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.repository.model;
|
package com.kamco.cd.kamcoback.postgres.repository.model;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.model.dto.ModelMngDto;
|
import com.kamco.cd.kamcoback.model.dto.ModelMngDto;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.ModelMngEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.ModelMngBakEntity;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@@ -9,7 +9,7 @@ import org.springframework.data.domain.Page;
|
|||||||
|
|
||||||
public interface ModelMngRepositoryCustom {
|
public interface ModelMngRepositoryCustom {
|
||||||
|
|
||||||
List<ModelMngEntity> findModelMngAll();
|
List<ModelMngBakEntity> findModelMngAll();
|
||||||
|
|
||||||
Optional<ModelMngDto.FinalModelDto> getFinalModelInfo();
|
Optional<ModelMngDto.FinalModelDto> getFinalModelInfo();
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.repository.model;
|
package com.kamco.cd.kamcoback.postgres.repository.model;
|
||||||
|
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QModelDeployHstEntity.modelDeployHstEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QModelDeployHstEntity.modelDeployHstEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QModelMngEntity.modelMngEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QModelMngBakEntity.modelMngBakEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QModelVerEntity.modelVerEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QModelVerEntity.modelVerEntity;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.model.dto.ModelMngDto;
|
import com.kamco.cd.kamcoback.model.dto.ModelMngDto;
|
||||||
import com.kamco.cd.kamcoback.postgres.QuerydslOrderUtil;
|
import com.kamco.cd.kamcoback.postgres.QuerydslOrderUtil;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.ModelMngEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.ModelMngBakEntity;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.ModelVerEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.ModelVerEntity;
|
||||||
import com.querydsl.core.types.Projections;
|
import com.querydsl.core.types.Projections;
|
||||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||||
@@ -32,13 +32,13 @@ public class ModelMngRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
private final StringExpression NULL_STRING = Expressions.stringTemplate("cast(null as text)");
|
private final StringExpression NULL_STRING = Expressions.stringTemplate("cast(null as text)");
|
||||||
|
|
||||||
public ModelMngRepositoryImpl(JPAQueryFactory queryFactory) {
|
public ModelMngRepositoryImpl(JPAQueryFactory queryFactory) {
|
||||||
super(ModelMngEntity.class);
|
super(ModelMngBakEntity.class);
|
||||||
this.queryFactory = queryFactory;
|
this.queryFactory = queryFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ModelMngEntity> findModelMngAll() {
|
public List<ModelMngBakEntity> findModelMngAll() {
|
||||||
return queryFactory.selectFrom(modelMngEntity).orderBy(modelMngEntity.id.desc()).fetch();
|
return queryFactory.selectFrom(modelMngBakEntity).orderBy(modelMngBakEntity.id.desc()).fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -47,9 +47,9 @@ public class ModelMngRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
.select(
|
.select(
|
||||||
Projections.constructor(
|
Projections.constructor(
|
||||||
ModelMngDto.FinalModelDto.class,
|
ModelMngDto.FinalModelDto.class,
|
||||||
modelMngEntity.id.as("modelUid"),
|
modelMngBakEntity.id.as("modelUid"),
|
||||||
modelMngEntity.modelNm,
|
modelMngBakEntity.modelNm,
|
||||||
modelMngEntity.modelCate,
|
modelMngBakEntity.modelCate,
|
||||||
modelVerEntity.id.as("modelVerUid"),
|
modelVerEntity.id.as("modelVerUid"),
|
||||||
modelVerEntity.modelVer,
|
modelVerEntity.modelVer,
|
||||||
Expressions.stringTemplate(
|
Expressions.stringTemplate(
|
||||||
@@ -60,9 +60,9 @@ public class ModelMngRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
Expressions.stringTemplate(
|
Expressions.stringTemplate(
|
||||||
"fn_codenm_to_misc({0}, {1})", 52, modelVerEntity.deployState), // 배포상태 한글 명칭
|
"fn_codenm_to_misc({0}, {1})", 52, modelVerEntity.deployState), // 배포상태 한글 명칭
|
||||||
modelVerEntity.modelPath))
|
modelVerEntity.modelPath))
|
||||||
.from(modelMngEntity)
|
.from(modelMngBakEntity)
|
||||||
.innerJoin(modelVerEntity)
|
.innerJoin(modelVerEntity)
|
||||||
.on(modelMngEntity.id.eq(modelVerEntity.modelUid))
|
.on(modelMngBakEntity.id.eq(modelVerEntity.modelUid))
|
||||||
.where(modelVerEntity.usedState.eq("USED")) // USED 인 것 중에
|
.where(modelVerEntity.usedState.eq("USED")) // USED 인 것 중에
|
||||||
.orderBy(modelVerEntity.modelVer.desc()) // Version 높은 것 기준
|
.orderBy(modelVerEntity.modelVer.desc()) // Version 높은 것 기준
|
||||||
.stream()
|
.stream()
|
||||||
@@ -79,8 +79,8 @@ public class ModelMngRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
.select(
|
.select(
|
||||||
Projections.constructor(
|
Projections.constructor(
|
||||||
ModelMngDto.ModelRegHistory.class,
|
ModelMngDto.ModelRegHistory.class,
|
||||||
modelMngEntity.modelNm,
|
modelMngBakEntity.modelNm,
|
||||||
modelMngEntity.modelCate,
|
modelMngBakEntity.modelCate,
|
||||||
modelVerEntity.modelVer,
|
modelVerEntity.modelVer,
|
||||||
Expressions.stringTemplate(
|
Expressions.stringTemplate(
|
||||||
"to_char({0}, 'YYYY-MM-DD')", modelVerEntity.createdDate)
|
"to_char({0}, 'YYYY-MM-DD')", modelVerEntity.createdDate)
|
||||||
@@ -93,9 +93,9 @@ public class ModelMngRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
Expressions.stringTemplate(
|
Expressions.stringTemplate(
|
||||||
"to_char({0}, 'YYYY-MM-DD')", modelDeployHstEntity.deployDttm)
|
"to_char({0}, 'YYYY-MM-DD')", modelDeployHstEntity.deployDttm)
|
||||||
.as("deployDttm")))
|
.as("deployDttm")))
|
||||||
.from(modelMngEntity)
|
.from(modelMngBakEntity)
|
||||||
.innerJoin(modelVerEntity)
|
.innerJoin(modelVerEntity)
|
||||||
.on(modelMngEntity.id.eq(modelVerEntity.modelUid))
|
.on(modelMngBakEntity.id.eq(modelVerEntity.modelUid))
|
||||||
.leftJoin(modelDeployHstEntity)
|
.leftJoin(modelDeployHstEntity)
|
||||||
.on(
|
.on(
|
||||||
modelVerEntity
|
modelVerEntity
|
||||||
@@ -114,9 +114,9 @@ public class ModelMngRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
Long countQuery =
|
Long countQuery =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(modelVerEntity.id.count())
|
.select(modelVerEntity.id.count())
|
||||||
.from(modelMngEntity)
|
.from(modelMngBakEntity)
|
||||||
.innerJoin(modelVerEntity)
|
.innerJoin(modelVerEntity)
|
||||||
.on(modelMngEntity.id.eq(modelVerEntity.modelUid))
|
.on(modelMngBakEntity.id.eq(modelVerEntity.modelUid))
|
||||||
.where(eventEndedAtBetween(startDate, endDate), searchModelVerLike(searchVal))
|
.where(eventEndedAtBetween(startDate, endDate), searchModelVerLike(searchVal))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
|
|
||||||
@@ -129,10 +129,10 @@ public class ModelMngRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
}
|
}
|
||||||
LocalDateTime startDateTime = startDate.atStartOfDay();
|
LocalDateTime startDateTime = startDate.atStartOfDay();
|
||||||
LocalDateTime endDateTime = endDate.plusDays(1).atStartOfDay();
|
LocalDateTime endDateTime = endDate.plusDays(1).atStartOfDay();
|
||||||
return modelMngEntity
|
return modelMngBakEntity
|
||||||
.createdDate
|
.createdDate
|
||||||
.goe(ZonedDateTime.from(startDateTime))
|
.goe(ZonedDateTime.from(startDateTime))
|
||||||
.and(modelMngEntity.modifiedDate.lt(ZonedDateTime.from(endDateTime)));
|
.and(modelMngBakEntity.modifiedDate.lt(ZonedDateTime.from(endDateTime)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private BooleanExpression searchModelVerLike(String searchVal) {
|
private BooleanExpression searchModelVerLike(String searchVal) {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package com.kamco.cd.kamcoback.postgres.repository.model;
|
|||||||
|
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QModelVerEntity.modelVerEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QModelVerEntity.modelVerEntity;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.ModelMngEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.ModelMngBakEntity;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.ModelVerEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.ModelVerEntity;
|
||||||
import com.querydsl.core.types.dsl.Expressions;
|
import com.querydsl.core.types.dsl.Expressions;
|
||||||
import com.querydsl.core.types.dsl.StringExpression;
|
import com.querydsl.core.types.dsl.StringExpression;
|
||||||
@@ -17,7 +17,7 @@ public class ModelVerRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
private final StringExpression NULL_STRING = Expressions.stringTemplate("cast(null as text)");
|
private final StringExpression NULL_STRING = Expressions.stringTemplate("cast(null as text)");
|
||||||
|
|
||||||
public ModelVerRepositoryImpl(JPAQueryFactory queryFactory) {
|
public ModelVerRepositoryImpl(JPAQueryFactory queryFactory) {
|
||||||
super(ModelMngEntity.class);
|
super(ModelMngBakEntity.class);
|
||||||
this.queryFactory = queryFactory;
|
this.queryFactory = queryFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user