Commit 4fd2e08c8ffb9361c6450441d247956c30b7693c
1 parent
91a745c9
修复接口中的bug
Showing
9 changed files
with
227 additions
and
23 deletions
WebRoot/WEB-INF/jsp/sunvote/teacher/teacher_main.jsp
... | ... | @@ -170,7 +170,7 @@ |
170 | 170 | <div class="modal-content"> |
171 | 171 | <div class="modal-header"> |
172 | 172 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> |
173 | - <h4 class="modal-title">考试时间</h4> | |
173 | + <h4 class="modal-title">新建试卷</h4> | |
174 | 174 | </div> |
175 | 175 | <div class="modal-body"> |
176 | 176 | <div class="form-group"> | ... | ... |
resources/mybatis1/api/V1Mapper.xml
... | ... | @@ -35,6 +35,11 @@ |
35 | 35 | SELECT |
36 | 36 | STUDENT_ID, |
37 | 37 | sv_student.`NAME`, |
38 | + sv_student.`SNO`, | |
39 | + sv_student.`NUMBER`, | |
40 | + sv_student.`GROUPID`, | |
41 | + sv_student.`SIGN_NO`, | |
42 | + sv_student.`SEX`, | |
38 | 43 | sv_student.`KEYPAD_ID` |
39 | 44 | FROM |
40 | 45 | sv_classroster |
... | ... | @@ -76,8 +81,8 @@ |
76 | 81 | <select id="getTestPaperInfo" parameterType="pd" resultType="pd"> |
77 | 82 | SELECT |
78 | 83 | sv_question.OPTION_NUM, |
79 | - sv_paperquestion.SCORE, | |
80 | 84 | sv_paperquestion.PART_SCORE, |
85 | + sv_paperquestion.SCORE, | |
81 | 86 | sv_paperquestion.RANK, |
82 | 87 | sv_paperquestion.NO_NAME, |
83 | 88 | sv_question.ANALYSIS, |
... | ... | @@ -86,6 +91,7 @@ |
86 | 91 | sv_question.CONTENT, |
87 | 92 | sv_question.ANSWER, |
88 | 93 | sv_question.OPTION_CONTENT, |
94 | + sv_question.PROBLEM_TYPE_ID, | |
89 | 95 | sv_question.P_ID |
90 | 96 | FROM |
91 | 97 | sv_paperquestion |
... | ... | @@ -110,6 +116,7 @@ |
110 | 116 | sv_question.DIFFICULTY, |
111 | 117 | sv_question.QUESTION_ID, |
112 | 118 | sv_question.CONTENT, |
119 | + sv_question.PROBLEM_TYPE_ID, | |
113 | 120 | sv_question.ANSWER, |
114 | 121 | sv_question.OPTION_CONTENT |
115 | 122 | FROM | ... | ... |
resources/mybatis1/sunvote/PaperMapper.xml
... | ... | @@ -21,6 +21,7 @@ |
21 | 21 | PAPER_STATE, |
22 | 22 | REMARK, |
23 | 23 | SCORE, |
24 | + QUESTION_NUM, | |
24 | 25 | PAPER_ID |
25 | 26 | </sql> |
26 | 27 | |
... | ... | @@ -38,6 +39,7 @@ |
38 | 39 | #{PAPER_STATE}, |
39 | 40 | #{REMARK}, |
40 | 41 | #{SCORE}, |
42 | + #{QUESTION_NUM}, | |
41 | 43 | #{PAPER_ID} |
42 | 44 | </sql> |
43 | 45 | |
... | ... | @@ -77,6 +79,7 @@ |
77 | 79 | PAPER_STATE = #{PAPER_STATE}, |
78 | 80 | REMARK = #{REMARK}, |
79 | 81 | SCORE = #{SCORE}, |
82 | + QUESTION_NUM = #{QUESTION_NUM}, | |
80 | 83 | PAPER_ID = PAPER_ID |
81 | 84 | where |
82 | 85 | PAPER_ID = #{PAPER_ID} | ... | ... |
resources/mybatis1/sunvote/SClassMapper.xml
... | ... | @@ -91,15 +91,14 @@ |
91 | 91 | from |
92 | 92 | <include refid="tableName"></include> |
93 | 93 | where 1=1 |
94 | - <if test="pd.keywords!= null and pd.keywords != ''"><!-- 关键词检索 --> | |
95 | - and | |
96 | - ( | |
97 | - <!-- 根据需求自己加检索条件 | |
98 | - 字段1 LIKE CONCAT(CONCAT('%', #{pd.keywords}),'%') | |
99 | - or | |
100 | - 字段2 LIKE CONCAT(CONCAT('%', #{pd.keywords}),'%') | |
101 | - --> | |
102 | - ) | |
94 | + <if test="SCHOOL_ID != null and SCHOOL_ID != ''"> | |
95 | + and ( SCHOOL_ID = #{SCHOOL_ID} ) | |
96 | + </if> | |
97 | + <if test="GRADE_ID != null and GRADE_ID != ''"> | |
98 | + and ( GRADE_ID = #{GRADE_ID} ) | |
99 | + </if> | |
100 | + <if test="CLASS_TYPE != null and CLASS_TYPE != ''"> | |
101 | + and ( CLASS_TYPE = #{CLASS_TYPE} ) | |
103 | 102 | </if> |
104 | 103 | </select> |
105 | 104 | |
... | ... | @@ -109,6 +108,17 @@ |
109 | 108 | <include refid="Field"></include> |
110 | 109 | from |
111 | 110 | <include refid="tableName"></include> |
111 | + where 1=1 | |
112 | + <if test="SCHOOL_ID != null and SCHOOL_ID != ''"> | |
113 | + and ( SCHOOL_ID = #{SCHOOL_ID} ) | |
114 | + </if> | |
115 | + <if test="GRADE_ID != null and GRADE_ID != ''"> | |
116 | + and ( GRADE_ID = #{GRADE_ID} ) | |
117 | + </if> | |
118 | + <if test="CLASS_TYPE != null and CLASS_TYPE != ''"> | |
119 | + and ( CLASS_TYPE = #{CLASS_TYPE} ) | |
120 | + </if> | |
121 | + | |
112 | 122 | </select> |
113 | 123 | |
114 | 124 | <!-- 批量删除 --> | ... | ... |
resources/mybatis1/sunvote/SchoolGradeSubjectMapper.xml
... | ... | @@ -90,6 +90,55 @@ |
90 | 90 | <include refid="Field"></include> |
91 | 91 | from |
92 | 92 | <include refid="tableName"></include> |
93 | + where 1=1 | |
94 | + | |
95 | + <if test=" SCHOOL_ID != null and SCHOOL_ID != ''"> | |
96 | + and ( SCHOOL_ID = #{SCHOOL_ID} ) | |
97 | + </if> | |
98 | + <if test=" GRADE_ID != null and GRADE_ID != ''"> | |
99 | + and ( GRADE_ID = #{GRADE_ID} ) | |
100 | + </if> | |
101 | + <if test=" SUBJECT_ID != null and SUBJECT_ID != ''"> | |
102 | + and ( SUBJECT_ID = #{SUBJECT_ID} ) | |
103 | + </if> | |
104 | + | |
105 | + </select> | |
106 | + | |
107 | + <!-- 列表(所有年级) --> | |
108 | + <select id="listAllGrade" parameterType="pd" resultType="pd"> | |
109 | + select | |
110 | + SV_GRADE.NAME,SV_GRADE.DESC,REMARK,ID | |
111 | + from | |
112 | + SV_SCHOOLGRADESUBJECT inner join SV_GRADE on SV_SCHOOLGRADESUBJECT.GRADE_ID = SV_GRADE.ID | |
113 | + where 1=1 | |
114 | + | |
115 | + <if test=" SCHOOL_ID != null and SCHOOL_ID != ''"> | |
116 | + and ( SCHOOL_ID = #{SCHOOL_ID} ) | |
117 | + </if> | |
118 | + | |
119 | + group by GRADE_ID | |
120 | + </select> | |
121 | + | |
122 | + <!-- 列表(所有科目) --> | |
123 | + <select id="listAllSubject" parameterType="pd" resultType="pd"> | |
124 | + select | |
125 | + SV_SUBJECT.CNAME, | |
126 | + SV_SUBJECT.ENAME, | |
127 | + SV_SUBJECT.REMARK, | |
128 | + SV_SUBJECT.ID | |
129 | + from | |
130 | + SV_SCHOOLGRADESUBJECT inner join SV_SUBJECT on SV_SCHOOLGRADESUBJECT.SUBJECT_ID = SV_SUBJECT.ID | |
131 | + where 1=1 | |
132 | + <if test=" SCHOOL_ID != null and SCHOOL_ID != ''"> | |
133 | + and ( SCHOOL_ID = #{SCHOOL_ID} ) | |
134 | + </if> | |
135 | + | |
136 | + <if test=" GRADE_ID != null and GRADE_ID != ''"> | |
137 | + and ( GRADE_ID = #{GRADE_ID} ) | |
138 | + </if> | |
139 | + | |
140 | + group by SUBJECT_ID | |
141 | + | |
93 | 142 | </select> |
94 | 143 | |
95 | 144 | <!-- 批量删除 --> | ... | ... |
src/com/fh/bean/Question.java
... | ... | @@ -41,6 +41,8 @@ public class Question { |
41 | 41 | private String sug_score; |
42 | 42 | |
43 | 43 | private String sug_part_score; |
44 | + | |
45 | + private String questionType = "" ; | |
44 | 46 | |
45 | 47 | private List<Question> questions; |
46 | 48 | |
... | ... | @@ -204,4 +206,13 @@ public class Question { |
204 | 206 | return this.questions; |
205 | 207 | } |
206 | 208 | |
209 | + public String getQuestionType() { | |
210 | + return questionType; | |
211 | + } | |
212 | + | |
213 | + public void setQuestionType(String questionType) { | |
214 | + this.questionType = questionType; | |
215 | + } | |
216 | + | |
217 | + | |
207 | 218 | } | ... | ... |
src/com/fh/controller/api/V1.java
... | ... | @@ -186,8 +186,8 @@ public class V1 extends BaseController { |
186 | 186 | @ResponseBody |
187 | 187 | public Object sclass() throws Exception { |
188 | 188 | PageData pd = this.getPageData(); |
189 | - ResponseGson<PageData> res = new ResponseGson(); | |
190 | 189 | if (pd.containsKey("ID")) { |
190 | + ResponseGson<PageData> res = new ResponseGson(); | |
191 | 191 | PageData pageData = sclassService.findById(pd); |
192 | 192 | if (pageData != null && pageData.containsKey("ID")) { |
193 | 193 | PageData pt = new PageData(); |
... | ... | @@ -198,11 +198,67 @@ public class V1 extends BaseController { |
198 | 198 | } else { |
199 | 199 | res.set2Error(); |
200 | 200 | } |
201 | + return res.toJson(); | |
202 | + } else { | |
203 | + ResponseGson<List<PageData>> res = new ResponseGson(); | |
204 | + List<PageData> list = sclassService.listAll(pd); | |
205 | + res.setData(list); | |
206 | + return res.toJson(); | |
207 | + | |
208 | + } | |
209 | + } | |
210 | + | |
211 | + @RequestMapping(value = "/questiontype", produces = "application/json;charset=UTF-8") | |
212 | + @ResponseBody | |
213 | + public Object questiontype() throws Exception { | |
214 | + PageData pd = this.getPageData(); | |
215 | + ResponseGson<List<PageData>> res = new ResponseGson(); | |
216 | + List<PageData> list = questiontypeService.listAll(pd); | |
217 | + res.setData(list); | |
218 | + return res.toJson(); | |
219 | + } | |
220 | + | |
221 | + @RequestMapping(value = "/classtype", produces = "application/json;charset=UTF-8") | |
222 | + @ResponseBody | |
223 | + public Object classtype() throws Exception { | |
224 | + PageData pd = this.getPageData(); | |
225 | + ResponseGson<List<PageData>> res = new ResponseGson(); | |
226 | + List<PageData> list = classtypeService.listAll(pd); | |
227 | + res.setData(list); | |
228 | + return res.toJson(); | |
229 | + } | |
230 | + | |
231 | + @RequestMapping(value = "/grade", produces = "application/json;charset=UTF-8") | |
232 | + @ResponseBody | |
233 | + public Object grade() throws Exception { | |
234 | + PageData pd = this.getPageData(); | |
235 | + ResponseGson<List<PageData>> res = new ResponseGson(); | |
236 | + if (!pd.containsKey("SCHOOL_ID")) { | |
237 | + List<PageData> list = gradeService.listAll(pd); | |
238 | + res.setData(list); | |
201 | 239 | } else { |
202 | - res.set2Error(); | |
240 | + List<PageData> list = schoolgradesubjectService.listAllGrade(pd); | |
241 | + res.setData(list); | |
203 | 242 | } |
204 | 243 | return res.toJson(); |
205 | 244 | } |
245 | + | |
246 | + @RequestMapping(value = "/subject", produces = "application/json;charset=UTF-8") | |
247 | + @ResponseBody | |
248 | + public Object subject() throws Exception { | |
249 | + PageData pd = this.getPageData(); | |
250 | + ResponseGson<List<PageData>> res = new ResponseGson(); | |
251 | + if (!pd.containsKey("SCHOOL_ID")) { | |
252 | + List<PageData> list = subjectService.listAll(pd); | |
253 | + res.setData(list); | |
254 | + } else { | |
255 | + List<PageData> list = schoolgradesubjectService.listAllSubject(pd); | |
256 | + res.setData(list); | |
257 | + } | |
258 | + return res.toJson(); | |
259 | + } | |
260 | + | |
261 | + | |
206 | 262 | |
207 | 263 | @RequestMapping(value = "/keypadscan", produces = "application/json;charset=UTF-8") |
208 | 264 | @ResponseBody |
... | ... | @@ -296,9 +352,10 @@ public class V1 extends BaseController { |
296 | 352 | question.setAnalysis(qpd.getString("ANALYSIS")); |
297 | 353 | question.setQuestion_from(qpd |
298 | 354 | .getString("QUESTION_FROM")); |
299 | - question.setSug_score(qpd.getString("SUG_SCORE")); | |
300 | - question.setSug_part_score(qpd | |
301 | - .getString("SUG_PART_SCORE")); | |
355 | + question.setScore(qpd.getString("SCORE")); | |
356 | + question.setPart_score(qpd | |
357 | + .getString("PART_SCORE")); | |
358 | + question.setQuestionType(qpd.getString("PROBLEM_TYPE_ID")); | |
302 | 359 | question.setRank(qpd.getString("RANK")); |
303 | 360 | question.setNo_name(qpd.getString("NO_NAME")); |
304 | 361 | if ("-1".equals("" + qpd.getString("P_ID"))) { |
... | ... | @@ -326,9 +383,10 @@ public class V1 extends BaseController { |
326 | 383 | qq.setAnalysis(q.getString("ANALYSIS")); |
327 | 384 | qq.setQuestion_from(q |
328 | 385 | .getString("QUESTION_FROM")); |
329 | - qq.setSug_score(q.getString("SUG_SCORE")); | |
330 | - qq.setSug_part_score(q | |
331 | - .getString("SUG_PART_SCORE")); | |
386 | + qq.setScore(q.getString("SCORE")); | |
387 | + qq.setPart_score(q | |
388 | + .getString("PART_SCORE")); | |
389 | + qq.setQuestionType(qpd.getString("PROBLEM_TYPE_ID")); | |
332 | 390 | qq.setRank(q.getString("RANK")); |
333 | 391 | qq.setNo_name(q.getString("NO_NAME")); |
334 | 392 | question.getQuestions().add(qq); |
... | ... | @@ -365,7 +423,32 @@ public class V1 extends BaseController { |
365 | 423 | |
366 | 424 | return res.toJson(); |
367 | 425 | } |
368 | - | |
426 | + | |
427 | + @RequestMapping(value = "/question", produces = "application/json;charset=UTF-8") | |
428 | + @ResponseBody | |
429 | + public Object question() throws Exception { | |
430 | + PageData pd = this.getPageData(); | |
431 | + ResponseGson<PageData> res = new ResponseGson(); | |
432 | + if(pd.containsKey("ID")){ | |
433 | + pd.put("QUESTION_ID", pd.get("ID")); | |
434 | + PageData data = questionService.findById(pd); | |
435 | + res.setData(data); | |
436 | + }else{ | |
437 | + res.setDataError(); | |
438 | + } | |
439 | + return res.toJson(); | |
440 | + } | |
441 | + | |
442 | + @RequestMapping(value = "/question/add", produces = "application/json;charset=UTF-8") | |
443 | + @ResponseBody | |
444 | + public Object questionAdd() throws Exception { | |
445 | + PageData pd = this.getPageData(); | |
446 | + ResponseGson<PageData> res = new ResponseGson(); | |
447 | + pd.put("QUESTION_ID", this.get32UUID()); | |
448 | + questionService.save(pd); | |
449 | + return res.toJson(); | |
450 | + } | |
451 | + | |
369 | 452 | @RequestMapping(value = "/uploadpaper", produces = "application/json;charset=UTF-8") |
370 | 453 | @ResponseBody |
371 | 454 | public Object uploadpaper() throws Exception { |
... | ... | @@ -373,6 +456,7 @@ public class V1 extends BaseController { |
373 | 456 | ResponseGson<String> res = new ResponseGson(); |
374 | 457 | |
375 | 458 | if (!StringUtils.isEmpty(pd.getJsonString())) { |
459 | + logger.info(pd.getJsonString()); | |
376 | 460 | Paper paper = Paper.parse(pd.getJsonString()); |
377 | 461 | PageData paperPd = new PageData(); |
378 | 462 | String paperID = this.get32UUID(); |
... | ... | @@ -392,7 +476,8 @@ public class V1 extends BaseController { |
392 | 476 | paperPd.put("CREATE_DATE", Tools.date2Str(new Date())); |
393 | 477 | paperPd.put("MODIFY_DATE", Tools.date2Str(new Date())); |
394 | 478 | |
395 | - paperService.save(paperPd); | |
479 | + int questionNum = 0 ; | |
480 | + | |
396 | 481 | |
397 | 482 | List<Question> questions = paper.getQuestions(); |
398 | 483 | if (questions != null) { |
... | ... | @@ -404,11 +489,12 @@ public class V1 extends BaseController { |
404 | 489 | && question.getQuestions().size() > 0) { |
405 | 490 | qPd.put("P_ID", "-1"); |
406 | 491 | } else { |
492 | + questionNum ++ ; | |
407 | 493 | qPd.put("P_ID", "0"); |
408 | 494 | } |
409 | 495 | qPd.put("SUBJECT_ID", paper.getSubject_id()); |
410 | 496 | qPd.put("CHAPTER_ID", question.getChapter_id()); |
411 | - qPd.put("PROBLEM_TYPE_ID", question.getProblem_type_id()); | |
497 | + qPd.put("PROBLEM_TYPE_ID", question.getProblem_type_id() == null ? "1" : question.getProblem_type_id()); | |
412 | 498 | qPd.put("TEACHER_ID", paper.getUser_id()); |
413 | 499 | qPd.put("SCHOOL_ID", schoolID); |
414 | 500 | qPd.put("KNOWLEDGE_ID", question.getKnowledge_id()); |
... | ... | @@ -445,7 +531,7 @@ public class V1 extends BaseController { |
445 | 531 | cqPd.put("P_ID", questionID); |
446 | 532 | cqPd.put("SUBJECT_ID", paper.getSubject_id()); |
447 | 533 | cqPd.put("CHAPTER_ID", q.getChapter_id()); |
448 | - cqPd.put("PROBLEM_TYPE_ID", q.getProblem_type_id()); | |
534 | + cqPd.put("PROBLEM_TYPE_ID", question.getProblem_type_id() == null ? "1" : question.getProblem_type_id()); | |
449 | 535 | cqPd.put("TEACHER_ID", paper.getUser_id()); |
450 | 536 | cqPd.put("SCHOOL_ID", schoolID); |
451 | 537 | cqPd.put("KNOWLEDGE_ID", q.getKnowledge_id()); |
... | ... | @@ -474,10 +560,13 @@ public class V1 extends BaseController { |
474 | 560 | cpqPd.put("PAPERQUESTION_ID", this.get32UUID()); |
475 | 561 | |
476 | 562 | paperquestionService.save(cpqPd); |
563 | + questionNum ++ ; | |
477 | 564 | } |
478 | 565 | } |
479 | 566 | } |
480 | 567 | } |
568 | + paperPd.put("QUESTION_NUM", "" + questionNum); | |
569 | + paperService.save(paperPd); | |
481 | 570 | |
482 | 571 | } else { |
483 | 572 | res.setDataError(); |
... | ... | @@ -490,9 +579,11 @@ public class V1 extends BaseController { |
490 | 579 | @RequestMapping(value = "/uploadtestpaper", produces = "application/json;charset=UTF-8") |
491 | 580 | @ResponseBody |
492 | 581 | public Object uploadTestpaper() { |
582 | + long cur = System.currentTimeMillis(); | |
493 | 583 | PageData pd = this.getPageData(); |
494 | 584 | ResponseGson<String> res = new ResponseGson(); |
495 | 585 | if (!StringUtils.isEmpty(pd.getJsonString())) { |
586 | + logger.info(pd.getJsonString()); | |
496 | 587 | TestPaper testPaper = TestPaper.parse(pd.getJsonString()); |
497 | 588 | try { |
498 | 589 | PageData testPd = new PageData(); |
... | ... | @@ -576,6 +667,7 @@ public class V1 extends BaseController { |
576 | 667 | } else { |
577 | 668 | res.setDataError(); |
578 | 669 | } |
670 | + logger.info("uploadtestpaper cost time:" + (System.currentTimeMillis() - cur)); | |
579 | 671 | |
580 | 672 | return res.toJson(); |
581 | 673 | |
... | ... | @@ -704,4 +796,15 @@ public class V1 extends BaseController { |
704 | 796 | return res.toJson(); |
705 | 797 | |
706 | 798 | } |
799 | + | |
800 | + | |
801 | + @RequestMapping(value = "/schooladmin", produces = "application/json;charset=UTF-8") | |
802 | + @ResponseBody | |
803 | + public void schoolAdmin(){ | |
804 | + PageData pd = this.getPageData(); | |
805 | + this.getUserID(); | |
806 | + | |
807 | + | |
808 | + } | |
809 | + | |
707 | 810 | } | ... | ... |
src/com/fh/service/sunvote/schoolgradesubject/SchoolGradeSubjectManager.java
1 | 1 | package com.fh.service.sunvote.schoolgradesubject; |
2 | 2 | |
3 | 3 | import java.util.List; |
4 | + | |
4 | 5 | import com.fh.entity.Page; |
5 | 6 | import com.fh.util.PageData; |
6 | 7 | |
... | ... | @@ -53,5 +54,9 @@ public interface SchoolGradeSubjectManager{ |
53 | 54 | */ |
54 | 55 | public void deleteAll(String[] ArrayDATA_IDS)throws Exception; |
55 | 56 | |
57 | + public List<PageData> listAllGrade(PageData pd)throws Exception; | |
58 | + | |
59 | + public List<PageData> listAllSubject(PageData pd)throws Exception; | |
60 | + | |
56 | 61 | } |
57 | 62 | ... | ... |
src/com/fh/service/sunvote/schoolgradesubject/impl/SchoolGradeSubjectService.java
... | ... | @@ -60,6 +60,22 @@ public class SchoolGradeSubjectService implements SchoolGradeSubjectManager{ |
60 | 60 | public List<PageData> listAll(PageData pd)throws Exception{ |
61 | 61 | return (List<PageData>)dao.findForList("SchoolGradeSubjectMapper.listAll", pd); |
62 | 62 | } |
63 | + /**列表(年级) | |
64 | + * @param pd | |
65 | + * @throws Exception | |
66 | + */ | |
67 | + @SuppressWarnings("unchecked") | |
68 | + public List<PageData> listAllGrade(PageData pd)throws Exception{ | |
69 | + return (List<PageData>)dao.findForList("SchoolGradeSubjectMapper.listAllGrade", pd); | |
70 | + } | |
71 | + /**列表(科目) | |
72 | + * @param pd | |
73 | + * @throws Exception | |
74 | + */ | |
75 | + @SuppressWarnings("unchecked") | |
76 | + public List<PageData> listAllSubject(PageData pd)throws Exception{ | |
77 | + return (List<PageData>)dao.findForList("SchoolGradeSubjectMapper.listAllSubject", pd); | |
78 | + } | |
63 | 79 | |
64 | 80 | /**通过id获取数据 |
65 | 81 | * @param pd | ... | ... |