新增风险测评 计算建议投资产品分配接口,修改新增案例接口
parent
9142d99e2f
commit
023cf94363
@ -1,18 +1,18 @@
|
||||
package com.sztzjy.money_management.controller;
|
||||
|
||||
import com.sztzjy.money_management.mapper.ObjectiveQuestionMapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @Author xcj
|
||||
* @Date 2024/8/13
|
||||
* @Date 2024/8/19
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "实训相关接口")
|
||||
@RequestMapping("api/training")
|
||||
public class TrainingController {
|
||||
@Api(tags = "考试中心接口")
|
||||
@RequestMapping("api/exam")
|
||||
public class ExamController {
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.sztzjy.money_management.service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author xcj
|
||||
* @Date 2024/8/16
|
||||
*/
|
||||
public interface SynthesisPlanService {
|
||||
Map<String, String> adviseInvestmentProductAllot(BigDecimal raiScore, BigDecimal rciScore);
|
||||
}
|
@ -0,0 +1,168 @@
|
||||
package com.sztzjy.money_management.service.impl;
|
||||
|
||||
import com.sztzjy.money_management.service.SynthesisPlanService;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* @Author xcj
|
||||
* @Date 2024/8/16
|
||||
*/
|
||||
@Service
|
||||
public class SynthesisPlanServiceImpl implements SynthesisPlanService {
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, String> adviseInvestmentProductAllot(BigDecimal RAIScore, BigDecimal RCIScore) {
|
||||
Map<String, String> allocation = new HashMap<>();
|
||||
|
||||
int RAIScoreInt = RAIScore.intValue(); //风险容忍态度分数
|
||||
int RCIScoreInt = RCIScore.intValue(); //风险承受能力分数
|
||||
|
||||
if (RAIScoreInt >= 0 && RAIScoreInt <= 19) {
|
||||
if (RCIScoreInt >= 0 && RCIScoreInt <= 19) {
|
||||
allocation.put("货币", "70%");
|
||||
allocation.put("债券", "20%");
|
||||
allocation.put("股票", "10%");
|
||||
}
|
||||
if (RCIScoreInt >= 20 && RCIScoreInt <= 39) {
|
||||
allocation.put("货币", "50%");
|
||||
allocation.put("债券", "40%");
|
||||
allocation.put("股票", "10%");
|
||||
}
|
||||
if (RCIScoreInt >= 40 && RCIScoreInt <= 59) {
|
||||
allocation.put("货币", "40%");
|
||||
allocation.put("债券", "40%");
|
||||
allocation.put("股票", "20%");
|
||||
}
|
||||
if (RCIScoreInt >= 60 && RCIScoreInt <= 79) {
|
||||
allocation.put("货币", "20%");
|
||||
allocation.put("债券", "50%");
|
||||
allocation.put("股票", "30%");
|
||||
}
|
||||
if (RCIScoreInt >= 80 && RCIScoreInt <= 100) {
|
||||
allocation.put("货币", "0%");
|
||||
allocation.put("债券", "50%");
|
||||
allocation.put("股票", "50%");
|
||||
}
|
||||
}
|
||||
|
||||
if (RAIScoreInt >= 20 && RAIScoreInt <= 39) {
|
||||
if (RCIScoreInt >= 0 && RCIScoreInt <= 19) {
|
||||
allocation.put("货币", "50%");
|
||||
allocation.put("债券", "40%");
|
||||
allocation.put("股票", "10%");
|
||||
}
|
||||
if (RCIScoreInt >= 20 && RCIScoreInt <= 39) {
|
||||
allocation.put("货币", "40%");
|
||||
allocation.put("债券", "40%");
|
||||
allocation.put("股票", "20%");
|
||||
}
|
||||
if (RCIScoreInt >= 40 && RCIScoreInt <= 59) {
|
||||
allocation.put("货币", "20%");
|
||||
allocation.put("债券", "50%");
|
||||
allocation.put("股票", "30%");
|
||||
}
|
||||
if (RCIScoreInt >= 60 && RCIScoreInt <= 79) {
|
||||
allocation.put("货币", "0%");
|
||||
allocation.put("债券", "50%");
|
||||
allocation.put("股票", "50%");
|
||||
}
|
||||
if (RCIScoreInt >= 80 && RCIScoreInt <= 100) {
|
||||
allocation.put("货币", "0%");
|
||||
allocation.put("债券", "40%");
|
||||
allocation.put("股票", "60%");
|
||||
}
|
||||
}
|
||||
|
||||
if (RAIScoreInt >= 40 && RAIScoreInt <= 59) {
|
||||
if (RCIScoreInt >= 0 && RCIScoreInt <= 19) {
|
||||
allocation.put("货币", "40%");
|
||||
allocation.put("债券", "40%");
|
||||
allocation.put("股票", "20%");
|
||||
}
|
||||
if (RCIScoreInt >= 20 && RCIScoreInt <= 39) {
|
||||
allocation.put("货币", "20%");
|
||||
allocation.put("债券", "50%");
|
||||
allocation.put("股票", "30%");
|
||||
}
|
||||
if (RCIScoreInt >= 40 && RCIScoreInt <= 59) {
|
||||
allocation.put("货币", "0%");
|
||||
allocation.put("债券", "50%");
|
||||
allocation.put("股票", "50%");
|
||||
}
|
||||
if (RCIScoreInt >= 60 && RCIScoreInt <= 79) {
|
||||
allocation.put("货币", "0%");
|
||||
allocation.put("债券", "40%");
|
||||
allocation.put("股票", "60%");
|
||||
}
|
||||
if (RCIScoreInt >= 80 && RCIScoreInt <= 100) {
|
||||
allocation.put("货币", "0%");
|
||||
allocation.put("债券", "30%");
|
||||
allocation.put("股票", "70%");
|
||||
}
|
||||
}
|
||||
|
||||
if (RAIScoreInt >= 60 && RAIScoreInt <= 79) {
|
||||
if (RCIScoreInt >= 0 && RCIScoreInt <= 19) {
|
||||
allocation.put("货币", "20%");
|
||||
allocation.put("债券", "30%");
|
||||
allocation.put("股票", "50%");
|
||||
}
|
||||
if (RCIScoreInt >= 20 && RCIScoreInt <= 39) {
|
||||
allocation.put("货币", "0%");
|
||||
allocation.put("债券", "50%");
|
||||
allocation.put("股票", "50%");
|
||||
}
|
||||
if (RCIScoreInt >= 40 && RCIScoreInt <= 59) {
|
||||
allocation.put("货币", "0%");
|
||||
allocation.put("债券", "40%");
|
||||
allocation.put("股票", "60%");
|
||||
}
|
||||
if (RCIScoreInt >= 60 && RCIScoreInt <= 79) {
|
||||
allocation.put("货币", "0%");
|
||||
allocation.put("债券", "30%");
|
||||
allocation.put("股票", "70%");
|
||||
}
|
||||
if (RCIScoreInt >= 80 && RCIScoreInt <= 100) {
|
||||
allocation.put("货币", "0%");
|
||||
allocation.put("债券", "20%");
|
||||
allocation.put("股票", "80%");
|
||||
}
|
||||
}
|
||||
|
||||
if (RAIScoreInt >= 80 && RAIScoreInt <= 100) {
|
||||
if (RCIScoreInt >= 0 && RCIScoreInt <= 19) {
|
||||
allocation.put("货币", "0%");
|
||||
allocation.put("债券", "50%");
|
||||
allocation.put("股票", "50%");
|
||||
}
|
||||
if (RCIScoreInt >= 20 && RCIScoreInt <= 39) {
|
||||
allocation.put("货币", "0%");
|
||||
allocation.put("债券", "40%");
|
||||
allocation.put("股票", "60%");
|
||||
}
|
||||
if (RCIScoreInt >= 40 && RCIScoreInt <= 59) {
|
||||
allocation.put("货币", "0%");
|
||||
allocation.put("债券", "30%");
|
||||
allocation.put("股票", "70%");
|
||||
}
|
||||
if (RCIScoreInt >= 60 && RCIScoreInt <= 79) {
|
||||
allocation.put("货币", "0%");
|
||||
allocation.put("债券", "50%");
|
||||
allocation.put("股票", "80%");
|
||||
}
|
||||
if (RCIScoreInt >= 80 && RCIScoreInt <= 100) {
|
||||
allocation.put("货币", "0%");
|
||||
allocation.put("债券", "40%");
|
||||
allocation.put("股票", "90%");
|
||||
}
|
||||
}
|
||||
return allocation;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue