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