Browse Source

修改测试结果接口

4228306 6 năm trước cách đây
mục cha
commit
e4e357c416

+ 62 - 0
src/main/java/edu/math/diagnosis/controller/ExcelReportController.java

@@ -0,0 +1,62 @@
+package edu.math.diagnosis.controller;
+
+import edu.math.diagnosis.model.GeneralInfo;
+import edu.math.diagnosis.model.Report;
+import edu.math.diagnosis.word.ExcelUtils;
+import io.swagger.annotations.Api;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+@Api(tags = "获取报告信息 马上废弃")
+@RestController
+@RequestMapping("/getTempPapers")
+//@PreAuthorize("hasRole('ROLE_ADMIN')")
+public class ExcelReportController {
+
+    @Resource
+    private ExcelUtils excelUtils;
+
+    @RequestMapping(value = "/getGeneralInfo", method = RequestMethod.GET)
+    public GeneralInfo getCorrectInfo() {
+        GeneralInfo info = new GeneralInfo();
+        info.setCorrectOptions(excelUtils.getCorrectAns());
+        info.setRates(excelUtils.getCorrectRate());
+        info.setAbilityAveScore(excelUtils.getAbilityAveScore());
+        info.setCurveGraph(excelUtils.getCurveGraph());
+
+        return info;
+    }
+
+    @RequestMapping(value = "/getReportData", method = RequestMethod.GET)
+    public List<Report> getPaperData() {
+        List<Report> reports = new ArrayList<>(81);
+        List<String> names = excelUtils.getNames();
+        Map<String, List<String>> optionMap = excelUtils.getOptions();
+        Map<String, List<Integer>> optionRwMap = excelUtils.getOptionRw();
+        Map<String, List<String>> optionCommentMap = excelUtils.getOptionCommentMap(optionRwMap);
+        Map<String, List<Integer>> abilityLevelMap = excelUtils.getAbilityLevel();
+        Map<String, List<Double>> abilityScoreMap = excelUtils.getAbilityScore();
+        Map<String, List<String>> abilityCommentMap = excelUtils.getAbilityWords(abilityLevelMap, abilityScoreMap);
+        Map<String, Integer> scoreMap = excelUtils.getTotalScore();
+        for (String name : names) {
+            Report report = new Report();
+            report.setName(name);
+            report.setOptions(optionMap.get(name));
+            report.setAbilityComments(abilityCommentMap.get(name));
+            report.setAbilityLevel(abilityLevelMap.get(name));
+            report.setRw(optionRwMap.get(name));
+            report.setComments(optionCommentMap.get(name));
+            report.setAbilityScore(abilityScoreMap.get(name));
+            report.setTotalScore(scoreMap.get(name));
+            reports.add(report);
+        }
+
+        return reports;
+    }
+}

+ 4 - 3
src/main/java/edu/math/diagnosis/controller/ReportController.java

