Pārlūkot izejas kodu

新增客观题判分规则;客观题检查新增识别坐标

yin 1 gadu atpakaļ
vecāks
revīzija
83655f4019

+ 5 - 0
distributed-print-business/src/main/resources/db/log/update-yin.sql

@@ -0,0 +1,5 @@
+update mark_question t
+set t.objective_policy = 'LEAK'
+where t.category = 'LEAK_HALF';
+ALTER TABLE `mark_question`
+    ADD COLUMN `objective_policy_score` double DEFAULT NULL COMMENT '客观题判分策略计分';

+ 16 - 2
teachcloud-common/src/main/java/com/qmth/teachcloud/common/entity/MarkQuestion.java

@@ -2,11 +2,14 @@ package com.qmth.teachcloud.common.entity;
 
 import java.io.Serializable;
 
-import com.baomidou.mybatisplus.annotation.*;
+import com.baomidou.mybatisplus.annotation.FieldStrategy;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
-
 import com.qmth.teachcloud.common.enums.ObjectivePolicy;
+
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
@@ -69,6 +72,9 @@ public class MarkQuestion implements Serializable {
     @ApiModelProperty(value = "客观题判分策略")
     private ObjectivePolicy objectivePolicy;
 
+    @ApiModelProperty(value = "客观题判分策略计分")
+    private Double objectivePolicyScore;
+
     @ApiModelProperty(value = "题型")
     private Integer questionType;
     
@@ -234,4 +240,12 @@ public class MarkQuestion implements Serializable {
             ", name=" + name +
         "}";
     }
+
+    public Double getObjectivePolicyScore() {
+        return objectivePolicyScore;
+    }
+
+    public void setObjectivePolicyScore(Double objectivePolicyScore) {
+        this.objectivePolicyScore = objectivePolicyScore;
+    }
 }

+ 1 - 1
teachcloud-common/src/main/java/com/qmth/teachcloud/common/enums/ObjectivePolicy.java

