추론관리 > 분석결과 상세 summary, dashboard 추가
This commit is contained in:
@@ -2,6 +2,9 @@ package com.kamco.cd.kamcoback.inference;
|
||||
|
||||
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.Dashboard;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.Detail;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.SearchReq;
|
||||
import com.kamco.cd.kamcoback.inference.service.InferenceResultService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@@ -10,6 +13,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -49,9 +53,12 @@ public class InferenceResultApiController {
|
||||
@Parameter(description = "제목", example = "2023_2024년도") @RequestParam(required = false)
|
||||
String title,
|
||||
@Parameter(description = "페이지 번호 (0부터 시작)", example = "0") @RequestParam(defaultValue = "0")
|
||||
int page
|
||||
int page,
|
||||
@Parameter(description = "정렬 조건 (형식: 필드명,방향)", example = "name,asc")
|
||||
@RequestParam(required = false)
|
||||
String sort
|
||||
) {
|
||||
InferenceResultDto.SearchReq searchReq = new InferenceResultDto.SearchReq(statCode, title, page, 20, null);
|
||||
InferenceResultDto.SearchReq searchReq = new InferenceResultDto.SearchReq(statCode, title, page, 20, sort);
|
||||
Page<InferenceResultDto.AnalResList> analResList = inferenceResultService.getInferenceResultList(searchReq);
|
||||
return ApiResponseDto.ok(analResList);
|
||||
}
|
||||
@@ -60,6 +67,18 @@ public class InferenceResultApiController {
|
||||
summary = "추론관리 분석결과 요약정보",
|
||||
description =
|
||||
"분석결과 요약정보를 조회합니다.")
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(
|
||||
responseCode = "200",
|
||||
description = "검색 성공",
|
||||
content =
|
||||
@Content(
|
||||
mediaType = "application/json",
|
||||
schema = @Schema(implementation = InferenceResultDto.AnalResSummary.class))),
|
||||
@ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content),
|
||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
})
|
||||
@GetMapping("/summary")
|
||||
public ApiResponseDto<InferenceResultDto.AnalResSummary> getInferenceResultSummary(
|
||||
@Parameter(description = "목록 id", example = "1")
|
||||
@@ -68,5 +87,42 @@ public class InferenceResultApiController {
|
||||
}
|
||||
|
||||
|
||||
@Operation(
|
||||
summary = "추론관리 분석결과 상세",
|
||||
description =
|
||||
"분석결과 상제 정보 Summary, DashBoard")
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(
|
||||
responseCode = "200",
|
||||
description = "검색 성공",
|
||||
content =
|
||||
@Content(
|
||||
mediaType = "application/json",
|
||||
schema = @Schema(implementation = InferenceResultDto.Detail.class))),
|
||||
@ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content),
|
||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
})
|
||||
@GetMapping("/detail")
|
||||
public ApiResponseDto<InferenceResultDto.Detail> getInferenceDetail(
|
||||
@Parameter(description = "목록 id", example = "1")
|
||||
@RequestParam Long id) {
|
||||
InferenceResultDto.AnalResSummary summary = inferenceResultService.getInferenceResultSummary(id);
|
||||
List<InferenceResultDto.Dashboard> dashboardList = this.getInferenceResultDashboard(id);
|
||||
|
||||
return ApiResponseDto.ok(new Detail(summary, dashboardList));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 분석결과 상세 대시보드 조회
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
private List<Dashboard> getInferenceResultDashboard(Long id) {
|
||||
return inferenceResultService.getInferenceResultBasic(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,10 +3,12 @@ package com.kamco.cd.kamcoback.inference.dto;
|
||||
import com.kamco.cd.kamcoback.common.utils.interfaces.JsonFormatDttm;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
@@ -110,6 +112,8 @@ public class InferenceResultDto {
|
||||
private String resultUrl;
|
||||
private Long detectingCnt;
|
||||
private Double accuracy;
|
||||
private String analState;
|
||||
private String analStateNm;
|
||||
|
||||
public AnalResSummary(
|
||||
Long id,
|
||||
@@ -123,7 +127,9 @@ public class InferenceResultDto {
|
||||
Long analPredSec,
|
||||
String resultUrl,
|
||||
Long detectingCnt,
|
||||
Double accuracy
|
||||
Double accuracy,
|
||||
String analState,
|
||||
String analStateNm
|
||||
) {
|
||||
this.id = id;
|
||||
this.modelInfo = modelInfo;
|
||||
@@ -137,9 +143,76 @@ public class InferenceResultDto {
|
||||
this.resultUrl = resultUrl;
|
||||
this.detectingCnt = detectingCnt;
|
||||
this.accuracy = accuracy;
|
||||
this.analState = analState;
|
||||
this.analStateNm = analStateNm;
|
||||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
public static class Dashboard {
|
||||
Integer compareYyyy;
|
||||
Integer targetYyyy;
|
||||
Long mapSheetNum;
|
||||
String classBeforeName;
|
||||
String classAfterName;
|
||||
Long classBeforeCnt;
|
||||
Long classAfterCnt;
|
||||
@JsonFormatDttm
|
||||
ZonedDateTime createdDttm;
|
||||
Long createdUid;
|
||||
@JsonFormatDttm
|
||||
ZonedDateTime updatedDttm;
|
||||
Long updatedUid;
|
||||
Long refMapSheetNum;
|
||||
Long dataUid;
|
||||
|
||||
public Dashboard(
|
||||
Integer compareYyyy,
|
||||
Integer targetYyyy,
|
||||
Long mapSheetNum,
|
||||
String classBeforeName,
|
||||
String classAfterName,
|
||||
Long classBeforeCnt,
|
||||
Long classAfterCnt,
|
||||
ZonedDateTime createdDttm,
|
||||
Long createdUid,
|
||||
ZonedDateTime updatedDttm,
|
||||
Long updatedUid,
|
||||
Long refMapSheetNum,
|
||||
Long dataUid
|
||||
) {
|
||||
this.compareYyyy = compareYyyy;
|
||||
this.targetYyyy = targetYyyy;
|
||||
this.mapSheetNum = mapSheetNum;
|
||||
this.classBeforeName = classBeforeName;
|
||||
this.classAfterName = classAfterName;
|
||||
this.classBeforeCnt = classBeforeCnt;
|
||||
this.classAfterCnt = classAfterCnt;
|
||||
this.createdDttm = createdDttm;
|
||||
this.createdUid = createdUid;
|
||||
this.updatedDttm = updatedDttm;
|
||||
this.updatedUid = updatedUid;
|
||||
this.refMapSheetNum = refMapSheetNum;
|
||||
this.dataUid = dataUid;
|
||||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
public static class Detail {
|
||||
AnalResSummary summary;
|
||||
List<Dashboard> dashboard;
|
||||
|
||||
public Detail(
|
||||
AnalResSummary summary,
|
||||
List<Dashboard> dashboard
|
||||
) {
|
||||
this.summary = summary;
|
||||
this.dashboard = dashboard;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Schema(name = "InferenceResultSearchReq", description = "분석결과 목록 요청 정보")
|
||||
@Getter
|
||||
|
||||
@@ -2,7 +2,9 @@ package com.kamco.cd.kamcoback.inference.service;
|
||||
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.Basic;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.Dashboard;
|
||||
import com.kamco.cd.kamcoback.postgres.core.InferenceResultCoreService;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -33,6 +35,15 @@ public class InferenceResultService {
|
||||
return inferenceResultCoreService.getInferenceResultSummary(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 분석결과 대시보드 조회
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public List<Dashboard> getInferenceResultBasic(Long id) {
|
||||
return inferenceResultCoreService.getInferenceResultDashboard(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.kamco.cd.kamcoback.postgres.core;
|
||||
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.Dashboard;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalSttcEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.repository.Inference.InferenceResultRepository;
|
||||
import jakarta.persistence.EntityNotFoundException;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -31,4 +34,16 @@ public class InferenceResultCoreService {
|
||||
InferenceResultDto.AnalResSummary summary = inferenceResultRepository.getInferenceResultSummary(id).orElseThrow(() -> new EntityNotFoundException("요약정보를 찾을 수 없습니다. " + id));
|
||||
return summary;
|
||||
}
|
||||
|
||||
/**
|
||||
* 분석결과 대시보드 조회
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public List<Dashboard> getInferenceResultDashboard(Long id) {
|
||||
return inferenceResultRepository.getInferenceResultDashboard(id)
|
||||
.stream()
|
||||
.map(MapSheetAnalSttcEntity::toDto)
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.kamco.cd.kamcoback.postgres.entity;
|
||||
|
||||
import com.kamco.cd.kamcoback.code.dto.CommonCodeDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.EmbeddedId;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.time.ZonedDateTime;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@Table(name = "tb_map_sheet_anal_sttc")
|
||||
public class MapSheetAnalSttcEntity {
|
||||
|
||||
@EmbeddedId
|
||||
private MapSheetAnalSttcEntityId id;
|
||||
|
||||
@Column(name = "class_before_cnt")
|
||||
private Long classBeforeCnt;
|
||||
|
||||
@Column(name = "class_after_cnt")
|
||||
private Long classAfterCnt;
|
||||
|
||||
@ColumnDefault("now()")
|
||||
@Column(name = "created_dttm")
|
||||
private ZonedDateTime createdDttm;
|
||||
|
||||
@Column(name = "created_uid")
|
||||
private Long createdUid;
|
||||
|
||||
@ColumnDefault("now()")
|
||||
@Column(name = "updated_dttm")
|
||||
private ZonedDateTime updatedDttm;
|
||||
|
||||
@Column(name = "updated_uid", length = Integer.MAX_VALUE)
|
||||
private Long updatedUid;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "ref_map_sheet_num", nullable = false)
|
||||
private Long refMapSheetNum;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "data_uid", nullable = false)
|
||||
private Long dataUid;
|
||||
|
||||
public InferenceResultDto.Dashboard toDto() {
|
||||
return new InferenceResultDto.Dashboard(
|
||||
id.getCompareYyyy(),
|
||||
id.getTargetYyyy(),
|
||||
id.getMapSheetNum(),
|
||||
id.getClassBeforeName(),
|
||||
id.getClassAfterName(),
|
||||
this.classBeforeCnt,
|
||||
this.classAfterCnt,
|
||||
this.createdDttm,
|
||||
this.createdUid,
|
||||
this.updatedDttm,
|
||||
this.updatedUid,
|
||||
this.refMapSheetNum,
|
||||
this.dataUid
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.kamco.cd.kamcoback.postgres.entity;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Embeddable;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.Hibernate;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Embeddable
|
||||
public class MapSheetAnalSttcEntityId implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -8630519290255405042L;
|
||||
@NotNull
|
||||
@Column(name = "compare_yyyy", nullable = false)
|
||||
private Integer compareYyyy;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "target_yyyy", nullable = false)
|
||||
private Integer targetYyyy;
|
||||
|
||||
@NotNull
|
||||
@Column(name = "map_sheet_num", nullable = false)
|
||||
private Long mapSheetNum;
|
||||
|
||||
@Size(max = 64)
|
||||
@NotNull
|
||||
@Column(name = "class_before_name", nullable = false, length = 64)
|
||||
private String classBeforeName;
|
||||
|
||||
@Size(max = 64)
|
||||
@NotNull
|
||||
@Column(name = "class_after_name", nullable = false, length = 64)
|
||||
private String classAfterName;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) {
|
||||
return false;
|
||||
}
|
||||
MapSheetAnalSttcEntityId entity = (MapSheetAnalSttcEntityId) o;
|
||||
return Objects.equals(this.targetYyyy, entity.targetYyyy) &&
|
||||
Objects.equals(this.classBeforeName, entity.classBeforeName) &&
|
||||
Objects.equals(this.classAfterName, entity.classAfterName) &&
|
||||
Objects.equals(this.compareYyyy, entity.compareYyyy) &&
|
||||
Objects.equals(this.mapSheetNum, entity.mapSheetNum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(targetYyyy, classBeforeName, classAfterName, compareYyyy, mapSheetNum);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,11 +1,16 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.Inference;
|
||||
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.Dashboard;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalSttcEntity;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import org.springframework.data.domain.Page;
|
||||
|
||||
public interface InferenceResultRepositoryCustom {
|
||||
Page<InferenceResultDto.AnalResList> getInferenceResultList(InferenceResultDto.SearchReq searchReq);
|
||||
Optional<InferenceResultDto.AnalResSummary> getInferenceResultSummary(Long id);
|
||||
List<MapSheetAnalSttcEntity> getInferenceResultDashboard(Long id);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,21 +1,18 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.Inference;
|
||||
|
||||
import com.kamco.cd.kamcoback.common.utils.interfaces.JsonFormatDttm;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.ModelVerEntity;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.Dashboard;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalSttcEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalSttcEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QModelMngEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QModelVerEntity;
|
||||
import com.querydsl.core.Tuple;
|
||||
import com.querydsl.core.types.Projections;
|
||||
import com.querydsl.core.types.dsl.Expressions;
|
||||
import com.querydsl.core.types.dsl.NumberExpression;
|
||||
import com.querydsl.jpa.JPAExpressions;
|
||||
import com.querydsl.jpa.JPQLQuery;
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -32,6 +29,8 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
private final QMapSheetAnalEntity mapSheetAnal = QMapSheetAnalEntity.mapSheetAnalEntity;
|
||||
private final QModelMngEntity tmm = QModelMngEntity.modelMngEntity;
|
||||
private final QModelVerEntity tmv = QModelVerEntity.modelVerEntity;
|
||||
private final QMapSheetAnalSttcEntity mapSheetAnalSttc = QMapSheetAnalSttcEntity.mapSheetAnalSttcEntity;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@@ -117,7 +116,9 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
mapSheetAnal.analPredSec,
|
||||
mapSheetAnal.resultUrl,
|
||||
mapSheetAnal.detectingCnt,
|
||||
mapSheetAnal.accuracy
|
||||
mapSheetAnal.accuracy,
|
||||
mapSheetAnal.analState,
|
||||
Expressions.stringTemplate("fn_code_name({0}, {1})", "0002", mapSheetAnal.analState)
|
||||
))
|
||||
.from(mapSheetAnal)
|
||||
.leftJoin(tmm).on(mapSheetAnal.modelUid.eq(tmm.id))
|
||||
@@ -130,4 +131,18 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
);
|
||||
return content;
|
||||
}
|
||||
|
||||
/**
|
||||
* 분석결과 상세 대시보드 조회
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<MapSheetAnalSttcEntity> getInferenceResultDashboard(Long id) {
|
||||
return queryFactory
|
||||
.select(mapSheetAnalSttc)
|
||||
.from(mapSheetAnalSttc)
|
||||
.where(mapSheetAnalSttc.dataUid.eq(id))
|
||||
.fetch();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user