Selaa lähdekoodia

分数修改为dobule

yangfeng 1 vuosi sitten
vanhempi
commit
1b6aa54a96
29 muutettua tiedostoa jossa 204 lisäystä ja 144 poistoa
  1. 1 1
      web/src/main/java/com/ynfy/buss/exam/exam/dto/AnswerCardDTO.java
  2. 2 2
      web/src/main/java/com/ynfy/buss/exam/exam/dto/BlankAnswerResultDTO.java
  3. 2 2
      web/src/main/java/com/ynfy/buss/exam/exam/entity/Exam.java
  4. 3 3
      web/src/main/java/com/ynfy/buss/exam/exam/mapper/xml/ExamMapper.xml
  5. 41 35
      web/src/main/java/com/ynfy/buss/exam/exam/service/impl/ExamServiceImpl.java
  6. 1 1
      web/src/main/java/com/ynfy/buss/exam/examreview/dto/ExamPreviewDTO.java
  7. 2 2
      web/src/main/java/com/ynfy/buss/exam/examreview/service/impl/ExamReviewServiceImpl.java
  8. 3 3
      web/src/main/java/com/ynfy/buss/exam/examstatistics/dto/ExamStatisticsDTO.java
  9. 2 2
      web/src/main/java/com/ynfy/buss/exam/examstatistics/entity/ExamStatistics.java
  10. 3 3
      web/src/main/java/com/ynfy/buss/exam/examstatistics/mapper/xml/ExamStatisticsMapper.xml
  11. 6 6
      web/src/main/java/com/ynfy/buss/exam/examstatistics/service/impl/ExamStatisticsServiceImpl.java
  12. 1 1
      web/src/main/java/com/ynfy/buss/exam/examuserstatistics/entity/ExamUserStatistics.java
  13. 1 1
      web/src/main/java/com/ynfy/buss/exam/paper/entity/Paper.java
  14. 19 10
      web/src/main/java/com/ynfy/buss/exam/paper/service/impl/PaperServiceImpl.java
  15. 1 1
      web/src/main/java/com/ynfy/buss/exam/paperquestion/entity/PaperQuestion.java
  16. 47 30
      web/src/main/java/com/ynfy/buss/exam/paperquestion/service/impl/PaperQuestionServiceImpl.java
  17. 1 1
      web/src/main/java/com/ynfy/buss/exam/paperquestionanswer/service/IPaperQuestionAnswerService.java
  18. 40 13
      web/src/main/java/com/ynfy/buss/exam/paperquestionanswer/service/impl/PaperQuestionAnswerServiceImpl.java
  19. 2 2
      web/src/main/java/com/ynfy/buss/exam/paperrulegroup/entity/PaperRuleGroup.java
  20. 2 2
      web/src/main/java/com/ynfy/buss/exam/paperrulegroup/mapper/xml/PaperRuleGroupMapper.xml
  21. 3 2
      web/src/main/java/com/ynfy/buss/exam/paperrulegroup/service/impl/PaperRuleGroupServiceImpl.java
  22. 1 1
      web/src/main/java/com/ynfy/buss/exam/question/entity/Question.java
  23. 5 5
      web/src/main/java/com/ynfy/buss/exam/userexam/entity/UserExam.java
  24. 7 7
      web/src/main/java/com/ynfy/buss/exam/userexam/mapper/xml/UserExamMapper.xml
  25. 2 2
      web/src/main/java/com/ynfy/buss/exam/userexamquestion/entity/UserExamQuestion.java
  26. 1 1
      web/src/main/java/com/ynfy/buss/exam/userexamresult/entity/UserExamResult.java
  27. 3 3
      web/src/main/java/com/ynfy/buss/exam/userexamresult/entity/vo/UserExamScoreVO.java
  28. 1 1
      web/src/main/java/com/ynfy/buss/exam/userexamresult/service/IUserExamResultService.java
  29. 1 1
      web/src/main/java/com/ynfy/buss/exam/userexamresult/service/impl/UserExamResultServiceImpl.java

+ 1 - 1
web/src/main/java/com/ynfy/buss/exam/exam/dto/AnswerCardDTO.java

