개선작업
This commit is contained in:
@@ -107,7 +107,11 @@ public class LabelAllocateApiController {
|
||||
@PostMapping("/allocate")
|
||||
public ApiResponseDto<Void> labelAllocate(@RequestBody LabelAllocateDto.AllocateDto dto) {
|
||||
labelAllocateService.allocateAsc(
|
||||
dto.getAutoType(), dto.getStage(), dto.getLabelers(), dto.getInspectors());
|
||||
dto.getAutoType(),
|
||||
dto.getStage(),
|
||||
dto.getLabelers(),
|
||||
dto.getInspectors(),
|
||||
dto.getAnalUid());
|
||||
|
||||
return ApiResponseDto.ok(null);
|
||||
}
|
||||
|
||||
@@ -2,14 +2,9 @@ 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.label.dto.LabelAllocateDto;
|
||||
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.LabelWorkDto;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.LabelWorkMng;
|
||||
import com.kamco.cd.kamcoback.label.service.LabelAllocateService;
|
||||
import com.kamco.cd.kamcoback.label.service.LabelWorkService;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@@ -17,15 +12,12 @@ 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 jakarta.validation.Valid;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Slf4j
|
||||
@@ -52,9 +44,7 @@ public class LabelWorkerApiController {
|
||||
})
|
||||
@PostMapping("/label-work-mng-list")
|
||||
public ApiResponseDto<Page<LabelWorkMng>> labelWorkMngList(
|
||||
@RequestBody @Valid LabelWorkDto.LabelWorkMngSearchReq searchReq) {
|
||||
@RequestBody @Valid LabelWorkDto.LabelWorkMngSearchReq searchReq) {
|
||||
return ApiResponseDto.ok(labelWorkService.labelWorkMngList(searchReq));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -87,6 +87,9 @@ public class LabelAllocateDto {
|
||||
@AllArgsConstructor
|
||||
public static class AllocateDto {
|
||||
|
||||
@Schema(description = "분석 ID", example = "3", required = true)
|
||||
private Long analUid;
|
||||
|
||||
@Schema(description = "자동/수동여부(AUTO/MANUAL)", example = "AUTO")
|
||||
private String autoType;
|
||||
|
||||
|
||||
@@ -1,26 +1,19 @@
|
||||
package com.kamco.cd.kamcoback.label.dto;
|
||||
|
||||
import com.kamco.cd.kamcoback.common.enums.MngStateType;
|
||||
import com.kamco.cd.kamcoback.common.utils.enums.CodeExpose;
|
||||
import com.kamco.cd.kamcoback.common.utils.enums.EnumType;
|
||||
import com.kamco.cd.kamcoback.common.utils.enums.Enums;
|
||||
import com.kamco.cd.kamcoback.common.utils.interfaces.JsonFormatDttm;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelMngState;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
|
||||
public class LabelWorkDto {
|
||||
|
||||
|
||||
|
||||
@Schema(name = "LabelWorkMng", description = "라벨작업관리")
|
||||
@Getter
|
||||
@Setter
|
||||
@@ -39,7 +32,6 @@ public class LabelWorkDto {
|
||||
private Long labelCompleteTotCnt;
|
||||
@JsonFormatDttm private ZonedDateTime labelStartDttm;
|
||||
|
||||
|
||||
public String getLabelState() {
|
||||
|
||||
String mngState = "PENDING";
|
||||
@@ -69,7 +61,6 @@ public class LabelWorkDto {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Schema(name = "LabelWorkMngSearchReq", description = "라벨작업관리 검색 요청")
|
||||
@Getter
|
||||
@Setter
|
||||
@@ -98,5 +89,4 @@ public class LabelWorkDto {
|
||||
return PageRequest.of(page, size);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -37,17 +37,19 @@ public class LabelAllocateService {
|
||||
* @param stage 회차
|
||||
* @param targetUsers 라벨러 목록
|
||||
* @param targetInspectors 검수자 목록
|
||||
* @param analUid 분석 ID
|
||||
*/
|
||||
@Transactional
|
||||
public void allocateAsc(
|
||||
String autoType,
|
||||
Integer stage,
|
||||
List<TargetUser> targetUsers,
|
||||
List<TargetInspector> targetInspectors) {
|
||||
List<TargetInspector> targetInspectors,
|
||||
Long analUid) {
|
||||
Long lastId = null;
|
||||
|
||||
// geom 잔여건수 != 프론트에서 넘어 온 총 건수 -> return
|
||||
Long chargeCnt = labelAllocateCoreService.findLabelUnAssignedCnt(3L); // TODO
|
||||
// geom 잔여건수 조회
|
||||
Long chargeCnt = labelAllocateCoreService.findLabelUnAssignedCnt(analUid, stage);
|
||||
// Long totalDemand = targetUsers.stream().mapToLong(TargetUser::getDemand).sum();
|
||||
// if (!Objects.equals(chargeCnt, totalDemand)) {
|
||||
// log.info("chargeCnt != totalDemand");
|
||||
@@ -58,18 +60,18 @@ public class LabelAllocateService {
|
||||
return;
|
||||
}
|
||||
|
||||
List<Long> allIds = labelAllocateCoreService.fetchNextIds(lastId, chargeCnt);
|
||||
List<Long> allIds = labelAllocateCoreService.fetchNextIds(lastId, chargeCnt, analUid);
|
||||
int index = 0;
|
||||
for (TargetUser target : targetUsers) {
|
||||
int end = index + target.getDemand();
|
||||
List<Long> sub = allIds.subList(index, end);
|
||||
|
||||
labelAllocateCoreService.assignOwner(sub, target.getUserId());
|
||||
labelAllocateCoreService.assignOwner(sub, target.getUserId(), analUid);
|
||||
index = end;
|
||||
}
|
||||
|
||||
// 검수자에게 userCount명 만큼 할당
|
||||
List<LabelAllocateDto.Basic> list = labelAllocateCoreService.findAssignedLabelerList(3L);
|
||||
List<LabelAllocateDto.Basic> list = labelAllocateCoreService.findAssignedLabelerList(analUid);
|
||||
int from = 0;
|
||||
|
||||
for (TargetInspector inspector : targetInspectors) {
|
||||
|
||||
@@ -1,16 +1,8 @@
|
||||
package com.kamco.cd.kamcoback.label.service;
|
||||
|
||||
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.TargetUser;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.UserList;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.LabelWorkMng;
|
||||
import com.kamco.cd.kamcoback.postgres.core.LabelAllocateCoreService;
|
||||
import com.kamco.cd.kamcoback.postgres.core.LabelWorkCoreService;
|
||||
import jakarta.transaction.Transactional;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -25,8 +17,6 @@ public class LabelWorkService {
|
||||
this.labelWorkCoreService = labelWorkCoreService;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Page<LabelWorkMng> labelWorkMngList(LabelWorkDto.LabelWorkMngSearchReq searchReq) {
|
||||
|
||||
return labelWorkCoreService.labelWorkMngList(searchReq);
|
||||
|
||||
@@ -19,12 +19,12 @@ public class LabelAllocateCoreService {
|
||||
|
||||
private final LabelAllocateRepository labelAllocateRepository;
|
||||
|
||||
public List<Long> fetchNextIds(Long lastId, Long batchSize) {
|
||||
return labelAllocateRepository.fetchNextIds(lastId, batchSize);
|
||||
public List<Long> fetchNextIds(Long lastId, Long batchSize, Long analUid) {
|
||||
return labelAllocateRepository.fetchNextIds(lastId, batchSize, analUid);
|
||||
}
|
||||
|
||||
public void assignOwner(List<Long> ids, String userId) {
|
||||
labelAllocateRepository.assignOwner(ids, userId);
|
||||
public void assignOwner(List<Long> ids, String userId, Long analUid) {
|
||||
labelAllocateRepository.assignOwner(ids, userId, analUid);
|
||||
}
|
||||
|
||||
public List<LabelAllocateDto.Basic> findAssignedLabelerList(Long analUid) {
|
||||
@@ -33,8 +33,8 @@ public class LabelAllocateCoreService {
|
||||
.toList();
|
||||
}
|
||||
|
||||
public Long findLabelUnAssignedCnt(Long analUid) {
|
||||
return labelAllocateRepository.findLabelUnAssignedCnt(analUid);
|
||||
public Long findLabelUnAssignedCnt(Long analUid, Integer stage) {
|
||||
return labelAllocateRepository.findLabelUnAssignedCnt(analUid, stage);
|
||||
}
|
||||
|
||||
public void assignInspector(UUID assignmentUid, String inspectorUid) {
|
||||
|
||||
@@ -1,17 +1,8 @@
|
||||
package com.kamco.cd.kamcoback.postgres.core;
|
||||
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.UserList;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.LabelWorkMng;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.ErrorDataDto;
|
||||
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.LabelWorkRepository;
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -22,10 +13,7 @@ public class LabelWorkCoreService {
|
||||
|
||||
private final LabelWorkRepository labelWorkRepository;
|
||||
|
||||
|
||||
public Page<LabelWorkMng> labelWorkMngList(LabelWorkDto.LabelWorkMngSearchReq searchReq) {
|
||||
return labelWorkRepository.labelWorkMngList(searchReq);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -11,13 +11,13 @@ import java.util.UUID;
|
||||
|
||||
public interface LabelAllocateRepositoryCustom {
|
||||
|
||||
List<Long> fetchNextIds(Long lastId, Long batchSize);
|
||||
List<Long> fetchNextIds(Long lastId, Long batchSize, Long analUid);
|
||||
|
||||
void assignOwner(List<Long> ids, String userId);
|
||||
void assignOwner(List<Long> ids, String userId, Long analUid);
|
||||
|
||||
List<LabelingAssignmentEntity> findAssignedLabelerList(Long analUid);
|
||||
|
||||
Long findLabelUnAssignedCnt(Long analUid);
|
||||
Long findLabelUnAssignedCnt(Long analUid, Integer stage);
|
||||
|
||||
void assignInspector(UUID assignmentUid, String userId);
|
||||
|
||||
|
||||
@@ -44,16 +44,25 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
@PersistenceContext private EntityManager em;
|
||||
|
||||
@Override
|
||||
public List<Long> fetchNextIds(Long lastId, Long batchSize) {
|
||||
public List<Long> fetchNextIds(Long lastId, Long batchSize, Long analUid) {
|
||||
// analUid로 분석 정보 조회
|
||||
MapSheetAnalEntity analEntity =
|
||||
queryFactory
|
||||
.selectFrom(mapSheetAnalEntity)
|
||||
.where(mapSheetAnalEntity.id.eq(analUid))
|
||||
.fetchOne();
|
||||
|
||||
if (Objects.isNull(analEntity)) {
|
||||
throw new EntityNotFoundException("MapSheetAnalEntity not found for analUid: " + analUid);
|
||||
}
|
||||
|
||||
return queryFactory
|
||||
.select(mapSheetAnalDataInferenceGeomEntity.geoUid)
|
||||
.from(mapSheetAnalDataInferenceGeomEntity)
|
||||
.where(
|
||||
// mapSheetAnalDataGeomEntity.pnu.isNotNull(), //TODO: Mockup 진행 이후 확인하기
|
||||
lastId == null ? null : mapSheetAnalDataInferenceGeomEntity.geoUid.gt(lastId),
|
||||
mapSheetAnalDataInferenceGeomEntity.compareYyyy.eq(2022),
|
||||
mapSheetAnalDataInferenceGeomEntity.targetYyyy.eq(2024),
|
||||
mapSheetAnalDataInferenceGeomEntity.compareYyyy.eq(analEntity.getCompareYyyy()),
|
||||
mapSheetAnalDataInferenceGeomEntity.targetYyyy.eq(analEntity.getTargetYyyy()),
|
||||
mapSheetAnalDataInferenceGeomEntity.labelState.isNull())
|
||||
.orderBy(mapSheetAnalDataInferenceGeomEntity.mapSheetNum.asc())
|
||||
.limit(batchSize)
|
||||
@@ -61,7 +70,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
}
|
||||
|
||||
@Override
|
||||
public void assignOwner(List<Long> ids, String userId) {
|
||||
public void assignOwner(List<Long> ids, String userId, Long analUid) {
|
||||
|
||||
// data_geom 테이블에 label state 를 ASSIGNED 로 update
|
||||
queryFactory
|
||||
@@ -87,7 +96,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
.setParameter(3, userId)
|
||||
.setParameter(4, LabelState.ASSIGNED.getId())
|
||||
.setParameter(5, "")
|
||||
.setParameter(6, 3)
|
||||
.setParameter(6, analUid)
|
||||
.executeUpdate();
|
||||
}
|
||||
|
||||
@@ -108,7 +117,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long findLabelUnAssignedCnt(Long analUid) {
|
||||
public Long findLabelUnAssignedCnt(Long analUid, Integer stage) {
|
||||
MapSheetAnalEntity entity =
|
||||
queryFactory
|
||||
.selectFrom(mapSheetAnalEntity)
|
||||
@@ -116,7 +125,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
.fetchOne();
|
||||
|
||||
if (Objects.isNull(entity)) {
|
||||
throw new EntityNotFoundException();
|
||||
throw new EntityNotFoundException("MapSheetAnalEntity not found for analUid: " + analUid);
|
||||
}
|
||||
|
||||
return queryFactory
|
||||
@@ -125,7 +134,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
.where(
|
||||
mapSheetAnalDataInferenceGeomEntity.compareYyyy.eq(entity.getCompareYyyy()),
|
||||
mapSheetAnalDataInferenceGeomEntity.targetYyyy.eq(entity.getTargetYyyy()),
|
||||
mapSheetAnalDataInferenceGeomEntity.stage.eq(4), // TODO: 회차 컬럼을 가져와야 할 듯?
|
||||
mapSheetAnalDataInferenceGeomEntity.stage.eq(stage),
|
||||
mapSheetAnalDataInferenceGeomEntity.labelState.isNull())
|
||||
.fetchOne();
|
||||
}
|
||||
@@ -149,7 +158,9 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
memberEntity.employeeNo,
|
||||
memberEntity.name))
|
||||
.from(memberEntity)
|
||||
.where(memberEntity.userRole.eq(role), memberEntity.status.eq("ACTIVE"))
|
||||
.where(
|
||||
memberEntity.userRole.eq(role),
|
||||
memberEntity.status.eq(com.kamco.cd.kamcoback.common.enums.StatusType.ACTIVE.getId()))
|
||||
.orderBy(memberEntity.name.asc())
|
||||
.fetch();
|
||||
}
|
||||
|
||||
@@ -4,5 +4,4 @@ import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceGeomEntit
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface LabelWorkRepository
|
||||
extends JpaRepository<MapSheetAnalDataInferenceGeomEntity, Long>,
|
||||
LabelWorkRepositoryCustom {}
|
||||
extends JpaRepository<MapSheetAnalDataInferenceGeomEntity, Long>, LabelWorkRepositoryCustom {}
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.label;
|
||||
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.UserList;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.LabelWorkMng;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import org.springframework.data.domain.Page;
|
||||
|
||||
public interface LabelWorkRepositoryCustom {
|
||||
|
||||
@@ -1,23 +1,11 @@
|
||||
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.QMapInkx5kEntity.mapInkx5kEntity;
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceEntity.mapSheetAnalDataInferenceEntity;
|
||||
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.QMapSheetMngEntity.mapSheetMngEntity;
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetMngHstEntity.mapSheetMngHstEntity;
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QMemberEntity.memberEntity;
|
||||
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.LabelState;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelAllocateDto.UserList;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto;
|
||||
import com.kamco.cd.kamcoback.label.dto.LabelWorkDto.LabelWorkMng;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.ErrorDataDto;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.LabelingAssignmentEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataGeomEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalEntity;
|
||||
import com.querydsl.core.BooleanBuilder;
|
||||
import com.querydsl.core.types.Projections;
|
||||
import com.querydsl.core.types.dsl.CaseBuilder;
|
||||
@@ -25,16 +13,9 @@ import com.querydsl.core.types.dsl.Expressions;
|
||||
import com.querydsl.core.types.dsl.StringExpression;
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityNotFoundException;
|
||||
import jakarta.persistence.PersistenceContext;
|
||||
import jakarta.validation.Valid;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
@@ -58,7 +39,6 @@ public class LabelWorkRepositoryImpl extends QuerydslRepositorySupport
|
||||
this.queryFactory = queryFactory;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Page<LabelWorkMng> labelWorkMngList(LabelWorkDto.LabelWorkMngSearchReq searchReq) {
|
||||
|
||||
@@ -72,66 +52,62 @@ public class LabelWorkRepositoryImpl extends QuerydslRepositorySupport
|
||||
whereBuilder.and(mapSheetAnalDataInferenceEntity.targetYyyy.eq(searchReq.getDetectYyyy()));
|
||||
}
|
||||
|
||||
//mapSheetAnalDataInferenceGeomEntity.dataUid.eq(mapSheetAnalDataInferenceEntity.id)
|
||||
// mapSheetAnalDataInferenceGeomEntity.dataUid.eq(mapSheetAnalDataInferenceEntity.id)
|
||||
|
||||
whereSubBuilder.and(mapSheetAnalDataInferenceGeomEntity.dataUid.eq(mapSheetAnalDataInferenceEntity.id));
|
||||
whereSubBuilder.and(
|
||||
mapSheetAnalDataInferenceGeomEntity.dataUid.eq(mapSheetAnalDataInferenceEntity.id));
|
||||
|
||||
if (searchReq.getStrtDttm() != null && ! searchReq.getStrtDttm().isEmpty()) {
|
||||
if (searchReq.getStrtDttm() != null && !searchReq.getStrtDttm().isEmpty()) {
|
||||
|
||||
whereSubBuilder.and(mapSheetAnalDataInferenceGeomEntity.labelStateDttm.isNotNull());
|
||||
|
||||
whereSubBuilder.and(
|
||||
Expressions.stringTemplate("to_char({0}, 'YYYY-MM-DD')", mapSheetAnalDataInferenceEntity.labelStateDttm)
|
||||
.gt("2024-01-01")
|
||||
);
|
||||
Expressions.stringTemplate(
|
||||
"to_char({0}, 'YYYY-MM-DD')", mapSheetAnalDataInferenceEntity.labelStateDttm)
|
||||
.gt("2024-01-01"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
List<LabelWorkMng> foundContent =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
LabelWorkMng.class,
|
||||
mapSheetAnalDataInferenceEntity.compareYyyy,
|
||||
mapSheetAnalDataInferenceEntity.targetYyyy,
|
||||
mapSheetAnalDataInferenceEntity.stage,
|
||||
mapSheetAnalDataInferenceEntity.createdDttm.min(),
|
||||
mapSheetAnalDataInferenceEntity.detectingCnt.sum(),
|
||||
mapSheetAnalDataInferenceGeomEntity.dataUid.count(),
|
||||
|
||||
new CaseBuilder()
|
||||
.when(mapSheetAnalDataInferenceGeomEntity.labelState.eq("STOP"))
|
||||
.then(1L)
|
||||
.otherwise(0L)
|
||||
.sum(),
|
||||
new CaseBuilder()
|
||||
.when(mapSheetAnalDataInferenceGeomEntity.labelState.eq("LABEL_ING"))
|
||||
.then(1L)
|
||||
.otherwise(0L)
|
||||
.sum(),
|
||||
new CaseBuilder()
|
||||
.when(mapSheetAnalDataInferenceGeomEntity.labelState.eq("LABEL_COMPLETE"))
|
||||
.then(1L)
|
||||
.otherwise(0L)
|
||||
.sum(),
|
||||
|
||||
mapSheetAnalDataInferenceGeomEntity.labelStateDttm.min()
|
||||
))
|
||||
.from(mapSheetAnalDataInferenceEntity)
|
||||
.leftJoin(mapSheetAnalDataInferenceGeomEntity)
|
||||
.on(whereSubBuilder)
|
||||
.where(whereBuilder)
|
||||
.groupBy(
|
||||
mapSheetAnalDataInferenceEntity.compareYyyy,
|
||||
mapSheetAnalDataInferenceEntity.targetYyyy,
|
||||
mapSheetAnalDataInferenceEntity.stage
|
||||
)
|
||||
.orderBy(mapSheetAnalDataInferenceEntity.targetYyyy.desc()
|
||||
,mapSheetAnalDataInferenceEntity.stage.desc())
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.fetch();
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
LabelWorkMng.class,
|
||||
mapSheetAnalDataInferenceEntity.compareYyyy,
|
||||
mapSheetAnalDataInferenceEntity.targetYyyy,
|
||||
mapSheetAnalDataInferenceEntity.stage,
|
||||
mapSheetAnalDataInferenceEntity.createdDttm.min(),
|
||||
mapSheetAnalDataInferenceEntity.detectingCnt.sum(),
|
||||
mapSheetAnalDataInferenceGeomEntity.dataUid.count(),
|
||||
new CaseBuilder()
|
||||
.when(mapSheetAnalDataInferenceGeomEntity.labelState.eq("STOP"))
|
||||
.then(1L)
|
||||
.otherwise(0L)
|
||||
.sum(),
|
||||
new CaseBuilder()
|
||||
.when(mapSheetAnalDataInferenceGeomEntity.labelState.eq("LABEL_ING"))
|
||||
.then(1L)
|
||||
.otherwise(0L)
|
||||
.sum(),
|
||||
new CaseBuilder()
|
||||
.when(mapSheetAnalDataInferenceGeomEntity.labelState.eq("LABEL_COMPLETE"))
|
||||
.then(1L)
|
||||
.otherwise(0L)
|
||||
.sum(),
|
||||
mapSheetAnalDataInferenceGeomEntity.labelStateDttm.min()))
|
||||
.from(mapSheetAnalDataInferenceEntity)
|
||||
.leftJoin(mapSheetAnalDataInferenceGeomEntity)
|
||||
.on(whereSubBuilder)
|
||||
.where(whereBuilder)
|
||||
.groupBy(
|
||||
mapSheetAnalDataInferenceEntity.compareYyyy,
|
||||
mapSheetAnalDataInferenceEntity.targetYyyy,
|
||||
mapSheetAnalDataInferenceEntity.stage)
|
||||
.orderBy(
|
||||
mapSheetAnalDataInferenceEntity.targetYyyy.desc(),
|
||||
mapSheetAnalDataInferenceEntity.stage.desc())
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.fetch();
|
||||
|
||||
/*
|
||||
Long countQuery =
|
||||
|
||||
Reference in New Issue
Block a user