@@ -75,9 +75,10 @@ public class ReportController {
 //    private Result check()
 
     @GetMapping("globalResult")
-    public Result globalResult(Long paperResultId) {
-
-        return Result.fail("not implements");
+    @ApiOperation("诊断结果")
+    public Result<PaperResult> globalResult(Long paperResultId) {
+        Map<String, Object> result = new HashMap<>();
+        return new Result<>(true,"",new PaperResult());
     }
 
 }

+ 44 - 13
src/main/java/edu/math/diagnosis/entity/PaperCount.java

@@ -3,33 +3,64 @@ package edu.math.diagnosis.entity;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
-import javax.persistence.Entity;
+import javax.persistence.*;
 
 @Entity
 @ApiModel("试卷提交统计信息")
 public class PaperCount {
 
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
     private Long id;
     private Long pid;
 
     /**
-     * {
-     *     '0':88.88
-     *     '1':25.33,
-     * }
+     * 各题目平均作答时间
+     *
+     * [10,20,30]
      */
-    @ApiModelProperty("各章节知识点平均掌握率")
-    private String knowledgeAvgRate;
-
+    @Lob
+    @ApiModelProperty("各题目平均作答试卷 [10,20,30,20]")
+    private String useTimeAgvRate;
     /**
-     * 还是说直接一个数组?
      * {
-     *     "1":20,
-     *     "2":20,
-     *     "3":20
+     *     "预备章节":88.88
+     *     "第一章":25.33
      * }
      */
-    private String useTimeAgvRate;
+    @Lob
+    @ApiModelProperty("各章节知识点平均掌握率 {\"预备章节\":88.88}")
+    private String knowledgeAvgRate;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getPid() {
+        return pid;
+    }
+
+    public void setPid(Long pid) {
+        this.pid = pid;
+    }
+
+    public String getKnowledgeAvgRate() {
+        return knowledgeAvgRate;
+    }
+
+    public void setKnowledgeAvgRate(String knowledgeAvgRate) {
+        this.knowledgeAvgRate = knowledgeAvgRate;
+    }
 
+    public String getUseTimeAgvRate() {
+        return useTimeAgvRate;
+    }
 
+    public void setUseTimeAgvRate(String useTimeAgvRate) {
+        this.useTimeAgvRate = useTimeAgvRate;
+    }
 }

+ 116 - 72
src/main/java/edu/math/diagnosis/entity/PaperResult.java

@@ -24,39 +24,91 @@ public class PaperResult {
     @Column(nullable = false)
     private Long pid;
 
+    @ApiModelProperty("试卷编号")
     private String code;
 
     @CreationTimestamp
     @Column(nullable = false)
     private Date createtime;
-//    @Column(nullable = false, columnDefinition = "double(10,2) default 0")
-//    private Double score1;
-//    @Column(nullable = false, columnDefinition = "double(10,2) default 0")
-//    private Double score2;
-//    @Column(nullable = false, columnDefinition = "double(10,2) default 0")
-//    private Double score3;
-//    @Column(nullable = false, columnDefinition = "double(10,2) default 0")
-//    private Double score4;
-//    @Column(nullable = false, columnDefinition = "double(10,2) default 0")
-//    private Double score5;
-//    @Column(nullable = false, columnDefinition = "double(10,2) default 0")
-//    private Double score6;
 
     @Lob
     @Column(nullable = false)
-    @ApiModelProperty("试卷分数")
+    @ApiModelProperty("json化的试卷分数")
     private String jsonScore;
 
+    @ApiModelProperty("总分")
     private Double totalScore;
 
+    /**
+     * 答对的题目编号
+     * 1,2
+     */
     @Lob
     @Column(nullable = false)
-    @ApiModelProperty("正确情况")
+    @ApiModelProperty("答对的题目编号 1,2")
+    private String collectQuestion;
+
+    @Lob
+    @ApiModelProperty("知识掌握率,88.88")
+    private Double knowledgeRate;
+
     /**
+     * 各能力分数,5分制
+     * {
+     *     "计算能力":"aa"
+     * }
+     */
+    @Lob
+    @ApiModelProperty("各能力分数,5分制 {\"计算能力\":4.1}")
+    private String abilityScore;
+
+    /**
+     * 以章节为单位各知识点接受程度
+     * 0 未掌握
+     * 1 半掌握
+     * 2 已掌握
+     * [
+     *     [1,1],[0,1,2]
+     * ]
      *
-     * 1,2
      */
-    private String collectQuestion;
+    @Lob
+    @ApiModelProperty("以章节为单位各知识点掌握程度,0 未掌握 1半掌握 2已掌握 [[1,2],[1,2,2,2]]")
+    private String knowledgeAcceptanceLevel;
+
+    /**
+     * 各章节掌握率
+     * {
+     *     "预备章节":0,
+     *     "第一章":88.8,
+     * }
+     *
+     */
+    @Lob
+    @ApiModelProperty("各章节掌握率 {\"预备章节\":0,\"第一章\":88.88}")
+    private String chapterRate;
+
+    /**
+     * 各题目答题时间
+     * [50,20]
+     */
+    @Lob
+    @ApiModelProperty("各题目作答时间 [50,20,10,20]")
+    private String useTime;
+
+    /**
+     * 模块作答详情
+     * {
+     *     "0":{
+     *         "collectInfo":"43/50",
+     *         "useTime":"30:00/30:00",
+     *         "score":35
+     *         }
+     * }
+     */
+    @Lob
+    @ApiModelProperty("模块作答详情 \"模块一\":{\"collectInfo\":\"43/50\",\"useTime\":\"30:00/30:00\",\"score\":30}}")
+    private String sectionInfo;
 
 //    @Transient
 //    private List<AbilityScore> scores;
@@ -119,53 +171,6 @@ public class PaperResult {
     public void setTotalScore(Double totalScore) {
         this.totalScore = totalScore;
     }
-//    public Double getScore1() {
-//        return score1;
-//    }
-//
-//    public void setScore1(Double score1) {
-//        this.score1 = score1;
-//    }
-//
-//    public Double getScore2() {
-//        return score2;
-//    }
-//
-//    public void setScore2(Double score2) {
-//        this.score2 = score2;
-//    }
-//
-//    public Double getScore3() {
-//        return score3;
-//    }
-//
-//    public void setScore3(Double score3) {
-//        this.score3 = score3;
-//    }
-//
-//    public Double getScore4() {
-//        return score4;
-//    }
-//
-//    public void setScore4(Double score4) {
-//        this.score4 = score4;
-//    }
-//
-//    public Double getScore5() {
-//        return score5;
-//    }
-//
-//    public void setScore5(Double score5) {
-//        this.score5 = score5;
-//    }
-//
-//    public Double getScore6() {
-//        return score6;
-//    }
-//
-//    public void setScore6(Double score6) {
-//        this.score6 = score6;
-//    }
 
     public String getJsonScore() {
         return jsonScore;
@@ -175,15 +180,6 @@ public class PaperResult {
         this.jsonScore = jsonScore;
     }
 
-//    public List<AbilityScore> getScores() {
-//        return scores;
-//    }
-//
-//    public void setScores(List<AbilityScore> scores) {
-//        this.scores = scores;
-//    }
-
-
     public String getCollectQuestion() {
         return collectQuestion;
     }
@@ -199,4 +195,52 @@ public class PaperResult {
     public void setCode(String code) {
         this.code = code;
     }
+
+    public Double getKnowledgeRate() {
+        return knowledgeRate;
+    }
+
+    public void setKnowledgeRate(Double knowledgeRate) {
+        this.knowledgeRate = knowledgeRate;
+    }
+
+    public String getAbilityScore() {
+        return abilityScore;
+    }
+
+    public void setAbilityScore(String abilityScore) {
+        this.abilityScore = abilityScore;
+    }
+
+    public String getKnowledgeAcceptanceLevel() {
+        return knowledgeAcceptanceLevel;
+    }
+
+    public void setKnowledgeAcceptanceLevel(String knowledgeAcceptanceLevel) {
+        this.knowledgeAcceptanceLevel = knowledgeAcceptanceLevel;
+    }
+
+    public String getChapterRate() {
+        return chapterRate;
+    }
+
+    public void setChapterRate(String chapterRate) {
+        this.chapterRate = chapterRate;
+    }
+
+    public String getUseTime() {
+        return useTime;
+    }
+
+    public void setUseTime(String useTime) {
+        this.useTime = useTime;
+    }
+
+    public String getSectionInfo() {
+        return sectionInfo;
+    }
+
+    public void setSectionInfo(String sectionInfo) {
+        this.sectionInfo = sectionInfo;
+    }
 }

+ 1 - 1
src/main/java/edu/math/diagnosis/entity/PaperTemplate.java

@@ -19,7 +19,7 @@ public class PaperTemplate {
     @GeneratedValue(strategy = GenerationType.IDENTITY)
     private Long id;
 
-    @Column(nullable = false, length = 128, unique = true)
+    @Column(nullable = false,length = 128,unique = true)
     @ApiModelProperty("模板名称")
     private String name;
 

+ 1 - 1
src/main/java/edu/math/diagnosis/entity/RemarkTemplate.java

@@ -14,7 +14,7 @@ public class RemarkTemplate {
     @Id
     @GeneratedValue(strategy = GenerationType.IDENTITY)
     private Long id;
-    @Column(nullable = false, unique = true)
+    @Column(nullable = false, length = 128, unique = true)
     private String name;
     @Lob
     @Column