diff --git a/src/main/java/com/sztzjy/money_management/controller/TopicController.java b/src/main/java/com/sztzjy/money_management/controller/TopicController.java index 43daccc..6f496d7 100644 --- a/src/main/java/com/sztzjy/money_management/controller/TopicController.java +++ b/src/main/java/com/sztzjy/money_management/controller/TopicController.java @@ -77,6 +77,13 @@ public class TopicController { if (StringUtils.isBlank(objectiveQuestion.getSource())) { return new ResultEntity<>(HttpStatus.BAD_REQUEST, "题目来源为999999999/学校ID!"); } + String answer = objectiveQuestion.getAnswer(); + if (answer.equals("A")||answer.equals("对")) { + objectiveQuestion.setAnswer("正确"); + } + if (answer.equals("B")||answer.equals("错")) { + objectiveQuestion.setAnswer("错误"); + } objectiveQuestion.setObjectiveId(IdUtil.randomUUID()); objectiveQuestionMapper.insert(objectiveQuestion); return new ResultEntity(HttpStatus.OK, "新增成功!"); diff --git a/src/main/java/com/sztzjy/money_management/entity/dto/StuTheoryTestDto.java b/src/main/java/com/sztzjy/money_management/entity/dto/StuTheoryTestDto.java index ae9df00..bf8cff0 100644 --- a/src/main/java/com/sztzjy/money_management/entity/dto/StuTheoryTestDto.java +++ b/src/main/java/com/sztzjy/money_management/entity/dto/StuTheoryTestDto.java @@ -26,13 +26,13 @@ public class StuTheoryTestDto { Boolean answered; @ApiModelProperty("单选题学生答案集合") - List singleStuAnswer; + String singleStuAnswer; @ApiModelProperty("多选题学生答案集合 ABC AB") - List multipleStuAnswer; + String multipleStuAnswer; @ApiModelProperty("判断题学生答案集合true false") - List judgeStuAnswer; + String judgeStuAnswer; @ApiModelProperty("单选错误题目id集合") List singleErrorIds; diff --git a/src/main/java/com/sztzjy/money_management/service/impl/ObjectiveQuestionServiceImpl.java b/src/main/java/com/sztzjy/money_management/service/impl/ObjectiveQuestionServiceImpl.java index 4bbd574..fe66dd1 100644 --- a/src/main/java/com/sztzjy/money_management/service/impl/ObjectiveQuestionServiceImpl.java +++ b/src/main/java/com/sztzjy/money_management/service/impl/ObjectiveQuestionServiceImpl.java @@ -87,11 +87,11 @@ public class ObjectiveQuestionServiceImpl implements ObjectiveQuestionService { if (type.equals("判断题") || type.equals("判断")) { obj.setType(2); - if (answer.equals("A")) { - obj.setAnswer("对"); + if (answer.equals("A")||answer.equals("对")) { + obj.setAnswer("正确"); } - if (answer.equals("B")) { - obj.setAnswer("错"); + if (answer.equals("B")||answer.equals("错")) { + obj.setAnswer("错误"); } } obj.setSource(source); diff --git a/src/main/java/com/sztzjy/money_management/service/impl/SynthesisPlanServiceImpl.java b/src/main/java/com/sztzjy/money_management/service/impl/SynthesisPlanServiceImpl.java index 15ce99b..b9aaed5 100644 --- a/src/main/java/com/sztzjy/money_management/service/impl/SynthesisPlanServiceImpl.java +++ b/src/main/java/com/sztzjy/money_management/service/impl/SynthesisPlanServiceImpl.java @@ -5,6 +5,7 @@ import com.sztzjy.money_management.entity.*; import com.sztzjy.money_management.mapper.*; import com.sztzjy.money_management.service.SynthesisPlanService; import com.sztzjy.money_management.util.ResultEntity; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Service; @@ -595,18 +596,17 @@ public class SynthesisPlanServiceImpl implements SynthesisPlanService { String caseScore = convertToString(scoreGetter.apply(caseHeritageWithBLOB)); String stuScore = convertToString(scoreGetter.apply(stuCaseHeritageWithBLOB)); - SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); - synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); - synthesisPlanScore.setCaseid(caseID); - synthesisPlanScore.setUserid(userId); - synthesisPlanScore.setManageMoneyMattersType("财产传承"); - synthesisPlanScore.setTestCenter(testCenter); - // 检查并设置 caseAnswer 和 stuAnswer 字段 - synthesisPlanScore.setCaseAnswer(caseScore != null ? String.valueOf(caseScore) : null); - synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); - if (testCenter.equals("财产传承规划分析") || testCenter.equals("财务分析")) { - - } else { + if (StringUtils.isNotBlank(caseScore) + && !testCenter.equals("财产传承规划分析") && !testCenter.equals("财务分析")) { + SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); + synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); + synthesisPlanScore.setCaseid(caseID); + synthesisPlanScore.setUserid(userId); + synthesisPlanScore.setManageMoneyMattersType("财产传承"); + synthesisPlanScore.setTestCenter(testCenter); + // 检查并设置 caseAnswer 和 stuAnswer 字段 + synthesisPlanScore.setCaseAnswer(caseScore); + synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); if (stuScore == null || !stuScore.equals(caseScore)) { synthesisPlanScore.setStatus("答错"); synthesisPlanScore.setScore(BigDecimal.ZERO); @@ -614,8 +614,20 @@ public class SynthesisPlanServiceImpl implements SynthesisPlanService { synthesisPlanScore.setStatus("答对"); synthesisPlanScore.setScore(BigDecimal.valueOf(2)); } + list.add(synthesisPlanScore); + } + if (testCenter.equals("财产传承规划分析") || testCenter.equals("财务分析")) { + SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); + synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); + synthesisPlanScore.setCaseid(caseID); + synthesisPlanScore.setUserid(userId); + synthesisPlanScore.setManageMoneyMattersType("财产传承"); + synthesisPlanScore.setTestCenter(testCenter); + // 检查并设置 caseAnswer 和 stuAnswer 字段 + synthesisPlanScore.setCaseAnswer(caseScore != null ? String.valueOf(caseScore) : null); + synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); + list.add(synthesisPlanScore); } - list.add(synthesisPlanScore); } } } @@ -682,19 +694,17 @@ public class SynthesisPlanServiceImpl implements SynthesisPlanService { String caseScore = convertToString(scoreGetter.apply(caseTaxPlan)); String stuScore = convertToString(scoreGetter.apply(stuCaseTaxPlan)); - SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); - synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); - synthesisPlanScore.setCaseid(caseID); - synthesisPlanScore.setUserid(userId); - synthesisPlanScore.setManageMoneyMattersType("税务筹划"); - synthesisPlanScore.setTestCenter(testCenter); - // 检查并设置 caseAnswer 和 stuAnswer 字段 - synthesisPlanScore.setCaseAnswer(caseScore != null ? String.valueOf(caseScore) : null); - synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); - - if (testCenter.equals("税务筹划分析")) { + if (StringUtils.isNotBlank(caseScore) && !testCenter.equals("税务筹划分析")) { + SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); + synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); + synthesisPlanScore.setCaseid(caseID); + synthesisPlanScore.setUserid(userId); + synthesisPlanScore.setManageMoneyMattersType("税务筹划"); + synthesisPlanScore.setTestCenter(testCenter); + // 检查并设置 caseAnswer 和 stuAnswer 字段 + synthesisPlanScore.setCaseAnswer(caseScore); + synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); - } else { if (stuScore == null || !stuScore.equals(caseScore)) { synthesisPlanScore.setStatus("答错"); synthesisPlanScore.setScore(BigDecimal.ZERO); @@ -702,8 +712,21 @@ public class SynthesisPlanServiceImpl implements SynthesisPlanService { synthesisPlanScore.setStatus("答对"); synthesisPlanScore.setScore(BigDecimal.valueOf(2)); } + list.add(synthesisPlanScore); + } + + if (testCenter.equals("税务筹划分析")) { + SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); + synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); + synthesisPlanScore.setCaseid(caseID); + synthesisPlanScore.setUserid(userId); + synthesisPlanScore.setManageMoneyMattersType("税务筹划"); + synthesisPlanScore.setTestCenter(testCenter); + // 检查并设置 caseAnswer 和 stuAnswer 字段 + synthesisPlanScore.setCaseAnswer(caseScore); + synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); + list.add(synthesisPlanScore); } - list.add(synthesisPlanScore); } } @@ -730,19 +753,16 @@ public class SynthesisPlanServiceImpl implements SynthesisPlanService { String caseScore = convertToString(scoreGetter.apply(caseInvestmentPlan)); String stuScore = convertToString(scoreGetter.apply(stuCaseInvestmentPlan)); - SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); - synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); - synthesisPlanScore.setCaseid(caseID); - synthesisPlanScore.setUserid(userId); - synthesisPlanScore.setManageMoneyMattersType("投资规划"); - synthesisPlanScore.setTestCenter(testCenter); - // 检查并设置 caseAnswer 和 stuAnswer 字段 - synthesisPlanScore.setCaseAnswer(caseScore != null ? String.valueOf(caseScore) : null); - synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); - - if (testCenter.equals("投资规划分析")) { - - } else { + if (StringUtils.isNotBlank(caseScore) && !testCenter.equals("投资规划分析")) { + SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); + synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); + synthesisPlanScore.setCaseid(caseID); + synthesisPlanScore.setUserid(userId); + synthesisPlanScore.setManageMoneyMattersType("投资规划"); + synthesisPlanScore.setTestCenter(testCenter); + // 检查并设置 caseAnswer 和 stuAnswer 字段 + synthesisPlanScore.setCaseAnswer(caseScore); + synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); if (stuScore == null || !stuScore.equals(caseScore)) { synthesisPlanScore.setStatus("答错"); synthesisPlanScore.setScore(BigDecimal.ZERO); @@ -750,8 +770,21 @@ public class SynthesisPlanServiceImpl implements SynthesisPlanService { synthesisPlanScore.setStatus("答对"); synthesisPlanScore.setScore(BigDecimal.valueOf(2)); } + list.add(synthesisPlanScore); + } + + if (testCenter.equals("投资规划分析")) { + SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); + synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); + synthesisPlanScore.setCaseid(caseID); + synthesisPlanScore.setUserid(userId); + synthesisPlanScore.setManageMoneyMattersType("投资规划"); + synthesisPlanScore.setTestCenter(testCenter); + // 检查并设置 caseAnswer 和 stuAnswer 字段 + synthesisPlanScore.setCaseAnswer(caseScore != null ? String.valueOf(caseScore) : null); + synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); + list.add(synthesisPlanScore); } - list.add(synthesisPlanScore); } } } @@ -819,20 +852,19 @@ public class SynthesisPlanServiceImpl implements SynthesisPlanService { String caseScore = convertToString(scoreGetter.apply(caseInsurancePlan)); String stuScore = convertToString(scoreGetter.apply(stuCaseInsurancePlan)); - SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); - synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); - synthesisPlanScore.setCaseid(caseID); - synthesisPlanScore.setUserid(userId); - synthesisPlanScore.setManageMoneyMattersType("生涯规划-保险规划"); - synthesisPlanScore.setTestCenter(testCenter); - // 检查并设置 caseAnswer 和 stuAnswer 字段 - synthesisPlanScore.setCaseAnswer(caseScore != null ? String.valueOf(caseScore) : null); - synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); - - if (testCenter.equals("寿险需求测算方法选择-遗属需求法-保险规划分析") - || testCenter.equals("寿险需求测算方法选择-生命价值法-保险规划分析")) { + if (StringUtils.isNotBlank(caseScore) + && !testCenter.equals("寿险需求测算方法选择-遗属需求法-保险规划分析") + && !testCenter.equals("寿险需求测算方法选择-生命价值法-保险规划分析")) { + SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); + synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); + synthesisPlanScore.setCaseid(caseID); + synthesisPlanScore.setUserid(userId); + synthesisPlanScore.setManageMoneyMattersType("生涯规划-保险规划"); + synthesisPlanScore.setTestCenter(testCenter); + // 检查并设置 caseAnswer 和 stuAnswer 字段 + synthesisPlanScore.setCaseAnswer(caseScore); + synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); - } else { if (stuScore == null || !stuScore.equals(caseScore)) { synthesisPlanScore.setStatus("答错"); synthesisPlanScore.setScore(BigDecimal.ZERO); @@ -840,9 +872,23 @@ public class SynthesisPlanServiceImpl implements SynthesisPlanService { synthesisPlanScore.setStatus("答对"); synthesisPlanScore.setScore(BigDecimal.valueOf(2)); } + list.add(synthesisPlanScore); + } + if (testCenter.equals("寿险需求测算方法选择-遗属需求法-保险规划分析") + || testCenter.equals("寿险需求测算方法选择-生命价值法-保险规划分析")) { + SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); + synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); + synthesisPlanScore.setCaseid(caseID); + synthesisPlanScore.setUserid(userId); + synthesisPlanScore.setManageMoneyMattersType("生涯规划-保险规划"); + synthesisPlanScore.setTestCenter(testCenter); + // 检查并设置 caseAnswer 和 stuAnswer 字段 + synthesisPlanScore.setCaseAnswer(caseScore != null ? String.valueOf(caseScore) : null); + synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); + list.add(synthesisPlanScore); } - list.add(synthesisPlanScore); } + } } @@ -878,19 +924,19 @@ public class SynthesisPlanServiceImpl implements SynthesisPlanService { String caseScore = convertToString(scoreGetter.apply(caseRetirementPlan)); String stuScore = convertToString(scoreGetter.apply(stuCaseRetirementPlan)); - SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); - synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); - synthesisPlanScore.setCaseid(caseID); - synthesisPlanScore.setUserid(userId); - synthesisPlanScore.setManageMoneyMattersType("生涯规划-退休规划"); - synthesisPlanScore.setTestCenter(testCenter); - // 检查并设置 caseAnswer 和 stuAnswer 字段 - synthesisPlanScore.setCaseAnswer(caseScore != null ? String.valueOf(caseScore) : null); - synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); + if (StringUtils.isNotBlank(caseScore) + && !testCenter.equals("理财方案") && !testCenter.equals("退休规划分析")) { + SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); + synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); + synthesisPlanScore.setCaseid(caseID); + synthesisPlanScore.setUserid(userId); + synthesisPlanScore.setManageMoneyMattersType("生涯规划-退休规划"); + synthesisPlanScore.setTestCenter(testCenter); + // 检查并设置 caseAnswer 和 stuAnswer 字段 + synthesisPlanScore.setCaseAnswer(caseScore); + synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); - if (testCenter.equals("理财方案") || testCenter.equals("退休规划分析")) { - } else { if (stuScore == null || !stuScore.equals(caseScore)) { synthesisPlanScore.setStatus("答错"); synthesisPlanScore.setScore(BigDecimal.ZERO); @@ -898,8 +944,20 @@ public class SynthesisPlanServiceImpl implements SynthesisPlanService { synthesisPlanScore.setStatus("答对"); synthesisPlanScore.setScore(BigDecimal.valueOf(2)); } + list.add(synthesisPlanScore); + } + if (testCenter.equals("理财方案") || testCenter.equals("退休规划分析")) { + SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); + synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); + synthesisPlanScore.setCaseid(caseID); + synthesisPlanScore.setUserid(userId); + synthesisPlanScore.setManageMoneyMattersType("生涯规划-退休规划"); + synthesisPlanScore.setTestCenter(testCenter); + // 检查并设置 caseAnswer 和 stuAnswer 字段 + synthesisPlanScore.setCaseAnswer(caseScore != null ? String.valueOf(caseScore) : null); + synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); + list.add(synthesisPlanScore); } - list.add(synthesisPlanScore); } } } @@ -925,19 +983,18 @@ public class SynthesisPlanServiceImpl implements SynthesisPlanService { String caseScore = convertToString(scoreGetter.apply(caseStartAnUndertakingPlan)); String stuScore = convertToString(scoreGetter.apply(stuCaseStartAnUndertakingPlan)); - SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); - synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); - synthesisPlanScore.setCaseid(caseID); - synthesisPlanScore.setUserid(userId); - synthesisPlanScore.setManageMoneyMattersType("生涯规划-创业规划"); - synthesisPlanScore.setTestCenter(testCenter); - // 检查并设置 caseAnswer 和 stuAnswer 字段 - synthesisPlanScore.setCaseAnswer(caseScore != null ? String.valueOf(caseScore) : null); - synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); - - if (testCenter.equals("理财方案") || testCenter.equals("创业规划分析")) { + if (StringUtils.isNotBlank(caseScore) + && !testCenter.equals("理财方案") && !testCenter.equals("创业规划分析")) { + SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); + synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); + synthesisPlanScore.setCaseid(caseID); + synthesisPlanScore.setUserid(userId); + synthesisPlanScore.setManageMoneyMattersType("生涯规划-创业规划"); + synthesisPlanScore.setTestCenter(testCenter); + // 检查并设置 caseAnswer 和 stuAnswer 字段 + synthesisPlanScore.setCaseAnswer(caseScore); + synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); - } else { if (stuScore == null || !stuScore.equals(caseScore)) { synthesisPlanScore.setStatus("答错"); synthesisPlanScore.setScore(BigDecimal.ZERO); @@ -945,8 +1002,21 @@ public class SynthesisPlanServiceImpl implements SynthesisPlanService { synthesisPlanScore.setStatus("答对"); synthesisPlanScore.setScore(BigDecimal.valueOf(2)); } + list.add(synthesisPlanScore); + } + + if (testCenter.equals("理财方案") || testCenter.equals("创业规划分析")) { + SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); + synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); + synthesisPlanScore.setCaseid(caseID); + synthesisPlanScore.setUserid(userId); + synthesisPlanScore.setManageMoneyMattersType("生涯规划-创业规划"); + synthesisPlanScore.setTestCenter(testCenter); + // 检查并设置 caseAnswer 和 stuAnswer 字段 + synthesisPlanScore.setCaseAnswer(caseScore); + synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); + list.add(synthesisPlanScore); } - list.add(synthesisPlanScore); } } } @@ -983,19 +1053,18 @@ public class SynthesisPlanServiceImpl implements SynthesisPlanService { String caseScore = convertToString(scoreGetter.apply(caseConsumptionPlan)); String stuScore = convertToString(scoreGetter.apply(stuCaseConsumptionPlan)); - SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); - synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); - synthesisPlanScore.setCaseid(caseID); - synthesisPlanScore.setUserid(userId); - synthesisPlanScore.setManageMoneyMattersType("生涯规划-消费规划"); - synthesisPlanScore.setTestCenter(testCenter); - // 检查并设置 caseAnswer 和 stuAnswer 字段 - synthesisPlanScore.setCaseAnswer(caseScore != null ? String.valueOf(caseScore) : null); - synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); - - if (testCenter.equals("理财方案") || testCenter.equals("消费规划分析")) { + if (StringUtils.isNotBlank(caseScore) + && !testCenter.equals("理财方案") && !testCenter.equals("消费规划分析")) { + SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); + synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); + synthesisPlanScore.setCaseid(caseID); + synthesisPlanScore.setUserid(userId); + synthesisPlanScore.setManageMoneyMattersType("生涯规划-消费规划"); + synthesisPlanScore.setTestCenter(testCenter); + // 检查并设置 caseAnswer 和 stuAnswer 字段 + synthesisPlanScore.setCaseAnswer(caseScore); + synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); - } else { if (stuScore == null || !stuScore.equals(caseScore)) { synthesisPlanScore.setStatus("答错"); synthesisPlanScore.setScore(BigDecimal.ZERO); @@ -1003,10 +1072,24 @@ public class SynthesisPlanServiceImpl implements SynthesisPlanService { synthesisPlanScore.setStatus("答对"); synthesisPlanScore.setScore(BigDecimal.valueOf(2)); } + list.add(synthesisPlanScore); + } + + if (testCenter.equals("理财方案") || testCenter.equals("消费规划分析")) { + SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); + synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); + synthesisPlanScore.setCaseid(caseID); + synthesisPlanScore.setUserid(userId); + synthesisPlanScore.setManageMoneyMattersType("生涯规划-消费规划"); + synthesisPlanScore.setTestCenter(testCenter); + // 检查并设置 caseAnswer 和 stuAnswer 字段 + synthesisPlanScore.setCaseAnswer(caseScore); + synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); + list.add(synthesisPlanScore); } - list.add(synthesisPlanScore); } } + } private void caseLifeEducationPlans(String userId, String @@ -1052,19 +1135,19 @@ public class SynthesisPlanServiceImpl implements SynthesisPlanService { String caseScore = convertToString(scoreGetter.apply(caseLifeEducationPlan)); String stuScore = convertToString(scoreGetter.apply(stuCaseLifeEducationPlan)); - SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); - synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); - synthesisPlanScore.setCaseid(caseID); - synthesisPlanScore.setUserid(userId); - synthesisPlanScore.setManageMoneyMattersType("生涯规划-教育规划"); - synthesisPlanScore.setTestCenter(testCenter); - // 检查并设置 caseAnswer 和 stuAnswer 字段 - synthesisPlanScore.setCaseAnswer(caseScore != null ? String.valueOf(caseScore) : null); - synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); - - if (testCenter.equals("理财方案") || testCenter.equals("教育规划分析")) { - } else { + if (StringUtils.isNotBlank(caseScore) + && !testCenter.equals("理财方案") + && !testCenter.equals("教育规划分析")) { + SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); + synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); + synthesisPlanScore.setCaseid(caseID); + synthesisPlanScore.setUserid(userId); + synthesisPlanScore.setManageMoneyMattersType("生涯规划-教育规划"); + synthesisPlanScore.setTestCenter(testCenter); + // 检查并设置 caseAnswer 和 stuAnswer 字段 + synthesisPlanScore.setCaseAnswer(caseScore); + synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); if (stuScore == null || !stuScore.equals(caseScore)) { synthesisPlanScore.setStatus("答错"); synthesisPlanScore.setScore(BigDecimal.ZERO); @@ -1072,8 +1155,22 @@ public class SynthesisPlanServiceImpl implements SynthesisPlanService { synthesisPlanScore.setStatus("答对"); synthesisPlanScore.setScore(BigDecimal.valueOf(2)); } + list.add(synthesisPlanScore); + } + + if (testCenter.equals("理财方案") || + testCenter.equals("教育规划分析")) { + SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); + synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); + synthesisPlanScore.setCaseid(caseID); + synthesisPlanScore.setUserid(userId); + synthesisPlanScore.setManageMoneyMattersType("生涯规划-教育规划"); + synthesisPlanScore.setTestCenter(testCenter); + // 检查并设置 caseAnswer 和 stuAnswer 字段 + synthesisPlanScore.setCaseAnswer(caseScore); + synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); + list.add(synthesisPlanScore); } - list.add(synthesisPlanScore); } } } @@ -1095,20 +1192,16 @@ public class SynthesisPlanServiceImpl implements SynthesisPlanService { String caseScore = convertToString(scoreGetter.apply(caseCashPlan)); String stuScore = convertToString(scoreGetter.apply(stuCaseCashPlan)); - - SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); - synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); - synthesisPlanScore.setCaseid(caseID); - synthesisPlanScore.setUserid(userId); - synthesisPlanScore.setManageMoneyMattersType("现金规划"); - synthesisPlanScore.setTestCenter(testCenter); - // 检查并设置 caseAnswer 和 stuAnswer 字段 - synthesisPlanScore.setCaseAnswer(caseScore != null ? String.valueOf(caseScore) : null); - synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); - - if (testCenter.equals("现金规划分析")) { - - } else { + if (StringUtils.isNotBlank(caseScore) && !testCenter.equals("现金规划分析")) { + SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); + synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); + synthesisPlanScore.setCaseid(caseID); + synthesisPlanScore.setUserid(userId); + synthesisPlanScore.setManageMoneyMattersType("现金规划"); + synthesisPlanScore.setTestCenter(testCenter); + // 检查并设置 caseAnswer 和 stuAnswer 字段 + synthesisPlanScore.setCaseAnswer(caseScore); + synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); if (stuScore == null || !stuScore.equals(caseScore)) { synthesisPlanScore.setStatus("答错"); synthesisPlanScore.setScore(BigDecimal.ZERO); @@ -1116,8 +1209,20 @@ public class SynthesisPlanServiceImpl implements SynthesisPlanService { synthesisPlanScore.setStatus("答对"); synthesisPlanScore.setScore(BigDecimal.valueOf(2)); } + list.add(synthesisPlanScore); + } + + if (testCenter.equals("现金规划分析")) { + SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); + synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); + synthesisPlanScore.setCaseid(caseID); + synthesisPlanScore.setUserid(userId); + synthesisPlanScore.setManageMoneyMattersType("现金规划"); + synthesisPlanScore.setTestCenter(testCenter); + synthesisPlanScore.setCaseAnswer(caseScore); + synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); + list.add(synthesisPlanScore); } - list.add(synthesisPlanScore); } } } @@ -1150,16 +1255,18 @@ public class SynthesisPlanServiceImpl implements SynthesisPlanService { String caseScore = scoreGetter.apply(caseFinancialRatiosWithBLOBs); String stuScore = scoreGetter.apply(stuCaseFinancialRatiosWithBLOB); - SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); - synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); - synthesisPlanScore.setCaseid(caseID); - synthesisPlanScore.setUserid(userId); - synthesisPlanScore.setManageMoneyMattersType("财务分析-财务比例分析"); - synthesisPlanScore.setTestCenter(testCenter); - // 检查并设置 caseAnswer 和 stuAnswer 字段 - synthesisPlanScore.setCaseAnswer(caseScore != null ? String.valueOf(caseScore) : null); - synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); - list.add(synthesisPlanScore); + if (StringUtils.isNotBlank(caseScore)) { + SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); + synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); + synthesisPlanScore.setCaseid(caseID); + synthesisPlanScore.setUserid(userId); + synthesisPlanScore.setManageMoneyMattersType("财务分析-财务比例分析"); + synthesisPlanScore.setTestCenter(testCenter); + // 检查并设置 caseAnswer 和 stuAnswer 字段 + synthesisPlanScore.setCaseAnswer(caseScore); + synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); + list.add(synthesisPlanScore); + } } } } @@ -1186,25 +1293,26 @@ public class SynthesisPlanServiceImpl implements SynthesisPlanService { BigDecimal caseScore = scoreGetter.apply(caseCashFlow); BigDecimal stuScore = scoreGetter.apply(stuCaseCashFlow); - SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); - synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); - synthesisPlanScore.setCaseid(caseID); - synthesisPlanScore.setUserid(userId); - synthesisPlanScore.setManageMoneyMattersType("财务分析-现金流量表"); - synthesisPlanScore.setTestCenter(testCenter); - // 检查并设置 caseAnswer 和 stuAnswer 字段 - synthesisPlanScore.setCaseAnswer(caseScore != null ? String.valueOf(caseScore) : null); - synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); + if (caseScore != null) { + SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); + synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); + synthesisPlanScore.setCaseid(caseID); + synthesisPlanScore.setUserid(userId); + synthesisPlanScore.setManageMoneyMattersType("财务分析-现金流量表"); + synthesisPlanScore.setTestCenter(testCenter); + // 检查并设置 caseAnswer 和 stuAnswer 字段 + synthesisPlanScore.setCaseAnswer(String.valueOf(caseScore)); + synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); - if (stuScore == null || !stuScore.equals(caseScore)) { - synthesisPlanScore.setStatus("答错"); - synthesisPlanScore.setScore(BigDecimal.ZERO); - } else { - synthesisPlanScore.setStatus("答对"); - synthesisPlanScore.setScore(BigDecimal.valueOf(2)); + if (stuScore == null || !stuScore.equals(caseScore)) { + synthesisPlanScore.setStatus("答错"); + synthesisPlanScore.setScore(BigDecimal.ZERO); + } else { + synthesisPlanScore.setStatus("答对"); + synthesisPlanScore.setScore(BigDecimal.valueOf(2)); + } + list.add(synthesisPlanScore); } - - list.add(synthesisPlanScore); } } } @@ -1241,25 +1349,26 @@ public class SynthesisPlanServiceImpl implements SynthesisPlanService { BigDecimal caseScore = scoreGetter.apply(caseIncomeAndExpenses); BigDecimal stuScore = scoreGetter.apply(stuCaseRiskIncomeAndExpenses); - SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); - synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); - synthesisPlanScore.setCaseid(caseID); - synthesisPlanScore.setUserid(userId); - synthesisPlanScore.setManageMoneyMattersType("财务分析-收支储蓄表"); - synthesisPlanScore.setTestCenter(testCenter); - // 检查并设置 caseAnswer 和 stuAnswer 字段 - synthesisPlanScore.setCaseAnswer(caseScore != null ? String.valueOf(caseScore) : null); - synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); + if (caseScore != null) { + SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); + synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); + synthesisPlanScore.setCaseid(caseID); + synthesisPlanScore.setUserid(userId); + synthesisPlanScore.setManageMoneyMattersType("财务分析-收支储蓄表"); + synthesisPlanScore.setTestCenter(testCenter); + // 检查并设置 caseAnswer 和 stuAnswer 字段 + synthesisPlanScore.setCaseAnswer(String.valueOf(caseScore)); + synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); - if (stuScore == null || !stuScore.equals(caseScore)) { - synthesisPlanScore.setStatus("答错"); - synthesisPlanScore.setScore(BigDecimal.ZERO); - } else { - synthesisPlanScore.setStatus("答对"); - synthesisPlanScore.setScore(BigDecimal.valueOf(2)); + if (stuScore == null || !stuScore.equals(caseScore)) { + synthesisPlanScore.setStatus("答错"); + synthesisPlanScore.setScore(BigDecimal.ZERO); + } else { + synthesisPlanScore.setStatus("答对"); + synthesisPlanScore.setScore(BigDecimal.valueOf(2)); + } + list.add(synthesisPlanScore); } - - list.add(synthesisPlanScore); } } } @@ -1309,24 +1418,26 @@ public class SynthesisPlanServiceImpl implements SynthesisPlanService { BigDecimal caseScore = scoreGetter.apply(caseFinanceLiability); BigDecimal stuScore = scoreGetter.apply(stuCaseFinanceLiability); - SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); - synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); - synthesisPlanScore.setCaseid(caseID); - synthesisPlanScore.setUserid(userId); - synthesisPlanScore.setManageMoneyMattersType("财务分析-资产负债表"); - synthesisPlanScore.setTestCenter(testCenter); - // 检查并设置 caseAnswer 和 stuAnswer 字段 - synthesisPlanScore.setCaseAnswer(caseScore != null ? String.valueOf(caseScore) : null); - synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); + if (caseScore != null) { + SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); + synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); + synthesisPlanScore.setCaseid(caseID); + synthesisPlanScore.setUserid(userId); + synthesisPlanScore.setManageMoneyMattersType("财务分析-资产负债表"); + synthesisPlanScore.setTestCenter(testCenter); + // 检查并设置 caseAnswer 和 stuAnswer 字段 + synthesisPlanScore.setCaseAnswer(String.valueOf(caseScore)); + synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); - if (stuScore == null || !stuScore.equals(caseScore)) { - synthesisPlanScore.setStatus("答错"); - synthesisPlanScore.setScore(BigDecimal.ZERO); - } else { - synthesisPlanScore.setStatus("答对"); - synthesisPlanScore.setScore(BigDecimal.valueOf(2)); + if (stuScore == null || !stuScore.equals(caseScore)) { + synthesisPlanScore.setStatus("答错"); + synthesisPlanScore.setScore(BigDecimal.ZERO); + } else { + synthesisPlanScore.setStatus("答对"); + synthesisPlanScore.setScore(BigDecimal.valueOf(2)); + } + list.add(synthesisPlanScore); } - list.add(synthesisPlanScore); } } } @@ -1358,25 +1469,26 @@ public class SynthesisPlanServiceImpl implements SynthesisPlanService { BigDecimal caseScore = scoreGetter.apply(caseRiskIndex); BigDecimal stuScore = scoreGetter.apply(stuCaseRiskIndex); - SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); - synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); - synthesisPlanScore.setCaseid(caseID); - synthesisPlanScore.setUserid(userId); - synthesisPlanScore.setManageMoneyMattersType("风险测评-风险指标"); - synthesisPlanScore.setTestCenter(testCenter); - // 检查并设置 caseAnswer 和 stuAnswer 字段 - synthesisPlanScore.setCaseAnswer(caseScore != null ? String.valueOf(caseScore) : null); - synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); + if (caseScore != null) { + SynthesisPlanScoreWithBLOBs synthesisPlanScore = new SynthesisPlanScoreWithBLOBs(); + synthesisPlanScore.setSynthesisPlanId(IdUtil.randomUUID()); + synthesisPlanScore.setCaseid(caseID); + synthesisPlanScore.setUserid(userId); + synthesisPlanScore.setManageMoneyMattersType("风险测评-风险指标"); + synthesisPlanScore.setTestCenter(testCenter); + // 检查并设置 caseAnswer 和 stuAnswer 字段 + synthesisPlanScore.setCaseAnswer(String.valueOf(caseScore)); + synthesisPlanScore.setStuAnswer(stuScore != null ? String.valueOf(stuScore) : null); - if (stuScore == null || !stuScore.equals(caseScore)) { - synthesisPlanScore.setStatus("答错"); - synthesisPlanScore.setScore(BigDecimal.ZERO); - } else { - synthesisPlanScore.setStatus("答对"); - synthesisPlanScore.setScore(BigDecimal.valueOf(2)); + if (stuScore == null || !stuScore.equals(caseScore)) { + synthesisPlanScore.setStatus("答错"); + synthesisPlanScore.setScore(BigDecimal.ZERO); + } else { + synthesisPlanScore.setStatus("答对"); + synthesisPlanScore.setScore(BigDecimal.valueOf(2)); + } + list.add(synthesisPlanScore); } - - list.add(synthesisPlanScore); } } } diff --git a/src/main/java/com/sztzjy/money_management/service/impl/TheoryTestServiceImpl.java b/src/main/java/com/sztzjy/money_management/service/impl/TheoryTestServiceImpl.java index 748524d..ae6e572 100644 --- a/src/main/java/com/sztzjy/money_management/service/impl/TheoryTestServiceImpl.java +++ b/src/main/java/com/sztzjy/money_management/service/impl/TheoryTestServiceImpl.java @@ -59,13 +59,13 @@ public class TheoryTestServiceImpl implements TheoryTestService { list.addAll(theoryTestDto.getMultipleErrorIds()); list.addAll(theoryTestDto.getJudgeErrorIds()); - String singleStuAnswer = String.valueOf(theoryTestDto.getSingleStuAnswer()).replace("[", "").replace("]", ""); + String singleStuAnswer = theoryTestDto.getSingleStuAnswer(); stuTheoryExam.setSingleStuAnswer(singleStuAnswer); - String multipleStuAnswer = String.valueOf(theoryTestDto.getMultipleStuAnswer()).replace("[", "").replace("]", ""); + String multipleStuAnswer = theoryTestDto.getMultipleStuAnswer(); stuTheoryExam.setMultipleStuAnswer(multipleStuAnswer); - String judgeStuAnswer = String.valueOf(theoryTestDto.getJudgeStuAnswer()).replace("[", "").replace("]", ""); + String judgeStuAnswer = theoryTestDto.getJudgeStuAnswer(); stuTheoryExam.setJudgeStuAnswer(judgeStuAnswer); String stingList = String.valueOf(list.toString()).replace("[", "").replace("]", ""); @@ -524,6 +524,14 @@ public class TheoryTestServiceImpl implements TheoryTestService { } } + public static void main(String[] args) { + String singleStuAnswer = ", , , ,"+" ,"; + System.out.println(singleStuAnswer); + String[] split = singleStuAnswer.split(", "); + for (String s : split) { + System.out.println(s); + } + } @Override public List getTheoryTestDetail(String theoryExamId, Integer index, Integer size) throws IOException { ArrayList idsList = new ArrayList<>(); @@ -554,9 +562,11 @@ public class TheoryTestServiceImpl implements TheoryTestService { ArrayList answerList = new ArrayList<>(); if (StringUtils.isNotBlank(theoryExam.getSingleStuAnswer())) { // String[] singleSplit = theoryExam.getSingleStuAnswer().substring(1, theoryExam.getSingleStuAnswer().length() - 1).split(","); - String[] singleSplit = theoryExam.getSingleStuAnswer().split(","); + String singleStuAnswer = theoryExam.getSingleStuAnswer(); + String[] singleSplit = singleStuAnswer.split(","); +// String[] singleSplit = theoryExam.getSingleStuAnswer().split(", "); for (String str : singleSplit) { - if (str.equals("") || str.equals(" ")) { + if (StringUtils.isBlank(str)) { answerList.add(null); } else { answerList.add(str); @@ -564,10 +574,11 @@ public class TheoryTestServiceImpl implements TheoryTestService { } } if (StringUtils.isNotBlank(theoryExam.getMultipleStuAnswer())) { -// String[] multipleSplit = theoryExam.getMultipleStuAnswer().substring(1, theoryExam.getMultipleStuAnswer().length() - 1).split(","); - String[] multipleSplit = theoryExam.getMultipleStuAnswer().split(","); + String s = theoryExam.getMultipleStuAnswer(); + String[] multipleSplit = s.split(","); +// String[] multipleSplit = theoryExam.getMultipleStuAnswer().split(", "); for (String str : multipleSplit) { - if (str.equals("") || str.equals(" ")) { + if (StringUtils.isBlank(str)) { answerList.add(null); } else { String strSort = sortString(str); @@ -576,10 +587,10 @@ public class TheoryTestServiceImpl implements TheoryTestService { } } if (StringUtils.isNotBlank(theoryExam.getJudgeStuAnswer())) { -// String[] judgeSplit = theoryExam.getJudgeStuAnswer().substring(1, theoryExam.getJudgeStuAnswer().length() - 1).split(","); - String[] judgeSplit = theoryExam.getJudgeStuAnswer().split(","); + String judgeStuAnswer = theoryExam.getJudgeStuAnswer(); + String[] judgeSplit = judgeStuAnswer.split(","); for (String str : judgeSplit) { - if (str.equals("") || str.equals(" ")) { + if (StringUtils.isBlank(str)) { answerList.add(null); } else { answerList.add(str); @@ -605,10 +616,10 @@ public class TheoryTestServiceImpl implements TheoryTestService { String content = objectiveQuestion.getContent(); String answer = objectiveQuestion.getAnswer(); if (stuAnswer.equals("true")) { - stuAnswer = "对"; + stuAnswer = "正确"; } if (stuAnswer.equals("false")) { - stuAnswer = "错"; + stuAnswer = "错误"; } if (answer.replaceAll(",", "").equals(stuAnswer)) { detailDto.setScore(String.valueOf(score));