Browse Source

add: 知学知考 分析试卷蓝图管理

caozixuan 3 years ago
parent
commit
e8902cfbc5
15 changed files with 989 additions and 10 deletions
  1. 158 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/excel/GradePaperStructDto.java
  2. 2 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/marking/Question.java
  3. 1 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/params/analyze/GradePaperDimensionParam.java
  4. 102 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/params/analyze/GradePaperStructDatasource.java
  5. 64 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/params/analyze/GradePaperStructParam.java
  6. 146 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/result/analyze/GradePaperStructResult.java
  7. 44 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/result/analyze/SecondDimensionResult.java
  8. 13 4
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/GradePaperStruct.java
  9. 12 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/GradePaperStructMapper.java
  10. 15 3
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/GradePaperDimensionService.java
  11. 46 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/GradePaperStructService.java
  12. 29 2
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/GradePaperDimensionServiceImpl.java
  13. 295 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/GradePaperStructServiceImpl.java
  14. 41 0
      distributed-print-business/src/main/resources/mapper/GradePaperStructMapper.xml
  15. 21 0
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/enums/QuestionType.java

+ 158 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/excel/GradePaperStructDto.java

@@ -0,0 +1,158 @@
+package com.qmth.distributed.print.business.bean.dto.excel;
+
+import com.qmth.teachcloud.common.annotation.ExcelNote;
+import com.qmth.teachcloud.common.annotation.ExcelProperty;
+import com.qmth.teachcloud.common.enums.QuestionType;
+
+import javax.validation.constraints.NotNull;
+import java.math.BigDecimal;
+
+/**
+ * @Description: 分析试卷结构excel操作类
+ * @Author: CaoZixuan
+ * @Date: 2022-05-30
+ */
+public class GradePaperStructDto {
+    @ExcelNote(value = "课程代码")
+    @ExcelProperty(name = "课程代码", width = 30, index = 1)
+    @NotNull
+    private String courseCode;
+
+    @ExcelNote(value = "课程名称")
+    @ExcelProperty(name = "课程名称", width = 30, index = 2)
+    @NotNull
+    private String courseName;
+
+    @ExcelNote(value = "试卷编号")
+    @ExcelProperty(name = "试卷编号", width = 30, index = 3)
+    @NotNull
+    private String paperNumber;
+
+    @ExcelNote(value = "试卷类型")
+    @ExcelProperty(name = "试卷类型", width = 30, index = 4)
+    @NotNull
+    private String paperType;
+
+    @ExcelNote(value = "题目类型")
+    @ExcelProperty(name = "题目类型", width = 30, index = 5)
+    @NotNull
+    private QuestionType numberType;
+
+    @ExcelNote(value = "大题名称")
+    @ExcelProperty(name = "大题名称", width = 30, index = 6)
+    @NotNull
+    private String bigTopicName;
+
+    @ExcelNote(value = "大题号")
+    @ExcelProperty(name = "大题号", width = 30, index = 7)
+    @NotNull
+    private String bigQuestionNumber;
+
+    @ExcelNote(value = "小题号")
+    @ExcelProperty(name = "小题号", width = 30, index = 8)
+    @NotNull
+    private String smallQuestionNumber;
+
+    @ExcelNote(value = "题目满分")
+    @ExcelProperty(name = "题目满分", width = 30, index = 9)
+    @NotNull
+    private BigDecimal fullScore;
+
+    @ExcelNote(value = "知识维度")
+    @ExcelProperty(name = "知识维度", width = 30, index = 10)
+    @NotNull
+    private String knowledgeDimension;
+
+    @ExcelNote(value = "能力维度")
+    @ExcelProperty(name = "能力维度", width = 30, index = 11)
+    @NotNull
+    private String abilityDimension;
+
+    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 QuestionType getNumberType() {
+        return numberType;
+    }
+
+    public void setNumberType(QuestionType numberType) {
+        this.numberType = numberType;
+    }
+
+    public String getBigTopicName() {
+        return bigTopicName;
+    }
+
+    public void setBigTopicName(String bigTopicName) {
+        this.bigTopicName = bigTopicName;
+    }
+
+    public String getBigQuestionNumber() {
+        return bigQuestionNumber;
+    }
+
+    public void setBigQuestionNumber(String bigQuestionNumber) {
+        this.bigQuestionNumber = bigQuestionNumber;
+    }
+
+    public String getSmallQuestionNumber() {
+        return smallQuestionNumber;
+    }
+
+    public void setSmallQuestionNumber(String smallQuestionNumber) {
+        this.smallQuestionNumber = smallQuestionNumber;
+    }
+
+    public BigDecimal getFullScore() {
+        return fullScore;
+    }
+
+    public void setFullScore(BigDecimal fullScore) {
+        this.fullScore = fullScore;
+    }
+
+    public String getKnowledgeDimension() {
+        return knowledgeDimension;
+    }
+
+    public void setKnowledgeDimension(String knowledgeDimension) {
+        this.knowledgeDimension = knowledgeDimension;
+    }
+
+    public String getAbilityDimension() {
+        return abilityDimension;
+    }
+
+    public void setAbilityDimension(String abilityDimension) {
+        this.abilityDimension = abilityDimension;
+    }
+}

+ 2 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/marking/Question.java

@@ -118,4 +118,6 @@ public class Question {
         }
         }
         return true;
         return true;
     }
     }
+
+
 }
 }

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/params/GradePaperDimensionParam.java → distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/params/analyze/GradePaperDimensionParam.java

@@ -1,4 +1,4 @@
-package com.qmth.distributed.print.business.bean.params;
+package com.qmth.distributed.print.business.bean.params.analyze;
 
 
 import com.qmth.distributed.print.business.enums.DimensionEnum;
 import com.qmth.distributed.print.business.enums.DimensionEnum;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;

+ 102 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/params/analyze/GradePaperStructDatasource.java

