Merge pull request 'feat/infer_dev_260107' (#284) from feat/infer_dev_260107 into develop
Reviewed-on: https://kamco.gitea.gs.dabeeo.com/dabeeo/kamco-dabeeo-backoffice/pulls/284
This commit is contained in:
@@ -123,7 +123,7 @@ public class LabelAllocateApiController {
|
||||
int targetYyyy = Integer.parseInt(dto.getYyyy().split("-")[1]);
|
||||
return ApiResponseDto.okObject(
|
||||
labelAllocateService.allocateAsc(
|
||||
dto.getStage(), dto.getLabelers(), dto.getInspectors(), compareYyyy, targetYyyy));
|
||||
dto.getUuid(), dto.getLabelers(), dto.getInspectors(), compareYyyy, targetYyyy));
|
||||
}
|
||||
|
||||
@Operation(summary = "작업현황 관리 > 변화탐지 회차 정보", description = "작업현황 관리 > 변화탐지 회차 정보")
|
||||
|
||||
@@ -86,6 +86,12 @@ public class LabelAllocateDto {
|
||||
@AllArgsConstructor
|
||||
public static class AllocateDto {
|
||||
|
||||
@Schema(
|
||||
description = "회차 마스터 key",
|
||||
example = "f97dc186-e6d3-4645-9737-3173dde8dc64",
|
||||
required = true)
|
||||
private UUID uuid;
|
||||
|
||||
@Schema(description = "비교년도-기준년도", example = "2022-2024", required = true)
|
||||
private String yyyy;
|
||||
|
||||
@@ -95,7 +101,7 @@ public class LabelAllocateDto {
|
||||
// @Schema(description = "기준년도", example = "2024", required = true)
|
||||
// private Integer targetYyyy;
|
||||
|
||||
@Schema(description = "회차", example = "4", required = true)
|
||||
@Schema(description = "회차", example = "4")
|
||||
private Integer stage;
|
||||
|
||||
@Schema(
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.kamco.cd.kamcoback.label.dto.WorkerStatsDto.WorkerListResponse;
|
||||
import com.kamco.cd.kamcoback.postgres.core.LabelAllocateCoreService;
|
||||
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.stereotype.Service;
|
||||
@@ -37,13 +38,13 @@ public class LabelAllocateService {
|
||||
/**
|
||||
* 도엽 기준 asc sorting 해서 할당 수만큼 배정하는 로직
|
||||
*
|
||||
* @param stage 회차
|
||||
* @param uuid 회차 key
|
||||
* @param targetUsers 라벨러 목록
|
||||
* @param targetInspectors 검수자 목록
|
||||
*/
|
||||
@Transactional
|
||||
public ApiResponseDto.ResponseObj allocateAsc(
|
||||
Integer stage,
|
||||
UUID uuid,
|
||||
List<TargetUser> targetUsers,
|
||||
List<String> targetInspectors,
|
||||
Integer compareYyyy,
|
||||
@@ -51,8 +52,7 @@ public class LabelAllocateService {
|
||||
Long lastId = null;
|
||||
|
||||
// geom 잔여건수 조회
|
||||
Long chargeCnt =
|
||||
labelAllocateCoreService.findLabelUnAssignedCnt(stage, compareYyyy, targetYyyy);
|
||||
Long chargeCnt = labelAllocateCoreService.findLabelUnAssignedCnt(uuid);
|
||||
if (chargeCnt <= 0) {
|
||||
return new ApiResponseDto.ResponseObj(ApiResponseCode.DUPLICATE_DATA, "이미 배정완료된 회차 입니다.");
|
||||
}
|
||||
@@ -63,12 +63,10 @@ public class LabelAllocateService {
|
||||
ApiResponseCode.BAD_REQUEST, "총 잔여건수와 요청 값의 합계가 맞지 않습니다.");
|
||||
}
|
||||
|
||||
List<AllocateInfoDto> allIds =
|
||||
labelAllocateCoreService.fetchNextIds(lastId, chargeCnt, compareYyyy, targetYyyy, stage);
|
||||
List<AllocateInfoDto> allIds = labelAllocateCoreService.fetchNextIds(lastId, chargeCnt, uuid);
|
||||
|
||||
// MapSheetAnalInferenceEntity analUid 가져오기
|
||||
Long analUid =
|
||||
labelAllocateCoreService.findMapSheetAnalInferenceUid(compareYyyy, targetYyyy, stage);
|
||||
Long analUid = labelAllocateCoreService.findMapSheetAnalInferenceUid(uuid);
|
||||
|
||||
int index = 0;
|
||||
for (TargetUser target : targetUsers) {
|
||||
|
||||
@@ -350,7 +350,8 @@ public class MapSheetMngService {
|
||||
List<MngDto> mngList = mapSheetMngCoreService.findMapSheetMngList();
|
||||
List<MngYyyyDto> yearList =
|
||||
mngList.stream()
|
||||
.filter(dto -> "DONE".equals(dto.getMngState()))
|
||||
.filter(
|
||||
dto -> "DONE".equals(dto.getMngState()) || "TAKINGERROR".equals(dto.getMngState()))
|
||||
.map(dto -> new MngYyyyDto(dto.getMngYyyy(), dto.getMngPath()))
|
||||
.toList();
|
||||
|
||||
|
||||
@@ -27,9 +27,8 @@ public class LabelAllocateCoreService {
|
||||
|
||||
private final LabelAllocateRepository labelAllocateRepository;
|
||||
|
||||
public List<AllocateInfoDto> fetchNextIds(
|
||||
Long lastId, Long batchSize, Integer compareYyyy, Integer targetYyyy, Integer stage) {
|
||||
return labelAllocateRepository.fetchNextIds(lastId, batchSize, compareYyyy, targetYyyy, stage);
|
||||
public List<AllocateInfoDto> fetchNextIds(Long lastId, Long batchSize, UUID uuid) {
|
||||
return labelAllocateRepository.fetchNextIds(lastId, batchSize, uuid);
|
||||
}
|
||||
|
||||
public void assignOwner(List<AllocateInfoDto> ids, String userId, Long analUid) {
|
||||
@@ -42,8 +41,8 @@ public class LabelAllocateCoreService {
|
||||
.toList();
|
||||
}
|
||||
|
||||
public Long findLabelUnAssignedCnt(Integer stage, Integer compareYyyy, Integer targetYyyy) {
|
||||
return labelAllocateRepository.findLabelUnAssignedCnt(stage, compareYyyy, targetYyyy);
|
||||
public Long findLabelUnAssignedCnt(UUID uuid) {
|
||||
return labelAllocateRepository.findLabelUnAssignedCnt(uuid);
|
||||
}
|
||||
|
||||
public void assignInspector(UUID assignmentUid, String inspectorUid) {
|
||||
@@ -144,8 +143,8 @@ public class LabelAllocateCoreService {
|
||||
return detail;
|
||||
}
|
||||
|
||||
public Long findMapSheetAnalInferenceUid(Integer compareYyyy, Integer targetYyyy, Integer stage) {
|
||||
return labelAllocateRepository.findMapSheetAnalInferenceUid(compareYyyy, targetYyyy, stage);
|
||||
public Long findMapSheetAnalInferenceUid(UUID uuid) {
|
||||
return labelAllocateRepository.findMapSheetAnalInferenceUid(uuid);
|
||||
}
|
||||
|
||||
public void insertInspector(Long analUid, String inspector) {
|
||||
|
||||
@@ -20,14 +20,13 @@ import org.springframework.data.domain.Page;
|
||||
|
||||
public interface LabelAllocateRepositoryCustom {
|
||||
|
||||
List<AllocateInfoDto> fetchNextIds(
|
||||
Long lastId, Long batchSize, Integer compareYyyy, Integer targetYyyy, Integer stage);
|
||||
List<AllocateInfoDto> fetchNextIds(Long lastId, Long batchSize, UUID uuid);
|
||||
|
||||
void assignOwner(List<AllocateInfoDto> ids, String userId, Long analUid);
|
||||
|
||||
List<LabelingAssignmentEntity> findAssignedLabelerList(Long analUid);
|
||||
|
||||
Long findLabelUnAssignedCnt(Integer stage, Integer compareYyyy, Integer targetYyyy);
|
||||
Long findLabelUnAssignedCnt(UUID uuid);
|
||||
|
||||
void assignInspector(UUID assignmentUid, String userId);
|
||||
|
||||
@@ -74,7 +73,7 @@ public interface LabelAllocateRepositoryCustom {
|
||||
/** UUID로 analUid 조회 */
|
||||
Long findAnalUidByUuid(String uuid);
|
||||
|
||||
Long findMapSheetAnalInferenceUid(Integer compareYyyy, Integer targetYyyy, Integer stage);
|
||||
Long findMapSheetAnalInferenceUid(UUID uuid);
|
||||
|
||||
void insertInspector(Long analUid, String inspector);
|
||||
|
||||
|
||||
@@ -66,8 +66,7 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
@PersistenceContext private EntityManager em;
|
||||
|
||||
@Override
|
||||
public List<AllocateInfoDto> fetchNextIds(
|
||||
Long lastId, Long batchSize, Integer compareYyyy, Integer targetYyyy, Integer stage) {
|
||||
public List<AllocateInfoDto> fetchNextIds(Long lastId, Long batchSize, UUID uuid) {
|
||||
|
||||
return queryFactory
|
||||
.select(
|
||||
@@ -76,14 +75,17 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
mapSheetAnalDataInferenceGeomEntity.geoUid,
|
||||
mapSheetAnalDataInferenceGeomEntity.mapSheetNum,
|
||||
mapSheetAnalDataInferenceGeomEntity.pnu))
|
||||
.from(mapSheetAnalDataInferenceGeomEntity)
|
||||
.where(
|
||||
lastId == null ? null : mapSheetAnalDataInferenceGeomEntity.geoUid.gt(lastId),
|
||||
.from(mapSheetAnalInferenceEntity)
|
||||
.innerJoin(mapSheetAnalDataInferenceEntity)
|
||||
.on(mapSheetAnalInferenceEntity.id.eq(mapSheetAnalDataInferenceEntity.analUid))
|
||||
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
|
||||
.on(
|
||||
mapSheetAnalDataInferenceEntity.id.eq(mapSheetAnalDataInferenceGeomEntity.dataUid),
|
||||
mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull(),
|
||||
mapSheetAnalDataInferenceGeomEntity.compareYyyy.eq(compareYyyy),
|
||||
mapSheetAnalDataInferenceGeomEntity.targetYyyy.eq(targetYyyy),
|
||||
mapSheetAnalDataInferenceGeomEntity.stage.eq(stage),
|
||||
mapSheetAnalDataInferenceGeomEntity.labelState.isNull())
|
||||
.where(
|
||||
mapSheetAnalInferenceEntity.uuid.eq(uuid),
|
||||
lastId == null ? null : mapSheetAnalDataInferenceGeomEntity.geoUid.gt(lastId))
|
||||
.orderBy(mapSheetAnalDataInferenceGeomEntity.mapSheetNum.asc())
|
||||
.limit(batchSize)
|
||||
.fetch();
|
||||
@@ -177,17 +179,19 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long findLabelUnAssignedCnt(Integer stage, Integer compareYyyy, Integer targetYyyy) {
|
||||
public Long findLabelUnAssignedCnt(UUID uuid) {
|
||||
|
||||
return queryFactory
|
||||
.select(mapSheetAnalDataInferenceGeomEntity.geoUid.count())
|
||||
.from(mapSheetAnalDataInferenceGeomEntity)
|
||||
.where(
|
||||
.from(mapSheetAnalInferenceEntity)
|
||||
.innerJoin(mapSheetAnalDataInferenceEntity)
|
||||
.on(mapSheetAnalInferenceEntity.id.eq(mapSheetAnalDataInferenceEntity.analUid))
|
||||
.innerJoin(mapSheetAnalDataInferenceGeomEntity)
|
||||
.on(
|
||||
mapSheetAnalDataInferenceEntity.id.eq(mapSheetAnalDataInferenceGeomEntity.dataUid),
|
||||
mapSheetAnalDataInferenceGeomEntity.pnu.isNotNull(),
|
||||
mapSheetAnalDataInferenceGeomEntity.compareYyyy.eq(compareYyyy),
|
||||
mapSheetAnalDataInferenceGeomEntity.targetYyyy.eq(targetYyyy),
|
||||
mapSheetAnalDataInferenceGeomEntity.stage.eq(stage),
|
||||
mapSheetAnalDataInferenceGeomEntity.labelState.isNull())
|
||||
.where(mapSheetAnalInferenceEntity.uuid.eq(uuid))
|
||||
.fetchOne();
|
||||
}
|
||||
|
||||
@@ -912,14 +916,11 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long findMapSheetAnalInferenceUid(Integer compareYyyy, Integer targetYyyy, Integer stage) {
|
||||
public Long findMapSheetAnalInferenceUid(UUID uuid) {
|
||||
return queryFactory
|
||||
.select(mapSheetAnalInferenceEntity.id)
|
||||
.from(mapSheetAnalInferenceEntity)
|
||||
.where(
|
||||
mapSheetAnalInferenceEntity.compareYyyy.eq(compareYyyy),
|
||||
mapSheetAnalInferenceEntity.targetYyyy.eq(targetYyyy),
|
||||
mapSheetAnalInferenceEntity.stage.eq(stage))
|
||||
.where(mapSheetAnalInferenceEntity.uuid.eq(uuid))
|
||||
.fetchOne();
|
||||
}
|
||||
|
||||
|
||||
@@ -138,7 +138,9 @@ public class LabelWorkRepositoryImpl implements LabelWorkRepositoryCustom {
|
||||
mapSheetAnalDataInferenceGeomEntity
|
||||
.pnu
|
||||
.isNotNull()
|
||||
.and(mapSheetAnalDataInferenceGeomEntity.pnu.ne(0L))
|
||||
.and(
|
||||
mapSheetAnalDataInferenceGeomEntity.pnu
|
||||
.isNotNull()) // TODO: 이노팸 연동 후 0 이상이라고 해야할 듯
|
||||
.and(mapSheetAnalDataInferenceGeomEntity.passYn.eq(Boolean.FALSE)))
|
||||
.then(1L)
|
||||
.otherwise(0L)
|
||||
|
||||
@@ -18,7 +18,7 @@ public class MapSheetMngFileJobController {
|
||||
@Getter private int mngSyncPageSize = 20;
|
||||
|
||||
// 파일싱크 진행여부 확인하기
|
||||
@Scheduled(fixedDelay = 1000 * 10)
|
||||
@Scheduled(fixedDelay = 1000 * 30)
|
||||
public void checkMngFileSync() {
|
||||
if (!isSchedulerEnabled) return;
|
||||
|
||||
|
||||
@@ -53,8 +53,8 @@ public class MapSheetInferenceJobService {
|
||||
@Value("${inference.jar-path}")
|
||||
private String jarPath;
|
||||
|
||||
/** 추론 진행 배치 1분 */
|
||||
@Scheduled(fixedDelay = 60_000)
|
||||
/** 추론 진행 배치 1분 60_000 */
|
||||
@Scheduled(fixedDelay = 30_000)
|
||||
public void runBatch() {
|
||||
if (isLocalProfile()) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user