新增风险测评 计算建议投资产品分配接口,修改新增案例接口

master
xiaoCJ 7 months ago
parent 9142d99e2f
commit 023cf94363

@ -39,7 +39,7 @@ public class CaseController {
ChapterMapper chapterMapper;
@PostMapping("/insertCase")
@ApiOperation("新增案例老师和管理员新增根据caseInfo中的publish区分")
@ApiOperation("新增案例老师和管理员新增根据caseInfo中的publish区分,学生端新增传isAnswer为学生答案/题目答案+userId")
private ResultEntity<HttpStatus> insertCase(@ApiParam("左侧caseInfo对象") @RequestParam String caseInfo, //todo 传json字符串
@ApiParam("右侧考核点设置的参数对象") @RequestParam String json) {
return caseService.insertCase(caseInfo, json);

@ -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 {
}

@ -9,6 +9,7 @@ import com.sztzjy.money_management.entity.*;
import com.sztzjy.money_management.entity.dto.SynthesisPlanScoreDto;
import com.sztzjy.money_management.entity.dto.UserStatisticsDto;
import com.sztzjy.money_management.mapper.*;
import com.sztzjy.money_management.service.SynthesisPlanService;
import com.sztzjy.money_management.util.ResultEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -19,10 +20,8 @@ import org.springframework.http.HttpStatus;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import java.math.BigDecimal;
import java.util.*;
import java.util.regex.Pattern;
//综合规划相关
@ -44,7 +43,8 @@ public class SynthesisPlanController {
UserStatisticsMapper userStatisticsMapper;
@Autowired
ClientFamilyInfoMapper clientFamilyInfoMapper;
@Autowired
SynthesisPlanService synthesisPlanService;
//目标客户查询
//根据create_time排序
@ -407,4 +407,13 @@ public class SynthesisPlanController {
}
return null;
}
@AnonymousAccess
@ApiOperation("风险测评结果/建议投资产品分配")
@PostMapping("/adviseInvestmentProductAllot")
public ResultEntity<Map<String, String>> adviseInvestmentProductAllot(@ApiParam("风险容忍态度分数") @RequestParam BigDecimal RAIScore,
@ApiParam("风险承受能力分数") @RequestParam BigDecimal RCIScore) {
Map<String, String> map = synthesisPlanService.adviseInvestmentProductAllot(RAIScore, RCIScore);
return new ResultEntity<Map<String, String>>(map);
}
}

@ -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);
}

@ -163,7 +163,6 @@ public class CaseServiceImpl implements CaseService {
CaseRiskIndex caseRiskIndex = gson.fromJson(json, CaseRiskIndex.class);
caseRiskIndex.setCaseRiskIndexId(IdUtil.randomUUID());
caseRiskIndex.setCaseid(caseid);
caseRiskIndex.setIsAnswer("题目答案");
caseRiskIndexMapper.insert(caseRiskIndex);
return new ResultEntity<HttpStatus>(HttpStatus.OK, "新增成功!");
}
@ -172,7 +171,6 @@ public class CaseServiceImpl implements CaseService {
CaseFinanceLiability caseFinanceLiability = gson.fromJson(json, CaseFinanceLiability.class);
caseFinanceLiability.setCaseFinanceLiabilityId(IdUtil.randomUUID());
caseFinanceLiability.setCaseId(caseid);
caseFinanceLiability.setIsAnswer("题目答案");
caseFinanceLiabilityMapper.insert(caseFinanceLiability);
return new ResultEntity<HttpStatus>(HttpStatus.OK, "新增成功!");
}
@ -181,7 +179,6 @@ public class CaseServiceImpl implements CaseService {
CaseIncomeAndExpenses caseIncomeAndExpenses = gson.fromJson(json, CaseIncomeAndExpenses.class);
caseIncomeAndExpenses.setCaseIncomeAndExpensesId(IdUtil.randomUUID());
caseIncomeAndExpenses.setCaseid(caseid);
caseIncomeAndExpenses.setIsAnswer("题目答案");
caseIncomeAndExpensesMapper.insert(caseIncomeAndExpenses);
return new ResultEntity<HttpStatus>(HttpStatus.OK, "新增成功!");
}
@ -190,7 +187,6 @@ public class CaseServiceImpl implements CaseService {
CaseCashFlow caseCashFlow = gson.fromJson(json, CaseCashFlow.class);
caseCashFlow.setCaseCashFlowId(IdUtil.randomUUID());
caseCashFlow.setCaseid(caseid);
caseCashFlow.setIsAnswer("题目答案");
caseCashFlowMapper.insert(caseCashFlow);
return new ResultEntity<HttpStatus>(HttpStatus.OK, "新增成功!");
}
@ -199,7 +195,6 @@ public class CaseServiceImpl implements CaseService {
CaseFinancialRatiosWithBLOBs caseFinancialRatios = gson.fromJson(json, CaseFinancialRatiosWithBLOBs.class);
caseFinancialRatios.setCaseFinancialRatiosId(IdUtil.randomUUID());
caseFinancialRatios.setCaseid(caseid);
caseFinancialRatios.setIsAnswer("题目答案");
caseFinancialRatiosMapper.insert(caseFinancialRatios);
return new ResultEntity<HttpStatus>(HttpStatus.OK, "新增成功!");
}
@ -208,7 +203,6 @@ public class CaseServiceImpl implements CaseService {
CaseCashPlan caseCashPlan = gson.fromJson(json, CaseCashPlan.class);
caseCashPlan.setCaseCashPlanId(IdUtil.randomUUID());
caseCashPlan.setCaseid(caseid);
caseCashPlan.setIsAnswer("题目答案");
caseCashPlanMapper.insert(caseCashPlan);
return new ResultEntity<HttpStatus>(HttpStatus.OK, "新增成功!");
}
@ -217,7 +211,6 @@ public class CaseServiceImpl implements CaseService {
CaseLifeEducationPlan caseLifeEducationPlan = gson.fromJson(json, CaseLifeEducationPlan.class);
caseLifeEducationPlan.setCaseLifeEducationPlanId(IdUtil.randomUUID());
caseLifeEducationPlan.setCaseid(caseid);
caseLifeEducationPlan.setIsAnswer("题目答案");
caseLifeEducationPlanMapper.insert(caseLifeEducationPlan);
return new ResultEntity<HttpStatus>(HttpStatus.OK, "新增成功!");
}
@ -234,7 +227,6 @@ public class CaseServiceImpl implements CaseService {
CaseStartAnUndertakingPlan caseStartAnUndertakingPlan = gson.fromJson(json, CaseStartAnUndertakingPlan.class);
caseStartAnUndertakingPlan.setCaseStartAnUndertakingPlanId(IdUtil.randomUUID());
caseStartAnUndertakingPlan.setCaseid(caseid);
caseStartAnUndertakingPlan.setIsAnswer("题目答案");
caseStartAnUndertakingPlanMapper.insert(caseStartAnUndertakingPlan);
return new ResultEntity<HttpStatus>(HttpStatus.OK, "新增成功!");
}
@ -243,7 +235,6 @@ public class CaseServiceImpl implements CaseService {
CaseRetirementPlan caseRetirementPlan = gson.fromJson(json, CaseRetirementPlan.class);
caseRetirementPlan.setCaseRetirementPlanId(IdUtil.randomUUID());
caseRetirementPlan.setCaseid(caseid);
caseRetirementPlan.setIsAnswer("题目答案");
caseRetirementPlanMapper.insert(caseRetirementPlan);
return new ResultEntity<HttpStatus>(HttpStatus.OK, "新增成功!");
}
@ -252,7 +243,6 @@ public class CaseServiceImpl implements CaseService {
CaseInsurancePlan caseInsurancePlan = gson.fromJson(json, CaseInsurancePlan.class);
caseInsurancePlan.setCaseInsurancePlanId(IdUtil.randomUUID());
caseInsurancePlan.setCaseid(caseid);
caseInsurancePlan.setIsAnswer("题目答案");
caseInsurancePlanMapper.insert(caseInsurancePlan);
return new ResultEntity<HttpStatus>(HttpStatus.OK, "新增成功!");
}
@ -266,7 +256,6 @@ public class CaseServiceImpl implements CaseService {
CaseTaxPlan caseTaxPlan = gson.fromJson(json, CaseTaxPlan.class);
caseTaxPlan.setCaseTaxPlanId(IdUtil.randomUUID());
caseTaxPlan.setCaseid(caseid);
caseTaxPlan.setIsAnswer("题目答案");
caseTaxPlanMapper.insert(caseTaxPlan);
return new ResultEntity<HttpStatus>(HttpStatus.OK, "新增成功!");
}
@ -275,7 +264,6 @@ public class CaseServiceImpl implements CaseService {
CaseDistributionOfPropertyWithBLOBs caseDistributionOfPropertyWithBLOBs = gson.fromJson(json, CaseDistributionOfPropertyWithBLOBs.class);
caseDistributionOfPropertyWithBLOBs.setCaseDistributionOfPropertyId(IdUtil.randomUUID());
caseDistributionOfPropertyWithBLOBs.setCaseid(caseid);
caseDistributionOfPropertyWithBLOBs.setIsAnswer("题目答案");
caseDistributionOfPropertyMapper.insert(caseDistributionOfPropertyWithBLOBs);
return new ResultEntity<HttpStatus>(HttpStatus.OK, "新增成功!");
}
@ -284,7 +272,6 @@ public class CaseServiceImpl implements CaseService {
CaseHeritageWithBLOBs caseHeritageWithBLOBs = gson.fromJson(json, CaseHeritageWithBLOBs.class);
caseHeritageWithBLOBs.setCaseHeritageId(IdUtil.randomUUID());
caseHeritageWithBLOBs.setCaseid(caseid);
caseHeritageWithBLOBs.setIsAnswer("题目答案");
caseHeritageMapper.insert(caseHeritageWithBLOBs);
return new ResultEntity<HttpStatus>(HttpStatus.OK, "新增成功!");
}

@ -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…
Cancel
Save