Kaynağa Gözat

完善学生考试

tags/正式版本
王宁 2 yıl önce
ebeveyn
işleme
6ece1fa634

+ 38
- 38
sexam/src/main/java/com/xhkjedu/sexam/controller/paperstudent/EPaperStudentController.java Dosyayı Görüntüle

@@ -35,80 +35,80 @@ public class EPaperStudentController {
35 35
 
36 36
     //学生考试列表
37 37
     @PostMapping("/list")
38
-    public ResultVo listExamPapersForStudent(@RequestBody EPaperStudent eps){
39
-        N_Utils.validation(new Object[]{eps.getStudentid(),"学生id",1});
40
-        if(eps.getSstate() == 1){
41
-           //进行中
38
+    public ResultVo listExamPapersForStudent(@RequestBody EPaperStudent eps) {
39
+        N_Utils.validation(new Object[]{eps.getStudentid(), "学生id", 1});
40
+        if (eps.getSstate() == 1) {
41
+            //进行中
42 42
             List<Map> rtnlst = ePaperStudentService.listExamPapersForStudent(eps);
43
-            return new ResultVo(0,"成功获取考试列表",rtnlst);
44
-        }else{
43
+            return new ResultVo(0, "成功获取考试列表", rtnlst);
44
+        } else {
45 45
             Integer page = eps.getPage();
46 46
             Integer pageSize = eps.getPageSize();
47
-            N_Utils.validation(new Object[]{page,"显示页码",1,pageSize,"显示条数",1});
47
+            N_Utils.validation(new Object[]{page, "显示页码", 1, pageSize, "显示条数", 1});
48 48
             PageHelper.startPage(page, pageSize);
49 49
             List<Map> rtnlst = ePaperStudentService.listExamsEndForStudent(eps);
50 50
             PageResult pageResult = PageUtil.getPageResult(new PageInfo<>(rtnlst));
51
-            return new ResultVo(0,"成功获取考试列表",pageResult);
51
+            return new ResultVo(0, "成功获取考试列表", pageResult);
52 52
         }
53 53
     }
54 54
 
55 55
     //学生开始考试(android)
56 56
     @PostMapping("/spa")
57
-    public ResultVo startPaperForAndroid(@RequestBody EPaperStudent eps){
58
-        N_Utils.validation(new Object[]{eps.getEpsid(),"学生试卷id",1});
57
+    public ResultVo startPaperForAndroid(@RequestBody EPaperStudent eps) {
58
+        N_Utils.validation(new Object[]{eps.getEpsid(), "学生试卷id", 1});
59 59
         List<Map> list = ePaperStudentService.startPaperForAndroid(eps);
60
-        return new ResultVo(0,"成功获取学生试卷",list);
60
+        return new ResultVo(0, "成功获取学生试卷", list);
61 61
     }
62
+
62 63
     //学生开始考试(web)
63 64
     @PostMapping("/spw")
64
-    public ResultVo startPaperForWeb(@RequestBody EPaperStudent eps){
65
-        N_Utils.validation(new Object[]{eps.getEpsid(),"学生试卷id",1});
65
+    public ResultVo startPaperForWeb(@RequestBody EPaperStudent eps) {
66
+        N_Utils.validation(new Object[]{eps.getEpsid(), "学生试卷id", 1});
66 67
         EPaperStudentVo psvo = ePaperStudentService.startPaperForWeb(eps);
67
-        return new ResultVo(0,"成功获取学生试卷",psvo);
68
+        return new ResultVo(0, "成功获取学生试卷", psvo);
68 69
     }
69 70
 
70 71
     //提交单题
71 72
     @PostMapping("/scq")
72
-    public ResultVo saveCommitQuestion(@RequestBody EPaperStudentQuestion sq){
73
-       try {
74
-           N_Utils.validation(new Object[]{sq.getEpsqid(),"试题id",1});
75
-           ePaperStudentService.saveCommitQuestion(sq);
76
-           return new ResultVo(0,"成功提交试题");
77
-       }catch (Exception e){
78
-           return new ResultVo(1,"提交试题失败");
79
-       }
73
+    public ResultVo saveCommitQuestion(@RequestBody EPaperStudentQuestion sq) {
74
+        try {
75
+            N_Utils.validation(new Object[]{sq.getEpsqid(), "试题id", 1});
76
+            ePaperStudentService.saveCommitQuestion(sq);
77
+            return new ResultVo(0, "成功提交试题");
78
+        } catch (Exception e) {
79
+            return new ResultVo(1, "提交试题失败");
80
+        }
80 81
     }
82
+
81 83
     //提交试卷
82 84
     @PostMapping("/scp")
83
-    public ResultVo saveCommitPaper(@RequestBody EPaperStudent ps){
85
+    public ResultVo saveCommitPaper(@RequestBody EPaperStudent ps) {
84 86
         try {
85
-            N_Utils.validation(new Object[]{ps.getEpsid(),"试卷id",1});
87
+            N_Utils.validation(new Object[]{ps.getEpsid(), "试卷id", 1});
86 88
             ePaperStudentService.saveCommitPaper(ps.getEpsid());
87
-            return new ResultVo(0,"成功提交试卷");
88
-        }catch (Exception e){
89
-            log.error("提交试卷失败:"+e.getMessage());
90
-            return new ResultVo(1,"提交失败");
89
+            return new ResultVo(0, "成功提交试卷");
90
+        } catch (Exception e) {
91
+            log.error("提交试卷失败:" + e.getMessage());
92
+            return new ResultVo(1, "提交失败");
91 93
         }
92 94
     }
93 95
 
94 96
     //提交试卷--网页端
95 97
     @PostMapping("/scpw")
96
-    public ResultVo saveCommitPaperWeb(@RequestBody PaperStudentWebVo ps){
98
+    public ResultVo saveCommitPaperWeb(@RequestBody PaperStudentWebVo ps) {
97 99
         try {
98
-            N_Utils.validation(new Object[]{ps.getEpsid(),"试卷id",1});
100
+            N_Utils.validation(new Object[]{ps.getEpsid(), "试卷id", 1});
99 101
             List<EPaperStudentQuestion> qlist = ps.getQuestions();
100
-            if(N_Utils.isListEmpty(qlist)){
101
-                return new ResultVo(1,"试题");
102
+            if (N_Utils.isListEmpty(qlist)) {
103
+                return new ResultVo(1, "试题");
102 104
             }
103 105
             ePaperStudentService.saveCommitPaperForWeb(ps);
104
-            return new ResultVo(0,"成功提交试卷");
105
-        }catch (Exception e){
106
-            log.error("提交试卷(web)失败:"+e.getMessage());
107
-            return new ResultVo(1,"提交失败");
106
+            return new ResultVo(0, "成功提交试卷");
107
+        } catch (Exception e) {
108
+            log.error("提交试卷(web)失败:" + e.getMessage());
109
+            return new ResultVo(1, "提交失败");
108 110
         }
109 111
     }
110 112
 
111 113
 
112
-
113
-
114 114
 }

+ 4
- 0
sexam/src/main/java/com/xhkjedu/sexam/model/paper/EPaperQtype.java Dosyayı Görüntüle

@@ -8,6 +8,7 @@ import javax.persistence.Table;
8 8
 import javax.persistence.Transient;
9 9
 import java.util.ArrayList;
10 10
 import java.util.List;
11
+import java.util.Map;
11 12
 
12 13
 @Table(name = "e_paper_qtype")
13 14
 @Data
@@ -43,4 +44,7 @@ public class EPaperQtype extends BaseBean {
43 44
     //试题集合
44 45
     @Transient
45 46
     private List<EPaperQtypeQuestion> questions = new ArrayList<>();
47
+
48
+    @Transient
49
+    private List<Map> queslist = new ArrayList<>();
46 50
 }

+ 1
- 0
sexam/src/main/java/com/xhkjedu/sexam/service/paperstudent/EPaperStudentService.java Dosyayı Görüntüle

@@ -121,6 +121,7 @@ public class EPaperStudentService {
121 121
             sq.setConverted(0);
122 122
             sq.setChecked(0);
123 123
             sq.setStuscore(0.0);
124
+            sq.setCosttime(0);
124 125
             psqlist.add(sq);
125 126
         }
126 127
         ePaperStudentQuestionMapper.insertList(psqlist);//保存试卷

+ 2
- 0
sexam/src/main/java/com/xhkjedu/sexam/vo/paper/EPaperQtypeQuestionVo.java Dosyayı Görüntüle

@@ -100,4 +100,6 @@ public class EPaperQtypeQuestionVo {
100 100
     //子题集合
101 101
     private List<EPaperQtypeQuestionVo> sonques;
102 102
 
103
+    private Integer eqspid;
104
+
103 105
 }

+ 9
- 9
sexam/src/main/resources/mapper/paperstudent/EPaperStudentMapper.xml Dosyayı Görüntüle

@@ -61,7 +61,7 @@
61 61
     </select>
62 62
     <!--学生试卷附件(android)-->
63 63
     <select id="listStuPaperFjQuestionsForAndroid" resultType="java.util.Map">
64
-        select distinct psq.epsqid,psq.questionid,psq.qn,psq.qorder,psq.answered,psq.ansertype,psq.stuanswer,
64
+        select distinct psq.epsqid,psq.questionid,psq.qn,psq.qorder,psq.answered,psq.answertype,psq.stuanswer,
65 65
         psq.stuanswertxt,psq.eptqid,pq.score,pq.optionnum,pq.ctype,pq.qtypeid,pq.qtypename
66 66
         from e_paper_student_question psq left join e_paper_qtype_question pq on psq.eptqid=pq.eptqid
67 67
         where psq.epsid=#{epsid} order by psq.qorder
@@ -74,13 +74,13 @@
74 74
         <result column="eptnum" property="eptnum"></result>
75 75
         <result column="eptorder" property="eptorder"></result>
76 76
         <result column="eptscore" property="eptscore"></result>
77
-        <collection property="questions" ofType="com.xhkjedu.sexam.vo.paper.EPaperQtypeQuestionVo" javaType="java.util.List">
77
+        <collection property="questions" ofType="java.util.Map" javaType="java.util.List">
78 78
             <result column="epsqid" property="epsqid"></result>
79 79
             <result column="questionid" property="questionid"></result>
80 80
             <result column="qscore" property="qscore"></result>
81 81
             <result column="qorder" property="qorder"></result>
82 82
             <result column="answered" property="answered"></result>
83
-            <result column="ansertype" property="ansertype"></result>
83
+            <result column="answertype" property="answertype"></result>
84 84
             <result column="stuanswer" property="stuanswer"></result>
85 85
             <result column="stuanswertxt" property="stuanswertxt"></result>
86 86
             <result column="eptqid" property="eptqid"></result>
@@ -106,12 +106,12 @@
106 106
     <!--学生试卷题库(web)-->
107 107
     <select id="listStuPaperQuestionsForWeb" resultMap="qtypesQuestion">
108 108
         select pt.eptid,pt.ctype,pt.eptname,pt.eptnum,pt.eptorder,pt.eptscore,
109
-               psq.epsqid,psq.questionid,psq.qorder,psq.qscore,psq.answered,psq.ansertype,psq.stuanswer,
109
+               psq.epsqid,psq.questionid,psq.qorder,psq.qscore,psq.answered,psq.answertype,psq.stuanswer,
110 110
                psq.stuanswertxt,psq.eptqid,q.qstem,q.qoption,q.ctype qctype,q.hearfile,q.qtypeid,
111 111
                q.qtypename,q.qlevel,q.snum,q.sorder,q.questionpid,mq.questionid mquestionid,mq.qstem mqstem,
112 112
                mq.qoption mqoption,mq.ctype mctype,mq.qtypeid mqtypeid,mq.qtypename mqtypename
113
-        from e_paper_student_question psq
114
-        left join e_paper_qtype pt on psq.epid=pt.epid
113
+        from e_paper_student_question psq left join e_paper_qtype_question ptq on psq.eptqid=ptq.eptqid
114
+        left join e_paper_qtype pt on pt.eptid=ptq.eptid
115 115
         left join t_question q on psq.questionid=q.questionid
116 116
         left join t_question mq on q.questionpid=mq.questionid
117 117
         where psq.epsid=#{epsid} order by pt.eptorder,psq.qorder
@@ -135,7 +135,7 @@
135 135
             <result column="qctype" property="qctype"></result>
136 136
             <result column="optionnum" property="optionnum"></result>
137 137
             <result column="answered" property="answered"></result>
138
-            <result column="ansertype" property="ansertype"></result>
138
+            <result column="answertype" property="answertype"></result>
139 139
             <result column="stuanswer" property="stuanswer"></result>
140 140
             <result column="stuanswertxt" property="stuanswertxt"></result>
141 141
         </collection>
@@ -143,10 +143,10 @@
143 143
     <!--学生试卷附件(web)-->
144 144
     <select id="listStuPaperFjQuestionsForWeb" resultMap="fjtypeQuestions">
145 145
         select pt.eptid,pt.ctype,pt.eptname,pt.eptnum,pt.eptorder,pt.eptscore,
146
-               psq.epsqid,psq.qn,psq.qorder,psq.answered,psq.ansertype,psq.stuanswer,
146
+               psq.epsqid,psq.qn,psq.qorder,psq.answered,psq.answertype,psq.stuanswer,
147 147
                psq.stuanswertxt,psq.eptqid,psq.qscore score,pq.optionnum,pq.ctype qctype,pq.qtypeid,pq.qtypename
148 148
         from e_paper_student_question psq left join e_paper_qtype_question pq on psq.eptqid=pq.eptqid
149
-        left join e_paper_qtype pt on psq.epid=pt.epid
149
+        left join e_paper_qtype pt on pq.eptid=pt.eptid
150 150
         where psq.epsid=#{epsid} order by pt.eptorder, psq.qorder
151 151
     </select>
152 152
 

+ 3
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/vo/question/SelectQuestionVo.java Dosyayı Görüntüle

@@ -40,6 +40,9 @@ public class SelectQuestionVo {
40 40
     //处理题型1单选题2多选题3主观题4判断对错5判断✔6判断TF7完形填空8阅读理解
41 41
     private Integer ctype;
42 42
 
43
+    //试题类型1单体2母题3子题
44
+    private Integer qlevel;
45
+
43 46
     //资源归属1平台1区平台3学校4个人(搜索时5我的收藏 6我的上传)
44 47
     private Integer belong;
45 48
 

+ 20
- 19
sstudy/src/main/resources/mapper/question/QuestionMapper.xml Dosyayı Görüntüle

@@ -188,7 +188,7 @@
188 188
     <select id="listForSelect" resultType="com.xhkjedu.sstudy.vo.question.SelectQuestionVo">
189 189
         select q.questionid,q.score,q.complexity,q.qstem,q.qoption,q.qanswer,q.qanalyze
190 190
         ,q.qtypeid,q.qtypename,q.count,GROUP_CONCAT(p.pointname)points,q.ctype,q.belong,q.createid
191
-        ,q.source,q.year,q.region,q.schoolname
191
+        ,q.source,q.year,q.region,q.schoolname,q.qlevel
192 192
         from t_question q left join t_question_point qp on q.questionid = qp.questionid
193 193
         left join t_point p on p.pointid=qp.pointid
194 194
         left join t_question_director qd on q.questionid=qd.questionid
@@ -196,6 +196,24 @@
196 196
             left join t_question_collect qc on q.questionid = qc.questionid
197 197
         </if>
198 198
         where q.qstate=1
199
+        <if test="question.lsbid!=null and question.lsbid!='0'.toString() and question.lsbid!=''">
200
+            and qd.lsbid=#{question.lsbid}
201
+        </if>
202
+        <if test="question.directorid!=null and question.directorid!='0'.toString() and question.directorid!=''">
203
+            and qd.directorid=#{question.directorid}
204
+        </if>
205
+        <if test="question.subjectid!=null and question.subjectid!='0'.toString() and question.subjectid!=''">
206
+            and q.subjectid=#{question.subjectid}
207
+        </if>
208
+        <if test="question.pointid!=null and question.pointid!='0'.toString() and question.pointid!=''">
209
+            and qp.pointid=#{question.pointid}
210
+        </if>
211
+        <if test="question.qtypeid!=null and question.qtypeid!='0'.toString() and question.qtypeid!=''">
212
+            and q.qtypeid=#{question.qtypeid}
213
+        </if>
214
+        <if test="question.complexity!=null and question.complexity!=0">
215
+            and q.complexity=#{question.complexity}
216
+        </if>
199 217
         <if test="question.belong==0">
200 218
             and (q.belong in(1,2)
201 219
             <if test="question.schoolid!=null">
@@ -215,24 +233,6 @@
215 233
         <if test="question.belong==3">
216 234
             and q.schoolid=#{question.schoolid}
217 235
         </if>
218
-        <if test="question.lsbid!=null and question.lsbid!='0'.toString() and question.lsbid!=''">
219
-            and qd.lsbid=#{question.lsbid}
220
-        </if>
221
-        <if test="question.directorid!=null and question.directorid!='0'.toString() and question.directorid!=''">
222
-            and qd.directorid=#{question.directorid}
223
-        </if>
224
-        <if test="question.subjectid!=null and question.subjectid!='0'.toString() and question.subjectid!=''">
225
-            and q.subjectid=#{question.subjectid}
226
-        </if>
227
-        <if test="question.pointid!=null and question.pointid!='0'.toString() and question.pointid!=''">
228
-            and qp.pointid=#{question.pointid}
229
-        </if>
230
-        <if test="question.qtypeid!=null and question.qtypeid!='0'.toString() and question.qtypeid!=''">
231
-            and q.qtypeid=#{question.qtypeid}
232
-        </if>
233
-        <if test="question.complexity!=null and question.complexity!=0">
234
-            and q.complexity=#{question.complexity}
235
-        </if>
236 236
         <if test="question.belong!=null and question.belong!=0">
237 237
             <if test="question.belong==4 or question.belong==6">
238 238
                 and q.createid=#{question.createid}
@@ -241,6 +241,7 @@
241 241
                 and qc.userid=#{question.createid}
242 242
             </if>
243 243
         </if>
244
+        and q.qlevel &lt; 3
244 245
         group by q.questionid order by q.createtime desc
245 246
     </select>
246 247
     <!--修改试题状态-->

Loading…
İptal
Kaydet