Merge pull request 'feat/dev_251201' (#72) from feat/dev_251201 into develop
Reviewed-on: https://kamco.gitea.gs.dabeeo.com/dabeeo/kamco-dabeeo-backoffice/pulls/72
This commit is contained in:
@@ -80,6 +80,7 @@ dependencies {
|
||||
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.12.5' // JSON (Jackson)
|
||||
|
||||
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
|
||||
implementation 'org.reflections:reflections:0.10.2'
|
||||
}
|
||||
|
||||
configurations.configureEach {
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.kamco.cd.kamcoback.code;
|
||||
|
||||
import com.kamco.cd.kamcoback.code.config.CommonCodeCacheManager;
|
||||
import com.kamco.cd.kamcoback.code.dto.CommonCodeDto;
|
||||
import com.kamco.cd.kamcoback.code.dto.CommonCodeDto.CodeDto;
|
||||
import com.kamco.cd.kamcoback.code.service.CommonCodeService;
|
||||
import com.kamco.cd.kamcoback.common.utils.CommonCodeUtil;
|
||||
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
|
||||
@@ -13,6 +14,7 @@ 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 java.util.Map;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -288,4 +290,21 @@ public class CommonCodeApiController {
|
||||
int count = commonCodeCacheManager.getCachedCommonCodeCount();
|
||||
return ApiResponseDto.ok(count);
|
||||
}
|
||||
|
||||
@Operation(summary = "코드 조회", description = "enum 코드 조회")
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(
|
||||
responseCode = "200",
|
||||
description = "코드 조회 성공",
|
||||
content =
|
||||
@Content(
|
||||
mediaType = "application/json",
|
||||
schema = @Schema(implementation = CodeDto.class))),
|
||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
})
|
||||
@GetMapping("/enums")
|
||||
public ApiResponseDto<Map<String, List<CodeDto>>> getCode() {
|
||||
return ApiResponseDto.ok(commonCodeService.getAllCodes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ public class CommonCodeDto {
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class ModifyReq {
|
||||
|
||||
@NotEmpty private String name;
|
||||
private String description;
|
||||
private boolean used;
|
||||
@@ -70,6 +71,7 @@ public class CommonCodeDto {
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class OrderReq {
|
||||
|
||||
@NotNull private Long id;
|
||||
@NotNull private Integer order;
|
||||
}
|
||||
@@ -176,4 +178,12 @@ public class CommonCodeDto {
|
||||
this.color = color;
|
||||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public static class CodeDto {
|
||||
|
||||
private String code;
|
||||
private String name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,14 @@ package com.kamco.cd.kamcoback.code.service;
|
||||
|
||||
import com.kamco.cd.kamcoback.code.dto.CommonCodeDto.AddReq;
|
||||
import com.kamco.cd.kamcoback.code.dto.CommonCodeDto.Basic;
|
||||
import com.kamco.cd.kamcoback.code.dto.CommonCodeDto.CodeDto;
|
||||
import com.kamco.cd.kamcoback.code.dto.CommonCodeDto.ModifyReq;
|
||||
import com.kamco.cd.kamcoback.code.dto.CommonCodeDto.OrderReq;
|
||||
import com.kamco.cd.kamcoback.common.utils.enums.Enums;
|
||||
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
|
||||
import com.kamco.cd.kamcoback.postgres.core.CommonCodeCoreService;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
@@ -118,4 +121,8 @@ public class CommonCodeService {
|
||||
public Optional<String> getCode(String parentCodeCd, String childCodeCd) {
|
||||
return commonCodeCoreService.getCode(parentCodeCd, childCodeCd);
|
||||
}
|
||||
|
||||
public Map<String, List<CodeDto>> getAllCodes() {
|
||||
return Enums.getAllCodes();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.kamco.cd.kamcoback.common.enums;
|
||||
|
||||
import com.kamco.cd.kamcoback.config.enums.EnumType;
|
||||
import com.kamco.cd.kamcoback.common.utils.enums.CodeExpose;
|
||||
import com.kamco.cd.kamcoback.common.utils.enums.EnumType;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@CodeExpose
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum MngStateType implements EnumType {
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.kamco.cd.kamcoback.common.enums;
|
||||
|
||||
import com.kamco.cd.kamcoback.config.enums.EnumType;
|
||||
import com.kamco.cd.kamcoback.common.utils.enums.CodeExpose;
|
||||
import com.kamco.cd.kamcoback.common.utils.enums.EnumType;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@CodeExpose
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum RoleType implements EnumType {
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.kamco.cd.kamcoback.common.enums;
|
||||
|
||||
import com.kamco.cd.kamcoback.config.enums.EnumType;
|
||||
import com.kamco.cd.kamcoback.common.utils.enums.CodeExpose;
|
||||
import com.kamco.cd.kamcoback.common.utils.enums.EnumType;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@CodeExpose
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum StatusType implements EnumType {
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.kamco.cd.kamcoback.common.enums;
|
||||
|
||||
import com.kamco.cd.kamcoback.config.enums.EnumType;
|
||||
import com.kamco.cd.kamcoback.common.utils.enums.CodeExpose;
|
||||
import com.kamco.cd.kamcoback.common.utils.enums.EnumType;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@CodeExpose
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum SyncStateType implements EnumType {
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.kamco.cd.kamcoback.common.utils;
|
||||
|
||||
import com.kamco.cd.kamcoback.config.enums.EnumType;
|
||||
|
||||
public class Enums {
|
||||
|
||||
// code로 text
|
||||
public static <E extends Enum<E> & EnumType> E fromId(Class<E> enumClass, String id) {
|
||||
if (id == null) {
|
||||
return null;
|
||||
}
|
||||
for (E e : enumClass.getEnumConstants()) {
|
||||
if (id.equalsIgnoreCase(e.getId())) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null; // 못 찾으면 null
|
||||
}
|
||||
}
|
||||
@@ -178,9 +178,14 @@ public class FIleChecker {
|
||||
|
||||
if (isWindows) {
|
||||
// 윈도우용
|
||||
command.add("cmd.exe");
|
||||
command.add("/c");
|
||||
command.add(gdalinfoPath + " \"" + filePath + "\" | findstr /i Geo");
|
||||
command.add("cmd.exe"); // 윈도우 명령 프롬프트 실행
|
||||
command.add("/c"); // 명령어를 수행하고 종료한다는 옵션
|
||||
command.add("gdalinfo");
|
||||
command.add(filePath);
|
||||
command.add("|");
|
||||
command.add("findstr");
|
||||
command.add("/i");
|
||||
command.add("Geo");
|
||||
} else if (isMac || isUnix) {
|
||||
// 리눅스, 맥용
|
||||
command.add("sh");
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.kamco.cd.kamcoback.common.utils.enums;
|
||||
|
||||
public class CodeDto {
|
||||
|
||||
private String code;
|
||||
private String name;
|
||||
|
||||
public CodeDto(String code, String name) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.kamco.cd.kamcoback.common.utils.enums;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface CodeExpose {}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.kamco.cd.kamcoback.config.enums;
|
||||
package com.kamco.cd.kamcoback.common.utils.enums;
|
||||
|
||||
public interface EnumType {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.kamco.cd.kamcoback.common.utils;
|
||||
package com.kamco.cd.kamcoback.common.utils.enums;
|
||||
|
||||
import com.kamco.cd.kamcoback.common.utils.interfaces.EnumValid;
|
||||
import jakarta.validation.ConstraintValidator;
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.kamco.cd.kamcoback.common.utils.enums;
|
||||
|
||||
import com.kamco.cd.kamcoback.code.dto.CommonCodeDto.CodeDto;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.reflections.Reflections;
|
||||
|
||||
public class Enums {
|
||||
|
||||
// code로 text
|
||||
public static <E extends Enum<E> & EnumType> E fromId(Class<E> enumClass, String id) {
|
||||
if (id == null) {
|
||||
return null;
|
||||
}
|
||||
for (E e : enumClass.getEnumConstants()) {
|
||||
if (id.equalsIgnoreCase(e.getId())) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null; // 못 찾으면 null
|
||||
}
|
||||
|
||||
public static List<CodeDto> toList(Class<? extends Enum<?>> enumClass) {
|
||||
|
||||
Object[] enums = enumClass.getEnumConstants();
|
||||
|
||||
return Arrays.stream(enums)
|
||||
.map(e -> (EnumType) e)
|
||||
.map(e -> new CodeDto(e.getId(), e.getText()))
|
||||
.toList();
|
||||
}
|
||||
|
||||
public static Map<String, List<CodeDto>> getAllCodes() {
|
||||
|
||||
Reflections reflections = new Reflections("com.kamco.cd.kamcoback");
|
||||
|
||||
Set<Class<?>> types = reflections.getTypesAnnotatedWith(CodeExpose.class);
|
||||
|
||||
Map<String, List<CodeDto>> result = new HashMap<>();
|
||||
|
||||
for (Class<?> clazz : types) {
|
||||
if (clazz.isEnum() && EnumType.class.isAssignableFrom(clazz)) {
|
||||
result.put(clazz.getSimpleName(), Enums.toList((Class<? extends Enum<?>>) clazz));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.kamco.cd.kamcoback.common.utils.interfaces;
|
||||
|
||||
import com.kamco.cd.kamcoback.common.utils.EnumValidator;
|
||||
import com.kamco.cd.kamcoback.common.utils.enums.EnumValidator;
|
||||
import jakarta.validation.Constraint;
|
||||
import jakarta.validation.Payload;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.kamco.cd.kamcoback.config.api;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.kamco.cd.kamcoback.config.enums.EnumType;
|
||||
import com.kamco.cd.kamcoback.common.utils.enums.EnumType;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.kamco.cd.kamcoback.log.dto;
|
||||
|
||||
import com.kamco.cd.kamcoback.config.enums.EnumType;
|
||||
import com.kamco.cd.kamcoback.common.utils.enums.EnumType;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.time.LocalDate;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.kamco.cd.kamcoback.log.dto;
|
||||
|
||||
import com.kamco.cd.kamcoback.config.enums.EnumType;
|
||||
import com.kamco.cd.kamcoback.common.utils.enums.EnumType;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.kamco.cd.kamcoback.log.dto;
|
||||
|
||||
import com.kamco.cd.kamcoback.config.enums.EnumType;
|
||||
import com.kamco.cd.kamcoback.common.utils.enums.EnumType;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ public class MapSheetMngApiController {
|
||||
private final CommonCodeService commonCodeService;
|
||||
private final MapSheetMngService mapSheetMngService;
|
||||
|
||||
@Operation(summary = "영상데이터관리목록 조회", description = "영상데이터관리목록 조회")
|
||||
@Operation(summary = "영상 데이터 관리 목록 조회", description = "영상 데이터 관리 목록 조회")
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(
|
||||
@@ -47,7 +47,7 @@ public class MapSheetMngApiController {
|
||||
return ApiResponseDto.ok(mapSheetMngService.findMapSheetMngList());
|
||||
}
|
||||
|
||||
@Operation(summary = "영상데이터관리 상세", description = "영상데이터관리 상세")
|
||||
@Operation(summary = "영상 데이터 관리 상세", description = "영상 데이터 관리 상세")
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(
|
||||
@@ -105,12 +105,38 @@ public class MapSheetMngApiController {
|
||||
return ApiResponseDto.ok(mapSheetMngService.mngComplete(mngYyyy));
|
||||
}
|
||||
|
||||
/**
|
||||
* 오류데이터 목록 조회
|
||||
*
|
||||
* @param searchReq
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "영상 데이터 관리 년도 목록", description = "영상 데이터 관리 년도 목록")
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(
|
||||
responseCode = "200",
|
||||
description = "조회 성공",
|
||||
content =
|
||||
@Content(
|
||||
mediaType = "application/json",
|
||||
schema = @Schema(implementation = CommonCodeDto.Basic.class))),
|
||||
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
})
|
||||
@PostMapping("/mng-year-list")
|
||||
public ApiResponseDto<List<Integer>> findMapSheetMngYyyyList() {
|
||||
|
||||
return ApiResponseDto.ok(mapSheetMngService.findMapSheetMngYyyyList());
|
||||
}
|
||||
|
||||
@Operation(summary = "영상 데이터 관리 오류 목록", description = "영상 데이터 관리 오류 목록")
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(
|
||||
responseCode = "200",
|
||||
description = "조회 성공",
|
||||
content =
|
||||
@Content(
|
||||
mediaType = "application/json",
|
||||
schema = @Schema(implementation = CommonCodeDto.Basic.class))),
|
||||
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
})
|
||||
@PostMapping("/error-list")
|
||||
public ApiResponseDto<Page<MapSheetMngDto.ErrorDataDto>> findMapSheetErrorList(
|
||||
@RequestBody @Valid MapSheetMngDto.ErrorSearchReq searchReq) {
|
||||
@@ -137,10 +163,6 @@ public class MapSheetMngApiController {
|
||||
return ApiResponseDto.ok(mapSheetMngService.uploadProcess(hstUidList));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param hstUidList
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "오류데이터 팝업 > 추론 제외", description = "오류데이터 팝업 > 추론 제외")
|
||||
@PutMapping("/except-inference")
|
||||
public ApiResponseDto<MapSheetMngDto.DmlReturn> updateExceptUseInference(
|
||||
@@ -156,4 +178,44 @@ public class MapSheetMngApiController {
|
||||
@RequestParam(value = "hstUid", required = false) Long hstUid) {
|
||||
return ApiResponseDto.createOK(mapSheetMngService.uploadPair(tfwFile, tifFile, hstUid));
|
||||
}
|
||||
|
||||
@Operation(summary = "영상관리 > 파일조회", description = "영상관리 > 파일조회")
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(
|
||||
responseCode = "201",
|
||||
description = "파일삭제 처리 성공",
|
||||
content =
|
||||
@Content(
|
||||
mediaType = "application/json",
|
||||
schema = @Schema(implementation = Long.class))),
|
||||
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
|
||||
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
})
|
||||
@GetMapping("/mng-file-list")
|
||||
public ApiResponseDto<List<MapSheetMngDto.MngFilesDto>> findHstUidToMapSheetFileList(
|
||||
@RequestParam @Valid Long hstUid) {
|
||||
return ApiResponseDto.ok(mapSheetMngService.findHstUidToMapSheetFileList(hstUid));
|
||||
}
|
||||
|
||||
@Operation(summary = "영상관리 > 파일삭제", description = "영상관리 > 파일삭제")
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(
|
||||
responseCode = "201",
|
||||
description = "파일삭제 처리 성공",
|
||||
content =
|
||||
@Content(
|
||||
mediaType = "application/json",
|
||||
schema = @Schema(implementation = Long.class))),
|
||||
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
|
||||
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
})
|
||||
@PutMapping("/del-mng-files")
|
||||
public ApiResponseDto<MapSheetMngDto.DmlReturn> deleteByFileUidMngFile(
|
||||
@RequestParam @Valid List<Long> fileUids) {
|
||||
return ApiResponseDto.ok(mapSheetMngService.deleteByFileUidMngFile(fileUids));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,14 +15,10 @@ 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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RequestPart;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@Tag(name = "영상 관리", description = "영상 관리 API")
|
||||
@RestController
|
||||
@@ -71,6 +67,7 @@ public class MapSheetMngFileCheckerApiController {
|
||||
return ApiResponseDto.createOK(mapSheetMngFileCheckerService.getFilesAll(srchDto));
|
||||
}
|
||||
|
||||
/*
|
||||
@Operation(summary = "파일 업로드", description = "파일 업로드 및 TIF 검증")
|
||||
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public ApiResponseDto<String> uploadFile(
|
||||
@@ -83,6 +80,9 @@ public class MapSheetMngFileCheckerApiController {
|
||||
mapSheetMngFileCheckerService.uploadFile(file, targetPath, overwrite, hstUid));
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
@Operation(summary = "파일 삭제", description = "중복 파일 등 파일 삭제")
|
||||
@PostMapping("/delete")
|
||||
public ApiResponseDto<Boolean> deleteFile(@RequestBody SrchFoldersDto dto) {
|
||||
@@ -97,6 +97,8 @@ public class MapSheetMngFileCheckerApiController {
|
||||
mapSheetMngFileCheckerService.deleteDuplicate(filePath, fileName));
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
@Operation(summary = "지정폴더(하위폴더포함) 파일목록 조회", description = "지정폴더(하위폴더포함) 파일목록 조회")
|
||||
@ApiResponses(
|
||||
|
||||
@@ -2,9 +2,8 @@ package com.kamco.cd.kamcoback.mapsheet.dto;
|
||||
|
||||
import com.kamco.cd.kamcoback.common.enums.MngStateType;
|
||||
import com.kamco.cd.kamcoback.common.enums.SyncStateType;
|
||||
import com.kamco.cd.kamcoback.common.utils.Enums;
|
||||
import com.kamco.cd.kamcoback.common.utils.enums.Enums;
|
||||
import com.kamco.cd.kamcoback.common.utils.interfaces.JsonFormatDttm;
|
||||
import com.kamco.cd.kamcoback.config.enums.EnumType;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.time.ZonedDateTime;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -45,6 +44,7 @@ public class MapSheetMngDto {
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class AddReq {
|
||||
|
||||
@Schema(description = "관리년도", example = "2022")
|
||||
private int mngYyyy;
|
||||
|
||||
@@ -58,6 +58,7 @@ public class MapSheetMngDto {
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class DeleteFileReq {
|
||||
|
||||
@Schema(description = "파일 경로", example = "/app/original-images/2024/00000001.tif")
|
||||
private String filePath;
|
||||
}
|
||||
@@ -68,6 +69,7 @@ public class MapSheetMngDto {
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class MngDto {
|
||||
|
||||
private int rowNum;
|
||||
private int mngYyyy;
|
||||
private String mngState;
|
||||
@@ -109,7 +111,9 @@ public class MapSheetMngDto {
|
||||
|
||||
public String getMngStateName() {
|
||||
String enumId = this.mngState;
|
||||
if (enumId == null || enumId.isEmpty()) enumId = "NOTYET";
|
||||
if (enumId == null || enumId.isEmpty()) {
|
||||
enumId = "NOTYET";
|
||||
}
|
||||
|
||||
MngStateType type = Enums.fromId(MngStateType.class, enumId);
|
||||
return type.getText();
|
||||
@@ -161,8 +165,10 @@ public class MapSheetMngDto {
|
||||
@Getter
|
||||
@Setter
|
||||
public static class ErrorDataDto {
|
||||
|
||||
// private Integer rowNum;
|
||||
private Long hstUid;
|
||||
private String mapSheetNum;
|
||||
private String map50kName;
|
||||
private String map5kName;
|
||||
private String mapSrcName;
|
||||
@@ -211,7 +217,9 @@ public class MapSheetMngDto {
|
||||
}
|
||||
|
||||
private String getSyncStateName(String enumId) {
|
||||
if (enumId == null || enumId.isEmpty()) enumId = "NOTYET";
|
||||
if (enumId == null || enumId.isEmpty()) {
|
||||
enumId = "NOTYET";
|
||||
}
|
||||
|
||||
SyncStateType type = Enums.fromId(SyncStateType.class, enumId);
|
||||
return type.getText();
|
||||
@@ -222,6 +230,7 @@ public class MapSheetMngDto {
|
||||
@Getter
|
||||
@Setter
|
||||
public static class MngFIleDto {
|
||||
|
||||
private Long fileUid;
|
||||
private String filePath;
|
||||
private String fileName;
|
||||
@@ -236,27 +245,26 @@ public class MapSheetMngDto {
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class DmlReturn {
|
||||
|
||||
private String flag;
|
||||
private String message;
|
||||
}
|
||||
|
||||
@Schema(name = "MngFilesDto", description = "영상파일내역 검색 리턴")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public enum DataState implements EnumType {
|
||||
NOTYET("대기중"),
|
||||
PROCESSING("진행중"),
|
||||
DONE("완료");
|
||||
public static class MngFilesDto {
|
||||
|
||||
private final String desc;
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return name();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
return desc;
|
||||
}
|
||||
private long fileUid;
|
||||
private int mngYyyy;
|
||||
private String mapSheetNum;
|
||||
private String refMapSheetNum;
|
||||
private String filePath;
|
||||
private String fileName;
|
||||
private String fileExt;
|
||||
private Long hstUid;
|
||||
private Long fileSize;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ 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.DmlReturn;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.MngFilesDto;
|
||||
import com.kamco.cd.kamcoback.postgres.core.MapSheetMngCoreService;
|
||||
import jakarta.validation.Valid;
|
||||
import java.io.File;
|
||||
@@ -217,6 +219,10 @@ public class MapSheetMngService {
|
||||
return mapSheetMngCoreService.findMapSheetMngList();
|
||||
}
|
||||
|
||||
public List<Integer> findMapSheetMngYyyyList() {
|
||||
return mapSheetMngCoreService.findMapSheetMngYyyyList();
|
||||
}
|
||||
|
||||
public MapSheetMngDto.MngDto findMapSheetMng(int mngYyyy) {
|
||||
return mapSheetMngCoreService.findMapSheetMng(mngYyyy);
|
||||
}
|
||||
@@ -263,7 +269,7 @@ public class MapSheetMngService {
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public MapSheetMngDto.DmlReturn uploadPair(
|
||||
public DmlReturn uploadPair(
|
||||
MultipartFile tfwFile,
|
||||
MultipartFile tifFile,
|
||||
// String targetPath,
|
||||
@@ -271,9 +277,9 @@ public class MapSheetMngService {
|
||||
|
||||
// 파일 유효성 검증
|
||||
if (tfwFile == null || tfwFile.isEmpty() || tfwFile.getSize() == 0) {
|
||||
return new MapSheetMngDto.DmlReturn("fail", "TFW 파일이(0Byte) 비어있습니다.");
|
||||
return new DmlReturn("fail", "TFW SIZE 오류");
|
||||
} else if (tifFile == null || tifFile.isEmpty() || tifFile.getSize() == 0) {
|
||||
return new MapSheetMngDto.DmlReturn("fail", "TIF 파일이(0Byte) 비어있습니다.");
|
||||
return new DmlReturn("fail", "TIF SIZE 오류");
|
||||
}
|
||||
|
||||
if (!tfwFile
|
||||
@@ -281,15 +287,45 @@ public class MapSheetMngService {
|
||||
.substring(tfwFile.getOriginalFilename().lastIndexOf('.') + 1)
|
||||
.toLowerCase()
|
||||
.equals("tfw")) {
|
||||
return new MapSheetMngDto.DmlReturn("fail", "파일명이 TFW형식이 아닙니다.");
|
||||
return new DmlReturn("fail", "TFW TYPE ERROR");
|
||||
} else if (!tifFile
|
||||
.getOriginalFilename()
|
||||
.substring(tifFile.getOriginalFilename().lastIndexOf('.') + 1)
|
||||
.toLowerCase()
|
||||
.equals("tif")) {
|
||||
return new MapSheetMngDto.DmlReturn("fail", "파일명이 TIF형식이 아닙니다.");
|
||||
return new DmlReturn("fail", "TIF TYPE ERROR");
|
||||
}
|
||||
|
||||
return new MapSheetMngDto.DmlReturn("success", "파일 업로드 완료되었습니다.");
|
||||
// 싱크파일목록 가저오기
|
||||
List<MngFilesDto> mngFiles = mapSheetMngCoreService.findIdToMapSheetFileList(hstUid);
|
||||
String uploadPath = "";
|
||||
for (MngFilesDto dto : mngFiles) {
|
||||
uploadPath = dto.getFilePath();
|
||||
break;
|
||||
}
|
||||
|
||||
if (uploadPath.isEmpty()) {
|
||||
// ErrorDataDto errDto = mapSheetMngCoreService.findMapSheetError(hstUid);
|
||||
// uploadPath = FileConfig.rootSyncDir+"\\"+errDto.getMapSheetNum();
|
||||
}
|
||||
|
||||
// tfw가 있는 경우
|
||||
// tif가 있는 경우
|
||||
|
||||
return new DmlReturn("success", "파일 업로드 완료되었습니다.");
|
||||
}
|
||||
|
||||
public List<MapSheetMngDto.MngFilesDto> findHstUidToMapSheetFileList(Long hstUid) {
|
||||
return mapSheetMngCoreService.findHstUidToMapSheetFileList(hstUid);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public MapSheetMngDto.DmlReturn deleteByFileUidMngFile(List<Long> fileUids) {
|
||||
|
||||
for (Long uid : fileUids) {
|
||||
MapSheetMngDto.DmlReturn dmlReturn = mapSheetMngCoreService.deleteByFileUidMngFile(uid);
|
||||
}
|
||||
|
||||
return new MapSheetMngDto.DmlReturn("success", fileUids.size() + "개 파일이 삭제되었습니다.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.kamco.cd.kamcoback.members.dto;
|
||||
|
||||
import com.kamco.cd.kamcoback.common.enums.RoleType;
|
||||
import com.kamco.cd.kamcoback.common.enums.StatusType;
|
||||
import com.kamco.cd.kamcoback.common.utils.Enums;
|
||||
import com.kamco.cd.kamcoback.common.utils.enums.Enums;
|
||||
import com.kamco.cd.kamcoback.common.utils.interfaces.EnumValid;
|
||||
import com.kamco.cd.kamcoback.common.utils.interfaces.JsonFormatDttm;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
@@ -36,6 +36,10 @@ public class MapSheetMngCoreService {
|
||||
return mapSheetMngRepository.findMapSheetMngList();
|
||||
}
|
||||
|
||||
public List<Integer> findMapSheetMngYyyyList() {
|
||||
return mapSheetMngRepository.findMapSheetMngYyyyList();
|
||||
}
|
||||
|
||||
public MapSheetMngDto.MngDto findMapSheetMng(int mngYyyy) {
|
||||
return mapSheetMngRepository.findMapSheetMng(mngYyyy);
|
||||
}
|
||||
@@ -53,6 +57,10 @@ public class MapSheetMngCoreService {
|
||||
return mapSheetMngRepository.findMapSheetError(hstUid);
|
||||
}
|
||||
|
||||
public List<MapSheetMngDto.MngFilesDto> findIdToMapSheetFileList(Long hstUid) {
|
||||
return mapSheetMngRepository.findIdToMapSheetFileList(hstUid);
|
||||
}
|
||||
|
||||
public MapSheetMngDto.DmlReturn uploadProcess(@Valid List<Long> hstUidList) {
|
||||
int count = 0;
|
||||
if (!Objects.isNull(hstUidList) && !hstUidList.isEmpty()) {
|
||||
@@ -200,4 +208,14 @@ public class MapSheetMngCoreService {
|
||||
|
||||
return new MapSheetMngDto.DmlReturn("success", saved.getMngYyyy().toString());
|
||||
}
|
||||
|
||||
public List<MapSheetMngDto.MngFilesDto> findHstUidToMapSheetFileList(Long hstUid) {
|
||||
return mapSheetMngRepository.findHstUidToMapSheetFileList(hstUid);
|
||||
}
|
||||
|
||||
public MapSheetMngDto.DmlReturn deleteByFileUidMngFile(Long fileUid) {
|
||||
mapSheetMngRepository.deleteByFileUidMngFile(fileUid);
|
||||
|
||||
return new MapSheetMngDto.DmlReturn("success", fileUid + " : 삭제되었습니다.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ public interface MapSheetMngRepositoryCustom {
|
||||
|
||||
List<MapSheetMngDto.MngDto> findMapSheetMngList();
|
||||
|
||||
List<Integer> findMapSheetMngYyyyList();
|
||||
|
||||
MapSheetMngDto.MngDto findMapSheetMng(int mngYyyy);
|
||||
|
||||
void MapSheetMngComplete(int mngYyyy);
|
||||
@@ -19,6 +21,12 @@ public interface MapSheetMngRepositoryCustom {
|
||||
|
||||
int insertMapSheetOrgDataToMapSheetMngHst(int mngYyyy);
|
||||
|
||||
List<MapSheetMngDto.MngFilesDto> findHstUidToMapSheetFileList(Long hstUid);
|
||||
|
||||
void deleteByFileUidMngFile(Long fileUid);
|
||||
|
||||
MapSheetMngDto.MngFilesDto findYyyyToMapSheetFilePath(int mngYyyy);
|
||||
|
||||
void deleteByMngYyyyMngAll(int mngYyyy);
|
||||
|
||||
void deleteByMngYyyyMng(int mngYyyy);
|
||||
@@ -32,5 +40,7 @@ public interface MapSheetMngRepositoryCustom {
|
||||
|
||||
MapSheetMngDto.ErrorDataDto findMapSheetError(Long hstUid);
|
||||
|
||||
List<MapSheetMngDto.MngFilesDto> findIdToMapSheetFileList(Long hstUid);
|
||||
|
||||
void updateHstFileSizes(Long hstUid, long tifSizeBytes, long tfwSizeBytes, long totalSizeBytes);
|
||||
}
|
||||
|
||||
@@ -167,6 +167,18 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
return foundContent;
|
||||
}
|
||||
|
||||
public List<Integer> findMapSheetMngYyyyList() {
|
||||
List<Integer> foundContent =
|
||||
queryFactory
|
||||
.select(mapSheetMngEntity.mngYyyy)
|
||||
.from(mapSheetMngEntity)
|
||||
.where(mapSheetMngEntity.mngState.ne("COMPLETE"))
|
||||
.orderBy(mapSheetMngEntity.mngYyyy.desc())
|
||||
.fetch();
|
||||
|
||||
return foundContent;
|
||||
}
|
||||
|
||||
public MapSheetMngDto.MngDto findMapSheetMng(int mngYyyy) {
|
||||
|
||||
BooleanBuilder whereBuilder = new BooleanBuilder();
|
||||
@@ -379,6 +391,7 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
Projections.constructor(
|
||||
MapSheetMngDto.ErrorDataDto.class,
|
||||
mapSheetMngHstEntity.hstUid,
|
||||
mapSheetMngHstEntity.mapSheetNum,
|
||||
Expressions.stringTemplate(
|
||||
"concat({0},substring({1}, 0, 6))",
|
||||
mapInkx5kEntity.mapidNm, mapSheetMngHstEntity.mapSheetNum)
|
||||
@@ -408,6 +421,87 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
return foundContent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MapSheetMngDto.MngFilesDto> findIdToMapSheetFileList(Long hstUid) {
|
||||
|
||||
BooleanBuilder whereBuilder = new BooleanBuilder();
|
||||
whereBuilder.and(mapSheetMngFileEntity.hstUid.eq(hstUid));
|
||||
|
||||
List<MapSheetMngDto.MngFilesDto> foundContent =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
MapSheetMngDto.MngFilesDto.class,
|
||||
mapSheetMngFileEntity.fileUid,
|
||||
mapSheetMngFileEntity.mngYyyy,
|
||||
mapSheetMngFileEntity.mapSheetNum,
|
||||
mapSheetMngFileEntity.refMapSheetNum,
|
||||
mapSheetMngFileEntity.filePath,
|
||||
mapSheetMngFileEntity.fileName,
|
||||
mapSheetMngFileEntity.fileExt,
|
||||
mapSheetMngFileEntity.hstUid,
|
||||
mapSheetMngFileEntity.fileSize))
|
||||
.from(mapSheetMngFileEntity)
|
||||
.where(whereBuilder)
|
||||
.fetch();
|
||||
|
||||
return foundContent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MapSheetMngDto.MngFilesDto> findHstUidToMapSheetFileList(Long hstUid) {
|
||||
BooleanBuilder whereBuilder = new BooleanBuilder();
|
||||
whereBuilder.and(mapSheetMngFileEntity.hstUid.eq(hstUid));
|
||||
|
||||
List<MapSheetMngDto.MngFilesDto> foundContent =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
MapSheetMngDto.MngFilesDto.class,
|
||||
mapSheetMngFileEntity.fileUid,
|
||||
mapSheetMngFileEntity.mngYyyy,
|
||||
mapSheetMngFileEntity.mapSheetNum,
|
||||
mapSheetMngFileEntity.refMapSheetNum,
|
||||
mapSheetMngFileEntity.filePath,
|
||||
mapSheetMngFileEntity.fileName,
|
||||
mapSheetMngFileEntity.fileExt,
|
||||
mapSheetMngFileEntity.hstUid,
|
||||
mapSheetMngFileEntity.fileSize))
|
||||
.from(mapSheetMngFileEntity)
|
||||
.where(whereBuilder)
|
||||
.orderBy(mapSheetMngFileEntity.filePath.asc())
|
||||
.fetch();
|
||||
|
||||
return foundContent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapSheetMngDto.MngFilesDto findYyyyToMapSheetFilePath(int mngYyyy) {
|
||||
|
||||
BooleanBuilder whereBuilder = new BooleanBuilder();
|
||||
whereBuilder.and(mapSheetMngFileEntity.mngYyyy.eq(mngYyyy));
|
||||
|
||||
MapSheetMngDto.MngFilesDto foundContent =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
MapSheetMngDto.MngFilesDto.class,
|
||||
mapSheetMngFileEntity.fileUid,
|
||||
mapSheetMngFileEntity.mngYyyy,
|
||||
mapSheetMngFileEntity.mapSheetNum,
|
||||
mapSheetMngFileEntity.refMapSheetNum,
|
||||
mapSheetMngFileEntity.filePath,
|
||||
mapSheetMngFileEntity.fileName,
|
||||
mapSheetMngFileEntity.fileExt,
|
||||
mapSheetMngFileEntity.hstUid,
|
||||
mapSheetMngFileEntity.fileSize))
|
||||
.from(mapSheetMngFileEntity)
|
||||
.where(whereBuilder)
|
||||
.fetchOne();
|
||||
|
||||
return foundContent;
|
||||
}
|
||||
|
||||
public void MapSheetMngComplete(int mngYyyy) {
|
||||
long execCount =
|
||||
queryFactory
|
||||
@@ -469,6 +563,15 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByFileUidMngFile(Long fileUid) {
|
||||
long deletedFileCount =
|
||||
queryFactory
|
||||
.delete(mapSheetMngFileEntity)
|
||||
.where(mapSheetMngFileEntity.fileUid.eq(fileUid))
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertMapSheetOrgDataToMapSheetMngHst(int mngYyyy) {
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.kamco.cd.kamcoback.zoo.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.kamco.cd.kamcoback.config.enums.EnumType;
|
||||
import com.kamco.cd.kamcoback.common.utils.enums.EnumType;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.time.ZonedDateTime;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
@@ -15,8 +15,8 @@ spring:
|
||||
format_sql: true # ⚠️ 선택 - SQL 포맷팅 (가독성)
|
||||
|
||||
datasource:
|
||||
#url: jdbc:postgresql://192.168.2.127:15432/kamco_cds
|
||||
url: jdbc:postgresql://localhost:15432/kamco_cds
|
||||
url: jdbc:postgresql://192.168.2.127:15432/kamco_cds
|
||||
#url: jdbc:postgresql://localhost:15432/kamco_cds
|
||||
username: kamco_cds
|
||||
password: kamco_cds_Q!W@E#R$
|
||||
hikari:
|
||||
|
||||
Reference in New Issue
Block a user