@@ -0,0 +1,102 @@
+package com.qmth.distributed.print.business.bean.params.analyze;
+
+import com.qmth.teachcloud.common.enums.QuestionType;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.math.BigDecimal;
+
+/**
+ * @Description: 分析试卷参数数据源
+ * @Author: CaoZixuan
+ * @Date: 2022-05-30
+ */
+public class GradePaperStructDatasource {
+
+    @ApiModelProperty(value = "大题号")
+    private String bigQuestionNumber;
+
+    @ApiModelProperty(value = "小题号(每一课程试卷的唯一标识)")
+    private String smallQuestionNumber;
+
+    @ApiModelProperty(value = "大题名称")
+    private String bigTopicName;
+
+    @ApiModelProperty(value = "题号类型(客观题、主观题)")
+    private QuestionType numberType;
+
+    @ApiModelProperty(value = "满分")
+    private BigDecimal fullScore;
+
+    @ApiModelProperty(value = "计分规则")
+    private String scoreRules;
+
+    @ApiModelProperty(value = "知识维度")
+    private String knowledgeDimension;
+
+    @ApiModelProperty(value = "能力维度")
+    private String abilityDimension;
+
+    public String getBigQuestionNumber() {
+        return bigQuestionNumber;
+    }
+
+    public void setBigQuestionNumber(String bigQuestionNumber) {
+        this.bigQuestionNumber = bigQuestionNumber;
+    }
+
+    public String getSmallQuestionNumber() {
+        return smallQuestionNumber;
+    }
+
+    public void setSmallQuestionNumber(String smallQuestionNumber) {
+        this.smallQuestionNumber = smallQuestionNumber;
+    }
+
+    public String getBigTopicName() {
+        return bigTopicName;
+    }
+
+    public void setBigTopicName(String bigTopicName) {
+        this.bigTopicName = bigTopicName;
+    }
+
+    public QuestionType getNumberType() {
+        return numberType;
+    }
+
+    public void setNumberType(QuestionType numberType) {
+        this.numberType = numberType;
+    }
+
+    public BigDecimal getFullScore() {
+        return fullScore;
+    }
+
+    public void setFullScore(BigDecimal fullScore) {
+        this.fullScore = fullScore;
+    }
+
+    public String getScoreRules() {
+        return scoreRules;
+    }
+
+    public void setScoreRules(String scoreRules) {
+        this.scoreRules = scoreRules;
+    }
+
+    public String getKnowledgeDimension() {
+        return knowledgeDimension;
+    }
+
+    public void setKnowledgeDimension(String knowledgeDimension) {
+        this.knowledgeDimension = knowledgeDimension;
+    }
+
+    public String getAbilityDimension() {
+        return abilityDimension;
+    }
+
+    public void setAbilityDimension(String abilityDimension) {
+        this.abilityDimension = abilityDimension;
+    }
+}

+ 64 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/params/analyze/GradePaperStructParam.java

@@ -0,0 +1,64 @@
+package com.qmth.distributed.print.business.bean.params.analyze;
+
+import io.swagger.annotations.ApiModelProperty;
+import org.hibernate.validator.constraints.Range;
+
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+/**
+ * @Description: 分析试卷结构参数
+ * @Author: CaoZixuan
+ * @Date: 2022-05-30
+ */
+public class GradePaperStructParam {
+
+    @ApiModelProperty(value = "试卷编号")
+    @NotNull(message = "缺少试卷编号")
+    private String paperNumber;
+
+    @ApiModelProperty(value = "试卷类型")
+    @NotNull(message = "缺少试卷类型")
+    private String paperType;
+
+    @ApiModelProperty(value = "试卷名称")
+    @NotNull(message = "缺少试卷名称")
+    private String paperName;
+
+    @ApiModelProperty(value = "分析试卷数据集")
+    @NotNull(message = "请填写试卷结构")
+    @Range(min = 1L, message = "请填写试卷结构")
+    private List<GradePaperStructDatasource> datasource;
+
+    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;
+    }
+
+    public List<GradePaperStructDatasource> getDatasource() {
+        return datasource;
+    }
+
+    public void setDatasource(List<GradePaperStructDatasource> datasource) {
+        this.datasource = datasource;
+    }
+}

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

@@ -0,0 +1,146 @@
+package com.qmth.distributed.print.business.bean.result.analyze;
+
+import com.qmth.teachcloud.common.enums.QuestionType;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.math.BigDecimal;
+
+/**
+ * @Description: 分析试卷结构列表对象
+ * @Author: CaoZixuan
+ * @Date: 2022-05-30
+ */
+public class GradePaperStructResult {
+
+    @ApiModelProperty(value = "课程编号")
+    private String courseCode;
+
+    @ApiModelProperty(value = "课程名称")
+    private String courseName;
+
+    @ApiModelProperty(value = "试卷编号")
+    private String paperNumber;
+
+    @ApiModelProperty(value = "试卷类型")
+    private String paperType;
+
+    @ApiModelProperty(value = "题号类型(主观题,客观题)")
+    private QuestionType numberType;
+
+    @ApiModelProperty(value = "大题名称")
+    private String bigTopicName;
+
+    @ApiModelProperty(value = "大题号")
+    private String bigQuestionNumber;
+
+    @ApiModelProperty(value = "小题号")
+    private String smallQuestionNumber;
+
+    @ApiModelProperty(value = "满分")
+    private BigDecimal fullScore;
+
+    @ApiModelProperty(value = "计分规则")
+    private String scoreRules;
+
+    @ApiModelProperty(value = "知识模块")
+    private String knowledgeDimension;
+
+    @ApiModelProperty(value = "能力模块")
+    private String abilityDimension;
+
+    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 QuestionType getNumberType() {
+        return numberType;
+    }
+
+    public void setNumberType(QuestionType numberType) {
+        this.numberType = numberType;
+    }
+
+    public String getBigTopicName() {
+        return bigTopicName;
+    }
+
+    public void setBigTopicName(String bigTopicName) {
+        this.bigTopicName = bigTopicName;
+    }
+
+    public String getBigQuestionNumber() {
+        return bigQuestionNumber;
+    }
+
+    public void setBigQuestionNumber(String bigQuestionNumber) {
+        this.bigQuestionNumber = bigQuestionNumber;
+    }
+
+    public String getSmallQuestionNumber() {
+        return smallQuestionNumber;
+    }
+
+    public void setSmallQuestionNumber(String smallQuestionNumber) {
+        this.smallQuestionNumber = smallQuestionNumber;
+    }
+
+    public BigDecimal getFullScore() {
+        return fullScore;
+    }
+
+    public void setFullScore(BigDecimal fullScore) {
+        this.fullScore = fullScore;
+    }
+
+    public String getScoreRules() {
+        return scoreRules;
+    }
+
+    public void setScoreRules(String scoreRules) {
+        this.scoreRules = scoreRules;
+    }
+
+    public String getKnowledgeDimension() {
+        return knowledgeDimension;
+    }
+
+    public void setKnowledgeDimension(String knowledgeDimension) {
+        this.knowledgeDimension = knowledgeDimension;
+    }
+
+    public String getAbilityDimension() {
+        return abilityDimension;
+    }
+
+    public void setAbilityDimension(String abilityDimension) {
+        this.abilityDimension = abilityDimension;
+    }
+}

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

