This commit is contained in:
2026-02-02 12:29:00 +09:00
parent f8f5cef6e1
commit 495ef7d86c
175 changed files with 45128 additions and 0 deletions

View File

@@ -0,0 +1,212 @@
package com.kamco.cd.training.dataset.dto;
import com.kamco.cd.training.common.enums.LearnDataRegister;
import com.kamco.cd.training.common.enums.LearnDataType;
import com.kamco.cd.training.common.utils.enums.Enums;
import com.kamco.cd.training.common.utils.interfaces.JsonFormatDttm;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.time.ZonedDateTime;
import java.util.List;
import java.util.UUID;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
public class DatasetDto {
@Schema(name = "Dataset Basic", description = "데이터셋 기본 정보")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class Basic {
private Long id;
private UUID uuid;
private String groupTitle;
private String groupTitleCd;
private String title;
private Long roundNo;
private String totalSize;
private String memo;
@JsonFormatDttm private ZonedDateTime createdDttm;
private String status;
private String statusCd;
private Boolean deleted;
public Basic(
Long id,
UUID uuid,
String groupTitle,
String title,
Long roundNo,
Long totalSize,
String memo,
ZonedDateTime createdDttm,
String status,
Boolean deleted) {
this.id = id;
this.uuid = uuid;
this.groupTitle = getGroupTitle(groupTitle);
this.groupTitleCd = groupTitle;
this.title = title;
this.roundNo = roundNo;
this.totalSize = getTotalSize(totalSize);
this.memo = memo;
this.createdDttm = createdDttm;
this.status = getStatus(status);
this.statusCd = status;
this.deleted = deleted;
}
public String getTotalSize(Long totalSize) {
if (totalSize == null) return "0G";
double giga = totalSize / (1024.0 * 1024 * 1024);
return String.format("%.2fG", giga);
}
public String getGroupTitle(String groupTitleCd) {
LearnDataType type = Enums.fromId(LearnDataType.class, groupTitleCd);
return type == null ? null : type.getText();
}
public String getStatus(String status) {
LearnDataRegister type = Enums.fromId(LearnDataRegister.class, status);
return type == null ? null : type.getText();
}
}
@Schema(name = "Dataset Detail", description = "데이터셋 상세 정보")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class Detail {
private Long id;
private String groupTitle;
private String title;
private Long roundNo;
private String totalSize;
private String memo;
@JsonFormatDttm private ZonedDateTime createdDttm;
private String status;
private Boolean deleted;
}
@Schema(name = "DatasetSearchReq", description = "데이터셋 목록 조회 요청")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class SearchReq {
@Schema(description = "구분", example = "DELIVER(납품), PRODUCTION(제작)")
private String groupTitle;
@Schema(description = "제목 (부분 검색)", example = "1차")
private String title;
@Schema(description = "페이지 번호 (1부터 시작)", example = "1")
private int page = 1;
@Schema(description = "페이지 크기", example = "20")
private int size = 20;
public Pageable toPageable() {
// API에서는 1부터 시작하지만 내부적으로는 0부터 시작
int pageIndex = Math.max(0, page - 1);
return PageRequest.of(pageIndex, size, Sort.by(Sort.Direction.DESC, "createdDttm"));
}
}
@Schema(name = "DatasetDetailReq", description = "데이터셋 상세 조회 요청")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class DetailReq {
@NotNull(message = "데이터셋 ID는 필수입니다")
@Schema(description = "데이터셋 ID", example = "101")
private Long datasetId;
}
@Schema(name = "DatasetRegisterReq", description = "데이터셋 등록 요청")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class RegisterReq {
@NotBlank(message = "제목은 필수입니다")
@Size(max = 200, message = "제목은 최대 200자까지 입력 가능합니다")
@Schema(description = "제목", example = "1차 제작")
private String title;
@NotBlank(message = "연도는 필수입니다")
@Size(max = 4, message = "연도는 4자리입니다")
@Schema(description = "연도 (YYYY)", example = "2024")
private String year;
@Schema(description = "회차", example = "1")
private Long roundNo;
@Schema(description = "메모", example = "데이터셋 설명")
private String memo;
}
@Schema(name = "DatasetUpdateReq", description = "데이터셋 수정 요청")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class UpdateReq {
@Size(max = 200, message = "제목은 최대 200자까지 입력 가능합니다")
@Schema(description = "제목", example = "1차 제작")
private String title;
@Schema(description = "메모", example = "데이터셋 설명")
private String memo;
}
@Schema(name = "DatasetSummaryReq", description = "데이터셋 통계 요약 요청")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class SummaryReq {
@NotNull(message = "데이터셋 ID 목록은 필수입니다")
@Schema(description = "데이터셋 ID 목록", example = "[101, 105]")
private List<Long> datasetIds;
}
@Schema(name = "DatasetSummary", description = "데이터셋 통계 요약")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class Summary {
@Schema(description = "총 데이터셋 수", example = "2")
private int totalDatasets;
@Schema(description = "총 도엽 수", example = "1500")
private long totalMapSheets;
@Schema(description = "총 파일 크기 (bytes)", example = "10737418240")
private long totalFileSize;
@Schema(description = "평균 도엽 수", example = "750")
private double averageMapSheets;
}
}

View File

@@ -0,0 +1,103 @@
package com.kamco.cd.training.dataset.dto;
import com.kamco.cd.training.common.utils.interfaces.JsonFormatDttm;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
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.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
public class MapSheetDto {
@Schema(name = "MapSheet Basic", description = "도엽 기본 정보")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class Basic {
private Long id;
private Long datasetId;
private String sheetNum;
private String fileName;
private Long fileSize;
private String filePath;
private String status;
private String memo;
private Boolean deleted;
@JsonFormatDttm private ZonedDateTime createdDttm;
@JsonFormatDttm private ZonedDateTime updatedDttm;
}
@Schema(name = "MapSheetSearchReq", description = "도엽 목록 조회 요청")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class SearchReq {
@NotNull(message = "데이터셋 ID는 필수입니다")
@Schema(description = "데이터셋 ID", example = "101")
private Long datasetId;
@Schema(description = "페이지 번호 (1부터 시작)", example = "1")
private int page = 1;
@Schema(description = "페이지 크기", example = "20")
private int size = 20;
public Pageable toPageable() {
int pageIndex = Math.max(0, page - 1);
return PageRequest.of(pageIndex, size, Sort.by(Sort.Direction.DESC, "createdDttm"));
}
}
@Schema(name = "MapSheetDeleteReq", description = "도엽 삭제 요청 (다건)")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class DeleteReq {
@NotNull(message = "삭제할 도엽 ID 목록은 필수입니다")
@Schema(description = "삭제할 도엽 ID 목록", example = "[9991, 9992]")
private List<Long> itemIds;
}
@Schema(name = "MapSheetCheckReq", description = "도엽 번호 유효성 검증 요청")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class CheckReq {
@NotNull(message = "도엽 번호는 필수입니다")
@Schema(description = "도엽 번호", example = "377055")
private String sheetNum;
}
@Schema(name = "MapSheetCheckRes", description = "도엽 번호 유효성 검증 응답")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class CheckRes {
@Schema(description = "유효 여부", example = "true")
private boolean valid;
@Schema(description = "메시지", example = "유효한 도엽 번호입니다")
private String message;
@Schema(description = "중복 여부", example = "false")
private boolean duplicate;
}
}