Bläddra i källkod

3.4.5 update-20250410,新功能开发

xiaofei 2 månader sedan
förälder
incheckning
ca30a66a75

+ 129 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/entity/MarkOcrStudentQuestion.java

@@ -0,0 +1,129 @@
+package com.qmth.teachcloud.mark.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.io.Serializable;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * <p>
+ * 考生主观题小题OCR识别结果
+ * </p>
+ *
+ * @author xf
+ * @since 2025-04-10
+ */
+@TableName("mark_ocr_student_question")
+@ApiModel(value="MarkOcrStudentQuestion对象", description="考生主观题小题OCR识别结果")
+public class MarkOcrStudentQuestion implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.INPUT)
+    private Long id;
+
+    @ApiModelProperty(value = "考试ID")
+    private Long examId;
+
+    @ApiModelProperty(value = "试卷编号")
+    private String paperNumber;
+
+    @ApiModelProperty(value = "考生ID")
+    private Long studentId;
+
+    @ApiModelProperty(value = "题目ID")
+    private Long questionId;
+
+    @ApiModelProperty(value = "图片序号")
+    private Integer number;
+
+    @ApiModelProperty(value = "图片md5")
+    private String md5;
+
+    @ApiModelProperty(value = "ocr识别内容")
+    private String ocrContent;
+
+    @ApiModelProperty(value = "识别时间")
+    private Long createTime;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+    public Long getExamId() {
+        return examId;
+    }
+
+    public void setExamId(Long examId) {
+        this.examId = examId;
+    }
+    public String getPaperNumber() {
+        return paperNumber;
+    }
+
+    public void setPaperNumber(String paperNumber) {
+        this.paperNumber = paperNumber;
+    }
+    public Long getStudentId() {
+        return studentId;
+    }
+
+    public void setStudentId(Long studentId) {
+        this.studentId = studentId;
+    }
+    public Long getQuestionId() {
+        return questionId;
+    }
+
+    public void setQuestionId(Long questionId) {
+        this.questionId = questionId;
+    }
+    public Integer getNumber() {
+        return number;
+    }
+
+    public void setNumber(Integer number) {
+        this.number = number;
+    }
+    public String getMd5() {
+        return md5;
+    }
+
+    public void setMd5(String md5) {
+        this.md5 = md5;
+    }
+    public String getOcrContent() {
+        return ocrContent;
+    }
+
+    public void setOcrContent(String ocrContent) {
+        this.ocrContent = ocrContent;
+    }
+    public Long getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Long createTime) {
+        this.createTime = createTime;
+    }
+
+    @Override
+    public String toString() {
+        return "MarkOcrStudentQuestion{" +
+            "id=" + id +
+            ", examId=" + examId +
+            ", paperNumber=" + paperNumber +
+            ", studentId=" + studentId +
+            ", questionId=" + questionId +
+            ", number=" + number +
+            ", md5=" + md5 +
+            ", ocrContent=" + ocrContent +
+            ", createTime=" + createTime +
+        "}";
+    }
+}

+ 16 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/mapper/MarkOcrStudentQuestionMapper.java

@@ -0,0 +1,16 @@
+package com.qmth.teachcloud.mark.mapper;
+
+import com.qmth.teachcloud.mark.entity.MarkOcrStudentQuestion;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 考生主观题小题OCR识别结果 Mapper 接口
+ * </p>
+ *
+ * @author xf
+ * @since 2025-04-10
+ */
+public interface MarkOcrStudentQuestionMapper extends BaseMapper<MarkOcrStudentQuestion> {
+
+}

+ 3 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/MarkAiQuestionLevelService.java

@@ -3,6 +3,8 @@ package com.qmth.teachcloud.mark.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.qmth.teachcloud.mark.entity.MarkAiQuestionLevel;
 
+import java.util.List;
+
 /**
  * <p>
  * AI评卷得分明细表 服务类
@@ -13,4 +15,5 @@ import com.qmth.teachcloud.mark.entity.MarkAiQuestionLevel;
  */
 public interface MarkAiQuestionLevelService extends IService<MarkAiQuestionLevel> {
 
+    List<MarkAiQuestionLevel> listByAiQuestionId(Long id);
 }

