Redis Cache Status Error Fix
This commit is contained in:
@@ -13,8 +13,7 @@ import org.springframework.stereotype.Component;
|
||||
/**
|
||||
* 공통코드 캐시 관리 및 초기화 클래스
|
||||
*
|
||||
* <p>애플리케이션 시작 시 공통코드를 Redis 캐시에 미리 로드하고, 캐시 갱신을 관리합니다.
|
||||
* 기존 Redis 데이터와의 호환성 문제로 인한 간헐적 오류를 방지합니다.
|
||||
* <p>애플리케이션 시작 시 공통코드를 Redis 캐시에 미리 로드하고, 캐시 갱신을 관리합니다. 기존 Redis 데이터와의 호환성 문제로 인한 간헐적 오류를 방지합니다.
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@@ -29,9 +28,8 @@ public class CommonCodeCacheManager {
|
||||
/**
|
||||
* 애플리케이션 시작 완료 후 공통코드를 Redis 캐시에 미리 로드
|
||||
*
|
||||
* <p>이 메서드는 Spring 애플리케이션이 완전히 시작된 후에 자동으로 실행되며, 공통코드 데이터를 Redis
|
||||
* 캐시에 미리 로드하여 초기 조회 시 성능을 최적화합니다. 기존 캐시 데이터 호환성 문제를 대비하여 먼저
|
||||
* 캐시를 초기화한 후 재로드합니다.
|
||||
* <p>이 메서드는 Spring 애플리케이션이 완전히 시작된 후에 자동으로 실행되며, 공통코드 데이터를 Redis 캐시에 미리 로드하여 초기 조회 시 성능을 최적화합니다.
|
||||
* 기존 캐시 데이터 호환성 문제를 대비하여 먼저 캐시를 초기화한 후 재로드합니다.
|
||||
*/
|
||||
@EventListener(ApplicationReadyEvent.class)
|
||||
public void initializeCommonCodeCache() {
|
||||
@@ -48,27 +46,18 @@ public class CommonCodeCacheManager {
|
||||
|
||||
// 2. DB에서 새로운 데이터 로드 (캐시 미스 상태)
|
||||
List<Basic> allCommonCodes = commonCodeService.getFindAll();
|
||||
log.info(
|
||||
"✓ 공통코드 {}개를 DB에서 로드하고 Redis 캐시에 저장했습니다.",
|
||||
allCommonCodes.size());
|
||||
log.info("✓ 공통코드 {}개를 DB에서 로드하고 Redis 캐시에 저장했습니다.", allCommonCodes.size());
|
||||
|
||||
// 3. 로그 출력 (DEBUG 레벨)
|
||||
if (log.isDebugEnabled()) {
|
||||
allCommonCodes.forEach(
|
||||
code ->
|
||||
log.debug(
|
||||
" - [{}] {} (ID: {})",
|
||||
code.getCode(),
|
||||
code.getName(),
|
||||
code.getId()));
|
||||
log.debug(" - [{}] {} (ID: {})", code.getCode(), code.getName(), code.getId()));
|
||||
}
|
||||
|
||||
log.info("=== 공통코드 캐시 초기화 완료 ===");
|
||||
} catch (Exception e) {
|
||||
log.warn(
|
||||
"공통코드 캐시 초기화 중 오류 발생했습니다. 캐시 없이 계속 진행합니다. "
|
||||
+ "(첫 번째 조회 시 DB에서 로드되고 캐시됩니다.)",
|
||||
e);
|
||||
log.warn("공통코드 캐시 초기화 중 오류 발생했습니다. 캐시 없이 계속 진행합니다. " + "(첫 번째 조회 시 DB에서 로드되고 캐시됩니다.)", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,11 +109,32 @@ public class CommonCodeCacheManager {
|
||||
* @return 캐시에 있는 공통코드 개수
|
||||
*/
|
||||
public int getCachedCommonCodeCount() {
|
||||
try {
|
||||
// 캐시 오류 시 자동으로 재초기화
|
||||
try {
|
||||
List<Basic> cachedCodes = commonCodeService.getFindAll();
|
||||
return cachedCodes.size();
|
||||
} catch (Exception cacheError) {
|
||||
log.debug("캐시 조회 중 호환성 오류 감지, 캐시 재초기화 중...: {}", cacheError.getMessage());
|
||||
|
||||
// 기존 호환성 문제가 있는 캐시 데이터 강제 제거
|
||||
try {
|
||||
var cache = cacheManager.getCache(COMMON_CODES_CACHE_NAME);
|
||||
if (cache != null) {
|
||||
cache.clear();
|
||||
log.debug("✓ 호환되지 않는 캐시 데이터 제거 완료");
|
||||
}
|
||||
} catch (Exception clearEx) {
|
||||
log.debug("캐시 정리 중 예외: {}", clearEx.getMessage());
|
||||
}
|
||||
|
||||
// 재시도
|
||||
List<Basic> cachedCodes = commonCodeService.getFindAll();
|
||||
log.info("✓ 캐시 재초기화 완료, 공통코드 {}개 로드됨", cachedCodes.size());
|
||||
return cachedCodes.size();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("캐시 상태 확인 중 오류 발생: {}", e.getMessage());
|
||||
log.warn("캐시 상태 확인 중 최종 오류 발생: {}", e.getMessage());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,8 +13,6 @@ import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import org.geotools.coverage.grid.GridCoverage2D;
|
||||
import org.geotools.gce.geotiff.GeoTiffReader;
|
||||
|
||||
@@ -47,7 +45,6 @@ public class FIleChecker {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static boolean verifyFileIntegrity(Path path, String expectedHash)
|
||||
throws IOException, NoSuchAlgorithmException {
|
||||
|
||||
@@ -72,7 +69,6 @@ public class FIleChecker {
|
||||
return actualHash.equalsIgnoreCase(expectedHash);
|
||||
}
|
||||
|
||||
|
||||
public static boolean checkTfw(String filePath) {
|
||||
|
||||
File file = new File(filePath);
|
||||
@@ -90,13 +86,13 @@ public class FIleChecker {
|
||||
lines.add(Double.parseDouble(line.trim()));
|
||||
}
|
||||
}
|
||||
}catch (IOException ignored) {
|
||||
} catch (IOException ignored) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 2. 6줄이 맞는지 확인
|
||||
if (lines.size() < 6) {
|
||||
//System.out.println("유효하지 않은 TFW 파일입니다. (데이터 부족)");
|
||||
// System.out.println("유효하지 않은 TFW 파일입니다. (데이터 부족)");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -123,9 +119,9 @@ public class FIleChecker {
|
||||
if (coverage == null) return false;
|
||||
|
||||
// 3. GIS 필수 정보(좌표계)가 있는지 확인
|
||||
//if (coverage.getCoordinateReferenceSystem() == null) {
|
||||
// if (coverage.getCoordinateReferenceSystem() == null) {
|
||||
// GeoTIFF가 아니라 일반 TIFF일 수도 있음(이미지는 정상이지만, 좌표계(CRS) 정보가 없습니다.)
|
||||
//}
|
||||
// }
|
||||
|
||||
return true;
|
||||
|
||||
@@ -150,14 +146,14 @@ public class FIleChecker {
|
||||
boolean hasDriver = false;
|
||||
|
||||
// 리눅스/맥용
|
||||
//ProcessBuilder pb = new ProcessBuilder("sh", "-c", "gdalinfo "+filePath+" | grep -i 'Geo'");
|
||||
// ProcessBuilder pb = new ProcessBuilder("sh", "-c", "gdalinfo "+filePath+" | grep -i 'Geo'");
|
||||
|
||||
List<String> command = new ArrayList<>();
|
||||
|
||||
//윈도우용
|
||||
// 윈도우용
|
||||
command.add("cmd.exe"); // 윈도우 명령 프롬프트 실행
|
||||
command.add("/c"); // 명령어를 수행하고 종료한다는 옵션
|
||||
//command.add("C:\\Program Files\\QGIS 3.44.4\\bin\\gdalinfo");
|
||||
// command.add("C:\\Program Files\\QGIS 3.44.4\\bin\\gdalinfo");
|
||||
command.add("gdalinfo");
|
||||
command.add(filePath);
|
||||
command.add("|");
|
||||
@@ -183,13 +179,12 @@ public class FIleChecker {
|
||||
Process process = processBuilder.start();
|
||||
|
||||
// 인코딩은 윈도우 한글 환경에 맞게 MS949로 지정
|
||||
BufferedReader reader = new BufferedReader(
|
||||
new InputStreamReader(process.getInputStream()));
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
||||
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
//System.out.println(line);
|
||||
if( line.contains("Driver: GTiff/GeoTIFF")) {
|
||||
// System.out.println(line);
|
||||
if (line.contains("Driver: GTiff/GeoTIFF")) {
|
||||
hasDriver = true;
|
||||
break;
|
||||
}
|
||||
@@ -203,5 +198,4 @@ public class FIleChecker {
|
||||
|
||||
return hasDriver;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -189,7 +189,6 @@ public class GlobalExceptionHandler {
|
||||
errorLog.getId());
|
||||
}
|
||||
|
||||
|
||||
@ResponseStatus(HttpStatus.BAD_GATEWAY)
|
||||
@ExceptionHandler(HttpServerErrorException.BadGateway.class)
|
||||
public ApiResponseDto<String> handlerHttpServerErrorException(
|
||||
@@ -314,11 +313,9 @@ public class GlobalExceptionHandler {
|
||||
errorLog.getId());
|
||||
}
|
||||
|
||||
|
||||
@ExceptionHandler(BadCredentialsException.class)
|
||||
public ResponseEntity<ApiResponseDto<String>> handleBadCredentials(
|
||||
BadCredentialsException e, HttpServletRequest request
|
||||
) {
|
||||
BadCredentialsException e, HttpServletRequest request) {
|
||||
log.warn("[BadCredentialsException] resource : {} ", e.getMessage());
|
||||
|
||||
String codeName = "UNAUTHORIZED";
|
||||
@@ -338,8 +335,7 @@ public class GlobalExceptionHandler {
|
||||
HttpStatus.valueOf(codeName),
|
||||
errorLog.getId());
|
||||
|
||||
return ResponseEntity
|
||||
.status(HttpStatus.UNAUTHORIZED) // 🔥 여기서 401 지정
|
||||
return ResponseEntity.status(HttpStatus.UNAUTHORIZED) // 🔥 여기서 401 지정
|
||||
.body(body);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.fasterxml.jackson.databind.jsontype.BasicPolymorphicTypeValidator;
|
||||
import com.fasterxml.jackson.databind.jsontype.PolymorphicTypeValidator;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import java.time.Duration;
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.cache.CacheManager;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
@@ -81,15 +82,21 @@ public class RedisConfig {
|
||||
cacheObjectMapper.registerModule(new JavaTimeModule());
|
||||
cacheObjectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
|
||||
cacheObjectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
|
||||
// 알 수 없는 타입에 대해 더 유연하게 처리
|
||||
cacheObjectMapper.enable(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS);
|
||||
cacheObjectMapper.findAndRegisterModules();
|
||||
|
||||
// 타입 정보 포함 - JAVA_LANG_OBJECT로 제한적으로 적용
|
||||
// 호환성 문제 해결을 위해 더 많은 타입 허용
|
||||
PolymorphicTypeValidator ptv =
|
||||
BasicPolymorphicTypeValidator.builder()
|
||||
.allowIfSubType("com.kamco.cd.kamcoback")
|
||||
.allowIfSubType("org.springframework.data.domain")
|
||||
.allowIfSubType("java.util")
|
||||
.allowIfSubType("java.time")
|
||||
.allowIfSubType("java.lang")
|
||||
.allowIfBaseType(List.class)
|
||||
.allowIfBaseType("com.kamco.cd.kamcoback.code.dto.CommonCodeDto$Basic")
|
||||
.build();
|
||||
cacheObjectMapper.activateDefaultTyping(ptv, ObjectMapper.DefaultTyping.JAVA_LANG_OBJECT);
|
||||
|
||||
|
||||
@@ -52,7 +52,6 @@ public class SecurityConfig {
|
||||
jwtAuthenticationFilter,
|
||||
UsernamePasswordAuthenticationFilter
|
||||
.class) // 요청 들어오면 먼저 JWT 토큰 검사 후 security context 에 사용자 정보 저장.
|
||||
|
||||
;
|
||||
|
||||
return http.build();
|
||||
|
||||
@@ -9,8 +9,5 @@ import org.springframework.context.annotation.Configuration;
|
||||
name = "BearerAuth",
|
||||
type = SecuritySchemeType.HTTP,
|
||||
scheme = "bearer",
|
||||
bearerFormat = "JWT"
|
||||
)
|
||||
public class SwaggerConfig {
|
||||
|
||||
}
|
||||
bearerFormat = "JWT")
|
||||
public class SwaggerConfig {}
|
||||
|
||||
@@ -57,12 +57,13 @@ public class ApiResponseAdvice implements ResponseBodyAdvice<Object> {
|
||||
Long userid = null;
|
||||
|
||||
/**
|
||||
* servletRequest.getUserPrincipal() instanceof UsernamePasswordAuthenticationToken auth
|
||||
* 이 요청이 JWT 인증을 통과한 요청인가? 그리고 Spring Security Authentication 객체가 UsernamePasswordAuthenticationToken 타입인가? 체크
|
||||
* servletRequest.getUserPrincipal() instanceof UsernamePasswordAuthenticationToken auth 이 요청이
|
||||
* JWT 인증을 통과한 요청인가? 그리고 Spring Security Authentication 객체가
|
||||
* UsernamePasswordAuthenticationToken 타입인가? 체크
|
||||
*/
|
||||
/**
|
||||
* auth.getPrincipal() instanceof CustomUserDetails customUserDetails
|
||||
* principal 안에 들어있는 객체가 내가 만든 CustomUserDetails 타입인가? 체크
|
||||
* auth.getPrincipal() instanceof CustomUserDetails customUserDetails principal 안에 들어있는 객체가 내가
|
||||
* 만든 CustomUserDetails 타입인가? 체크
|
||||
*/
|
||||
if (servletRequest.getUserPrincipal() instanceof UsernamePasswordAuthenticationToken auth
|
||||
&& auth.getPrincipal() instanceof CustomUserDetails customUserDetails) {
|
||||
|
||||
@@ -3,12 +3,6 @@ package com.kamco.cd.kamcoback.mapsheet;
|
||||
import com.kamco.cd.kamcoback.code.dto.CommonCodeDto;
|
||||
import com.kamco.cd.kamcoback.code.service.CommonCodeService;
|
||||
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.FileDto.FilesDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.FileDto.FoldersDto;
|
||||
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.FileDto.SrchFoldersDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.ImageryDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.service.MapSheetMngService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@@ -63,7 +57,6 @@ public class MapSheetMngApiController {
|
||||
return ApiResponseDto.ok(mapSheetMngService.findMapSheetMngList(searchReq));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param hstUidList
|
||||
* @return
|
||||
|
||||
@@ -9,9 +9,7 @@ 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.FileDto.SrchFoldersDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.ImageryDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.service.MapSheetMngFileCheckerService;
|
||||
import com.kamco.cd.kamcoback.mapsheet.service.MapSheetMngService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@@ -19,11 +17,8 @@ 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.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
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.RestController;
|
||||
@@ -93,7 +88,6 @@ public class MapSheetMngFileCheckerApiController {
|
||||
return ApiResponseDto.createOK(mapSheetMngFileCheckerService.getFilesDepthAll(srchDto));
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "영상데이터관리 > 영상파일 동기화", description = "영상파일 동기화")
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@@ -112,7 +106,4 @@ public class MapSheetMngFileCheckerApiController {
|
||||
@RequestBody @Valid ImageryDto.searchReq searchReq) {
|
||||
return ApiResponseDto.ok(mapSheetMngFileCheckerService.syncProcess(searchReq));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package com.kamco.cd.kamcoback.mapsheet.dto;
|
||||
|
||||
import com.kamco.cd.kamcoback.config.enums.EnumType;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.UUID;
|
||||
@@ -10,10 +8,8 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
|
||||
public class ImageryDto {
|
||||
|
||||
@@ -43,7 +39,9 @@ public class ImageryDto {
|
||||
@NotNull
|
||||
private Integer mngYyyy;
|
||||
|
||||
public Pageable toPageable() {return PageRequest.of(page, size);}
|
||||
public Pageable toPageable() {
|
||||
return PageRequest.of(page, size);
|
||||
}
|
||||
}
|
||||
|
||||
@Schema(name = "ImageryDto", description = "영상관리파일 검색 리턴")
|
||||
@@ -94,7 +92,4 @@ public class ImageryDto {
|
||||
private int tfwErrCnt;
|
||||
private int tifErrCnt;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ 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.FileDto.SrchFoldersDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.ImageryDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
||||
import com.kamco.cd.kamcoback.postgres.core.MapSheetMngFileCheckerCoreService;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -302,9 +301,7 @@ public class MapSheetMngFileCheckerService {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public ImageryDto.SyncReturn syncProcess(ImageryDto.searchReq searchReq) {
|
||||
return mapSheetMngFileCheckerCoreService.syncProcess(searchReq);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,15 +2,10 @@ package com.kamco.cd.kamcoback.mapsheet.service;
|
||||
|
||||
import static java.lang.String.CASE_INSENSITIVE_ORDER;
|
||||
|
||||
import com.kamco.cd.kamcoback.common.utils.NameValidator;
|
||||
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.FolderDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.FileDto.FoldersDto;
|
||||
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.FileDto.SrchFoldersDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.ImageryDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
||||
import com.kamco.cd.kamcoback.postgres.core.MapSheetMngCoreService;
|
||||
import jakarta.validation.Valid;
|
||||
@@ -42,8 +37,6 @@ public class MapSheetMngService {
|
||||
|
||||
private final MapSheetMngCoreService mapSheetMngCoreService;
|
||||
|
||||
|
||||
|
||||
public FilesDto getFilesAll(SrchFilesDto srchDto) {
|
||||
|
||||
String dirPath = srchDto.getDirPath();
|
||||
@@ -236,7 +229,4 @@ public class MapSheetMngService {
|
||||
public MapSheetMngDto.DmlReturn updateExceptUseInference(@Valid List<Long> hstUidList) {
|
||||
return mapSheetMngCoreService.updateExceptUseInference(hstUidList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -141,10 +141,9 @@ public class AdminApiController {
|
||||
@Content(
|
||||
mediaType = "application/json",
|
||||
schema = @Schema(implementation = MembersDto.StatusDto.class)))
|
||||
@PathVariable UUID uuid,
|
||||
@RequestBody
|
||||
@Valid
|
||||
MembersDto.StatusDto statusDto) {
|
||||
@PathVariable
|
||||
UUID uuid,
|
||||
@RequestBody @Valid MembersDto.StatusDto statusDto) {
|
||||
adminService.updateStatus(uuid, statusDto);
|
||||
return ApiResponseDto.createOK(uuid);
|
||||
}
|
||||
|
||||
@@ -101,7 +101,8 @@ public class AuthController {
|
||||
description = "만료되었거나 유효하지 않은 리프레시 토큰",
|
||||
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
|
||||
})
|
||||
public ResponseEntity<TokenResponse> refresh(String refreshToken, HttpServletResponse response) throws AccessDeniedException {
|
||||
public ResponseEntity<TokenResponse> refresh(String refreshToken, HttpServletResponse response)
|
||||
throws AccessDeniedException {
|
||||
if (refreshToken == null || !jwtTokenProvider.isValidToken(refreshToken)) {
|
||||
throw new AccessDeniedException("만료되었거나 유효하지 않은 리프레시 토큰 입니다.");
|
||||
}
|
||||
@@ -143,7 +144,8 @@ public class AuthController {
|
||||
description = "로그아웃 성공",
|
||||
content = @Content(schema = @Schema(implementation = Void.class)))
|
||||
})
|
||||
public ApiResponseDto<ResponseEntity<Object>> logout(Authentication authentication, HttpServletResponse response) {
|
||||
public ApiResponseDto<ResponseEntity<Object>> logout(
|
||||
Authentication authentication, HttpServletResponse response) {
|
||||
if (authentication != null) {
|
||||
String username = authentication.getName();
|
||||
// Redis에서 RefreshToken 삭제
|
||||
@@ -164,7 +166,5 @@ public class AuthController {
|
||||
return ApiResponseDto.createOK(ResponseEntity.noContent().build());
|
||||
}
|
||||
|
||||
public record TokenResponse(String accessToken) {
|
||||
|
||||
}
|
||||
public record TokenResponse(String accessToken) {}
|
||||
}
|
||||
|
||||
@@ -28,10 +28,8 @@ public class MembersDto {
|
||||
private String email;
|
||||
private String status;
|
||||
private String roleName;
|
||||
@JsonFormatDttm
|
||||
private ZonedDateTime createdDttm;
|
||||
@JsonFormatDttm
|
||||
private ZonedDateTime updatedDttm;
|
||||
@JsonFormatDttm private ZonedDateTime createdDttm;
|
||||
@JsonFormatDttm private ZonedDateTime updatedDttm;
|
||||
|
||||
public Basic(
|
||||
Long id,
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.kamco.cd.kamcoback.postgres.core;
|
||||
|
||||
import com.kamco.cd.kamcoback.common.utils.FIleChecker;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.ImageryDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetMngHstEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.repository.mapsheet.MapSheetMngRepository;
|
||||
@@ -124,8 +122,4 @@ public class MapSheetMngCoreService {
|
||||
throw new RuntimeException("File search error", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2,23 +2,7 @@ package com.kamco.cd.kamcoback.postgres.core;
|
||||
|
||||
import com.kamco.cd.kamcoback.common.utils.FIleChecker;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.ImageryDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetMngHstEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.repository.mapsheet.MapSheetMngFileCheckerRepository;
|
||||
import com.kamco.cd.kamcoback.postgres.repository.mapsheet.MapSheetMngRepository;
|
||||
import jakarta.persistence.EntityNotFoundException;
|
||||
import jakarta.validation.Valid;
|
||||
import java.io.File;
|
||||
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.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -35,36 +19,35 @@ public class MapSheetMngFileCheckerCoreService {
|
||||
@Value("{spring.profiles.active}")
|
||||
private String activeEnv;
|
||||
|
||||
|
||||
public ImageryDto.SyncReturn syncProcess(ImageryDto.searchReq searchReq) {
|
||||
String flag = "SUCCESS";
|
||||
int syncCnt = 0;
|
||||
int tfwErrCnt = 0;
|
||||
int tifErrCnt = 0;
|
||||
|
||||
//대상파일목록 가저오기
|
||||
Page<ImageryDto.SyncDto> pageImagerySyncDto = mapSheetMngFileCheckerRepository.findImagerySyncList(searchReq);
|
||||
// 대상파일목록 가저오기
|
||||
Page<ImageryDto.SyncDto> pageImagerySyncDto =
|
||||
mapSheetMngFileCheckerRepository.findImagerySyncList(searchReq);
|
||||
|
||||
for (ImageryDto.SyncDto dto : pageImagerySyncDto.getContent()) {
|
||||
|
||||
boolean isTfwFile = true;
|
||||
isTfwFile = FIleChecker.checkTfw(dto.getMiddlePath()+dto.getFilename());
|
||||
isTfwFile = FIleChecker.checkTfw(dto.getMiddlePath() + dto.getFilename());
|
||||
|
||||
boolean isGdalInfoTiffFile = true;
|
||||
isGdalInfoTiffFile = FIleChecker.cmmndGdalInfo(dto.getCogMiddlePath()+dto.getCogFilename());
|
||||
//isGdalInfoTiffFile = FIleChecker.cmmndGdalInfo("D:/kamco_cog/36713/36713073_cog.tif");
|
||||
isGdalInfoTiffFile = FIleChecker.cmmndGdalInfo(dto.getCogMiddlePath() + dto.getCogFilename());
|
||||
// isGdalInfoTiffFile = FIleChecker.cmmndGdalInfo("D:/kamco_cog/36713/36713073_cog.tif");
|
||||
|
||||
syncCnt = syncCnt + 1;
|
||||
if( !isTfwFile )tfwErrCnt = tfwErrCnt + 1;
|
||||
if( !isGdalInfoTiffFile )tifErrCnt = tifErrCnt + 1;
|
||||
if (!isTfwFile) tfwErrCnt = tfwErrCnt + 1;
|
||||
if (!isGdalInfoTiffFile) tifErrCnt = tifErrCnt + 1;
|
||||
|
||||
// 예: 특정 작업 수행
|
||||
// someService.process(dto);
|
||||
}
|
||||
|
||||
if( tfwErrCnt > 0 || tifErrCnt > 0 )flag = "ERROR";
|
||||
if (tfwErrCnt > 0 || tifErrCnt > 0) flag = "ERROR";
|
||||
|
||||
return new ImageryDto.SyncReturn(flag, syncCnt, tfwErrCnt, tifErrCnt);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -142,9 +142,7 @@ public class MembersCoreService {
|
||||
*/
|
||||
public void updateStatus(UUID uuid, MembersDto.StatusDto statusDto) {
|
||||
MemberEntity memberEntity =
|
||||
membersRepository
|
||||
.findByUUID(uuid)
|
||||
.orElseThrow(() -> new MemberNotFoundException());
|
||||
membersRepository.findByUUID(uuid).orElseThrow(() -> new MemberNotFoundException());
|
||||
|
||||
memberEntity.setStatus(statusDto.getStatus());
|
||||
memberEntity.setUpdatedDttm(ZonedDateTime.now());
|
||||
@@ -158,9 +156,7 @@ public class MembersCoreService {
|
||||
*/
|
||||
public void deleteAccount(UUID uuid) {
|
||||
MemberEntity memberEntity =
|
||||
membersRepository
|
||||
.findByUUID(uuid)
|
||||
.orElseThrow(() -> new MemberNotFoundException());
|
||||
membersRepository.findByUUID(uuid).orElseThrow(() -> new MemberNotFoundException());
|
||||
|
||||
MemberArchivedEntityId memberArchivedEntityId = new MemberArchivedEntityId();
|
||||
memberArchivedEntityId.setUserId(memberEntity.getId());
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.mapsheet;
|
||||
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.ImageryDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetMngHstEntity;
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.Optional;
|
||||
import org.springframework.data.domain.Page;
|
||||
|
||||
public interface MapSheetMngFileCheckerRepositoryCustom {
|
||||
|
||||
Page<ImageryDto.SyncDto> findImagerySyncList(ImageryDto.@Valid searchReq searchReq);
|
||||
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ public class MapSheetMngFileCheckerRepositoryImpl extends QuerydslRepositorySupp
|
||||
this.queryFactory = queryFactory;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Page<ImageryDto.SyncDto> findImagerySyncList(ImageryDto.@Valid searchReq searchReq) {
|
||||
|
||||
@@ -53,17 +52,18 @@ public class MapSheetMngFileCheckerRepositoryImpl extends QuerydslRepositorySupp
|
||||
imageryEntity.cogMiddlePath,
|
||||
imageryEntity.filename,
|
||||
imageryEntity.cogFilename,
|
||||
mapSheetMngHstEntity.hstUid
|
||||
)
|
||||
)
|
||||
mapSheetMngHstEntity.hstUid))
|
||||
.from(imageryEntity)
|
||||
.leftJoin(mapSheetMngHstEntity).on(
|
||||
imageryEntity.year.eq(mapSheetMngHstEntity.mngYyyy)
|
||||
.leftJoin(mapSheetMngHstEntity)
|
||||
.on(
|
||||
imageryEntity
|
||||
.year
|
||||
.eq(mapSheetMngHstEntity.mngYyyy)
|
||||
.and(imageryEntity.scene5k.eq(mapSheetMngHstEntity.mapSheetNum.stringValue())))
|
||||
.where(whereBuilder)
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
//.orderBy(mapSheetMngEntity.createdDttm.desc())
|
||||
// .orderBy(mapSheetMngEntity.createdDttm.desc())
|
||||
.fetch();
|
||||
|
||||
Long countQuery =
|
||||
@@ -76,18 +76,8 @@ public class MapSheetMngFileCheckerRepositoryImpl extends QuerydslRepositorySupp
|
||||
return new PageImpl<>(foundContent, pageable, countQuery);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private NumberExpression<Integer> rowNum() {
|
||||
return Expressions.numberTemplate(
|
||||
Integer.class, "row_number() over(order by {0} desc)", mapSheetMngHstEntity.createdDate);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.mapsheet;
|
||||
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.ImageryDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetMngHstEntity;
|
||||
import jakarta.validation.Valid;
|
||||
@@ -14,6 +13,4 @@ public interface MapSheetMngRepositoryCustom {
|
||||
Page<MapSheetMngDto.MngDto> findMapSheetMngList(MapSheetMngDto.@Valid searchReq searchReq);
|
||||
|
||||
Optional<MapSheetMngHstEntity> findMapSheetMngHstInfo(Long hstUid);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.mapsheet;
|
||||
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QImageryEntity.imageryEntity;
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapInkx50kEntity.mapInkx50kEntity;
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapInkx5kEntity.mapInkx5kEntity;
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetMngEntity.mapSheetMngEntity;
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetMngHstEntity.mapSheetMngHstEntity;
|
||||
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.ImageryDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetMngHstEntity;
|
||||
import com.querydsl.core.BooleanBuilder;
|
||||
@@ -141,7 +139,6 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
return new PageImpl<>(foundContent, pageable, countQuery);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<MapSheetMngHstEntity> findMapSheetMngHstInfo(Long hstUid) {
|
||||
return Optional.ofNullable(
|
||||
@@ -169,7 +166,4 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
"{0} like '%" + searchReq.getSearchValue() + "%'",
|
||||
mapSheetMngHstEntity.mapSheetNum));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user