Compare commits
12 Commits
43651289ec
...
20e06f9e28
| Author | SHA1 | Date | |
|---|---|---|---|
| 20e06f9e28 | |||
| a00d933eb1 | |||
| b203412560 | |||
| 1967a9d7cd | |||
| 7eadc49b78 | |||
| bbc87071fb | |||
| 73862e95bd | |||
| 8a0c6d124b | |||
| 3f29de9039 | |||
| fba1e5f4e3 | |||
| 1ed4a1eeee | |||
| f1f8753fbb |
@@ -457,6 +457,7 @@ public class InferenceDetailDto {
|
|||||||
|
|
||||||
private String bboxGeom;
|
private String bboxGeom;
|
||||||
private String bboxCenterPoint;
|
private String bboxCenterPoint;
|
||||||
|
private UUID inferenceUuid;
|
||||||
|
|
||||||
public AnalResultInfo(
|
public AnalResultInfo(
|
||||||
String analTitle,
|
String analTitle,
|
||||||
@@ -472,7 +473,8 @@ public class InferenceDetailDto {
|
|||||||
Integer stage,
|
Integer stage,
|
||||||
String subUid,
|
String subUid,
|
||||||
Boolean applyYn,
|
Boolean applyYn,
|
||||||
ZonedDateTime applyDttm) {
|
ZonedDateTime applyDttm,
|
||||||
|
UUID inferenceUuid) {
|
||||||
this.analTitle = analTitle;
|
this.analTitle = analTitle;
|
||||||
this.modelVer1 = modelVer1;
|
this.modelVer1 = modelVer1;
|
||||||
this.modelVer2 = modelVer2;
|
this.modelVer2 = modelVer2;
|
||||||
@@ -502,6 +504,7 @@ public class InferenceDetailDto {
|
|||||||
|
|
||||||
this.elapsedDuration = String.format("%02d:%02d:%02d", h, m, s);
|
this.elapsedDuration = String.format("%02d:%02d:%02d", h, m, s);
|
||||||
}
|
}
|
||||||
|
this.inferenceUuid = inferenceUuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonProperty("bboxGeom")
|
@JsonProperty("bboxGeom")
|
||||||
|
|||||||
@@ -33,12 +33,14 @@ import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.MngListCompareDto;
|
|||||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.MngListDto;
|
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.MngListDto;
|
||||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.TotalListDto;
|
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.TotalListDto;
|
||||||
import com.kamco.cd.kamcoback.model.dto.ModelMngDto.Basic;
|
import com.kamco.cd.kamcoback.model.dto.ModelMngDto.Basic;
|
||||||
|
import com.kamco.cd.kamcoback.model.dto.ModelMngDto.ModelType;
|
||||||
import com.kamco.cd.kamcoback.postgres.core.AuditLogCoreService;
|
import com.kamco.cd.kamcoback.postgres.core.AuditLogCoreService;
|
||||||
import com.kamco.cd.kamcoback.postgres.core.InferenceResultCoreService;
|
import com.kamco.cd.kamcoback.postgres.core.InferenceResultCoreService;
|
||||||
import com.kamco.cd.kamcoback.postgres.core.MapSheetMngCoreService;
|
import com.kamco.cd.kamcoback.postgres.core.MapSheetMngCoreService;
|
||||||
import com.kamco.cd.kamcoback.postgres.core.ModelMngCoreService;
|
import com.kamco.cd.kamcoback.postgres.core.ModelMngCoreService;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
@@ -396,22 +398,25 @@ public class InferenceResultService {
|
|||||||
String cdClsModelPath = "";
|
String cdClsModelPath = "";
|
||||||
|
|
||||||
if (modelInfo.getCdModelPath() != null && modelInfo.getCdModelFileName() != null) {
|
if (modelInfo.getCdModelPath() != null && modelInfo.getCdModelFileName() != null) {
|
||||||
cdModelPath = modelInfo.getCdModelPath() + "/" + modelInfo.getCdModelFileName();
|
cdModelPath =
|
||||||
|
Paths.get(modelInfo.getCdModelPath(), modelInfo.getCdModelFileName()).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modelInfo.getCdModelConfig() != null && modelInfo.getCdModelConfigFileName() != null) {
|
if (modelInfo.getCdModelConfig() != null && modelInfo.getCdModelConfigFileName() != null) {
|
||||||
cdModelConfigPath = modelInfo.getCdModelConfig() + "/" + modelInfo.getCdModelConfigFileName();
|
cdModelConfigPath =
|
||||||
|
Paths.get(modelInfo.getCdModelConfig(), modelInfo.getCdModelConfigFileName()).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modelInfo.getClsModelPath() != null && modelInfo.getClsModelFileName() != null) {
|
if (modelInfo.getClsModelPath() != null && modelInfo.getClsModelFileName() != null) {
|
||||||
cdClsModelPath = modelInfo.getClsModelPath() + "/" + modelInfo.getClsModelFileName();
|
cdClsModelPath =
|
||||||
|
Paths.get(modelInfo.getClsModelPath(), modelInfo.getClsModelFileName()).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
String modelType = "";
|
String modelType = "";
|
||||||
|
|
||||||
if (modelInfo.getModelType().equals("M1")) {
|
if (modelInfo.getModelType().equals(ModelType.M1.getId())) {
|
||||||
modelType = "G1";
|
modelType = "G1";
|
||||||
} else if (modelInfo.getModelType().equals("M2")) {
|
} else if (modelInfo.getModelType().equals(ModelType.M2.getId())) {
|
||||||
modelType = "G2";
|
modelType = "G2";
|
||||||
} else {
|
} else {
|
||||||
modelType = "G3";
|
modelType = "G3";
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import com.kamco.cd.kamcoback.mapsheet.dto.FileDto.SrchFoldersDto;
|
|||||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
||||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.MngYyyyDto;
|
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.MngYyyyDto;
|
||||||
import com.kamco.cd.kamcoback.mapsheet.service.MapSheetMngService;
|
import com.kamco.cd.kamcoback.mapsheet.service.MapSheetMngService;
|
||||||
|
import com.kamco.cd.kamcoback.model.dto.ModelMngDto.ModelUploadResDto;
|
||||||
|
import com.kamco.cd.kamcoback.upload.dto.UploadDto;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.media.Content;
|
import io.swagger.v3.oas.annotations.media.Content;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
@@ -17,8 +19,10 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
|||||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@@ -40,6 +44,12 @@ public class MapSheetMngApiController {
|
|||||||
private final CommonCodeService commonCodeService;
|
private final CommonCodeService commonCodeService;
|
||||||
private final MapSheetMngService mapSheetMngService;
|
private final MapSheetMngService mapSheetMngService;
|
||||||
|
|
||||||
|
@Value("${file.sync-root-dir}")
|
||||||
|
private String syncRootDir;
|
||||||
|
|
||||||
|
@Value("${file.sync-tmp-dir}")
|
||||||
|
private String syncRootTmpDir;
|
||||||
|
|
||||||
@Operation(summary = "영상 데이터 관리 목록 조회", description = "영상 데이터 관리 목록 조회")
|
@Operation(summary = "영상 데이터 관리 목록 조회", description = "영상 데이터 관리 목록 조회")
|
||||||
@ApiResponses(
|
@ApiResponses(
|
||||||
value = {
|
value = {
|
||||||
@@ -300,4 +310,38 @@ public class MapSheetMngApiController {
|
|||||||
|
|
||||||
return ApiResponseDto.ok(mapSheetMngService.findMapSheetMngDoneYyyyList());
|
return ApiResponseDto.ok(mapSheetMngService.findMapSheetMngDoneYyyyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "영상 tif 대용량 파일 분할 전송", description = "영상 tif 파일 대용량 파일을 청크 단위로 전송합니다.")
|
||||||
|
@ApiResponses(
|
||||||
|
value = {
|
||||||
|
@ApiResponse(responseCode = "200", description = "청크 업로드 성공", content = @Content),
|
||||||
|
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
|
||||||
|
@ApiResponse(responseCode = "404", description = "업로드 세션을 찾을 수 없음", content = @Content),
|
||||||
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
|
})
|
||||||
|
@PostMapping(value = "/file-chunk-upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||||
|
public ApiResponseDto<ModelUploadResDto> fileChunkUpload(
|
||||||
|
@RequestParam("hstUid") Long hstUid,
|
||||||
|
@RequestParam("fileName") String fileName,
|
||||||
|
@RequestParam("fileSize") long fileSize,
|
||||||
|
@RequestParam("chunkIndex") Integer chunkIndex,
|
||||||
|
@RequestParam("chunkTotalIndex") Integer chunkTotalIndex,
|
||||||
|
@RequestPart("chunkFile") MultipartFile chunkFile)
|
||||||
|
throws IOException {
|
||||||
|
|
||||||
|
String uploadDivi = "mapsheet";
|
||||||
|
|
||||||
|
UploadDto.UploadAddReq upAddReqDto = new UploadDto.UploadAddReq();
|
||||||
|
upAddReqDto.setDatasetId(0L);
|
||||||
|
upAddReqDto.setFileName(fileName);
|
||||||
|
upAddReqDto.setFileSize(fileSize);
|
||||||
|
upAddReqDto.setChunkIndex(chunkIndex);
|
||||||
|
upAddReqDto.setChunkTotalIndex(chunkTotalIndex);
|
||||||
|
upAddReqDto.setUploadDivi(uploadDivi);
|
||||||
|
upAddReqDto.setFinalPath(syncRootDir);
|
||||||
|
upAddReqDto.setTempPath(syncRootTmpDir);
|
||||||
|
|
||||||
|
return ApiResponseDto.ok(
|
||||||
|
mapSheetMngService.uploadChunkMapSheetFile(hstUid, upAddReqDto, chunkFile));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.kamco.cd.kamcoback.common.utils.interfaces.JsonFormatDttm;
|
|||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@@ -256,6 +257,8 @@ public class MapSheetMngDto {
|
|||||||
private String errorCheckTifFileName;
|
private String errorCheckTifFileName;
|
||||||
private String mapSheetPath;
|
private String mapSheetPath;
|
||||||
|
|
||||||
|
private UUID uuid;
|
||||||
|
|
||||||
// private List<MngFIleDto> fileArray;
|
// private List<MngFIleDto> fileArray;
|
||||||
|
|
||||||
public ErrorDataDto(
|
public ErrorDataDto(
|
||||||
@@ -274,7 +277,8 @@ public class MapSheetMngDto {
|
|||||||
String errorCheckState,
|
String errorCheckState,
|
||||||
String errorCheckTfwFileName,
|
String errorCheckTfwFileName,
|
||||||
String errorCheckTifFileName,
|
String errorCheckTifFileName,
|
||||||
String mapSheetPath) {
|
String mapSheetPath,
|
||||||
|
UUID uuid) {
|
||||||
this.hstUid = hstUid;
|
this.hstUid = hstUid;
|
||||||
this.mngYyyy = mngYyyy;
|
this.mngYyyy = mngYyyy;
|
||||||
this.mapSheetNum = mapSheetNum;
|
this.mapSheetNum = mapSheetNum;
|
||||||
@@ -293,6 +297,7 @@ public class MapSheetMngDto {
|
|||||||
this.errorCheckTfwFileName = errorCheckTfwFileName;
|
this.errorCheckTfwFileName = errorCheckTfwFileName;
|
||||||
this.errorCheckTifFileName = errorCheckTifFileName;
|
this.errorCheckTifFileName = errorCheckTifFileName;
|
||||||
this.mapSheetPath = mapSheetPath;
|
this.mapSheetPath = mapSheetPath;
|
||||||
|
this.uuid = uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getSyncStateName(String enumId) {
|
private String getSyncStateName(String enumId) {
|
||||||
|
|||||||
@@ -15,8 +15,12 @@ import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.MngDto;
|
|||||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.MngFilesDto;
|
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.MngFilesDto;
|
||||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.MngYyyyDto;
|
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.MngYyyyDto;
|
||||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.YearSearchReq;
|
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.YearSearchReq;
|
||||||
|
import com.kamco.cd.kamcoback.model.dto.ModelMngDto.ModelUploadResDto;
|
||||||
import com.kamco.cd.kamcoback.postgres.core.MapSheetMngCoreService;
|
import com.kamco.cd.kamcoback.postgres.core.MapSheetMngCoreService;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.YearEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.YearEntity;
|
||||||
|
import com.kamco.cd.kamcoback.upload.dto.UploadDto;
|
||||||
|
import com.kamco.cd.kamcoback.upload.dto.UploadDto.UploadAddReq;
|
||||||
|
import com.kamco.cd.kamcoback.upload.service.UploadService;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
@@ -38,6 +42,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
public class MapSheetMngService {
|
public class MapSheetMngService {
|
||||||
|
|
||||||
private final MapSheetMngCoreService mapSheetMngCoreService;
|
private final MapSheetMngCoreService mapSheetMngCoreService;
|
||||||
|
private final UploadService uploadService;
|
||||||
private final UserUtil userUtil = new UserUtil();
|
private final UserUtil userUtil = new UserUtil();
|
||||||
|
|
||||||
@Value("${file.sync-root-dir}")
|
@Value("${file.sync-root-dir}")
|
||||||
@@ -129,15 +134,15 @@ public class MapSheetMngService {
|
|||||||
MngDto mngDto = mapSheetMngCoreService.findMapSheetMng(errDto.getMngYyyy());
|
MngDto mngDto = mapSheetMngCoreService.findMapSheetMng(errDto.getMngYyyy());
|
||||||
String targetYearDir = mngDto.getMngPath();
|
String targetYearDir = mngDto.getMngPath();
|
||||||
|
|
||||||
// 중복체크
|
// 중복체크 -> 도엽/uuid 경로에 업로드 할 거라 overwrite 되지 않음
|
||||||
if (!overwrite) {
|
// if (!overwrite) {
|
||||||
dmlReturn =
|
// dmlReturn =
|
||||||
this.duplicateFile(
|
// this.duplicateFile(
|
||||||
errDto.getMngYyyy(), tfwFile.getOriginalFilename(), tifFile.getOriginalFilename());
|
// errDto.getMngYyyy(), tfwFile.getOriginalFilename(), tifFile.getOriginalFilename());
|
||||||
if (dmlReturn.getFlag().equals("duplicate")) {
|
// if (dmlReturn.getFlag().equals("duplicate")) {
|
||||||
return dmlReturn;
|
// return dmlReturn;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 멀티파트 파일 tmp폴더 저장(파일형식 체크를 위해)
|
// 멀티파트 파일 tmp폴더 저장(파일형식 체크를 위해)
|
||||||
String tfwTmpPath = tmpPath + tfwFile.getOriginalFilename();
|
String tfwTmpPath = tmpPath + tfwFile.getOriginalFilename();
|
||||||
@@ -146,13 +151,13 @@ public class MapSheetMngService {
|
|||||||
if (!FIleChecker.multipartSaveTo(tfwFile, tfwTmpPath)) {
|
if (!FIleChecker.multipartSaveTo(tfwFile, tfwTmpPath)) {
|
||||||
return new DmlReturn("fail", "UPLOAD ERROR");
|
return new DmlReturn("fail", "UPLOAD ERROR");
|
||||||
}
|
}
|
||||||
if (!FIleChecker.multipartSaveTo(tifFile, tifTmpPath)) {
|
// if (!FIleChecker.multipartSaveTo(tifFile, tifTmpPath)) {
|
||||||
return new DmlReturn("fail", "UPLOAD ERROR");
|
// return new DmlReturn("fail", "UPLOAD ERROR");
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (!FIleChecker.cmmndGdalInfo(tifTmpPath)) {
|
// if (!FIleChecker.cmmndGdalInfo(tifTmpPath)) {
|
||||||
return new DmlReturn("fail", "TIF TYPE ERROR");
|
// return new DmlReturn("fail", "TIF TYPE ERROR");
|
||||||
}
|
// }
|
||||||
if (!FIleChecker.checkTfw(tfwTmpPath)) {
|
if (!FIleChecker.checkTfw(tfwTmpPath)) {
|
||||||
return new DmlReturn("fail", "TFW TYPE ERROR");
|
return new DmlReturn("fail", "TFW TYPE ERROR");
|
||||||
}
|
}
|
||||||
@@ -161,12 +166,12 @@ public class MapSheetMngService {
|
|||||||
List<MngFilesDto> mngFiles = mapSheetMngCoreService.findByHstUidMapSheetFileList(hstUid);
|
List<MngFilesDto> mngFiles = mapSheetMngCoreService.findByHstUidMapSheetFileList(hstUid);
|
||||||
String uploadPath = "";
|
String uploadPath = "";
|
||||||
for (MngFilesDto dto : mngFiles) {
|
for (MngFilesDto dto : mngFiles) {
|
||||||
uploadPath = dto.getFilePath();
|
uploadPath = dto.getFilePath() + "/" + errDto.getUuid();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Path tfwTmpSavePath = Paths.get(tfwTmpPath);
|
Path tfwTmpSavePath = Paths.get(tfwTmpPath);
|
||||||
Path tifTmpSavePath = Paths.get(tifTmpPath);
|
// Path tifTmpSavePath = Paths.get(tifTmpPath);
|
||||||
Path tfwTargetPath = null;
|
Path tfwTargetPath = null;
|
||||||
Path tifTargetPath = null;
|
Path tifTargetPath = null;
|
||||||
|
|
||||||
@@ -175,7 +180,12 @@ public class MapSheetMngService {
|
|||||||
MngFilesDto filesDto =
|
MngFilesDto filesDto =
|
||||||
mapSheetMngCoreService.findYyyyToMapSheetFilePathRefer(errDto.getMngYyyy());
|
mapSheetMngCoreService.findYyyyToMapSheetFilePathRefer(errDto.getMngYyyy());
|
||||||
String referPath = filesDto.getFilePath();
|
String referPath = filesDto.getFilePath();
|
||||||
uploadPath = Paths.get(referPath).getParent().toString() + "/" + errDto.getRefMapSheetNum();
|
uploadPath =
|
||||||
|
Paths.get(referPath).getParent().toString()
|
||||||
|
+ "/"
|
||||||
|
+ errDto.getRefMapSheetNum()
|
||||||
|
+ "/"
|
||||||
|
+ errDto.getUuid();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 업로드 경로 확인(없으면 생성)
|
// 업로드 경로 확인(없으면 생성)
|
||||||
@@ -186,9 +196,13 @@ public class MapSheetMngService {
|
|||||||
tfwTargetPath = Paths.get(uploadPath).resolve(tfwFile.getOriginalFilename());
|
tfwTargetPath = Paths.get(uploadPath).resolve(tfwFile.getOriginalFilename());
|
||||||
tifTargetPath = Paths.get(uploadPath).resolve(tifFile.getOriginalFilename());
|
tifTargetPath = Paths.get(uploadPath).resolve(tifFile.getOriginalFilename());
|
||||||
|
|
||||||
|
if (!Files.exists(tifTargetPath)) {
|
||||||
|
return new DmlReturn("fail", "TIF 파일이 정상적으로 업로드 되지 않았습니다. 확인해주세요.");
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Files.move(tfwTmpSavePath, tfwTargetPath, StandardCopyOption.REPLACE_EXISTING);
|
Files.move(tfwTmpSavePath, tfwTargetPath, StandardCopyOption.REPLACE_EXISTING);
|
||||||
Files.move(tifTmpSavePath, tifTargetPath, StandardCopyOption.REPLACE_EXISTING);
|
// Files.move(tifTmpSavePath, tifTargetPath, StandardCopyOption.REPLACE_EXISTING);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
@@ -357,4 +371,55 @@ public class MapSheetMngService {
|
|||||||
|
|
||||||
return yearList;
|
return yearList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public ModelUploadResDto uploadChunkMapSheetFile(
|
||||||
|
Long hstUid, UploadAddReq upAddReqDto, MultipartFile chunkFile) throws IOException {
|
||||||
|
|
||||||
|
ErrorDataDto errDto = mapSheetMngCoreService.findMapSheetError(hstUid);
|
||||||
|
|
||||||
|
// 싱크파일목록으로 업로드 경로 확인
|
||||||
|
List<MngFilesDto> mngFiles = mapSheetMngCoreService.findByHstUidMapSheetFileList(hstUid);
|
||||||
|
String uploadPath = "";
|
||||||
|
for (MngFilesDto dto : mngFiles) {
|
||||||
|
uploadPath = dto.getFilePath();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (uploadPath.isEmpty()) {
|
||||||
|
MngFilesDto filesDto =
|
||||||
|
mapSheetMngCoreService.findYyyyToMapSheetFilePathRefer(errDto.getMngYyyy());
|
||||||
|
String referPath = filesDto.getFilePath();
|
||||||
|
uploadPath = Paths.get(referPath).getParent().toString() + "/" + errDto.getRefMapSheetNum();
|
||||||
|
}
|
||||||
|
|
||||||
|
upAddReqDto.setUuid(errDto.getUuid());
|
||||||
|
upAddReqDto.setFinalPath(uploadPath + "/");
|
||||||
|
upAddReqDto.setTempPath(upAddReqDto.getTempPath() + "/");
|
||||||
|
|
||||||
|
UploadDto.UploadRes upRes = uploadService.uploadChunk(upAddReqDto, chunkFile);
|
||||||
|
|
||||||
|
ModelUploadResDto modelUploadResDto = new ModelUploadResDto();
|
||||||
|
|
||||||
|
// 병합 다 했는데 gdalinfo 가 fail 이면 삭제?
|
||||||
|
if (upRes.getRes().equals("MERGED")) {
|
||||||
|
if (!FIleChecker.cmmndGdalInfo(upRes.getFilePath() + "/" + upRes.getFileName())) {
|
||||||
|
Path filePath = Paths.get(upRes.getFilePath());
|
||||||
|
Files.deleteIfExists(filePath);
|
||||||
|
modelUploadResDto.setRes("fail");
|
||||||
|
modelUploadResDto.setResMsg("TIF TYPE ERROR");
|
||||||
|
return modelUploadResDto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
modelUploadResDto.setRes(upRes.getRes());
|
||||||
|
modelUploadResDto.setResMsg(upRes.getResMsg());
|
||||||
|
modelUploadResDto.setUuid(upRes.getUuid());
|
||||||
|
modelUploadResDto.setFilePath(upRes.getFilePath());
|
||||||
|
modelUploadResDto.setFileName(upRes.getFileName());
|
||||||
|
modelUploadResDto.setChunkIndex(upRes.getChunkIndex());
|
||||||
|
modelUploadResDto.setChunkTotalIndex(upRes.getChunkTotalIndex());
|
||||||
|
|
||||||
|
return modelUploadResDto;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,8 +38,10 @@ import jakarta.validation.constraints.NotNull;
|
|||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
import java.util.stream.Stream;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.dao.DataAccessException;
|
import org.springframework.dao.DataAccessException;
|
||||||
@@ -263,10 +265,12 @@ public class InferenceResultCoreService {
|
|||||||
applyModelUpdate(entity, request);
|
applyModelUpdate(entity, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Long> batchIds = new ArrayList<>();
|
List<Long> batchIds =
|
||||||
batchIds.add(entity.getM1ModelBatchId());
|
Stream.of(
|
||||||
batchIds.add(entity.getM2ModelBatchId());
|
entity.getM1ModelBatchId(), entity.getM2ModelBatchId(), entity.getM3ModelBatchId())
|
||||||
batchIds.add(entity.getM3ModelBatchId());
|
.filter(Objects::nonNull)
|
||||||
|
.distinct() // 중복 방지 (선택)
|
||||||
|
.toList();
|
||||||
|
|
||||||
// testing 추론결과 테이블 조회하여 탐지 개수 업데이트
|
// testing 추론결과 테이블 조회하여 탐지 개수 업데이트
|
||||||
Long testing = getInferenceResultCnt(batchIds);
|
Long testing = getInferenceResultCnt(batchIds);
|
||||||
@@ -509,10 +513,7 @@ public class InferenceResultCoreService {
|
|||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
throw new CustomApiException("NOT_FOUND_DATA", HttpStatus.NOT_FOUND);
|
throw new CustomApiException("NOT_FOUND_DATA", HttpStatus.NOT_FOUND);
|
||||||
}
|
}
|
||||||
// inferenceResultRepository
|
|
||||||
// .getInferenceUid(uuid)
|
|
||||||
// .orElseThrow(() -> new CustomApiException("NOT_FOUND_DATA",
|
|
||||||
// HttpStatus.NOT_FOUND));
|
|
||||||
InferenceLearnDto dto = new InferenceLearnDto();
|
InferenceLearnDto dto = new InferenceLearnDto();
|
||||||
dto.setUid(entity.getUid());
|
dto.setUid(entity.getUid());
|
||||||
dto.setM1ModelBatchId(entity.getM1ModelBatchId());
|
dto.setM1ModelBatchId(entity.getM1ModelBatchId());
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import jakarta.persistence.ManyToOne;
|
|||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
|
import java.util.UUID;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -159,6 +160,9 @@ public class MapSheetMngHstEntity extends CommonDateEntity {
|
|||||||
@Column(name = "sync_check_tfw_file_name", length = 100)
|
@Column(name = "sync_check_tfw_file_name", length = 100)
|
||||||
private String syncCheckTfwFileName;
|
private String syncCheckTfwFileName;
|
||||||
|
|
||||||
|
@Column(name = "uuid")
|
||||||
|
private UUID uuid;
|
||||||
|
|
||||||
// 파일정보 업데이트
|
// 파일정보 업데이트
|
||||||
public void updateFileInfos(Long tifSizeBytes, Long tfwSizeBytes) {
|
public void updateFileInfos(Long tifSizeBytes, Long tfwSizeBytes) {
|
||||||
tifSizeBytes = tifSizeBytes == null ? 0L : tifSizeBytes;
|
tifSizeBytes = tifSizeBytes == null ? 0L : tifSizeBytes;
|
||||||
|
|||||||
@@ -328,7 +328,8 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
|
|||||||
mapSheetLearnEntity.stage,
|
mapSheetLearnEntity.stage,
|
||||||
Expressions.stringTemplate("substring({0} from 1 for 8)", mapSheetLearnEntity.uid),
|
Expressions.stringTemplate("substring({0} from 1 for 8)", mapSheetLearnEntity.uid),
|
||||||
mapSheetLearnEntity.applyYn,
|
mapSheetLearnEntity.applyYn,
|
||||||
mapSheetLearnEntity.applyDttm))
|
mapSheetLearnEntity.applyDttm,
|
||||||
|
mapSheetAnalInferenceEntity.uuid))
|
||||||
.from(mapSheetLearnEntity)
|
.from(mapSheetLearnEntity)
|
||||||
.leftJoin(m1)
|
.leftJoin(m1)
|
||||||
.on(mapSheetLearnEntity.m1ModelUuid.eq(m1.uuid))
|
.on(mapSheetLearnEntity.m1ModelUuid.eq(m1.uuid))
|
||||||
@@ -336,6 +337,8 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
|
|||||||
.on(mapSheetLearnEntity.m2ModelUuid.eq(m2.uuid))
|
.on(mapSheetLearnEntity.m2ModelUuid.eq(m2.uuid))
|
||||||
.leftJoin(m3)
|
.leftJoin(m3)
|
||||||
.on(mapSheetLearnEntity.m3ModelUuid.eq(m3.uuid))
|
.on(mapSheetLearnEntity.m3ModelUuid.eq(m3.uuid))
|
||||||
|
.leftJoin(mapSheetAnalInferenceEntity)
|
||||||
|
.on(mapSheetAnalInferenceEntity.learnId.eq(mapSheetLearnEntity.id))
|
||||||
.where(mapSheetLearnEntity.uuid.eq(uuid))
|
.where(mapSheetLearnEntity.uuid.eq(uuid))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1811,7 +1811,9 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
return queryFactory
|
return queryFactory
|
||||||
.select(mapSheetAnalInferenceEntity.id.count())
|
.select(mapSheetAnalInferenceEntity.id.count())
|
||||||
.from(mapSheetAnalInferenceEntity)
|
.from(mapSheetAnalInferenceEntity)
|
||||||
.where(mapSheetAnalInferenceEntity.analState.eq(LabelMngState.ING.getId()))
|
.where(
|
||||||
|
mapSheetAnalInferenceEntity.analState.in(
|
||||||
|
LabelMngState.ASSIGNED.getId(), LabelMngState.ING.getId()))
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -387,7 +387,8 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
mapSheetMngHstEntity.syncCheckState,
|
mapSheetMngHstEntity.syncCheckState,
|
||||||
mapSheetMngHstEntity.syncCheckTfwFileName,
|
mapSheetMngHstEntity.syncCheckTfwFileName,
|
||||||
mapSheetMngHstEntity.syncCheckTifFileName,
|
mapSheetMngHstEntity.syncCheckTifFileName,
|
||||||
mapSheetMngHstEntity.mapSheetPath))
|
mapSheetMngHstEntity.mapSheetPath,
|
||||||
|
mapSheetMngHstEntity.uuid))
|
||||||
.from(mapSheetMngHstEntity)
|
.from(mapSheetMngHstEntity)
|
||||||
.innerJoin(mapInkx5kEntity)
|
.innerJoin(mapInkx5kEntity)
|
||||||
.on(
|
.on(
|
||||||
@@ -435,7 +436,6 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
Expressions.stringTemplate(
|
Expressions.stringTemplate(
|
||||||
"concat({0}, substring({1}, 1, 5))",
|
"concat({0}, substring({1}, 1, 5))",
|
||||||
mapInkx5kEntity.mapidNm, mapSheetMngHstEntity.mapSheetNum),
|
mapInkx5kEntity.mapidNm, mapSheetMngHstEntity.mapSheetNum),
|
||||||
|
|
||||||
// 튜플 방지: concat으로 문자열 생성
|
// 튜플 방지: concat으로 문자열 생성
|
||||||
Expressions.stringTemplate(
|
Expressions.stringTemplate(
|
||||||
"concat('(', {0}, ',', {1}, ')')",
|
"concat('(', {0}, ',', {1}, ')')",
|
||||||
@@ -443,18 +443,18 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
Expressions.stringTemplate(
|
Expressions.stringTemplate(
|
||||||
"concat({0}, substring({1}, 6, 3))",
|
"concat({0}, substring({1}, 6, 3))",
|
||||||
mapInkx5kEntity.mapidNm, mapSheetMngHstEntity.mapSheetNum),
|
mapInkx5kEntity.mapidNm, mapSheetMngHstEntity.mapSheetNum),
|
||||||
|
|
||||||
// fid 타입 주의 (Long이면 DTO도 Long으로 맞추는 걸 추천)
|
// fid 타입 주의 (Long이면 DTO도 Long으로 맞추는 걸 추천)
|
||||||
mapInkx5kEntity.fid, // 또는 mapInkx5kEntity.fid.intValue()
|
mapInkx5kEntity.fid, // 또는 mapInkx5kEntity.fid.intValue()
|
||||||
|
|
||||||
// createdDate 말고 ZonedDateTime으로 매핑된 필드로
|
// createdDate 말고 ZonedDateTime으로 매핑된 필드로
|
||||||
mapSheetMngHstEntity.createdDate, // (예시)
|
mapSheetMngHstEntity.createdDate, // (예시) //createdDttm
|
||||||
mapSheetMngHstEntity.syncState,
|
mapSheetMngHstEntity.syncState,
|
||||||
mapSheetMngHstEntity.syncTfwFileName,
|
mapSheetMngHstEntity.syncTfwFileName,
|
||||||
mapSheetMngHstEntity.syncTifFileName,
|
mapSheetMngHstEntity.syncTifFileName,
|
||||||
mapSheetMngHstEntity.syncCheckState,
|
mapSheetMngHstEntity.syncCheckState,
|
||||||
mapSheetMngHstEntity.syncCheckTfwFileName,
|
mapSheetMngHstEntity.syncCheckTfwFileName,
|
||||||
mapSheetMngHstEntity.syncCheckTifFileName))
|
mapSheetMngHstEntity.syncCheckTifFileName,
|
||||||
|
mapSheetMngHstEntity.mapSheetPath,
|
||||||
|
mapSheetMngHstEntity.uuid))
|
||||||
.from(mapSheetMngHstEntity)
|
.from(mapSheetMngHstEntity)
|
||||||
.innerJoin(mapInkx5kEntity)
|
.innerJoin(mapInkx5kEntity)
|
||||||
.on(mapSheetMngHstEntity.mapSheetNum.eq(mapInkx5kEntity.mapidcdNo))
|
.on(mapSheetMngHstEntity.mapSheetNum.eq(mapInkx5kEntity.mapidcdNo))
|
||||||
|
|||||||
@@ -14,14 +14,17 @@ import com.kamco.cd.kamcoback.inference.dto.InferenceSendDto;
|
|||||||
import com.kamco.cd.kamcoback.postgres.core.InferenceResultCoreService;
|
import com.kamco.cd.kamcoback.postgres.core.InferenceResultCoreService;
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.BatchStatusDto;
|
import com.kamco.cd.kamcoback.scheduler.dto.BatchStatusDto;
|
||||||
import com.kamco.cd.kamcoback.scheduler.dto.JobStatusDto;
|
import com.kamco.cd.kamcoback.scheduler.dto.JobStatusDto;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
@@ -244,15 +247,16 @@ public class MapSheetInferenceJobService {
|
|||||||
inferenceResultCoreService.upsertGeomData(sheet.getId());
|
inferenceResultCoreService.upsertGeomData(sheet.getId());
|
||||||
|
|
||||||
// 추론 종료일때 shp 파일 생성
|
// 추론 종료일때 shp 파일 생성
|
||||||
List<Long> batchIds = new ArrayList<>();
|
List<Long> batchIds =
|
||||||
batchIds.add(sheet.getM1BatchId());
|
Stream.of(sheet.getM1BatchId(), sheet.getM2BatchId(), sheet.getM3BatchId())
|
||||||
batchIds.add(sheet.getM2BatchId());
|
.filter(Objects::nonNull)
|
||||||
batchIds.add(sheet.getM3BatchId());
|
.distinct()
|
||||||
|
.toList();
|
||||||
|
|
||||||
String batchId = sheet.getM1BatchId() + "," + sheet.getM2BatchId() + "," + sheet.getM3BatchId();
|
String batchIdStr = batchIds.stream().map(String::valueOf).collect(Collectors.joining(","));
|
||||||
|
|
||||||
// shp 파일 비동기 생성
|
// shp 파일 비동기 생성
|
||||||
shpPipelineService.runPipeline(jarPath, datasetDir, batchId, sheet.getUid());
|
shpPipelineService.runPipeline(jarPath, datasetDir, batchIdStr, sheet.getUid());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -343,11 +347,13 @@ public class MapSheetInferenceJobService {
|
|||||||
InferenceSendDto m = new InferenceSendDto();
|
InferenceSendDto m = new InferenceSendDto();
|
||||||
m.setPred_requests_areas(predRequestsAreas);
|
m.setPred_requests_areas(predRequestsAreas);
|
||||||
m.setModel_version(progressDto.getModelVersion());
|
m.setModel_version(progressDto.getModelVersion());
|
||||||
m.setCd_model_path(progressDto.getCdModelPath() + "/" + progressDto.getCdModelFileName());
|
m.setCd_model_path(
|
||||||
|
Paths.get(progressDto.getCdModelPath(), progressDto.getCdModelFileName()).toString());
|
||||||
m.setCd_model_config(
|
m.setCd_model_config(
|
||||||
progressDto.getCdModelConfigPath() + "/" + progressDto.getCdModelConfigFileName());
|
Paths.get(progressDto.getCdModelConfigPath(), progressDto.getCdModelConfigFileName())
|
||||||
|
.toString());
|
||||||
m.setCls_model_path(
|
m.setCls_model_path(
|
||||||
progressDto.getCdModelClsPath() + "/" + progressDto.getCdModelClsFileName());
|
Paths.get(progressDto.getCdModelClsPath(), progressDto.getCdModelClsFileName()).toString());
|
||||||
m.setCls_model_version(progressDto.getClsModelVersion());
|
m.setCls_model_version(progressDto.getClsModelVersion());
|
||||||
m.setCd_model_type(inferenceType);
|
m.setCd_model_type(inferenceType);
|
||||||
m.setPriority(progressDto.getPriority());
|
m.setPriority(progressDto.getPriority());
|
||||||
|
|||||||
Reference in New Issue
Block a user