+ 2 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/MarkAiQuestionParamService.java

@@ -12,5 +12,7 @@ import com.qmth.teachcloud.mark.entity.MarkAiQuestionParam;
  * @since 2025-04-10
  */
 public interface MarkAiQuestionParamService extends IService<MarkAiQuestionParam> {
+    boolean existMarkAiQuestionScoreOrLevel(Long examId, String paperNumber, Long questionId);
 
+    MarkAiQuestionParam getByExamIdAndPaperNumberAndQuestionId(Long examId, String paperNumber, Long questionId);
 }

+ 3 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/MarkAiQuestionScoreService.java

@@ -3,6 +3,8 @@ package com.qmth.teachcloud.mark.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.qmth.teachcloud.mark.entity.MarkAiQuestionScore;
 
+import java.util.List;
+
 /**
  * <p>
  * AI评卷得分明细表 服务类
@@ -13,4 +15,5 @@ import com.qmth.teachcloud.mark.entity.MarkAiQuestionScore;
  */
 public interface MarkAiQuestionScoreService extends IService<MarkAiQuestionScore> {
 
+    List<MarkAiQuestionScore> listByAiQuestionId(Long id);
 }

+ 16 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/MarkOcrStudentQuestionService.java

@@ -0,0 +1,16 @@
+package com.qmth.teachcloud.mark.service;
+
+import com.qmth.teachcloud.mark.entity.MarkOcrStudentQuestion;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 考生主观题小题OCR识别结果 服务类
+ * </p>
+ *
+ * @author xf
+ * @since 2025-04-10
+ */
+public interface MarkOcrStudentQuestionService extends IService<MarkOcrStudentQuestion> {
+
+}

+ 9 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkAiQuestionLevelServiceImpl.java

@@ -1,11 +1,14 @@
 package com.qmth.teachcloud.mark.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.teachcloud.mark.entity.MarkAiQuestionLevel;
 import com.qmth.teachcloud.mark.mapper.MarkAiQuestionLevelMapper;
 import com.qmth.teachcloud.mark.service.MarkAiQuestionLevelService;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * <p>
  * AI评卷得分明细表 服务实现类
@@ -17,4 +20,10 @@ import org.springframework.stereotype.Service;
 @Service
 public class MarkAiQuestionLevelServiceImpl extends ServiceImpl<MarkAiQuestionLevelMapper, MarkAiQuestionLevel> implements MarkAiQuestionLevelService {
 
+    @Override
+    public List<MarkAiQuestionLevel> listByAiQuestionId(Long id) {
+        QueryWrapper<MarkAiQuestionLevel> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(MarkAiQuestionLevel::getAiQuestionId, id);
+        return this.list(queryWrapper);
+    }
 }

+ 42 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkAiQuestionParamServiceImpl.java

@@ -1,11 +1,21 @@
 package com.qmth.teachcloud.mark.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.teachcloud.mark.entity.MarkAiQuestionLevel;
 import com.qmth.teachcloud.mark.entity.MarkAiQuestionParam;
+import com.qmth.teachcloud.mark.entity.MarkAiQuestionScore;
+import com.qmth.teachcloud.mark.enums.AiQuestionParamModeStatus;
 import com.qmth.teachcloud.mark.mapper.MarkAiQuestionParamMapper;
+import com.qmth.teachcloud.mark.service.MarkAiQuestionLevelService;
 import com.qmth.teachcloud.mark.service.MarkAiQuestionParamService;
