diff --git a/src/main/java/com/sztzjy/money_management/controller/GradeController.java b/src/main/java/com/sztzjy/money_management/controller/GradeController.java index e143fb0..55b1a33 100644 --- a/src/main/java/com/sztzjy/money_management/controller/GradeController.java +++ b/src/main/java/com/sztzjy/money_management/controller/GradeController.java @@ -108,7 +108,7 @@ public class GradeController { if (studentScoreWeights.isEmpty()) { //设置默认权重与计分规则 //计分规则 studentScoreWeight.setSummaryOfKnowledgeScore(BigDecimal.valueOf(20)); - studentScoreWeight.setResourceLearningScore(BigDecimal.valueOf(2)); + studentScoreWeight.setResourceLearningScore(BigDecimal.valueOf(20)); studentScoreWeight.setLearningAssessmentScore(BigDecimal.valueOf(10)); studentScoreWeight.setExperimentalTrainingScore(BigDecimal.valueOf(10)); @@ -291,7 +291,7 @@ public class GradeController { for (int i = 0; i < clientCaseList.size(); i++) { StuClientCaseScoreDto clientCase = clientCaseList.get(i); BigDecimal trainingTime = clientCase.getTrainingTime() == null ? BigDecimal.ZERO : clientCase.getTrainingTime(); - BigDecimal totalScore = clientCase.getTrainingTotalScore() == null ? BigDecimal.ZERO : clientCase.getTrainingTotalScore(); + BigDecimal totalScore = clientCase.getTrainingTotalScore() == null ? BigDecimal.ZERO : clientCase.getTrainingScore(); clientCaseTrainingTime = clientCaseTrainingTime.add(trainingTime); clientCaseTotalTrainingScore = clientCaseTotalTrainingScore.add(totalScore); } @@ -993,25 +993,32 @@ public class GradeController { } } //设置理财方案分数 先获取案例题答案的分数 再获取学生理财方案的四个对象 按照公式对比大小 如果大于老师的答案 则给两分 低于给0分 - CaseLifeEducationPlanExample teaExample = new CaseLifeEducationPlanExample(); - teaExample.createCriteria().andCaseidEqualTo(caseid).andIsAnswerEqualTo("题目答案"); - List teaCasePlanList = caseLifeEducationPlanMapper.selectByExample(teaExample); - CaseLifeEducationPlan teaPlan = teaCasePlanList.get(0); - BigDecimal teaFinancialPlanningMoney = new BigDecimal(teaPlan.getFinancialPlan()); + BigDecimal teaFinancialPlanningMoney = new BigDecimal(0); + String financialPlan = stuPlan.getFinancialPlan(); + try { + if (financialPlan != null) { + teaFinancialPlanningMoney = new BigDecimal(financialPlan); + } + } catch (Exception e) { + // 可以选择设置一个默认值或者进行其他错误处理 + teaFinancialPlanningMoney = new BigDecimal("0"); // 或者其他适当的默认值 + } BigDecimal returnOnInvestment = stuPlan.getReturnOnInvestment(); BigDecimal disposableInput = stuPlan.getDisposableInput(); BigDecimal monthlyInvestment = stuPlan.getMonthlyInvestment(); Integer regularYear = stuPlan.getRegularYear(); //定期定额投资年限 n - BigDecimal stuFinancialPlanningMoney = getFinancialPlanningMoney(returnOnInvestment, disposableInput, monthlyInvestment, regularYear); BigDecimal teacherFinancialPlanningScore = BigDecimal.ZERO; //老师理财分数 用于保存到综合规划成绩表中 - if (stuFinancialPlanningMoney.compareTo(teaFinancialPlanningMoney) >= 0) { - teacherFinancialPlanningScore = BigDecimal.valueOf(2); - stuPlan.setCaseTeacherScore(teacherFinancialPlanningScore); - } else { - stuPlan.setCaseTeacherScore(teacherFinancialPlanningScore); - } - + try { + BigDecimal stuFinancialPlanningMoney = getFinancialPlanningMoney(returnOnInvestment, disposableInput, monthlyInvestment, regularYear); + if (stuFinancialPlanningMoney.compareTo(teaFinancialPlanningMoney) >= 0) { + teacherFinancialPlanningScore = BigDecimal.valueOf(2); + stuPlan.setCaseTeacherScore(teacherFinancialPlanningScore); + } else { + stuPlan.setCaseTeacherScore(teacherFinancialPlanningScore); + } + } catch (Exception e) { + } caseLifeEducationPlanMapper.updateByPrimaryKey(stuPlan); //并设置综合规划成绩表 修改老师评分分数 SynthesisPlanScoreExample scoreExample = new SynthesisPlanScoreExample(); @@ -1064,25 +1071,32 @@ public class GradeController { } } //设置理财方案分数 先获取案例题答案的分数 再获取学生理财方案的四个对象 按照公式对比大小 如果大于老师的答案 则给两分 低于给0分 - CaseConsumptionPlanExample teaExample = new CaseConsumptionPlanExample(); - teaExample.createCriteria().andCaseIdEqualTo(caseid).andIsAnswerEqualTo("题目答案"); - List teaCasePlanList = caseConsumptionPlanMapper.selectByExample(teaExample); - CaseConsumptionPlan teaPlan = teaCasePlanList.get(0); - BigDecimal teaFinancialPlanningMoney = new BigDecimal(teaPlan.getFinancialPlan()); + BigDecimal teaFinancialPlanningMoney = new BigDecimal(0); + String financialPlan = stuPlan.getFinancialPlan(); + try { + if (financialPlan != null) { + teaFinancialPlanningMoney = new BigDecimal(financialPlan); + } + } catch (Exception e) { + // 可以选择设置一个默认值或者进行其他错误处理 + teaFinancialPlanningMoney = new BigDecimal("0"); // 或者其他适当的默认值 + } BigDecimal returnOnInvestment = stuPlan.getReturnOnInvestment(); BigDecimal disposableInput = stuPlan.getDisposableInput(); BigDecimal monthlyInvestment = stuPlan.getMonthlyInvestment(); Integer regularYear = stuPlan.getRegularYear(); //定期定额投资年限 n - BigDecimal stuFinancialPlanningMoney = getFinancialPlanningMoney(returnOnInvestment, disposableInput, monthlyInvestment, regularYear); BigDecimal teacherFinancialPlanningScore = BigDecimal.ZERO; //老师理财分数 用于保存到综合规划成绩表中 - if (stuFinancialPlanningMoney.compareTo(teaFinancialPlanningMoney) >= 0) { - teacherFinancialPlanningScore = BigDecimal.valueOf(2); - stuPlan.setCaseTeacherScore(teacherFinancialPlanningScore); - } else { - stuPlan.setCaseTeacherScore(teacherFinancialPlanningScore); - } - + try { + BigDecimal stuFinancialPlanningMoney = getFinancialPlanningMoney(returnOnInvestment, disposableInput, monthlyInvestment, regularYear); + if (stuFinancialPlanningMoney.compareTo(teaFinancialPlanningMoney) >= 0) { + teacherFinancialPlanningScore = BigDecimal.valueOf(2); + stuPlan.setCaseTeacherScore(teacherFinancialPlanningScore); + } else { + stuPlan.setCaseTeacherScore(teacherFinancialPlanningScore); + } + } catch (Exception e) { + } caseConsumptionPlanMapper.updateByPrimaryKey(stuPlan); //并设置综合规划成绩表 修改老师评分分数 SynthesisPlanScoreExample scoreExample = new SynthesisPlanScoreExample(); @@ -1135,22 +1149,31 @@ public class GradeController { } } //设置理财方案分数 先获取案例题答案的分数 再获取学生理财方案的四个对象 按照公式对比大小 如果大于老师的答案 则给两分 低于给0分 - CaseStartAnUndertakingPlanExample teaExample = new CaseStartAnUndertakingPlanExample(); - teaExample.createCriteria().andCaseidEqualTo(caseid).andIsAnswerEqualTo("题目答案"); - List teaCasePlanList = caseStartAnUndertakingPlanMapper.selectByExample(teaExample); - CaseStartAnUndertakingPlan teaPlan = teaCasePlanList.get(0); - BigDecimal teaFinancialPlanningMoney = new BigDecimal(teaPlan.getFinancialPlan()); + BigDecimal teaFinancialPlanningMoney = new BigDecimal(0); + String financialPlan = stuPlan.getFinancialPlan(); + try { + if (financialPlan != null) { + teaFinancialPlanningMoney = new BigDecimal(financialPlan); + } + } catch (Exception e) { + // 可以选择设置一个默认值或者进行其他错误处理 + teaFinancialPlanningMoney = new BigDecimal("0"); // 或者其他适当的默认值 + } BigDecimal returnOnInvestment = stuPlan.getReturnOnInvestmentRate(); BigDecimal disposableInput = stuPlan.getDisposableInput(); BigDecimal monthlyInvestment = stuPlan.getMonthlyInvestment(); Integer regularYear = stuPlan.getRegularYear(); //定期定额投资年限 n - BigDecimal stuFinancialPlanningMoney = getFinancialPlanningMoney(returnOnInvestment, disposableInput, monthlyInvestment, regularYear); BigDecimal teacherFinancialPlanningScore = BigDecimal.ZERO; //老师理财分数 用于保存到综合规划成绩表中 - if (stuFinancialPlanningMoney.compareTo(teaFinancialPlanningMoney) >= 0) { - teacherFinancialPlanningScore = BigDecimal.valueOf(2); - stuPlan.setCaseTeacherScore(teacherFinancialPlanningScore); - } else { - stuPlan.setCaseTeacherScore(teacherFinancialPlanningScore); + try { + BigDecimal stuFinancialPlanningMoney = getFinancialPlanningMoney(returnOnInvestment, disposableInput, monthlyInvestment, regularYear); + if (stuFinancialPlanningMoney.compareTo(teaFinancialPlanningMoney) >= 0) { + teacherFinancialPlanningScore = BigDecimal.valueOf(2); + stuPlan.setCaseTeacherScore(teacherFinancialPlanningScore); + } else { + stuPlan.setCaseTeacherScore(teacherFinancialPlanningScore); + } + } catch (Exception e) { + } @@ -1206,24 +1229,32 @@ public class GradeController { } } //设置理财方案分数 先获取案例题答案的分数 再获取学生理财方案的四个对象 按照公式对比大小 如果大于老师的答案 则给两分 低于给0分 - CaseRetirementPlanExample teaExample = new CaseRetirementPlanExample(); - teaExample.createCriteria().andCaseidEqualTo(caseid).andIsAnswerEqualTo("题目答案"); - List teaCasePlanList = caseRetirementPlanMapper.selectByExample(teaExample); - CaseRetirementPlan teaPlan = teaCasePlanList.get(0); - BigDecimal teaFinancialPlanningMoney = new BigDecimal(teaPlan.getFinancialPlan()); + BigDecimal teaFinancialPlanningMoney = new BigDecimal(0); + String financialPlan = stuPlan.getFinancialPlan(); + try { + if (financialPlan != null) { + teaFinancialPlanningMoney = new BigDecimal(financialPlan); + } + } catch (Exception e) { + // 可以选择设置一个默认值或者进行其他错误处理 + teaFinancialPlanningMoney = new BigDecimal("0"); // 或者其他适当的默认值 + } BigDecimal returnOnInvestment = stuPlan.getReturnOnInvestmentRate(); BigDecimal disposableInput = stuPlan.getDisposableInput(); BigDecimal monthlyInvestment = stuPlan.getMonthlyInvestment(); Integer regularYear = stuPlan.getRegularYear(); //定期定额投资年限 n - BigDecimal stuFinancialPlanningMoney = getFinancialPlanningMoney(returnOnInvestment, disposableInput, monthlyInvestment, regularYear); BigDecimal teacherFinancialPlanningScore = BigDecimal.ZERO; //老师理财分数 用于保存到综合规划成绩表中 - if (stuFinancialPlanningMoney.compareTo(teaFinancialPlanningMoney) >= 0) { - teacherFinancialPlanningScore = BigDecimal.valueOf(2); - stuPlan.setCaseTeacherScore(teacherFinancialPlanningScore); - } else { - stuPlan.setCaseTeacherScore(teacherFinancialPlanningScore); - } + try { + BigDecimal stuFinancialPlanningMoney = getFinancialPlanningMoney(returnOnInvestment, disposableInput, monthlyInvestment, regularYear); + if (stuFinancialPlanningMoney.compareTo(teaFinancialPlanningMoney) >= 0) { + teacherFinancialPlanningScore = BigDecimal.valueOf(2); + stuPlan.setCaseTeacherScore(teacherFinancialPlanningScore); + } else { + stuPlan.setCaseTeacherScore(teacherFinancialPlanningScore); + } + } catch (Exception e) { + } caseRetirementPlanMapper.updateByPrimaryKey(stuPlan); //并设置综合规划成绩表 修改老师评分分数 diff --git a/src/main/java/com/sztzjy/money_management/service/TrainingService.java b/src/main/java/com/sztzjy/money_management/service/TrainingService.java index c49b3d4..dc39921 100644 --- a/src/main/java/com/sztzjy/money_management/service/TrainingService.java +++ b/src/main/java/com/sztzjy/money_management/service/TrainingService.java @@ -19,4 +19,5 @@ public interface TrainingService { List getChapterNameList(); Map getStudentScoreWeightMap(String schoolId); + } diff --git a/src/main/java/com/sztzjy/money_management/service/impl/TrainingServiceImpl.java b/src/main/java/com/sztzjy/money_management/service/impl/TrainingServiceImpl.java index 26cdca6..63dbc16 100644 --- a/src/main/java/com/sztzjy/money_management/service/impl/TrainingServiceImpl.java +++ b/src/main/java/com/sztzjy/money_management/service/impl/TrainingServiceImpl.java @@ -131,6 +131,7 @@ public class TrainingServiceImpl implements TrainingService { } //获取客户案例权重对象 map("风险测评" 权重数值) + @Override public Map getClientWeight(String schoolId){ Map map=new HashMap<>(); ClientWeight clientWeight = clientWeightMapper.selectByPrimaryKey(schoolId);