@@ -0,0 +1,44 @@
+package com.qmth.distributed.print.business.bean.result.analyze;
+
+import com.qmth.distributed.print.business.enums.DimensionEnum;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * @Description: 分析试卷二级维度返回值
+ * @Author: CaoZixuan
+ * @Date: 2022-05-30
+ */
+public class SecondDimensionResult {
+    @ApiModelProperty(value = "二级维度编号")
+    private String code;
+
+    @ApiModelProperty(value = "二级维度名称")
+    private String name;
+
+    @ApiModelProperty(value = "二级维度类型")
+    private DimensionEnum type;
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public DimensionEnum getType() {
+        return type;
+    }
+
+    public void setType(DimensionEnum type) {
+        this.type = type;
+    }
+}

+ 13 - 4
distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/GradePaperStruct.java

@@ -3,6 +3,7 @@ package com.qmth.distributed.print.business.entity;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.qmth.teachcloud.common.base.BaseEntity;
 import com.qmth.teachcloud.common.base.BaseEntity;
+import com.qmth.teachcloud.common.enums.QuestionType;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
 
 
@@ -35,11 +36,11 @@ public class GradePaperStruct extends BaseEntity implements Serializable {
     @ApiModelProperty(value = "试卷名称")
     @ApiModelProperty(value = "试卷名称")
     private String paperName;
     private String paperName;
 
 
-    @ApiModelProperty(value = "题名称")
+    @ApiModelProperty(value = "题名称")
     private String questionName;
     private String questionName;
 
 
     @ApiModelProperty(value = "题号类型(客观题、主观题)")
     @ApiModelProperty(value = "题号类型(客观题、主观题)")
-    private String numberType;
+    private QuestionType numberType;
 
 
     @ApiModelProperty(value = "大题号")
     @ApiModelProperty(value = "大题号")
     private String bigQuestionNumber;
     private String bigQuestionNumber;
@@ -84,6 +85,14 @@ public class GradePaperStruct extends BaseEntity implements Serializable {
         this.paperNumber = paperNumber;
         this.paperNumber = paperNumber;
     }
     }
 
 
+    public String getPaperType() {
+        return paperType;
+    }
+
+    public void setPaperType(String paperType) {
+        this.paperType = paperType;
+    }
+
     public String getPaperName() {
     public String getPaperName() {
         return paperName;
         return paperName;
     }
     }
@@ -100,11 +109,11 @@ public class GradePaperStruct extends BaseEntity implements Serializable {
         this.questionName = questionName;
         this.questionName = questionName;
     }
     }
 
 
-    public String getNumberType() {
+    public QuestionType getNumberType() {
         return numberType;
         return numberType;
     }
     }
 
 
-    public void setNumberType(String numberType) {
+    public void setNumberType(QuestionType numberType) {
         this.numberType = numberType;
         this.numberType = numberType;
     }
     }
 
 

+ 12 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/GradePaperStructMapper.java

@@ -2,9 +2,12 @@ package com.qmth.distributed.print.business.mapper;
 
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.qmth.distributed.print.business.bean.dto.open.PaperStructure;
 import com.qmth.distributed.print.business.bean.dto.open.PaperStructure;
+import com.qmth.distributed.print.business.bean.result.analyze.GradePaperStructResult;
 import com.qmth.distributed.print.business.entity.GradePaperStruct;
 import com.qmth.distributed.print.business.entity.GradePaperStruct;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
 
 
+import java.util.List;
+
 /**
 /**
  * <p>
  * <p>
  * 分析-试卷结构(蓝图)表 Mapper 接口
  * 分析-试卷结构(蓝图)表 Mapper 接口
@@ -14,6 +17,15 @@ import org.apache.ibatis.annotations.Param;
  * @since 2022-05-20
  * @since 2022-05-20
  */
  */
 public interface GradePaperStructMapper extends BaseMapper<GradePaperStruct> {
 public interface GradePaperStructMapper extends BaseMapper<GradePaperStruct> {
+    /**
+     * 从分析试卷结构中查找试卷结构数据
+     *
+     * @param schoolId    学校id
+     * @param paperNumber 试卷编号
+     * @param paperType   试卷类型
+     * @return 结果
+     */
+    List<GradePaperStructResult> findStructByGradePaper(@Param("schoolId") Long schoolId, @Param("paperNumber") String paperNumber, @Param("paperType") String paperType);
 
 
     PaperStructure findBySchoolIdAndPaperNumberAndPaperType(@Param("schoolId") Long schoolId, @Param("paperNumber") String paperNumber, @Param("paperType") String paperType);
     PaperStructure findBySchoolIdAndPaperNumberAndPaperType(@Param("schoolId") Long schoolId, @Param("paperNumber") String paperNumber, @Param("paperType") String paperType);
 }
 }

+ 15 - 3
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/GradePaperDimensionService.java

@@ -2,8 +2,9 @@ package com.qmth.distributed.print.business.service;
 
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.qmth.distributed.print.business.bean.dto.open.PaperDimension;
 import com.qmth.distributed.print.business.bean.dto.open.PaperDimension;
-import com.qmth.distributed.print.business.bean.params.GradePaperDimensionParam;
+import com.qmth.distributed.print.business.bean.params.analyze.GradePaperDimensionParam;
 import com.qmth.distributed.print.business.bean.result.analyze.GradePaperDimensionResult;
 import com.qmth.distributed.print.business.bean.result.analyze.GradePaperDimensionResult;
