[KC-116] 추론 다운로드 이력 수정
This commit is contained in:
@@ -6,6 +6,10 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
|
||||
/** GeoJSON 파일 생성 유틸리티 */
|
||||
@@ -154,4 +158,14 @@ public class GeoJsonFileWriter {
|
||||
return filePath + "/" + fileName;
|
||||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public static class Scene {
|
||||
|
||||
List<ImageFeature> features;
|
||||
String filePath;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -467,9 +467,6 @@ public class InferenceResultApiController {
|
||||
@Parameter(description = "UUID", example = "0192efc6-9ec2-43ee-9a90-5b73e763c09f")
|
||||
@PathVariable
|
||||
UUID uuid,
|
||||
@Parameter(description = "구분-NAME(이름), EMPLOYEE_NO(사번)", example = "NAME")
|
||||
@RequestParam(required = false)
|
||||
String type,
|
||||
@Parameter(description = "다운로드일 시작", example = "2025-01-01") @RequestParam(required = false)
|
||||
LocalDate strtDttm,
|
||||
@Parameter(description = "다운로드일 종료", example = "2026-01-01") @RequestParam(required = false)
|
||||
@@ -487,7 +484,6 @@ public class InferenceResultApiController {
|
||||
downloadReq.setUuid(uuid);
|
||||
downloadReq.setStartDate(strtDttm);
|
||||
downloadReq.setEndDate(endDttm);
|
||||
downloadReq.setType(type);
|
||||
downloadReq.setSearchValue(searchValue);
|
||||
downloadReq.setMenuId("22");
|
||||
downloadReq.setRequestUri("/api/inference/download-audit");
|
||||
|
||||
@@ -481,4 +481,14 @@ public class InferenceDetailDto {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class Scene {
|
||||
|
||||
private String path;
|
||||
private Integer size;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,15 +240,15 @@ public class InferenceResultDto {
|
||||
@NotBlank
|
||||
private String title;
|
||||
|
||||
@Schema(description = "M1", example = "3e5d18b8-a7d7-4ce1-9f1e-52d75f953439")
|
||||
@Schema(description = "M1", example = "b40e0f68-c1d8-49fc-93f9-a36270093861")
|
||||
@NotNull
|
||||
private UUID model1Uuid;
|
||||
|
||||
@Schema(description = "M2", example = "55fba5d2-f69c-47ea-b54c-7efc8e1ecfa0")
|
||||
@Schema(description = "M2", example = "ec92b7d2-b5a3-4915-9bdf-35fb3ca8ad27")
|
||||
@NotNull
|
||||
private UUID model2Uuid;
|
||||
|
||||
@Schema(description = "M3", example = "a96cb525-a17c-4157-9e4a-49cceeb17518")
|
||||
@Schema(description = "M3", example = "37f45782-8ccf-4cf6-911c-a055a1510d39")
|
||||
@NotNull
|
||||
private UUID model3Uuid;
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.kamco.cd.kamcoback.common.exception.CustomApiException;
|
||||
import com.kamco.cd.kamcoback.common.geometry.GeoJsonFileWriter.ImageFeature;
|
||||
import com.kamco.cd.kamcoback.common.geometry.GeoJsonFileWriter.Scene;
|
||||
import com.kamco.cd.kamcoback.common.utils.UserUtil;
|
||||
import com.kamco.cd.kamcoback.config.resttemplate.ExternalHttpClient;
|
||||
import com.kamco.cd.kamcoback.config.resttemplate.ExternalHttpClient.ExternalCallResult;
|
||||
@@ -172,9 +174,6 @@ public class InferenceResultService {
|
||||
}
|
||||
}
|
||||
|
||||
// 목록 및 추론 대상 도엽정보 저장
|
||||
UUID uuid = inferenceResultCoreService.saveInferenceInfo(req, targetList);
|
||||
|
||||
// 추론에 필요한 geojson 파일 생성
|
||||
List<String> mapSheetNumList =
|
||||
targetList.stream()
|
||||
@@ -183,7 +182,7 @@ public class InferenceResultService {
|
||||
.toList();
|
||||
|
||||
// 비교년도 geojson 파일 생성하여 경로 받기
|
||||
String modelComparePath =
|
||||
Scene modelComparePath =
|
||||
getSceneInference(
|
||||
String.valueOf(req.getCompareYyyy()),
|
||||
mapSheetNumList,
|
||||
@@ -191,19 +190,44 @@ public class InferenceResultService {
|
||||
req.getDetectOption());
|
||||
|
||||
// 기준년도 geojson 파일 생성하여 경로 받기
|
||||
String modelTargetPath =
|
||||
Scene modelTargetPath =
|
||||
getSceneInference(
|
||||
String.valueOf(req.getTargetYyyy()),
|
||||
mapSheetNumList,
|
||||
req.getMapSheetScope(),
|
||||
req.getDetectOption());
|
||||
|
||||
// 작은 쪽 기준으로 탐지건수/파일생성 리스트 결정
|
||||
List<ImageFeature> imageFeatureList;
|
||||
if (modelComparePath.getFeatures().size() <= modelTargetPath.getFeatures().size()) {
|
||||
imageFeatureList = modelComparePath.getFeatures();
|
||||
} else {
|
||||
imageFeatureList = modelTargetPath.getFeatures();
|
||||
}
|
||||
|
||||
// imageFeatureList 기준 sceneId Set
|
||||
Set<String> sceneIdSet =
|
||||
imageFeatureList.stream()
|
||||
.map(ImageFeature::getSceneId)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
// targetList(List<MngListDto>) 리턴용으로 필터링
|
||||
List<MngListDto> newTargetList =
|
||||
targetList.stream()
|
||||
.filter(m -> m.getMapSheetNum() != null)
|
||||
.filter(m -> sceneIdSet.contains(m.getMapSheetNum()))
|
||||
.toList();
|
||||
|
||||
// 목록 및 추론 대상 도엽정보 저장
|
||||
UUID uuid = inferenceResultCoreService.saveInferenceInfo(req, newTargetList);
|
||||
|
||||
// ai 서버에 전달할 파라미터 생성
|
||||
pred_requests_areas predRequestsAreas = new pred_requests_areas();
|
||||
predRequestsAreas.setInput1_year(req.getCompareYyyy());
|
||||
predRequestsAreas.setInput2_year(req.getTargetYyyy());
|
||||
predRequestsAreas.setInput1_scene_path(modelComparePath);
|
||||
predRequestsAreas.setInput2_scene_path(modelTargetPath);
|
||||
predRequestsAreas.setInput1_scene_path(modelComparePath.getFilePath());
|
||||
predRequestsAreas.setInput2_scene_path(modelTargetPath.getFilePath());
|
||||
|
||||
InferenceSendDto m1 = this.getModelInfo(req.getModel1Uuid());
|
||||
m1.setPred_requests_areas(predRequestsAreas);
|
||||
@@ -218,8 +242,8 @@ public class InferenceResultService {
|
||||
saveInferenceAiDto.setStatus(Status.IN_PROGRESS.getId());
|
||||
saveInferenceAiDto.setType("M1");
|
||||
saveInferenceAiDto.setInferStartDttm(ZonedDateTime.now());
|
||||
saveInferenceAiDto.setModelComparePath(modelComparePath);
|
||||
saveInferenceAiDto.setModelTargetPath(modelTargetPath);
|
||||
saveInferenceAiDto.setModelComparePath(modelComparePath.getFilePath());
|
||||
saveInferenceAiDto.setModelTargetPath(modelTargetPath.getFilePath());
|
||||
saveInferenceAiDto.setModelStartDttm(ZonedDateTime.now());
|
||||
inferenceResultCoreService.update(saveInferenceAiDto);
|
||||
|
||||
@@ -406,7 +430,7 @@ public class InferenceResultService {
|
||||
* @param mapSheetScope EXCL : 추론제외, PREV 이전 년도 도엽 사용
|
||||
* @return
|
||||
*/
|
||||
private String getSceneInference(
|
||||
private Scene getSceneInference(
|
||||
String yyyy, List<String> mapSheetNums, String mapSheetScope, String detectOption) {
|
||||
return mapSheetMngCoreService.getSceneInference(
|
||||
yyyy, mapSheetNums, mapSheetScope, detectOption);
|
||||
@@ -565,10 +589,7 @@ public class InferenceResultService {
|
||||
* 다운로드 이력 조회
|
||||
*
|
||||
* @param searchReq 페이징
|
||||
* @param startDate 다운로드 시작일
|
||||
* @param endDate 다운로드 종료일
|
||||
* @param type 검색 구분
|
||||
* @param searchValue 키워드
|
||||
* @param downloadReq 조회조건
|
||||
*/
|
||||
public Page<AuditLogDto.DownloadRes> getDownloadAudit(
|
||||
AuditLogDto.searchReq searchReq, DownloadReq downloadReq) {
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package com.kamco.cd.kamcoback.log.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.kamco.cd.kamcoback.common.utils.enums.CodeExpose;
|
||||
import com.kamco.cd.kamcoback.common.utils.enums.EnumType;
|
||||
import com.kamco.cd.kamcoback.common.utils.interfaces.JsonFormatDttm;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.time.LocalDate;
|
||||
@@ -247,7 +245,6 @@ public class AuditLogDto {
|
||||
UUID uuid;
|
||||
LocalDate startDate;
|
||||
LocalDate endDate;
|
||||
String type;
|
||||
String searchValue;
|
||||
String menuId;
|
||||
String requestUri;
|
||||
@@ -262,25 +259,4 @@ public class AuditLogDto {
|
||||
String employeeNo;
|
||||
@JsonFormatDttm ZonedDateTime downloadDttm;
|
||||
}
|
||||
|
||||
@CodeExpose
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum AuditType implements EnumType {
|
||||
NAME("이름"),
|
||||
EMPLOYEE_NO("사번"),
|
||||
;
|
||||
|
||||
private final String desc;
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return name();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,12 +82,10 @@ public class InferenceResultCoreService {
|
||||
int detectingCnt = 0;
|
||||
|
||||
for (MngListDto dto : targetList) {
|
||||
if (Boolean.TRUE.equals(dto.getIsSuccess())) {
|
||||
if (detectingCnt == 0) {
|
||||
firstMapSheetName = dto.getMapSheetName();
|
||||
}
|
||||
detectingCnt++;
|
||||
if (detectingCnt == 0) {
|
||||
firstMapSheetName = dto.getMapSheetName();
|
||||
}
|
||||
detectingCnt++;
|
||||
}
|
||||
|
||||
if (detectingCnt == 0) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.kamco.cd.kamcoback.common.enums.MngStateType;
|
||||
import com.kamco.cd.kamcoback.common.exception.CustomApiException;
|
||||
import com.kamco.cd.kamcoback.common.geometry.GeoJsonFileWriter;
|
||||
import com.kamco.cd.kamcoback.common.geometry.GeoJsonFileWriter.ImageFeature;
|
||||
import com.kamco.cd.kamcoback.common.geometry.GeoJsonFileWriter.Scene;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.DetectOption;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.MapSheetScope;
|
||||
@@ -23,7 +24,9 @@ import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -231,9 +234,10 @@ public class MapSheetMngCoreService {
|
||||
* @param mapSheetScope EXCL : 추론제외, PREV 이전 년도 도엽 사용
|
||||
* @return
|
||||
*/
|
||||
public String getSceneInference(
|
||||
public Scene getSceneInference(
|
||||
String yyyy, List<String> scenes, String mapSheetScope, String detectOption) {
|
||||
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
boolean isAll = MapSheetScope.ALL.getId().equals(mapSheetScope);
|
||||
|
||||
String optionSuffix = "";
|
||||
@@ -278,7 +282,11 @@ public class MapSheetMngCoreService {
|
||||
new GeoJsonFileWriter()
|
||||
.exportToFile(sceneInference, "scene_inference_" + yyyy, 5186, outputPath.toString());
|
||||
|
||||
return outputPath.toString();
|
||||
Scene scene = new Scene();
|
||||
scene.setFeatures(sceneInference);
|
||||
scene.setFilePath(outputPath.toString());
|
||||
|
||||
return scene;
|
||||
|
||||
} catch (IOException e) {
|
||||
log.error(
|
||||
@@ -311,4 +319,5 @@ public class MapSheetMngCoreService {
|
||||
public List<MngListCompareDto> getByHstMapSheetCompareList(int mngYyyy, List<String> mapId) {
|
||||
return mapSheetMngRepository.findByHstMapSheetCompareList(mngYyyy, mapId);
|
||||
}
|
||||
;
|
||||
}
|
||||
|
||||
@@ -176,12 +176,12 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
whereBuilder.and(auditLogEntity.requestUri.endsWith(String.valueOf(req.getUuid())));
|
||||
}
|
||||
|
||||
if (req.getType() != null && !req.getType().isEmpty()) {
|
||||
if (req.getType().equals(AuditLogDto.AuditType.NAME.getId())) {
|
||||
whereBuilder.and(memberEntity.name.contains(req.getSearchValue()));
|
||||
} else if (req.getType().equals(AuditLogDto.AuditType.EMPLOYEE_NO.getId())) {
|
||||
whereBuilder.and(memberEntity.employeeNo.contains(req.getSearchValue()));
|
||||
}
|
||||
if (req.getSearchValue() != null && !req.getSearchValue().isEmpty()) {
|
||||
whereBuilder.and(
|
||||
memberEntity
|
||||
.name
|
||||
.contains(req.getSearchValue())
|
||||
.or(memberEntity.employeeNo.contains(req.getSearchValue())));
|
||||
}
|
||||
|
||||
List<AuditLogDto.DownloadRes> foundContent =
|
||||
|
||||
Reference in New Issue
Block a user