+import com.qmth.teachcloud.mark.service.MarkAiQuestionScoreService;
+import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
+import java.util.List;
+
 /**
  * <p>
  * AI评卷参数表 服务实现类
@@ -17,4 +27,36 @@ import org.springframework.stereotype.Service;
 @Service
 public class MarkAiQuestionParamServiceImpl extends ServiceImpl<MarkAiQuestionParamMapper, MarkAiQuestionParam> implements MarkAiQuestionParamService {
 
+    @Resource
+    private MarkAiQuestionScoreService markAiQuestionScoreService;
+    @Resource
+    private MarkAiQuestionLevelService markAiQuestionLevelService;
+
+    @Override
+    public boolean existMarkAiQuestionScoreOrLevel(Long examId, String paperNumber, Long questionId) {
+        MarkAiQuestionParam markAiQuestionParam = this.getByExamIdAndPaperNumberAndQuestionId(examId, paperNumber, questionId);
+        if (markAiQuestionParam == null) {
+            return false;
+        }
+        // 按得分点
+        if (AiQuestionParamModeStatus.SCORE.equals(markAiQuestionParam.getMode())) {
+            List<MarkAiQuestionScore> markAiQuestionScores = markAiQuestionScoreService.listByAiQuestionId(markAiQuestionParam.getId());
+            return CollectionUtils.isNotEmpty(markAiQuestionScores);
+        }
+        // 按档次
+        if (AiQuestionParamModeStatus.LEVEL.equals(markAiQuestionParam.getMode())) {
+            List<MarkAiQuestionLevel> markAiQuestionLevels = markAiQuestionLevelService.listByAiQuestionId(markAiQuestionParam.getId());
+            return CollectionUtils.isNotEmpty(markAiQuestionLevels);
+        }
+        return false;
+    }
+
+    @Override
+    public MarkAiQuestionParam getByExamIdAndPaperNumberAndQuestionId(Long examId, String paperNumber, Long questionId) {
+        QueryWrapper<MarkAiQuestionParam> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(MarkAiQuestionParam::getExamId, examId)
+                .eq(MarkAiQuestionParam::getPaperNumber, paperNumber)
+                .eq(MarkAiQuestionParam::getQuestionId, questionId);
+        return this.getOne(queryWrapper);
+    }
 }

+ 9 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkAiQuestionScoreServiceImpl.java

@@ -1,11 +1,14 @@
 package com.qmth.teachcloud.mark.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.teachcloud.mark.entity.MarkAiQuestionScore;
 import com.qmth.teachcloud.mark.mapper.MarkAiQuestionScoreMapper;
 import com.qmth.teachcloud.mark.service.MarkAiQuestionScoreService;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * <p>
  * AI评卷得分明细表 服务实现类
@@ -17,4 +20,10 @@ import org.springframework.stereotype.Service;
 @Service
 public class MarkAiQuestionScoreServiceImpl extends ServiceImpl<MarkAiQuestionScoreMapper, MarkAiQuestionScore> implements MarkAiQuestionScoreService {
 
+    @Override
+    public List<MarkAiQuestionScore> listByAiQuestionId(Long id) {
+        QueryWrapper<MarkAiQuestionScore> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(MarkAiQuestionScore::getAiQuestionId, id);
+        return this.list(queryWrapper);
+    }
 }

+ 20 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkOcrStudentQuestionServiceImpl.java

@@ -0,0 +1,20 @@
+package com.qmth.teachcloud.mark.service.impl;
+
+import com.qmth.teachcloud.mark.entity.MarkOcrStudentQuestion;
+import com.qmth.teachcloud.mark.mapper.MarkOcrStudentQuestionMapper;
+import com.qmth.teachcloud.mark.service.MarkOcrStudentQuestionService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 考生主观题小题OCR识别结果 服务实现类
+ * </p>
+ *
+ * @author xf
+ * @since 2025-04-10
+ */
+@Service
+public class MarkOcrStudentQuestionServiceImpl extends ServiceImpl<MarkOcrStudentQuestionMapper, MarkOcrStudentQuestion> implements MarkOcrStudentQuestionService {
+
+}

+ 18 - 0
teachcloud-mark/src/main/resources/mapper/MarkOcrStudentQuestionMapper.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.qmth.teachcloud.mark.mapper.MarkOcrStudentQuestionMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.qmth.teachcloud.mark.entity.MarkOcrStudentQuestion">
+        <id column="id" property="id" />
+        <result column="exam_id" property="examId" />
+        <result column="paper_number" property="paperNumber" />
+        <result column="student_id" property="studentId" />
+        <result column="question_id" property="questionId" />
+        <result column="number" property="number" />
+        <result column="md5" property="md5" />
+        <result column="ocr_content" property="ocrContent" />
+        <result column="create_time" property="createTime" />
+    </resultMap>
+
+</mapper>