|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package com.sztzjy.money_management.controller;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
|
|
import cn.hutool.json.JSONObject;
|
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
import com.nimbusds.jose.shaded.gson.Gson;
|
|
|
|
@ -61,6 +62,18 @@ public class GradeController {
|
|
|
|
|
SynthesisPlanClientMapper synthesisPlanClientMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
CaseService caseService;
|
|
|
|
|
@Autowired
|
|
|
|
|
CaseInfoMapper caseInfoMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
ComCaseMapper comCaseMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
CaseFinancialRatiosMapper caseFinancialRatiosMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
SynthesisPlanScoreMapper synthesisPlanScoreMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
CaseCashPlanMapper caseCashPlanMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
CaseLifeEducationPlanMapper caseLifeEducationPlanMapper;
|
|
|
|
|
|
|
|
|
|
@AnonymousAccess
|
|
|
|
|
@ApiOperation("实训演练-学习成绩得分情况展示")
|
|
|
|
@ -620,24 +633,238 @@ public class GradeController {
|
|
|
|
|
|
|
|
|
|
//教师端 综合规划成绩详情查询
|
|
|
|
|
@PostMapping("/getExamPoint")
|
|
|
|
|
@ApiOperation("展示考核点信息/老师端/学生实验实训")
|
|
|
|
|
@ApiOperation("教师端 综合规划成绩详情查询")
|
|
|
|
|
@AnonymousAccess
|
|
|
|
|
private ResultEntity<Object> getExamPoint(@RequestParam String caseID) {
|
|
|
|
|
return caseService.getExamPoint(caseID,null, "题目答案", "报告");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//教师端 综合规划老师评分
|
|
|
|
|
private ResultEntity<Object> getExamPoint11( @ApiParam("右侧考核点设置的参数对象") @RequestParam String json,
|
|
|
|
|
@ApiParam("老师或管理员操作传master,学生操作传stu") String operator,
|
|
|
|
|
String caseid) {
|
|
|
|
|
// Gson gson=new Gson();
|
|
|
|
|
// for (int i = 0; i < typeList.size(); i++) {
|
|
|
|
|
// String type = typeList.get(i);
|
|
|
|
|
// }
|
|
|
|
|
// return caseService.getExamPoint(caseID,null, "题目答案", "报告");
|
|
|
|
|
return null;
|
|
|
|
|
@PostMapping("/updateSynthesisPlanMark")
|
|
|
|
|
@ApiOperation("教师端 综合规划老师评分")
|
|
|
|
|
@AnonymousAccess
|
|
|
|
|
private ResultEntity updateSynthesisPlanMark(@ApiParam("map<type,json> type为更新的表名,json为预览展示单个表中的对象") @RequestBody Map<String, String> updateMap,
|
|
|
|
|
@RequestParam String userId,@RequestParam String caseId) {
|
|
|
|
|
for(String type:updateMap.keySet()){
|
|
|
|
|
String json = updateMap.get(type);
|
|
|
|
|
Gson gson = new Gson();
|
|
|
|
|
caseService.addCorrelationTable(type,json,gson,"stu");
|
|
|
|
|
}
|
|
|
|
|
//修改审核状态
|
|
|
|
|
SynthesisPlanClientExample synthesisPlanClientExample = new SynthesisPlanClientExample();
|
|
|
|
|
synthesisPlanClientExample.createCriteria().andUseridEqualTo(userId).andCaseidEqualTo(caseId);
|
|
|
|
|
List<SynthesisPlanClient> synthesisPlanClients = synthesisPlanClientMapper.selectByExample(synthesisPlanClientExample);
|
|
|
|
|
synthesisPlanClients.get(0).setSubmitStatus("已审核");
|
|
|
|
|
|
|
|
|
|
//设置综合规划成绩表 *****
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, "更新评分成功");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//教师端 综合规划一键评分
|
|
|
|
|
@GetMapping("/OneClickScoring")
|
|
|
|
|
@ApiOperation("教师端-综合规划一键评分")
|
|
|
|
|
@AnonymousAccess
|
|
|
|
|
private ResultEntity OneClickScoring(String schoolId){
|
|
|
|
|
//先在synthesis_plan_client表中查询schoolID 并且submitStatus状态为未审核的数据 循环获取caseId和userId
|
|
|
|
|
SynthesisPlanClientExample synthesisPlanClientExample = new SynthesisPlanClientExample();
|
|
|
|
|
synthesisPlanClientExample.createCriteria().andSchoolIdEqualTo(schoolId).andSubmitStatusEqualTo("未审核");
|
|
|
|
|
List<SynthesisPlanClient> planClientList= synthesisPlanClientMapper.selectByExample(synthesisPlanClientExample);
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < planClientList.size(); i++) {
|
|
|
|
|
SynthesisPlanClient client = planClientList.get(0);
|
|
|
|
|
String caseid = client.getCaseid();
|
|
|
|
|
String userid = client.getUserid();
|
|
|
|
|
//根据caseId 查询caseInfo表中的manage_money_matters_type字段 如果等于综合规划 则查询com_case表 获取理财类型TypeList 如果不等于综合规划 则获取caseInfo中的manage_money_matters_type作为理财类型Type
|
|
|
|
|
CaseInfo caseInfo = caseInfoMapper.selectByPrimaryKey(caseid);
|
|
|
|
|
List<String> typeList=new ArrayList<>();
|
|
|
|
|
if("综合规划".equals(caseInfo.getManageMoneyMattersType())){
|
|
|
|
|
ComCaseExample comCaseExample = new ComCaseExample();
|
|
|
|
|
comCaseExample.createCriteria().andCaseidEqualTo(caseid);
|
|
|
|
|
List<ComCase> comCaseList = comCaseMapper.selectByExample(comCaseExample);
|
|
|
|
|
for (int j = 0; j < comCaseList.size(); j++) {
|
|
|
|
|
String manageMoneyMattersType = comCaseList.get(j).getManageMoneyMattersType();
|
|
|
|
|
typeList.add(manageMoneyMattersType);
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
typeList.add(caseInfo.getManageMoneyMattersType());
|
|
|
|
|
}
|
|
|
|
|
for (int j = 0; j < typeList.size(); j++) {
|
|
|
|
|
String type = typeList.get(j);
|
|
|
|
|
if("财务分析-财务比例分析".equals(type)){
|
|
|
|
|
//根据caseid和userId查询case_Financial_Ratios表
|
|
|
|
|
CaseFinancialRatiosExample example = new CaseFinancialRatiosExample();
|
|
|
|
|
example.createCriteria().andCaseidEqualTo(caseid).andUserIdEqualTo(userid);
|
|
|
|
|
List<CaseFinancialRatiosWithBLOBs> list = caseFinancialRatiosMapper.selectByExampleWithBLOBs(example);
|
|
|
|
|
//如果不存在 则跳过
|
|
|
|
|
if(list.isEmpty()){
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
CaseFinancialRatiosWithBLOBs caseFinancialRatiosWithBLOBs = list.get(0);
|
|
|
|
|
String analysis = caseFinancialRatiosWithBLOBs.getAnalysis();
|
|
|
|
|
BigDecimal teacherScore=BigDecimal.ZERO;
|
|
|
|
|
if(StringUtils.isBlank(analysis)){
|
|
|
|
|
caseFinancialRatiosWithBLOBs.setAnalysisTeacherScore(teacherScore);
|
|
|
|
|
}else {
|
|
|
|
|
if(analysis.length()<20){
|
|
|
|
|
caseFinancialRatiosWithBLOBs.setAnalysisTeacherScore(teacherScore);
|
|
|
|
|
}else if(analysis.length()>=50){
|
|
|
|
|
teacherScore=BigDecimal.valueOf(2);
|
|
|
|
|
caseFinancialRatiosWithBLOBs.setAnalysisTeacherScore(teacherScore);
|
|
|
|
|
}else {
|
|
|
|
|
teacherScore=BigDecimal.valueOf(1);
|
|
|
|
|
caseFinancialRatiosWithBLOBs.setAnalysisTeacherScore(teacherScore);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
caseFinancialRatiosMapper.updateByPrimaryKeyWithBLOBs(caseFinancialRatiosWithBLOBs);
|
|
|
|
|
//并设置综合规划成绩表 修改分数
|
|
|
|
|
SynthesisPlanScoreExample scoreExample = new SynthesisPlanScoreExample();
|
|
|
|
|
scoreExample.createCriteria().andCaseidEqualTo(caseid).andUseridEqualTo(userid).andTestCenterEqualTo("财务分析-财务比例分析");
|
|
|
|
|
List<SynthesisPlanScore> scoreList = synthesisPlanScoreMapper.selectByExample(scoreExample);
|
|
|
|
|
SynthesisPlanScore synthesisPlanScore = scoreList.get(0);
|
|
|
|
|
synthesisPlanScore.setScore(teacherScore);
|
|
|
|
|
synthesisPlanScoreMapper.updateByPrimaryKey(synthesisPlanScore);
|
|
|
|
|
}else if("现金规划".equals(type)){
|
|
|
|
|
CaseCashPlanExample example = new CaseCashPlanExample();
|
|
|
|
|
example.createCriteria().andCaseidEqualTo(caseid).andUserIdEqualTo(userid);
|
|
|
|
|
List<CaseCashPlan> list = caseCashPlanMapper.selectByExample(example);
|
|
|
|
|
//如果不存在 则跳过
|
|
|
|
|
if(list.isEmpty()){
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
CaseCashPlan caseCashPlan = list.get(0);
|
|
|
|
|
String analysis = caseCashPlan.getAnalysis();
|
|
|
|
|
BigDecimal teacherScore=BigDecimal.ZERO;
|
|
|
|
|
if(StringUtils.isBlank(analysis)){
|
|
|
|
|
caseCashPlan.setAnalysisTeacherScore(teacherScore);
|
|
|
|
|
}else {
|
|
|
|
|
if(analysis.length()<20){
|
|
|
|
|
caseCashPlan.setAnalysisTeacherScore(teacherScore);
|
|
|
|
|
}else if(analysis.length()>=50){
|
|
|
|
|
teacherScore=BigDecimal.valueOf(2);
|
|
|
|
|
caseCashPlan.setAnalysisTeacherScore(teacherScore);
|
|
|
|
|
}else {
|
|
|
|
|
teacherScore=BigDecimal.valueOf(1);
|
|
|
|
|
caseCashPlan.setAnalysisTeacherScore(teacherScore);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
caseCashPlanMapper.updateByPrimaryKey(caseCashPlan);
|
|
|
|
|
//并设置综合规划成绩表 修改分数
|
|
|
|
|
SynthesisPlanScoreExample scoreExample = new SynthesisPlanScoreExample();
|
|
|
|
|
scoreExample.createCriteria().andCaseidEqualTo(caseid).andUseridEqualTo(userid).andTestCenterEqualTo("现金规划");
|
|
|
|
|
List<SynthesisPlanScore> scoreList = synthesisPlanScoreMapper.selectByExample(scoreExample);
|
|
|
|
|
SynthesisPlanScore synthesisPlanScore = scoreList.get(0);
|
|
|
|
|
synthesisPlanScore.setScore(teacherScore);
|
|
|
|
|
synthesisPlanScoreMapper.updateByPrimaryKey(synthesisPlanScore);
|
|
|
|
|
}else if("生涯规划-教育规划".equals(type)){
|
|
|
|
|
CaseLifeEducationPlanExample example = new CaseLifeEducationPlanExample();
|
|
|
|
|
example.createCriteria().andCaseidEqualTo(caseid).andUserIdEqualTo(userid);
|
|
|
|
|
List<CaseLifeEducationPlan> list = caseLifeEducationPlanMapper.selectByExample(example);
|
|
|
|
|
//如果不存在 则跳过
|
|
|
|
|
if(list.isEmpty()){
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
CaseLifeEducationPlan caseLifeEducationPlan = list.get(0);
|
|
|
|
|
String analysis = caseLifeEducationPlan.getAnalysis();
|
|
|
|
|
BigDecimal teacherScore=BigDecimal.ZERO;
|
|
|
|
|
//设置分析分数
|
|
|
|
|
if(StringUtils.isBlank(analysis)){
|
|
|
|
|
caseLifeEducationPlan.setAnalysisTeacherScore(teacherScore);
|
|
|
|
|
}else {
|
|
|
|
|
if(analysis.length()<20){
|
|
|
|
|
caseLifeEducationPlan.setAnalysisTeacherScore(teacherScore);
|
|
|
|
|
}else if(analysis.length()>=50){
|
|
|
|
|
teacherScore=BigDecimal.valueOf(2);
|
|
|
|
|
caseLifeEducationPlan.setAnalysisTeacherScore(teacherScore);
|
|
|
|
|
}else {
|
|
|
|
|
teacherScore=BigDecimal.valueOf(1);
|
|
|
|
|
caseLifeEducationPlan.setAnalysisTeacherScore(teacherScore);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//设置理财方案分数 先获取案例题答案的分数 再获取学生理财方案的四个对象 按照公式对比大小 如果大于老师的答案 则给两分 低于给0分
|
|
|
|
|
CaseLifeEducationPlanExample teaExample = new CaseLifeEducationPlanExample();
|
|
|
|
|
teaExample.createCriteria().andCaseidEqualTo(caseid).andIsAnswerEqualTo("题目答案");
|
|
|
|
|
List<CaseLifeEducationPlan> teaCaseLifeEducationPlans = caseLifeEducationPlanMapper.selectByExample(example);
|
|
|
|
|
CaseLifeEducationPlan teaPlan = teaCaseLifeEducationPlans.get(0);
|
|
|
|
|
BigDecimal teaFinancialPlanningMoney = teaPlan.getReturnOnInvestment();
|
|
|
|
|
BigDecimal returnOnInvestment = caseLifeEducationPlan.getReturnOnInvestment();
|
|
|
|
|
BigDecimal disposableInput = caseLifeEducationPlan.getDisposableInput();
|
|
|
|
|
BigDecimal monthlyInvestment = caseLifeEducationPlan.getMonthlyInvestment();
|
|
|
|
|
Integer regularYear = caseLifeEducationPlan.getRegularYear(); //定期定额投资年限 n
|
|
|
|
|
BigDecimal stuFinancialPlanningMoney = getFinancialPlanningMoney(returnOnInvestment,disposableInput,monthlyInvestment,regularYear);
|
|
|
|
|
BigDecimal teacherFinancialPlanningScore=BigDecimal.ZERO; //老师理财分数 用于保存到综合规划成绩表中
|
|
|
|
|
if(stuFinancialPlanningMoney.compareTo(teaFinancialPlanningMoney)>=0){
|
|
|
|
|
teacherFinancialPlanningScore=BigDecimal.valueOf(2);
|
|
|
|
|
caseLifeEducationPlan.setCaseTeacherScore(teacherFinancialPlanningScore);
|
|
|
|
|
}else {
|
|
|
|
|
caseLifeEducationPlan.setCaseTeacherScore(teacherFinancialPlanningScore);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
caseLifeEducationPlanMapper.updateByPrimaryKey(caseLifeEducationPlan);
|
|
|
|
|
//并设置综合规划成绩表 修改老师评分分数
|
|
|
|
|
SynthesisPlanScoreExample scoreExample = new SynthesisPlanScoreExample();
|
|
|
|
|
scoreExample.createCriteria().andCaseidEqualTo(caseid).andUseridEqualTo(userid).andManageMoneyMattersTypeEqualTo("生涯规划-教育规划").andTestCenterEqualTo("教育规划分析");
|
|
|
|
|
List<SynthesisPlanScore> scoreList = synthesisPlanScoreMapper.selectByExample(scoreExample);
|
|
|
|
|
SynthesisPlanScore synthesisPlanScore = scoreList.get(0);
|
|
|
|
|
synthesisPlanScore.setScore(teacherScore);
|
|
|
|
|
synthesisPlanScoreMapper.updateByPrimaryKey(synthesisPlanScore);
|
|
|
|
|
|
|
|
|
|
//修改理财方案老师评分
|
|
|
|
|
SynthesisPlanScoreExample scoreExample2 = new SynthesisPlanScoreExample();
|
|
|
|
|
scoreExample2.createCriteria().andCaseidEqualTo(caseid).andUseridEqualTo(userid).andManageMoneyMattersTypeEqualTo("生涯规划-教育规划").andTestCenterEqualTo("理财方案");
|
|
|
|
|
List<SynthesisPlanScore> scoreList2 = synthesisPlanScoreMapper.selectByExample(scoreExample2);
|
|
|
|
|
SynthesisPlanScore synthesisPlanScore2 = scoreList2.get(0);
|
|
|
|
|
synthesisPlanScore2.setScore(teacherFinancialPlanningScore);
|
|
|
|
|
synthesisPlanScoreMapper.updateByPrimaryKey(synthesisPlanScore2);
|
|
|
|
|
}else if("生涯规划-消费规划".equals(type)){
|
|
|
|
|
|
|
|
|
|
}else if("生涯规划-创业规划".equals(type)){
|
|
|
|
|
|
|
|
|
|
}else if("生涯规划-退休规划".equals(type)){
|
|
|
|
|
|
|
|
|
|
}else if("生涯规划-保险规划".equals(type)){
|
|
|
|
|
|
|
|
|
|
}else if("投资规划".equals(type)){
|
|
|
|
|
|
|
|
|
|
}else if("税务筹划".equals(type)){
|
|
|
|
|
|
|
|
|
|
}else if("财产分配".equals(type)){
|
|
|
|
|
|
|
|
|
|
}else if("财产传承".equals(type)){
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//根据caseid和userId查询case_InsurancePlan表 如果不存在 则跳过 如果存在 则获取Analysis参数 如果不为null则不进行修改 后续不操作 如果参数字数大于20个 则Analysis_teacher_score获得1分 50 两分 否则0分 并设置综合规划成绩表 先判断成绩是否存在 存在则修改分数、不存在则新增
|
|
|
|
|
//根据caseid和userId查询case_InvestmentPlan表 如果不存在 则跳过 如果存在 则获取Analysis参数 如果不为null则不进行修改 后续不操作 如果参数字数大于20个 则Analysis_teacher_score获得1分 50 两分 否则0分 并设置综合规划成绩表 先判断成绩是否存在 存在则修改分数、不存在则新增
|
|
|
|
|
//根据caseid和userId查询case_tax_plan表 如果不存在 则跳过 如果存在 则获取Analysis参数 如果不为null则不进行修改 后续不操作 如果参数字数大于20个 则Analysis_teacher_score获得1分 50 两分 否则0分 并设置综合规划成绩表 先判断成绩是否存在 存在则修改分数、不存在则新增
|
|
|
|
|
//根据caseid和case_Distribution Of Property表(双参数) 如果不存在 则跳过 如果存在 则获取Analysis参数 如果不为null则不进行修改 后续不操作 如果参数字数大于20个 则Analysis_teacher_score获得1分 50 两分 否则0分 并设置综合规划成绩表 先判断成绩是否存在 存在则修改分数、不存在则新增
|
|
|
|
|
//根据caseid和case_heritage表(双参数) 如果不存在 则跳过 如果存在 则获取Analysis参数 如果不为null则不进行修改 后续不操作 如果参数字数大于20个 则Analysis_teacher_score获得1分 50 两分 否则0分 并设置综合规划成绩表 先判断成绩是否存在 存在则修改分数、不存在则新增
|
|
|
|
|
//生涯规划需要判断理财方案得分情况
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//计算理财方案
|
|
|
|
|
public BigDecimal getFinancialPlanningMoney(BigDecimal returnOnInvestment,BigDecimal disposableInput,BigDecimal monthlyInvestment,Integer regularYear){
|
|
|
|
|
// returnOnInvestment 预计投资收益率 r
|
|
|
|
|
// disposableInput 一次性投入金额 pv
|
|
|
|
|
// monthlyInvestment 每月定期投资金额 pmt
|
|
|
|
|
// regularYear 定期定额投资年份
|
|
|
|
|
Integer regularMonth = regularYear*12; //定期定额投资月份 n
|
|
|
|
|
//单笔投资的终值 FV=PV*(1+r)^n FV终值 PV一次性投入金额 r预计投资收益率 n定期定额投资月份
|
|
|
|
|
BigDecimal dbFV = disposableInput.multiply((BigDecimal.ONE.add(returnOnInvestment)).pow(regularMonth));
|
|
|
|
|
//普通年金的终值 FV=PMT*(((1+r)^n)-1)/r PMT 每月定期投资金额 r预计投资收益率 n定期定额投资月份
|
|
|
|
|
BigDecimal ptFV=monthlyInvestment.divide(((((BigDecimal.ONE.add(returnOnInvestment)).pow(regularMonth)).subtract(BigDecimal.ONE)).divide(returnOnInvestment)));
|
|
|
|
|
BigDecimal answer=dbFV.add(ptFV);
|
|
|
|
|
return answer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//教师端 理论考核查询
|
|
|
|
|
@AnonymousAccess
|
|
|
|
|