영상관리파일삭제, 년도목록 조회 수정

This commit is contained in:
Moon
2025-12-18 10:59:09 +09:00
parent 9d1d9aff69
commit 21f1e9fc3c
8 changed files with 199 additions and 193 deletions

View File

@@ -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,26 @@ 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());
}
@PostMapping("/error-list")
public ApiResponseDto<Page<MapSheetMngDto.ErrorDataDto>> findMapSheetErrorList(
@RequestBody @Valid MapSheetMngDto.ErrorSearchReq searchReq) {
@@ -137,7 +151,6 @@ public class MapSheetMngApiController {
return ApiResponseDto.ok(mapSheetMngService.uploadProcess(hstUidList));
}
@Operation(summary = "오류데이터 팝업 > 추론 제외", description = "오류데이터 팝업 > 추론 제외")
@PutMapping("/except-inference")
public ApiResponseDto<MapSheetMngDto.DmlReturn> updateExceptUseInference(
@@ -154,33 +167,29 @@ public class MapSheetMngApiController {
return ApiResponseDto.createOK(mapSheetMngService.uploadPair(tfwFile, tifFile, hstUid));
}
@GetMapping("/mng-file-list")
public ApiResponseDto<List<MapSheetMngDto.MngFilesDto>> findHstUidToMapSheetFileList(
@RequestParam @Valid Long hstUid) {
@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)
})
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) {
public ApiResponseDto<MapSheetMngDto.DmlReturn> deleteByFileUidMngFile(
@RequestParam @Valid List<Long> fileUids) {
return ApiResponseDto.ok(mapSheetMngService.deleteByFileUidMngFile(fileUids));
}
}

View File

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

View File

@@ -4,7 +4,6 @@ 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.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;
@@ -107,10 +106,9 @@ public class MapSheetMngDto {
return this.syncNotPaireExecCnt + this.syncDuplicateExecCnt + this.syncFaultExecCnt;
}
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();
@@ -181,8 +179,7 @@ public class MapSheetMngDto {
private String errorCheckTfwFileName;
private String errorCheckTifFileName;
//private List<MngFIleDto> fileArray;
// private List<MngFIleDto> fileArray;
public ErrorDataDto(
Long hstUid,
@@ -214,7 +211,7 @@ 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();
@@ -259,5 +256,4 @@ public class MapSheetMngDto {
private Long hstUid;
private Long fileSize;
}
}

View File

@@ -2,17 +2,12 @@ package com.kamco.cd.kamcoback.mapsheet.service;
import static java.lang.String.CASE_INSENSITIVE_ORDER;
import com.kamco.cd.kamcoback.common.exception.DuplicateFileException;
import com.kamco.cd.kamcoback.common.exception.ValidationException;
import com.kamco.cd.kamcoback.common.utils.FIleChecker;
import com.kamco.cd.kamcoback.config.FileConfig;
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.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.ErrorDataDto;
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.MngFilesDto;
import com.kamco.cd.kamcoback.postgres.core.MapSheetMngCoreService;
import jakarta.validation.Valid;
@@ -224,11 +219,16 @@ public class MapSheetMngService {
return mapSheetMngCoreService.findMapSheetMngList();
}
public List<Integer> findMapSheetMngYyyyList() {
return mapSheetMngCoreService.findMapSheetMngYyyyList();
}
public MapSheetMngDto.MngDto findMapSheetMng(int mngYyyy) {
return mapSheetMngCoreService.findMapSheetMng(mngYyyy);
}
@Transactional
public MapSheetMngDto.DmlReturn mngComplete(int mngYyyy) {
@@ -272,59 +272,55 @@ public class MapSheetMngService {
@Transactional
public DmlReturn uploadPair(
MultipartFile tfwFile,
MultipartFile tifFile,
//String targetPath,
Long hstUid) {
MultipartFile tfwFile,
MultipartFile tifFile,
// String targetPath,
Long hstUid) {
// 파일 유효성 검증
if (tfwFile == null || tfwFile.isEmpty() || tfwFile.getSize() == 0) {
return new DmlReturn("fail", "TFW SIZE 오류");
}else if (tifFile == null || tifFile.isEmpty() || tifFile.getSize() == 0) {
return new DmlReturn("fail", "TIF SIZE 오류");
}
// 파일 유효성 검증
if (tfwFile == null || tfwFile.isEmpty() || tfwFile.getSize() == 0) {
return new DmlReturn("fail", "TFW SIZE 오류");
} else if (tifFile == null || tifFile.isEmpty() || tifFile.getSize() == 0) {
return new DmlReturn("fail", "TIF SIZE 오류");
}
if( ! tfwFile.getOriginalFilename()
.substring(tfwFile.getOriginalFilename().lastIndexOf('.') + 1)
.toLowerCase()
.equals("tfw") )
{
return new DmlReturn("fail", "TFW TYPE ERROR");
}else if( ! tifFile.getOriginalFilename()
if (!tfwFile
.getOriginalFilename()
.substring(tfwFile.getOriginalFilename().lastIndexOf('.') + 1)
.toLowerCase()
.equals("tfw")) {
return new DmlReturn("fail", "TFW TYPE ERROR");
} else if (!tifFile
.getOriginalFilename()
.substring(tifFile.getOriginalFilename().lastIndexOf('.') + 1)
.toLowerCase()
.equals("tif") )
{
return new DmlReturn("fail", "TIF TYPE ERROR");
}
.equals("tif")) {
return new DmlReturn("fail", "TIF TYPE ERROR");
}
//싱크파일목록 가저오기
List<MngFilesDto> mngFiles = mapSheetMngCoreService.findIdToMapSheetFileList(hstUid);
String uploadPath = "";
for (MngFilesDto dto : mngFiles) {
uploadPath = dto.getFilePath();
break;
}
// 싱크파일목록 가저오기
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();
}
if (uploadPath.isEmpty()) {
// ErrorDataDto errDto = mapSheetMngCoreService.findMapSheetError(hstUid);
// uploadPath = FileConfig.rootSyncDir+"\\"+errDto.getMapSheetNum();
}
//tfw가 있는 경우
//tif가 있는 경우
// 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) {
@@ -334,5 +330,4 @@ public class MapSheetMngService {
return new MapSheetMngDto.DmlReturn("success", fileUids.size() + "개 파일이 삭제되었습니다.");
}
}