할당 가능한 라벨러, 검수자 목록 API
This commit is contained in:
@@ -1,17 +1,25 @@
|
|||||||
package com.kamco.cd.kamcoback.label;
|
package com.kamco.cd.kamcoback.label;
|
||||||
|
|
||||||
|
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.LabelAllocateDto;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.TargetInspector;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.TargetInspector;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.TargetUser;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.TargetUser;
|
||||||
import com.kamco.cd.kamcoback.label.service.LabelAllocateService;
|
import com.kamco.cd.kamcoback.label.service.LabelAllocateService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Content;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
|
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 java.util.List;
|
import java.util.List;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
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
|
||||||
@@ -23,13 +31,38 @@ public class LabelAllocateApiController {
|
|||||||
|
|
||||||
private final LabelAllocateService labelAllocateService;
|
private final LabelAllocateService labelAllocateService;
|
||||||
|
|
||||||
|
@Operation(summary = "배정 가능한 사용자 목록 조회", description = "배정 가능한 사용자 목록 조회")
|
||||||
|
@ApiResponses(
|
||||||
|
value = {
|
||||||
|
@ApiResponse(
|
||||||
|
responseCode = "200",
|
||||||
|
description = "조회 성공",
|
||||||
|
content =
|
||||||
|
@Content(
|
||||||
|
mediaType = "application/json",
|
||||||
|
schema = @Schema(implementation = CommonCodeDto.Basic.class))),
|
||||||
|
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||||
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
|
})
|
||||||
|
@GetMapping("/avail-user")
|
||||||
|
public ApiResponseDto<List<LabelAllocateDto.UserList>> availUserList(@RequestParam @Schema() String role) {
|
||||||
|
return ApiResponseDto.ok(labelAllocateService.availUserList(role));
|
||||||
|
}
|
||||||
|
|
||||||
// 라벨링 수량 할당하는 로직 테스트
|
// 라벨링 수량 할당하는 로직 테스트
|
||||||
@PostMapping("/allocate")
|
@PostMapping("/allocate")
|
||||||
public ApiResponseDto<Void> labelAllocate(@RequestBody LabelAllocateDto dto) {
|
public ApiResponseDto<Void> labelAllocate(@RequestBody LabelAllocateDto dto) {
|
||||||
|
|
||||||
List<TargetUser> targets =
|
List<TargetUser> targets =
|
||||||
List.of(new TargetUser("1234567", 1000), new TargetUser("2345678", 400), new TargetUser("3456789", 440));
|
List.of(
|
||||||
List<TargetInspector> inspectors = List.of(new TargetInspector("9876543", 1000), new TargetInspector("8765432", 340), new TargetInspector("98765432", 500));
|
new TargetUser("1234567", 1000),
|
||||||
|
new TargetUser("2345678", 400),
|
||||||
|
new TargetUser("3456789", 440));
|
||||||
|
List<TargetInspector> inspectors =
|
||||||
|
List.of(
|
||||||
|
new TargetInspector("9876543", 1000),
|
||||||
|
new TargetInspector("8765432", 340),
|
||||||
|
new TargetInspector("98765432", 500));
|
||||||
labelAllocateService.allocateAsc(targets, inspectors);
|
labelAllocateService.allocateAsc(targets, inspectors);
|
||||||
|
|
||||||
return ApiResponseDto.ok(null);
|
return ApiResponseDto.ok(null);
|
||||||
|
|||||||
@@ -115,4 +115,14 @@ public class LabelAllocateDto {
|
|||||||
private ZonedDateTime createdDttm;
|
private ZonedDateTime createdDttm;
|
||||||
private ZonedDateTime updatedDttm;
|
private ZonedDateTime updatedDttm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class UserList {
|
||||||
|
|
||||||
|
private String userRole;
|
||||||
|
private String employeeNo;
|
||||||
|
private String name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.kamco.cd.kamcoback.label.service;
|
|||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.TargetInspector;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.TargetInspector;
|
||||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.TargetUser;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.TargetUser;
|
||||||
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.UserList;
|
||||||
import com.kamco.cd.kamcoback.postgres.core.LabelAllocateCoreService;
|
import com.kamco.cd.kamcoback.postgres.core.LabelAllocateCoreService;
|
||||||
import jakarta.transaction.Transactional;
|
import jakarta.transaction.Transactional;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -29,15 +30,15 @@ public class LabelAllocateService {
|
|||||||
public void allocateAsc(List<TargetUser> targetUsers, List<TargetInspector> targetInspectors) {
|
public void allocateAsc(List<TargetUser> targetUsers, List<TargetInspector> targetInspectors) {
|
||||||
Long lastId = null;
|
Long lastId = null;
|
||||||
|
|
||||||
//geom 잔여건수 != 프론트에서 넘어 온 총 건수 -> return
|
// geom 잔여건수 != 프론트에서 넘어 온 총 건수 -> return
|
||||||
Long chargeCnt = labelAllocateCoreService.findLabelUnAssignedCnt(3L); //TODO
|
Long chargeCnt = labelAllocateCoreService.findLabelUnAssignedCnt(3L); // TODO
|
||||||
Long totalDemand = targetUsers.stream().mapToLong(TargetUser::getDemand).sum();
|
Long totalDemand = targetUsers.stream().mapToLong(TargetUser::getDemand).sum();
|
||||||
if (!Objects.equals(chargeCnt, totalDemand)) {
|
if (!Objects.equals(chargeCnt, totalDemand)) {
|
||||||
log.info("chargeCnt != totalDemand");
|
log.info("chargeCnt != totalDemand");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//라벨러에게 건수만큼 할당
|
// 라벨러에게 건수만큼 할당
|
||||||
for (TargetUser target : targetUsers) {
|
for (TargetUser target : targetUsers) {
|
||||||
int remaining = target.getDemand();
|
int remaining = target.getDemand();
|
||||||
|
|
||||||
@@ -50,15 +51,14 @@ public class LabelAllocateService {
|
|||||||
return; // 더이상 할당할 데이터가 없으면 return
|
return; // 더이상 할당할 데이터가 없으면 return
|
||||||
}
|
}
|
||||||
|
|
||||||
labelAllocateCoreService.assignOwner(
|
labelAllocateCoreService.assignOwner(ids, target.getUserId());
|
||||||
ids, target.getUserId());
|
|
||||||
|
|
||||||
remaining -= ids.size();
|
remaining -= ids.size();
|
||||||
lastId = ids.get(ids.size() - 1);
|
lastId = ids.get(ids.size() - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//검수자에게 userCount명 만큼 할당
|
// 검수자에게 userCount명 만큼 할당
|
||||||
List<LabelAllocateDto.Basic> list = labelAllocateCoreService.findAssignedLabelerList(3L);
|
List<LabelAllocateDto.Basic> list = labelAllocateCoreService.findAssignedLabelerList(3L);
|
||||||
int reviewerIndex = 0;
|
int reviewerIndex = 0;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@@ -66,7 +66,8 @@ public class LabelAllocateService {
|
|||||||
|
|
||||||
for (LabelAllocateDto.Basic labeler : list) {
|
for (LabelAllocateDto.Basic labeler : list) {
|
||||||
TargetInspector inspector = targetInspectors.get(reviewerIndex);
|
TargetInspector inspector = targetInspectors.get(reviewerIndex);
|
||||||
labelAllocateCoreService.assignInspector(labeler.getAssignmentUid(), inspector.getInspectorUid());
|
labelAllocateCoreService.assignInspector(
|
||||||
|
labeler.getAssignmentUid(), inspector.getInspectorUid());
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
if (count == inspector.getUserCount()) {
|
if (count == inspector.getUserCount()) {
|
||||||
@@ -74,6 +75,9 @@ public class LabelAllocateService {
|
|||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<UserList> availUserList(String role) {
|
||||||
|
return labelAllocateCoreService.availUserList(role);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.UserList;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
||||||
import com.kamco.cd.kamcoback.postgres.repository.label.LabelAllocateRepository;
|
import com.kamco.cd.kamcoback.postgres.repository.label.LabelAllocateRepository;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -23,7 +24,9 @@ public class LabelAllocateCoreService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<LabelAllocateDto.Basic> findAssignedLabelerList(Long analUid) {
|
public List<LabelAllocateDto.Basic> findAssignedLabelerList(Long analUid) {
|
||||||
return labelAllocateRepository.findAssignedLabelerList(analUid).stream().map(LabelingAssignmentEntity::toDto).toList();
|
return labelAllocateRepository.findAssignedLabelerList(analUid).stream()
|
||||||
|
.map(LabelingAssignmentEntity::toDto)
|
||||||
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long findLabelUnAssignedCnt(Long analUid) {
|
public Long findLabelUnAssignedCnt(Long analUid) {
|
||||||
@@ -33,4 +36,8 @@ public class LabelAllocateCoreService {
|
|||||||
public void assignInspector(UUID assignmentUid, String inspectorUid) {
|
public void assignInspector(UUID assignmentUid, String inspectorUid) {
|
||||||
labelAllocateRepository.assignInspector(assignmentUid, inspectorUid);
|
labelAllocateRepository.assignInspector(assignmentUid, inspectorUid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<UserList> availUserList(String role) {
|
||||||
|
return labelAllocateRepository.availUserList(role);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,16 +42,16 @@ public class LabelingAssignmentEntity extends CommonDateEntity {
|
|||||||
|
|
||||||
public LabelAllocateDto.Basic toDto() {
|
public LabelAllocateDto.Basic toDto() {
|
||||||
return new LabelAllocateDto.Basic(
|
return new LabelAllocateDto.Basic(
|
||||||
this.assignmentUid,
|
this.assignmentUid,
|
||||||
this.inferenceGeomUid,
|
this.inferenceGeomUid,
|
||||||
this.workerUid,
|
this.workerUid,
|
||||||
this.inspectorUid,
|
this.inspectorUid,
|
||||||
this.workState,
|
this.workState,
|
||||||
this.stagnationYn,
|
this.stagnationYn,
|
||||||
this.assignGroupId,
|
this.assignGroupId,
|
||||||
this.learnGeomUid,
|
this.learnGeomUid,
|
||||||
this.analUid,
|
this.analUid,
|
||||||
super.getCreatedDate(),
|
super.getCreatedDate(),
|
||||||
super.getModifiedDate());
|
super.getModifiedDate());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.UserList;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@@ -15,4 +16,6 @@ public interface LabelAllocateRepositoryCustom {
|
|||||||
Long findLabelUnAssignedCnt(Long analUid);
|
Long findLabelUnAssignedCnt(Long analUid);
|
||||||
|
|
||||||
void assignInspector(UUID assignmentUid, String userId);
|
void assignInspector(UUID assignmentUid, String userId);
|
||||||
|
|
||||||
|
List<UserList> availUserList(String role);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,15 @@ package com.kamco.cd.kamcoback.postgres.repository.label;
|
|||||||
import static com.kamco.cd.kamcoback.postgres.entity.QLabelingAssignmentEntity.labelingAssignmentEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QLabelingAssignmentEntity.labelingAssignmentEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
|
||||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalEntity.mapSheetAnalEntity;
|
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalEntity.mapSheetAnalEntity;
|
||||||
|
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.LabelState;
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelState;
|
||||||
|
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.UserList;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataGeomEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataGeomEntity;
|
||||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalEntity;
|
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalEntity;
|
||||||
|
import com.querydsl.core.types.Projections;
|
||||||
import com.querydsl.core.types.dsl.Expressions;
|
import com.querydsl.core.types.dsl.Expressions;
|
||||||
import com.querydsl.core.types.dsl.StringExpression;
|
import com.querydsl.core.types.dsl.StringExpression;
|
||||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||||
@@ -24,13 +28,12 @@ import org.springframework.stereotype.Repository;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@Repository
|
@Repository
|
||||||
public class LabelAllocateRepositoryImpl extends QuerydslRepositorySupport
|
public class LabelAllocateRepositoryImpl extends QuerydslRepositorySupport
|
||||||
implements LabelAllocateRepositoryCustom {
|
implements LabelAllocateRepositoryCustom {
|
||||||
|
|
||||||
private final JPAQueryFactory queryFactory;
|
private final JPAQueryFactory queryFactory;
|
||||||
private final StringExpression NULL_STRING = Expressions.stringTemplate("cast(null as text)");
|
private final StringExpression NULL_STRING = Expressions.stringTemplate("cast(null as text)");
|
||||||
|
|
||||||
@PersistenceContext
|
@PersistenceContext private EntityManager em;
|
||||||
private EntityManager em;
|
|
||||||
|
|
||||||
public LabelAllocateRepositoryImpl(JPAQueryFactory queryFactory) {
|
public LabelAllocateRepositoryImpl(JPAQueryFactory queryFactory) {
|
||||||
super(MapSheetAnalDataGeomEntity.class);
|
super(MapSheetAnalDataGeomEntity.class);
|
||||||
@@ -41,50 +44,48 @@ public class LabelAllocateRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
public List<Long> fetchNextIds(Long lastId, int batchSize) {
|
public List<Long> fetchNextIds(Long lastId, int batchSize) {
|
||||||
|
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.select(mapSheetAnalDataInferenceGeomEntity.geoUid)
|
.select(mapSheetAnalDataInferenceGeomEntity.geoUid)
|
||||||
.from(mapSheetAnalDataInferenceGeomEntity)
|
.from(mapSheetAnalDataInferenceGeomEntity)
|
||||||
.where(
|
.where(
|
||||||
// mapSheetAnalDataGeomEntity.pnu.isNotNull(), //TODO: Mockup 진행 이후 확인하기
|
// mapSheetAnalDataGeomEntity.pnu.isNotNull(), //TODO: Mockup 진행 이후 확인하기
|
||||||
lastId == null ? null : mapSheetAnalDataInferenceGeomEntity.geoUid.gt(lastId),
|
lastId == null ? null : mapSheetAnalDataInferenceGeomEntity.geoUid.gt(lastId),
|
||||||
mapSheetAnalDataInferenceGeomEntity.compareYyyy.eq(2022),
|
mapSheetAnalDataInferenceGeomEntity.compareYyyy.eq(2022),
|
||||||
mapSheetAnalDataInferenceGeomEntity.targetYyyy.eq(2024),
|
mapSheetAnalDataInferenceGeomEntity.targetYyyy.eq(2024),
|
||||||
mapSheetAnalDataInferenceGeomEntity.labelState.isNull())
|
mapSheetAnalDataInferenceGeomEntity.labelState.isNull())
|
||||||
.orderBy(mapSheetAnalDataInferenceGeomEntity.geoUid.asc())
|
.orderBy(mapSheetAnalDataInferenceGeomEntity.geoUid.asc())
|
||||||
.limit(batchSize)
|
.limit(batchSize)
|
||||||
.fetch();
|
.fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void assignOwner(List<Long> ids, String userId) {
|
public void assignOwner(List<Long> ids, String userId) {
|
||||||
|
|
||||||
//data_geom 테이블에 label state 를 ASSIGNED 로 update
|
// data_geom 테이블에 label state 를 ASSIGNED 로 update
|
||||||
queryFactory
|
queryFactory
|
||||||
.update(mapSheetAnalDataInferenceGeomEntity)
|
.update(mapSheetAnalDataInferenceGeomEntity)
|
||||||
.set(mapSheetAnalDataInferenceGeomEntity.labelState, LabelState.ASSIGNED.getId())
|
.set(mapSheetAnalDataInferenceGeomEntity.labelState, LabelState.ASSIGNED.getId())
|
||||||
.where(mapSheetAnalDataInferenceGeomEntity.geoUid.in(ids))
|
.where(mapSheetAnalDataInferenceGeomEntity.geoUid.in(ids))
|
||||||
.execute();
|
.execute();
|
||||||
|
|
||||||
//라벨러 할당 테이블에 insert
|
// 라벨러 할당 테이블에 insert
|
||||||
for (Long geoUid : ids) {
|
for (Long geoUid : ids) {
|
||||||
queryFactory
|
queryFactory
|
||||||
.insert(labelingAssignmentEntity)
|
.insert(labelingAssignmentEntity)
|
||||||
.columns(
|
.columns(
|
||||||
labelingAssignmentEntity.assignmentUid,
|
labelingAssignmentEntity.assignmentUid,
|
||||||
labelingAssignmentEntity.inferenceGeomUid,
|
labelingAssignmentEntity.inferenceGeomUid,
|
||||||
labelingAssignmentEntity.workerUid,
|
labelingAssignmentEntity.workerUid,
|
||||||
labelingAssignmentEntity.workState,
|
labelingAssignmentEntity.workState,
|
||||||
labelingAssignmentEntity.assignGroupId,
|
labelingAssignmentEntity.assignGroupId,
|
||||||
labelingAssignmentEntity.analUid
|
labelingAssignmentEntity.analUid)
|
||||||
)
|
.values(
|
||||||
.values(
|
UUID.randomUUID(),
|
||||||
UUID.randomUUID(),
|
geoUid,
|
||||||
geoUid,
|
userId,
|
||||||
userId,
|
LabelState.ASSIGNED.getId(),
|
||||||
LabelState.ASSIGNED.getId(),
|
"", // TODO: 도엽번호
|
||||||
"", //TODO: 도엽번호
|
3)
|
||||||
3
|
.execute();
|
||||||
)
|
|
||||||
.execute();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
em.flush();
|
em.flush();
|
||||||
@@ -94,45 +95,59 @@ public class LabelAllocateRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
@Override
|
@Override
|
||||||
public List<LabelingAssignmentEntity> findAssignedLabelerList(Long analUid) {
|
public List<LabelingAssignmentEntity> findAssignedLabelerList(Long analUid) {
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.selectFrom(labelingAssignmentEntity)
|
.selectFrom(labelingAssignmentEntity)
|
||||||
.where(
|
.where(
|
||||||
labelingAssignmentEntity.analUid.eq(analUid),
|
labelingAssignmentEntity.analUid.eq(analUid),
|
||||||
labelingAssignmentEntity.workState.eq(LabelState.ASSIGNED.getId()),
|
labelingAssignmentEntity.workState.eq(LabelState.ASSIGNED.getId()),
|
||||||
labelingAssignmentEntity.inspectorUid.isNull()
|
labelingAssignmentEntity.inspectorUid.isNull())
|
||||||
)
|
.orderBy(labelingAssignmentEntity.workerUid.asc())
|
||||||
.orderBy(labelingAssignmentEntity.workerUid.asc())
|
.fetch();
|
||||||
.fetch();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long findLabelUnAssignedCnt(Long analUid) {
|
public Long findLabelUnAssignedCnt(Long analUid) {
|
||||||
MapSheetAnalEntity entity = queryFactory.selectFrom(mapSheetAnalEntity).where(mapSheetAnalEntity.id.eq(analUid)).fetchOne();
|
MapSheetAnalEntity entity =
|
||||||
|
queryFactory
|
||||||
|
.selectFrom(mapSheetAnalEntity)
|
||||||
|
.where(mapSheetAnalEntity.id.eq(analUid))
|
||||||
|
.fetchOne();
|
||||||
|
|
||||||
if (Objects.isNull(entity)) {
|
if (Objects.isNull(entity)) {
|
||||||
throw new EntityNotFoundException();
|
throw new EntityNotFoundException();
|
||||||
}
|
}
|
||||||
|
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.select(mapSheetAnalDataInferenceGeomEntity.geoUid.count())
|
.select(mapSheetAnalDataInferenceGeomEntity.geoUid.count())
|
||||||
.from(mapSheetAnalDataInferenceGeomEntity)
|
.from(mapSheetAnalDataInferenceGeomEntity)
|
||||||
.where(
|
.where(
|
||||||
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.isNull()
|
mapSheetAnalDataInferenceGeomEntity.labelState.isNull())
|
||||||
)
|
.fetchOne();
|
||||||
.fetchOne()
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void assignInspector(UUID assignmentUid, String inspectorUid) {
|
public void assignInspector(UUID assignmentUid, String inspectorUid) {
|
||||||
queryFactory
|
queryFactory
|
||||||
.update(labelingAssignmentEntity)
|
.update(labelingAssignmentEntity)
|
||||||
.set(labelingAssignmentEntity.inspectorUid, inspectorUid)
|
.set(labelingAssignmentEntity.inspectorUid, inspectorUid)
|
||||||
.where(
|
.where(labelingAssignmentEntity.assignmentUid.eq(assignmentUid))
|
||||||
labelingAssignmentEntity.assignmentUid.eq(assignmentUid)
|
.execute();
|
||||||
)
|
}
|
||||||
.execute();
|
|
||||||
|
@Override
|
||||||
|
public List<UserList> availUserList(String role) {
|
||||||
|
return queryFactory
|
||||||
|
.select(
|
||||||
|
Projections.constructor(
|
||||||
|
LabelAllocateDto.UserList.class,
|
||||||
|
memberEntity.userRole,
|
||||||
|
memberEntity.employeeNo,
|
||||||
|
memberEntity.name))
|
||||||
|
.from(memberEntity)
|
||||||
|
.where(memberEntity.userRole.eq(role), memberEntity.status.eq("ACTIVE"))
|
||||||
|
.orderBy(memberEntity.name.asc())
|
||||||
|
.fetch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user