@@ -5,7 +5,7 @@ package com.qmth.teachcloud.common.enums;
  * 
  */
 public enum ObjectivePolicy {
-    NONE("无", 1), ALL("任选给分", 2), LEAK("漏选给分", 3);
+    NONE("全对给全分", 1), ALL("任选给全分", 2), LEAK_HALF("漏选给半分", 3),LEAK("漏选给分", 4);
 
     private String name;
 

+ 12 - 1
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/dto/mark/score/SheetUrlDto.java

@@ -6,12 +6,15 @@ public class SheetUrlDto {
 
     private String url;
 
+    private String recogData;
+
     public SheetUrlDto() {
     }
 
-    public SheetUrlDto(int index, String url) {
+    public SheetUrlDto(int index, String url,String recogData) {
         this.index = index;
         this.url = url;
+        this.recogData = recogData;
     }
 
     public int getIndex() {
@@ -29,4 +32,12 @@ public class SheetUrlDto {
     public void setUrl(String url) {
         this.url = url;
     }
+
+    public String getRecogData() {
+        return recogData;
+    }
+
+    public void setRecogData(String recogData) {
+        this.recogData = recogData;
+    }
 }

+ 9 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/dto/mark/score/StudentPaperDetailDto.java

@@ -12,6 +12,7 @@ public class StudentPaperDetailDto {
     private Integer cardNumber;
     private Integer pageIndex;
     private String sheetPath;
+    private String recogData;
 
     public Long getStudentId() {
         return studentId;
@@ -60,4 +61,12 @@ public class StudentPaperDetailDto {
     public void setSheetPath(String sheetPath) {
         this.sheetPath = sheetPath;
     }
+
+    public String getRecogData() {
+        return recogData;
+    }
+
+    public void setRecogData(String recogData) {
+        this.recogData = recogData;
+    }
 }

+ 21 - 11
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkQuestionServiceImpl.java

@@ -1,5 +1,17 @@
 package com.qmth.teachcloud.mark.service.impl;
 
+import java.util.*;
+import java.util.stream.Collectors;
+
+import javax.annotation.Resource;
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.MapUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
+
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@@ -7,6 +19,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.MarkQuestion;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
+import com.qmth.teachcloud.common.enums.ObjectivePolicy;
 import com.qmth.teachcloud.common.enums.QuestionType;
 import com.qmth.teachcloud.common.enums.UploadFileEnum;
 import com.qmth.teachcloud.common.service.TeachcloudCommonService;
@@ -19,17 +32,6 @@ import com.qmth.teachcloud.mark.params.MarkQuestionParams;
 import com.qmth.teachcloud.mark.service.MarkGroupService;
 import com.qmth.teachcloud.mark.service.MarkPaperService;
 import com.qmth.teachcloud.mark.service.MarkQuestionService;
-import jdk.nashorn.internal.runtime.QuotedStringTokenizer;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.MapUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.multipart.MultipartFile;
-
-import javax.annotation.Resource;
-import java.util.*;
-import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -191,6 +193,14 @@ public class MarkQuestionServiceImpl extends ServiceImpl<MarkQuestionMapper, Mar
             if (StringUtils.isBlank(question.getAnswer())) {
                 throw ExceptionResultEnum.ERROR.exception("答案不能为空");
             }
+            if (question.getObjectivePolicy() != null && question.getObjectivePolicy().equals(ObjectivePolicy.LEAK)) {
+                if(question.getObjectivePolicyScore()==null){
+                    throw ExceptionResultEnum.ERROR.exception("漏选给分不能没有计分规则");
+                }
+                if(question.getObjectivePolicyScore()>(question.getTotalScore()/question.getAnswer().length())){
+                    throw ExceptionResultEnum.ERROR.exception("漏选给分计分规则有误");
+                }
+            }
             UpdateWrapper<MarkQuestion> updateWrapper = new UpdateWrapper<>();
             updateWrapper.lambda().set(MarkQuestion::getAnswer, question.getAnswer());
             if (question.getObjectivePolicy() != null) {

+ 2 - 2
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkStudentServiceImpl.java

@@ -9,7 +9,6 @@ import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.constraints.NotNull;
 
-import com.google.zxing.client.result.BookmarkDoCoMoResultParser;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -239,7 +238,8 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
             StudentPaperDetailDto studentPaperDetailDto = studentPaperDetailDtoList.get(i);
             sheetUrls.add(new SheetUrlDto(
                     2 * (studentPaperDetailDto.getPaperIndex() - 1) + studentPaperDetailDto.getPageIndex(),
-                    teachcloudCommonService.filePreview(studentPaperDetailDto.getSheetPath())));
+                    teachcloudCommonService.filePreview(studentPaperDetailDto.getSheetPath()),
+                    studentPaperDetailDto.getRecogData()));
         }
         return sheetUrls;
     }

+ 15 - 8
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/utils/ScoreCalculateUtil.java

@@ -1,16 +1,17 @@
 package com.qmth.teachcloud.mark.utils;
 
-import com.qmth.teachcloud.mark.dto.mark.ScoreInfo;
-import com.qmth.teachcloud.mark.dto.mark.ScoreItem;
-import com.qmth.teachcloud.common.entity.MarkQuestion;
-import com.qmth.teachcloud.mark.entity.MarkStudent;
-import com.qmth.teachcloud.common.enums.ObjectivePolicy;
+import java.util.LinkedList;
+import java.util.List;
+
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.LinkedList;
-import java.util.List;
+import com.qmth.teachcloud.common.entity.MarkQuestion;
+import com.qmth.teachcloud.common.enums.ObjectivePolicy;
+import com.qmth.teachcloud.mark.dto.mark.ScoreInfo;
+import com.qmth.teachcloud.mark.dto.mark.ScoreItem;
+import com.qmth.teachcloud.mark.entity.MarkStudent;
 
 public class ScoreCalculateUtil {
 
@@ -66,7 +67,7 @@ public class ScoreCalculateUtil {
             }
 
             boolean correct = true;
-
+            int correctCount = 0;
             // 客观题判分策略
             // 任选给分
             if (ObjectivePolicy.ALL.equals(question.getObjectivePolicy())) {
@@ -76,9 +77,15 @@ public class ScoreCalculateUtil {
                     if (!question.getAnswer().contains(String.valueOf(answer.charAt(i)))) {
                         correct = false;
                         break;
+                    }else{
+                        correctCount ++;
                     }
                 }
                 if (correct & ObjectivePolicy.LEAK.equals(question.getObjectivePolicy())) {
+                    score = answer.length() < question.getAnswer().length() ? question.getObjectivePolicyScore()*correctCount: question
+                            .getTotalScore();
+                }
+                if (correct & ObjectivePolicy.LEAK_HALF.equals(question.getObjectivePolicy())) {
                     score = answer.length() < question.getAnswer().length() ? question.getTotalScore() / 2 : question
                             .getTotalScore();
                 }

+ 34 - 36
teachcloud-mark/src/main/resources/mapper/ScanPaperMapper.xml

@@ -4,54 +4,52 @@
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.qmth.teachcloud.mark.entity.ScanPaper">
-        <id column="id" property="id" />
-        <result column="exam_id" property="examId" />
-        <result column="card_number" property="cardNumber" />
-        <result column="number" property="number" />
-        <result column="page_count" property="pageCount" />
-        <result column="mismatch" property="mismatch" />
-        <result column="assigned" property="assigned" />
-        <result column="question_filled" property="questionFilled" />
-        <result column="creator_id" property="creatorId" />
-        <result column="updater_id" property="updaterId" />
-        <result column="create_time" property="createTime" />
-        <result column="update_time" property="updateTime" />
+        <id column="id" property="id"/>
+        <result column="exam_id" property="examId"/>
+        <result column="card_number" property="cardNumber"/>
+        <result column="number" property="number"/>
+        <result column="page_count" property="pageCount"/>
+        <result column="mismatch" property="mismatch"/>
+        <result column="assigned" property="assigned"/>
+        <result column="question_filled" property="questionFilled"/>
+        <result column="creator_id" property="creatorId"/>
+        <result column="updater_id" property="updaterId"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_time" property="updateTime"/>
     </resultMap>
     <select id="listStudentPaperDetail" resultType="com.qmth.teachcloud.mark.dto.mark.score.StudentPaperDetailDto">
-        SELECT
-            ssp.student_id studentId,
-            ssp.paper_index paperIndex,
-            ssp.paper_id paperId,
-            sp.card_number cardNumber,
-            spp.page_index pageIndex,
-            spp.sheet_path sheetPath
-        FROM
-            (SELECT
-                 student_id, paper_index, paper_id
-             FROM
-                 scan_student_paper
-             WHERE
-                 student_id = #{studentId}) ssp
-                JOIN
-            scan_paper sp ON ssp.paper_id = sp.id
-                AND ssp.paper_index = sp.number
-                JOIN
-            scan_paper_page spp ON sp.id = spp.paper_id
-        ORDER BY ssp.paper_index , spp.page_index
+        SELECT ssp.student_id  studentId,
+               ssp.paper_index paperIndex,
+               ssp.paper_id    paperId,
+               sp.card_number  cardNumber,
+               spp.page_index  pageIndex,
+               spp.sheet_path  sheetPath,
+               spp.recog_data  recogData
+        FROM (SELECT student_id,
+                     paper_index,
+                     paper_id
+              FROM scan_student_paper
+              WHERE student_id = #{studentId}) ssp
+                 JOIN
+             scan_paper sp ON ssp.paper_id = sp.id
+                 AND ssp.paper_index = sp.number
+                 JOIN
+             scan_paper_page spp ON sp.id = spp.paper_id
+        ORDER BY ssp.paper_index, spp.page_index
     </select>
     <select id="findStudentPaper"
             resultType="com.qmth.teachcloud.mark.bean.scanpaper.PaperVo">
         SELECT p.id,
                t.paper_index number,
-               b.id           batchId,
-               u.login_name userName,
-               p.create_time  createTime,
+               b.id          batchId,
+               u.login_name  userName,
+               p.create_time createTime,
                p.mismatch
         FROM scan_student_paper t
                  inner join scan_paper p on t.paper_id = p.id
                  left join scan_batch_paper bp on bp.paper_id = p.id
                  left join scan_batch b on bp.batch_id = b.id
-                 left join sys_user u on b.user_id=u.id
+                 left join sys_user u on b.user_id = u.id
         WHERE t.student_id = #{studentId}
         ORDER BY t.paper_index
     </select>