+import com.qmth.distributed.print.business.bean.result.analyze.SecondDimensionResult;
 import com.qmth.distributed.print.business.entity.GradePaperDimension;
 import com.qmth.distributed.print.business.entity.GradePaperDimension;
 import com.qmth.distributed.print.business.enums.DimensionEnum;
 import com.qmth.distributed.print.business.enums.DimensionEnum;
 import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.entity.SysUser;
@@ -24,12 +25,13 @@ public interface GradePaperDimensionService extends IService<GradePaperDimension
 
 
     /**
     /**
      * 查询分析试卷维度
      * 查询分析试卷维度
+     *
      * @param paperNumber 试卷编号
      * @param paperNumber 试卷编号
-     * @param paperType 试卷类型
+     * @param paperType   试卷类型
      * @param requestUser 请求用户
      * @param requestUser 请求用户
      * @return 结果集
      * @return 结果集
      */
      */
-    List<GradePaperDimensionResult> findGradePaperDimensionList(String paperNumber,String paperType,SysUser requestUser);
+    List<GradePaperDimensionResult> findGradePaperDimensionList(String paperNumber, String paperType, SysUser requestUser);
 
 
     /**
     /**
      * 批量保存分析试卷维度数据
      * 批量保存分析试卷维度数据
@@ -68,5 +70,15 @@ public interface GradePaperDimensionService extends IService<GradePaperDimension
      */
      */
     void exportGradePaperDimensionTemplate(String courseCode, String courseName, DimensionEnum dimensionType) throws Exception;
     void exportGradePaperDimensionTemplate(String courseCode, String courseName, DimensionEnum dimensionType) throws Exception;
 
 
+    /**
+     * 分析 - 查询二级维度集合
+     * @param paperNumber 试卷编号
+     * @param paperType 试卷类型
+     * @param dimensionType 维度类型
+     * @param requestUser 请求用户
+     * @return 结果
+     */
+    List<SecondDimensionResult> findSecondDimensionList(String paperNumber, String paperType, DimensionEnum dimensionType, SysUser requestUser);
+
     PaperDimension findBySchoolIdAndPaperNumberAndPaperType(Long schoolId, String paperNumber, String paperType);
     PaperDimension findBySchoolIdAndPaperNumberAndPaperType(Long schoolId, String paperNumber, String paperType);
 }
 }

+ 46 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/GradePaperStructService.java

@@ -2,7 +2,14 @@ package com.qmth.distributed.print.business.service;
 
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.qmth.distributed.print.business.bean.dto.open.PaperStructure;
 import com.qmth.distributed.print.business.bean.dto.open.PaperStructure;
+import com.qmth.distributed.print.business.bean.params.analyze.GradePaperStructParam;
+import com.qmth.distributed.print.business.bean.result.analyze.GradePaperStructResult;
 import com.qmth.distributed.print.business.entity.GradePaperStruct;
 import com.qmth.distributed.print.business.entity.GradePaperStruct;
+import com.qmth.teachcloud.common.entity.SysUser;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+import java.util.List;
 
 
 /**
 /**
  * <p>
  * <p>
@@ -14,5 +21,44 @@ import com.qmth.distributed.print.business.entity.GradePaperStruct;
  */
  */
 public interface GradePaperStructService extends IService<GradePaperStruct> {
 public interface GradePaperStructService extends IService<GradePaperStruct> {
 
 
+    /**
+     * 查找分析试卷结构列表
+     *
+     * @param paperNumber 试卷编号
+     * @param paperType   试卷类型
+     * @param requestUser 请求的用户
+     * @return 结果
+     */
+    List<GradePaperStructResult> findGradePaperStructureResultList(String paperNumber, String paperType, SysUser requestUser);
+
+    /**
+     * 批量保存分析试卷结构
+     *
+     * @param gradePaperStructParam 分析试卷结构数据
+     * @param requestUser           请求用户
+     */
+    void saveGradePaperStructBatch(GradePaperStructParam gradePaperStructParam, SysUser requestUser);
+
+    /**
+     * 分析 - 试卷结构数据导入
+     *
+     * @param file        excel 文件
+     * @param paperNumber 试卷编号
+     * @param paperType   试卷类型
+     * @param paperName   试卷名称
+     * @param requestUser 请求用户
+     */
+    void importGradePaperStruct(MultipartFile file, String paperNumber, String paperType, String paperName, SysUser requestUser) throws IOException, NoSuchFieldException;
+
+    /**
+     * 分析 - 试卷结构模板导出
+     *
+     * @param paperNumber 试卷编号
+     * @param paperType   试卷类型
+     * @param requestUser 请求用户
+     * @throws Exception 异常
+     */
+    void exportGradePaperStructTemplate(String paperNumber, String paperType, SysUser requestUser) throws Exception;
+
     PaperStructure findBySchoolIdAndPaperNumberAndPaperType(Long schoolId, String paperNumber, String paperType);
     PaperStructure findBySchoolIdAndPaperNumberAndPaperType(Long schoolId, String paperNumber, String paperType);
 }
 }

+ 29 - 2
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/GradePaperDimensionServiceImpl.java

@@ -1,13 +1,15 @@
 package com.qmth.distributed.print.business.service.impl;
 package com.qmth.distributed.print.business.service.impl;
 
 
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Lists;
 import com.qmth.distributed.print.business.bean.dto.excel.GradePaperDimensionAbilityDto;
 import com.qmth.distributed.print.business.bean.dto.excel.GradePaperDimensionAbilityDto;
 import com.qmth.distributed.print.business.bean.dto.excel.GradePaperDimensionKnowledgeDto;
 import com.qmth.distributed.print.business.bean.dto.excel.GradePaperDimensionKnowledgeDto;
 import com.qmth.distributed.print.business.bean.dto.open.PaperDimension;
 import com.qmth.distributed.print.business.bean.dto.open.PaperDimension;
-import com.qmth.distributed.print.business.bean.params.GradePaperDimensionParam;
+import com.qmth.distributed.print.business.bean.params.analyze.GradePaperDimensionParam;
 import com.qmth.distributed.print.business.bean.result.analyze.GradePaperDimensionResult;
 import com.qmth.distributed.print.business.bean.result.analyze.GradePaperDimensionResult;
