Browse Source

新增可观题答案没有则为0分

wangliang 2 years ago
parent
commit
b7bc381540

+ 1 - 0
themis-admin/src/main/java/com/qmth/themis/admin/api/TIeInvigilateController.java

@@ -353,6 +353,7 @@ public class TIeInvigilateController {
         }
         invigilateListDetailBean.setMonitorVideoSource(examCacheBean.getMonitorVideoSource());
         invigilateListDetailBean.setMonitorRecord(examCacheBean.getMonitorRecord());
+        invigilateListDetailBean.setExamStudentCallEnable(examCacheBean.getExamStudentCallEnable());
         return ResultUtil.ok(invigilateListDetailBean);
     }
 

+ 11 - 0
themis-business/src/main/java/com/qmth/themis/business/bean/admin/InvigilateListDetailBean.java

@@ -87,6 +87,17 @@ public class InvigilateListDetailBean implements Serializable {
     @ApiModelProperty(name = "转录源")
     private String monitorRecord;
 
+    @ApiModelProperty(value = "是否允许考生发起语音通话,false:否,true:是")
+    private Boolean examStudentCallEnable = true;
+
+    public Boolean getExamStudentCallEnable() {
+        return examStudentCallEnable;
+    }
+
+    public void setExamStudentCallEnable(Boolean examStudentCallEnable) {
+        this.examStudentCallEnable = examStudentCallEnable;
+    }
+
     public String getMonitorVideoSource() {
         return monitorVideoSource;
     }

+ 12 - 12
themis-business/src/main/java/com/qmth/themis/business/cache/bean/ExamCacheBean.java

@@ -175,36 +175,36 @@ public class ExamCacheBean implements Serializable {
     @ApiModelProperty(value = "第三方考试id")
     private String thirdExamId;
 
-    @ApiModelProperty(value = "是否允许考生发起语音通话,0:否,1:是")
-    private Integer examStudentCallEnable;
+    @ApiModelProperty(value = "是否允许考生发起语音通话,false:否,true:是")
+    private Boolean examStudentCallEnable;
 
-    @ApiModelProperty(value = "是否推送客观分,0:否,1:是")
-    private Integer objectiveScorePush;
+    @ApiModelProperty(value = "是否推送客观分,false:否,true:是")
+    private Boolean objectiveScorePush;
 
-    @ApiModelProperty(value = "是否推送违纪考生,0:否,1:是")
-    private Integer examStudentBreachPush;
+    @ApiModelProperty(value = "是否推送违纪考生,false:否,true:是")
+    private Boolean examStudentBreachPush;
 
-    public Integer getExamStudentCallEnable() {
+    public Boolean getExamStudentCallEnable() {
         return examStudentCallEnable;
     }
 
-    public void setExamStudentCallEnable(Integer examStudentCallEnable) {
+    public void setExamStudentCallEnable(Boolean examStudentCallEnable) {
         this.examStudentCallEnable = examStudentCallEnable;
     }
 
-    public Integer getObjectiveScorePush() {
+    public Boolean getObjectiveScorePush() {
         return objectiveScorePush;
     }
 
-    public void setObjectiveScorePush(Integer objectiveScorePush) {
+    public void setObjectiveScorePush(Boolean objectiveScorePush) {
         this.objectiveScorePush = objectiveScorePush;
     }
 
-    public Integer getExamStudentBreachPush() {
+    public Boolean getExamStudentBreachPush() {
         return examStudentBreachPush;
     }
 
-    public void setExamStudentBreachPush(Integer examStudentBreachPush) {
+    public void setExamStudentBreachPush(Boolean examStudentBreachPush) {
         this.examStudentBreachPush = examStudentBreachPush;
     }
 

+ 4 - 4
themis-business/src/main/java/com/qmth/themis/business/dto/request/TEExamDto.java

@@ -196,8 +196,8 @@ public class TEExamDto extends BaseEntity {
     @TableField(value = "in_process_realness_verify")
     private Integer inProcessRealnessVerify;
 
-    @ApiModelProperty(value = "是否允许考生发起语音通话,0:否,1:是")
-    private Integer examStudentCallEnable = 1;
+    @ApiModelProperty(value = "是否允许考生发起语音通话,false:否,true:是")
+    private Boolean examStudentCallEnable = true;
 
     public TEExamDto() {
 
@@ -274,11 +274,11 @@ public class TEExamDto extends BaseEntity {
         this.examStudentCallEnable = teExam.getExamStudentCallEnable();
     }
 
-    public Integer getExamStudentCallEnable() {
+    public Boolean getExamStudentCallEnable() {
         return examStudentCallEnable;
     }
 
-    public void setExamStudentCallEnable(Integer examStudentCallEnable) {
+    public void setExamStudentCallEnable(Boolean examStudentCallEnable) {
         this.examStudentCallEnable = examStudentCallEnable;
     }
 

+ 9 - 9
themis-business/src/main/java/com/qmth/themis/business/entity/TEExam.java

@@ -209,13 +209,13 @@ public class TEExam extends BaseEntity {
     private String thirdExamId;
 
     @ApiModelProperty(value = "是否允许考生发起语音通话,0:否,1:是")
-    private Integer examStudentCallEnable = 1;
+    private Boolean examStudentCallEnable = true;
 
     @ApiModelProperty(value = "是否推送客观分,0:否,1:是")
-    private Integer objectiveScorePush = 0;
+    private Boolean objectiveScorePush = false;
 
     @ApiModelProperty(value = "是否推送违纪考生,0:否,1:是")
-    private Integer examStudentBreachPush = 0;
+    private Boolean examStudentBreachPush = false;
 
     public TEExam() {
 
@@ -298,27 +298,27 @@ public class TEExam extends BaseEntity {
         this.examStudentCallEnable = teExamDto.getExamStudentCallEnable();
     }
 
-    public Integer getExamStudentCallEnable() {
+    public Boolean getExamStudentCallEnable() {
         return examStudentCallEnable;
     }
 
-    public void setExamStudentCallEnable(Integer examStudentCallEnable) {
+    public void setExamStudentCallEnable(Boolean examStudentCallEnable) {
         this.examStudentCallEnable = examStudentCallEnable;
     }
 
-    public Integer getObjectiveScorePush() {
+    public Boolean getObjectiveScorePush() {
         return objectiveScorePush;
     }
 
-    public void setObjectiveScorePush(Integer objectiveScorePush) {
+    public void setObjectiveScorePush(Boolean objectiveScorePush) {
         this.objectiveScorePush = objectiveScorePush;
     }
 
-    public Integer getExamStudentBreachPush() {
+    public Boolean getExamStudentBreachPush() {
         return examStudentBreachPush;
     }
 
-    public void setExamStudentBreachPush(Integer examStudentBreachPush) {
+    public void setExamStudentBreachPush(Boolean examStudentBreachPush) {
         this.examStudentBreachPush = examStudentBreachPush;
     }
 

+ 35 - 24
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEExamServiceImpl.java

@@ -691,6 +691,12 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
         return ret;
     }
 
+    /**
+     * 统分
+     *
+     * @param answer
+     * @param recordId
+     */
     private void calculateObjectiveScore(ExamStudentAnswerCacheBean answer, Long recordId) {
         if (answer.getObjective() == null || !answer.getObjective()) {
             return;
@@ -712,44 +718,49 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
         if (cb == null) {
             throw new BusinessException(ExceptionResultEnum.NOT_FOUND_QUESTION_OBJECTIVE_ANSWER);
         }
-
         if (cb.getStructType().intValue() == 1) {
-            if (checkSingleChoice(answer.getAnswer(), cb.getChoiceAnswer())) {
-                answer.setScore(cb.getScore());
+            if (Objects.nonNull(cb.getChoiceAnswer()) && cb.getChoiceAnswer().size() > 0) {
+                if (checkSingleChoice(answer.getAnswer(), cb.getChoiceAnswer())) {
+                    answer.setScore(cb.getScore());
+                } else {
+                    answer.setScore(0.0);
+                }
             } else {
                 answer.setScore(0.0);
             }
         }
         if (cb.getStructType().intValue() == 2) {
             ExamCacheBean ec = getExamCacheBeanNative(ExamRecordCacheUtil.getExamId(recordId));
-            int r = checkMultipleChoice(answer.getAnswer(), cb.getChoiceAnswer());
-            if (ec.getObjectiveScorePolicy().equals(ObjectiveScorePolicyEnum.EQUAL)) {// 全对给分
-                if (r == 1) {
-                    answer.setScore(cb.getScore());
-                } else {
-                    answer.setScore(0.0);
+            if (Objects.nonNull(cb.getChoiceAnswer()) && cb.getChoiceAnswer().size() > 0) {
+                int r = checkMultipleChoice(answer.getAnswer(), cb.getChoiceAnswer());
+                if (ec.getObjectiveScorePolicy().equals(ObjectiveScorePolicyEnum.EQUAL)) {// 全对给分
+                    if (r == 1) {
+                        answer.setScore(cb.getScore());
+                    } else {
+                        answer.setScore(0.0);
+                    }
                 }
-            }
-            if (ec.getObjectiveScorePolicy().equals(ObjectiveScorePolicyEnum.PARTIAL)) {// 漏选半分
-                if (r == 1) {
-                    answer.setScore(cb.getScore());
-                } else if (r == 0) {
-                    BigDecimal b = new BigDecimal(cb.getScore()).divide(new BigDecimal("2"), 1, BigDecimal.ROUND_UP);
-                    answer.setScore(b.doubleValue());
-                } else {
-                    answer.setScore(0.0);
+                if (ec.getObjectiveScorePolicy().equals(ObjectiveScorePolicyEnum.PARTIAL)) {// 漏选半分
+                    if (r == 1) {
+                        answer.setScore(cb.getScore());
+                    } else if (r == 0) {
+                        BigDecimal b = new BigDecimal(cb.getScore()).divide(new BigDecimal("2"), 1, BigDecimal.ROUND_UP);
+                        answer.setScore(b.doubleValue());
+                    } else {
+                        answer.setScore(0.0);
+                    }
                 }
+            } else {
+                answer.setScore(0.0);
             }
         }
         if (cb.getStructType().intValue() == 3) {
             if (StringUtils.isNotBlank(answer.getAnswer())) {
                 String answerStr = answer.getAnswer().replaceAll("\n", "");
-                if (StringUtils.isNotBlank(answerStr)) {
-                    if (Boolean.parseBoolean(answerStr) == cb.getBoolAnswer().booleanValue()) {
-                        answer.setScore(cb.getScore());
-                    } else {
-                        answer.setScore(0.0);
-                    }
+                if (Objects.nonNull(answerStr) && Objects.nonNull(cb.getBoolAnswer()) && Boolean.parseBoolean(answerStr) == cb.getBoolAnswer().booleanValue()) {
+                    answer.setScore(cb.getScore());
+                } else {
+                    answer.setScore(0.0);
                 }
             }
         }

+ 29 - 27
themis-business/src/main/java/com/qmth/themis/business/service/impl/TOeExamRecordServiceImpl.java

@@ -842,7 +842,6 @@ public class TOeExamRecordServiceImpl extends ServiceImpl<TOeExamRecordMapper, T
     @Transactional
     @Override
     public void calculateScore(Long recordId) {
-
         TOeExamRecord rec = this.getById(recordId);
 
         ExamPaperCacheBean ep = examPaperService.getExamPaperCacheBean(rec.getPaperId());
@@ -885,50 +884,53 @@ public class TOeExamRecordServiceImpl extends ServiceImpl<TOeExamRecordMapper, T
             log.info("not a objective question  recordId:" + answer.getExamRecordId() + " key:" + key);
             return null;
         }
-
         if (cb.getStructType().intValue() == 1) {
-            if (checkSingleChoice(answer.getAnswer(), cb.getChoiceAnswer())) {
-                answer.setScore(cb.getScore());
+            if (Objects.nonNull(cb.getChoiceAnswer()) && cb.getChoiceAnswer().size() > 0) {
+                if (checkSingleChoice(answer.getAnswer(), cb.getChoiceAnswer())) {
+                    answer.setScore(cb.getScore());
+                } else {
+                    answer.setScore(0.0);
+                }
             } else {
                 answer.setScore(0.0);
             }
         }
         if (cb.getStructType().intValue() == 2) {
             ExamCacheBean ec = examService.getExamCacheBean(tOeExamRecordMapper.selectById(recordId).getExamId());
-            int r = checkMultipleChoice(answer.getAnswer(), cb.getChoiceAnswer());
-            if (ec.getObjectiveScorePolicy().equals(ObjectiveScorePolicyEnum.EQUAL)) {// 全对给分
-                if (r == 1) {
-                    answer.setScore(cb.getScore());
-                } else {
-                    answer.setScore(0.0);
+            if (Objects.nonNull(cb.getChoiceAnswer()) && cb.getChoiceAnswer().size() > 0) {
+                int r = checkMultipleChoice(answer.getAnswer(), cb.getChoiceAnswer());
+                if (ec.getObjectiveScorePolicy().equals(ObjectiveScorePolicyEnum.EQUAL)) {// 全对给分
+                    if (r == 1) {
+                        answer.setScore(cb.getScore());
+                    } else {
+                        answer.setScore(0.0);
+                    }
                 }
-            }
-            if (ec.getObjectiveScorePolicy().equals(ObjectiveScorePolicyEnum.PARTIAL)) {// 漏选半分
-                if (r == 1) {
-                    answer.setScore(cb.getScore());
-                } else if (r == 0) {
-                    BigDecimal b = new BigDecimal(cb.getScore()).divide(new BigDecimal("2"), 1, BigDecimal.ROUND_UP);
-                    answer.setScore(b.doubleValue());
-                } else {
-                    answer.setScore(0.0);
+                if (ec.getObjectiveScorePolicy().equals(ObjectiveScorePolicyEnum.PARTIAL)) {// 漏选半分
+                    if (r == 1) {
+                        answer.setScore(cb.getScore());
+                    } else if (r == 0) {
+                        BigDecimal b = new BigDecimal(cb.getScore()).divide(new BigDecimal("2"), 1, BigDecimal.ROUND_UP);
+                        answer.setScore(b.doubleValue());
+                    } else {
+                        answer.setScore(0.0);
+                    }
                 }
+            } else {
+                answer.setScore(0.0);
             }
         }
         if (cb.getStructType().intValue() == 3) {
             if (StringUtils.isNotBlank(answer.getAnswer())) {
                 String answerStr = answer.getAnswer().replaceAll("\n", "");
-                if (StringUtils.isNotBlank(answerStr)) {
-                    if (Boolean.parseBoolean(answerStr) == cb.getBoolAnswer().booleanValue()) {
-                        answer.setScore(cb.getScore());
-                    } else {
-                        answer.setScore(0.0);
-                    }
+                if (Objects.nonNull(answerStr) && Objects.nonNull(cb.getBoolAnswer()) && Boolean.parseBoolean(answerStr) == cb.getBoolAnswer().booleanValue()) {
+                    answer.setScore(cb.getScore());
+                } else {
+                    answer.setScore(0.0);
                 }
             }
         }
-
         examAnswerService.saveOrUpdate(answer);
-
         return answer.getScore();
     }