From 7210af0d7fdcbec663aa2e5b9eed630aac414a91 Mon Sep 17 00:00:00 2001 From: JongBin Noh <95959567+begong313@users.noreply.github.com> Date: Mon, 27 May 2024 03:39:29 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix=20:=20=EC=83=81=ED=98=B8=EC=9E=91?= =?UTF-8?q?=EC=9A=A9=EB=8B=A8=EA=B3=84=20=EB=A7=89=EC=95=84=EB=86=93?= =?UTF-8?q?=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/controller/GuardianController.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/server/src/main/java/com/capstone/server/controller/GuardianController.java b/server/src/main/java/com/capstone/server/controller/GuardianController.java index e64ddb1909..8f756353b3 100644 --- a/server/src/main/java/com/capstone/server/controller/GuardianController.java +++ b/server/src/main/java/com/capstone/server/controller/GuardianController.java @@ -1,9 +1,11 @@ package com.capstone.server.controller; +import com.capstone.server.code.ErrorCode; import com.capstone.server.dto.KafkaDto; import com.capstone.server.dto.SearchRequestDto; import com.capstone.server.dto.detection.DetectionResultDto; import com.capstone.server.dto.guardian.BetweenRequestDto; +import com.capstone.server.exception.CustomException; import com.capstone.server.model.enums.SearchResultSortBy; import com.capstone.server.model.enums.Step; import com.capstone.server.response.SuccessResponse; @@ -79,10 +81,10 @@ public ResponseEntity uploadBetweenResult( @RequestBody BetweenRequestDto betweenRequestDto) { Long id = encryptionService.extractIdFromToken(authorization); // between 단계가 아니면 요청을 보낼 수 없음. 현재 테스트를 위해 빼놓은 상태 -// Step step = guardianService.getStep(id).getStep(); -// if (step.equals(Step.fromValue("between"))) { -// throw new CustomException(ErrorCode.BAD_REQUEST, "invalid step", "can't request step"); -// } + Step stepCheck = missingPeopleService.getStep(id, false).getStep(); + if (stepCheck.equals(Step.fromValue("between"))) { + throw new CustomException(ErrorCode.BAD_REQUEST, "invalid step", "can't request step"); + } //상화작용 단계 결과 db저장 guardianService.postBetween(id, betweenRequestDto); @@ -93,8 +95,8 @@ public ResponseEntity uploadBetweenResult( //2차탐색 시작 KafkaDto kafkaDto = KafkaDto.toKafkaDto(id, betweenRequestDto, searchId); - kafkaProducerService.startCallSecondDetectApiToKafka(kafkaDto); - + kafkaProducerService.startCallSecondDetectApiToKafka(kafkaDto); + //사진을 업로드하면 바로 2차탐색하게 구현하기 return ResponseEntity.ok().body(new SuccessResponse("success")); } From 92e9460fe778c5d7985b80e17f6e66ea29eaa25c Mon Sep 17 00:00:00 2001 From: JongBin Noh <95959567+begong313@users.noreply.github.com> Date: Mon, 27 May 2024 04:11:16 +0900 Subject: [PATCH 2/2] =?UTF-8?q?Fix=20:=20=EB=B2=84=EA=B7=B8=EC=88=98?= =?UTF-8?q?=EC=A0=95=20=EB=B0=8F=20=EB=B6=88=ED=95=84=EC=9A=94=ED=95=9C=20?= =?UTF-8?q?=EC=97=90=EB=9F=AC=EC=BD=94=EB=93=9C=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/capstone/server/controller/GuardianController.java | 2 +- .../main/java/com/capstone/server/service/GuardianService.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/com/capstone/server/controller/GuardianController.java b/server/src/main/java/com/capstone/server/controller/GuardianController.java index 8f756353b3..dcc1abf933 100644 --- a/server/src/main/java/com/capstone/server/controller/GuardianController.java +++ b/server/src/main/java/com/capstone/server/controller/GuardianController.java @@ -82,7 +82,7 @@ public ResponseEntity uploadBetweenResult( Long id = encryptionService.extractIdFromToken(authorization); // between 단계가 아니면 요청을 보낼 수 없음. 현재 테스트를 위해 빼놓은 상태 Step stepCheck = missingPeopleService.getStep(id, false).getStep(); - if (stepCheck.equals(Step.fromValue("between"))) { + if (!stepCheck.equals(Step.fromValue("between"))) { throw new CustomException(ErrorCode.BAD_REQUEST, "invalid step", "can't request step"); } //상화작용 단계 결과 db저장 diff --git a/server/src/main/java/com/capstone/server/service/GuardianService.java b/server/src/main/java/com/capstone/server/service/GuardianService.java index 88fc221458..c75e68dbdc 100644 --- a/server/src/main/java/com/capstone/server/service/GuardianService.java +++ b/server/src/main/java/com/capstone/server/service/GuardianService.java @@ -40,7 +40,7 @@ public MissingPeopleForGuardianDto getMissingPeople(Long id) { public void postBetween(Long id, BetweenRequestDto betweenRequestDto) { try { MissingPeopleEntity missingPeopleEntity = missingPeopleRepository.findById(id) - .orElseThrow(() -> new NoSuchElementException("Missing person not found with ID: " + id)); + .orElseThrow(() -> new NoSuchElementException("Missing person not found with ID " )); SearchResultEntity searchResultEntity = null; for (Long resultId : betweenRequestDto.getResultIds()) { //TODO : 반복문을 돌며 저장해 db호출이 너무많음. //유효성검사도 더 해야될듯 searchResultEntity = searchResultRepository.findById(resultId)