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)
|
||||
.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 로 저장된 패스워드 비교
|
||||
if (!BCrypt.checkpw(rawPassword, member.getPassword())) {
|
||||
// 실패 카운트 저장
|
||||
@@ -44,11 +49,6 @@ public class CustomAuthenticationProvider implements AuthenticationProvider {
|
||||
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) {
|
||||
throw new CustomApiException(AuthErrorCode.LOGIN_PASSWORD_EXCEEDED);
|
||||
|
||||
@@ -12,6 +12,7 @@ import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
@@ -29,25 +30,24 @@ public class MapSheetMngCoreService {
|
||||
|
||||
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;
|
||||
|
||||
public Page<MapSheetMngDto.ErrorDataDto> findMapSheetErrorList(
|
||||
MapSheetMngDto.@Valid searchReq searchReq) {
|
||||
MapSheetMngDto.@Valid searchReq searchReq) {
|
||||
return mapSheetMngRepository.findMapSheetErrorList(searchReq);
|
||||
}
|
||||
|
||||
public Page<MapSheetMngDto.MngDto> findMapSheetMngList(
|
||||
MapSheetMngDto.@Valid searchReq searchReq) {
|
||||
MapSheetMngDto.@Valid searchReq searchReq) {
|
||||
return mapSheetMngRepository.findMapSheetMngList(searchReq);
|
||||
}
|
||||
|
||||
public MapSheetMngDto.DmlReturn uploadFile(MultipartFile file, Long hstUid) {
|
||||
MapSheetMngHstEntity entity =
|
||||
mapSheetMngRepository
|
||||
.findMapSheetMngHstInfo(hstUid)
|
||||
.orElseThrow(() -> new EntityNotFoundException("해당 이력이 존재하지 않습니다."));
|
||||
mapSheetMngRepository
|
||||
.findMapSheetMngHstInfo(hstUid)
|
||||
.orElseThrow(() -> new EntityNotFoundException("해당 이력이 존재하지 않습니다."));
|
||||
|
||||
String localPath = "";
|
||||
String rootDir = ORIGINAL_IMAGES_PATH + "/" + entity.getMngYyyy();
|
||||
@@ -62,7 +62,7 @@ public class MapSheetMngCoreService {
|
||||
}
|
||||
|
||||
String originalFilename = file.getOriginalFilename();
|
||||
if (originalFilename == null || originalFilename.isBlank()) {
|
||||
if (originalFilename == null) {
|
||||
throw new IllegalArgumentException("파일명이 없습니다.");
|
||||
}
|
||||
Path filePath = uploadPath.resolve(originalFilename);
|
||||
@@ -88,48 +88,54 @@ public class MapSheetMngCoreService {
|
||||
}
|
||||
|
||||
public MapSheetMngDto.DmlReturn uploadProcess(@Valid List<Long> hstUidList) {
|
||||
if (Objects.isNull(hstUidList) || hstUidList.isEmpty()) {
|
||||
throw new IllegalArgumentException("처리할 대상이 없습니다.");
|
||||
}
|
||||
int successCount = 0;
|
||||
int failCount = 0;
|
||||
|
||||
for (Long hstUid : hstUidList) {
|
||||
MapSheetMngHstEntity hst =
|
||||
mapSheetMngRepository
|
||||
int count = 0;
|
||||
if (!Objects.isNull(hstUidList) && !hstUidList.isEmpty()) {
|
||||
for (Long hstUid : hstUidList) {
|
||||
Optional<MapSheetMngHstEntity> entity =
|
||||
Optional.ofNullable(
|
||||
mapSheetMngRepository
|
||||
.findMapSheetMngHstInfo(hstUid)
|
||||
.orElseThrow(() -> new EntityNotFoundException("해당 이력이 존재하지 않습니다."));
|
||||
.orElseThrow(EntityNotFoundException::new));
|
||||
|
||||
String localPath = ""; // 필요 시 로컬 테스트 경로 설정
|
||||
String rootDir = ORIGINAL_IMAGES_PATH + "/" + hst.getMngYyyy();
|
||||
if ("local".equals(activeEnv)) {
|
||||
rootDir = localPath + rootDir;
|
||||
}
|
||||
// TODO: local TEST 시 각자 경로 수정하기
|
||||
// TODO: application.yml 에 active profile : local 로 임시 변경하여 테스트
|
||||
String localPath = "";
|
||||
// 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[] extensions = {"tif", "tfw"};
|
||||
boolean existBoth = allExtensionsExist(rootDir, filename, extensions);
|
||||
String filename = entity.get().getMapSheetNum();
|
||||
String[] extensions = {"tif", "tfw"};
|
||||
boolean flag = allExtensionsExist(rootDir, filename, extensions);
|
||||
if (flag) {
|
||||
count += 1;
|
||||
}
|
||||
|
||||
String state = existBoth ? "SUCCESS" : "NOT";
|
||||
mapSheetMngRepository.updateUploadProcessResult(hstUid, state);
|
||||
|
||||
if (existBoth) {
|
||||
successCount++;
|
||||
} else {
|
||||
failCount++;
|
||||
/*
|
||||
MapSheetMngDto.DataState dataState =
|
||||
flag ? MapSheetMngDto.DataState.SUCCESS : MapSheetMngDto.DataState.FAIL;
|
||||
entity.get().updateDataState(dataState);
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
String msg = String.format("업로드 처리 완료: 성공 %d건, 실패 %d건", successCount, failCount);
|
||||
return new MapSheetMngDto.DmlReturn("success", msg);
|
||||
return new MapSheetMngDto.DmlReturn("success", count + "개 업로드 성공하였습니다.");
|
||||
}
|
||||
|
||||
public MapSheetMngDto.DmlReturn updateExceptUseInference(@Valid List<Long> hstUidList) {
|
||||
if (Objects.isNull(hstUidList) || hstUidList.isEmpty()) {
|
||||
throw new IllegalArgumentException("처리할 대상이 없습니다.");
|
||||
if (!Objects.isNull(hstUidList) && !hstUidList.isEmpty()) {
|
||||
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() + "개 추론제외 업데이트 하였습니다.");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -145,10 +151,10 @@ public class MapSheetMngCoreService {
|
||||
|
||||
// 모든 파일명을 Set으로 저장
|
||||
Set<String> fileNames =
|
||||
paths
|
||||
.filter(Files::isRegularFile)
|
||||
.map(p -> p.getFileName().toString())
|
||||
.collect(Collectors.toSet());
|
||||
paths
|
||||
.filter(Files::isRegularFile)
|
||||
.map(p -> p.getFileName().toString())
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
// 모든 확장자 파일 존재 여부 확인
|
||||
for (String ext : extensions) {
|
||||
|
||||
Reference in New Issue
Block a user