라벨링작업관리 리스트 추가
This commit is contained in:
102
src/main/java/com/kamco/cd/kamcoback/label/dto/LabelWorkDto.java
Normal file
102
src/main/java/com/kamco/cd/kamcoback/label/dto/LabelWorkDto.java
Normal file
@@ -0,0 +1,102 @@
|
||||
package com.kamco.cd.kamcoback.label.dto;
|
||||
|
||||
import com.kamco.cd.kamcoback.common.enums.MngStateType;
|
||||
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.enums.Enums;
|
||||
import com.kamco.cd.kamcoback.common.utils.interfaces.JsonFormatDttm;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelMngState;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.time.ZonedDateTime;
|
||||
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 LabelWorkDto {
|
||||
|
||||
|
||||
|
||||
@Schema(name = "LabelWorkMng", description = "라벨작업관리")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class LabelWorkMng {
|
||||
|
||||
private int compareYyyy;
|
||||
private int targetYyyy;
|
||||
private int stage;
|
||||
@JsonFormatDttm private ZonedDateTime createdDttm;
|
||||
private Long detectionTotCnt;
|
||||
private Long labelTotCnt;
|
||||
private Long labelStopTotCnt;
|
||||
private Long labelIngTotCnt;
|
||||
private Long labelCompleteTotCnt;
|
||||
@JsonFormatDttm private ZonedDateTime labelStartDttm;
|
||||
|
||||
|
||||
public String getLabelState() {
|
||||
|
||||
String mngState = "PENDING";
|
||||
|
||||
if (this.labelTotCnt == 0) mngState = "PENDING";
|
||||
else if (this.labelIngTotCnt > 0) mngState = "LABEL_ING";
|
||||
else if (this.labelTotCnt <= labelCompleteTotCnt) mngState = "LABEL_COMPLETE";
|
||||
|
||||
return mngState;
|
||||
}
|
||||
|
||||
public String getLabelStateName() {
|
||||
String enumId = this.getLabelState();
|
||||
if (enumId == null || enumId.isEmpty()) {
|
||||
enumId = "PENDING";
|
||||
}
|
||||
|
||||
LabelMngState type = Enums.fromId(LabelMngState.class, enumId);
|
||||
return type.getText();
|
||||
}
|
||||
|
||||
public double getLabelRate() {
|
||||
if (this.labelTotCnt == null || this.labelCompleteTotCnt == 0) {
|
||||
return 0.0;
|
||||
}
|
||||
return (double) this.labelTotCnt / this.labelCompleteTotCnt * 100.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Schema(name = "LabelWorkMngSearchReq", description = "라벨작업관리 검색 요청")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class LabelWorkMngSearchReq {
|
||||
|
||||
// 페이징 파라미터
|
||||
@Schema(description = "페이지 번호 (0부터 시작) ", example = "0")
|
||||
private int page = 0;
|
||||
|
||||
@Schema(description = "페이지 크기", example = "20")
|
||||
private int size = 20;
|
||||
|
||||
@Schema(description = "변화탐지년도", example = "2024")
|
||||
private Integer detectYyyy;
|
||||
|
||||
@Schema(description = "시작일", example = "20240101")
|
||||
private String strtDttm;
|
||||
|
||||
@Schema(description = "종료일", example = "20241201")
|
||||
private String endDttm;
|
||||
|
||||
public Pageable toPageable() {
|
||||
|
||||
return PageRequest.of(page, size);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user