Merge remote-tracking branch 'origin/feat/dev_251201' into feat/dev_251201
# Conflicts: # src/main/java/com/kamco/cd/kamcoback/postgres/core/MapSheetMngCoreService.java
This commit is contained in:
@@ -32,6 +32,11 @@ public class CustomAuthenticationProvider implements AuthenticationProvider {
|
|||||||
.findByUserId(username)
|
.findByUserId(username)
|
||||||
.orElseThrow(() -> new CustomApiException(AuthErrorCode.LOGIN_ID_NOT_FOUND));
|
.orElseThrow(() -> new CustomApiException(AuthErrorCode.LOGIN_ID_NOT_FOUND));
|
||||||
|
|
||||||
|
// 삭제 상태
|
||||||
|
if (member.getStatus().equals(StatusType.DELETED.getId())) {
|
||||||
|
throw new CustomApiException(AuthErrorCode.LOGIN_ID_NOT_FOUND);
|
||||||
|
}
|
||||||
|
|
||||||
// jBCrypt + 커스텀 salt 로 저장된 패스워드 비교
|
// jBCrypt + 커스텀 salt 로 저장된 패스워드 비교
|
||||||
if (!BCrypt.checkpw(rawPassword, member.getPassword())) {
|
if (!BCrypt.checkpw(rawPassword, member.getPassword())) {
|
||||||
// 실패 카운트 저장
|
// 실패 카운트 저장
|
||||||
@@ -44,11 +49,6 @@ public class CustomAuthenticationProvider implements AuthenticationProvider {
|
|||||||
throw new CustomApiException(AuthErrorCode.LOGIN_PASSWORD_MISMATCH);
|
throw new CustomApiException(AuthErrorCode.LOGIN_PASSWORD_MISMATCH);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 삭제 상태
|
|
||||||
if (member.getStatus().equals(StatusType.DELETED.getId())) {
|
|
||||||
throw new CustomApiException(AuthErrorCode.LOGIN_ID_NOT_FOUND);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 패스워드 실패 횟수 체크
|
// 패스워드 실패 횟수 체크
|
||||||
if (member.getLoginFailCount() >= 5) {
|
if (member.getLoginFailCount() >= 5) {
|
||||||
throw new CustomApiException(AuthErrorCode.LOGIN_PASSWORD_EXCEEDED);
|
throw new CustomApiException(AuthErrorCode.LOGIN_PASSWORD_EXCEEDED);
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import java.nio.file.Path;
|
|||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
@@ -29,25 +30,24 @@ public class MapSheetMngCoreService {
|
|||||||
|
|
||||||
private static final String ORIGINAL_IMAGES_PATH = "/app/original-images";
|
private static final String ORIGINAL_IMAGES_PATH = "/app/original-images";
|
||||||
|
|
||||||
// Fix: property placeholder syntax
|
@Value("{spring.profiles.active}")
|
||||||
@Value("${spring.profiles.active}")
|
|
||||||
private String activeEnv;
|
private String activeEnv;
|
||||||
|
|
||||||
public Page<MapSheetMngDto.ErrorDataDto> findMapSheetErrorList(
|
public Page<MapSheetMngDto.ErrorDataDto> findMapSheetErrorList(
|
||||||
MapSheetMngDto.@Valid searchReq searchReq) {
|
MapSheetMngDto.@Valid searchReq searchReq) {
|
||||||
return mapSheetMngRepository.findMapSheetErrorList(searchReq);
|
return mapSheetMngRepository.findMapSheetErrorList(searchReq);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Page<MapSheetMngDto.MngDto> findMapSheetMngList(
|
public Page<MapSheetMngDto.MngDto> findMapSheetMngList(
|
||||||
MapSheetMngDto.@Valid searchReq searchReq) {
|
MapSheetMngDto.@Valid searchReq searchReq) {
|
||||||
return mapSheetMngRepository.findMapSheetMngList(searchReq);
|
return mapSheetMngRepository.findMapSheetMngList(searchReq);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MapSheetMngDto.DmlReturn uploadFile(MultipartFile file, Long hstUid) {
|
public MapSheetMngDto.DmlReturn uploadFile(MultipartFile file, Long hstUid) {
|
||||||
MapSheetMngHstEntity entity =
|
MapSheetMngHstEntity entity =
|
||||||
mapSheetMngRepository
|
mapSheetMngRepository
|
||||||
.findMapSheetMngHstInfo(hstUid)
|
.findMapSheetMngHstInfo(hstUid)
|
||||||
.orElseThrow(() -> new EntityNotFoundException("해당 이력이 존재하지 않습니다."));
|
.orElseThrow(() -> new EntityNotFoundException("해당 이력이 존재하지 않습니다."));
|
||||||
|
|
||||||
String localPath = "";
|
String localPath = "";
|
||||||
String rootDir = ORIGINAL_IMAGES_PATH + "/" + entity.getMngYyyy();
|
String rootDir = ORIGINAL_IMAGES_PATH + "/" + entity.getMngYyyy();
|
||||||
@@ -62,7 +62,7 @@ public class MapSheetMngCoreService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String originalFilename = file.getOriginalFilename();
|
String originalFilename = file.getOriginalFilename();
|
||||||
if (originalFilename == null || originalFilename.isBlank()) {
|
if (originalFilename == null) {
|
||||||
throw new IllegalArgumentException("파일명이 없습니다.");
|
throw new IllegalArgumentException("파일명이 없습니다.");
|
||||||
}
|
}
|
||||||
Path filePath = uploadPath.resolve(originalFilename);
|
Path filePath = uploadPath.resolve(originalFilename);
|
||||||
@@ -88,48 +88,54 @@ public class MapSheetMngCoreService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public MapSheetMngDto.DmlReturn uploadProcess(@Valid List<Long> hstUidList) {
|
public MapSheetMngDto.DmlReturn uploadProcess(@Valid List<Long> hstUidList) {
|
||||||
if (Objects.isNull(hstUidList) || hstUidList.isEmpty()) {
|
int count = 0;
|
||||||
throw new IllegalArgumentException("처리할 대상이 없습니다.");
|
if (!Objects.isNull(hstUidList) && !hstUidList.isEmpty()) {
|
||||||
}
|
for (Long hstUid : hstUidList) {
|
||||||
int successCount = 0;
|
Optional<MapSheetMngHstEntity> entity =
|
||||||
int failCount = 0;
|
Optional.ofNullable(
|
||||||
|
mapSheetMngRepository
|
||||||
for (Long hstUid : hstUidList) {
|
|
||||||
MapSheetMngHstEntity hst =
|
|
||||||
mapSheetMngRepository
|
|
||||||
.findMapSheetMngHstInfo(hstUid)
|
.findMapSheetMngHstInfo(hstUid)
|
||||||
.orElseThrow(() -> new EntityNotFoundException("해당 이력이 존재하지 않습니다."));
|
.orElseThrow(EntityNotFoundException::new));
|
||||||
|
|
||||||
String localPath = ""; // 필요 시 로컬 테스트 경로 설정
|
// TODO: local TEST 시 각자 경로 수정하기
|
||||||
String rootDir = ORIGINAL_IMAGES_PATH + "/" + hst.getMngYyyy();
|
// TODO: application.yml 에 active profile : local 로 임시 변경하여 테스트
|
||||||
if ("local".equals(activeEnv)) {
|
String localPath = "";
|
||||||
rootDir = localPath + rootDir;
|
// String localPath = "C:\\Users\\gypark\\Desktop\\file";
|
||||||
}
|
String rootDir = ORIGINAL_IMAGES_PATH + "/" + entity.get().getMngYyyy();
|
||||||
|
if (activeEnv.equals("local")) {
|
||||||
|
rootDir = localPath + rootDir;
|
||||||
|
}
|
||||||
|
|
||||||
String filename = hst.getMapSheetNum();
|
String filename = entity.get().getMapSheetNum();
|
||||||
String[] extensions = {"tif", "tfw"};
|
String[] extensions = {"tif", "tfw"};
|
||||||
boolean existBoth = allExtensionsExist(rootDir, filename, extensions);
|
boolean flag = allExtensionsExist(rootDir, filename, extensions);
|
||||||
|
if (flag) {
|
||||||
|
count += 1;
|
||||||
|
}
|
||||||
|
|
||||||
String state = existBoth ? "SUCCESS" : "NOT";
|
/*
|
||||||
mapSheetMngRepository.updateUploadProcessResult(hstUid, state);
|
MapSheetMngDto.DataState dataState =
|
||||||
|
flag ? MapSheetMngDto.DataState.SUCCESS : MapSheetMngDto.DataState.FAIL;
|
||||||
if (existBoth) {
|
entity.get().updateDataState(dataState);
|
||||||
successCount++;
|
*/
|
||||||
} else {
|
|
||||||
failCount++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return new MapSheetMngDto.DmlReturn("success", count + "개 업로드 성공하였습니다.");
|
||||||
String msg = String.format("업로드 처리 완료: 성공 %d건, 실패 %d건", successCount, failCount);
|
|
||||||
return new MapSheetMngDto.DmlReturn("success", msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MapSheetMngDto.DmlReturn updateExceptUseInference(@Valid List<Long> hstUidList) {
|
public MapSheetMngDto.DmlReturn updateExceptUseInference(@Valid List<Long> hstUidList) {
|
||||||
if (Objects.isNull(hstUidList) || hstUidList.isEmpty()) {
|
if (!Objects.isNull(hstUidList) && !hstUidList.isEmpty()) {
|
||||||
throw new IllegalArgumentException("처리할 대상이 없습니다.");
|
for (Long hstUid : hstUidList) {
|
||||||
|
Optional<MapSheetMngHstEntity> entity =
|
||||||
|
Optional.ofNullable(
|
||||||
|
mapSheetMngRepository
|
||||||
|
.findMapSheetMngHstInfo(hstUid)
|
||||||
|
.orElseThrow(EntityNotFoundException::new));
|
||||||
|
|
||||||
|
// entity.get().updateUseInference(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
long updated = mapSheetMngRepository.updateExceptUseInference(hstUidList);
|
return new MapSheetMngDto.DmlReturn("success", hstUidList.size() + "개 추론제외 업데이트 하였습니다.");
|
||||||
return new MapSheetMngDto.DmlReturn("success", updated + "개 추론제외 업데이트 하였습니다.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -145,10 +151,10 @@ public class MapSheetMngCoreService {
|
|||||||
|
|
||||||
// 모든 파일명을 Set으로 저장
|
// 모든 파일명을 Set으로 저장
|
||||||
Set<String> fileNames =
|
Set<String> fileNames =
|
||||||
paths
|
paths
|
||||||
.filter(Files::isRegularFile)
|
.filter(Files::isRegularFile)
|
||||||
.map(p -> p.getFileName().toString())
|
.map(p -> p.getFileName().toString())
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
// 모든 확장자 파일 존재 여부 확인
|
// 모든 확장자 파일 존재 여부 확인
|
||||||
for (String ext : extensions) {
|
for (String ext : extensions) {
|
||||||
|
|||||||
Reference in New Issue
Block a user