Skip to content

Commit

Permalink
Merge pull request #283 from kookmin-sw/BugFix/279
Browse files Browse the repository at this point in the history
fix : 상호작용단계 막아놓기
  • Loading branch information
ancy0 authored May 26, 2024
2 parents c2b453f + 92e9460 commit 35f6c4e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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);

Expand All @@ -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"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 35f6c4e

Please sign in to comment.