[KC-151] 재할당 이전 로직으로 수정

This commit is contained in:
2026-01-08 18:08:09 +09:00
parent be69fe274d
commit 8e8c09f2f6
5 changed files with 48 additions and 53 deletions

View File

@@ -87,15 +87,8 @@ public class LabelAllocateCoreService {
return labelAllocateRepository.findInferenceDetail(uuid);
}
public List<Long> fetchNextMoveIds(
Long lastId,
Long batchSize,
Integer compareYyyy,
Integer targetYyyy,
Integer stage,
String userId) {
return labelAllocateRepository.fetchNextMoveIds(
lastId, batchSize, compareYyyy, targetYyyy, stage, userId);
public List<Long> fetchNextMoveIds(Long lastId, Long batchSize, String uuid, String userId) {
return labelAllocateRepository.fetchNextMoveIds(lastId, batchSize, uuid, userId);
}
public void assignOwnerMove(List<Long> sub, String userId) {

View File

@@ -54,13 +54,7 @@ public interface LabelAllocateRepositoryCustom {
InferenceDetail findInferenceDetail(String uuid);
List<Long> fetchNextMoveIds(
Long lastId,
Long batchSize,
Integer compareYyyy,
Integer targetYyyy,
Integer stage,
String userId);
List<Long> fetchNextMoveIds(Long lastId, Long batchSize, String uuid, String userId);
void assignOwnerMove(List<Long> sub, String userId);

View File

@@ -7,6 +7,7 @@ import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceG
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalInferenceEntity.mapSheetAnalInferenceEntity;
import static com.kamco.cd.kamcoback.postgres.entity.QMemberEntity.memberEntity;
import com.kamco.cd.kamcoback.common.enums.StatusType;
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;
@@ -493,38 +494,35 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
Projections.constructor(
InferenceDetail.class,
mapSheetAnalInferenceEntity.analTitle,
Expressions.numberTemplate(Integer.class, "{0}", 4),
mapSheetAnalInferenceEntity.stage,
mapSheetAnalInferenceEntity.gukyuinApplyDttm,
mapSheetAnalInferenceEntity.detectingCnt,
labelingAssignmentEntity.workerUid.countDistinct(),
labelingAssignmentEntity.inspectorUid.countDistinct()))
mapSheetAnalDataInferenceGeomEntity.geoUid.count()))
.from(mapSheetAnalInferenceEntity)
.innerJoin(labelingAssignmentEntity)
.on(mapSheetAnalInferenceEntity.id.eq(labelingAssignmentEntity.analUid))
.leftJoin(mapSheetAnalDataInferenceGeomEntity)
.on(
mapSheetAnalInferenceEntity.compareYyyy.eq(
mapSheetAnalDataInferenceGeomEntity.compareYyyy),
mapSheetAnalInferenceEntity.targetYyyy.eq(
mapSheetAnalDataInferenceGeomEntity.targetYyyy),
mapSheetAnalInferenceEntity.stage.eq(mapSheetAnalDataInferenceGeomEntity.stage),
mapSheetAnalDataInferenceGeomEntity.pnu.gt(0),
mapSheetAnalDataInferenceGeomEntity.passYn.isFalse())
.where(mapSheetAnalInferenceEntity.id.eq(analEntity.getId()))
.groupBy(
mapSheetAnalInferenceEntity.analTitle,
mapSheetAnalInferenceEntity.stage,
mapSheetAnalInferenceEntity.gukyuinApplyDttm,
mapSheetAnalInferenceEntity.detectingCnt)
.fetchOne();
}
@Override
public List<Long> fetchNextMoveIds(
Long lastId,
Long batchSize,
Integer compareYyyy,
Integer targetYyyy,
Integer stage,
String userId) {
public List<Long> fetchNextMoveIds(Long lastId, Long batchSize, String uuid, String userId) {
MapSheetAnalInferenceEntity analEntity =
queryFactory
.selectFrom(mapSheetAnalInferenceEntity)
.where(
mapSheetAnalInferenceEntity.compareYyyy.eq(compareYyyy),
mapSheetAnalInferenceEntity.targetYyyy.eq(targetYyyy),
mapSheetAnalInferenceEntity.stage.eq(stage))
.where(mapSheetAnalInferenceEntity.uuid.eq(UUID.fromString(uuid)))
.fetchOne();
if (Objects.isNull(analEntity)) {
@@ -539,7 +537,9 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
labelingAssignmentEntity.workState.eq(LabelState.ASSIGNED.getId()),
labelingAssignmentEntity.analUid.eq(analEntity.getId()),
lastId == null ? null : labelingAssignmentEntity.inferenceGeomUid.gt(lastId))
.orderBy(labelingAssignmentEntity.inferenceGeomUid.asc())
.orderBy(
labelingAssignmentEntity.assignGroupId.asc(),
labelingAssignmentEntity.inferenceGeomUid.asc())
.limit(batchSize)
.fetch();
}
@@ -574,7 +574,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
NumberExpression<Long> completeCnt =
new CaseBuilder()
.when(labelingAssignmentEntity.workState.eq(LabelState.COMPLETE.getId()))
.when(labelingAssignmentEntity.workState.eq(LabelState.DONE.getId()))
.then(1L)
.otherwise((Long) null)
.count();
@@ -1050,7 +1050,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
.when(
labelingAssignmentEntity
.workState
.eq(LabelState.COMPLETE.getId())
.eq(LabelState.DONE.getId())
.or(labelingAssignmentEntity.workState.eq(LabelState.SKIP.getId())))
.then(1L)
.otherwise(0L)
@@ -1103,7 +1103,9 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
percent))
.from(labelingAssignmentEntity)
.innerJoin(memberEntity)
.on(labelingAssignmentEntity.workerUid.eq(memberEntity.employeeNo))
.on(
labelingAssignmentEntity.workerUid.eq(memberEntity.employeeNo),
memberEntity.status.eq(StatusType.ACTIVE.getId()))
.where(
labelingAssignmentEntity.analUid.eq(analEntity.getId()),
labelingAssignmentEntity.workerUid.ne(userId))
@@ -1112,7 +1114,10 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
completeCnt
.multiply(2)
.goe(totalCnt)) // 진행률 평균 이상인 것들만 조회 => percent 를 바로 쓰면 having절에 무리가 갈 수 있다고 함
.orderBy(completeCnt.desc()) // TODO: 도엽번호? PNU? 로 정렬하여 보여주기?
.orderBy(
completeCnt
.desc()) // TODO: 현재는 잔여건수가 제일 적은(=완료건수가 높은) 순서로 desc, 추후 도엽번호? PNU? 로 정렬하여
// 보여주기?
.fetch();
return new MoveInfo(userChargeCnt, list);