This commit is contained in:
2026-01-02 21:42:13 +09:00
parent e80144d5fc
commit b06c5a88ff
6 changed files with 448 additions and 448 deletions

View File

@@ -110,7 +110,8 @@ public class LabelAllocateApiController {
@Content( @Content(
mediaType = "application/json", mediaType = "application/json",
schema = @Schema(implementation = Long.class), schema = @Schema(implementation = Long.class),
examples = {@ExampleObject( examples = {
@ExampleObject(
name = "라벨러 할당 예시", name = "라벨러 할당 예시",
description = "라벨러 할당 예시", description = "라벨러 할당 예시",
value = value =
@@ -148,8 +149,8 @@ public class LabelAllocateApiController {
] ]
} }
""")} """)
)), })),
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content), @ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content), @ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
@@ -182,7 +183,9 @@ public class LabelAllocateApiController {
@Operation(summary = "작업이관 > 라벨러 상세 정보", description = "작업이관 > 라벨러 상세 정보") @Operation(summary = "작업이관 > 라벨러 상세 정보", description = "작업이관 > 라벨러 상세 정보")
@GetMapping("/labeler-detail") @GetMapping("/labeler-detail")
public ApiResponseDto<LabelerDetail> findLabelerDetail(@RequestParam(defaultValue = "01022223333") String userId, @RequestParam(defaultValue = "3") Long analUid) { public ApiResponseDto<LabelerDetail> findLabelerDetail(
@RequestParam(defaultValue = "01022223333") String userId,
@RequestParam(defaultValue = "3") Long analUid) {
return ApiResponseDto.ok(labelAllocateService.findLabelerDetail(userId, analUid)); return ApiResponseDto.ok(labelAllocateService.findLabelerDetail(userId, analUid));
} }
@@ -196,7 +199,8 @@ public class LabelAllocateApiController {
@Content( @Content(
mediaType = "application/json", mediaType = "application/json",
schema = @Schema(implementation = Long.class), schema = @Schema(implementation = Long.class),
examples = {@ExampleObject( examples = {
@ExampleObject(
name = "라벨러 할당 예시", name = "라벨러 할당 예시",
description = "라벨러 할당 예시", description = "라벨러 할당 예시",
value = value =
@@ -215,8 +219,8 @@ public class LabelAllocateApiController {
} }
] ]
} }
""")} """)
)), })),
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content), @ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content), @ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
@@ -233,8 +237,7 @@ public class LabelAllocateApiController {
@RequestBody @RequestBody
LabelAllocateDto.AllocateMoveDto dto) { LabelAllocateDto.AllocateMoveDto dto) {
labelAllocateService.allocateMove( labelAllocateService.allocateMove(dto.getAutoType(), dto.getStage(), dto.getLabelers());
dto.getAutoType(), dto.getStage(), dto.getLabelers());
return ApiResponseDto.ok(null); return ApiResponseDto.ok(null);
} }

View File

@@ -177,7 +177,7 @@ public class LabelAllocateDto {
private String roleType; private String roleType;
private String name; private String name;
private String userId; //사번 private String userId; // 사번
private Long count; private Long count;
private Long completeCnt; private Long completeCnt;
private Long skipCnt; private Long skipCnt;
@@ -198,5 +198,4 @@ public class LabelAllocateDto {
@Schema(description = "라벨러 할당 목록") @Schema(description = "라벨러 할당 목록")
private List<TargetUser> labelers; private List<TargetUser> labelers;
} }
} }

View File

