From c8aab5f9fb9812ae66e74be47c209e82f2e5aa55 Mon Sep 17 00:00:00 2001 From: DanielLee <198891672+sanghyeonhd@users.noreply.github.com> Date: Fri, 16 Jan 2026 12:26:05 +0900 Subject: [PATCH 1/3] projectinfo closed BOTH ADD --- .../label/LabelAllocateApiController.java | 20 +++++++++++++++++-- .../kamcoback/label/dto/WorkerStatsDto.java | 11 +++++----- .../label/service/LabelAllocateService.java | 8 +++++++- .../label/LabelAllocateRepositoryImpl.java | 4 ++++ 4 files changed, 35 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/kamco/cd/kamcoback/label/LabelAllocateApiController.java b/src/main/java/com/kamco/cd/kamcoback/label/LabelAllocateApiController.java index 11243bb8..040c0e96 100644 --- a/src/main/java/com/kamco/cd/kamcoback/label/LabelAllocateApiController.java +++ b/src/main/java/com/kamco/cd/kamcoback/label/LabelAllocateApiController.java @@ -267,7 +267,13 @@ public class LabelAllocateApiController { value = """ {"uuid": "f97dc186-e6d3-4645-9737-3173dde8dc64", "closedType": "INSPECTION", "closedYn": "Y"} - """) + """), + @io.swagger.v3.oas.annotations.media.ExampleObject( + name = "특정 프로젝트 라벨링+검수 동시 종료", + value = + """ + {"uuid": "f97dc186-e6d3-4645-9737-3173dde8dc64", "closedType": "BOTH", "closedYn": "Y"} + """) })) @RequestBody @Valid @@ -276,7 +282,17 @@ public class LabelAllocateApiController { labelAllocateService.updateClosedYn( request.getUuid(), request.getClosedType(), request.getClosedYn()); - String typeLabel = "LABELING".equals(request.getClosedType()) ? "라벨링" : "검수"; + String typeLabel; + if ("LABELING".equals(request.getClosedType())) { + typeLabel = "라벨링"; + } else if ("INSPECTION".equals(request.getClosedType())) { + typeLabel = "검수"; + } else if ("BOTH".equals(request.getClosedType())) { + typeLabel = "라벨링 및 검수"; + } else { + typeLabel = "작업"; + } + String statusMessage = "Y".equals(request.getClosedYn()) ? typeLabel + "이(가) 종료되었습니다." diff --git a/src/main/java/com/kamco/cd/kamcoback/label/dto/WorkerStatsDto.java b/src/main/java/com/kamco/cd/kamcoback/label/dto/WorkerStatsDto.java index 75f09508..42d924d5 100644 --- a/src/main/java/com/kamco/cd/kamcoback/label/dto/WorkerStatsDto.java +++ b/src/main/java/com/kamco/cd/kamcoback/label/dto/WorkerStatsDto.java @@ -57,13 +57,14 @@ public class WorkerStatsDto { example = "f97dc186-e6d3-4645-9737-3173dde8dc64") private String uuid; - @NotBlank(message = "종료 유형은 필수입니다.") - @Pattern(regexp = "^(LABELING|INSPECTION)$", message = "종료 유형은 LABELING 또는 INSPECTION이어야 합니다.") + @Pattern( + regexp = "^(LABELING|INSPECTION|BOTH)$", + message = "종료 유형은 LABELING, INSPECTION 또는 BOTH 이어야 합니다.") @Schema( - description = "종료 유형 (LABELING: 라벨링, INSPECTION: 검수)", + description = "종료 유형 (LABELING: 라벨링만, INSPECTION: 검수만, BOTH: 라벨링+검수 동시)", example = "LABELING", - allowableValues = {"LABELING", "INSPECTION"}, - requiredMode = Schema.RequiredMode.REQUIRED) + allowableValues = {"LABELING", "INSPECTION", "BOTH"}, + requiredMode = Schema.RequiredMode.NOT_REQUIRED) private String closedType; @NotBlank(message = "종료 여부는 필수입니다.") diff --git a/src/main/java/com/kamco/cd/kamcoback/label/service/LabelAllocateService.java b/src/main/java/com/kamco/cd/kamcoback/label/service/LabelAllocateService.java index 4a8b5502..3b070eb6 100644 --- a/src/main/java/com/kamco/cd/kamcoback/label/service/LabelAllocateService.java +++ b/src/main/java/com/kamco/cd/kamcoback/label/service/LabelAllocateService.java @@ -234,13 +234,19 @@ public class LabelAllocateService { * 프로젝트 종료 여부 업데이트 * * @param uuid 프로젝트 UUID (선택, 미입력 시 최신 프로젝트 대상) - * @param closedType 종료 유형 (LABELING/INSPECTION) + * @param closedType 종료 유형 (LABELING/INSPECTION/BOTH) * @param closedYn 종료 여부 (Y/N) */ @Transactional public void updateClosedYn(String uuid, String closedType, String closedYn) { String targetUuid = uuid; + // closedType 유효성 검증 + if (closedType == null || closedType.isBlank()) { + throw new IllegalArgumentException( + "종료 유형(closedType)은 필수입니다. (LABELING, INSPECTION, BOTH 중 하나)"); + } + // uuid가 없으면 최신 프로젝트 uuid 조회 if (targetUuid == null || targetUuid.isBlank()) { var latestProjectInfo = labelAllocateCoreService.findLatestProjectInfo(); diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/label/LabelAllocateRepositoryImpl.java b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/label/LabelAllocateRepositoryImpl.java index e3ec3ff6..a4015c2f 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/label/LabelAllocateRepositoryImpl.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/label/LabelAllocateRepositoryImpl.java @@ -1553,6 +1553,10 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto updateQuery.set(mapSheetAnalInferenceEntity.labelingClosedYn, closedYn); } else if ("INSPECTION".equals(closedType)) { updateQuery.set(mapSheetAnalInferenceEntity.inspectionClosedYn, closedYn); + } else if ("BOTH".equals(closedType)) { + updateQuery + .set(mapSheetAnalInferenceEntity.labelingClosedYn, closedYn) + .set(mapSheetAnalInferenceEntity.inspectionClosedYn, closedYn); } updateQuery From 520d1f975d3a2759c4fdfaf873838e8c14e57dd5 Mon Sep 17 00:00:00 2001 From: teddy Date: Fri, 16 Jan 2026 12:31:24 +0900 Subject: [PATCH 2/3] =?UTF-8?q?spotless=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InferenceResultRepositoryImpl.java | 143 +++++++++--------- 1 file changed, 73 insertions(+), 70 deletions(-) diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/InferenceResultRepositoryImpl.java b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/InferenceResultRepositoryImpl.java index 1e6bcc15..a3a5d350 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/InferenceResultRepositoryImpl.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/InferenceResultRepositoryImpl.java @@ -19,15 +19,19 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC private final EntityManager em; private final QMapSheetAnalInferenceEntity inferenceEntity = - QMapSheetAnalInferenceEntity.mapSheetAnalInferenceEntity; + QMapSheetAnalInferenceEntity.mapSheetAnalInferenceEntity; - /** tb_map_sheet_anal_data_inference */ + /** + * tb_map_sheet_anal_data_inference + */ private final QMapSheetAnalDataInferenceEntity inferenceDataEntity = - QMapSheetAnalDataInferenceEntity.mapSheetAnalDataInferenceEntity; + QMapSheetAnalDataInferenceEntity.mapSheetAnalDataInferenceEntity; - /** tb_map_sheet_anal_data_inference_geom */ + /** + * tb_map_sheet_anal_data_inference_geom + */ private final QMapSheetAnalDataInferenceGeomEntity inferenceGeomEntity = - QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity; + QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity; // =============================== // Upsert (Native only) @@ -36,7 +40,7 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC @Override public Long upsertGroupsFromMapSheetAnal(Long id) { String sql = - """ + """ INSERT INTO tb_map_sheet_anal_inference ( stage, compare_yyyy, @@ -77,8 +81,7 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC } /** - * inference_results 테이블을 기준으로 분석 데이터 단위(stage, compare_yyyy, target_yyyy, map_sheet_num)를 - * 생성/갱신한다. + * inference_results 테이블을 기준으로 분석 데이터 단위(stage, compare_yyyy, target_yyyy, map_sheet_num)를 생성/갱신한다. * *

- 최초 생성 시 file_created_yn = false - detecting_cnt는 inference_results 건수 기준 * @@ -88,7 +91,7 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC public void upsertGroupsFromInferenceResults(Long analId) { String sql = - """ + """ INSERT INTO tb_map_sheet_anal_data_inference ( anal_uid, compare_yyyy, @@ -144,7 +147,7 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC public void upsertGeomsFromInferenceResults(Long analUid) { String sql = - """ + """ INSERT INTO tb_map_sheet_anal_data_inference_geom ( result_uid, stage, @@ -184,9 +187,9 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC SELECT r.uid AS result_uid, msadi.stage, - r.cd_prob, - r.input1 AS compare_yyyy, - r.input2 AS target_yyyy, + r.after_p as cd_prob, + msl.compare_yyyy, + msl.target_yyyy, CASE WHEN r.map_id ~ '^[0-9]+$' THEN r.map_id::bigint ELSE NULL @@ -239,7 +242,7 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC public void upsertSttcFromInferenceResults(Long analUid) { String sql = - """ + """ INSERT INTO tb_map_sheet_anal_sttc ( compare_yyyy @@ -324,22 +327,22 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC public List findPendingDataUids(int limit, Long learnId) { return queryFactory - .select(inferenceDataEntity.id) - .from(inferenceEntity) - .innerJoin(inferenceDataEntity) - .on(inferenceEntity.id.eq(inferenceDataEntity.analUid)) - .where( - inferenceEntity - .learnId - .eq(learnId) - .and( - inferenceDataEntity - .fileCreatedYn - .isFalse() - .or(inferenceDataEntity.fileCreatedYn.isNull()))) - .orderBy(inferenceDataEntity.id.asc()) - .limit(limit) - .fetch(); + .select(inferenceDataEntity.id) + .from(inferenceEntity) + .innerJoin(inferenceDataEntity) + .on(inferenceEntity.id.eq(inferenceDataEntity.analUid)) + .where( + inferenceEntity + .learnId + .eq(learnId) + .and( + inferenceDataEntity + .fileCreatedYn + .isFalse() + .or(inferenceDataEntity.fileCreatedYn.isNull()))) + .orderBy(inferenceDataEntity.id.asc()) + .limit(limit) + .fetch(); } // =============================== @@ -358,13 +361,13 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC ZonedDateTime now = ZonedDateTime.now(); return (int) - queryFactory - .update(inferenceDataEntity) - .set(inferenceDataEntity.fileCreatedYn, false) - .set(inferenceDataEntity.fileCreatedDttm, (ZonedDateTime) null) - .set(inferenceDataEntity.updatedDttm, now) - .where(inferenceDataEntity.id.eq(dataUid)) - .execute(); + queryFactory + .update(inferenceDataEntity) + .set(inferenceDataEntity.fileCreatedYn, false) + .set(inferenceDataEntity.fileCreatedDttm, (ZonedDateTime) null) + .set(inferenceDataEntity.updatedDttm, now) + .where(inferenceDataEntity.id.eq(dataUid)) + .execute(); } /** @@ -377,13 +380,13 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC ZonedDateTime now = ZonedDateTime.now(); return (int) - queryFactory - .update(inferenceDataEntity) - .set(inferenceDataEntity.fileCreatedYn, true) - .set(inferenceDataEntity.fileCreatedDttm, now) - .set(inferenceDataEntity.updatedDttm, now) - .where(inferenceDataEntity.id.eq(dataUid)) - .execute(); + queryFactory + .update(inferenceDataEntity) + .set(inferenceDataEntity.fileCreatedYn, true) + .set(inferenceDataEntity.fileCreatedDttm, now) + .set(inferenceDataEntity.updatedDttm, now) + .where(inferenceDataEntity.id.eq(dataUid)) + .execute(); } /** @@ -396,13 +399,13 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC ZonedDateTime now = ZonedDateTime.now(); return (int) - queryFactory - .update(inferenceGeomEntity) - .set(inferenceGeomEntity.fileCreatedYn, false) - .set(inferenceGeomEntity.fileCreatedDttm, (ZonedDateTime) null) - .set(inferenceGeomEntity.updatedDttm, now) - .where(inferenceGeomEntity.dataUid.eq(dataUid)) - .execute(); + queryFactory + .update(inferenceGeomEntity) + .set(inferenceGeomEntity.fileCreatedYn, false) + .set(inferenceGeomEntity.fileCreatedDttm, (ZonedDateTime) null) + .set(inferenceGeomEntity.updatedDttm, now) + .where(inferenceGeomEntity.dataUid.eq(dataUid)) + .execute(); } /** @@ -420,13 +423,13 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC ZonedDateTime now = ZonedDateTime.now(); return (int) - queryFactory - .update(inferenceGeomEntity) - .set(inferenceGeomEntity.fileCreatedYn, true) - .set(inferenceGeomEntity.fileCreatedDttm, now) - .set(inferenceGeomEntity.updatedDttm, now) - .where(inferenceGeomEntity.geoUid.in(geoUids)) - .execute(); + queryFactory + .update(inferenceGeomEntity) + .set(inferenceGeomEntity.fileCreatedYn, true) + .set(inferenceGeomEntity.fileCreatedDttm, now) + .set(inferenceGeomEntity.updatedDttm, now) + .where(inferenceGeomEntity.geoUid.in(geoUids)) + .execute(); } // =============================== @@ -440,18 +443,18 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC */ @Override public List findGeomEntitiesByDataUid( - Long dataUid, int limit) { + Long dataUid, int limit) { return queryFactory - .selectFrom(inferenceGeomEntity) - .where( - inferenceGeomEntity.dataUid.eq(dataUid), - inferenceGeomEntity.geom.isNotNull(), - inferenceGeomEntity - .fileCreatedYn - .isFalse() - .or(inferenceGeomEntity.fileCreatedYn.isNull())) - .orderBy(inferenceGeomEntity.geoUid.asc()) - .limit(limit) - .fetch(); + .selectFrom(inferenceGeomEntity) + .where( + inferenceGeomEntity.dataUid.eq(dataUid), + inferenceGeomEntity.geom.isNotNull(), + inferenceGeomEntity + .fileCreatedYn + .isFalse() + .or(inferenceGeomEntity.fileCreatedYn.isNull())) + .orderBy(inferenceGeomEntity.geoUid.asc()) + .limit(limit) + .fetch(); } } From 1acadc462667e25704882f0493df893c7d612642 Mon Sep 17 00:00:00 2001 From: teddy Date: Fri, 16 Jan 2026 12:37:12 +0900 Subject: [PATCH 3/3] =?UTF-8?q?spotless=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/Inference/InferenceResultRepositoryImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/InferenceResultRepositoryImpl.java b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/InferenceResultRepositoryImpl.java index 9b623183..755bf60e 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/InferenceResultRepositoryImpl.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/InferenceResultRepositoryImpl.java @@ -184,9 +184,9 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC SELECT r.uid AS result_uid, msadi.stage, - r.cd_prob, - r.input1 AS compare_yyyy, - r.input2 AS target_yyyy, + r.after_p as cd_prob, + msl.compare_yyyy, + msl.target_yyyy, CASE WHEN r.map_id ~ '^[0-9]+$' THEN r.map_id::bigint ELSE NULL