@@ -19,7 +19,7 @@ public class AnswerCardDTO {
     /**
      * 分数
      */
-    private Integer questionScore;
+    private Double questionScore;
 
     /**
      * 数值面板

+ 2 - 2
web/src/main/java/com/ynfy/buss/exam/exam/dto/BlankAnswerResultDTO.java

@@ -28,10 +28,10 @@ public class BlankAnswerResultDTO {
     /**
      * 选项得分
      */
-    private Integer score;
+    private Double score;
 
 
-    public BlankAnswerResultDTO(String tag, String content, Boolean isRight, Integer score) {
+    public BlankAnswerResultDTO(String tag, String content, Boolean isRight, Double score) {
         this.tag = tag;
         this.content = content;
         this.isRight = isRight;

+ 2 - 2
web/src/main/java/com/ynfy/buss/exam/exam/entity/Exam.java

@@ -95,13 +95,13 @@ public class Exam implements Serializable {
      */
     @Excel(name = "试卷总分", width = 15)
     @ApiModelProperty(value = "试卷总分")
-    private Integer totalScore;
+    private Double totalScore;
     /**
      * 及格分
      */
     @Excel(name = "及格分", width = 15)
     @ApiModelProperty(value = "及格分")
-    private Integer qualifyScore;
+    private Double qualifyScore;
     /**
      * 考试时长
      */

+ 3 - 3
web/src/main/java/com/ynfy/buss/exam/exam/mapper/xml/ExamMapper.xml

@@ -48,8 +48,8 @@
         <result column="open_type" property="openType" jdbcType="INTEGER"/>
         <result column="start_time" property="startTime" jdbcType="TIMESTAMP"/>
         <result column="end_time" property="endTime" jdbcType="TIMESTAMP"/>
-        <result column="exam_total_score" property="totalScore" jdbcType="INTEGER"/>
-        <result column="qualify_score" property="qualifyScore" jdbcType="INTEGER"/>
+        <result column="exam_total_score" property="totalScore" jdbcType="DOUBLE"/>
+        <result column="qualify_score" property="qualifyScore" jdbcType="DOUBLE"/>
         <result column="total_time" property="totalTime" jdbcType="INTEGER"/>
         <result column="exam_paper_id" property="paperId" jdbcType="VARCHAR"/>
         <result column="limit_count" property="limitCount" jdbcType="INTEGER"/>
@@ -69,7 +69,7 @@
         <association property="paper" javaType="com.ynfy.buss.exam.paper.entity.Paper">
             <id column="paper_id" property="id" jdbcType="VARCHAR"/>
             <result column="paperName" property="title" jdbcType="VARCHAR"/>
-            <result column="total_score" property="totalScore" jdbcType="VARCHAR"/>
+            <result column="total_score" property="totalScore" jdbcType="DOUBLE"/>
             <result column="join_type" property="joinType" jdbcType="INTEGER"/>
             <result column="create_by" property="createBy" jdbcType="VARCHAR"/>
             <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>

+ 41 - 35
web/src/main/java/com/ynfy/buss/exam/exam/service/impl/ExamServiceImpl.java

@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUnit;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.IdUtil;
+import cn.hutool.core.util.NumberUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -184,7 +185,7 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
         UserExam userExam = new UserExam();
         userExam.setId(IdUtil.getSnowflake(1, 1).nextIdStr());
         userExam.setExamId(exam.getId());
-        userExam.setUserScore(0);
+        userExam.setUserScore(0.0);
         userExam.setUserId(userId);
         userExam.setPaperId(paper.getId());
         userExam.setState(PaperState.ING);
@@ -194,6 +195,7 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
 
         //保存考试关联的试题列表
         if (!CollectionUtils.isEmpty(paperQuestionList)) {
+            //保存用户考试题目,如果有组合题,则也要保存子题目
             this.savePaperQuestion(paper.getId(), userExam.getId(), paperQuestionList, joinType);
             //保存用户考试的题目答案
             this.saveQuestionAnswer(paper.getId(), userExam.getId(), exam, paperQuestionList);
@@ -238,7 +240,8 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
         }
     }
 
-    public void genQuestionAnswer(String userExamId, Exam exam, Question question, List<UserExamQuestionAnswer> userExamQuestionAnswerList) {
+    public void genQuestionAnswer(String userExamId, Exam exam, Question question,
+                                  List<UserExamQuestionAnswer> userExamQuestionAnswerList) {
         List<QuestionAnswer> answerList = question.getAnswerList();
         if (!CollectionUtils.isEmpty(answerList)) {
             //答案乱序(支持单选题,多选题)
@@ -299,7 +302,9 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
     }
 
     /**
-     * 保存试卷试题列表
+     * 保存用户考试题目,如果有组合题,则也要保存子题目
+     *
+     * @param paperQuestionList 主题目
      */
     private void savePaperQuestion(String paperId, String userExamId, List<PaperQuestion> paperQuestionList, Integer joinType) {
         paperQuestionList = paperQuestionList.stream().sorted(Comparator.comparing(PaperQuestion::getQuestionType)
@@ -336,7 +341,7 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
 
         //配置子题目
         configUserExamSubQuestion(userExamId, paperSubQuestionList, groupMap, userExamQuestionList);
-
+        //保存用户考试题目,如果有组合题,则也要保存子题目
         userExamQuestionService.saveBatch(userExamQuestionList);
     }
 
@@ -347,17 +352,18 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
      * @param parent
      * @return
      */
-    public Integer calcSubQuestionScore(Map<String, Long> subQuestionCountMap, PaperQuestion parent) {
-        int subQuestionScore = 0;
+    public Double calcSubQuestionScore(Map<String, Long> subQuestionCountMap, PaperQuestion parent) {
+        double subQuestionScore = 0;
         if (!Objects.isNull(parent) && !Objects.isNull(subQuestionCountMap)
                 && !Objects.isNull(subQuestionCountMap.get(parent.getQuestionId()))) {
             //TODO 分数改为double
-            subQuestionScore = parent.getQuestionScore() / subQuestionCountMap.get(parent.getQuestionId()).intValue();
+            subQuestionScore = NumberUtil.div(parent.getQuestionScore().doubleValue(),
+                    subQuestionCountMap.get(parent.getQuestionId()).doubleValue(), 2);
         }
         return subQuestionScore;
     }
 
-    private static PaperQuestion getPaperQuestion(String paperId, Question sub, PaperQuestion parent, int subQuestionScore) {
+    private PaperQuestion getPaperQuestion(String paperId, Question sub, PaperQuestion parent, double subQuestionScore) {
         PaperQuestion paperSubQuestion = new PaperQuestion();
         paperSubQuestion.setGroupId(!Objects.isNull(parent) ? parent.getGroupId() : null);
         paperSubQuestion.setPaperId(paperId);
@@ -616,7 +622,7 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
             answerCard.setQuestionType(item.getKey());
             //题数和分数
             answerCard.setQuestionCount(questions.size());
-            answerCard.setQuestionScore(questions.stream().mapToInt(UserExamQuestion::getQuestionScore).sum());
+            answerCard.setQuestionScore(questions.stream().mapToDouble(UserExamQuestion::getQuestionScore).sum());
             //答题卡数字面板
             answerCard.setIndexList(questions.stream().map(UserExamQuestion::getQuestionIndex).collect(Collectors.toList()));
             Map<String, AnswerCardDTO> answerCardMap = new LinkedHashMap<>();
@@ -667,7 +673,7 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
             Map<Integer, UserExamQuestion> userExamQuestionMap = rootQuestionList.stream().collect(Collectors.toMap(UserExamQuestion::getQuestionIndex, a -> a, (k1, k2) -> k1));
 
             //计算客观题得分
-            int score = calcObjectiveScore(examAnswers, userExamQuestionMap, rootQuestionList);
+            double score = calcObjectiveScore(examAnswers, userExamQuestionMap, rootQuestionList);
             //更新用户考试信息和成绩
             updateUserExamAndResult(score, userExam);
         }
@@ -811,7 +817,7 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
      * @param userExamQuestionMap
      * @return
      */
-    public int calcObjectiveScore(List<ExamAnswerDTO> examAnswers, Map<Integer, UserExamQuestion> userExamQuestionMap, List<UserExamQuestion> rootQuestionList) {
+    public double calcObjectiveScore(List<ExamAnswerDTO> examAnswers, Map<Integer, UserExamQuestion> userExamQuestionMap, List<UserExamQuestion> rootQuestionList) {
         if (!CollectionUtils.isEmpty(examAnswers)) {
             //对比/计算
             for (ExamAnswerDTO o : examAnswers) {
@@ -826,7 +832,7 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
                         root.setAnswered(true);
                     }
                     root.setActualScore(root.getSubQuestionList().stream().filter(o ->
-                            !Objects.isNull(o.getActualScore())).mapToInt(UserExamQuestion::getActualScore).sum());
+                            !Objects.isNull(o.getActualScore())).mapToDouble(UserExamQuestion::getActualScore).sum());
                     resultList.add(root);
                     root.getSubQuestionList().forEach(subQuestion -> {
                         //是否是没回答的客观题,如果是,是否正确设置为false
@@ -856,7 +862,7 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
         }
         //最终得分
         return rootQuestionList.stream().filter(o -> !Objects.isNull(o.getActualScore()))
-                .mapToInt(UserExamQuestion::getActualScore).sum();
+                .mapToDouble(UserExamQuestion::getActualScore).sum();
     }
 
     /**
@@ -953,7 +959,7 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
      *
      * @return
      */
-    public Integer compareBlankToScore(UserExamQuestion userExamQuestion, String userAnswerStr, Question question, Boolean canBlankOption) {
+    public Double compareBlankToScore(UserExamQuestion userExamQuestion, String userAnswerStr, Question question, Boolean canBlankOption) {
         List<QuestionAnswer> answerList = question.getAnswerList();
         //深拷贝答案
         List<QuestionAnswer> deepList = deepCopyAnswerList(answerList);
@@ -989,7 +995,7 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
                 }
             }
         }
-        return 0;
+        return 0.0;
     }
 
     /**
@@ -1000,22 +1006,22 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
      * @param dtoList
      * @return
      */
-    public Integer calcBlankScoreWhenFalse(UserExamQuestion userExamQuestion, Boolean canBlankOption, List<BlankAnswerResultDTO> dtoList) {
+    public Double calcBlankScoreWhenFalse(UserExamQuestion userExamQuestion, Boolean canBlankOption, List<BlankAnswerResultDTO> dtoList) {
         if (!Objects.isNull(canBlankOption) && canBlankOption) {//是否允许按空得分
             if (dtoList.stream().filter(d -> !Objects.isNull(d.getIsRight()) && d.getIsRight()).count() == 0) {//全部错
                 userExamQuestion.setIsRight(false);
-                userExamQuestion.setActualScore(0);
-                return 0;
+                userExamQuestion.setActualScore(0.0);
+                return 0.0;
             }
             //有答对的,部分得分
-            int actualScore = sumRightAnswerScore(dtoList);
+            double actualScore = sumRightAnswerScore(dtoList);
             userExamQuestion.setIsRight(true);
             userExamQuestion.setActualScore(actualScore);
             return actualScore;
         } else {
             userExamQuestion.setIsRight(false);
-            userExamQuestion.setActualScore(0);
-            return 0;
+            userExamQuestion.setActualScore(0.0);
+            return 0.0;
         }
     }
 
@@ -1025,8 +1031,8 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
      * @param dtoList
      * @return
      */
-    public int sumRightAnswerScore(List<BlankAnswerResultDTO> dtoList) {
-        return dtoList.stream().filter(d -> !Objects.isNull(d.getIsRight()) && d.getIsRight() && !Objects.isNull(d.getScore())).mapToInt(BlankAnswerResultDTO::getScore).sum();
+    public double sumRightAnswerScore(List<BlankAnswerResultDTO> dtoList) {
+        return dtoList.stream().filter(d -> !Objects.isNull(d.getIsRight()) && d.getIsRight() && !Objects.isNull(d.getScore())).mapToDouble(BlankAnswerResultDTO::getScore).sum();
     }
 
     /**
@@ -1062,7 +1068,7 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
             if (!Objects.isNull(answerArray) && answerArray.length > 0) {
                 List<String> asList = Arrays.asList(answerArray);
                 if (asList.contains(userAnswer.getContent().trim())) {
-                    dtoList.add(new BlankAnswerResultDTO(userAnswer.getTag(), userAnswer.getContent().trim(), true, !Objects.isNull(tmp.getPathScore()) ? tmp.getPathScore().intValue() : null));
+                    dtoList.add(new BlankAnswerResultDTO(userAnswer.getTag(), userAnswer.getContent().trim(), true, !Objects.isNull(tmp.getPathScore()) ? tmp.getPathScore().doubleValue() : null));
                 } else {
                     dtoList.add(new BlankAnswerResultDTO(userAnswer.getTag(), userAnswer.getContent().trim(), false, null));
                 }
@@ -1086,7 +1092,7 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
             if (!Objects.isNull(answerArray) && answerArray.length > 0) {
                 List<String> asList = Arrays.asList(answerArray);
                 if (asList.contains(userAnswer.getContent().trim())) {
-                    dtoList.add(new BlankAnswerResultDTO(userAnswer.getTag(), userAnswer.getContent().trim(), true, !Objects.isNull(qa.getPathScore()) ? qa.getPathScore().intValue() : null));
+                    dtoList.add(new BlankAnswerResultDTO(userAnswer.getTag(), userAnswer.getContent().trim(), true, !Objects.isNull(qa.getPathScore()) ? qa.getPathScore().doubleValue() : null));
                     isTrue = true;
                     iterator.remove();
                     break;
@@ -1106,8 +1112,8 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
      * @param question
      * @return
      */
-    public Integer compareMultiToScore(UserExamQuestion userExamQuestion, String[] answers, Question question) {
-        Result<Integer> result = compareMultiAnswer(userExamQuestion, answers, question);
+    public Double compareMultiToScore(UserExamQuestion userExamQuestion, String[] answers, Question question) {
+        Result<Double> result = compareMultiAnswer(userExamQuestion, answers, question);
         if (Objects.isNull(result)) {
             return null;
         }
@@ -1132,7 +1138,7 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
      * @param answers
      * @return
      */
-    public Result<Integer> compareMultiAnswer(UserExamQuestion userExamQuestion, String[] answers, Question question) {
+    public Result<Double> compareMultiAnswer(UserExamQuestion userExamQuestion, String[] answers, Question question) {
         List<QuestionAnswer> answerList = question.getAnswerList();
         if (!Objects.isNull(answers) && answers.length > 0 && !CollectionUtils.isEmpty(answerList)) {
             //找出正确答案
@@ -1148,7 +1154,7 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
                 if (CollectionUtils.isEmpty(reduceList)) {
                     return Result.ok(userExamQuestion.getQuestionScore());//给整题的分
                 } else {
-                    return Result.error("答题错误", 0);//有错误项,给0分
+                    return Result.error("答题错误", 0.0);//有错误项,给0分
                 }
             } else {
                 //去重并集,取交集,再取差集
@@ -1161,12 +1167,12 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
                     //如果用户给的答案中有错误答案的话,给0分
                     List<QuestionAnswer> falseList = reduceAnswers.stream().filter(o -> !Objects.isNull(o.getIsRight()) && !o.getIsRight()).collect(Collectors.toList());
                     if (!CollectionUtils.isEmpty(falseList)) {
-                        return Result.error("答题错误", 0);
+                        return Result.error("答题错误", 0.0);
                     } else {
                         //漏选项单独算分
                         List<QuestionAnswer> trueList = answerList.stream().filter(o -> userAnswerList.contains(o.getId())).collect(Collectors.toList());
                         double sum = trueList.stream().filter(q -> !Objects.isNull(q.getPathScore()) && q.getPathScore() > 0).mapToDouble(QuestionAnswer::getPathScore).sum();
-                        return Result.ok((int) sum);
+                        return Result.ok(sum);
                     }
                 }
             }
@@ -1205,7 +1211,7 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
      * @param question
      * @return
      */
-    public Integer compareToScore(UserExamQuestion userExamQuestion, String[] answers, Question question) {
+    public Double compareToScore(UserExamQuestion userExamQuestion, String[] answers, Question question) {
         boolean succeed = compareAnswer(answers, question);
         if (succeed) {//回答正确
             userExamQuestion.setIsRight(true);
@@ -1213,8 +1219,8 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
             return userExamQuestion.getQuestionScore();
         } else {
             userExamQuestion.setIsRight(false);
-            userExamQuestion.setActualScore(0);
-            return 0;
+            userExamQuestion.setActualScore(0.0);
+            return 0.0;
         }
     }
 
@@ -1233,7 +1239,7 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
      *
      * @param score
      */
-    public void updateUserExamAndResult(int score, UserExam userExam) {
+    public void updateUserExamAndResult(double score, UserExam userExam) {
         userExam.setUserScore(score);//最终得分
         userExam.setObjectiveScore(score);//客观题得分
         userExam.setCommitTime(new Date());

+ 1 - 1
web/src/main/java/com/ynfy/buss/exam/examreview/dto/ExamPreviewDTO.java

@@ -17,5 +17,5 @@ public class ExamPreviewDTO {
     /**
      * 试题得分(主观题)
      */
-    private Integer actualScore;
+    private Double actualScore;
 }

+ 2 - 2
web/src/main/java/com/ynfy/buss/exam/examreview/service/impl/ExamReviewServiceImpl.java

@@ -111,7 +111,7 @@ public class ExamReviewServiceImpl extends ServiceImpl<ExamReviewMapper, ExamRev
 
         if (!CollectionUtils.isEmpty(examPreviews)) {
             List<UserExamQuestion> resultList = new ArrayList<>();
-            int subjectiveScore = 0;
+            double subjectiveScore = 0;
             for (ExamPreviewDTO o : examPreviews) {
                 //根据题目序号中获取考题
                 UserExamQuestion userExamQuestion = examService.getUserExamQuestionByIndex(o.getIndex(), userExamQuestionMap);
@@ -133,7 +133,7 @@ public class ExamReviewServiceImpl extends ServiceImpl<ExamReviewMapper, ExamRev
                             .equals(q.getQuestionType())).count();
                     if (simpleCount > 0) {
                         question.setActualScore(question.getSubQuestionList().stream().filter(o ->
-                                !Objects.isNull(o.getActualScore())).mapToInt(UserExamQuestion::getActualScore).sum());
+                                !Objects.isNull(o.getActualScore())).mapToDouble(UserExamQuestion::getActualScore).sum());
                         if (question.getActualScore() > 0) {
                             question.setIsRight(true);
                         } else {

+ 3 - 3
web/src/main/java/com/ynfy/buss/exam/examstatistics/dto/ExamStatisticsDTO.java

@@ -43,11 +43,11 @@ public class ExamStatisticsDTO {
     /**
      * 试卷总分
      */
-    private Integer totalScore;
+    private Double totalScore;
     /**
      * 及格分
      */
-    private Integer qualifyScore;
+    private Double qualifyScore;
 
     /**
      * 用户用时
@@ -57,7 +57,7 @@ public class ExamStatisticsDTO {
     /**
      * 用户得分
      */
-    private Integer userScore;
+    private Double userScore;
 
     /**
      * 交卷时间

+ 2 - 2
web/src/main/java/com/ynfy/buss/exam/examstatistics/entity/ExamStatistics.java

@@ -113,7 +113,7 @@ public class ExamStatistics implements Serializable {
      */
     @Excel(name = "最高分", width = 15)
     @ApiModelProperty(value = "最高分")
-    private Integer maxScore;
+    private Double maxScore;
     /**
      * 平均分
      */
@@ -125,7 +125,7 @@ public class ExamStatistics implements Serializable {
      */
     @Excel(name = "最低分", width = 15)
     @ApiModelProperty(value = "最低分")
-    private Integer minScore;
+    private Double minScore;
 
     /**
      * 考试名称

+ 3 - 3
web/src/main/java/com/ynfy/buss/exam/examstatistics/mapper/xml/ExamStatisticsMapper.xml

@@ -9,10 +9,10 @@
         <result column="exam_id" property="examId" jdbcType="VARCHAR"/>
         <result column="title" property="title" jdbcType="VARCHAR"/>
         <result column="open_type" property="openType" jdbcType="INTEGER"/>
-        <result column="total_score" property="totalScore" jdbcType="INTEGER"/>
-        <result column="qualify_score" property="qualifyScore" jdbcType="INTEGER"/>
+        <result column="total_score" property="totalScore" jdbcType="DOUBLE"/>
+        <result column="qualify_score" property="qualifyScore" jdbcType="DOUBLE"/>
         <result column="user_time" property="userTime" jdbcType="INTEGER"/>
-        <result column="user_score" property="userScore" jdbcType="INTEGER"/>
+        <result column="user_score" property="userScore" jdbcType="DOUBLE"/>
         <result column="commit_time" property="commitExamTime" jdbcType="TIMESTAMP"/>
         <result column="create_time" property="startExamTime" jdbcType="TIMESTAMP"/>
         <result column="passed" property="passed" jdbcType="INTEGER"/>

+ 6 - 6
web/src/main/java/com/ynfy/buss/exam/examstatistics/service/impl/ExamStatisticsServiceImpl.java

@@ -88,8 +88,8 @@ public class ExamStatisticsServiceImpl extends ServiceImpl<ExamStatisticsMapper,
         examStatistics.setExamTitle(exam.getTitle());
         examStatistics.setExamState(exam.getState());
         examStatistics.setActualExaminee(userExamList.size());
-        examStatistics.setMaxScore(userExamList.stream().mapToInt(ExamStatisticsDTO::getUserScore).max().getAsInt());
-        examStatistics.setMinScore(userExamList.stream().mapToInt(ExamStatisticsDTO::getUserScore).min().getAsInt());
+        examStatistics.setMaxScore(userExamList.stream().mapToDouble(ExamStatisticsDTO::getUserScore).max().getAsDouble());
+        examStatistics.setMinScore(userExamList.stream().mapToDouble(ExamStatisticsDTO::getUserScore).min().getAsDouble());
         examStatistics.setParticipant(userExamList.stream().mapToInt(ExamStatisticsDTO::getTryCount).sum());//参加人次
         examStatistics.setAvgScore(userExamList.stream().mapToDouble(ExamStatisticsDTO::getUserScore).average().getAsDouble());
         int passNum = userExamList.stream().filter(o -> o.getPassed().equals(1)).collect(Collectors.toList()).size();
@@ -190,9 +190,9 @@ public class ExamStatisticsServiceImpl extends ServiceImpl<ExamStatisticsMapper,
     public Double calcScoreRate(Map<String, List<UserExamQuestion>> ueqMap, ExamStatisticsDTO dto) {
         List<UserExamQuestion> questions = ueqMap.get(dto.getUserExamId());
         if (!CollectionUtils.isEmpty(questions)) {
-            int userScoreTotal = questions.stream().filter(o -> !Objects.isNull(o.getIsRight()) && o.getIsRight())
-                    .mapToInt(UserExamQuestion::getQuestionScore).sum();
-            int scoreTotal = questions.stream().mapToInt(UserExamQuestion::getQuestionScore).sum();
+            double userScoreTotal = questions.stream().filter(o -> !Objects.isNull(o.getIsRight()) && o.getIsRight())
+                    .mapToDouble(UserExamQuestion::getQuestionScore).sum();
+            double scoreTotal = questions.stream().mapToDouble(UserExamQuestion::getQuestionScore).sum();
             return NumberUtil.div(multi(userScoreTotal), scoreTotal, 2);
         }
         return null;
@@ -210,7 +210,7 @@ public class ExamStatisticsServiceImpl extends ServiceImpl<ExamStatisticsMapper,
      * @param a
      * @return
      */
-    public double multi(long a) {
+    public double multi(double a) {
         return NumberUtil.mul(a, 100);
     }
 }

+ 1 - 1
web/src/main/java/com/ynfy/buss/exam/examuserstatistics/entity/ExamUserStatistics.java

@@ -122,7 +122,7 @@ public class ExamUserStatistics implements Serializable {
      */
     @Excel(name = "用户得分", width = 15)
     @ApiModelProperty(value = "用户得分")
-    private Integer userScore;
+    private Double userScore;
     /**
      * 正确率
      */

+ 1 - 1
web/src/main/java/com/ynfy/buss/exam/paper/entity/Paper.java

@@ -48,7 +48,7 @@ public class Paper implements Serializable {
      */
     @Excel(name = "试卷总分", width = 15)
     @ApiModelProperty(value = "试卷总分")
-    private Integer totalScore;
+    private Double totalScore;
     /**
      * 组卷类型 1:选题组卷 2.随机组卷
      */

+ 19 - 10
web/src/main/java/com/ynfy/buss/exam/paper/service/impl/PaperServiceImpl.java

@@ -388,8 +388,8 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, Paper> implements
                     List<Question> subQuestionList = questionList.stream().filter(c -> StringUtils.isNotBlank(c.getParentId()) && c.getParentId()
                             .equals(paperQuestion.getQuestionId())).sorted(Comparator.comparing(Question::getSort)).collect(Collectors.toList());
                     if (!CollectionUtils.isEmpty(subQuestionList)) {
-                        //设置子题目相关信息
-                        setSubQuestionInfo(subQuestionList, paperSubQuestionList);
+                        //设置子题目题目和答案
+                        setSubQuestionInfo(subQuestionList, paperSubQuestionList, answerMap, g);
                     }
                     question.setSubQuestionList(subQuestionList);
                     sortQuestions.add(question);
@@ -397,12 +397,8 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, Paper> implements
             } else {
                 if (!Objects.isNull(question)) {
                     question.setScore(paperQuestion.getQuestionScore());
-                    if (!Objects.isNull(answerMap) && !Objects.isNull(g)) {
-                        //多选题回填漏选选项分值
-                        fillMissOptionScore(g, question, answerMap);
-                        //填空题按空设置分值
-                        fillBlankOptionScore(g, question, answerMap);
-                    }
+                    //答案选项设置,多选题回填漏选选项分值,填空题按空设置分值设置
+                    answerConfig(question, answerMap, g);
                     sortQuestions.add(question);
                 }
             }
@@ -410,13 +406,24 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, Paper> implements
         return sortQuestions;
     }
 
+    //答案选项设置,多选题回填漏选选项分值,填空题按空设置分值设置
+    public void answerConfig(Question question, Map<String, PaperQuestionAnswer> answerMap, PaperRuleGroup g) {
+        if (!Objects.isNull(answerMap) && !Objects.isNull(g)) {
+            //多选题回填漏选选项分值
+            fillMissOptionScore(g, question, answerMap);
+            //填空题按空设置分值
+            fillBlankOptionScore(g, question, answerMap);
+        }
+    }
+
     /**
-     * 设置子题目相关信息
+     * 设置子题目题目和答案
      *
      * @param subQuestionList
      * @param paperSubQuestionList
      */
-    public void setSubQuestionInfo(List<Question> subQuestionList, List<PaperQuestion> paperSubQuestionList) {
+    public void setSubQuestionInfo(List<Question> subQuestionList, List<PaperQuestion> paperSubQuestionList,
+                                   Map<String, PaperQuestionAnswer> answerMap, PaperRuleGroup g) {
         //设置子题目分值
         subQuestionList.forEach(subQuestion -> {
             PaperQuestion paperSubQuestion = paperSubQuestionList.stream().filter(psq -> psq.getQuestionId()
@@ -424,6 +431,8 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, Paper> implements
             if (!Objects.isNull(paperSubQuestion)) {
                 subQuestion.setScore(paperSubQuestion.getQuestionScore());
             }
+            //答案选项设置,多选题回填漏选选项分值,填空题按空设置分值设置
+            answerConfig(subQuestion, answerMap, g);
         });
     }
 

+ 1 - 1
web/src/main/java/com/ynfy/buss/exam/paperquestion/entity/PaperQuestion.java

@@ -61,7 +61,7 @@ public class PaperQuestion implements Serializable {
      */
     @Excel(name = "题目分数", width = 15)
     @ApiModelProperty(value = "题目分数")
-    private Integer questionScore;
+    private Double questionScore;
 
     /**
      * 所属组id

+ 47 - 30
web/src/main/java/com/ynfy/buss/exam/paperquestion/service/impl/PaperQuestionServiceImpl.java

@@ -68,6 +68,12 @@ public class PaperQuestionServiceImpl extends ServiceImpl<PaperQuestionMapper, P
         return paperQuestions;
     }
 
+    /**
+     * 保存试卷试题和答案
+     *
+     * @param paperId
+     * @param groupList
+     */
     @Override
     public void saveAll(String paperId, List<PaperRuleGroup> groupList) {
         if (!CollectionUtils.isEmpty(groupList)) {
@@ -76,39 +82,28 @@ public class PaperQuestionServiceImpl extends ServiceImpl<PaperQuestionMapper, P
                 List<Question> questionList = g.getQuestionList();
                 int sort = 1;
                 if (!CollectionUtils.isEmpty(questionList)) {
-                    for (Question q : questionList) {
-                        //多选题漏选也给分,填空题按空给分设置
-                        groupAnswerConfig(paperId, g, q);
-
-                        PaperQuestion paperQuestion = new PaperQuestion();
-                        paperQuestion.setGroupId(g.getId());
-                        paperQuestion.setPaperId(paperId);
-                        paperQuestion.setQuestionId(q.getId());
-                        paperQuestion.setQuestionType(q.getType());
-                        paperQuestion.setChild(q.getChild());
-                        if (QuestionType.COMBINATION.getCode().equals(q.getType())) {//组合题
-                            paperQuestion.setQuestionScore((int) q.getSubQuestionList().stream().mapToDouble(Question::getScore).sum());
-
+                    if (QuestionType.COMBINATION.getCode().equals(g.getQuestionType())) {//组合题
+                        for (Question q : questionList) {
+                            double questionScore = (int) q.getSubQuestionList().stream().mapToDouble(Question::getScore).sum();
+                            PaperQuestion root = generatePaperQuestion(paperId, g, q, sort, questionScore);
+                            paperQuestionList.add(root);
                             //子题目
                             q.getSubQuestionList().forEach(sub -> {
-                                PaperQuestion paperSubQuestion = new PaperQuestion();
-                                paperSubQuestion.setGroupId(g.getId());
-                                paperSubQuestion.setPaperId(paperId);
-                                paperSubQuestion.setQuestionId(sub.getId());
-                                paperSubQuestion.setQuestionType(sub.getType());
-                                paperSubQuestion.setChild(sub.getChild());
-                                paperSubQuestion.setQuestionScore(sub.getScore());
-                                paperSubQuestion.setSort(sub.getSort());
+                                PaperQuestion paperSubQuestion = generatePaperQuestion(paperId, g, sub, sub.getSort(), sub.getScore());
                                 paperSubQuestion.setParentQuestionId(q.getId());
-                                //groupAnswerConfig(paperId, g, sub);
+                                //多选题漏选也给分,填空题按空给分设置(保存答案)
+                                groupAnswerConfig(paperId, g, sub);
+
                                 paperQuestionList.add(paperSubQuestion);
                             });
-                        } else {
-                            paperQuestion.setQuestionScore(q.getScore());
                         }
-                        paperQuestion.setSort(sort);
-                        paperQuestionList.add(paperQuestion);
-                        sort++;
+                    } else {//非组合题(单选,多选,判断,填空,简答)
+                        for (Question q : questionList) {
+                            groupAnswerConfig(paperId, g, q);
+                            //生成试卷试题
+                            paperQuestionList.add(generatePaperQuestion(paperId, g, q, sort, q.getScore()));
+                            sort++;
+                        }
                     }
                 }
                 saveBatch(paperQuestionList);
@@ -117,7 +112,29 @@ public class PaperQuestionServiceImpl extends ServiceImpl<PaperQuestionMapper, P
     }
 
     /**
-     * 多选题漏选也给分,填空题按空给分设置
+     * 生成试卷试题
+     *
+     * @param paperId
+     * @param g
+     * @param q
+     * @param sort
+     * @return
+     */
+    public PaperQuestion generatePaperQuestion(String paperId, PaperRuleGroup g, Question q,
+                                               Integer sort, Double questionScore) {
+        PaperQuestion paperQuestion = new PaperQuestion();
+        paperQuestion.setGroupId(g.getId());
+        paperQuestion.setPaperId(paperId);
+        paperQuestion.setQuestionId(q.getId());
+        paperQuestion.setQuestionType(q.getType());
+        paperQuestion.setChild(q.getChild());
+        paperQuestion.setQuestionScore(questionScore);
+        paperQuestion.setSort(sort);
+        return paperQuestion;
+    }
+
+    /**
+     * 多选题漏选也给分,填空题按空给分设置(保存答案)
      *
      * @param paperId
      * @param g
@@ -126,10 +143,10 @@ public class PaperQuestionServiceImpl extends ServiceImpl<PaperQuestionMapper, P
     public void groupAnswerConfig(String paperId, PaperRuleGroup g, Question q) {
         //多选题漏选选项分值(漏选也给分)
         if (QuestionType.MULTI.getCode().equals(q.getType()) && !Objects.isNull(g.getCanMissOption()) && g.getCanMissOption()) {
-            paperQuestionAnswerService.save(paperId, q);
+            paperQuestionAnswerService.save(paperId, q, g.getQuestionType());
             //填空题按空给分
         } else if (QuestionType.BLANK.getCode().equals(q.getType()) && !Objects.isNull(g.getCanBlankOption()) && g.getCanBlankOption()) {
-            paperQuestionAnswerService.save(paperId, q);
+            paperQuestionAnswerService.save(paperId, q, g.getQuestionType());
         }
     }
 

+ 1 - 1
web/src/main/java/com/ynfy/buss/exam/paperquestionanswer/service/IPaperQuestionAnswerService.java

@@ -18,5 +18,5 @@ public interface IPaperQuestionAnswerService extends IService<PaperQuestionAnswe
 
     void remove(String paperId);
 
-    void save(String paperId, Question question);
+    void save(String paperId, Question question, Integer groupQuestionType);
 }

+ 40 - 13
web/src/main/java/com/ynfy/buss/exam/paperquestionanswer/service/impl/PaperQuestionAnswerServiceImpl.java

@@ -1,11 +1,13 @@
 package com.ynfy.buss.exam.paperquestionanswer.service.impl;
 
+import cn.hutool.core.util.NumberUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ynfy.buss.exam.paperquestionanswer.entity.PaperQuestionAnswer;
 import com.ynfy.buss.exam.paperquestionanswer.mapper.PaperQuestionAnswerMapper;
 import com.ynfy.buss.exam.paperquestionanswer.service.IPaperQuestionAnswerService;
 import com.ynfy.buss.exam.question.entity.Question;
+import com.ynfy.buss.exam.question.enums.QuestionType;
 import com.ynfy.buss.exam.questionanswer.entity.QuestionAnswer;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
@@ -39,25 +41,50 @@ public class PaperQuestionAnswerServiceImpl extends ServiceImpl<PaperQuestionAns
     }
 
     @Override
-    public void save(String paperId, Question question) {
+    public void save(String paperId, Question question, Integer groupQuestionType) {
         List<QuestionAnswer> answerList = question.getAnswerList();
         if (!CollectionUtils.isEmpty(answerList)) {
-            List<QuestionAnswer> pathScoreList = answerList.stream().filter(o ->
-                    !Objects.isNull(o.getPathScore()) && o.getPathScore() > 0).collect(Collectors.toList());
-            if (!CollectionUtils.isEmpty(pathScoreList)) {
-                List<PaperQuestionAnswer> paperQuestionAnswerList = new ArrayList<>();
-                pathScoreList.stream().forEach(ps -> {
-                    PaperQuestionAnswer pqa = new PaperQuestionAnswer();
-                    pqa.setPaperId(paperId);
-                    pqa.setQuestionId(question.getId());
-                    pqa.setAnswerId(ps.getId());
-                    pqa.setPathScore(ps.getPathScore());
+            List<PaperQuestionAnswer> paperQuestionAnswerList = new ArrayList<>();
+            if (QuestionType.COMBINATION.getCode().equals(groupQuestionType)) {//组合题
+                answerList.stream().forEach(answer -> {
+                    //计算每个答案得分
+                    double pathScore = NumberUtil.div(question.getScore().intValue(), answerList.size(), 2);
+                    //生成试卷试题答案
+                    PaperQuestionAnswer pqa = generatePaperQuestionAnswer(paperId, question.getId(), answer.getId(), pathScore);
                     paperQuestionAnswerList.add(pqa);
                 });
-                if (!CollectionUtils.isEmpty(paperQuestionAnswerList)) {
-                    saveBatch(paperQuestionAnswerList);
+            } else {
+                List<QuestionAnswer> pathScoreList = answerList.stream().filter(o ->
+                        !Objects.isNull(o.getPathScore()) && o.getPathScore() > 0).collect(Collectors.toList());
+                if (!CollectionUtils.isEmpty(pathScoreList)) {
+                    pathScoreList.stream().forEach(ps ->
+                            //生成试卷试题答案
+                            paperQuestionAnswerList.add(generatePaperQuestionAnswer(paperId, question.getId(),
+                                    ps.getId(), ps.getPathScore())));
                 }
             }
+            if (!CollectionUtils.isEmpty(paperQuestionAnswerList)) {
+                saveBatch(paperQuestionAnswerList);
+            }
         }
     }
+
+    /**
+     * 生成试卷试题答案
+     *
+     * @param paperId
+     * @param question
+     * @param answerId
+     * @param pathScore
+     * @return
+     */
+    public PaperQuestionAnswer generatePaperQuestionAnswer(String paperId, String questionId,
+                                                           String answerId, Double pathScore) {
+        PaperQuestionAnswer pqa = new PaperQuestionAnswer();
+        pqa.setPaperId(paperId);
+        pqa.setQuestionId(questionId);
+        pqa.setAnswerId(answerId);
+        pqa.setPathScore(pathScore);
+        return pqa;
+    }
 }

+ 2 - 2
web/src/main/java/com/ynfy/buss/exam/paperrulegroup/entity/PaperRuleGroup.java

@@ -64,7 +64,7 @@ public class PaperRuleGroup implements Serializable {
      */
     @Excel(name = "每题分数", width = 15)
     @ApiModelProperty(value = "每题分数")
-    private Integer perScore;
+    private Double perScore;
     /**
      * 题目数量
      */
@@ -76,7 +76,7 @@ public class PaperRuleGroup implements Serializable {
      */
     @Excel(name = "总分数", width = 15)
     @ApiModelProperty(value = "总分数")
-    private Integer totalScore;
+    private Double totalScore;
     /**
      * 排序
      */

+ 2 - 2
web/src/main/java/com/ynfy/buss/exam/paperrulegroup/mapper/xml/PaperRuleGroupMapper.xml

@@ -7,9 +7,9 @@
         <result column="title" property="title" jdbcType="VARCHAR"/>
         <result column="paper_id" property="paperId" jdbcType="VARCHAR"/>
         <result column="question_type" property="questionType" jdbcType="INTEGER"/>
-        <result column="per_score" property="perScore" jdbcType="INTEGER"/>
+        <result column="per_score" property="perScore" jdbcType="DOUBLE"/>
         <result column="question_count" property="questionCount" jdbcType="INTEGER"/>
-        <result column="total_score" property="totalScore" jdbcType="INTEGER"/>
+        <result column="total_score" property="totalScore" jdbcType="DOUBLE"/>
         <result column="sort" property="sort" jdbcType="INTEGER"/>
         <result column="can_miss_option" property="canMissOption" jdbcType="BOOLEAN"/>
         <result column="can_blank_option" property="canBlankOption" jdbcType="BOOLEAN"/>

+ 3 - 2
web/src/main/java/com/ynfy/buss/exam/paperrulegroup/service/impl/PaperRuleGroupServiceImpl.java

@@ -87,6 +87,7 @@ public class PaperRuleGroupServiceImpl extends ServiceImpl<PaperRuleGroupMapper,
         }
         //保存规则组
         saveBatch(groupList);
+        //保存试卷试题和答案
         paperQuestionService.saveAll(paper.getId(), groupList);
 
         //更新试卷
@@ -103,12 +104,12 @@ public class PaperRuleGroupServiceImpl extends ServiceImpl<PaperRuleGroupMapper,
     public void saveRandom(Paper paper, List<PaperRuleGroup> groupList) {
         int allQuestionNum = 0;
         int sort = 1;
-        int totalScore = 0;
+        double totalScore = 0;
         for (PaperRuleGroup item : groupList) {
             item.setPaperId(paper.getId());
             Integer questionNum = item.getRuleList().stream().mapToInt(PaperRuleDetail::getNum).sum();
             item.setQuestionCount(questionNum);
-            int groupTotalScore = questionNum * item.getPerScore();
+            double groupTotalScore = questionNum * item.getPerScore();
             item.setTotalScore(groupTotalScore);
             totalScore += groupTotalScore;
             allQuestionNum += questionNum;

+ 1 - 1
web/src/main/java/com/ynfy/buss/exam/question/entity/Question.java

@@ -125,7 +125,7 @@ public class Question implements Serializable {
      * 分数
      */
     @TableField(exist = false)
-    private Integer score;
+    private Double score;
 
     /**
      * 答案选项

+ 5 - 5
web/src/main/java/com/ynfy/buss/exam/userexam/entity/UserExam.java

@@ -68,7 +68,7 @@ public class UserExam implements Serializable {
      */
     @Excel(name = "用户得分", width = 15)
     @ApiModelProperty(value = "用户得分")
-    private Integer userScore;
+    private Double userScore;
     /**
      * 交卷时间
      */
@@ -121,14 +121,14 @@ public class UserExam implements Serializable {
      */
     @Excel(name = "及格分", width = 15)
     @ApiModelProperty(value = "及格分")
-    private Integer qualifyScore;
+    private Double qualifyScore;
 
     /**
      * 试卷总分
      */
     @Excel(name = "试卷总分", width = 15)
     @ApiModelProperty(value = "试卷总分")
-    private Integer totalScore;
+    private Double totalScore;
 
     /**
      * 是否通过
@@ -150,14 +150,14 @@ public class UserExam implements Serializable {
      */
     @Excel(name = "主观题得分", width = 15)
     @ApiModelProperty(value = "主观题得分")
-    private Integer subjectiveScore;
+    private Double subjectiveScore;
 
     /**
      * 客观题得分
      */
     @Excel(name = "客观题得分", width = 15)
     @ApiModelProperty(value = "客观题得分")
-    private Integer objectiveScore;
+    private Double objectiveScore;
 
     /**
      * 阅卷人

+ 7 - 7
web/src/main/java/com/ynfy/buss/exam/userexam/mapper/xml/UserExamMapper.xml

@@ -7,20 +7,20 @@
         <result column="exam_id" property="examId" jdbcType="VARCHAR"/>
         <result column="paper_id" property="paperId" jdbcType="VARCHAR"/>
         <result column="user_time" property="userTime" jdbcType="INTEGER"/>
-        <result column="user_score" property="userScore" jdbcType="INTEGER"/>
+        <result column="user_score" property="userScore" jdbcType="DOUBLE"/>
         <result column="commit_time" property="commitTime" jdbcType="TIMESTAMP"/>
         <result column="state" property="state" jdbcType="INTEGER"/>
         <result column="limit_time" property="limitTime" jdbcType="TIMESTAMP"/>
-        <result column="qualify_score" property="qualifyScore" jdbcType="INTEGER"/>
-        <result column="total_score" property="totalScore" jdbcType="INTEGER"/>
+        <result column="qualify_score" property="qualifyScore" jdbcType="DOUBLE"/>
+        <result column="total_score" property="totalScore" jdbcType="DOUBLE"/>
         <result column="passed" property="passed" jdbcType="INTEGER"/>
         <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
         <result column="leave_on" property="leaveOn" jdbcType="BOOLEAN"/>
         <result column="total_leave_times" property="totalLeaveTimes" jdbcType="INTEGER"/>
         <result column="leave_time" property="leaveTime" jdbcType="INTEGER"/>
         <result column="has_subjective" property="hasSubjective" jdbcType="BOOLEAN"/>
-        <result column="subjective_score" property="subjectiveScore" jdbcType="INTEGER"/>
-        <result column="objective_score" property="objectiveScore" jdbcType="INTEGER"/>
+        <result column="subjective_score" property="subjectiveScore" jdbcType="DOUBLE"/>
+        <result column="objective_score" property="objectiveScore" jdbcType="DOUBLE"/>
         <result column="exam_result_showtype" property="examResultShowtype" jdbcType="INTEGER"/>
         <result column="show_deadline" property="showDeadline" jdbcType="INTEGER"/>
         <result column="preview_time" property="previewTime" jdbcType="TIMESTAMP"/>
@@ -35,12 +35,12 @@
             <result column="question_id" property="questionId" jdbcType="VARCHAR"/>
             <result column="question_type" property="questionType" jdbcType="INTEGER"/>
             <result column="sort" property="sort" jdbcType="INTEGER"/>
-            <result column="question_score" property="questionScore" jdbcType="INTEGER"/>
+            <result column="question_score" property="questionScore" jdbcType="DOUBLE"/>
             <result column="answered" property="answered" jdbcType="BOOLEAN"/>
             <result column="is_right" property="isRight" jdbcType="BOOLEAN"/>
             <result column="answer" property="answer" jdbcType="VARCHAR"/>
             <result column="question_index" property="questionIndex" jdbcType="INTEGER"/>
-            <result column="actual_score" property="actualScore" jdbcType="INTEGER"/>
+            <result column="actual_score" property="actualScore" jdbcType="DOUBLE"/>
             <result column="can_miss_option" property="canMissOption" jdbcType="BOOLEAN"/>
             <result column="can_blank_option" property="canBlankOption" jdbcType="BOOLEAN"/>
             <result column="child" property="child" jdbcType="BOOLEAN"/>

+ 2 - 2
web/src/main/java/com/ynfy/buss/exam/userexamquestion/entity/UserExamQuestion.java

@@ -67,7 +67,7 @@ public class UserExamQuestion implements Serializable {
      */
     @Excel(name = "题目分值", width = 15)
     @ApiModelProperty(value = "题目分值")
-    private Integer questionScore;
+    private Double questionScore;
     /**
      * 是否已答
      */
@@ -127,7 +127,7 @@ public class UserExamQuestion implements Serializable {
      */
     @Excel(name = "实际得分", width = 15)
     @ApiModelProperty(value = "实际得分")
-    private Integer actualScore;
+    private Double actualScore;
 
     /**
      * 漏选也给分

+ 1 - 1
web/src/main/java/com/ynfy/buss/exam/userexamresult/entity/UserExamResult.java

@@ -60,7 +60,7 @@ public class UserExamResult implements Serializable {
      */
     @Excel(name = "最高分数", width = 15)
     @ApiModelProperty(value = "最高分数")
-    private Integer maxScore;
+    private Double maxScore;
     /**
      * 是否通过
      */

+ 3 - 3
web/src/main/java/com/ynfy/buss/exam/userexamresult/entity/vo/UserExamScoreVO.java

@@ -19,7 +19,7 @@ public class UserExamScoreVO implements Serializable {
     /**
      * 最高得分
      */
-    private Integer maxScore;
+    private Double maxScore;
 
     /**
      * 是否通过
@@ -30,12 +30,12 @@ public class UserExamScoreVO implements Serializable {
     /**
      * 试卷总分
      */
-    private Integer totalScore;
+    private Double totalScore;
 
     /**
      * 及格分
      */
-    private Integer qualifyScore;
+    private Double qualifyScore;
 
     /**
      * 试题总数

+ 1 - 1
web/src/main/java/com/ynfy/buss/exam/userexamresult/service/IUserExamResultService.java

@@ -23,7 +23,7 @@ public interface IUserExamResultService extends IService<UserExamResult> {
      * @param score
      * @param passed
      */
-    void joinResult(String userId, String examId, Integer score, int passed);
+    void joinResult(String userId, String examId, Double score, int passed);
 
 
     /**

+ 1 - 1
web/src/main/java/com/ynfy/buss/exam/userexamresult/service/impl/UserExamResultServiceImpl.java

@@ -35,7 +35,7 @@ public class UserExamResultServiceImpl extends ServiceImpl<UserExamResultMapper,
      * @param passed
      */
     @Override
-    public void joinResult(String userId, String examId, Integer score, int passed) {
+    public void joinResult(String userId, String examId, Double score, int passed) {
         LambdaQueryWrapper<UserExamResult> wrapper = new LambdaQueryWrapper();
         wrapper.eq(UserExamResult::getUserId, userId).eq(UserExamResult::getExamId, examId);
         UserExamResult record = this.getOne(wrapper);