Merge remote-tracking branch 'origin/feat/infer_dev_260107' into feat/infer_dev_260107
This commit is contained in:
@@ -386,7 +386,7 @@ public class InferenceResultApiController {
|
||||
@Parameter(description = "비교년도 분류", example = "waste") @RequestParam(required = false)
|
||||
String compareClass,
|
||||
@Parameter(description = "5000:1 도엽번호 37801011,37801012") @RequestParam(required = false)
|
||||
List<Long> mapSheetNum,
|
||||
Long mapSheetNum,
|
||||
@Parameter(description = "페이지 번호 (0부터 시작)", example = "0") @RequestParam(defaultValue = "0")
|
||||
int page,
|
||||
@Parameter(description = "페이지 크기", example = "20") @RequestParam(defaultValue = "20")
|
||||
|
||||
@@ -10,7 +10,6 @@ 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 java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -50,7 +49,7 @@ public class InferenceResultApiV2Controller {
|
||||
@Parameter(description = "비교년도 분류", example = "waste") @RequestParam(required = false)
|
||||
String compareClass,
|
||||
@Parameter(description = "5000:1 도협번호 37801011,37801012") @RequestParam(required = false)
|
||||
List<Long> mapSheetNum,
|
||||
Long mapSheetNum,
|
||||
@Parameter(description = "페이지 번호 (0부터 시작)", example = "0") @RequestParam(defaultValue = "0")
|
||||
int page,
|
||||
@Parameter(description = "페이지 크기", example = "20") @RequestParam(defaultValue = "20")
|
||||
|
||||
@@ -384,7 +384,7 @@ public class InferenceDetailDto {
|
||||
// 비교년도
|
||||
private String compareClass;
|
||||
// 분석도엽
|
||||
private List<Long> mapSheetNum;
|
||||
private Long mapSheetNum;
|
||||
|
||||
// 페이징 파라미터
|
||||
private int page = 0;
|
||||
|
||||
@@ -53,7 +53,11 @@ public class LabelWorkService {
|
||||
|
||||
public Page<WorkerState> findlabelWorkStateList(LabelWorkDto.WorkerStateSearchReq searchReq) {
|
||||
|
||||
if (searchReq.getUserRole() == null || searchReq.getUserRole().equals("LABELER")) {
|
||||
return labelWorkCoreService.findlabelWorkStateList(searchReq);
|
||||
} else {
|
||||
return labelWorkCoreService.findReviewerWorkStateList(searchReq);
|
||||
}
|
||||
}
|
||||
|
||||
public UUID findLastLabelWorkState() {
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.ChangeDetectYear;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.LabelWorkMng;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.LabelWorkMngDetail;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.WorkerState;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.WorkerStateSearchReq;
|
||||
import com.kamco.cd.kamcoback.postgres.repository.label.LabelWorkRepository;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
@@ -61,4 +62,8 @@ public class LabelWorkCoreService {
|
||||
public UUID findLastLabelWorkState() {
|
||||
return labelWorkRepository.findLastLabelWorkState();
|
||||
}
|
||||
|
||||
public Page<WorkerState> findReviewerWorkStateList(WorkerStateSearchReq searchReq) {
|
||||
return labelWorkRepository.findReviewerWorkStateList(searchReq);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.Inference;
|
||||
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalInferenceEntity.mapSheetAnalInferenceEntity;
|
||||
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto;
|
||||
@@ -252,9 +253,9 @@ public class MapSheetAnalDataInferenceRepositoryImpl
|
||||
}
|
||||
|
||||
// 분석도엽
|
||||
if (searchGeoReq.getMapSheetNum() != null && !searchGeoReq.getMapSheetNum().isEmpty()) {
|
||||
List<Long> mapSheetNum = searchGeoReq.getMapSheetNum();
|
||||
builder.and(MapSheetAnalDataInferenceGeomEntity.mapSheetNum.in(mapSheetNum));
|
||||
if (searchGeoReq.getMapSheetNum() != null) {
|
||||
Long mapSheetNum = searchGeoReq.getMapSheetNum();
|
||||
builder.and(mapSheetAnalDataInferenceGeomEntity.mapSheetNum.like("%" + mapSheetNum + "%"));
|
||||
}
|
||||
|
||||
List<InferenceDetailDto.Geom> content =
|
||||
@@ -368,8 +369,8 @@ public class MapSheetAnalDataInferenceRepositoryImpl
|
||||
}
|
||||
|
||||
private BooleanExpression containsMapSheetNum(
|
||||
QMapSheetAnalDataInferenceGeomEntity detectedEntity, List<Long> mapSheet) {
|
||||
if (mapSheet == null || mapSheet.isEmpty()) {
|
||||
QMapSheetAnalDataInferenceGeomEntity detectedEntity, Long mapSheet) {
|
||||
if (mapSheet == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -391,9 +391,9 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
|
||||
}
|
||||
|
||||
// 분석도엽
|
||||
if (searchGeoReq.getMapSheetNum() != null && !searchGeoReq.getMapSheetNum().isEmpty()) {
|
||||
List<Long> mapSheetNum = searchGeoReq.getMapSheetNum();
|
||||
builder.and(mapSheetAnalDataInferenceGeomEntity.mapSheetNum.in(mapSheetNum));
|
||||
if (searchGeoReq.getMapSheetNum() != null) {
|
||||
Long mapSheetNum = searchGeoReq.getMapSheetNum();
|
||||
builder.and(mapSheetAnalDataInferenceGeomEntity.mapSheetNum.like("%" + mapSheetNum + "%"));
|
||||
}
|
||||
|
||||
List<Geom> content =
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.kamco.cd.kamcoback.label.dto.LabelWorkDto;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.LabelWorkMng;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.LabelWorkMngDetail;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.WorkerState;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.WorkerStateSearchReq;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalInferenceEntity;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
@@ -20,4 +21,6 @@ public interface LabelWorkRepositoryCustom {
|
||||
Page<WorkerState> findlabelWorkStateList(LabelWorkDto.WorkerStateSearchReq searchReq);
|
||||
|
||||
UUID findLastLabelWorkState();
|
||||
|
||||
Page<WorkerState> findReviewerWorkStateList(WorkerStateSearchReq searchReq);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.kamco.cd.kamcoback.label.dto.LabelWorkDto;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.LabelWorkMng;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.LabelWorkMngDetail;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.WorkerState;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.WorkerStateSearchReq;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalInferenceEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QLabelingAssignmentEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceEntity;
|
||||
@@ -300,17 +301,17 @@ public class LabelWorkRepositoryImpl implements LabelWorkRepositoryCustom {
|
||||
NumberExpression<Long> day3AgoDoneCnt =
|
||||
this.caseSumExpression(
|
||||
doneStateCondition.and(
|
||||
this.fromDateEqExpression(labelingAssignmentEntity.modifiedDate, -3)));
|
||||
this.fromDateEqExpression(labelingAssignmentEntity.workStatDttm, -3)));
|
||||
|
||||
NumberExpression<Long> day2AgoDoneCnt =
|
||||
this.caseSumExpression(
|
||||
doneStateCondition.and(
|
||||
this.fromDateEqExpression(labelingAssignmentEntity.modifiedDate, -2)));
|
||||
this.fromDateEqExpression(labelingAssignmentEntity.workStatDttm, -2)));
|
||||
|
||||
NumberExpression<Long> day1AgoDoneCnt =
|
||||
this.caseSumExpression(
|
||||
doneStateCondition.and(
|
||||
this.fromDateEqExpression(labelingAssignmentEntity.modifiedDate, -1)));
|
||||
this.fromDateEqExpression(labelingAssignmentEntity.workStatDttm, -1)));
|
||||
|
||||
NumberExpression<Long> remainingCnt = assignedCnt.subtract(doneCnt);
|
||||
|
||||
@@ -409,6 +410,118 @@ public class LabelWorkRepositoryImpl implements LabelWorkRepositoryCustom {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<WorkerState> findReviewerWorkStateList(WorkerStateSearchReq searchReq) {
|
||||
Pageable pageable = PageRequest.of(searchReq.getPage(), searchReq.getSize());
|
||||
BooleanBuilder whereBuilder = new BooleanBuilder();
|
||||
BooleanBuilder whereSubBuilder = new BooleanBuilder();
|
||||
List<OrderSpecifier<?>> orderSpecifiers = new ArrayList<>();
|
||||
|
||||
UUID uuid = UUID.fromString(searchReq.getUuid());
|
||||
|
||||
if (searchReq.getUserRole() != null && !searchReq.getUserRole().isEmpty()) {
|
||||
whereSubBuilder.and(memberEntity.userRole.eq(searchReq.getUserRole()));
|
||||
}
|
||||
|
||||
if (searchReq.getSearchVal() != null && !searchReq.getSearchVal().isEmpty()) {
|
||||
whereSubBuilder.and(
|
||||
Expressions.stringTemplate("{0}", memberEntity.userId)
|
||||
.likeIgnoreCase("%" + searchReq.getSearchVal() + "%")
|
||||
.or(
|
||||
Expressions.stringTemplate("{0}", memberEntity.name)
|
||||
.likeIgnoreCase("%" + searchReq.getSearchVal() + "%")));
|
||||
}
|
||||
|
||||
whereSubBuilder.and(labelingAssignmentEntity.inspectorUid.eq(memberEntity.userId));
|
||||
|
||||
// 공통 조건 추출
|
||||
BooleanExpression doneStateCondition =
|
||||
labelingAssignmentEntity.inspectState.eq(InspectState.COMPLETE.name());
|
||||
|
||||
NumberExpression<Long> assignedCnt = labelingAssignmentEntity.inspectorUid.count();
|
||||
NumberExpression<Long> doneCnt = this.caseSumExpression(doneStateCondition);
|
||||
NumberExpression<Long> skipCnt =
|
||||
this.caseSumExpression(
|
||||
labelingAssignmentEntity.inspectState.eq(InspectState.EXCEPT.name()));
|
||||
|
||||
NumberExpression<Long> day3AgoDoneCnt =
|
||||
this.caseSumExpression(
|
||||
doneStateCondition.and(
|
||||
this.fromDateEqExpression(labelingAssignmentEntity.inspectStatDttm, -3)));
|
||||
|
||||
NumberExpression<Long> day2AgoDoneCnt =
|
||||
this.caseSumExpression(
|
||||
doneStateCondition.and(
|
||||
this.fromDateEqExpression(labelingAssignmentEntity.inspectStatDttm, -2)));
|
||||
|
||||
NumberExpression<Long> day1AgoDoneCnt =
|
||||
this.caseSumExpression(
|
||||
doneStateCondition.and(
|
||||
this.fromDateEqExpression(labelingAssignmentEntity.inspectStatDttm, -1)));
|
||||
|
||||
NumberExpression<Long> remainingCnt = assignedCnt.subtract(doneCnt);
|
||||
|
||||
if (searchReq.getSort() == null || searchReq.getSort().isEmpty()) {
|
||||
orderSpecifiers.add(memberEntity.name.asc());
|
||||
} else if (searchReq.getSort().equals("doneCnt desc")) {
|
||||
orderSpecifiers.add(doneCnt.desc());
|
||||
} else if (searchReq.getSort().equals("remindCnt desc")) {
|
||||
orderSpecifiers.add(remainingCnt.desc());
|
||||
}
|
||||
|
||||
List<WorkerState> foundContent =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
WorkerState.class,
|
||||
memberEntity.userRole,
|
||||
memberEntity.name,
|
||||
memberEntity.userId,
|
||||
assignedCnt.as("assignedCnt"),
|
||||
doneCnt.as("doneCnt"),
|
||||
skipCnt.as("skipCnt"),
|
||||
day3AgoDoneCnt.as("day3AgoDoneCnt"),
|
||||
day2AgoDoneCnt.as("day2AgoDoneCnt"),
|
||||
day1AgoDoneCnt.as("day1AgoDoneCnt")))
|
||||
.from(labelingAssignmentEntity)
|
||||
.innerJoin(mapSheetAnalInferenceEntity)
|
||||
.on(
|
||||
mapSheetAnalInferenceEntity
|
||||
.uuid
|
||||
.eq(uuid)
|
||||
.and(labelingAssignmentEntity.analUid.eq(mapSheetAnalInferenceEntity.id)))
|
||||
.innerJoin(memberEntity)
|
||||
.on(whereSubBuilder)
|
||||
.where(whereBuilder)
|
||||
.groupBy(memberEntity.userRole, memberEntity.name, memberEntity.userId)
|
||||
.orderBy(orderSpecifiers.toArray(new OrderSpecifier[0]))
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.fetch();
|
||||
|
||||
// Count 쿼리 별도 실행 (null safe handling)
|
||||
long countQuery =
|
||||
Optional.ofNullable(
|
||||
queryFactory
|
||||
.select(labelingAssignmentEntity.workerUid.countDistinct())
|
||||
.from(labelingAssignmentEntity)
|
||||
.innerJoin(mapSheetAnalInferenceEntity)
|
||||
.on(
|
||||
mapSheetAnalInferenceEntity
|
||||
.uuid
|
||||
.eq(uuid)
|
||||
.and(
|
||||
labelingAssignmentEntity.analUid.eq(
|
||||
mapSheetAnalInferenceEntity.id)))
|
||||
.innerJoin(memberEntity)
|
||||
.on(whereSubBuilder)
|
||||
.where(whereBuilder)
|
||||
.fetchOne())
|
||||
.orElse(0L);
|
||||
|
||||
return new PageImpl<>(foundContent, pageable, countQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 작업배정 상세조회 (복잡한 집계 쿼리로 인해 DTO 직접 반환)
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user