From 8c91055feebc21e57aa1ace5b3ef49daf7b21d95 Mon Sep 17 00:00:00 2001 From: j2noo Date: Fri, 8 Mar 2024 13:00:36 +0900 Subject: [PATCH] =?UTF-8?q?feat=20:=20#34=20swagger=20=EC=84=A4=EB=AA=85?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ModelFitnessController.java | 4 +++ .../controller/ModelIssueController.java | 5 ++++ .../service/impl/ModelServiceImpl.java | 25 ++++++++++++++++--- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/backend/soullive_a/controller/ModelFitnessController.java b/src/main/java/com/backend/soullive_a/controller/ModelFitnessController.java index f5810c8..e1dc7c5 100644 --- a/src/main/java/com/backend/soullive_a/controller/ModelFitnessController.java +++ b/src/main/java/com/backend/soullive_a/controller/ModelFitnessController.java @@ -4,18 +4,22 @@ import com.backend.soullive_a.dto.response.model.fitness.ModelFitnessResponse; import com.backend.soullive_a.exception.base.BaseResponse; import com.backend.soullive_a.service.impl.ModelFitnessServiceImpl; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +@Tag(name = "모델 적합도 API", description = "모델 적합도 이슈 API입니다.") @RestController @RequiredArgsConstructor @RequestMapping("/api/model/fitness") public class ModelFitnessController { private final ModelFitnessServiceImpl modelFitnessService; + @Operation(summary = "모델 적합도 API", description = "모델 적합도 조회 API입니다.") @GetMapping("") public BaseResponse getModelFitness( @RequestParam String modelName, diff --git a/src/main/java/com/backend/soullive_a/controller/ModelIssueController.java b/src/main/java/com/backend/soullive_a/controller/ModelIssueController.java index c67f1c9..42e878a 100644 --- a/src/main/java/com/backend/soullive_a/controller/ModelIssueController.java +++ b/src/main/java/com/backend/soullive_a/controller/ModelIssueController.java @@ -3,17 +3,22 @@ import com.backend.soullive_a.dto.response.model.issue.ModelIssueResponse; import com.backend.soullive_a.exception.base.BaseResponse; import com.backend.soullive_a.service.ModelIssueService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +@Tag(name = "모델 부정 이슈 API", description = "모델 부정 이슈 API입니다.") @RestController @RequiredArgsConstructor @RequestMapping("api/model/issue") public class ModelIssueController { private final ModelIssueService modelIssueService; + + @Operation(summary = "모델 부정 이슈 조회 API", description = "특정 모델 부정 이슈 조회 API입니다.") @GetMapping() public BaseResponse getIssue(@RequestParam String modelName) { return BaseResponse.builder() diff --git a/src/main/java/com/backend/soullive_a/service/impl/ModelServiceImpl.java b/src/main/java/com/backend/soullive_a/service/impl/ModelServiceImpl.java index 6dc318e..4c5773f 100644 --- a/src/main/java/com/backend/soullive_a/service/impl/ModelServiceImpl.java +++ b/src/main/java/com/backend/soullive_a/service/impl/ModelServiceImpl.java @@ -33,7 +33,7 @@ public class ModelServiceImpl implements ModelService { public ModelResponse getModel(String modelName,Long productId) { System.out.println(modelName); Model model = modelRepository.findByModelName(modelName) - .orElseThrow(() -> new NotFoundUserException("실페ㅐ")); + .orElseThrow(() -> new NotFoundUserException()); System.out.println(model.getModelName()+productId); //최근 조회 모델 데이터 업데이트 updateRecentViewModel(model,productId); @@ -54,12 +54,29 @@ public ModelResponse getModel(String modelName,Long productId) { } private void createModelFitness( ProductModel productModel) { - + String aiComment="ai 한줄 평 준비 중 입니다."; + if (productModel.getModel().getId() == 1) { + aiComment = "김희애의 우아하고 고급스러운 이미지와 함께 가족적인 이미지가 어우러져 lg 시그니처 브랜드의 프리미엄적인 이미지와 고품질 제품에 잘 어울릴 것이라고 판단 됩니다."; + } + else if (productModel.getModel().getId() == 2) { + aiComment = "한지민은 깨끗하고 바른 이미지로 LG시그니처와 어울리지만 현재 목표하는 프리미엄 이미지를 강조하기에는 다소 아쉬운 모델입니다."; + } else if (productModel.getModel().getId() == 3) { + aiComment = "김고은은 세련되고 사랑스러운 이미지로 LG 시그니처가 목표로 하는 세련되고 대중에게 친숙한 이미지와 적합합니다."; + } + + String scoreUrl="scoreUrl.png"; + if (productModel.getModel().getId() == 1) { + scoreUrl="희애scoreUrl.png"; + } + else if (productModel.getModel().getId() == 2) { + scoreUrl="한지민scoreUrl.png"; + } else if (productModel.getModel().getId() == 3) { + scoreUrl="김고은scoreUrl.png"; } modelFitnessRepository.save( ModelFitness.builder() .productModel(productModel) - .aiComment("ai comment입니다") - .scoreUrl("점수 url입니다") + .aiComment(aiComment) + .scoreUrl(scoreUrl) .build() );