diff --git a/src/main/java/FITPET/dev/controller/ComparisonController.java b/src/main/java/FITPET/dev/controller/ComparisonController.java index 9433b81..7ad9f5d 100644 --- a/src/main/java/FITPET/dev/controller/ComparisonController.java +++ b/src/main/java/FITPET/dev/controller/ComparisonController.java @@ -8,15 +8,9 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.HttpServletResponse; -import java.util.List; import lombok.AllArgsConstructor; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; @Tag(name = "견적서 API") @RestController @@ -88,49 +82,6 @@ public ApiResponse patchPetInfoStatus( } - @GetMapping("/comparison") - @Operation(summary = "견적 요청 화면을 리다이렉트하는 API", description = "사용자의 기본 정보를 파라미터로 넘긴 후, 견적서 생성 화면으로 리다이렉트한다") - public ResponseEntity getComparisonView( - @RequestParam(value = "petName") String petName, - @RequestParam(value = "petType") String petType, - @RequestParam(value = "petSpecies") String petSpecies, - @RequestParam(value = "petAge") String petAge, - @RequestParam(value = "phoneNumber") String phoneNumber, - @RequestParam(value = "referSite", required = false) String referSite, - @RequestParam(value = "referUserId", required = false) String referUserId, - HttpServletResponse response - ) throws IOException { - - Map params = new HashMap<>(); - params.put("petName", String.valueOf(petName)); - params.put("petType", String.valueOf(petType)); - params.put("petSpecies", String.valueOf(petSpecies)); - params.put("petAge", String.valueOf(petAge)); - params.put("phoneNumber", String.valueOf(phoneNumber)); - params.put("referSite", String.valueOf(referSite)); - params.put("referUserId", String.valueOf(referUserId)); - - // redirect할 url 생성 - String redirectUrl = comparisonService.makeRedirectUrl(params); - - response.sendRedirect(redirectUrl); - return ResponseEntity.status(HttpStatus.FOUND).build(); - } - -// @GetMapping("/comparison/form") -// @Operation(summary = "견적 요청 화면을 조회하는 API", description = "사용자의 기본 정보를 파라미터로 넘긴 후, 견적서 생성 화면을 조회한다") -// public ApiResponse getComparisonForm( -// @RequestParam(value = "petName") String petName, -// @RequestParam(value = "petType") String petType, -// @RequestParam(value = "petSpecies") String petSpecies, -// @RequestParam(value = "petAge") String petAge, -// @RequestParam(value = "phoneNumber") String phoneNumber, -// @RequestParam(value = "referSite", required = false) String referSite, -// @RequestParam(value = "referUserId", required = false) String referUserId -// ){ -// return ApiResponse.SuccessResponse(SuccessStatus.GET_COMPARISON_VIEW); -// } - @DeleteMapping("/admin/comparison/{comparisonId}") @Operation(summary = "견적 요청 삭제 API", description = "특정 견적 요청 정보를 삭제") public ApiResponse deleteComparison( diff --git a/src/main/java/FITPET/dev/converter/ComparisonConverter.java b/src/main/java/FITPET/dev/converter/ComparisonConverter.java index f981965..51cbc25 100644 --- a/src/main/java/FITPET/dev/converter/ComparisonConverter.java +++ b/src/main/java/FITPET/dev/converter/ComparisonConverter.java @@ -63,7 +63,7 @@ public static ComparisonResponse.ComparisonDto toComparisonDto(Comparison compar .petType(pet.getPetType().toString()) .petSpecies(pet.getPetSpecies()) .comment(comparison.getComment()) - .status(comparison.getStatus().getLabel()) + .status(comparison.getStatus().toString()) .referSite(referSite) .referUserId(comparison.getReferUserId()) .build(); diff --git a/src/main/java/FITPET/dev/service/ComparisonService.java b/src/main/java/FITPET/dev/service/ComparisonService.java index 8ea18f1..d9a4e7d 100644 --- a/src/main/java/FITPET/dev/service/ComparisonService.java +++ b/src/main/java/FITPET/dev/service/ComparisonService.java @@ -1,7 +1,6 @@ package FITPET.dev.service; import FITPET.dev.common.enums.ComparisonStatus; -import FITPET.dev.common.enums.PetType; import FITPET.dev.common.status.ErrorStatus; import FITPET.dev.common.exception.GeneralException; import FITPET.dev.common.utils.ApachePdfUtils; @@ -13,7 +12,6 @@ import FITPET.dev.dto.response.ComparisonResponse; import FITPET.dev.dto.response.InsuranceResponse; import FITPET.dev.entity.Comparison; -import FITPET.dev.entity.Insurance; import FITPET.dev.entity.Pet; import FITPET.dev.entity.PetInfo; import FITPET.dev.entity.ReferSite; @@ -22,19 +20,13 @@ import FITPET.dev.repository.PetRepository; import FITPET.dev.repository.ReferSiteRepository; -import java.io.UnsupportedEncodingException; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLEncoder; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.time.format.DateTimeParseException; import java.util.List; -import java.util.Map; import java.util.regex.Pattern; import jakarta.servlet.http.HttpServletResponse; -import java.util.stream.Collectors; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; @@ -228,33 +220,6 @@ public void deleteComparison(Long comparisonId) { } - - /* - * redirect url 생성 - * @param params - * @return - * @throws UnsupportedEncodingException - * @throws MalformedURLException - */ - public String makeRedirectUrl(Map params) throws UnsupportedEncodingException, MalformedURLException { - - // TODO: 배포 후 domain 수정 - String endpoint = "http://localhost:8080/api/v1/comparison/form"; - StringBuilder urlBuilder = new StringBuilder(endpoint); - urlBuilder.append("?"); - - for (Map.Entry entry : params.entrySet()) { - urlBuilder.append(URLEncoder.encode(entry.getKey(), "UTF-8")) - .append("=") - .append(URLEncoder.encode(entry.getValue(), "UTF-8")) - .append("&"); - } - - URL url = new URL(urlBuilder.toString()); - return url.toString(); - } - - private Comparison findComparisonById(Long comparisonId) { return comparisonRepository.findById(comparisonId) .orElseThrow(() -> new GeneralException(ErrorStatus.NOT_EXIST_COMPARISON));