Merge pull request 'feat/infer_dev_260107' (#169) from feat/infer_dev_260107 into develop

Reviewed-on: https://kamco.gitea.gs.dabeeo.com/dabeeo/kamco-dabeeo-backoffice/pulls/169
This commit is contained in:
2026-01-09 12:07:16 +09:00
9 changed files with 177 additions and 13 deletions

View File

@@ -280,4 +280,23 @@ public class MapSheetMngApiController {
return ApiResponseDto.createOK(mapSheetMngService.getFilesAll(srchDto));
}
@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-done-yyyy-list")
public ApiResponseDto<List<Integer>> findMapSheetMngDoneYyyyList() {
return ApiResponseDto.ok(mapSheetMngService.findMapSheetMngDoneYyyyList());
}
}

View File

@@ -338,4 +338,16 @@ public class MapSheetMngService {
public void getSceneInference(String yyyy) {
mapSheetMngCoreService.getSceneInference(yyyy);
}
public List<Integer> findMapSheetMngDoneYyyyList() {
List<MngDto> mngList = mapSheetMngCoreService.findMapSheetMngList();
List<Integer> yearList =
mngList.stream()
.filter(dto -> "DONE".equals(dto.getMngState()))
.map(dto -> dto.getMngYyyy()) // 날짜 객체에서 연도(int)만 추출
.toList();
return yearList;
}
}

View File

