Merge pull request 'feat/infer_dev_260107' (#230) from feat/infer_dev_260107 into develop
Reviewed-on: https://kamco.gitea.gs.dabeeo.com/dabeeo/kamco-dabeeo-backoffice/pulls/230
This commit is contained in:
@@ -7,6 +7,8 @@ import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.kamco.cd.kamcoback.common.enums.DetectionClassification;
|
||||
import com.kamco.cd.kamcoback.common.utils.interfaces.JsonFormatDttm;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.DetectOption;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.MapSheetScope;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.time.Duration;
|
||||
import java.time.ZonedDateTime;
|
||||
@@ -428,7 +430,7 @@ public class InferenceDetailDto {
|
||||
@JsonFormatDttm private ZonedDateTime inferStartDttm;
|
||||
@JsonFormatDttm private ZonedDateTime inferEndDttm;
|
||||
|
||||
private Duration elapsedDuration;
|
||||
private String elapsedDuration;
|
||||
|
||||
public AnalResultInfo(
|
||||
String analTitle,
|
||||
@@ -447,14 +449,23 @@ public class InferenceDetailDto {
|
||||
this.modelVer3 = modelVer3;
|
||||
this.compareYyyy = compareYyyy;
|
||||
this.targetYyyy = targetYyyy;
|
||||
this.detectOption = detectOption;
|
||||
this.mapSheetScope = mapSheetScope;
|
||||
this.detectOption = DetectOption.getDescByCode(detectOption);
|
||||
this.mapSheetScope = MapSheetScope.getDescByCode(mapSheetScope);
|
||||
this.inferStartDttm = inferStartDttm;
|
||||
this.inferEndDttm = inferEndDttm;
|
||||
this.elapsedDuration =
|
||||
Duration elapsed =
|
||||
(inferStartDttm != null && inferEndDttm != null)
|
||||
? Duration.between(inferStartDttm, inferEndDttm)
|
||||
: null;
|
||||
|
||||
long seconds = elapsed.getSeconds();
|
||||
long abs = Math.abs(seconds);
|
||||
|
||||
long h = abs / 3600;
|
||||
long m = (abs % 3600) / 60;
|
||||
long s = abs % 60;
|
||||
|
||||
this.elapsedDuration = String.format("%02d:%02d:%02d", h, m, s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,112 @@ import org.springframework.data.domain.Pageable;
|
||||
|
||||
public class InferenceResultDto {
|
||||
|
||||
/** 탐지 데이터 옵션 dto */
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum MapSheetScope implements EnumType {
|
||||
ALL("전체"),
|
||||
PART("부분"),
|
||||
;
|
||||
|
||||
private final String desc;
|
||||
|
||||
public static MapSheetScope fromCode(String code) {
|
||||
return Arrays.stream(values()).filter(v -> v.name().equals(code)).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
public static String getDescByCode(String code) {
|
||||
return fromCode(code).getDesc();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return name();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
|
||||
/** 분석대상 도엽 enum */
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum DetectOption implements EnumType {
|
||||
EXCL("추론제외"),
|
||||
PREV("이전 년도 도엽 사용"),
|
||||
;
|
||||
private final String desc;
|
||||
|
||||
public static DetectOption fromCode(String code) {
|
||||
return Arrays.stream(values()).filter(v -> v.name().equals(code)).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
public static String getDescByCode(String code) {
|
||||
return fromCode(code).getDesc();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return name();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum Status implements EnumType {
|
||||
READY("대기"),
|
||||
IN_PROGRESS("진행중"),
|
||||
END("종료"),
|
||||
;
|
||||
private final String desc;
|
||||
|
||||
public static Status fromCode(String code) {
|
||||
return Arrays.stream(values()).filter(v -> v.name().equals(code)).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
public static String getDescByCode(String code) {
|
||||
return fromCode(code).getDesc();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return name();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ServerStatus implements EnumType {
|
||||
SAFETY("원활"),
|
||||
CAUTION("주의"),
|
||||
FAILUR("장애"),
|
||||
;
|
||||
|
||||
private final String desc;
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return name();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
|
||||
/** 목록조회 dto */
|
||||
@Getter
|
||||
@Setter
|
||||
@@ -69,75 +175,6 @@ public class InferenceResultDto {
|
||||
}
|
||||
}
|
||||
|
||||
/** 탐지 데이터 옵션 dto */
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum MapSheetScope implements EnumType {
|
||||
ALL("전체"),
|
||||
PART("부분"),
|
||||
;
|
||||
|
||||
private final String desc;
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return name();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
|
||||
/** 분석대상 도엽 enum */
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum DetectOption implements EnumType {
|
||||
EXCL("추론제외"),
|
||||
PREV("이전 년도 도엽 사용"),
|
||||
;
|
||||
private final String desc;
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return name();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum Status implements EnumType {
|
||||
READY("대기"),
|
||||
IN_PROGRESS("진행중"),
|
||||
END("종료"),
|
||||
;
|
||||
private final String desc;
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return name();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public static Status fromCode(String code) {
|
||||
return Arrays.stream(values()).filter(v -> v.name().equals(code)).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
public static String getDescByCode(String code) {
|
||||
return fromCode(code).getDesc();
|
||||
}
|
||||
}
|
||||
|
||||
/** 변화탐지 실행 정보 저장 요청 정보 */
|
||||
@Getter
|
||||
@Setter
|
||||
@@ -220,6 +257,13 @@ public class InferenceResultDto {
|
||||
private String model1Ver;
|
||||
private String model2Ver;
|
||||
private String model3Ver;
|
||||
private String usedServerName;
|
||||
private String model1VerStatus = "PROCCESING";
|
||||
private String model1VerStatusName = "진행중";
|
||||
private String model2VerStatus = "PROCCESING";
|
||||
private String model2VerStatusName = "진행중";
|
||||
private String model3VerStatus = "PROCCESING";
|
||||
private String model3VerStatusName = "진행중";
|
||||
|
||||
public InferenceStatusDetailDto(
|
||||
String title,
|
||||
@@ -264,14 +308,6 @@ public class InferenceResultDto {
|
||||
}
|
||||
}
|
||||
|
||||
private String usedServerName;
|
||||
private String model1VerStatus = "PROCCESING";
|
||||
private String model1VerStatusName = "진행중";
|
||||
private String model2VerStatus = "PROCCESING";
|
||||
private String model2VerStatusName = "진행중";
|
||||
private String model3VerStatus = "PROCCESING";
|
||||
private String model3VerStatusName = "진행중";
|
||||
|
||||
public String getDetectOptionName() {
|
||||
if (this.detectOption.equals("EXCL")) {
|
||||
return "추론제외";
|
||||
@@ -417,27 +453,6 @@ public class InferenceResultDto {
|
||||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ServerStatus implements EnumType {
|
||||
SAFETY("원활"),
|
||||
CAUTION("주의"),
|
||||
FAILUR("장애"),
|
||||
;
|
||||
|
||||
private final String desc;
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return name();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.kamco.cd.kamcoback.inference.dto.InferenceSendDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceSendDto.pred_requests_areas;
|
||||
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.TotalListDto;
|
||||
import com.kamco.cd.kamcoback.model.dto.ModelMngDto.Basic;
|
||||
import com.kamco.cd.kamcoback.postgres.core.InferenceResultCoreService;
|
||||
import com.kamco.cd.kamcoback.postgres.core.MapSheetMngCoreService;
|
||||
@@ -30,7 +31,6 @@ import com.kamco.cd.kamcoback.postgres.core.ModelMngCoreService;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
@@ -113,26 +113,26 @@ public class InferenceResultService {
|
||||
throw new CustomApiException("NOT_FOUND_COMPARE_YEAR", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
List<Map<String, Object>> totalNumList = new ArrayList<>();
|
||||
List<TotalListDto> totalNumList = new ArrayList<>();
|
||||
|
||||
if (DetectOption.EXCL.getId().equals(req.getDetectOption())) {
|
||||
// "추론제외" 일때 전년도 이전 값이 있어도 전년도 도엽이 없으면 비교 안함
|
||||
for (MngListCompareDto dto : compareList) {
|
||||
if (Objects.equals(dto.getBeforeYear(), req.getCompareYyyy())) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("beforeYear", dto.getBeforeYear());
|
||||
map.put("mapSheetNum", dto.getMapSheetNum());
|
||||
totalNumList.add(map);
|
||||
TotalListDto totalDto = new TotalListDto();
|
||||
totalDto.setBeforeYear(dto.getBeforeYear() == null ? 0 : dto.getBeforeYear());
|
||||
totalDto.setMapSheetNum(dto.getMapSheetNum());
|
||||
totalNumList.add(totalDto);
|
||||
}
|
||||
}
|
||||
} else if (DetectOption.PREV.getId().equals(req.getDetectOption())) {
|
||||
// "이전 년도 도엽 사용" 이면 전년도 이전 도엽도 사용
|
||||
for (MngListCompareDto dto : compareList) {
|
||||
if (dto.getBeforeYear() != 0) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("beforeYear", dto.getBeforeYear());
|
||||
map.put("mapSheetNum", dto.getMapSheetNum());
|
||||
totalNumList.add(map);
|
||||
TotalListDto totalDto = new TotalListDto();
|
||||
totalDto.setBeforeYear(dto.getBeforeYear() == null ? 0 : dto.getBeforeYear());
|
||||
totalDto.setMapSheetNum(dto.getMapSheetNum());
|
||||
totalNumList.add(totalDto);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -143,9 +143,9 @@ public class InferenceResultService {
|
||||
|
||||
// 사용할 영상파일 년도 기록 및 추론에 포함되는지 설정
|
||||
for (MngListDto target : targetList) {
|
||||
for (Map<String, Object> map : totalNumList) {
|
||||
if (target.getMapSheetNum().equals(map.get("mapSheetNum").toString())) {
|
||||
target.setBeforeYear(map.get("beforeYear").toString());
|
||||
for (TotalListDto totalDto : totalNumList) {
|
||||
if (target.getMapSheetNum().equals(totalDto.getMapSheetNum())) {
|
||||
target.setBeforeYear(totalDto.getBeforeYear());
|
||||
target.setIsSuccess(true);
|
||||
}
|
||||
}
|
||||
@@ -182,7 +182,7 @@ public class InferenceResultService {
|
||||
m1.setPred_requests_areas(predRequestsAreas);
|
||||
|
||||
// ai 추론 실행 api 호출
|
||||
Long batchId = ensureAccepted(m1);
|
||||
Long batchId = 0L; // ensureAccepted(m1);
|
||||
|
||||
// ai 추론 실행후 응답값 update
|
||||
SaveInferenceAiDto saveInferenceAiDto = new SaveInferenceAiDto();
|
||||
|
||||
@@ -427,7 +427,7 @@ public class MapSheetMngDto {
|
||||
private int mngYyyy;
|
||||
private String mapSheetNum;
|
||||
private String mapSheetName;
|
||||
private String beforeYear;
|
||||
private Integer beforeYear;
|
||||
private Boolean isSuccess;
|
||||
}
|
||||
|
||||
@@ -442,4 +442,14 @@ public class MapSheetMngDto {
|
||||
private String mapSheetNum;
|
||||
private Integer beforeYear;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class TotalListDto {
|
||||
|
||||
private String mapSheetNum;
|
||||
private Integer beforeYear;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,6 +92,7 @@ public class InferenceResultCoreService {
|
||||
|
||||
MapSheetLearnEntity mapSheetLearnEntity = new MapSheetLearnEntity();
|
||||
mapSheetLearnEntity.setTitle(req.getTitle());
|
||||
mapSheetLearnEntity.setRunningModelType("M1");
|
||||
mapSheetLearnEntity.setM1ModelUuid(req.getModel1Uuid());
|
||||
mapSheetLearnEntity.setM2ModelUuid(req.getModel2Uuid());
|
||||
mapSheetLearnEntity.setM3ModelUuid(req.getModel3Uuid());
|
||||
@@ -116,7 +117,7 @@ public class InferenceResultCoreService {
|
||||
MapSheetLearn5kEntity entity = new MapSheetLearn5kEntity();
|
||||
entity.setLearn(savedLearn);
|
||||
entity.setMapSheetNum(Long.parseLong(mngDto.getMapSheetNum()));
|
||||
entity.setBeforeYear(Integer.valueOf(mngDto.getBeforeYear()));
|
||||
entity.setBeforeYear(mngDto.getBeforeYear());
|
||||
entity.setIsSuccess(mngDto.getIsSuccess() != null && mngDto.getIsSuccess());
|
||||
entity.setCreatedUid(userUtil.getId());
|
||||
|
||||
|
||||
@@ -50,8 +50,8 @@ public class MapSheetLearn5kEntity {
|
||||
private Long createdUid;
|
||||
|
||||
@Column(name = "befroe_year")
|
||||
private Integer beforeYear;
|
||||
private Integer beforeYear = 0;
|
||||
|
||||
@Column(name = "is_success")
|
||||
private Boolean isSuccess;
|
||||
private Boolean isSuccess = false;
|
||||
}
|
||||
|
||||
@@ -528,7 +528,7 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
mapSheetMngHstEntity.mngYyyy,
|
||||
mapSheetMngHstEntity.mapSheetNum,
|
||||
mapSheetMngHstEntity.mapSheetName,
|
||||
nullExpression(String.class),
|
||||
nullExpression(Integer.class),
|
||||
nullExpression(Boolean.class)))
|
||||
.from(mapSheetMngHstEntity)
|
||||
.where(whereBuilder)
|
||||
|
||||
@@ -249,6 +249,7 @@ public class MapSheetInferenceJobService {
|
||||
save.setRunningJobs(job.getRunningJobs());
|
||||
save.setCompletedJobs(job.getCompletedJobs());
|
||||
save.setFailedJobs(job.getFailedJobs());
|
||||
save.setType(sheet.getRunningModelType());
|
||||
inferenceResultCoreService.update(save);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user