+import com.qmth.distributed.print.business.bean.result.analyze.SecondDimensionResult;
 import com.qmth.distributed.print.business.entity.GradePaperDimension;
 import com.qmth.distributed.print.business.entity.GradePaperDimension;
 import com.qmth.distributed.print.business.enums.DimensionEnum;
 import com.qmth.distributed.print.business.enums.DimensionEnum;
 import com.qmth.distributed.print.business.mapper.GradePaperDimensionMapper;
 import com.qmth.distributed.print.business.mapper.GradePaperDimensionMapper;
@@ -27,6 +29,7 @@ import javax.annotation.Resource;
 import java.io.IOException;
 import java.io.IOException;
 import java.util.*;
 import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 
 /**
 /**
  * <p>
  * <p>
@@ -43,7 +46,7 @@ public class GradePaperDimensionServiceImpl extends ServiceImpl<GradePaperDimens
 
 
     @Override
     @Override
     public List<GradePaperDimensionResult> findGradePaperDimensionList(String paperNumber, String paperType, SysUser requestUser) {
     public List<GradePaperDimensionResult> findGradePaperDimensionList(String paperNumber, String paperType, SysUser requestUser) {
-        return this.baseMapper.findGradePaperDimensionList(paperNumber,paperType, requestUser.getSchoolId());
+        return this.baseMapper.findGradePaperDimensionList(paperNumber, paperType, requestUser.getSchoolId());
     }
     }
 
 
     @Override
     @Override
@@ -60,6 +63,10 @@ public class GradePaperDimensionServiceImpl extends ServiceImpl<GradePaperDimens
         String paperType = paperTypeList.get(0);
         String paperType = paperTypeList.get(0);
         gradeBatchPaperService.checkOperateAuth(requestUser.getSchoolId(), paperNumber, paperType);
         gradeBatchPaperService.checkOperateAuth(requestUser.getSchoolId(), paperNumber, paperType);
         List<GradePaperDimension> gradePaperDimensionList = this.checkAndBuildGradePaperDimensionList(gradePaperDimensionParamList, requestUser);
         List<GradePaperDimension> gradePaperDimensionList = this.checkAndBuildGradePaperDimensionList(gradePaperDimensionParamList, requestUser);
+        this.remove(new QueryWrapper<GradePaperDimension>().lambda()
+                .eq(GradePaperDimension::getSchoolId, requestUser.getSchoolId())
+                .eq(GradePaperDimension::getPaperNumber, paperNumber)
+                .eq(GradePaperDimension::getPaperType, paperType));
         this.saveBatch(gradePaperDimensionList);
         this.saveBatch(gradePaperDimensionList);
     }
     }
 
 
@@ -165,6 +172,26 @@ public class GradePaperDimensionServiceImpl extends ServiceImpl<GradePaperDimens
         }
         }
     }
     }
 
 
+    @Override
+    public List<SecondDimensionResult> findSecondDimensionList(String paperNumber, String paperType, DimensionEnum dimensionType, SysUser requestUser) {
+        return this.list(new QueryWrapper<GradePaperDimension>()
+                        .lambda()
+                        .eq(GradePaperDimension::getSchoolId, requestUser.getSchoolId())
+                        .eq(GradePaperDimension::getPaperNumber, paperNumber)
+                        .eq(GradePaperDimension::getPaperType, paperType)
+                        .eq(GradePaperDimension::getDimensionType, dimensionType))
+                .stream()
+                .distinct()
+                .flatMap(e -> {
+                    SecondDimensionResult cell = new SecondDimensionResult();
+                    cell.setCode(e.getCodeSecond());
+                    cell.setName(e.getNameSecond());
+                    cell.setType(e.getDimensionType());
+                    return Stream.of(cell);
+                })
+                .collect(Collectors.toList());
+    }
+
     @Override
     @Override
     public PaperDimension findBySchoolIdAndPaperNumberAndPaperType(Long schoolId, String paperNumber, String paperType) {
     public PaperDimension findBySchoolIdAndPaperNumberAndPaperType(Long schoolId, String paperNumber, String paperType) {
         return this.baseMapper.findBySchoolIdAndPaperNumberAndPaperType(schoolId, paperNumber, paperType);
         return this.baseMapper.findBySchoolIdAndPaperNumberAndPaperType(schoolId, paperNumber, paperType);

+ 295 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/GradePaperStructServiceImpl.java

@@ -1,11 +1,43 @@
 package com.qmth.distributed.print.business.service.impl;
 package com.qmth.distributed.print.business.service.impl;
 
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.google.common.collect.Lists;
+import com.qmth.distributed.print.business.bean.dto.excel.GradePaperStructDto;
 import com.qmth.distributed.print.business.bean.dto.open.PaperStructure;
 import com.qmth.distributed.print.business.bean.dto.open.PaperStructure;
+import com.qmth.distributed.print.business.bean.marking.Question;
+import com.qmth.distributed.print.business.bean.params.analyze.GradePaperStructDatasource;
+import com.qmth.distributed.print.business.bean.params.analyze.GradePaperStructParam;
+import com.qmth.distributed.print.business.bean.result.analyze.GradePaperStructResult;
+import com.qmth.distributed.print.business.entity.ExamPaperStructure;
+import com.qmth.distributed.print.business.entity.ExamTask;
 import com.qmth.distributed.print.business.entity.GradePaperStruct;
 import com.qmth.distributed.print.business.entity.GradePaperStruct;
 import com.qmth.distributed.print.business.mapper.GradePaperStructMapper;
 import com.qmth.distributed.print.business.mapper.GradePaperStructMapper;
+import com.qmth.distributed.print.business.service.ExamPaperStructureService;
+import com.qmth.distributed.print.business.service.ExamTaskService;
+import com.qmth.distributed.print.business.service.GradeBatchPaperService;
 import com.qmth.distributed.print.business.service.GradePaperStructService;
 import com.qmth.distributed.print.business.service.GradePaperStructService;
+import com.qmth.teachcloud.common.contant.SystemConstant;
+import com.qmth.teachcloud.common.entity.SysUser;
+import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
+import com.qmth.teachcloud.common.enums.QuestionType;
+import com.qmth.teachcloud.common.util.ExcelUtil;
+import com.qmth.teachcloud.common.util.ServletUtil;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 
 /**
 /**
  * <p>
  * <p>
@@ -17,9 +49,272 @@ import org.springframework.stereotype.Service;
  */
  */
 @Service
 @Service
 public class GradePaperStructServiceImpl extends ServiceImpl<GradePaperStructMapper, GradePaperStruct> implements GradePaperStructService {
 public class GradePaperStructServiceImpl extends ServiceImpl<GradePaperStructMapper, GradePaperStruct> implements GradePaperStructService {
+    @Resource
+    private GradeBatchPaperService gradeBatchPaperService;
+    @Resource
+    private ExamPaperStructureService examPaperStructureService;
+    @Resource
+    private ExamTaskService examTaskService;
+
+    @Override
+    public List<GradePaperStructResult> findGradePaperStructureResultList(String paperNumber, String paperType, SysUser requestUser) {
+        Long schoolId = requestUser.getSchoolId();
+        List<GradePaperStructResult> result = new ArrayList<>();
+        // 先从分析试卷结构表取
+        List<GradePaperStructResult> gradeStructDatasource = this.baseMapper.findStructByGradePaper(schoolId, paperNumber, paperType);
+        if (gradeStructDatasource != null && gradeStructDatasource.size() > 0) {
+            result = gradeStructDatasource;
+        } else {
+            // 如果老师还没设置过分析参数 则从评卷参数中把试卷结构取出来
+            ExamPaperStructure examPaperStructure = examPaperStructureService.getOne(new QueryWrapper<ExamPaperStructure>()
+                    .lambda()
+                    .eq(ExamPaperStructure::getSchoolId, schoolId)
+                    .eq(ExamPaperStructure::getPaperNumber, paperNumber)
+                    .eq(ExamPaperStructure::getPaperType, paperType));
+            if (Objects.isNull(examPaperStructure)) {
+                throw ExceptionResultEnum.ERROR.exception("该试卷还没有上传评卷参数设置");
+            }
+            ExamTask examTask = examTaskService.getOne(new QueryWrapper<ExamTask>().lambda()
+                    .eq(ExamTask::getSchoolId, schoolId)
+                    .eq(ExamTask::getPaperNumber, paperNumber));
+            if (Objects.isNull(examTask)) {
+                throw ExceptionResultEnum.ERROR.exception("没有找到试卷编号对应的命题任务");
+            }
+            String courseCode = examTask.getCourseCode();
+            String courseName = examTask.getCourseName();
+
+            // 客观题
+            List<Question> examPaperObjList = new ArrayList<>();
+            String examPaperObj = examPaperStructure.getObjectiveStructure();
+            if (SystemConstant.strNotNull(examPaperObj)) {
+                examPaperObjList = JSON.parseArray(examPaperObj, Question.class);
+            }
+            // 主观题
+            List<Question> examPaperSubList = new ArrayList<>();
+            String examPaperSub = examPaperStructure.getSubjectiveStructure();
+            if (SystemConstant.strNotNull(examPaperSub)) {
+                examPaperSubList = JSON.parseArray(examPaperSub, Question.class);
+            }
+            // 按题号排序
+            examPaperObjList = examPaperObjList.stream().sorted(Comparator.comparing(Question::getMainNumber).thenComparing(Question::getSubNumber)).collect(Collectors.toList());
+            examPaperSubList = examPaperSubList.stream().sorted(Comparator.comparing(Question::getMainNumber).thenComparing(Question::getSubNumber)).collect(Collectors.toList());
+            for (Question question : examPaperObjList) {
+                GradePaperStructResult cell = new GradePaperStructResult();
+                cell.setCourseCode(courseCode);
+                cell.setCourseName(courseName);
+                cell.setPaperNumber(paperNumber);
+                cell.setPaperType(paperType);
+                cell.setNumberType(QuestionType.OBJECTIVE);
+                cell.setBigTopicName(question.getMainTitle());
+                cell.setBigQuestionNumber(String.valueOf(question.getMainNumber()));
+                cell.setSmallQuestionNumber(question.getSubNumber());
+                cell.setFullScore(question.getTotalScore());
+                result.add(cell);
+            }
+
+            for (Question question : examPaperSubList) {
+                GradePaperStructResult cell = new GradePaperStructResult();
+                cell.setCourseCode(courseCode);
+                cell.setCourseName(courseName);
+                cell.setPaperNumber(paperNumber);
+                cell.setPaperType(paperType);
+                cell.setNumberType(QuestionType.SUBJECTIVE);
+                cell.setBigTopicName(question.getMainTitle());
+                cell.setBigQuestionNumber(String.valueOf(question.getMainNumber()));
+                cell.setSmallQuestionNumber(question.getSubNumber());
+                cell.setFullScore(question.getTotalScore());
+                result.add(cell);
+            }
+        }
+        return result;
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void saveGradePaperStructBatch(GradePaperStructParam gradePaperStructParam, SysUser requestUser) {
+        Long schoolId = requestUser.getSchoolId();
+        String paperNumber = gradePaperStructParam.getPaperNumber();
+        String paperType = gradePaperStructParam.getPaperType();
+        String paperName = gradePaperStructParam.getPaperName();
+        List<GradePaperStructDatasource> datasource = gradePaperStructParam.getDatasource();
+        // 验证批次分析试卷是否在计算
+        gradeBatchPaperService.checkOperateAuth(schoolId, paperNumber, paperType);
+        // 检验结构正确性并构建分析试卷结构
+        List<GradePaperStruct> gradePaperStructList = this.checkAndBuildGradePaperStruct(datasource, paperNumber, paperType, paperName, requestUser);
+        // 删除旧的试卷结构
+        this.remove(new QueryWrapper<GradePaperStruct>()
+                .lambda()
+                .eq(GradePaperStruct::getSchoolId, schoolId)
+                .eq(GradePaperStruct::getPaperNumber, paperNumber)
+                .eq(GradePaperStruct::getPaperType, paperType));
+        this.saveBatch(gradePaperStructList);
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void importGradePaperStruct(MultipartFile file, String paperNumber, String paperType, String paperName, SysUser requestUser) throws IOException, NoSuchFieldException {
+        if (Objects.isNull(file)) {
+            throw ExceptionResultEnum.ERROR.exception("找不到附件");
+        }
+
+        List<LinkedMultiValueMap<Integer, Object>> finalList = ExcelUtil.excelReader(file.getInputStream(), Lists.newArrayList(GradePaperStructDto.class), (finalExcelList, finalColumnNameList, finalExcelErrorList) -> {
+            if (finalExcelErrorList.size() > 0) {
+                throw ExceptionResultEnum.ERROR.exception(JSONObject.toJSONString(finalExcelErrorList));
+            }
+            return finalExcelList;
+        });
+        GradePaperStructParam gradePaperStructParam = new GradePaperStructParam();
+        gradePaperStructParam.setPaperNumber(paperNumber);
+        gradePaperStructParam.setPaperType(paperType);
+        gradePaperStructParam.setPaperName(paperName);
+        List<GradePaperStructDatasource> gradePaperStructDatasourceList = new ArrayList<>();
+
+        if (Objects.nonNull(finalList) && finalList.size() > 0) {
+            for (int i = 0; i < finalList.size(); i++) {
+                LinkedMultiValueMap<Integer, Object> map = finalList.get(i);
+                List<Object> importList = map.get(i);
+                for (int y = 0; y < Objects.requireNonNull(importList).size(); y++) {
+                    if (importList.get(y) instanceof GradePaperStructDto) {
+                        GradePaperStructDto gradePaperStructDto = (GradePaperStructDto) importList.get(y);
+
+                        GradePaperStructDatasource gradePaperStructDatasource = new GradePaperStructDatasource();
+                        gradePaperStructDatasource.setBigQuestionNumber(gradePaperStructDto.getBigQuestionNumber());
+                        gradePaperStructDatasource.setSmallQuestionNumber(gradePaperStructDto.getSmallQuestionNumber());
+                        gradePaperStructDatasource.setBigTopicName(gradePaperStructDto.getBigTopicName());
+                        gradePaperStructDatasource.setNumberType(gradePaperStructDto.getNumberType());
+                        gradePaperStructDatasource.setFullScore(gradePaperStructDto.getFullScore());
+                        gradePaperStructDatasource.setKnowledgeDimension(gradePaperStructDto.getKnowledgeDimension());
+                        gradePaperStructDatasource.setAbilityDimension(gradePaperStructDto.getAbilityDimension());
+                        gradePaperStructDatasourceList.add(gradePaperStructDatasource);
+                    }
+                }
+            }
+        }
+        gradePaperStructParam.setDatasource(gradePaperStructDatasourceList);
+        this.saveGradePaperStructBatch(gradePaperStructParam, requestUser);
+    }
+
+    @Override
+    public void exportGradePaperStructTemplate(String paperNumber, String paperType, SysUser requestUser) throws Exception {
+
+        ExamTask examTask = examTaskService.getOne(new QueryWrapper<ExamTask>().lambda()
+                .eq(ExamTask::getSchoolId, requestUser.getSchoolId())
+                .eq(ExamTask::getPaperNumber, paperNumber));
+        if (Objects.isNull(examTask)) {
+            throw ExceptionResultEnum.ERROR.exception("没有找到试卷编号对应的命题任务");
+        }
+        String courseCode = examTask.getCourseCode();
+        String courseName = examTask.getCourseName();
+
+        List<GradePaperStructResult> datasource = this.findGradePaperStructureResultList(paperNumber, paperType, requestUser);
+        List<GradePaperStructDto> gradePaperStructDtoList = datasource.stream().flatMap(e -> {
+            GradePaperStructDto cell = new GradePaperStructDto();
+            cell.setCourseCode(courseCode);
+            cell.setCourseName(courseName);
+            cell.setPaperNumber(e.getPaperNumber());
+            cell.setPaperType(e.getPaperType());
+            cell.setNumberType(e.getNumberType());
+            cell.setBigTopicName(e.getBigTopicName());
+            cell.setBigQuestionNumber(e.getBigQuestionNumber());
+            cell.setSmallQuestionNumber(e.getSmallQuestionNumber());
+            cell.setFullScore(e.getFullScore());
+            cell.setKnowledgeDimension(e.getKnowledgeDimension());
+            cell.setAbilityDimension(e.getAbilityDimension());
+            return Stream.of(cell);
+        }).collect(Collectors.toList());
+        ExcelUtil.excelExport(courseName + "-试卷蓝图导入模板", GradePaperStructDto.class, gradePaperStructDtoList, ServletUtil.getResponse());
+    }
 
 
     @Override
     @Override
     public PaperStructure findBySchoolIdAndPaperNumberAndPaperType(Long schoolId, String paperNumber, String paperType) {
     public PaperStructure findBySchoolIdAndPaperNumberAndPaperType(Long schoolId, String paperNumber, String paperType) {
         return this.baseMapper.findBySchoolIdAndPaperNumberAndPaperType(schoolId, paperNumber, paperType);
         return this.baseMapper.findBySchoolIdAndPaperNumberAndPaperType(schoolId, paperNumber, paperType);
     }
     }
+
+    /**
+     * 检验结构正确性并构建分析试卷结构
+     *
+     * @param datasource  数据源
+     * @param paperNumber 试卷编号
+     * @param paperType   试卷类型
+     * @param paperName   试卷名称
+     * @param requestUser 请求用户
+     * @return 创建好的分析试卷结构
+     */
+    private List<GradePaperStruct> checkAndBuildGradePaperStruct(List<GradePaperStructDatasource> datasource, String paperNumber, String paperType, String paperName, SysUser requestUser) {
+        Long schoolId = requestUser.getSchoolId();
+        Long userId = requestUser.getId();
+        ExamPaperStructure examPaperStructure = examPaperStructureService.getOne(new QueryWrapper<ExamPaperStructure>()
+                .lambda()
+                .eq(ExamPaperStructure::getSchoolId, schoolId)
+                .eq(ExamPaperStructure::getPaperNumber, paperNumber)
+                .eq(ExamPaperStructure::getPaperType, paperType));
+        if (Objects.isNull(examPaperStructure)) {
+            throw ExceptionResultEnum.ERROR.exception("该试卷还没有上传评卷参数设置");
+        }
+
+        // 客观题
+        List<Question> examPaperObjList = new ArrayList<>();
+        String examPaperObj = examPaperStructure.getObjectiveStructure();
+        if (SystemConstant.strNotNull(examPaperObj)) {
+            examPaperObjList = JSON.parseArray(examPaperObj, Question.class);
+        }
+
+        List<Question> gradePaperObjList = datasource.stream()
+                .filter(e -> QuestionType.OBJECTIVE.equals(e.getNumberType()))
+                .flatMap(e -> {
+                    Question cell = new Question();
+                    cell.setMainNumber(Integer.valueOf(e.getBigQuestionNumber()));
+                    cell.setMainTitle(e.getBigTopicName());
+                    cell.setSubNumber(e.getSmallQuestionNumber());
+                    cell.setTotalScore(e.getFullScore());
+                    return Stream.of(cell);
+                })
+                .collect(Collectors.toList());
+        if (!Question.matchTwoQuestionList(examPaperObjList, gradePaperObjList)) {
+            throw ExceptionResultEnum.ERROR.exception("试卷编号为【" + paperNumber + "】,试卷类型为【" + paperType +
+                    "】的分析试卷结构和 评卷参数试卷结构在【" + QuestionType.OBJECTIVE.getDesc() + "】上不一致");
+        }
+
+        // 主观题
+        List<Question> examPaperSubList = new ArrayList<>();
+        String examPaperSub = examPaperStructure.getSubjectiveStructure();
+        if (SystemConstant.strNotNull(examPaperSub)) {
+            examPaperSubList = JSON.parseArray(examPaperSub, Question.class);
+        }
+
+        List<Question> gradePaperSubList = datasource.stream()
+                .filter(e -> QuestionType.SUBJECTIVE.equals(e.getNumberType()))
+                .flatMap(e -> {
+                    Question cell = new Question();
+                    cell.setMainNumber(Integer.valueOf(e.getBigQuestionNumber()));
+                    cell.setMainTitle(e.getBigTopicName());
+                    cell.setSubNumber(e.getSmallQuestionNumber());
+                    cell.setTotalScore(e.getFullScore());
+                    return Stream.of(cell);
+                })
+                .collect(Collectors.toList());
+        if (!Question.matchTwoQuestionList(examPaperSubList, gradePaperSubList)) {
+            throw ExceptionResultEnum.ERROR.exception("试卷编号为【" + paperNumber + "】,试卷类型为【" + paperType +
+                    "】的分析试卷结构和 评卷参数试卷结构在【" + QuestionType.SUBJECTIVE.getDesc() + "】上不一致");
+        }
+
+        return datasource.stream().flatMap(e -> {
+            GradePaperStruct gradePaperStruct = new GradePaperStruct();
+            gradePaperStruct.setSchoolId(schoolId);
+            gradePaperStruct.setPaperNumber(paperNumber);
+            gradePaperStruct.setPaperType(paperType);
+            gradePaperStruct.setPaperName(paperName);
+            gradePaperStruct.setQuestionName(e.getBigTopicName() + " " + e.getBigQuestionNumber() + SystemConstant.HYPHEN + e.getSmallQuestionNumber());
+            gradePaperStruct.setNumberType(e.getNumberType());
+            gradePaperStruct.setBigQuestionNumber(e.getBigQuestionNumber());
+            gradePaperStruct.setSmallQuestionNumber(e.getSmallQuestionNumber());
+            gradePaperStruct.setBigTopicName(e.getBigTopicName());
+            gradePaperStruct.setFullScore(e.getFullScore());
+            gradePaperStruct.setScoreRules(e.getScoreRules());
+            gradePaperStruct.setKnowledgeDimension(e.getKnowledgeDimension());
+            gradePaperStruct.setAbilityDimension(e.getAbilityDimension());
+            gradePaperStruct.insertInfo(userId);
+            return Stream.of(gradePaperStruct);
+        }).collect(Collectors.toList());
+    }
 }
 }

+ 41 - 0
distributed-print-business/src/main/resources/mapper/GradePaperStructMapper.xml

@@ -19,4 +19,45 @@
           and paper_number = #{paperNumber}
           and paper_number = #{paperNumber}
           and paper_type = #{paperType}
           and paper_type = #{paperType}
     </select>
     </select>
+
+    <select id="findStructByGradePaper"
+            resultType="com.qmth.distributed.print.business.bean.result.analyze.GradePaperStructResult">
+        SELECT
+            et.course_code AS courseCode,
+            et.course_name AS courseName,
+            gps.paper_number AS paperNumber,
+            gps.paper_type AS paperType,
+            gps.number_type AS numberType,
+            gps.big_topic_name AS bigTopicName,
+            gps.big_question_number AS bigQuestionNumber,
+            gps.small_question_number AS smallQuestionNumber,
+            gps.full_score AS fullScore,
+            gps.score_rules AS scoreRules,
+            gps.knowledge_dimension AS knowledgeDimension,
+            gps.ability_dimension AS abilityDimension
+        FROM
+            grade_paper_struct gps
+                LEFT JOIN
+            (SELECT
+                 school_id,
+                 paper_number,
+                 MAX(course_code) AS course_code,
+                 MAX(course_name) AS course_name
+             FROM
+                 exam_task
+             GROUP BY school_id , paper_number) et ON gps.school_id = et.school_id
+                AND gps.paper_number = et.paper_number
+        <where>
+            <if test="schoolId != null and schoolId != ''">
+                AND gps.school_id = #{schoolId}
+            </if>
+            <if test="paperNumber != null and paperNumber != ''">
+                AND gps.paper_number = #{paperNumber}
+            </if>
+            <if test="paperType != null and paperType != ''">
+                AND gps.paper_type = #{paperType}
+            </if>
+        </where>
+        ORDER BY gps.paper_number,gps.paper_type,gps.number_type,gps.big_question_number,gps.small_question_number
+    </select>
 </mapper>
 </mapper>

+ 21 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/enums/QuestionType.java

@@ -0,0 +1,21 @@
+package com.qmth.teachcloud.common.enums;
+
+/**
+ * @Description: 题目类型(主观题、客观题)
+ * @Author: CaoZixuan
+ * @Date: 2022-05-30
+ */
+public enum QuestionType {
+    OBJECTIVE("客观题"),
+    SUBJECTIVE("主观题"),
+    ;
+    private final String desc;
+
+    QuestionType(String desc) {
+        this.desc = desc;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+}