@@ -176,7 +176,6 @@ public class LabelAllocateService {
labelAllocateCoreService.assignOwnerMove(sub, target.getUserId()); labelAllocateCoreService.assignOwnerMove(sub, target.getUserId());
index = end; index = end;
} }
} }
public LabelerDetail findLabelerDetail(String userId, Long analUid) { public LabelerDetail findLabelerDetail(String userId, Long analUid) {

View File

@@ -44,8 +44,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
private final JPAQueryFactory queryFactory; private final JPAQueryFactory queryFactory;
@PersistenceContext @PersistenceContext private EntityManager em;
private EntityManager em;
@Override @Override
public List<Long> fetchNextIds(Long lastId, Long batchSize, Long analUid) { public List<Long> fetchNextIds(Long lastId, Long batchSize, Long analUid) {
@@ -434,13 +433,12 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
.fetchOne(); .fetchOne();
} }
@Override @Override
public List<Long> fetchNextMoveIds(Long lastId, Long batchSize) { public List<Long> fetchNextMoveIds(Long lastId, Long batchSize) {
MapSheetAnalEntity entity = MapSheetAnalEntity entity =
queryFactory queryFactory
.selectFrom(mapSheetAnalEntity) .selectFrom(mapSheetAnalEntity)
.where(mapSheetAnalEntity.id.eq(3L)) //TODO .where(mapSheetAnalEntity.id.eq(3L)) // TODO
.fetchOne(); .fetchOne();
if (Objects.isNull(entity)) { if (Objects.isNull(entity)) {
@@ -455,7 +453,8 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
lastId == null ? null : mapSheetAnalDataInferenceGeomEntity.geoUid.gt(lastId), lastId == null ? null : mapSheetAnalDataInferenceGeomEntity.geoUid.gt(lastId),
mapSheetAnalDataInferenceGeomEntity.compareYyyy.eq(entity.getCompareYyyy()), mapSheetAnalDataInferenceGeomEntity.compareYyyy.eq(entity.getCompareYyyy()),
mapSheetAnalDataInferenceGeomEntity.targetYyyy.eq(entity.getTargetYyyy()), mapSheetAnalDataInferenceGeomEntity.targetYyyy.eq(entity.getTargetYyyy()),
mapSheetAnalDataInferenceGeomEntity.labelState.in(LabelState.ASSIGNED.getId(), LabelState.SKIP.getId())) mapSheetAnalDataInferenceGeomEntity.labelState.in(
LabelState.ASSIGNED.getId(), LabelState.SKIP.getId()))
.orderBy(mapSheetAnalDataInferenceGeomEntity.mapSheetNum.asc()) .orderBy(mapSheetAnalDataInferenceGeomEntity.mapSheetNum.asc())
.limit(batchSize) .limit(batchSize)
.fetch(); .fetch();
@@ -480,7 +479,8 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
mapSheetAnalDataInferenceGeomEntity.compareYyyy.eq(entity.getCompareYyyy()), mapSheetAnalDataInferenceGeomEntity.compareYyyy.eq(entity.getCompareYyyy()),
mapSheetAnalDataInferenceGeomEntity.targetYyyy.eq(entity.getTargetYyyy()), mapSheetAnalDataInferenceGeomEntity.targetYyyy.eq(entity.getTargetYyyy()),
mapSheetAnalDataInferenceGeomEntity.stage.eq(4), // TODO: 회차 컬럼을 가져와야 할 듯? mapSheetAnalDataInferenceGeomEntity.stage.eq(4), // TODO: 회차 컬럼을 가져와야 할 듯?
mapSheetAnalDataInferenceGeomEntity.labelState.in(LabelState.ASSIGNED.getId(), LabelState.SKIP.getId())) mapSheetAnalDataInferenceGeomEntity.labelState.in(
LabelState.ASSIGNED.getId(), LabelState.SKIP.getId()))
.fetchOne(); .fetchOne();
} }
@@ -500,19 +500,22 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
public LabelerDetail findLabelerDetail(String userId, Long analUid) { public LabelerDetail findLabelerDetail(String userId, Long analUid) {
NumberExpression<Long> assignedCnt = NumberExpression<Long> assignedCnt =
new CaseBuilder() new CaseBuilder()
.when(labelingAssignmentEntity.workState.eq(LabelState.ASSIGNED.getId())).then(1L) .when(labelingAssignmentEntity.workState.eq(LabelState.ASSIGNED.getId()))
.then(1L)
.otherwise((Long) null) .otherwise((Long) null)
.count(); .count();
NumberExpression<Long> skipCnt = NumberExpression<Long> skipCnt =
new CaseBuilder() new CaseBuilder()
.when(labelingAssignmentEntity.workState.eq(LabelState.SKIP.getId())).then(1L) .when(labelingAssignmentEntity.workState.eq(LabelState.SKIP.getId()))
.then(1L)
.otherwise((Long) null) .otherwise((Long) null)
.count(); .count();
NumberExpression<Long> completeCnt = NumberExpression<Long> completeCnt =
new CaseBuilder() new CaseBuilder()
.when(labelingAssignmentEntity.workState.eq(LabelState.COMPLETE.getId())).then(1L) .when(labelingAssignmentEntity.workState.eq(LabelState.COMPLETE.getId()))
.then(1L)
.otherwise((Long) null) .otherwise((Long) null)
.count(); .count();
@@ -525,30 +528,26 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
Double.class, Double.class,
"round({0} / {1}, 2)", "round({0} / {1}, 2)",
labelingAssignmentEntity.count(), labelingAssignmentEntity.count(),
completeCnt completeCnt));
)
);
return queryFactory return queryFactory
.select(Projections.constructor(LabelerDetail.class, .select(
Projections.constructor(
LabelerDetail.class,
memberEntity.userRole, memberEntity.userRole,
memberEntity.name, memberEntity.name,
memberEntity.employeeNo, memberEntity.employeeNo,
assignedCnt, assignedCnt,
skipCnt, skipCnt,
completeCnt, completeCnt,
percent percent))
))
.from(memberEntity) .from(memberEntity)
.innerJoin(labelingAssignmentEntity) .innerJoin(labelingAssignmentEntity)
.on(memberEntity.employeeNo.eq(labelingAssignmentEntity.workerUid), .on(
labelingAssignmentEntity.analUid.eq(analUid) memberEntity.employeeNo.eq(labelingAssignmentEntity.workerUid),
) labelingAssignmentEntity.analUid.eq(analUid))
.where(memberEntity.employeeNo.eq(userId)) .where(memberEntity.employeeNo.eq(userId))
.groupBy(memberEntity.userRole, .groupBy(memberEntity.userRole, memberEntity.name, memberEntity.employeeNo)
memberEntity.name, .fetchOne();
memberEntity.employeeNo)
.fetchOne()
;
} }
} }