Browse Source

完善学生考试

tags/正式版本
王宁 2 years ago
parent
commit
6ece1fa634

+ 38
- 38
sexam/src/main/java/com/xhkjedu/sexam/controller/paperstudent/EPaperStudentController.java View File

35
 
35
 
36
     //学生考试列表
36
     //学生考试列表
37
     @PostMapping("/list")
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
             List<Map> rtnlst = ePaperStudentService.listExamPapersForStudent(eps);
42
             List<Map> rtnlst = ePaperStudentService.listExamPapersForStudent(eps);
43
-            return new ResultVo(0,"成功获取考试列表",rtnlst);
44
-        }else{
43
+            return new ResultVo(0, "成功获取考试列表", rtnlst);
44
+        } else {
45
             Integer page = eps.getPage();
45
             Integer page = eps.getPage();
46
             Integer pageSize = eps.getPageSize();
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
             PageHelper.startPage(page, pageSize);
48
             PageHelper.startPage(page, pageSize);
49
             List<Map> rtnlst = ePaperStudentService.listExamsEndForStudent(eps);
49
             List<Map> rtnlst = ePaperStudentService.listExamsEndForStudent(eps);
50
             PageResult pageResult = PageUtil.getPageResult(new PageInfo<>(rtnlst));
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
     //学生开始考试(android)
55
     //学生开始考试(android)
56
     @PostMapping("/spa")
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
         List<Map> list = ePaperStudentService.startPaperForAndroid(eps);
59
         List<Map> list = ePaperStudentService.startPaperForAndroid(eps);
60
-        return new ResultVo(0,"成功获取学生试卷",list);
60
+        return new ResultVo(0, "成功获取学生试卷", list);
61
     }
61
     }
62
+
62
     //学生开始考试(web)
63
     //学生开始考试(web)
63
     @PostMapping("/spw")
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
         EPaperStudentVo psvo = ePaperStudentService.startPaperForWeb(eps);
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
     @PostMapping("/scq")
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
     @PostMapping("/scp")
84
     @PostMapping("/scp")
83
-    public ResultVo saveCommitPaper(@RequestBody EPaperStudent ps){
85
+    public ResultVo saveCommitPaper(@RequestBody EPaperStudent ps) {
84
         try {
86
         try {
85
-            N_Utils.validation(new Object[]{ps.getEpsid(),"试卷id",1});
87
+            N_Utils.validation(new Object[]{ps.getEpsid(), "试卷id", 1});
86
             ePaperStudentService.saveCommitPaper(ps.getEpsid());
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
     @PostMapping("/scpw")
97
     @PostMapping("/scpw")
96
-    public ResultVo saveCommitPaperWeb(@RequestBody PaperStudentWebVo ps){
98
+    public ResultVo saveCommitPaperWeb(@RequestBody PaperStudentWebVo ps) {
97
         try {
99
         try {
98
-            N_Utils.validation(new Object[]{ps.getEpsid(),"试卷id",1});
100
+            N_Utils.validation(new Object[]{ps.getEpsid(), "试卷id", 1});
99
             List<EPaperStudentQuestion> qlist = ps.getQuestions();
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
             ePaperStudentService.saveCommitPaperForWeb(ps);
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 View File

8
 import javax.persistence.Transient;
8
 import javax.persistence.Transient;
9
 import java.util.ArrayList;
9
 import java.util.ArrayList;
10
 import java.util.List;
10
 import java.util.List;
11
+import java.util.Map;
11
 
12
 
12
 @Table(name = "e_paper_qtype")
13
 @Table(name = "e_paper_qtype")
13
 @Data
14
 @Data
43
     //试题集合
44
     //试题集合
44
     @Transient
45
     @Transient
45
     private List<EPaperQtypeQuestion> questions = new ArrayList<>();
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 View File

121
             sq.setConverted(0);
121
             sq.setConverted(0);
122
             sq.setChecked(0);
122
             sq.setChecked(0);
123
             sq.setStuscore(0.0);
123
             sq.setStuscore(0.0);
124
+            sq.setCosttime(0);
124
             psqlist.add(sq);
125
             psqlist.add(sq);
125
         }
126
         }
126
         ePaperStudentQuestionMapper.insertList(psqlist);//保存试卷
127
         ePaperStudentQuestionMapper.insertList(psqlist);//保存试卷

+ 2
- 0
sexam/src/main/java/com/xhkjedu/sexam/vo/paper/EPaperQtypeQuestionVo.java View File

100
     //子题集合
100
     //子题集合
101
     private List<EPaperQtypeQuestionVo> sonques;
101
     private List<EPaperQtypeQuestionVo> sonques;
102
 
102
 
103
+    private Integer eqspid;
104
+
103
 }
105
 }

+ 9
- 9
sexam/src/main/resources/mapper/paperstudent/EPaperStudentMapper.xml View File

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

+ 3
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/vo/question/SelectQuestionVo.java View File

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

+ 20
- 19
sstudy/src/main/resources/mapper/question/QuestionMapper.xml View File

188
     <select id="listForSelect" resultType="com.xhkjedu.sstudy.vo.question.SelectQuestionVo">
188
     <select id="listForSelect" resultType="com.xhkjedu.sstudy.vo.question.SelectQuestionVo">
189
         select q.questionid,q.score,q.complexity,q.qstem,q.qoption,q.qanswer,q.qanalyze
189
         select q.questionid,q.score,q.complexity,q.qstem,q.qoption,q.qanswer,q.qanalyze
190
         ,q.qtypeid,q.qtypename,q.count,GROUP_CONCAT(p.pointname)points,q.ctype,q.belong,q.createid
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
         from t_question q left join t_question_point qp on q.questionid = qp.questionid
192
         from t_question q left join t_question_point qp on q.questionid = qp.questionid
193
         left join t_point p on p.pointid=qp.pointid
193
         left join t_point p on p.pointid=qp.pointid
194
         left join t_question_director qd on q.questionid=qd.questionid
194
         left join t_question_director qd on q.questionid=qd.questionid
196
             left join t_question_collect qc on q.questionid = qc.questionid
196
             left join t_question_collect qc on q.questionid = qc.questionid
197
         </if>
197
         </if>
198
         where q.qstate=1
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
         <if test="question.belong==0">
217
         <if test="question.belong==0">
200
             and (q.belong in(1,2)
218
             and (q.belong in(1,2)
201
             <if test="question.schoolid!=null">
219
             <if test="question.schoolid!=null">
215
         <if test="question.belong==3">
233
         <if test="question.belong==3">
216
             and q.schoolid=#{question.schoolid}
234
             and q.schoolid=#{question.schoolid}
217
         </if>
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
         <if test="question.belong!=null and question.belong!=0">
236
         <if test="question.belong!=null and question.belong!=0">
237
             <if test="question.belong==4 or question.belong==6">
237
             <if test="question.belong==4 or question.belong==6">
238
                 and q.createid=#{question.createid}
238
                 and q.createid=#{question.createid}
241
                 and qc.userid=#{question.createid}
241
                 and qc.userid=#{question.createid}
242
             </if>
242
             </if>
243
         </if>
243
         </if>
244
+        and q.qlevel &lt; 3
244
         group by q.questionid order by q.createtime desc
245
         group by q.questionid order by q.createtime desc
245
     </select>
246
     </select>
246
     <!--修改试题状态-->
247
     <!--修改试题状态-->

Loading…
Cancel
Save