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:
DanielLee
2025-12-12 11:29:53 +09:00
2 changed files with 55 additions and 49 deletions

View File

@@ -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);

View File

@@ -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,8 +30,7 @@ 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(
@@ -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()) {
}
int successCount = 0;
int failCount = 0;
for (Long hstUid : hstUidList) { for (Long hstUid : hstUidList) {
MapSheetMngHstEntity hst = Optional<MapSheetMngHstEntity> entity =
Optional.ofNullable(
mapSheetMngRepository 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 = "";
// String localPath = "C:\\Users\\gypark\\Desktop\\file";
String rootDir = ORIGINAL_IMAGES_PATH + "/" + entity.get().getMngYyyy();
if (activeEnv.equals("local")) {
rootDir = localPath + rootDir; 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) {
String state = existBoth ? "SUCCESS" : "NOT"; count += 1;
mapSheetMngRepository.updateUploadProcessResult(hstUid, state);
if (existBoth) {
successCount++;
} else {
failCount++;
}
} }
String msg = String.format("업로드 처리 완료: 성공 %d건, 실패 %d건", successCount, failCount); /*
return new MapSheetMngDto.DmlReturn("success", msg); MapSheetMngDto.DataState dataState =
flag ? MapSheetMngDto.DataState.SUCCESS : MapSheetMngDto.DataState.FAIL;
entity.get().updateDataState(dataState);
*/
}
}
return new MapSheetMngDto.DmlReturn("success", count + "개 업로드 성공하였습니다.");
} }
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", updated + "개 추론제외 업데이트 하였습니다."); return new MapSheetMngDto.DmlReturn("success", hstUidList.size() + "개 추론제외 업데이트 하였습니다.");
} }
/** /**