Pārlūkot izejas kodu

add: 知学知考 数据初始化查询

caozixuan 3 gadi atpakaļ
vecāks
revīzija
5ceb4560e9

+ 87 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/result/analyze/GradeInitResult.java

@@ -0,0 +1,87 @@
+package com.qmth.distributed.print.business.bean.result.analyze;
+
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * @Description: 教研分析数据初始化界面结果呈现类
+ * @Author: CaoZixuan
+ * @Date: 2022-05-26
+ */
+public class GradeInitResult {
+    @ApiModelProperty(value = "学期名称")
+    private String semesterName;
+
+    @ApiModelProperty(value = "考试名称")
+    private String examName;
+
+    @ApiModelProperty(value = "课程编号")
+    private String courseCode;
+
+    @ApiModelProperty(value = "课程名称")
+    private String courseName;
+
+    @ApiModelProperty(value = "试卷编号")
+    private String paperNumber;
+
+    @ApiModelProperty(value = "试卷类型")
+    private String paperType;
+
+    @ApiModelProperty(value = "试卷名称")
+    private String paperName;
+
+    public String getSemesterName() {
+        return semesterName;
+    }
+
+    public void setSemesterName(String semesterName) {
+        this.semesterName = semesterName;
+    }
+
+    public String getExamName() {
+        return examName;
+    }
+
+    public void setExamName(String examName) {
+        this.examName = examName;
+    }
+
+    public String getCourseCode() {
+        return courseCode;
+    }
+
+    public void setCourseCode(String courseCode) {
+        this.courseCode = courseCode;
+    }
+
+    public String getCourseName() {
+        return courseName;
+    }
+
+    public void setCourseName(String courseName) {
+        this.courseName = courseName;
+    }
+
+    public String getPaperNumber() {
+        return paperNumber;
+    }
+
+    public void setPaperNumber(String paperNumber) {
+        this.paperNumber = paperNumber;
+    }
+
+    public String getPaperType() {
+        return paperType;
+    }
+
+    public void setPaperType(String paperType) {
+        this.paperType = paperType;
+    }
+
+    public String getPaperName() {
+        return paperName;
+    }
+
+    public void setPaperName(String paperName) {
+        this.paperName = paperName;
+    }
+}

+ 12 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/GradeBatch.java

