라벨할당 로직에 도엽 추가, 라벨러 상세 정보 수정
This commit is contained in:
@@ -150,8 +150,8 @@ public class LabelAllocateApiController {
|
||||
}
|
||||
|
||||
@Operation(
|
||||
summary = "작업현황 관리 > 상세 > 작업 이관 > 팝업 내 라벨러 상세 정보",
|
||||
description = "작업현황 관리 > 상세 > 작업 이관 > 팝업 내 라벨러 상세 정보")
|
||||
summary = "작업현황 관리 > 라벨러 상세 정보, 작업이관 팝업 내 라벨러 상세 정보 동일",
|
||||
description = "작업현황 관리 > 라벨러 상세 정보, 작업이관 팝업 내 라벨러 상세 정보 동일")
|
||||
@GetMapping("/labeler-detail")
|
||||
public ApiResponseDto<LabelerDetail> findLabelerDetail(
|
||||
@RequestParam(defaultValue = "01022223333") String userId,
|
||||
|
||||
@@ -109,42 +109,42 @@ public class LabelAllocateDto {
|
||||
description = "라벨러 할당 목록",
|
||||
example =
|
||||
"""
|
||||
[
|
||||
{
|
||||
"userId": "123456",
|
||||
"demand": 1000
|
||||
},
|
||||
{
|
||||
"userId": "010222297501",
|
||||
"demand": 400
|
||||
},
|
||||
{
|
||||
"userId": "01022223333",
|
||||
"demand": 440
|
||||
}
|
||||
]
|
||||
""")
|
||||
[
|
||||
{
|
||||
"userId": "123456",
|
||||
"demand": 1000
|
||||
},
|
||||
{
|
||||
"userId": "010222297501",
|
||||
"demand": 400
|
||||
},
|
||||
{
|
||||
"userId": "01022223333",
|
||||
"demand": 440
|
||||
}
|
||||
]
|
||||
""")
|
||||
private List<TargetUser> labelers;
|
||||
|
||||
@Schema(
|
||||
description = "검수자 할당 목록",
|
||||
example =
|
||||
"""
|
||||
[
|
||||
{
|
||||
"inspectorUid": "K20251216001",
|
||||
"userCount": 1000
|
||||
},
|
||||
{
|
||||
"inspectorUid": "01022225555",
|
||||
"userCount": 340
|
||||
[
|
||||
{
|
||||
"inspectorUid": "K20251216001",
|
||||
"userCount": 1000
|
||||
},
|
||||
{
|
||||
"inspectorUid": "K20251212001",
|
||||
"userCount": 500
|
||||
}
|
||||
]
|
||||
""")
|
||||
{
|
||||
"inspectorUid": "01022225555",
|
||||
"userCount": 340
|
||||
},
|
||||
{
|
||||
"inspectorUid": "K20251212001",
|
||||
"userCount": 500
|
||||
}
|
||||
]
|
||||
""")
|
||||
private List<TargetInspector> inspectors;
|
||||
}
|
||||
|
||||
@@ -227,6 +227,9 @@ public class LabelAllocateDto {
|
||||
private Long completeCnt;
|
||||
private Long skipCnt;
|
||||
private Double percent;
|
||||
private Integer ranking;
|
||||
private ZonedDateTime createdDttm;
|
||||
private String inspectorName;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@@ -244,17 +247,17 @@ public class LabelAllocateDto {
|
||||
description = "라벨러 할당 목록",
|
||||
example =
|
||||
"""
|
||||
[
|
||||
{
|
||||
"userId": "123456",
|
||||
"demand": 10
|
||||
},
|
||||
{
|
||||
"userId": "010222297501",
|
||||
"demand": 5
|
||||
}
|
||||
]
|
||||
""")
|
||||
[
|
||||
{
|
||||
"userId": "123456",
|
||||
"demand": 10
|
||||
},
|
||||
{
|
||||
"userId": "010222297501",
|
||||
"demand": 5
|
||||
}
|
||||
]
|
||||
""")
|
||||
private List<TargetUser> labelers;
|
||||
|
||||
@Schema(description = "비교년도", example = "2022")
|
||||
@@ -263,4 +266,13 @@ public class LabelAllocateDto {
|
||||
@Schema(description = "기준년도", example = "2024")
|
||||
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.ApiResponseCode;
|
||||
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.LabelerDetail;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.TargetInspector;
|
||||
@@ -67,12 +68,12 @@ public class LabelAllocateService {
|
||||
ApiResponseCode.BAD_REQUEST, "총 잔여건수와 요청 값의 합계가 맞지 않습니다.");
|
||||
}
|
||||
|
||||
List<Long> allIds =
|
||||
List<AllocateInfoDto> allIds =
|
||||
labelAllocateCoreService.fetchNextIds(lastId, chargeCnt, compareYyyy, targetYyyy, stage);
|
||||
int index = 0;
|
||||
for (TargetUser target : targetUsers) {
|
||||
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);
|
||||
index = end;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.kamco.cd.kamcoback.postgres.core;
|
||||
|
||||
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.LabelerDetail;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.UserList;
|
||||
@@ -20,13 +21,17 @@ public class LabelAllocateCoreService {
|
||||
|
||||
private final LabelAllocateRepository labelAllocateRepository;
|
||||
|
||||
public List<Long> fetchNextIds(
|
||||
public List<AllocateInfoDto> fetchNextIds(
|
||||
Long lastId, Long batchSize, Integer compareYyyy, Integer targetYyyy, Integer stage) {
|
||||
return labelAllocateRepository.fetchNextIds(lastId, batchSize, compareYyyy, targetYyyy, stage);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
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.LabelerDetail;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.UserList;
|
||||
@@ -12,11 +13,15 @@ import java.util.UUID;
|
||||
|
||||
public interface LabelAllocateRepositoryCustom {
|
||||
|
||||
List<Long> fetchNextIds(
|
||||
List<AllocateInfoDto> fetchNextIds(
|
||||
Long lastId, Long batchSize, Integer compareYyyy, Integer targetYyyy, Integer stage);
|
||||
|
||||
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(
|
||||
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 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.InspectState;
|
||||
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.MapSheetAnalDataInferenceEntity;
|
||||
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.dsl.BooleanExpression;
|
||||
import com.querydsl.core.types.dsl.CaseBuilder;
|
||||
@@ -49,11 +51,15 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
@PersistenceContext private EntityManager em;
|
||||
|
||||
@Override
|
||||
public List<Long> fetchNextIds(
|
||||
public List<AllocateInfoDto> fetchNextIds(
|
||||
Long lastId, Long batchSize, Integer compareYyyy, Integer targetYyyy, Integer stage) {
|
||||
|
||||
return queryFactory
|
||||
.select(mapSheetAnalDataInferenceGeomEntity.geoUid)
|
||||
.select(
|
||||
Projections.constructor(
|
||||
AllocateInfoDto.class,
|
||||
mapSheetAnalDataInferenceGeomEntity.geoUid,
|
||||
mapSheetAnalDataInferenceGeomEntity.mapSheetNum))
|
||||
.from(mapSheetAnalDataInferenceGeomEntity)
|
||||
.where(
|
||||
lastId == null ? null : mapSheetAnalDataInferenceGeomEntity.geoUid.gt(lastId),
|
||||
@@ -68,7 +74,11 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
|
||||
@Override
|
||||
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로 분석 정보 조회
|
||||
MapSheetAnalDataInferenceEntity analEntity =
|
||||
@@ -87,13 +97,16 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
}
|
||||
|
||||
// data_geom 테이블에 label state 를 ASSIGNED 로 update
|
||||
List<Long> geoUidList =
|
||||
ids.stream().map(AllocateInfoDto::getGeoUid).filter(Objects::nonNull).toList();
|
||||
|
||||
queryFactory
|
||||
.update(mapSheetAnalDataInferenceGeomEntity)
|
||||
.set(mapSheetAnalDataInferenceGeomEntity.labelState, LabelState.ASSIGNED.getId())
|
||||
.set(mapSheetAnalDataInferenceGeomEntity.labelStateDttm, ZonedDateTime.now())
|
||||
.set(mapSheetAnalDataInferenceGeomEntity.testState, InspectState.UNCONFIRM.getId())
|
||||
.set(mapSheetAnalDataInferenceGeomEntity.testStateDttm, ZonedDateTime.now())
|
||||
.where(mapSheetAnalDataInferenceGeomEntity.geoUid.in(ids))
|
||||
.where(mapSheetAnalDataInferenceGeomEntity.geoUid.in(geoUidList))
|
||||
.execute();
|
||||
|
||||
// 라벨러 할당 테이블에 insert
|
||||
@@ -105,13 +118,13 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
values (?, ?, ?, ?, ?, ?)
|
||||
""";
|
||||
|
||||
for (Long geoUid : ids) {
|
||||
for (AllocateInfoDto info : ids) {
|
||||
em.createNativeQuery(sql)
|
||||
.setParameter(1, UUID.randomUUID())
|
||||
.setParameter(2, geoUid)
|
||||
.setParameter(2, info.getGeoUid())
|
||||
.setParameter(3, userId)
|
||||
.setParameter(4, LabelState.ASSIGNED.getId())
|
||||
.setParameter(5, "")
|
||||
.setParameter(5, info.getMapSheetNum())
|
||||
.setParameter(6, analEntity.getAnalUid())
|
||||
.executeUpdate();
|
||||
}
|
||||
@@ -572,24 +585,32 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
throw new EntityNotFoundException("MapSheetAnalEntity not found for analUid: ");
|
||||
}
|
||||
|
||||
QMemberEntity worker = QMemberEntity.memberEntity;
|
||||
QMemberEntity inspector = new QMemberEntity("inspector");
|
||||
|
||||
return queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
LabelerDetail.class,
|
||||
memberEntity.userRole,
|
||||
memberEntity.name,
|
||||
memberEntity.employeeNo,
|
||||
worker.userRole,
|
||||
worker.name,
|
||||
worker.employeeNo,
|
||||
assignedCnt,
|
||||
skipCnt,
|
||||
completeCnt,
|
||||
percent))
|
||||
.from(memberEntity)
|
||||
percent,
|
||||
Expressions.constant(0), // TODO: 순위, 꼭 해야할지?
|
||||
labelingAssignmentEntity.createdDate.min(),
|
||||
inspector.name.min()))
|
||||
.from(worker)
|
||||
.innerJoin(labelingAssignmentEntity)
|
||||
.on(
|
||||
memberEntity.employeeNo.eq(labelingAssignmentEntity.workerUid),
|
||||
worker.employeeNo.eq(labelingAssignmentEntity.workerUid),
|
||||
labelingAssignmentEntity.analUid.eq(analEntity.getAnalUid()))
|
||||
.where(memberEntity.employeeNo.eq(userId))
|
||||
.groupBy(memberEntity.userRole, memberEntity.name, memberEntity.employeeNo)
|
||||
.leftJoin(inspector)
|
||||
.on(labelingAssignmentEntity.inspectorUid.eq(inspector.employeeNo))
|
||||
.where(worker.employeeNo.eq(userId))
|
||||
.groupBy(worker.userRole, worker.name, worker.employeeNo)
|
||||
.fetchOne();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user