Merge pull request 'feat/dev_251201' (#149) from feat/dev_251201 into develop
Reviewed-on: https://kamco.gitea.gs.dabeeo.com/dabeeo/kamco-dabeeo-backoffice/pulls/149
This commit is contained in:
@@ -60,6 +60,10 @@ public class LabelAllocateCoreService {
|
||||
return labelAllocateRepository.findLatestProjectInfo();
|
||||
}
|
||||
|
||||
public UUID findLastLabelWorkState() {
|
||||
return labelAllocateRepository.findLastLabelWorkState();
|
||||
}
|
||||
|
||||
public List<WorkerStatistics> findWorkerStatistics(
|
||||
Long analUid, String workerType, String search, String sortType) {
|
||||
return labelAllocateRepository.findWorkerStatistics(analUid, workerType, search, sortType);
|
||||
|
||||
@@ -3,9 +3,12 @@ package com.kamco.cd.kamcoback.postgres.entity;
|
||||
import com.kamco.cd.kamcoback.postgres.CommonDateEntity;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.FetchType;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.time.ZonedDateTime;
|
||||
@@ -66,11 +69,10 @@ public class MapSheetMngHstEntity extends CommonDateEntity {
|
||||
private Integer mngYyyy; // 년도
|
||||
|
||||
// JPA 연관관계: MapInkx5k 참조 (PK 기반) 소속도엽번호 1:5k
|
||||
/*
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "map_sheet_code", referencedColumnName = "fid")
|
||||
private MapInkx5kEntity mapInkx5kByCode;
|
||||
*/
|
||||
|
||||
// TODO 1:5k 관련 정보 추후 제거 필요
|
||||
@Column(name = "map_sheet_num")
|
||||
private String mapSheetNum; // 도엽번호
|
||||
|
||||
@@ -36,6 +36,9 @@ public interface LabelAllocateRepositoryCustom {
|
||||
// 최신 프로젝트 정보 조회 (analUid 없이)
|
||||
ProjectInfo findLatestProjectInfo();
|
||||
|
||||
// 최신 작업 상태의 UUID 조회
|
||||
UUID findLastLabelWorkState();
|
||||
|
||||
// 작업자 통계 조회
|
||||
List<WorkerStatistics> findWorkerStatistics(
|
||||
Long analUid, String workerType, String search, String sortType);
|
||||
|
||||
@@ -21,6 +21,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.MapSheetAnalInferenceEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QMemberEntity;
|
||||
import com.querydsl.core.BooleanBuilder;
|
||||
import com.querydsl.core.types.Expression;
|
||||
import com.querydsl.core.types.Projections;
|
||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||
@@ -690,7 +691,14 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
|
||||
@Override
|
||||
public ProjectInfo findLatestProjectInfo() {
|
||||
// 최신 target_yyyy를 기준으로 프로젝트 정보 조회
|
||||
// 최근 집계용 UUID 조회 - 작업이 할당된 최신 프로젝트 우선
|
||||
UUID uuid = findLastLabelWorkState();
|
||||
|
||||
if (uuid == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// UUID로 프로젝트 정보 조회
|
||||
var result =
|
||||
queryFactory
|
||||
.select(
|
||||
@@ -701,11 +709,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
mapSheetAnalInferenceEntity.createdDttm,
|
||||
mapSheetAnalInferenceEntity.uuid)
|
||||
.from(mapSheetAnalInferenceEntity)
|
||||
.orderBy(
|
||||
mapSheetAnalInferenceEntity.targetYyyy.desc(),
|
||||
mapSheetAnalInferenceEntity.compareYyyy.desc(),
|
||||
mapSheetAnalInferenceEntity.createdDttm.desc())
|
||||
.limit(1)
|
||||
.where(mapSheetAnalInferenceEntity.uuid.eq(uuid))
|
||||
.fetchOne();
|
||||
|
||||
if (result == null) {
|
||||
@@ -717,7 +721,6 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
Integer stage = result.get(mapSheetAnalInferenceEntity.stage);
|
||||
ZonedDateTime gukyuinApplyDttm = result.get(mapSheetAnalInferenceEntity.gukyuinApplyDttm);
|
||||
ZonedDateTime createdDttm = result.get(mapSheetAnalInferenceEntity.createdDttm);
|
||||
UUID uuid = result.get(mapSheetAnalInferenceEntity.uuid);
|
||||
|
||||
// 변화탐지년도 생성
|
||||
String detectionYear =
|
||||
@@ -731,10 +734,45 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
.stage(round)
|
||||
.gukyuinApplyDttm(gukyuinApplyDttm)
|
||||
.startDttm(createdDttm)
|
||||
.uuid(uuid != null ? uuid.toString() : null)
|
||||
.uuid(uuid.toString())
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID findLastLabelWorkState() {
|
||||
BooleanBuilder whereBuilder = new BooleanBuilder();
|
||||
|
||||
// 1. 작업이 할당된 프로젝트 중 최신 UUID 조회
|
||||
UUID uuid =
|
||||
queryFactory
|
||||
.select(mapSheetAnalInferenceEntity.uuid)
|
||||
.from(mapSheetAnalInferenceEntity)
|
||||
.innerJoin(labelingAssignmentEntity)
|
||||
.on(mapSheetAnalInferenceEntity.id.eq(labelingAssignmentEntity.analUid))
|
||||
.where(whereBuilder)
|
||||
.orderBy(
|
||||
mapSheetAnalInferenceEntity.compareYyyy.desc(),
|
||||
mapSheetAnalInferenceEntity.targetYyyy.desc(),
|
||||
mapSheetAnalInferenceEntity.stage.desc())
|
||||
.fetchFirst();
|
||||
|
||||
// 2. 작업이 할당된 프로젝트가 없으면 전체 프로젝트 중 최신 UUID 조회
|
||||
if (uuid == null) {
|
||||
uuid =
|
||||
queryFactory
|
||||
.select(mapSheetAnalInferenceEntity.uuid)
|
||||
.from(mapSheetAnalInferenceEntity)
|
||||
.where(whereBuilder)
|
||||
.orderBy(
|
||||
mapSheetAnalInferenceEntity.compareYyyy.desc(),
|
||||
mapSheetAnalInferenceEntity.targetYyyy.desc(),
|
||||
mapSheetAnalInferenceEntity.stage.desc())
|
||||
.fetchFirst();
|
||||
}
|
||||
|
||||
return uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<LabelingStatDto> findLabelerDailyStat(
|
||||
LabelAllocateDto.searchReq searchReq, String uuid, String userId) {
|
||||
|
||||
Reference in New Issue
Block a user