@@ -59,6 +59,12 @@ public class ModelMngDto {
private String modelType;
private String filePath;
private String fileName;
private String cdModelPath;
private String cdModelFileName;
private String cdModelConfig;
private String cdModelConfigFileName;
private String clsModelPath;
private String clsModelFileName;
private String memo;
public Basic(
@@ -74,6 +80,12 @@ public class ModelMngDto {
String modelType,
String filePath,
String fileName,
String cdModelPath,
String cdModelFileName,
String cdModelConfig,
String cdModelConfigFileName,
String clsModelPath,
String clsModelFileName,
String memo) {
this.modelUid = modelUid;
this.modelVer = modelVer;
@@ -87,6 +99,12 @@ public class ModelMngDto {
this.modelType = modelType;
this.filePath = filePath;
this.fileName = fileName;
this.cdModelPath = cdModelPath;
this.cdModelFileName = cdModelFileName;
this.cdModelConfig = cdModelConfig;
this.cdModelConfigFileName = cdModelConfigFileName;
this.clsModelPath = clsModelPath;
this.clsModelFileName = clsModelFileName;
this.memo = memo;
}
}
@@ -123,6 +141,12 @@ public class ModelMngDto {
private String modelVer;
private String filePath;
private String fileName;
private String cdModelPath;
private String cdModelFileName;
private String cdModelConfigPath;
private String cdModelConfigFileName;
private String clsModelPath;
private String clsModelFileName;
private String memo;
@JsonIgnore private UUID uuid;
@@ -151,4 +175,19 @@ public class ModelMngDto {
return PageRequest.of(page, size);
}
}
@Schema(name = "ModelMetricAddReq", description = "모델 등록 req")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class ModelMetricAddReq {
private Long modelUid;
private Long modelVerUid;
private double f1Score;
private double precision;
private double recall;
private double loss;
private double iou;
}
}

View File

@@ -2,6 +2,7 @@ package com.kamco.cd.kamcoback.model.service;
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
import com.kamco.cd.kamcoback.model.dto.ModelMngDto;
import com.kamco.cd.kamcoback.model.dto.ModelMngDto.ModelMetricAddReq;
import com.kamco.cd.kamcoback.postgres.core.ModelMngCoreService;
import com.kamco.cd.kamcoback.upload.dto.UploadDto;
import com.kamco.cd.kamcoback.upload.service.UploadService;
@@ -62,7 +63,19 @@ public class ModelMngService {
public ApiResponseDto.ResponseObj insertModel(ModelMngDto.AddReq addReq) {
UUID uuid = UUID.randomUUID();
addReq.setUuid(uuid);
modelMngCoreService.insertModel(addReq);
Long modelUid = modelMngCoreService.insertModel(addReq);
ModelMetricAddReq modelMetricAddReq = new ModelMetricAddReq();
modelMetricAddReq.setModelUid(modelUid);
modelMetricAddReq.setModelVerUid(modelUid);
modelMetricAddReq.setF1Score(0);
modelMetricAddReq.setPrecision(0);
modelMetricAddReq.setRecall(0);
modelMetricAddReq.setLoss(0);
modelMetricAddReq.setIou(0);
modelMngCoreService.insertModelResultMetric(modelMetricAddReq);
return new ApiResponseDto.ResponseObj(ApiResponseDto.ApiResponseCode.OK, "등록되었습니다.");
}

View File

@@ -1,6 +1,7 @@
package com.kamco.cd.kamcoback.postgres.core;
import com.kamco.cd.kamcoback.model.dto.ModelMngDto;
import com.kamco.cd.kamcoback.postgres.entity.ModelMngEntity;
import com.kamco.cd.kamcoback.postgres.repository.model.ModelMngRepository;
import java.time.LocalDate;
import java.util.UUID;
@@ -37,11 +38,44 @@ public class ModelMngCoreService {
modelMngRepository.deleteByModelUuid(uuid);
}
public void insertModel(ModelMngDto.AddReq addReq) {
public Long insertModel(ModelMngDto.AddReq addReq) {
// ModelMngEntity addEntity = new ModelMngEntity();
// addEntity.setModelType(addReq.getModelType());
ModelMngEntity addEntity = new ModelMngEntity();
addEntity.setModelVer(addReq.getModelVer());
addEntity.setModelType(addReq.getModelType());
addEntity.setFilePath(addReq.getFilePath());
addEntity.setFileName(addReq.getFileName());
addEntity.setMemo(addReq.getMemo());
addEntity.setUuid(addReq.getUuid());
modelMngRepository.insertModel(addReq);
addEntity.setCdModelPath(addReq.getCdModelPath());
addEntity.setCdModelFileName(addReq.getCdModelFileName());
addEntity.setCdModelConfigPath(addReq.getCdModelConfigPath());
addEntity.setCdModelConfigFileName(addReq.getCdModelConfigFileName());
addEntity.setClsModelPath(addReq.getClsModelPath());
addEntity.setClsModelFileName(addReq.getClsModelFileName());
addEntity.setDeleted(false);
// modelMngRepository.insertModel(addReq);
ModelMngEntity entity = modelMngRepository.save(addEntity);
return entity.getModelUid();
}
public void insertModelResultMetric(ModelMngDto.ModelMetricAddReq addReq) {
/*
ModelResultMetricEntity addEntity = new ModelResultMetricEntity();
addEntity.setModelUid(addReq.getModelUid());
addEntity.setModelVerUid(addReq.getModelVerUid());
addEntity.setF1Score(addReq.getF1Score());
addEntity.setPrecision(addReq.getPrecision());
addEntity.setRecall(addReq.getRecall());
addEntity.setLoss(addReq.getLoss());
addEntity.setIou(addReq.getIou());
*/
modelMngRepository.insertModelResultMetric(addReq);
// ModelMngEntity entity = modelMngRepository.save(addEntity);
// return entity.getMetricUid();
}
}

View File

@@ -7,6 +7,7 @@ import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.validation.constraints.Size;
import java.time.ZonedDateTime;
import java.util.UUID;
import lombok.Getter;
@@ -56,6 +57,30 @@ public class ModelMngEntity extends CommonDateEntity {
@Column(name = "uuid")
private UUID uuid;
@Size(max = 155)
@Column(name = "cd_model_path", length = 155)
private String cdModelPath;
@Size(max = 155)
@Column(name = "cd_model_file_name", length = 155)
private String cdModelFileName;
@Size(max = 155)
@Column(name = "cd_model_config_path", length = 155)
private String cdModelConfigPath;
@Size(max = 155)
@Column(name = "cd_model_config_file_name", length = 155)
private String cdModelConfigFileName;
@Size(max = 155)
@Column(name = "cls_model_path", length = 155)
private String clsModelPath;
@Size(max = 155)
@Column(name = "cls_model_file_name", length = 155)
private String clsModelFileName;
public void deleted() {
this.deleted = true;
}

View File

@@ -3,25 +3,21 @@ package com.kamco.cd.kamcoback.postgres.entity;
import jakarta.persistence.*;
import java.time.ZonedDateTime;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.JdbcTypeCode;
import org.hibernate.type.SqlTypes;
@Entity
@Table(name = "tb_model_result_metric")
@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Setter
@Entity
public class ModelResultMetricEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "metric_uid")
private Long id;
private Long metricUid;
@Column(name = "model_uid")
private Long modelUid;

View File

@@ -23,4 +23,6 @@ public interface ModelMngRepositoryCustom {
void insertModel(ModelMngDto.AddReq addReq);
void deleteByModelUuid(UUID uuid);
void insertModelResultMetric(ModelMngDto.ModelMetricAddReq addReq);
}

View File

@@ -197,4 +197,28 @@ public class ModelMngRepositoryImpl extends QuerydslRepositorySupport
.where(modelMngEntity.uuid.eq(uuid))
.execute();
}
@Override
public void insertModelResultMetric(@Valid ModelMngDto.ModelMetricAddReq addReq) {
long execCount =
queryFactory
.insert(modelResultMetricEntity)
.columns(
modelResultMetricEntity.modelUid,
modelResultMetricEntity.modelVerUid,
modelResultMetricEntity.f1Score,
modelResultMetricEntity.precision,
modelResultMetricEntity.recall,
modelResultMetricEntity.loss,
modelResultMetricEntity.iou)
.values(
addReq.getModelUid(),
addReq.getModelVerUid(),
addReq.getF1Score(),
addReq.getPrecision(),
addReq.getRecall(),
addReq.getLoss(),
addReq.getIou())
.execute();
}
}