Merge pull request '학습관리 수정' (#136) from feat/dev_251201 into develop
Reviewed-on: https://kamco.gitea.gs.dabeeo.com/dabeeo/kamco-dabeeo-backoffice/pulls/136
This commit is contained in:
@@ -150,8 +150,8 @@ public class LabelAllocateApiController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Operation(
|
@Operation(
|
||||||
summary = "작업현황 관리 > 상세 > 작업 이관 > 팝업 내 라벨러 상세 정보",
|
summary = "작업현황 관리 > 라벨러 상세 정보, 작업이관 팝업 내 라벨러 상세 정보 동일",
|
||||||
description = "작업현황 관리 > 상세 > 작업 이관 > 팝업 내 라벨러 상세 정보")
|
description = "작업현황 관리 > 라벨러 상세 정보, 작업이관 팝업 내 라벨러 상세 정보 동일")
|
||||||
@GetMapping("/labeler-detail")
|
@GetMapping("/labeler-detail")
|
||||||
public ApiResponseDto<LabelerDetail> findLabelerDetail(
|
public ApiResponseDto<LabelerDetail> findLabelerDetail(
|
||||||
@RequestParam(defaultValue = "01022223333") String userId,
|
@RequestParam(defaultValue = "01022223333") String userId,
|
||||||
|
|||||||
@@ -4,20 +4,21 @@ import com.kamco.cd.kamcoback.code.dto.CommonCodeDto;
|
|||||||
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
|
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto;
|
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.LabelWorkMng;
|
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.LabelWorkMng;
|
||||||
|
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.LabelWorkMngSearchReq;
|
||||||
import com.kamco.cd.kamcoback.label.service.LabelWorkService;
|
import com.kamco.cd.kamcoback.label.service.LabelWorkService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.media.Content;
|
import io.swagger.v3.oas.annotations.media.Content;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -42,9 +43,21 @@ public class LabelWorkerApiController {
|
|||||||
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
})
|
})
|
||||||
@PostMapping("/label-work-mng-list")
|
@GetMapping("/label-work-mng-list")
|
||||||
public ApiResponseDto<Page<LabelWorkMng>> labelWorkMngList(
|
public ApiResponseDto<Page<LabelWorkMng>> labelWorkMngList(
|
||||||
@RequestBody @Valid LabelWorkDto.LabelWorkMngSearchReq searchReq) {
|
@Schema(description = "변화탐지년도", example = "2024") Integer detectYyyy,
|
||||||
|
@Schema(description = "시작일", example = "20260101") String strtDttm,
|
||||||
|
@Schema(description = "종료일", example = "20261201") String endDttm,
|
||||||
|
@Parameter(description = "페이지 번호 (0부터 시작)", example = "0") @RequestParam(defaultValue = "0")
|
||||||
|
int page,
|
||||||
|
@Parameter(description = "페이지 크기", example = "20") @RequestParam(defaultValue = "20")
|
||||||
|
int size) {
|
||||||
|
LabelWorkDto.LabelWorkMngSearchReq searchReq = new LabelWorkMngSearchReq();
|
||||||
|
searchReq.setDetectYyyy(detectYyyy);
|
||||||
|
searchReq.setStrtDttm(strtDttm);
|
||||||
|
searchReq.setEndDttm(endDttm);
|
||||||
|
searchReq.setPage(page);
|
||||||
|
searchReq.setSize(size);
|
||||||
return ApiResponseDto.ok(labelWorkService.labelWorkMngList(searchReq));
|
return ApiResponseDto.ok(labelWorkService.labelWorkMngList(searchReq));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -227,6 +227,9 @@ public class LabelAllocateDto {
|
|||||||
private Long completeCnt;
|
private Long completeCnt;
|
||||||
private Long skipCnt;
|
private Long skipCnt;
|
||||||
private Double percent;
|
private Double percent;
|
||||||
|
private Integer ranking;
|
||||||
|
private ZonedDateTime createdDttm;
|
||||||
|
private String inspectorName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -263,4 +266,13 @@ public class LabelAllocateDto {
|
|||||||
@Schema(description = "기준년도", example = "2024")
|
@Schema(description = "기준년도", example = "2024")
|
||||||
private Integer targetYyyy;
|
private Integer targetYyyy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class AllocateInfoDto {
|
||||||
|
|
||||||
|
private Long geoUid;
|
||||||
|
private String mapSheetNum;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.kamco.cd.kamcoback.label.service;
|
|||||||
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
|
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
|
||||||
import com.kamco.cd.kamcoback.config.api.ApiResponseDto.ApiResponseCode;
|
import com.kamco.cd.kamcoback.config.api.ApiResponseDto.ApiResponseCode;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto;
|
||||||
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.AllocateInfoDto;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InferenceDetail;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InferenceDetail;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelerDetail;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelerDetail;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.TargetInspector;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.TargetInspector;
|
||||||
@@ -67,12 +68,12 @@ public class LabelAllocateService {
|
|||||||
ApiResponseCode.BAD_REQUEST, "총 잔여건수와 요청 값의 합계가 맞지 않습니다.");
|
ApiResponseCode.BAD_REQUEST, "총 잔여건수와 요청 값의 합계가 맞지 않습니다.");
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Long> allIds =
|
List<AllocateInfoDto> allIds =
|
||||||
labelAllocateCoreService.fetchNextIds(lastId, chargeCnt, compareYyyy, targetYyyy, stage);
|
labelAllocateCoreService.fetchNextIds(lastId, chargeCnt, compareYyyy, targetYyyy, stage);
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (TargetUser target : targetUsers) {
|
for (TargetUser target : targetUsers) {
|
||||||
int end = index + target.getDemand();
|
int end = index + target.getDemand();
|
||||||
List<Long> sub = allIds.subList(index, end);
|
List<AllocateInfoDto> sub = allIds.subList(index, end);
|
||||||
|
|
||||||
labelAllocateCoreService.assignOwner(sub, target.getUserId(), compareYyyy, targetYyyy, stage);
|
labelAllocateCoreService.assignOwner(sub, target.getUserId(), compareYyyy, targetYyyy, stage);
|
||||||
index = end;
|
index = end;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.core;
|
package com.kamco.cd.kamcoback.postgres.core;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto;
|
||||||
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.AllocateInfoDto;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InferenceDetail;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InferenceDetail;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelerDetail;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelerDetail;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.UserList;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.UserList;
|
||||||
@@ -20,13 +21,17 @@ public class LabelAllocateCoreService {
|
|||||||
|
|
||||||
private final LabelAllocateRepository labelAllocateRepository;
|
private final LabelAllocateRepository labelAllocateRepository;
|
||||||
|
|
||||||
public List<Long> fetchNextIds(
|
public List<AllocateInfoDto> fetchNextIds(
|
||||||
Long lastId, Long batchSize, Integer compareYyyy, Integer targetYyyy, Integer stage) {
|
Long lastId, Long batchSize, Integer compareYyyy, Integer targetYyyy, Integer stage) {
|
||||||
return labelAllocateRepository.fetchNextIds(lastId, batchSize, compareYyyy, targetYyyy, stage);
|
return labelAllocateRepository.fetchNextIds(lastId, batchSize, compareYyyy, targetYyyy, stage);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void assignOwner(
|
public void assignOwner(
|
||||||
List<Long> ids, String userId, Integer compareYyyy, Integer targetYyyy, Integer stage) {
|
List<AllocateInfoDto> ids,
|
||||||
|
String userId,
|
||||||
|
Integer compareYyyy,
|
||||||
|
Integer targetYyyy,
|
||||||
|
Integer stage) {
|
||||||
labelAllocateRepository.assignOwner(ids, userId, compareYyyy, targetYyyy, stage);
|
labelAllocateRepository.assignOwner(ids, userId, compareYyyy, targetYyyy, stage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,152 @@
|
|||||||
|
package com.kamco.cd.kamcoback.postgres.entity;
|
||||||
|
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.SequenceGenerator;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import jakarta.validation.constraints.Size;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.hibernate.annotations.ColumnDefault;
|
||||||
|
import org.hibernate.annotations.JdbcTypeCode;
|
||||||
|
import org.hibernate.type.SqlTypes;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Entity
|
||||||
|
@Table(name = "tb_map_sheet_anal_inference")
|
||||||
|
public class MapSheetAnalInferenceEntity {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(
|
||||||
|
strategy = GenerationType.SEQUENCE,
|
||||||
|
generator = "tb_map_sheet_anal_inference_id_gen")
|
||||||
|
@SequenceGenerator(
|
||||||
|
name = "tb_map_sheet_anal_inference_id_gen",
|
||||||
|
sequenceName = "tb_map_sheet_anal_inference_uid",
|
||||||
|
allocationSize = 1)
|
||||||
|
@Column(name = "anal_uid", nullable = false)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Column(name = "compare_yyyy")
|
||||||
|
private Integer compareYyyy;
|
||||||
|
|
||||||
|
@Column(name = "target_yyyy")
|
||||||
|
private Integer targetYyyy;
|
||||||
|
|
||||||
|
@Column(name = "model_uid")
|
||||||
|
private Long modelUid;
|
||||||
|
|
||||||
|
@Size(max = 100)
|
||||||
|
@Column(name = "server_ids", length = 100)
|
||||||
|
private String serverIds;
|
||||||
|
|
||||||
|
@Column(name = "anal_strt_dttm")
|
||||||
|
private ZonedDateTime analStrtDttm;
|
||||||
|
|
||||||
|
@Column(name = "anal_end_dttm")
|
||||||
|
private ZonedDateTime analEndDttm;
|
||||||
|
|
||||||
|
@Column(name = "anal_sec")
|
||||||
|
private Long analSec;
|
||||||
|
|
||||||
|
@Size(max = 20)
|
||||||
|
@Column(name = "anal_state", length = 20)
|
||||||
|
private String analState;
|
||||||
|
|
||||||
|
@Size(max = 20)
|
||||||
|
@Column(name = "gukyuin_used", length = 20)
|
||||||
|
private String gukyuinUsed;
|
||||||
|
|
||||||
|
@Column(name = "accuracy")
|
||||||
|
private Double accuracy;
|
||||||
|
|
||||||
|
@Size(max = 255)
|
||||||
|
@Column(name = "result_url")
|
||||||
|
private String resultUrl;
|
||||||
|
|
||||||
|
@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")
|
||||||
|
private Long updatedUid;
|
||||||
|
|
||||||
|
@Size(max = 255)
|
||||||
|
@Column(name = "anal_title")
|
||||||
|
private String analTitle;
|
||||||
|
|
||||||
|
@Column(name = "detecting_cnt")
|
||||||
|
private Long detectingCnt;
|
||||||
|
|
||||||
|
@Column(name = "anal_pred_sec")
|
||||||
|
private Long analPredSec;
|
||||||
|
|
||||||
|
@Column(name = "model_ver_uid")
|
||||||
|
private Long modelVerUid;
|
||||||
|
|
||||||
|
@Column(name = "hyper_params")
|
||||||
|
@JdbcTypeCode(SqlTypes.JSON)
|
||||||
|
private Map<String, Object> hyperParams;
|
||||||
|
|
||||||
|
@Column(name = "tranning_rate")
|
||||||
|
private List<Double> tranningRate;
|
||||||
|
|
||||||
|
@Column(name = "validation_rate")
|
||||||
|
private List<Double> validationRate;
|
||||||
|
|
||||||
|
@Column(name = "test_rate", length = Integer.MAX_VALUE)
|
||||||
|
private String testRate;
|
||||||
|
|
||||||
|
@Size(max = 128)
|
||||||
|
@Column(name = "detecting_description", length = 128)
|
||||||
|
private String detectingDescription;
|
||||||
|
|
||||||
|
@Size(max = 12)
|
||||||
|
@Column(name = "base_map_sheet_num", length = 12)
|
||||||
|
private String baseMapSheetNum;
|
||||||
|
|
||||||
|
@ColumnDefault("gen_random_uuid()")
|
||||||
|
@Column(name = "uuid")
|
||||||
|
private UUID uuid;
|
||||||
|
|
||||||
|
@Size(max = 50)
|
||||||
|
@Column(name = "model_m1_ver", length = 50)
|
||||||
|
private String modelM1Ver;
|
||||||
|
|
||||||
|
@Size(max = 50)
|
||||||
|
@Column(name = "model_m2_ver", length = 50)
|
||||||
|
private String modelM2Ver;
|
||||||
|
|
||||||
|
@Size(max = 50)
|
||||||
|
@Column(name = "model_m3_ver", length = 50)
|
||||||
|
private String modelM3Ver;
|
||||||
|
|
||||||
|
@Size(max = 20)
|
||||||
|
@Column(name = "anal_target_type", length = 20)
|
||||||
|
private String analTargetType;
|
||||||
|
|
||||||
|
@Column(name = "gukyuin_apply_dttm")
|
||||||
|
private ZonedDateTime gukyuinApplyDttm;
|
||||||
|
|
||||||
|
@Size(max = 20)
|
||||||
|
@Column(name = "detection_data_option", length = 20)
|
||||||
|
private String detectionDataOption;
|
||||||
|
|
||||||
|
@Column(name = "stage")
|
||||||
|
private Integer stage;
|
||||||
|
}
|
||||||
@@ -38,21 +38,16 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
|||||||
INSERT INTO tb_map_sheet_anal_inference (
|
INSERT INTO tb_map_sheet_anal_inference (
|
||||||
compare_yyyy,
|
compare_yyyy,
|
||||||
target_yyyy,
|
target_yyyy,
|
||||||
anal_map_sheet,
|
|
||||||
stage,
|
stage,
|
||||||
anal_title
|
anal_title
|
||||||
)
|
)
|
||||||
SELECT
|
SELECT
|
||||||
r.input1 AS compare_yyyy,
|
r.input1 AS compare_yyyy,
|
||||||
r.input2 AS target_yyyy,
|
r.input2 AS target_yyyy,
|
||||||
r.map_id AS anal_map_sheet,
|
|
||||||
r.stage,
|
r.stage,
|
||||||
CONCAT(r.stage ,'_', r.input1 ,'_', r.input2 ,'_', r.map_id) as anal_title
|
CONCAT(r.stage ,'_', r.input1 ,'_', r.input2) AS anal_title
|
||||||
FROM inference_results r
|
FROM inference_results r
|
||||||
GROUP BY r.stage, r.input1, r.input2, r.map_id
|
GROUP BY r.stage, r.input1, r.input2;
|
||||||
ON CONFLICT (compare_yyyy, target_yyyy, anal_map_sheet, stage)
|
|
||||||
DO UPDATE SET
|
|
||||||
updated_dttm = now()
|
|
||||||
""";
|
""";
|
||||||
|
|
||||||
return em.createNativeQuery(sql).executeUpdate();
|
return em.createNativeQuery(sql).executeUpdate();
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.kamco.cd.kamcoback.postgres.repository.label;
|
package com.kamco.cd.kamcoback.postgres.repository.label;
|
||||||
|
|
||||||
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.AllocateInfoDto;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InferenceDetail;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InferenceDetail;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelerDetail;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelerDetail;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.UserList;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.UserList;
|
||||||
@@ -12,11 +13,15 @@ import java.util.UUID;
|
|||||||
|
|
||||||
public interface LabelAllocateRepositoryCustom {
|
public interface LabelAllocateRepositoryCustom {
|
||||||
|
|
||||||
List<Long> fetchNextIds(
|
List<AllocateInfoDto> fetchNextIds(
|
||||||
Long lastId, Long batchSize, Integer compareYyyy, Integer targetYyyy, Integer stage);
|
Long lastId, Long batchSize, Integer compareYyyy, Integer targetYyyy, Integer stage);
|
||||||
|
|
||||||
void assignOwner(
|
void assignOwner(
|
||||||
List<Long> ids, String userId, Integer compareYyyy, Integer targetYyyy, Integer stage);
|
List<AllocateInfoDto> ids,
|
||||||
|
String userId,
|
||||||
|
Integer compareYyyy,
|
||||||
|
Integer targetYyyy,
|
||||||
|
Integer stage);
|
||||||
|
|
||||||
List<LabelingAssignmentEntity> findAssignedLabelerList(
|
List<LabelingAssignmentEntity> findAssignedLabelerList(
|
||||||
Integer compareYyyy, Integer targetYyyy, Integer stage);
|
Integer compareYyyy, Integer targetYyyy, Integer stage);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalEntity.mapShee
|
|||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMemberEntity.memberEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMemberEntity.memberEntity;
|
||||||
|
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto;
|
||||||
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.AllocateInfoDto;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InferenceDetail;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InferenceDetail;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InspectState;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.InspectState;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelState;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelState;
|
||||||
@@ -17,6 +18,7 @@ import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerStatistics;
|
|||||||
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceEntity;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalEntity;
|
||||||
|
import com.kamco.cd.kamcoback.postgres.entity.QMemberEntity;
|
||||||
import com.querydsl.core.types.Projections;
|
import com.querydsl.core.types.Projections;
|
||||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||||
import com.querydsl.core.types.dsl.CaseBuilder;
|
import com.querydsl.core.types.dsl.CaseBuilder;
|
||||||
@@ -49,11 +51,15 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
@PersistenceContext private EntityManager em;
|
@PersistenceContext private EntityManager em;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Long> fetchNextIds(
|
public List<AllocateInfoDto> fetchNextIds(
|
||||||
Long lastId, Long batchSize, Integer compareYyyy, Integer targetYyyy, Integer stage) {
|
Long lastId, Long batchSize, Integer compareYyyy, Integer targetYyyy, Integer stage) {
|
||||||
|
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.select(mapSheetAnalDataInferenceGeomEntity.geoUid)
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
AllocateInfoDto.class,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.geoUid,
|
||||||
|
mapSheetAnalDataInferenceGeomEntity.mapSheetNum))
|
||||||
.from(mapSheetAnalDataInferenceGeomEntity)
|
.from(mapSheetAnalDataInferenceGeomEntity)
|
||||||
.where(
|
.where(
|
||||||
lastId == null ? null : mapSheetAnalDataInferenceGeomEntity.geoUid.gt(lastId),
|
lastId == null ? null : mapSheetAnalDataInferenceGeomEntity.geoUid.gt(lastId),
|
||||||
@@ -68,7 +74,11 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void assignOwner(
|
public void assignOwner(
|
||||||
List<Long> ids, String userId, Integer compareYyyy, Integer targetYyyy, Integer stage) {
|
List<AllocateInfoDto> ids,
|
||||||
|
String userId,
|
||||||
|
Integer compareYyyy,
|
||||||
|
Integer targetYyyy,
|
||||||
|
Integer stage) {
|
||||||
|
|
||||||
// analUid로 분석 정보 조회
|
// analUid로 분석 정보 조회
|
||||||
MapSheetAnalDataInferenceEntity analEntity =
|
MapSheetAnalDataInferenceEntity analEntity =
|
||||||
@@ -87,13 +97,16 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
}
|
}
|
||||||
|
|
||||||
// data_geom 테이블에 label state 를 ASSIGNED 로 update
|
// data_geom 테이블에 label state 를 ASSIGNED 로 update
|
||||||
|
List<Long> geoUidList =
|
||||||
|
ids.stream().map(AllocateInfoDto::getGeoUid).filter(Objects::nonNull).toList();
|
||||||
|
|
||||||
queryFactory
|
queryFactory
|
||||||
.update(mapSheetAnalDataInferenceGeomEntity)
|
.update(mapSheetAnalDataInferenceGeomEntity)
|
||||||
.set(mapSheetAnalDataInferenceGeomEntity.labelState, LabelState.ASSIGNED.getId())
|
.set(mapSheetAnalDataInferenceGeomEntity.labelState, LabelState.ASSIGNED.getId())
|
||||||
.set(mapSheetAnalDataInferenceGeomEntity.labelStateDttm, ZonedDateTime.now())
|
.set(mapSheetAnalDataInferenceGeomEntity.labelStateDttm, ZonedDateTime.now())
|
||||||
.set(mapSheetAnalDataInferenceGeomEntity.testState, InspectState.UNCONFIRM.getId())
|
.set(mapSheetAnalDataInferenceGeomEntity.testState, InspectState.UNCONFIRM.getId())
|
||||||
.set(mapSheetAnalDataInferenceGeomEntity.testStateDttm, ZonedDateTime.now())
|
.set(mapSheetAnalDataInferenceGeomEntity.testStateDttm, ZonedDateTime.now())
|
||||||
.where(mapSheetAnalDataInferenceGeomEntity.geoUid.in(ids))
|
.where(mapSheetAnalDataInferenceGeomEntity.geoUid.in(geoUidList))
|
||||||
.execute();
|
.execute();
|
||||||
|
|
||||||
// 라벨러 할당 테이블에 insert
|
// 라벨러 할당 테이블에 insert
|
||||||
@@ -105,13 +118,13 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
values (?, ?, ?, ?, ?, ?)
|
values (?, ?, ?, ?, ?, ?)
|
||||||
""";
|
""";
|
||||||
|
|
||||||
for (Long geoUid : ids) {
|
for (AllocateInfoDto info : ids) {
|
||||||
em.createNativeQuery(sql)
|
em.createNativeQuery(sql)
|
||||||
.setParameter(1, UUID.randomUUID())
|
.setParameter(1, UUID.randomUUID())
|
||||||
.setParameter(2, geoUid)
|
.setParameter(2, info.getGeoUid())
|
||||||
.setParameter(3, userId)
|
.setParameter(3, userId)
|
||||||
.setParameter(4, LabelState.ASSIGNED.getId())
|
.setParameter(4, LabelState.ASSIGNED.getId())
|
||||||
.setParameter(5, "")
|
.setParameter(5, info.getMapSheetNum())
|
||||||
.setParameter(6, analEntity.getAnalUid())
|
.setParameter(6, analEntity.getAnalUid())
|
||||||
.executeUpdate();
|
.executeUpdate();
|
||||||
}
|
}
|
||||||
@@ -572,24 +585,32 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
|||||||
throw new EntityNotFoundException("MapSheetAnalEntity not found for analUid: ");
|
throw new EntityNotFoundException("MapSheetAnalEntity not found for analUid: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QMemberEntity worker = QMemberEntity.memberEntity;
|
||||||
|
QMemberEntity inspector = new QMemberEntity("inspector");
|
||||||
|
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.select(
|
.select(
|
||||||
Projections.constructor(
|
Projections.constructor(
|
||||||
LabelerDetail.class,
|
LabelerDetail.class,
|
||||||
memberEntity.userRole,
|
worker.userRole,
|
||||||
memberEntity.name,
|
worker.name,
|
||||||
memberEntity.employeeNo,
|
worker.employeeNo,
|
||||||
assignedCnt,
|
assignedCnt,
|
||||||
skipCnt,
|
skipCnt,
|
||||||
completeCnt,
|
completeCnt,
|
||||||
percent))
|
percent,
|
||||||
.from(memberEntity)
|
Expressions.constant(0), // TODO: 순위, 꼭 해야할지?
|
||||||
|
labelingAssignmentEntity.createdDate.min(),
|
||||||
|
inspector.name.min()))
|
||||||
|
.from(worker)
|
||||||
.innerJoin(labelingAssignmentEntity)
|
.innerJoin(labelingAssignmentEntity)
|
||||||
.on(
|
.on(
|
||||||
memberEntity.employeeNo.eq(labelingAssignmentEntity.workerUid),
|
worker.employeeNo.eq(labelingAssignmentEntity.workerUid),
|
||||||
labelingAssignmentEntity.analUid.eq(analEntity.getAnalUid()))
|
labelingAssignmentEntity.analUid.eq(analEntity.getAnalUid()))
|
||||||
.where(memberEntity.employeeNo.eq(userId))
|
.leftJoin(inspector)
|
||||||
.groupBy(memberEntity.userRole, memberEntity.name, memberEntity.employeeNo)
|
.on(labelingAssignmentEntity.inspectorUid.eq(inspector.employeeNo))
|
||||||
|
.where(worker.employeeNo.eq(userId))
|
||||||
|
.groupBy(worker.userRole, worker.name, worker.employeeNo)
|
||||||
.fetchOne();
|
.fetchOne();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user