-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from SWM-WeLike2Coding/fix/survey
�feat: 사용자의 투자 성향에 맞는 청약 중인 상품 리스트 조회 기능 개발
- Loading branch information
Showing
19 changed files
with
396 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...ereuserservice/client/analysis/dto/request/RequestInvestmentPropensityInformationDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.wl2c.elswhereuserservice.client.analysis.dto.request; | ||
|
||
import com.wl2c.elswhereuserservice.domain.user.model.RepaymentOption; | ||
import com.wl2c.elswhereuserservice.domain.user.model.RiskPropensity; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public class RequestInvestmentPropensityInformationDto { | ||
|
||
@Schema(description = "상품 id 리스트", example = "[3, 6, 9, 12]") | ||
private final List<Long> productIdList; | ||
|
||
@Schema(description = "투자자 위험 감수 능력", example = "MEDIUM_RISK") | ||
private final RiskPropensity riskPropensity; | ||
|
||
@Schema(description = "희망 상환 기간", example = "EARLY_REPAYMENT") | ||
private final RepaymentOption repaymentOption; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
...esponse/ResponseSummarizedProductDto.java → ...roduct/dto/list/SummarizedProductDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 27 additions & 44 deletions
71
...m/wl2c/elswhereuserservice/domain/user/controller/UserInvestmentPropensityController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,51 @@ | ||
package com.wl2c.elswhereuserservice.domain.user.controller; | ||
|
||
import com.wl2c.elswhereuserservice.domain.user.model.dto.request.RequestCreateInvestmentPropensityDto; | ||
import com.wl2c.elswhereuserservice.domain.user.model.dto.response.ResponseInvestmentPropensityDto; | ||
import com.wl2c.elswhereuserservice.client.product.dto.list.SummarizedProductDto; | ||
import com.wl2c.elswhereuserservice.domain.user.service.UserInvestmentPropensityService; | ||
import com.wl2c.elswhereuserservice.global.model.dto.ResponseIdDto; | ||
import com.wl2c.elswhereuserservice.global.model.dto.ResponsePage; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import jakarta.servlet.http.HttpServletRequest; | ||
import jakarta.validation.Valid; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.*; | ||
import org.springdoc.core.annotations.ParameterObject; | ||
import org.springframework.data.domain.Pageable; | ||
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; | ||
|
||
import static java.lang.Long.parseLong; | ||
|
||
@Tag(name = "사용자의 투자 성향 설문조사", description = "사용자의 투자 성향 설문조사 관련 api") | ||
@Tag(name = "사용자의 투자 성향에 맞는 청약 중인 상품", description = "사용자의 투자 성향에 맞는 청약 중인 상품 관련 api") | ||
@RestController | ||
@RequestMapping("/v1/propensity/survey") | ||
@RequestMapping("/v1/propensity") | ||
@RequiredArgsConstructor | ||
public class UserInvestmentPropensityController { | ||
|
||
private final UserInvestmentPropensityService userInvestmentPropensityService; | ||
|
||
/** | ||
* 설문 조사 내용 등록 | ||
* 사용자의 투자 성향에 맞는 청약 중인 상품 리스트 조회 | ||
* <p> | ||
* <br/> | ||
* 설문 조사 첫 등록 및 재참여도 해당됩니다.<br/> | ||
* 설문 조사 양식은 아래 타입에 맞춰서 기입해주세요. | ||
* 해당하는 정렬 타입(type)에 맞게 문자열을 기입해주세요. | ||
* | ||
* investmentExperience(ELS 상품 투자 경험) : YES(있음), NO(없음) | ||
* investmentPreferredPeriod(투자 선호 기간) : LESS_THAN_A_YEAR(1년 미만), A_YEAR_OR_TWO(1~2년), MORE_THAN_THREE_YEARS(3년 이상) | ||
* riskTakingAbility(투자자 위험 감수 능력) : RISK_TAKING_TYPE(위험 감수형), STABILITY_SEEKING_TYPE(안정 추구형) | ||
* 최신순 : latest | ||
* 낙인순 : knock-in | ||
* 수익률순 : profit | ||
* 청약 마감일순 : deadline | ||
* </p> | ||
* | ||
* @param dto 설문 조사 양식 dto | ||
*/ | ||
@PostMapping | ||
public void create(HttpServletRequest request, | ||
@Valid @RequestBody RequestCreateInvestmentPropensityDto dto) { | ||
userInvestmentPropensityService.create(parseLong(request.getHeader("requestId")), dto); | ||
} | ||
|
||
/** | ||
* 설문 조사 내용 조회 | ||
*<p> | ||
* 설문 조사에 참여한 적이 없는 경우, "notfound.survey-participation" 오류가 발생합니다. | ||
*</p> | ||
* | ||
* @return 사용자가 작성한 설문 조사 내용 dto | ||
*/ | ||
@GetMapping | ||
public ResponseInvestmentPropensityDto read(HttpServletRequest request) { | ||
return userInvestmentPropensityService.read(parseLong(request.getHeader("requestId"))); | ||
} | ||
|
||
/** | ||
* 설문 조사 참여 여부 확인 | ||
* <p> | ||
* 설문 조사에 참여한 경우, "ok"<br/> | ||
* 설문 조사에 참여한 적이 없는 경우, "notfound.survey-participation" 오류가 발생합니다. | ||
* <br/> | ||
* 스텝다운 유형의 상품에 대해서 AI가 분석한 각 상품의 safetyScore를 제공합니다. <br/> | ||
* 스텝다운 유형이 아니거나 스텝다운 유형이지만 분석 정보가 없는 경우에는 null 값으로 제공됩니다. <br/> | ||
* </p> | ||
* | ||
* @param type 정렬 타입 | ||
* @return 페이징된 사용자의 투자 성향에 맞는 청약 중인 상품 목록 | ||
*/ | ||
@GetMapping("/check") | ||
public void checkSurveyParticipation(HttpServletRequest request) { | ||
userInvestmentPropensityService.checkSurveyParticipation(parseLong(request.getHeader("requestId"))); | ||
@GetMapping | ||
public ResponsePage<SummarizedProductDto> personalizedProducts(HttpServletRequest request, | ||
@RequestParam(name = "type") String type, | ||
@ParameterObject Pageable pageable) { | ||
return userInvestmentPropensityService.personalizedProducts(parseLong(request.getHeader("requestId")), type, pageable); | ||
} | ||
|
||
} |
68 changes: 68 additions & 0 deletions
68
.../elswhereuserservice/domain/user/controller/UserInvestmentPropensitySurveyController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package com.wl2c.elswhereuserservice.domain.user.controller; | ||
|
||
import com.wl2c.elswhereuserservice.domain.user.model.dto.request.RequestCreateInvestmentPropensityDto; | ||
import com.wl2c.elswhereuserservice.domain.user.model.dto.response.ResponseInvestmentPropensityDto; | ||
import com.wl2c.elswhereuserservice.domain.user.service.UserInvestmentPropensityService; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import jakarta.servlet.http.HttpServletRequest; | ||
import jakarta.validation.Valid; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import static java.lang.Long.parseLong; | ||
|
||
@Tag(name = "사용자의 투자 성향 설문조사", description = "사용자의 투자 성향 설문조사 관련 api") | ||
@RestController | ||
@RequestMapping("/v1/propensity/survey") | ||
@RequiredArgsConstructor | ||
public class UserInvestmentPropensitySurveyController { | ||
|
||
private final UserInvestmentPropensityService userInvestmentPropensityService; | ||
|
||
/** | ||
* 설문 조사 내용 등록 | ||
* <p> | ||
* <br/> | ||
* 설문 조사 첫 등록 및 재참여도 해당됩니다.<br/> | ||
* 설문 조사 양식은 아래 타입에 맞춰서 기입해주세요. | ||
* | ||
* investmentExperience(ELS 상품 투자 경험) : YES(있음), NO(없음) | ||
* riskTakingAbility(투자자 위험 감수 능력) : EXTREME_RISK(초고위험), HIGH_RISK(고위험), MEDIUM_RISK(중위험), LOW_RISK(저위험) | ||
* repaymentOption(희망 상환 기간) : EARLY_REPAYMENT(조기상환), MATURITY_REPAYMENT(만기상환), NO_PREFERENCE(상관없음) | ||
* minPreferredReturn(선호 최소 수익률(연%)) : 실수 값(ex. 8.4) | ||
* </p> | ||
* | ||
* @param dto 설문 조사 양식 dto | ||
*/ | ||
@PostMapping | ||
public void create(HttpServletRequest request, | ||
@Valid @RequestBody RequestCreateInvestmentPropensityDto dto) { | ||
userInvestmentPropensityService.create(parseLong(request.getHeader("requestId")), dto); | ||
} | ||
|
||
/** | ||
* 설문 조사 내용 조회 | ||
*<p> | ||
* 설문 조사에 참여한 적이 없는 경우, "notfound.survey-participation" 오류가 발생합니다. | ||
*</p> | ||
* | ||
* @return 사용자가 작성한 설문 조사 내용 dto | ||
*/ | ||
@GetMapping | ||
public ResponseInvestmentPropensityDto read(HttpServletRequest request) { | ||
return userInvestmentPropensityService.read(parseLong(request.getHeader("requestId"))); | ||
} | ||
|
||
/** | ||
* 설문 조사 참여 여부 확인 | ||
* <p> | ||
* 설문 조사에 참여한 경우, "ok"<br/> | ||
* 설문 조사에 참여한 적이 없는 경우, "notfound.survey-participation" 오류가 발생합니다. | ||
* </p> | ||
*/ | ||
@GetMapping("/check") | ||
public void checkSurveyParticipation(HttpServletRequest request) { | ||
userInvestmentPropensityService.checkSurveyParticipation(parseLong(request.getHeader("requestId"))); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 0 additions & 18 deletions
18
src/main/java/com/wl2c/elswhereuserservice/domain/user/model/InvestmentPreferredPeriod.java
This file was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
src/main/java/com/wl2c/elswhereuserservice/domain/user/model/RepaymentOption.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.wl2c.elswhereuserservice.domain.user.model; | ||
|
||
public enum RepaymentOption { | ||
|
||
/** | ||
* 조기상환 | ||
*/ | ||
EARLY_REPAYMENT, | ||
|
||
/** | ||
* 만기상환 | ||
*/ | ||
MATURITY_REPAYMENT, | ||
|
||
/** | ||
* 상관없음 | ||
*/ | ||
NO_PREFERENCE | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
src/main/java/com/wl2c/elswhereuserservice/domain/user/model/RiskPropensity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.wl2c.elswhereuserservice.domain.user.model; | ||
|
||
public enum RiskPropensity { | ||
|
||
/** | ||
* 초고위험 | ||
*/ | ||
EXTREME_RISK, | ||
|
||
/** | ||
* 고위험 | ||
*/ | ||
HIGH_RISK, | ||
|
||
/** | ||
* 중위험 | ||
*/ | ||
MEDIUM_RISK, | ||
|
||
/** | ||
* 저위험 | ||
*/ | ||
LOW_RISK | ||
|
||
} |
13 changes: 0 additions & 13 deletions
13
src/main/java/com/wl2c/elswhereuserservice/domain/user/model/RiskTakingAbility.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.