@@ -42,6 +42,10 @@ public class GradeBatch extends BaseEntity implements Serializable {
     @ApiModelProperty(value = "批次状态")
     private GradeAnalyzePaperStatusEnum status;
 
+    @ApiModelProperty(value = "第三方考试id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long thirdExamId;
+
     public Long getSchoolId() {
         return schoolId;
     }
@@ -89,4 +93,12 @@ public class GradeBatch extends BaseEntity implements Serializable {
     public void setStatus(GradeAnalyzePaperStatusEnum status) {
         this.status = status;
     }
+
+    public Long getThirdExamId() {
+        return thirdExamId;
+    }
+
+    public void setThirdExamId(Long thirdExamId) {
+        this.thirdExamId = thirdExamId;
+    }
 }

+ 11 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/GradeBatchPaper.java

@@ -53,6 +53,9 @@ public class GradeBatchPaper extends BaseEntity implements Serializable {
     @ApiModelProperty(value = "开课学院名称")
     private String teachCollegeName;
 
+    @ApiModelProperty(value = "教研分析课程代码")
+    private String gradeCourseCode;
+
     public Long getSchoolId() {
         return schoolId;
     }
@@ -124,4 +127,12 @@ public class GradeBatchPaper extends BaseEntity implements Serializable {
     public void setTeachCollegeName(String teachCollegeName) {
         this.teachCollegeName = teachCollegeName;
     }
+
+    public String getGradeCourseCode() {
+        return gradeCourseCode;
+    }
+
+    public void setGradeCourseCode(String gradeCourseCode) {
+        this.gradeCourseCode = gradeCourseCode;
+    }
 }

+ 32 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/GradeInitializeMapper.java

@@ -0,0 +1,32 @@
+package com.qmth.distributed.print.business.mapper;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.qmth.distributed.print.business.bean.result.analyze.GradeInitResult;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * @Description: 教研分析-试卷初始化页面(老师)
+ * @Author: CaoZixuan
+ * @Date: 2022-05-26
+ */
+public interface GradeInitializeMapper {
+
+    /**
+     * 查找老师需要提供分析参数的试卷
+     *
+     * @param iPage      分页参数
+     * @param semesterId 学期id
+     * @param examId     考试id
+     * @param courseCode 课程编号
+     * @param userId     命题教师id
+     * @param schoolId   学校id
+     * @return 结果
+     */
+    IPage<GradeInitResult> findNeedAnalyzedPaper(@Param("iPage") Page<GradeInitResult> iPage,
+                                                 @Param("semesterId") Long semesterId,
+                                                 @Param("examId") Long examId,
+                                                 @Param("courseCode") String courseCode,
+                                                 @Param("userId") Long userId,
+                                                 @Param("schoolId") Long schoolId);
+}

+ 24 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/GradeInitializeService.java

@@ -0,0 +1,24 @@
+package com.qmth.distributed.print.business.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.qmth.distributed.print.business.bean.result.analyze.GradeInitResult;
+import com.qmth.teachcloud.common.entity.SysUser;
+
+/**
+ * @Description: 教研分析对接-数据初始化服务实现类
+ * @Author: CaoZixuan
+ * @Date: 2022-05-26
+ */
+public interface GradeInitializeService {
+
+    /**
+     * 查询需要分析的试卷
+     *
+     * @param semesterId  学期id
+     * @param examId      考试id
+     * @param courseCode  课程编号
+     * @param requestUser 请求的命题老师
+     * @return 试卷结果
+     */
+    IPage<GradeInitResult> findNeedAnalyzedPaper(Long semesterId, Long examId, String courseCode, SysUser requestUser,int pageNumber,int pageSize);
+}

+ 30 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/GradeInitializeServiceImpl.java

@@ -0,0 +1,30 @@
+package com.qmth.distributed.print.business.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.qmth.distributed.print.business.bean.result.analyze.GradeInitResult;
+import com.qmth.distributed.print.business.mapper.GradeInitializeMapper;
+import com.qmth.distributed.print.business.service.GradeInitializeService;
+import com.qmth.teachcloud.common.entity.SysUser;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+/**
+ * @Description: 教研分析对接-数据初始化服务实现类
+ * @Author: CaoZixuan
+ * @Date: 2022-05-26
+ */
+@Service
+public class GradeInitializeServiceImpl implements GradeInitializeService {
+    @Resource
+    GradeInitializeMapper gradeInitializeMapper;
+
+
+    @Override
+    public IPage<GradeInitResult> findNeedAnalyzedPaper(Long semesterId, Long examId, String courseCode, SysUser requestUser,int pageNumber,int pageSize) {
+        Long schoolId = requestUser.getSchoolId();
+        Long userId = requestUser.getId();
+        return gradeInitializeMapper.findNeedAnalyzedPaper(new Page<>(pageNumber, pageSize), semesterId,examId,courseCode,userId,schoolId);
+    }
+}

+ 53 - 0
distributed-print-business/src/main/resources/mapper/GradeInitializeMapper.xml

@@ -0,0 +1,53 @@
+<?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.distributed.print.business.mapper.GradeInitializeMapper">
+
+    <select id="findNeedAnalyzedPaper"
+            resultType="com.qmth.distributed.print.business.bean.result.analyze.GradeInitResult">
+        SELECT
+            bs.name AS semesterName,
+            be.name AS examName,
+            et.course_code AS courseCode,
+            et.course_name AS courseName,
+            et.paper_number AS paperNumber,
+            pnpt.paper_type AS paperType,
+            pnpt.paper_name AS paperName
+        FROM
+            exam_task et
+                INNER JOIN
+            exam_task_detail etd ON et.id = etd.exam_task_id
+                INNER JOIN
+            (SELECT
+                 school_id,
+                 paper_number,
+                 paper_type,
+                 MAX(paper_name) AS paper_name
+             FROM
+                 grade_batch_paper
+             GROUP BY school_id , paper_number , paper_type) pnpt ON et.school_id = pnpt.school_id
+                AND et.paper_number = pnpt.paper_number
+                AND LOCATE(pnpt.paper_type, etd.relate_paper_type)
+                LEFT JOIN
+            basic_exam be ON et.exam_id = be.id
+                LEFT JOIN
+            basic_semester bs ON bs.id = be.semester_id
+        <where>
+            <if test="schoolId != null and schoolId != ''">
+                AND et.school_id = #{schoolId}
+            </if>
+            <if test="semesterId != null and semesterId != ''">
+                AND bs.id = #{semesterId}
+            </if>
+            <if test="examId != null and examId != ''">
+                AND be.id = #{examId}
+            </if>
+            <if test="courseCode != null and courseCode != ''">
+                AND et.course_code = #{courseCode}
+            </if>
+            <if test="userId != null and userId != ''">
+                AND et.user_id = #{userId}
+            </if>
+        </where>
+        ORDER BY bs.name , be.name , et.course_code , et.paper_number , pnpt.paper_type
+    </select>
+</mapper>