Commit 107fa3a0cab6282c51a37c70e45440a3f5adf984
1 parent
10146a46
修改试卷单选多远混合出题
Showing
11 changed files
with
588 additions
and
289 deletions
WebRoot/WEB-INF/jsp/sunvote/paper/paper_list2.jsp
@@ -146,7 +146,7 @@ | @@ -146,7 +146,7 @@ | ||
146 | //var remove = new remove(); | 146 | //var remove = new remove(); |
147 | window.top.remove.init({"title":"删除","func":function(success){ | 147 | window.top.remove.init({"title":"删除","func":function(success){ |
148 | if(success){ | 148 | if(success){ |
149 | - var url = "<%=basePath%>paper/delete.do?PAPER_ID="+Id+"&tm="+new Date().getTime(); | 149 | + var url = "<%=basePath%>paper/delete.do?PAPER_ID="+Id+"&qingsongkao=true&tm="+new Date().getTime(); |
150 | window.top.loading.show(); | 150 | window.top.loading.show(); |
151 | $.get(url,function(data){ | 151 | $.get(url,function(data){ |
152 | tosearch(); | 152 | tosearch(); |
WebRoot/WEB-INF/jsp/sunvote/teacher/creat_question.jsp
@@ -26,6 +26,7 @@ | @@ -26,6 +26,7 @@ | ||
26 | <h1 class="text-center"></h1> | 26 | <h1 class="text-center"></h1> |
27 | <div class="btn_group"> | 27 | <div class="btn_group"> |
28 | <div class="time text-center" data-toggle="modal" data-target=".test_time"><h3>测验时长:<span class="bg-primary" id="time">45</span><span class="bg-primary">分钟</span></h3></div> | 28 | <div class="time text-center" data-toggle="modal" data-target=".test_time"><h3>测验时长:<span class="bg-primary" id="time">45</span><span class="bg-primary">分钟</span></h3></div> |
29 | + <div class="pull-left"><h3>总分:<span id='score_all'>0</span> 分</h3></div> | ||
29 | <div class="btn_box pull-right"> | 30 | <div class="btn_box pull-right"> |
30 | <input type="button" class="btn btn-success btn-lg" name="save" value="保存" id="save"/> | 31 | <input type="button" class="btn btn-success btn-lg" name="save" value="保存" id="save"/> |
31 | <button type="button" class="btn btn-success btn-lg" data-toggle="modal" data-target=".fast" id="fast">单选出题</button> | 32 | <button type="button" class="btn btn-success btn-lg" data-toggle="modal" data-target=".fast" id="fast">单选出题</button> |
WebRoot/static/js/control-604.js
@@ -16,7 +16,7 @@ | @@ -16,7 +16,7 @@ | ||
16 | } | 16 | } |
17 | } | 17 | } |
18 | q_num=str.length; | 18 | q_num=str.length; |
19 | - $(".content").append('<div class="section section-' + answer_index_b +' single" data-fraction="'+fraction+'" data-score=""><div class="title"><h3>第' +answer_index_b +'大题总分: ' + (q_num * fraction)+'分<!--<span>请在试题选项上点击,亮色为该试题的正确答案 </span> --></h3> </div><div class="question_list"></div></div>'); | 19 | + $(".content").append('<div class="section section-' + answer_index_b +' single" data-fraction="'+fraction+'" data-score="'+(q_num * fraction)+'"><div class="title"><h3>第' +answer_index_b +'大题总分: ' + (q_num * fraction)+'分<!--<span>请在试题选项上点击,亮色为该试题的正确答案 </span> --></h3> </div><div class="question_list"></div></div>'); |
20 | for(var i=0;i<q_num;i++){ | 20 | for(var i=0;i<q_num;i++){ |
21 | str_temp=str[i]; | 21 | str_temp=str[i]; |
22 | str_temp=str_temp.toUpperCase() | 22 | str_temp=str_temp.toUpperCase() |
@@ -112,7 +112,7 @@ | @@ -112,7 +112,7 @@ | ||
112 | }*/ | 112 | }*/ |
113 | case 5: //多选题 | 113 | case 5: //多选题 |
114 | // $(".content").html(""); | 114 | // $(".content").html(""); |
115 | - $(".content").append('<div class="section section-'+ answer_index_b +' check" data-fraction="'+fraction2+'" data-score=""> <div class="title"><h3>第' +answer_index_b +'大题总分: ' + ((index_e_2- index_s_2 + 1 )* fraction2)+'分<!--<span>请在试题选项上点击,亮色为该试题的正确答案 </span>--></h3> </div> <div class="question_list"></div></div>'); | 115 | + $(".content").append('<div class="section section-'+ answer_index_b +' check" data-fraction="'+fraction2+'" data-score="' + ((index_e_2- index_s_2 + 1 )* fraction2)+ '"> <div class="title"><h3>第' +answer_index_b +'大题总分: ' + ((index_e_2- index_s_2 + 1 )* fraction2)+'分<!--<span>请在试题选项上点击,亮色为该试题的正确答案 </span>--></h3> </div> <div class="question_list"></div></div>'); |
116 | for(var i=index_s_2;i<=index_e_2;i++){ | 116 | for(var i=index_s_2;i<=index_e_2;i++){ |
117 | questionNUm++; | 117 | questionNUm++; |
118 | $(".section-" + answer_index_b +" .question_list").append('<div class="question question'+questionNUm+'"><span>'+questionNUm+'、</span><ul></ul></div>'); | 118 | $(".section-" + answer_index_b +" .question_list").append('<div class="question question'+questionNUm+'"><span>'+questionNUm+'、</span><ul></ul></div>'); |
@@ -221,9 +221,7 @@ | @@ -221,9 +221,7 @@ | ||
221 | /*提交保存数据*/ | 221 | /*提交保存数据*/ |
222 | $("#save").click(function(){ | 222 | $("#save").click(function(){ |
223 | var url=URL; | 223 | var url=URL; |
224 | - for(i=0;i<$(".section").length;i++){ | ||
225 | - score+=parseFloat($(".section").eq(i).attr("data-score")); | ||
226 | - } | 224 | + |
227 | var data={ | 225 | var data={ |
228 | title: $(".header_box h1").text(), | 226 | title: $(".header_box h1").text(), |
229 | exam_time: parseInt($("#time").text()), | 227 | exam_time: parseInt($("#time").text()), |
@@ -231,32 +229,32 @@ | @@ -231,32 +229,32 @@ | ||
231 | subject_id: testData.subject_id, | 229 | subject_id: testData.subject_id, |
232 | grade_id: testData.grade_id, | 230 | grade_id: testData.grade_id, |
233 | user_id: testData.user_id, | 231 | user_id: testData.user_id, |
234 | - score:score, | 232 | + score:total_score, |
235 | questions:[] | 233 | questions:[] |
236 | } | 234 | } |
237 | 235 | ||
238 | if($(".section").length>0){ | 236 | if($(".section").length>0){ |
239 | var rank=0 | 237 | var rank=0 |
240 | for(i=0;i<$(".section").length;i++){ | 238 | for(i=0;i<$(".section").length;i++){ |
241 | - /*rank++; | 239 | + //rank++; |
242 | data.questions[i]={ | 240 | data.questions[i]={ |
243 | chapter_id: "0", | 241 | chapter_id: "0", |
244 | problem_type_id: "0", | 242 | problem_type_id: "0", |
245 | knowledge_id: "0", | 243 | knowledge_id: "0", |
246 | - content: $(".section").eq(i).find(".que_name").text(), | 244 | + // content: $(".section").eq(i).find(".que_name").text(), |
247 | option_num: "", | 245 | option_num: "", |
248 | option_content: "", | 246 | option_content: "", |
249 | answer: "", | 247 | answer: "", |
250 | difficulty: "", | 248 | difficulty: "", |
251 | analysis: "", | 249 | analysis: "", |
252 | question_from: "", | 250 | question_from: "", |
253 | - score:parseInt($(".section").eq(i).attr("data-fraction")), | 251 | + score:parseFloat($(".section").eq(i).attr("data-score")), |
254 | part_score: "", | 252 | part_score: "", |
255 | remark: "", | 253 | remark: "", |
256 | rank: rank, | 254 | rank: rank, |
257 | no_name: $(".section").eq(i).find(".que_num").text(), | 255 | no_name: $(".section").eq(i).find(".que_num").text(), |
258 | questions:[] | 256 | questions:[] |
259 | - }*/ | 257 | + } |
260 | for(j=0;j<$(".section").eq(i).find(".question_list").children(".question").length;j++){ | 258 | for(j=0;j<$(".section").eq(i).find(".question_list").children(".question").length;j++){ |
261 | rank++; | 259 | rank++; |
262 | var on_num=$(".section").eq(i).find(".question").eq(j).find(".on").length; | 260 | var on_num=$(".section").eq(i).find(".question").eq(j).find(".on").length; |
@@ -269,7 +267,7 @@ | @@ -269,7 +267,7 @@ | ||
269 | alert("还有试题未编辑答案。"); | 267 | alert("还有试题未编辑答案。"); |
270 | return; | 268 | return; |
271 | } | 269 | } |
272 | - data.questions[rank-1]={ | 270 | + data.questions[i].questions[j]={ |
273 | chapter_id: "0", | 271 | chapter_id: "0", |
274 | problem_type_id: "0", | 272 | problem_type_id: "0", |
275 | knowledge_id: "0", | 273 | knowledge_id: "0", |
@@ -370,6 +368,7 @@ function creatHtml(data){ | @@ -370,6 +368,7 @@ function creatHtml(data){ | ||
370 | console.log(data); | 368 | console.log(data); |
371 | $(".header_box h1").html(data.title); | 369 | $(".header_box h1").html(data.title); |
372 | $("#time").html(data.exam_time); | 370 | $("#time").html(data.exam_time); |
371 | + $("#score_all").html(data.score); | ||
373 | 372 | ||
374 | if(data.questions.length>0){ | 373 | if(data.questions.length>0){ |
375 | $(".time").removeAttr("data-target"); | 374 | $(".time").removeAttr("data-target"); |
@@ -379,7 +378,7 @@ function creatHtml(data){ | @@ -379,7 +378,7 @@ function creatHtml(data){ | ||
379 | 378 | ||
380 | for(var i=0;i<data.questions.length;i++){ | 379 | for(var i=0;i<data.questions.length;i++){ |
381 | if(data.questions[i].questions){ | 380 | if(data.questions[i].questions){ |
382 | - $(".content").append('<div class="section section-'+i+'" data-fraction="'+data.questions[i].score+'"> <h3><span class="que_num">'+data.questions[i].no_name+'</span>'+'<span class="que_name">'+data.questions[i].content+'</span></h3> <input type="button" class="btn btn-danger pull-right remove" name="remove" value="删除" /> <div class="question_list"></div></div>'); | 381 | + $(".content").append('<div class="section section-'+i+'" data-fraction="'+data.questions[i].score+'" style="margin-top:20px;"> <h3><span class="que_num">'+'第'+ (i+1) + '大题总分:'+ data.questions[i].sug_score +'</span>'+'<span class="que_name">'+data.questions[i].content+'</span></h3><!-- <input type="button" class="btn btn-danger pull-right remove" name="remove" value="删除" /> --> <div class="question_list"></div></div>'); |
383 | }else{ | 382 | }else{ |
384 | if(i == 0){ | 383 | if(i == 0){ |
385 | $(".content").append('<div class="section section0"> <div class="question_list"></div></div>'); | 384 | $(".content").append('<div class="section section0"> <div class="question_list"></div></div>'); |
resources/dbconfig.properties
1 | #数据源 1 | 1 | #数据源 1 |
2 | -url:jdbc:mysql://120.78.57.84:3306/education?autoReconnect=true&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8 | 2 | +url:jdbc:mysql://120.78.57.84:3306/education?autoReconnect=true&failOverReadOnly=false&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8 |
3 | #url:jdbc:mysql://192.168.0.3:3306/education?autoReconnect=true&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8 | 3 | #url:jdbc:mysql://192.168.0.3:3306/education?autoReconnect=true&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8 |
4 | driverClassName:com.mysql.jdbc.Driver | 4 | driverClassName:com.mysql.jdbc.Driver |
5 | username:root | 5 | username:root |
resources/mybatis1/sunvote/PaperQuestionMapper.xml
@@ -102,6 +102,10 @@ | @@ -102,6 +102,10 @@ | ||
102 | <include refid="Field"></include> | 102 | <include refid="Field"></include> |
103 | from | 103 | from |
104 | <include refid="tableName"></include> | 104 | <include refid="tableName"></include> |
105 | + where 1=1 | ||
106 | + <if test="PAPER_ID != null and PAPER_ID != ''"> | ||
107 | + and PAPER_ID = #{PAPER_ID} | ||
108 | + </if> | ||
105 | </select> | 109 | </select> |
106 | 110 | ||
107 | <!-- 批量删除 --> | 111 | <!-- 批量删除 --> |
@@ -115,6 +119,8 @@ | @@ -115,6 +119,8 @@ | ||
115 | </foreach> | 119 | </foreach> |
116 | </delete> | 120 | </delete> |
117 | 121 | ||
122 | + | ||
123 | + | ||
118 | <!-- 批量删除 --> | 124 | <!-- 批量删除 --> |
119 | <delete id="deleteAllPaper" parameterType="String"> | 125 | <delete id="deleteAllPaper" parameterType="String"> |
120 | delete from | 126 | delete from |
resources/mybatis1/sunvote/StudentMapper.xml
@@ -84,6 +84,16 @@ | @@ -84,6 +84,16 @@ | ||
84 | ID = #{ID} | 84 | ID = #{ID} |
85 | </select> | 85 | </select> |
86 | 86 | ||
87 | + <!-- 通过ID获取数据 --> | ||
88 | + <select id="findByName" parameterType="pd" resultType="pd"> | ||
89 | + select | ||
90 | + <include refid="Field"></include> | ||
91 | + from | ||
92 | + <include refid="tableName"></include> | ||
93 | + where | ||
94 | + NAME = #{NAME} | ||
95 | + </select> | ||
96 | + | ||
87 | <!-- 列表 --> | 97 | <!-- 列表 --> |
88 | <select id="datalistPage" parameterType="page" resultType="pd"> | 98 | <select id="datalistPage" parameterType="page" resultType="pd"> |
89 | select | 99 | select |
src/com/fh/Main.java
@@ -9,29 +9,25 @@ public class Main { | @@ -9,29 +9,25 @@ public class Main { | ||
9 | 9 | ||
10 | public static void main(String[] args) { | 10 | public static void main(String[] args) { |
11 | 11 | ||
12 | - String username = "pressure_test" ; | ||
13 | - String password = "123456" ; | ||
14 | - String trueName = "" ; | ||
15 | - | ||
16 | - String url = "http://127.0.0.1:8080/SunvoteEducation/api/v1/tempcreateUser" ; | ||
17 | - for(int i = 2 ; i <= 100 ; i++){ | ||
18 | - trueName = username + i ; | ||
19 | - String keypadid = "0000" ; | ||
20 | - if(i >= 100){ | ||
21 | - keypadid = keypadid + i ; | ||
22 | - }else if(i > 9){ | ||
23 | - keypadid = keypadid + "0" + i ; | ||
24 | - }else{ | ||
25 | - keypadid = keypadid + "00" + i ; | ||
26 | - } | ||
27 | - post(url + "?ACCOUT=" + trueName + "&password=" + password + "&SCHOOL_ID=4" + "&SEX=1" + "&NAME=" + trueName + "&KEYPAD_ID=" + keypadid); | ||
28 | - } | 12 | + report(); |
29 | 13 | ||
30 | } | 14 | } |
15 | + | ||
16 | + | ||
17 | + static void report(){ | ||
18 | + String url = "http://192.168.0.3:8668/sunvoteAPI/report/getReport?" ; | ||
19 | +// String reportId = "62e7c27f-7f21-4e3c-8f86-5d9ba04cf4d6" ; | ||
20 | + String reportId = "5a002abf-9d96-4307-9c35-3dd4230d2f0a" ; | ||
21 | + url = url + "reportId="+reportId; | ||
22 | + String message = post(url); | ||
23 | + System.out.println(message); | ||
24 | + } | ||
31 | 25 | ||
32 | 26 | ||
33 | 27 | ||
34 | - static void post(String url){ | 28 | + |
29 | + | ||
30 | + static String post(String url){ | ||
35 | try { | 31 | try { |
36 | //请求地址 | 32 | //请求地址 |
37 | URL urlHttp = new URL(url); | 33 | URL urlHttp = new URL(url); |
@@ -72,10 +68,34 @@ public class Main { | @@ -72,10 +68,34 @@ public class Main { | ||
72 | } | 68 | } |
73 | bf.close(); // 重要且易忽略步骤 (关闭流,切记!) | 69 | bf.close(); // 重要且易忽略步骤 (关闭流,切记!) |
74 | connection.disconnect(); // 销毁连接 | 70 | connection.disconnect(); // 销毁连接 |
71 | + return sb.toString(); | ||
75 | 72 | ||
76 | 73 | ||
77 | } catch (Exception e) { | 74 | } catch (Exception e) { |
78 | e.printStackTrace(); | 75 | e.printStackTrace(); |
79 | } | 76 | } |
77 | + return null; | ||
78 | + | ||
79 | + } | ||
80 | + | ||
81 | + | ||
82 | + static void createUser(){ | ||
83 | + String username = "pressure_test" ; | ||
84 | + String password = "123456" ; | ||
85 | + String trueName = "" ; | ||
86 | + | ||
87 | + String url = "http://127.0.0.1:8080/SunvoteEducation/api/v1/tempcreateUser" ; | ||
88 | + for(int i = 2 ; i <= 100 ; i++){ | ||
89 | + trueName = username + i ; | ||
90 | + String keypadid = "0000" ; | ||
91 | + if(i >= 100){ | ||
92 | + keypadid = keypadid + i ; | ||
93 | + }else if(i > 9){ | ||
94 | + keypadid = keypadid + "0" + i ; | ||
95 | + }else{ | ||
96 | + keypadid = keypadid + "00" + i ; | ||
97 | + } | ||
98 | + post(url + "?ACCOUT=" + trueName + "&password=" + password + "&SCHOOL_ID=4" + "&SEX=1" + "&NAME=" + trueName + "&KEYPAD_ID=" + keypadid); | ||
99 | + } | ||
80 | } | 100 | } |
81 | } | 101 | } |
src/com/fh/controller/api/V1.java
1 | package com.fh.controller.api; | 1 | package com.fh.controller.api; |
2 | 2 | ||
3 | import java.io.File; | 3 | import java.io.File; |
4 | +import java.sql.Connection; | ||
5 | +import java.sql.ResultSet; | ||
6 | +import java.sql.Statement; | ||
4 | import java.util.ArrayList; | 7 | import java.util.ArrayList; |
5 | import java.util.Collections; | 8 | import java.util.Collections; |
6 | import java.util.Comparator; | 9 | import java.util.Comparator; |
@@ -65,6 +68,7 @@ import com.fh.service.sunvote.testpaper.TestPaperManager; | @@ -65,6 +68,7 @@ import com.fh.service.sunvote.testpaper.TestPaperManager; | ||
65 | import com.fh.service.sunvote.testpaperinfo.TestPaperInfoManager; | 68 | import com.fh.service.sunvote.testpaperinfo.TestPaperInfoManager; |
66 | import com.fh.service.sunvote.textbook.TextbookManager; | 69 | import com.fh.service.sunvote.textbook.TextbookManager; |
67 | import com.fh.service.system.user.UserManager; | 70 | import com.fh.service.system.user.UserManager; |
71 | +import com.fh.util.DbFH; | ||
68 | import com.fh.util.PageData; | 72 | import com.fh.util.PageData; |
69 | import com.fh.util.Tools; | 73 | import com.fh.util.Tools; |
70 | 74 | ||
@@ -88,7 +92,7 @@ public class V1 extends BaseController { | @@ -88,7 +92,7 @@ public class V1 extends BaseController { | ||
88 | private ClassRosterManager classrosterService; | 92 | private ClassRosterManager classrosterService; |
89 | 93 | ||
90 | @Resource(name = "classtypeService") | 94 | @Resource(name = "classtypeService") |
91 | - private ClassTypeManager classtypeService; | 95 | + private ClassTypeManager classtypeService; |
92 | 96 | ||
93 | @Resource(name = "gradeService") | 97 | @Resource(name = "gradeService") |
94 | private GradeManager gradeService; | 98 | private GradeManager gradeService; |
@@ -176,7 +180,7 @@ public class V1 extends BaseController { | @@ -176,7 +180,7 @@ public class V1 extends BaseController { | ||
176 | 180 | ||
177 | @Resource(name = "teachingmaterialService") | 181 | @Resource(name = "teachingmaterialService") |
178 | private TeachingMaterialManager teachingmaterialService; | 182 | private TeachingMaterialManager teachingmaterialService; |
179 | - | 183 | + |
180 | @Resource(name = "textbookService") | 184 | @Resource(name = "textbookService") |
181 | private TextbookManager textbookService; | 185 | private TextbookManager textbookService; |
182 | 186 | ||
@@ -184,9 +188,8 @@ public class V1 extends BaseController { | @@ -184,9 +188,8 @@ public class V1 extends BaseController { | ||
184 | private CacheManager cacheService; | 188 | private CacheManager cacheService; |
185 | 189 | ||
186 | /** | 190 | /** |
187 | - * 登录 | ||
188 | - * 可以通过账号密码登录、 | ||
189 | - * 可以通过教师卡登录 | 191 | + * 登录 可以通过账号密码登录、 可以通过教师卡登录 |
192 | + * | ||
190 | * @return | 193 | * @return |
191 | * @throws Exception | 194 | * @throws Exception |
192 | */ | 195 | */ |
@@ -245,11 +248,10 @@ public class V1 extends BaseController { | @@ -245,11 +248,10 @@ public class V1 extends BaseController { | ||
245 | 248 | ||
246 | return res.toJson(); | 249 | return res.toJson(); |
247 | } | 250 | } |
248 | - | 251 | + |
249 | /** | 252 | /** |
250 | - * 登录 | ||
251 | - * 可以通过账号密码登录、 | ||
252 | - * 可以通过教师卡登录 | 253 | + * 登录 可以通过账号密码登录、 可以通过教师卡登录 |
254 | + * | ||
253 | * @return | 255 | * @return |
254 | * @throws Exception | 256 | * @throws Exception |
255 | */ | 257 | */ |
@@ -265,18 +267,16 @@ public class V1 extends BaseController { | @@ -265,18 +267,16 @@ public class V1 extends BaseController { | ||
265 | PageData pt = new PageData(); | 267 | PageData pt = new PageData(); |
266 | pt.put("TEACHER_ID", pageData.get("ID")); | 268 | pt.put("TEACHER_ID", pageData.get("ID")); |
267 | // 在任课表中查找老师教哪些班级,然后查出班级信息 | 269 | // 在任课表中查找老师教哪些班级,然后查出班级信息 |
268 | - List<PageData> classInfoList = v1Service | ||
269 | - .getTeacherClassInfo(pt); | ||
270 | - | 270 | + List<PageData> classInfoList = v1Service.getTeacherClassInfo(pt); |
271 | + | ||
271 | pageData.put("classInfoList", classInfoList); | 272 | pageData.put("classInfoList", classInfoList); |
272 | // 在认可表中查找老师教哪些科目,然后查出科目信息 | 273 | // 在认可表中查找老师教哪些科目,然后查出科目信息 |
273 | - List<PageData> subjectList = v1Service | ||
274 | - .getTeacherSubjectInfo(pt); | 274 | + List<PageData> subjectList = v1Service.getTeacherSubjectInfo(pt); |
275 | // 一个sql语句完成。 | 275 | // 一个sql语句完成。 |
276 | pageData.put("subjectList", subjectList); | 276 | pageData.put("subjectList", subjectList); |
277 | - | 277 | + |
278 | pageData.remove("SUBJECT_IDS"); | 278 | pageData.remove("SUBJECT_IDS"); |
279 | - | 279 | + |
280 | PageData eventPd = new PageData(); | 280 | PageData eventPd = new PageData(); |
281 | eventPd.put("EVENT_ID", get32UUID()); | 281 | eventPd.put("EVENT_ID", get32UUID()); |
282 | eventPd.put("EVENT_NAME", "login"); | 282 | eventPd.put("EVENT_NAME", "login"); |
@@ -290,19 +290,19 @@ public class V1 extends BaseController { | @@ -290,19 +290,19 @@ public class V1 extends BaseController { | ||
290 | } | 290 | } |
291 | eventPd.put("EVENT_IP", getRemoteIp()); | 291 | eventPd.put("EVENT_IP", getRemoteIp()); |
292 | eventService.save(eventPd); | 292 | eventService.save(eventPd); |
293 | - | 293 | + |
294 | res.setData(pageData); | 294 | res.setData(pageData); |
295 | // 填充数据到返回数据中 | 295 | // 填充数据到返回数据中 |
296 | } else { | 296 | } else { |
297 | res.set1Error(); | 297 | res.set1Error(); |
298 | } | 298 | } |
299 | - | 299 | + |
300 | return res.toJson(); | 300 | return res.toJson(); |
301 | } | 301 | } |
302 | 302 | ||
303 | /** | 303 | /** |
304 | - * 查询班级 | ||
305 | - * 班级及班级学生详细信息 | 304 | + * 查询班级 班级及班级学生详细信息 |
305 | + * | ||
306 | * @return | 306 | * @return |
307 | * @throws Exception | 307 | * @throws Exception |
308 | */ | 308 | */ |
@@ -343,6 +343,7 @@ public class V1 extends BaseController { | @@ -343,6 +343,7 @@ public class V1 extends BaseController { | ||
343 | 343 | ||
344 | /** | 344 | /** |
345 | * 问题类型 | 345 | * 问题类型 |
346 | + * | ||
346 | * @return | 347 | * @return |
347 | * @throws Exception | 348 | * @throws Exception |
348 | */ | 349 | */ |
@@ -362,6 +363,7 @@ public class V1 extends BaseController { | @@ -362,6 +363,7 @@ public class V1 extends BaseController { | ||
362 | 363 | ||
363 | /** | 364 | /** |
364 | * 班级类型 | 365 | * 班级类型 |
366 | + * | ||
365 | * @return | 367 | * @return |
366 | * @throws Exception | 368 | * @throws Exception |
367 | */ | 369 | */ |
@@ -380,8 +382,8 @@ public class V1 extends BaseController { | @@ -380,8 +382,8 @@ public class V1 extends BaseController { | ||
380 | } | 382 | } |
381 | 383 | ||
382 | /** | 384 | /** |
383 | - * 年级 | ||
384 | - * 年级类型 | 385 | + * 年级 年级类型 |
386 | + * | ||
385 | * @return | 387 | * @return |
386 | * @throws Exception | 388 | * @throws Exception |
387 | */ | 389 | */ |
@@ -405,6 +407,7 @@ public class V1 extends BaseController { | @@ -405,6 +407,7 @@ public class V1 extends BaseController { | ||
405 | 407 | ||
406 | /** | 408 | /** |
407 | * 科目 | 409 | * 科目 |
410 | + * | ||
408 | * @return | 411 | * @return |
409 | * @throws Exception | 412 | * @throws Exception |
410 | */ | 413 | */ |
@@ -425,9 +428,10 @@ public class V1 extends BaseController { | @@ -425,9 +428,10 @@ public class V1 extends BaseController { | ||
425 | logger.info("subject cost time : " + (System.currentTimeMillis() - cur)); | 428 | logger.info("subject cost time : " + (System.currentTimeMillis() - cur)); |
426 | return res.toJson(); | 429 | return res.toJson(); |
427 | } | 430 | } |
428 | - | 431 | + |
429 | /** | 432 | /** |
430 | * 科目 | 433 | * 科目 |
434 | + * | ||
431 | * @return | 435 | * @return |
432 | * @throws Exception | 436 | * @throws Exception |
433 | */ | 437 | */ |
@@ -451,6 +455,7 @@ public class V1 extends BaseController { | @@ -451,6 +455,7 @@ public class V1 extends BaseController { | ||
451 | 455 | ||
452 | /** | 456 | /** |
453 | * 键盘扫描 | 457 | * 键盘扫描 |
458 | + * | ||
454 | * @return | 459 | * @return |
455 | * @throws Exception | 460 | * @throws Exception |
456 | */ | 461 | */ |
@@ -492,10 +497,13 @@ public class V1 extends BaseController { | @@ -492,10 +497,13 @@ public class V1 extends BaseController { | ||
492 | if (pd.containsKey("PAPER_TYPE") && pd.containsKey("USER_ID")) { | 497 | if (pd.containsKey("PAPER_TYPE") && pd.containsKey("USER_ID")) { |
493 | String CURRENTPAGE = pd.getString("CURRENTPAGE"); | 498 | String CURRENTPAGE = pd.getString("CURRENTPAGE"); |
494 | String SHOWCOUNT = pd.getString("SHOWCOUNT"); | 499 | String SHOWCOUNT = pd.getString("SHOWCOUNT"); |
495 | - if(CURRENTPAGE != null && SHOWCOUNT != null && !"".equals(CURRENTPAGE.trim()) && !"".equals(SHOWCOUNT.trim())){ | 500 | + if (CURRENTPAGE != null && SHOWCOUNT != null |
501 | + && !"".equals(CURRENTPAGE.trim()) | ||
502 | + && !"".equals(SHOWCOUNT.trim())) { | ||
496 | int currentPage = Integer.parseInt(CURRENTPAGE); | 503 | int currentPage = Integer.parseInt(CURRENTPAGE); |
497 | int showcount = Integer.parseInt(SHOWCOUNT); | 504 | int showcount = Integer.parseInt(SHOWCOUNT); |
498 | - currentPage = (currentPage > 0 ? currentPage -1 : 0) * showcount; | 505 | + currentPage = (currentPage > 0 ? currentPage - 1 : 0) |
506 | + * showcount; | ||
499 | pd.put("CURRENTPAGE", "" + currentPage); | 507 | pd.put("CURRENTPAGE", "" + currentPage); |
500 | } | 508 | } |
501 | List<PageData> pageList = paperService.listAllByType(pd); | 509 | List<PageData> pageList = paperService.listAllByType(pd); |
@@ -509,6 +517,7 @@ public class V1 extends BaseController { | @@ -509,6 +517,7 @@ public class V1 extends BaseController { | ||
509 | 517 | ||
510 | /** | 518 | /** |
511 | * 试卷详细信息 | 519 | * 试卷详细信息 |
520 | + * | ||
512 | * @return | 521 | * @return |
513 | * @throws Exception | 522 | * @throws Exception |
514 | */ | 523 | */ |
@@ -619,109 +628,62 @@ public class V1 extends BaseController { | @@ -619,109 +628,62 @@ public class V1 extends BaseController { | ||
619 | + (System.currentTimeMillis() - cur)); | 628 | + (System.currentTimeMillis() - cur)); |
620 | return res.toJson(); | 629 | return res.toJson(); |
621 | } | 630 | } |
622 | - | ||
623 | -/* *//** | 631 | + |
632 | + /* *//** | ||
624 | * 试卷详细信息 | 633 | * 试卷详细信息 |
634 | + * | ||
625 | * @return | 635 | * @return |
626 | * @throws Exception | 636 | * @throws Exception |
627 | - *//* | ||
628 | - @RequestMapping(value = "/paperinfo", produces = "application/json;charset=UTF-8") | ||
629 | - @ResponseBody | ||
630 | - public Object paperInfo() throws Exception { | ||
631 | - event("paperInfo"); | ||
632 | - long cur = System.currentTimeMillis(); | ||
633 | - PageData pd = this.getPageData(); | ||
634 | - ResponseGson<PageData> res = new ResponseGson<PageData>(); | ||
635 | - if (pd.containsKey("PAPER_ID")) { | ||
636 | - try { | ||
637 | - try { | ||
638 | - PageData ppd = paperService.findById(pd); | ||
639 | - if (ppd != null) { | ||
640 | - List<PageData> questList = v1Service | ||
641 | - .getTestPaperInfo(pd); | ||
642 | - ppd.put("QUESTIONS", questList); | ||
643 | - for (PageData qpd : questList) { | ||
644 | - | ||
645 | - String optionContent = qpd | ||
646 | - .getString("OPTION_CONTENT"); | ||
647 | - if (optionContent != null | ||
648 | - && optionContent.startsWith("[") | ||
649 | - && optionContent.endsWith("]")) { | ||
650 | - String[] options = optionContent.substring(1, | ||
651 | - optionContent.length() - 1).split(","); | ||
652 | - qpd.put("OPTION_CONTENT", options); | ||
653 | - } else { | ||
654 | - qpd.put("OPTION_CONTENT", | ||
655 | - new String[] { optionContent }); | ||
656 | - } | ||
657 | - if ("-1".equals("" + qpd.getString("P_ID"))) { | ||
658 | - PageData pidPd = new PageData(); | ||
659 | - pidPd.put("PID", qpd.getString("QUESTION_ID")); | ||
660 | - List<PageData> qs = v1Service | ||
661 | - .getQuestionsByPID(pidPd); | ||
662 | - for (PageData pcd : qs) { | ||
663 | - String optionContent1 = pcd | ||
664 | - .getString("OPTION_CONTENT"); | ||
665 | - if (optionContent1 != null | ||
666 | - && optionContent1.startsWith("[") | ||
667 | - && optionContent1.endsWith("]")) { | ||
668 | - String[] options = optionContent1 | ||
669 | - .substring( | ||
670 | - 1, | ||
671 | - optionContent1.length() - 1) | ||
672 | - .split(","); | ||
673 | - pcd.put("OPTION_CONTENT", options); | ||
674 | - } else { | ||
675 | - pcd.put("OPTION_CONTENT", | ||
676 | - new String[] { optionContent1 }); | ||
677 | - } | ||
678 | - String[] keys = new String[pcd.keySet().size()]; | ||
679 | - pcd.keySet().toArray(keys); | ||
680 | - Iterator map1it = pcd.entrySet().iterator(); | ||
681 | - for (String key : keys) { | ||
682 | - pcd.put(key.toLowerCase(),pcd.get(key)); | ||
683 | - pcd.remove(key.toUpperCase()); | ||
684 | - } | ||
685 | - } | ||
686 | - qpd.put("QUESTIONS", qs); | ||
687 | - } | ||
688 | - | ||
689 | - String[] keys = new String[qpd.keySet().size()]; | ||
690 | - qpd.keySet().toArray(keys); | ||
691 | - for (String key : keys) { | ||
692 | - qpd.put(key.toLowerCase(), qpd.get(key)); | ||
693 | - qpd.remove(key.toUpperCase()); | ||
694 | - } | ||
695 | - | ||
696 | - } | ||
697 | - String[] keys = new String[ppd.keySet().size()]; | ||
698 | - ppd.keySet().toArray(keys); | ||
699 | - for (String key : keys) { | ||
700 | - ppd.put(key.toLowerCase(), ppd.get(key)); | ||
701 | - ppd.remove(key.toUpperCase()); | ||
702 | - } | ||
703 | - // pd.put("JSON", paper.toJson()); | ||
704 | - res.setData(ppd); | ||
705 | - logger.info(res.toJson()); | ||
706 | - | ||
707 | - } | ||
708 | - } catch (Exception ex) { | ||
709 | - ex.printStackTrace(); | ||
710 | - } | ||
711 | - } catch (Exception ex) { | ||
712 | - ex.printStackTrace(); | ||
713 | - res.setError(); | ||
714 | - } | ||
715 | - } else { | ||
716 | - res.setOtherError(); | ||
717 | - } | ||
718 | - logger.info("paperInfo cost time : " | ||
719 | - + (System.currentTimeMillis() - cur)); | ||
720 | - return res.toJson(); | ||
721 | - } | ||
722 | - | ||
723 | -*/ /** | 637 | + */ |
638 | + /* | ||
639 | + * @RequestMapping(value = "/paperinfo", produces = | ||
640 | + * "application/json;charset=UTF-8") | ||
641 | + * | ||
642 | + * @ResponseBody public Object paperInfo() throws Exception { | ||
643 | + * event("paperInfo"); long cur = System.currentTimeMillis(); PageData pd = | ||
644 | + * this.getPageData(); ResponseGson<PageData> res = new | ||
645 | + * ResponseGson<PageData>(); if (pd.containsKey("PAPER_ID")) { try { try { | ||
646 | + * PageData ppd = paperService.findById(pd); if (ppd != null) { | ||
647 | + * List<PageData> questList = v1Service .getTestPaperInfo(pd); | ||
648 | + * ppd.put("QUESTIONS", questList); for (PageData qpd : questList) { | ||
649 | + * | ||
650 | + * String optionContent = qpd .getString("OPTION_CONTENT"); if | ||
651 | + * (optionContent != null && optionContent.startsWith("[") && | ||
652 | + * optionContent.endsWith("]")) { String[] options = | ||
653 | + * optionContent.substring(1, optionContent.length() - 1).split(","); | ||
654 | + * qpd.put("OPTION_CONTENT", options); } else { qpd.put("OPTION_CONTENT", | ||
655 | + * new String[] { optionContent }); } if ("-1".equals("" + | ||
656 | + * qpd.getString("P_ID"))) { PageData pidPd = new PageData(); | ||
657 | + * pidPd.put("PID", qpd.getString("QUESTION_ID")); List<PageData> qs = | ||
658 | + * v1Service .getQuestionsByPID(pidPd); for (PageData pcd : qs) { String | ||
659 | + * optionContent1 = pcd .getString("OPTION_CONTENT"); if (optionContent1 != | ||
660 | + * null && optionContent1.startsWith("[") && optionContent1.endsWith("]")) { | ||
661 | + * String[] options = optionContent1 .substring( 1, optionContent1.length() | ||
662 | + * - 1) .split(","); pcd.put("OPTION_CONTENT", options); } else { | ||
663 | + * pcd.put("OPTION_CONTENT", new String[] { optionContent1 }); } String[] | ||
664 | + * keys = new String[pcd.keySet().size()]; pcd.keySet().toArray(keys); | ||
665 | + * Iterator map1it = pcd.entrySet().iterator(); for (String key : keys) { | ||
666 | + * pcd.put(key.toLowerCase(),pcd.get(key)); pcd.remove(key.toUpperCase()); } | ||
667 | + * } qpd.put("QUESTIONS", qs); } | ||
668 | + * | ||
669 | + * String[] keys = new String[qpd.keySet().size()]; | ||
670 | + * qpd.keySet().toArray(keys); for (String key : keys) { | ||
671 | + * qpd.put(key.toLowerCase(), qpd.get(key)); qpd.remove(key.toUpperCase()); | ||
672 | + * } | ||
673 | + * | ||
674 | + * } String[] keys = new String[ppd.keySet().size()]; | ||
675 | + * ppd.keySet().toArray(keys); for (String key : keys) { | ||
676 | + * ppd.put(key.toLowerCase(), ppd.get(key)); ppd.remove(key.toUpperCase()); | ||
677 | + * } // pd.put("JSON", paper.toJson()); res.setData(ppd); | ||
678 | + * logger.info(res.toJson()); | ||
679 | + * | ||
680 | + * } } catch (Exception ex) { ex.printStackTrace(); } } catch (Exception ex) | ||
681 | + * { ex.printStackTrace(); res.setError(); } } else { res.setOtherError(); } | ||
682 | + * logger.info("paperInfo cost time : " + (System.currentTimeMillis() - | ||
683 | + * cur)); return res.toJson(); } | ||
684 | + *//** | ||
724 | * 试卷详细信息 | 685 | * 试卷详细信息 |
686 | + * | ||
725 | * @return | 687 | * @return |
726 | * @throws Exception | 688 | * @throws Exception |
727 | */ | 689 | */ |
@@ -741,7 +703,7 @@ public class V1 extends BaseController { | @@ -741,7 +703,7 @@ public class V1 extends BaseController { | ||
741 | .getTestPaperInfo(pd); | 703 | .getTestPaperInfo(pd); |
742 | ppd.put("QUESTIONS", questList); | 704 | ppd.put("QUESTIONS", questList); |
743 | for (PageData qpd : questList) { | 705 | for (PageData qpd : questList) { |
744 | - | 706 | + |
745 | String optionContent = qpd | 707 | String optionContent = qpd |
746 | .getString("OPTION_CONTENT"); | 708 | .getString("OPTION_CONTENT"); |
747 | if (optionContent != null | 709 | if (optionContent != null |
@@ -769,7 +731,7 @@ public class V1 extends BaseController { | @@ -769,7 +731,7 @@ public class V1 extends BaseController { | ||
769 | .substring( | 731 | .substring( |
770 | 1, | 732 | 1, |
771 | optionContent1.length() - 1) | 733 | optionContent1.length() - 1) |
772 | - .split(","); | 734 | + .split(","); |
773 | pcd.put("OPTION_CONTENT", options); | 735 | pcd.put("OPTION_CONTENT", options); |
774 | } else { | 736 | } else { |
775 | pcd.put("OPTION_CONTENT", | 737 | pcd.put("OPTION_CONTENT", |
@@ -778,13 +740,11 @@ public class V1 extends BaseController { | @@ -778,13 +740,11 @@ public class V1 extends BaseController { | ||
778 | } | 740 | } |
779 | qpd.put("QUESTIONS", qs); | 741 | qpd.put("QUESTIONS", qs); |
780 | } | 742 | } |
781 | - | ||
782 | - | ||
783 | - | 743 | + |
784 | } | 744 | } |
785 | res.setData(ppd); | 745 | res.setData(ppd); |
786 | logger.info(res.toJson()); | 746 | logger.info(res.toJson()); |
787 | - | 747 | + |
788 | } | 748 | } |
789 | } catch (Exception ex) { | 749 | } catch (Exception ex) { |
790 | ex.printStackTrace(); | 750 | ex.printStackTrace(); |
@@ -800,9 +760,10 @@ public class V1 extends BaseController { | @@ -800,9 +760,10 @@ public class V1 extends BaseController { | ||
800 | + (System.currentTimeMillis() - cur)); | 760 | + (System.currentTimeMillis() - cur)); |
801 | return res.toJson(); | 761 | return res.toJson(); |
802 | } | 762 | } |
803 | - | 763 | + |
804 | /** | 764 | /** |
805 | * 试卷详细信息 | 765 | * 试卷详细信息 |
766 | + * | ||
806 | * @return | 767 | * @return |
807 | * @throws Exception | 768 | * @throws Exception |
808 | */ | 769 | */ |
@@ -822,8 +783,9 @@ public class V1 extends BaseController { | @@ -822,8 +783,9 @@ public class V1 extends BaseController { | ||
822 | PageData testInfof = new PageData(); | 783 | PageData testInfof = new PageData(); |
823 | testInfof.put("PAPER_ID", testPd.getString("PAPER_ID")); | 784 | testInfof.put("PAPER_ID", testPd.getString("PAPER_ID")); |
824 | testInfof.put("TEST_ID", paperId); | 785 | testInfof.put("TEST_ID", paperId); |
825 | - List<PageData> list = testpaperinfoService.listTestPaperQuestionIDs(testInfof); | ||
826 | - for(PageData pqd : list){ | 786 | + List<PageData> list = testpaperinfoService |
787 | + .listTestPaperQuestionIDs(testInfof); | ||
788 | + for (PageData pqd : list) { | ||
827 | PageData tpqd = questionService.findById(pqd); | 789 | PageData tpqd = questionService.findById(pqd); |
828 | pqd.putAll(tpqd); | 790 | pqd.putAll(tpqd); |
829 | pqd.remove("P_ID"); | 791 | pqd.remove("P_ID"); |
@@ -839,22 +801,26 @@ public class V1 extends BaseController { | @@ -839,22 +801,26 @@ public class V1 extends BaseController { | ||
839 | pqd.remove("QUESTION_FROM"); | 801 | pqd.remove("QUESTION_FROM"); |
840 | pqd.remove("REMARK"); | 802 | pqd.remove("REMARK"); |
841 | pqd.put("TEST_ID", paperId); | 803 | pqd.put("TEST_ID", paperId); |
842 | - List<PageData> listinfo = testpaperinfoService.listTestPaperQuestionIDinfo(pqd); | 804 | + List<PageData> listinfo = testpaperinfoService |
805 | + .listTestPaperQuestionIDinfo(pqd); | ||
843 | List<PageData> answerInfos = new ArrayList<PageData>(); | 806 | List<PageData> answerInfos = new ArrayList<PageData>(); |
844 | List<String> answerList = new ArrayList<String>(); | 807 | List<String> answerList = new ArrayList<String>(); |
845 | - for(PageData pid : listinfo){ | 808 | + for (PageData pid : listinfo) { |
846 | String answer = pid.getString("ANSWER"); | 809 | String answer = pid.getString("ANSWER"); |
847 | PageData answerPd = null; | 810 | PageData answerPd = null; |
848 | - if(answerInfos.size() > 0){ | ||
849 | - answerPd = answerInfos.get(answerInfos.size() -1); | ||
850 | - if(!answer.equals(answerPd.getString("ANSWER"))){ | 811 | + if (answerInfos.size() > 0) { |
812 | + answerPd = answerInfos | ||
813 | + .get(answerInfos.size() - 1); | ||
814 | + if (!answer | ||
815 | + .equals(answerPd.getString("ANSWER"))) { | ||
851 | answerPd = new PageData(); | 816 | answerPd = new PageData(); |
852 | answerPd.put("ANSWER", answer); | 817 | answerPd.put("ANSWER", answer); |
853 | - answerPd.put("ISRIGHT", pid.getString("RIGHT")); | 818 | + answerPd.put("ISRIGHT", |
819 | + pid.getString("RIGHT")); | ||
854 | answerInfos.add(answerPd); | 820 | answerInfos.add(answerPd); |
855 | answerList.add(answer); | 821 | answerList.add(answer); |
856 | } | 822 | } |
857 | - }else{ | 823 | + } else { |
858 | answerPd = new PageData(); | 824 | answerPd = new PageData(); |
859 | answerPd.put("ANSWER", answer); | 825 | answerPd.put("ANSWER", answer); |
860 | answerPd.put("ISRIGHT", pid.getString("RIGHT")); | 826 | answerPd.put("ISRIGHT", pid.getString("RIGHT")); |
@@ -862,48 +828,59 @@ public class V1 extends BaseController { | @@ -862,48 +828,59 @@ public class V1 extends BaseController { | ||
862 | answerList.add(answer); | 828 | answerList.add(answer); |
863 | } | 829 | } |
864 | String strCount = answerPd.getString("COUNT"); | 830 | String strCount = answerPd.getString("COUNT"); |
865 | - int count = 0 ; | ||
866 | - if(strCount != null){ | ||
867 | - try{ | ||
868 | - count = Integer.parseInt(strCount); | ||
869 | - }catch(NumberFormatException ex){} | 831 | + int count = 0; |
832 | + if (strCount != null) { | ||
833 | + try { | ||
834 | + count = Integer.parseInt(strCount); | ||
835 | + } catch (NumberFormatException ex) { | ||
836 | + } | ||
870 | } | 837 | } |
871 | - count ++ ; | 838 | + count++; |
872 | answerPd.put("COUNT", count); | 839 | answerPd.put("COUNT", count); |
873 | } | 840 | } |
874 | String questionNumStr = pqd.getString("OPTION_NUM"); | 841 | String questionNumStr = pqd.getString("OPTION_NUM"); |
875 | int questionNum = Integer.parseInt(questionNumStr); | 842 | int questionNum = Integer.parseInt(questionNumStr); |
876 | - for(int i = 0 ; i < questionNum ;i++){ | ||
877 | - if((!answerList.contains("" + (char)('A' + i))) && !(answerList.contains("" + (char)('a' + i)))){ | 843 | + for (int i = 0; i < questionNum; i++) { |
844 | + if ((!answerList.contains("" + (char) ('A' + i))) | ||
845 | + && !(answerList.contains("" | ||
846 | + + (char) ('a' + i)))) { | ||
878 | PageData answerPd = new PageData(); | 847 | PageData answerPd = new PageData(); |
879 | - answerPd.put("ANSWER", "" + (char)('A' + i)); | ||
880 | - answerPd.put("ISRIGHT", pqd.get("ANSWER").equals(('A' + i)) ? "1" : "0"); | 848 | + answerPd.put("ANSWER", "" + (char) ('A' + i)); |
849 | + answerPd.put("ISRIGHT", pqd.get("ANSWER") | ||
850 | + .equals(('A' + i)) ? "1" : "0"); | ||
881 | answerPd.put("COUNT", 0); | 851 | answerPd.put("COUNT", 0); |
882 | answerInfos.add(answerPd); | 852 | answerInfos.add(answerPd); |
883 | } | 853 | } |
884 | } | 854 | } |
885 | - Collections.sort(answerInfos, new Comparator<PageData>(){ | 855 | + Collections.sort(answerInfos, |
856 | + new Comparator<PageData>() { | ||
857 | + | ||
858 | + @Override | ||
859 | + public int compare(PageData p1, PageData p2) { | ||
860 | + return p1.getString("ANSWER") | ||
861 | + .compareToIgnoreCase( | ||
862 | + p2.getString("ANSWER")); | ||
863 | + } | ||
886 | 864 | ||
887 | - @Override | ||
888 | - public int compare(PageData p1, PageData p2) { | ||
889 | - return p1.getString("ANSWER").compareToIgnoreCase(p2.getString("ANSWER")); | ||
890 | - } | ||
891 | - | ||
892 | - }); | 865 | + }); |
893 | pqd.put("ANSWERINFO", answerInfos); | 866 | pqd.put("ANSWERINFO", answerInfos); |
894 | pqd.remove("TEST_ID"); | 867 | pqd.remove("TEST_ID"); |
895 | } | 868 | } |
896 | - for(PageData pad:list){ | 869 | + for (PageData pad : list) { |
897 | String optionContent = pad.getString("OPTION_CONTENT"); | 870 | String optionContent = pad.getString("OPTION_CONTENT"); |
898 | - if(optionContent != null && optionContent.startsWith("[") && optionContent.endsWith("]")){ | ||
899 | - String[] options = optionContent.substring(1, optionContent.length() -1).split(","); | 871 | + if (optionContent != null |
872 | + && optionContent.startsWith("[") | ||
873 | + && optionContent.endsWith("]")) { | ||
874 | + String[] options = optionContent.substring(1, | ||
875 | + optionContent.length() - 1).split(","); | ||
900 | pad.put("OPTION_CONTENT", options); | 876 | pad.put("OPTION_CONTENT", options); |
901 | - }else{ | ||
902 | - pad.put("OPTION_CONTENT", new String[]{optionContent}); | 877 | + } else { |
878 | + pad.put("OPTION_CONTENT", | ||
879 | + new String[] { optionContent }); | ||
903 | } | 880 | } |
904 | } | 881 | } |
905 | testPd.put("QUESTIONS", list); | 882 | testPd.put("QUESTIONS", list); |
906 | - | 883 | + |
907 | } | 884 | } |
908 | 885 | ||
909 | res.setData(testPd); | 886 | res.setData(testPd); |
@@ -916,9 +893,10 @@ public class V1 extends BaseController { | @@ -916,9 +893,10 @@ public class V1 extends BaseController { | ||
916 | + (System.currentTimeMillis() - cur)); | 893 | + (System.currentTimeMillis() - cur)); |
917 | return res.toJson(); | 894 | return res.toJson(); |
918 | } | 895 | } |
919 | - | 896 | + |
920 | /** | 897 | /** |
921 | * 试卷详细信息 | 898 | * 试卷详细信息 |
899 | + * | ||
922 | * @return | 900 | * @return |
923 | * @throws Exception | 901 | * @throws Exception |
924 | */ | 902 | */ |
@@ -993,10 +971,10 @@ public class V1 extends BaseController { | @@ -993,10 +971,10 @@ public class V1 extends BaseController { | ||
993 | } | 971 | } |
994 | pqd.put("ANSWERINFO", answerInfos); | 972 | pqd.put("ANSWERINFO", answerInfos); |
995 | res.setData(pqd); | 973 | res.setData(pqd); |
996 | - }else{ | 974 | + } else { |
997 | res.setDataError(); | 975 | res.setDataError(); |
998 | } | 976 | } |
999 | - }else{ | 977 | + } else { |
1000 | res.setDataError(); | 978 | res.setDataError(); |
1001 | } | 979 | } |
1002 | logger.info("questionInTestReportInfo cost time:" | 980 | logger.info("questionInTestReportInfo cost time:" |
@@ -1006,6 +984,7 @@ public class V1 extends BaseController { | @@ -1006,6 +984,7 @@ public class V1 extends BaseController { | ||
1006 | 984 | ||
1007 | /** | 985 | /** |
1008 | * 试卷简要信息 | 986 | * 试卷简要信息 |
987 | + * | ||
1009 | * @return | 988 | * @return |
1010 | * @throws Exception | 989 | * @throws Exception |
1011 | */ | 990 | */ |
@@ -1075,9 +1054,9 @@ public class V1 extends BaseController { | @@ -1075,9 +1054,9 @@ public class V1 extends BaseController { | ||
1075 | return res.toBrifJson(); | 1054 | return res.toBrifJson(); |
1076 | } | 1055 | } |
1077 | 1056 | ||
1078 | - | ||
1079 | /** | 1057 | /** |
1080 | * 试卷问题 | 1058 | * 试卷问题 |
1059 | + * | ||
1081 | * @return | 1060 | * @return |
1082 | * @throws Exception | 1061 | * @throws Exception |
1083 | */ | 1062 | */ |
@@ -1095,6 +1074,7 @@ public class V1 extends BaseController { | @@ -1095,6 +1074,7 @@ public class V1 extends BaseController { | ||
1095 | 1074 | ||
1096 | /** | 1075 | /** |
1097 | * 问题 | 1076 | * 问题 |
1077 | + * | ||
1098 | * @return | 1078 | * @return |
1099 | * @throws Exception | 1079 | * @throws Exception |
1100 | */ | 1080 | */ |
@@ -1113,11 +1093,13 @@ public class V1 extends BaseController { | @@ -1113,11 +1093,13 @@ public class V1 extends BaseController { | ||
1113 | pd.put("QUESTION_ID", i); | 1093 | pd.put("QUESTION_ID", i); |
1114 | PageData data = questionService.findById(pd); | 1094 | PageData data = questionService.findById(pd); |
1115 | String optionContent = data.getString("OPTION_CONTENT"); | 1095 | String optionContent = data.getString("OPTION_CONTENT"); |
1116 | - if(optionContent != null && optionContent.startsWith("[") && optionContent.endsWith("]")){ | ||
1117 | - String[] options = optionContent.substring(1, optionContent.length() -1).split(","); | 1096 | + if (optionContent != null && optionContent.startsWith("[") |
1097 | + && optionContent.endsWith("]")) { | ||
1098 | + String[] options = optionContent.substring(1, | ||
1099 | + optionContent.length() - 1).split(","); | ||
1118 | data.put("OPTION_CONTENT", options); | 1100 | data.put("OPTION_CONTENT", options); |
1119 | - }else{ | ||
1120 | - data.put("OPTION_CONTENT", new String[]{optionContent}); | 1101 | + } else { |
1102 | + data.put("OPTION_CONTENT", new String[] { optionContent }); | ||
1121 | } | 1103 | } |
1122 | if (data != null) { | 1104 | if (data != null) { |
1123 | list.add(data); | 1105 | list.add(data); |
@@ -1134,6 +1116,7 @@ public class V1 extends BaseController { | @@ -1134,6 +1116,7 @@ public class V1 extends BaseController { | ||
1134 | 1116 | ||
1135 | /** | 1117 | /** |
1136 | * 查询知识点名称 | 1118 | * 查询知识点名称 |
1119 | + * | ||
1137 | * @return | 1120 | * @return |
1138 | * @throws Exception | 1121 | * @throws Exception |
1139 | */ | 1122 | */ |
@@ -1165,6 +1148,7 @@ public class V1 extends BaseController { | @@ -1165,6 +1148,7 @@ public class V1 extends BaseController { | ||
1165 | 1148 | ||
1166 | /** | 1149 | /** |
1167 | * 章节名称 | 1150 | * 章节名称 |
1151 | + * | ||
1168 | * @return | 1152 | * @return |
1169 | * @throws Exception | 1153 | * @throws Exception |
1170 | */ | 1154 | */ |
@@ -1196,6 +1180,7 @@ public class V1 extends BaseController { | @@ -1196,6 +1180,7 @@ public class V1 extends BaseController { | ||
1196 | 1180 | ||
1197 | /** | 1181 | /** |
1198 | * 试题添加 | 1182 | * 试题添加 |
1183 | + * | ||
1199 | * @return | 1184 | * @return |
1200 | * @throws Exception | 1185 | * @throws Exception |
1201 | */ | 1186 | */ |
@@ -1215,6 +1200,7 @@ public class V1 extends BaseController { | @@ -1215,6 +1200,7 @@ public class V1 extends BaseController { | ||
1215 | 1200 | ||
1216 | /*** | 1201 | /*** |
1217 | * 上传试卷 | 1202 | * 上传试卷 |
1203 | + * | ||
1218 | * @return | 1204 | * @return |
1219 | * @throws Exception | 1205 | * @throws Exception |
1220 | */ | 1206 | */ |
@@ -1352,6 +1338,7 @@ public class V1 extends BaseController { | @@ -1352,6 +1338,7 @@ public class V1 extends BaseController { | ||
1352 | 1338 | ||
1353 | /** | 1339 | /** |
1354 | * 上传试卷,不上传试题详细信息。试题从已有数据库中组卷 | 1340 | * 上传试卷,不上传试题详细信息。试题从已有数据库中组卷 |
1341 | + * | ||
1355 | * @return | 1342 | * @return |
1356 | * @throws Exception | 1343 | * @throws Exception |
1357 | */ | 1344 | */ |
@@ -1415,6 +1402,7 @@ public class V1 extends BaseController { | @@ -1415,6 +1402,7 @@ public class V1 extends BaseController { | ||
1415 | 1402 | ||
1416 | /** | 1403 | /** |
1417 | * 上传知识点 | 1404 | * 上传知识点 |
1405 | + * | ||
1418 | * @return | 1406 | * @return |
1419 | * @throws Exception | 1407 | * @throws Exception |
1420 | */ | 1408 | */ |
@@ -1448,7 +1436,8 @@ public class V1 extends BaseController { | @@ -1448,7 +1436,8 @@ public class V1 extends BaseController { | ||
1448 | } | 1436 | } |
1449 | 1437 | ||
1450 | /** | 1438 | /** |
1451 | - * 上传测验成绩 | 1439 | + * 上传测验成绩 |
1440 | + * | ||
1452 | * @return | 1441 | * @return |
1453 | */ | 1442 | */ |
1454 | @RequestMapping(value = "/uploadtestpaper", produces = "application/json;charset=UTF-8") | 1443 | @RequestMapping(value = "/uploadtestpaper", produces = "application/json;charset=UTF-8") |
@@ -1472,7 +1461,10 @@ public class V1 extends BaseController { | @@ -1472,7 +1461,10 @@ public class V1 extends BaseController { | ||
1472 | testPaper.getCreateDate() == null ? Tools | 1461 | testPaper.getCreateDate() == null ? Tools |
1473 | .date2Str(new Date()) : testPaper | 1462 | .date2Str(new Date()) : testPaper |
1474 | .getCreateDate()); | 1463 | .getCreateDate()); |
1475 | - testPd.put("TEST_TYPE", testPaper.getTest_type() != null ? testPaper.getTest_type() :"1"); | 1464 | + testPd.put( |
1465 | + "TEST_TYPE", | ||
1466 | + testPaper.getTest_type() != null ? testPaper | ||
1467 | + .getTest_type() : "1"); | ||
1476 | List<PageData> listData = testpaperService.listAll(testPd); | 1468 | List<PageData> listData = testpaperService.listAll(testPd); |
1477 | if (!(listData != null && listData.size() > 0)) { | 1469 | if (!(listData != null && listData.size() > 0)) { |
1478 | testPd.put("START_DATE", testPaper.getStartDate()); | 1470 | testPd.put("START_DATE", testPaper.getStartDate()); |
@@ -1564,10 +1556,11 @@ public class V1 extends BaseController { | @@ -1564,10 +1556,11 @@ public class V1 extends BaseController { | ||
1564 | 1556 | ||
1565 | return res.toJson(); | 1557 | return res.toJson(); |
1566 | 1558 | ||
1567 | - } | 1559 | + } |
1568 | 1560 | ||
1569 | /** | 1561 | /** |
1570 | - * 上传测验成绩 | 1562 | + * 上传测验成绩 |
1563 | + * | ||
1571 | * @return | 1564 | * @return |
1572 | */ | 1565 | */ |
1573 | @RequestMapping(value = "/uploadupdatetestpaper", produces = "application/json;charset=UTF-8") | 1566 | @RequestMapping(value = "/uploadupdatetestpaper", produces = "application/json;charset=UTF-8") |
@@ -1591,7 +1584,10 @@ public class V1 extends BaseController { | @@ -1591,7 +1584,10 @@ public class V1 extends BaseController { | ||
1591 | testPaper.getCreateDate() == null ? Tools | 1584 | testPaper.getCreateDate() == null ? Tools |
1592 | .date2Str(new Date()) : testPaper | 1585 | .date2Str(new Date()) : testPaper |
1593 | .getCreateDate()); | 1586 | .getCreateDate()); |
1594 | - testPd.put("TEST_TYPE", testPaper.getTest_type() != null ? testPaper.getTest_type() :"1"); | 1587 | + testPd.put( |
1588 | + "TEST_TYPE", | ||
1589 | + testPaper.getTest_type() != null ? testPaper | ||
1590 | + .getTest_type() : "1"); | ||
1595 | List<PageData> listData = testpaperService.listAll(testPd); | 1591 | List<PageData> listData = testpaperService.listAll(testPd); |
1596 | if ((listData != null && listData.size() > 0)) { | 1592 | if ((listData != null && listData.size() > 0)) { |
1597 | testPaperId = listData.get(0).getString("TESTPAPER_ID"); | 1593 | testPaperId = listData.get(0).getString("TESTPAPER_ID"); |
@@ -1682,9 +1678,10 @@ public class V1 extends BaseController { | @@ -1682,9 +1678,10 @@ public class V1 extends BaseController { | ||
1682 | return res.toJson(); | 1678 | return res.toJson(); |
1683 | 1679 | ||
1684 | } | 1680 | } |
1685 | - | 1681 | + |
1686 | /** | 1682 | /** |
1687 | - * 上传测验成绩 | 1683 | + * 上传测验成绩 |
1684 | + * | ||
1688 | * @return | 1685 | * @return |
1689 | */ | 1686 | */ |
1690 | @RequestMapping(value = "/uploadupdatetestpaper2", produces = "application/json;charset=UTF-8") | 1687 | @RequestMapping(value = "/uploadupdatetestpaper2", produces = "application/json;charset=UTF-8") |
@@ -1716,7 +1713,10 @@ public class V1 extends BaseController { | @@ -1716,7 +1713,10 @@ public class V1 extends BaseController { | ||
1716 | testpaperinfoService.delete(testPd); | 1713 | testpaperinfoService.delete(testPd); |
1717 | studenttestService.delete(testPd); | 1714 | studenttestService.delete(testPd); |
1718 | } | 1715 | } |
1719 | - testPd.put("TEST_TYPE", testPaper.getTest_type() != null ? testPaper.getTest_type() :"101"); | 1716 | + testPd.put( |
1717 | + "TEST_TYPE", | ||
1718 | + testPaper.getTest_type() != null ? testPaper | ||
1719 | + .getTest_type() : "101"); | ||
1720 | testPd.put("START_DATE", testPaper.getStartDate()); | 1720 | testPd.put("START_DATE", testPaper.getStartDate()); |
1721 | testPd.put("END_DATE", testPaper.getEndDate()); | 1721 | testPd.put("END_DATE", testPaper.getEndDate()); |
1722 | testPd.put("NAME", testPaper.getName()); | 1722 | testPd.put("NAME", testPaper.getName()); |
@@ -1745,7 +1745,7 @@ public class V1 extends BaseController { | @@ -1745,7 +1745,7 @@ public class V1 extends BaseController { | ||
1745 | testPaper.getClassId()); | 1745 | testPaper.getClassId()); |
1746 | studentPageData.put("STUDENTTEST_ID", get32UUID()); | 1746 | studentPageData.put("STUDENTTEST_ID", get32UUID()); |
1747 | studenttestService.save(studentPageData); | 1747 | studenttestService.save(studentPageData); |
1748 | - | 1748 | + |
1749 | for (TestPaperInfo testPaperInfo : studentAnswer | 1749 | for (TestPaperInfo testPaperInfo : studentAnswer |
1750 | .getQuestions()) { | 1750 | .getQuestions()) { |
1751 | testInfoPd = new PageData(); | 1751 | testInfoPd = new PageData(); |
@@ -1768,7 +1768,7 @@ public class V1 extends BaseController { | @@ -1768,7 +1768,7 @@ public class V1 extends BaseController { | ||
1768 | testPaperInfo.getLikes()); | 1768 | testPaperInfo.getLikes()); |
1769 | testInfoPd.put("ANSWER_TYPE", testPaperInfo | 1769 | testInfoPd.put("ANSWER_TYPE", testPaperInfo |
1770 | .getAnswerType() == null ? "1" | 1770 | .getAnswerType() == null ? "1" |
1771 | - : testPaperInfo.getAnswerType()); | 1771 | + : testPaperInfo.getAnswerType()); |
1772 | testInfoPd.put("PRESS_TIME", | 1772 | testInfoPd.put("PRESS_TIME", |
1773 | testPaperInfo.getPressTime()); | 1773 | testPaperInfo.getPressTime()); |
1774 | testInfoPd.put("RECEIVER_DATE", | 1774 | testInfoPd.put("RECEIVER_DATE", |
@@ -1778,7 +1778,8 @@ public class V1 extends BaseController { | @@ -1778,7 +1778,8 @@ public class V1 extends BaseController { | ||
1778 | testInfoPd.put("NOTE", testPaperInfo.getNote()); | 1778 | testInfoPd.put("NOTE", testPaperInfo.getNote()); |
1779 | testInfoPd.put("MARK_NO", | 1779 | testInfoPd.put("MARK_NO", |
1780 | testPaperInfo.getMarkNo()); | 1780 | testPaperInfo.getMarkNo()); |
1781 | - testInfoPd.put("RANDOM", testPaperInfo.getRandom()); | 1781 | + testInfoPd.put("RANDOM", |
1782 | + testPaperInfo.getRandom()); | ||
1782 | testInfoPd.put("RANK", testPaperInfo.getRank()); | 1783 | testInfoPd.put("RANK", testPaperInfo.getRank()); |
1783 | testInfoPdList.add(testInfoPd); | 1784 | testInfoPdList.add(testInfoPd); |
1784 | } | 1785 | } |
@@ -1797,13 +1798,14 @@ public class V1 extends BaseController { | @@ -1797,13 +1798,14 @@ public class V1 extends BaseController { | ||
1797 | } | 1798 | } |
1798 | logger.info("uploadupdateTestpaper2 cost time:" | 1799 | logger.info("uploadupdateTestpaper2 cost time:" |
1799 | + (System.currentTimeMillis() - cur)); | 1800 | + (System.currentTimeMillis() - cur)); |
1800 | - | 1801 | + |
1801 | return res.toJson(); | 1802 | return res.toJson(); |
1802 | - | 1803 | + |
1803 | } | 1804 | } |
1804 | 1805 | ||
1805 | /** | 1806 | /** |
1806 | * 查询知识点 | 1807 | * 查询知识点 |
1808 | + * | ||
1807 | * @return | 1809 | * @return |
1808 | * @throws Exception | 1810 | * @throws Exception |
1809 | */ | 1811 | */ |
@@ -1844,9 +1846,13 @@ public class V1 extends BaseController { | @@ -1844,9 +1846,13 @@ public class V1 extends BaseController { | ||
1844 | 1846 | ||
1845 | /** | 1847 | /** |
1846 | * 知识点递归查询 | 1848 | * 知识点递归查询 |
1847 | - * @param list 查询知识点及子知识点 | ||
1848 | - * @param dept 深度 | ||
1849 | - * @param end 层深 | 1849 | + * |
1850 | + * @param list | ||
1851 | + * 查询知识点及子知识点 | ||
1852 | + * @param dept | ||
1853 | + * 深度 | ||
1854 | + * @param end | ||
1855 | + * 层深 | ||
1850 | * @throws Exception | 1856 | * @throws Exception |
1851 | */ | 1857 | */ |
1852 | private void roundPointData(List<PageData> list, int dept, int end) | 1858 | private void roundPointData(List<PageData> list, int dept, int end) |
@@ -1869,9 +1875,13 @@ public class V1 extends BaseController { | @@ -1869,9 +1875,13 @@ public class V1 extends BaseController { | ||
1869 | 1875 | ||
1870 | /** | 1876 | /** |
1871 | * 章节递归查询 | 1877 | * 章节递归查询 |
1872 | - * @param list 章节 | ||
1873 | - * @param dept 深度 | ||
1874 | - * @param end 递归深度 | 1878 | + * |
1879 | + * @param list | ||
1880 | + * 章节 | ||
1881 | + * @param dept | ||
1882 | + * 深度 | ||
1883 | + * @param end | ||
1884 | + * 递归深度 | ||
1875 | * @throws Exception | 1885 | * @throws Exception |
1876 | */ | 1886 | */ |
1877 | private void roundChapterData(List<PageData> list, int dept, int end) | 1887 | private void roundChapterData(List<PageData> list, int dept, int end) |
@@ -1896,7 +1906,8 @@ public class V1 extends BaseController { | @@ -1896,7 +1906,8 @@ public class V1 extends BaseController { | ||
1896 | } | 1906 | } |
1897 | 1907 | ||
1898 | /** | 1908 | /** |
1899 | - * 下载测验成绩 | 1909 | + * 下载测验成绩 |
1910 | + * | ||
1900 | * @return | 1911 | * @return |
1901 | */ | 1912 | */ |
1902 | @RequestMapping(value = "/downloadtestpaper", produces = "application/json;charset=UTF-8") | 1913 | @RequestMapping(value = "/downloadtestpaper", produces = "application/json;charset=UTF-8") |
@@ -1987,7 +1998,8 @@ public class V1 extends BaseController { | @@ -1987,7 +1998,8 @@ public class V1 extends BaseController { | ||
1987 | 1998 | ||
1988 | /** | 1999 | /** |
1989 | * | 2000 | * |
1990 | - * 下载测验成绩 | 2001 | + * 下载测验成绩 |
2002 | + * | ||
1991 | * @return | 2003 | * @return |
1992 | */ | 2004 | */ |
1993 | @RequestMapping(value = "/testpaper", produces = "application/json;charset=UTF-8") | 2005 | @RequestMapping(value = "/testpaper", produces = "application/json;charset=UTF-8") |
@@ -2042,9 +2054,9 @@ public class V1 extends BaseController { | @@ -2042,9 +2054,9 @@ public class V1 extends BaseController { | ||
2042 | this.getUserID(); | 2054 | this.getUserID(); |
2043 | } | 2055 | } |
2044 | 2056 | ||
2045 | - | ||
2046 | /*** | 2057 | /*** |
2047 | * 网络 | 2058 | * 网络 |
2059 | + * | ||
2048 | * @return | 2060 | * @return |
2049 | * @throws Exception | 2061 | * @throws Exception |
2050 | */ | 2062 | */ |
@@ -2098,6 +2110,7 @@ public class V1 extends BaseController { | @@ -2098,6 +2110,7 @@ public class V1 extends BaseController { | ||
2098 | 2110 | ||
2099 | /** | 2111 | /** |
2100 | * 获取远端ip地址 | 2112 | * 获取远端ip地址 |
2113 | + * | ||
2101 | * @return | 2114 | * @return |
2102 | */ | 2115 | */ |
2103 | public String getRemoteIp() { | 2116 | public String getRemoteIp() { |
@@ -2113,6 +2126,7 @@ public class V1 extends BaseController { | @@ -2113,6 +2126,7 @@ public class V1 extends BaseController { | ||
2113 | 2126 | ||
2114 | /** | 2127 | /** |
2115 | * 查询新版本信息 | 2128 | * 查询新版本信息 |
2129 | + * | ||
2116 | * @param request | 2130 | * @param request |
2117 | * @return | 2131 | * @return |
2118 | * @throws Exception | 2132 | * @throws Exception |
@@ -2187,7 +2201,7 @@ public class V1 extends BaseController { | @@ -2187,7 +2201,7 @@ public class V1 extends BaseController { | ||
2187 | ret.setData(lpd); | 2201 | ret.setData(lpd); |
2188 | return ret.toJson(); | 2202 | return ret.toJson(); |
2189 | } | 2203 | } |
2190 | - | 2204 | + |
2191 | @RequestMapping(value = "/textbook", produces = "application/json;charset=UTF-8") | 2205 | @RequestMapping(value = "/textbook", produces = "application/json;charset=UTF-8") |
2192 | @ResponseBody | 2206 | @ResponseBody |
2193 | public Object textbook() throws Exception { | 2207 | public Object textbook() throws Exception { |
@@ -2277,29 +2291,32 @@ public class V1 extends BaseController { | @@ -2277,29 +2291,32 @@ public class V1 extends BaseController { | ||
2277 | pd.put("KNOWLEDGE_IDS", ids); | 2291 | pd.put("KNOWLEDGE_IDS", ids); |
2278 | pd.remove("KNOWLEDGE_ID"); | 2292 | pd.remove("KNOWLEDGE_ID"); |
2279 | } | 2293 | } |
2280 | - int pageNumI = 0 ; | ||
2281 | - int count = 30 ; | 2294 | + int pageNumI = 0; |
2295 | + int count = 30; | ||
2282 | String pageNum = pd.getString("PAGENUM"); | 2296 | String pageNum = pd.getString("PAGENUM"); |
2283 | String countStr = pd.getString("COUNT"); | 2297 | String countStr = pd.getString("COUNT"); |
2284 | - if(pageNum != null && !"".equals(pageNum) && countStr != null && !"".equals(countStr)){ | 2298 | + if (pageNum != null && !"".equals(pageNum) && countStr != null |
2299 | + && !"".equals(countStr)) { | ||
2285 | pageNumI = Integer.parseInt(pageNum); | 2300 | pageNumI = Integer.parseInt(pageNum); |
2286 | count = Integer.parseInt(countStr); | 2301 | count = Integer.parseInt(countStr); |
2287 | - if(pageNumI >= 1){ | ||
2288 | - pageNumI = (pageNumI -1 ) * count; | ||
2289 | - }else{ | ||
2290 | - pageNumI = 0 ; | 2302 | + if (pageNumI >= 1) { |
2303 | + pageNumI = (pageNumI - 1) * count; | ||
2304 | + } else { | ||
2305 | + pageNumI = 0; | ||
2291 | } | 2306 | } |
2292 | pd.put("PAGENUM", "" + pageNumI); | 2307 | pd.put("PAGENUM", "" + pageNumI); |
2293 | pd.put("COUNT", "" + count); | 2308 | pd.put("COUNT", "" + count); |
2294 | } | 2309 | } |
2295 | List<PageData> list = questionService.listAllquestion(pd); | 2310 | List<PageData> list = questionService.listAllquestion(pd); |
2296 | - for(PageData pad:list){ | 2311 | + for (PageData pad : list) { |
2297 | String optionContent = pad.getString("OPTION_CONTENT"); | 2312 | String optionContent = pad.getString("OPTION_CONTENT"); |
2298 | - if(optionContent != null && optionContent.startsWith("[") && optionContent.endsWith("]")){ | ||
2299 | - String[] options = optionContent.substring(1, optionContent.length() -1).split(","); | 2313 | + if (optionContent != null && optionContent.startsWith("[") |
2314 | + && optionContent.endsWith("]")) { | ||
2315 | + String[] options = optionContent.substring(1, | ||
2316 | + optionContent.length() - 1).split(","); | ||
2300 | pad.put("OPTION_CONTENT", options); | 2317 | pad.put("OPTION_CONTENT", options); |
2301 | - }else{ | ||
2302 | - pad.put("OPTION_CONTENT", new String[]{optionContent}); | 2318 | + } else { |
2319 | + pad.put("OPTION_CONTENT", new String[] { optionContent }); | ||
2303 | } | 2320 | } |
2304 | } | 2321 | } |
2305 | res.setData(list); | 2322 | res.setData(list); |
@@ -2348,13 +2365,15 @@ public class V1 extends BaseController { | @@ -2348,13 +2365,15 @@ public class V1 extends BaseController { | ||
2348 | pd.remove("KNOWLEDGE_ID"); | 2365 | pd.remove("KNOWLEDGE_ID"); |
2349 | } | 2366 | } |
2350 | List<PageData> list = questionService.listAllRandquestion(pd); | 2367 | List<PageData> list = questionService.listAllRandquestion(pd); |
2351 | - for(PageData pad:list){ | 2368 | + for (PageData pad : list) { |
2352 | String optionContent = pad.getString("OPTION_CONTENT"); | 2369 | String optionContent = pad.getString("OPTION_CONTENT"); |
2353 | - if(optionContent != null && optionContent.startsWith("[") && optionContent.endsWith("]")){ | ||
2354 | - String[] options = optionContent.substring(1, optionContent.length() -1).split(","); | 2370 | + if (optionContent != null && optionContent.startsWith("[") |
2371 | + && optionContent.endsWith("]")) { | ||
2372 | + String[] options = optionContent.substring(1, | ||
2373 | + optionContent.length() - 1).split(","); | ||
2355 | pad.put("OPTION_CONTENT", options); | 2374 | pad.put("OPTION_CONTENT", options); |
2356 | - }else{ | ||
2357 | - pad.put("OPTION_CONTENT", new String[]{optionContent}); | 2375 | + } else { |
2376 | + pad.put("OPTION_CONTENT", new String[] { optionContent }); | ||
2358 | } | 2377 | } |
2359 | } | 2378 | } |
2360 | res.setData(list); | 2379 | res.setData(list); |
@@ -2391,7 +2410,6 @@ public class V1 extends BaseController { | @@ -2391,7 +2410,6 @@ public class V1 extends BaseController { | ||
2391 | 2410 | ||
2392 | } | 2411 | } |
2393 | 2412 | ||
2394 | - | ||
2395 | /** | 2413 | /** |
2396 | * | 2414 | * |
2397 | * @return | 2415 | * @return |
@@ -2688,42 +2706,43 @@ public class V1 extends BaseController { | @@ -2688,42 +2706,43 @@ public class V1 extends BaseController { | ||
2688 | 2706 | ||
2689 | return key.toString(); | 2707 | return key.toString(); |
2690 | } | 2708 | } |
2691 | - | ||
2692 | - | 2709 | + |
2693 | /** | 2710 | /** |
2694 | * 根据ID,获取科目中文名称 | 2711 | * 根据ID,获取科目中文名称 |
2712 | + * | ||
2695 | * @param type | 2713 | * @param type |
2696 | * @return | 2714 | * @return |
2697 | * @throws Exception | 2715 | * @throws Exception |
2698 | */ | 2716 | */ |
2699 | @RequestMapping(value = "/subjectename", produces = "application/json;charset=UTF-8") | 2717 | @RequestMapping(value = "/subjectename", produces = "application/json;charset=UTF-8") |
2700 | @ResponseBody | 2718 | @ResponseBody |
2701 | - public String findSubjectEName() throws Exception{ | 2719 | + public String findSubjectEName() throws Exception { |
2702 | PageData pageData = this.getPageData(); | 2720 | PageData pageData = this.getPageData(); |
2703 | ResponseGson<String> res = new ResponseGson<String>(); | 2721 | ResponseGson<String> res = new ResponseGson<String>(); |
2704 | pageData = subjectService.findById(pageData); | 2722 | pageData = subjectService.findById(pageData); |
2705 | - if(pageData != null){ | 2723 | + if (pageData != null) { |
2706 | res.setData(pageData.getString("ENAME")); | 2724 | res.setData(pageData.getString("ENAME")); |
2707 | - }else{ | 2725 | + } else { |
2708 | res.setDataError(); | 2726 | res.setDataError(); |
2709 | } | 2727 | } |
2710 | return res.toJson(); | 2728 | return res.toJson(); |
2711 | } | 2729 | } |
2712 | - | 2730 | + |
2713 | /** | 2731 | /** |
2714 | * 根据ID或者科目英文名称 | 2732 | * 根据ID或者科目英文名称 |
2733 | + * | ||
2715 | * @param type | 2734 | * @param type |
2716 | * @return | 2735 | * @return |
2717 | * @throws Exception | 2736 | * @throws Exception |
2718 | */ | 2737 | */ |
2719 | @RequestMapping(value = "/subjectcname", produces = "application/json;charset=UTF-8") | 2738 | @RequestMapping(value = "/subjectcname", produces = "application/json;charset=UTF-8") |
2720 | @ResponseBody | 2739 | @ResponseBody |
2721 | - public String findSubjectCName() throws Exception{ | 2740 | + public String findSubjectCName() throws Exception { |
2722 | ResponseGson<String> res = new ResponseGson<String>(); | 2741 | ResponseGson<String> res = new ResponseGson<String>(); |
2723 | PageData pageData = new PageData(); | 2742 | PageData pageData = new PageData(); |
2724 | StringBuilder sb = new StringBuilder(); | 2743 | StringBuilder sb = new StringBuilder(); |
2725 | - String type = this.getPageData().getString("ID"); | ||
2726 | - if(type.contains(",")){ | 2744 | + String type = this.getPageData().getString("ID"); |
2745 | + if (type.contains(",")) { | ||
2727 | String[] types = type.split(","); | 2746 | String[] types = type.split(","); |
2728 | for (String t : types) { | 2747 | for (String t : types) { |
2729 | pageData.put("ID", t); | 2748 | pageData.put("ID", t); |
@@ -2732,8 +2751,8 @@ public class V1 extends BaseController { | @@ -2732,8 +2751,8 @@ public class V1 extends BaseController { | ||
2732 | sb.append(pageData.getString("CNAME") + "; "); | 2751 | sb.append(pageData.getString("CNAME") + "; "); |
2733 | } | 2752 | } |
2734 | } | 2753 | } |
2735 | - sb.delete(sb.length() -3, sb.length()); | ||
2736 | - }else{ | 2754 | + sb.delete(sb.length() - 3, sb.length()); |
2755 | + } else { | ||
2737 | pageData.put("ID", type); | 2756 | pageData.put("ID", type); |
2738 | pageData = subjectService.findById(pageData); | 2757 | pageData = subjectService.findById(pageData); |
2739 | if (pageData != null) { | 2758 | if (pageData != null) { |
@@ -2743,126 +2762,339 @@ public class V1 extends BaseController { | @@ -2743,126 +2762,339 @@ public class V1 extends BaseController { | ||
2743 | res.setData(sb.toString()); | 2762 | res.setData(sb.toString()); |
2744 | return res.toJson(); | 2763 | return res.toJson(); |
2745 | } | 2764 | } |
2746 | - | 2765 | + |
2747 | /** | 2766 | /** |
2748 | * 根据ID班级名称 | 2767 | * 根据ID班级名称 |
2768 | + * | ||
2749 | * @param id | 2769 | * @param id |
2750 | * @return | 2770 | * @return |
2751 | * @throws Exception | 2771 | * @throws Exception |
2752 | */ | 2772 | */ |
2753 | @RequestMapping(value = "/classname", produces = "application/json;charset=UTF-8") | 2773 | @RequestMapping(value = "/classname", produces = "application/json;charset=UTF-8") |
2754 | @ResponseBody | 2774 | @ResponseBody |
2755 | - public String findClassName() throws Exception { | 2775 | + public String findClassName() throws Exception { |
2756 | ResponseGson<String> res = new ResponseGson<String>(); | 2776 | ResponseGson<String> res = new ResponseGson<String>(); |
2757 | PageData pageData = this.getPageData(); | 2777 | PageData pageData = this.getPageData(); |
2758 | pageData = sclassService.findById(pageData); | 2778 | pageData = sclassService.findById(pageData); |
2759 | - String className = "" ; | ||
2760 | - if(pageData != null){ | 2779 | + String className = ""; |
2780 | + if (pageData != null) { | ||
2761 | className = pageData.getString("CLASS_NAME"); | 2781 | className = pageData.getString("CLASS_NAME"); |
2762 | - }else{ | 2782 | + } else { |
2763 | res.setDataError(); | 2783 | res.setDataError(); |
2764 | } | 2784 | } |
2765 | res.setData(className); | 2785 | res.setData(className); |
2766 | return res.toJson(); | 2786 | return res.toJson(); |
2767 | - | 2787 | + |
2768 | } | 2788 | } |
2769 | - | 2789 | + |
2770 | /** | 2790 | /** |
2771 | * 根据ID班级名称 | 2791 | * 根据ID班级名称 |
2792 | + * | ||
2772 | * @param id | 2793 | * @param id |
2773 | * @return | 2794 | * @return |
2774 | * @throws Exception | 2795 | * @throws Exception |
2775 | */ | 2796 | */ |
2776 | @RequestMapping(value = "/qstudentinfo", produces = "application/json;charset=UTF-8") | 2797 | @RequestMapping(value = "/qstudentinfo", produces = "application/json;charset=UTF-8") |
2777 | @ResponseBody | 2798 | @ResponseBody |
2778 | - public String qstudentinfo() throws Exception { | 2799 | + public String qstudentinfo() throws Exception { |
2779 | ResponseGson<List<PageData>> res = new ResponseGson(); | 2800 | ResponseGson<List<PageData>> res = new ResponseGson(); |
2780 | PageData pageData = this.getPageData(); | 2801 | PageData pageData = this.getPageData(); |
2781 | if (pageData.containsKey("TEST_ID") | 2802 | if (pageData.containsKey("TEST_ID") |
2782 | && pageData.containsKey("QUESTION_ID")) { | 2803 | && pageData.containsKey("QUESTION_ID")) { |
2783 | List<PageData> list = v1Service.getQuestionWrongInfo(pageData); | 2804 | List<PageData> list = v1Service.getQuestionWrongInfo(pageData); |
2784 | res.setData(list); | 2805 | res.setData(list); |
2785 | - }else{ | 2806 | + } else { |
2786 | res.setDataError(); | 2807 | res.setDataError(); |
2787 | } | 2808 | } |
2788 | return res.toJson(); | 2809 | return res.toJson(); |
2789 | - | 2810 | + |
2790 | } | 2811 | } |
2791 | - | 2812 | + |
2792 | /** | 2813 | /** |
2793 | * 根据ID班级名称 | 2814 | * 根据ID班级名称 |
2815 | + * | ||
2794 | * @param id | 2816 | * @param id |
2795 | * @return | 2817 | * @return |
2796 | * @throws Exception | 2818 | * @throws Exception |
2797 | */ | 2819 | */ |
2798 | @RequestMapping(value = "/wrongquestion", produces = "application/json;charset=UTF-8") | 2820 | @RequestMapping(value = "/wrongquestion", produces = "application/json;charset=UTF-8") |
2799 | @ResponseBody | 2821 | @ResponseBody |
2800 | - public String wrongquestion() throws Exception { | 2822 | + public String wrongquestion() throws Exception { |
2801 | ResponseGson<List<PageData>> res = new ResponseGson(); | 2823 | ResponseGson<List<PageData>> res = new ResponseGson(); |
2802 | PageData pageData = this.getPageData(); | 2824 | PageData pageData = this.getPageData(); |
2803 | List<PageData> list = v1Service.getLastWrongQuestionInfo(pageData); | 2825 | List<PageData> list = v1Service.getLastWrongQuestionInfo(pageData); |
2804 | res.setData(list); | 2826 | res.setData(list); |
2805 | return res.toJson(); | 2827 | return res.toJson(); |
2806 | - | 2828 | + |
2807 | } | 2829 | } |
2808 | - | 2830 | + |
2809 | /** | 2831 | /** |
2810 | * 根据ID班级名称 | 2832 | * 根据ID班级名称 |
2833 | + * | ||
2811 | * @param id | 2834 | * @param id |
2812 | * @return | 2835 | * @return |
2813 | * @throws Exception | 2836 | * @throws Exception |
2814 | */ | 2837 | */ |
2815 | @RequestMapping(value = "/printmsg", produces = "application/json;charset=UTF-8") | 2838 | @RequestMapping(value = "/printmsg", produces = "application/json;charset=UTF-8") |
2816 | @ResponseBody | 2839 | @ResponseBody |
2817 | - public String printmsg() throws Exception { | 2840 | + public String printmsg() throws Exception { |
2818 | ResponseGson<Map> res = new ResponseGson(); | 2841 | ResponseGson<Map> res = new ResponseGson(); |
2819 | res.setData(FileUploadProgressListener.map); | 2842 | res.setData(FileUploadProgressListener.map); |
2820 | return res.toJson(); | 2843 | return res.toJson(); |
2821 | - | 2844 | + |
2822 | } | 2845 | } |
2846 | + | ||
2823 | /** | 2847 | /** |
2824 | * 根据ID班级名称 | 2848 | * 根据ID班级名称 |
2849 | + * | ||
2825 | * @param id | 2850 | * @param id |
2826 | * @return | 2851 | * @return |
2827 | * @throws Exception | 2852 | * @throws Exception |
2828 | */ | 2853 | */ |
2829 | @RequestMapping(value = "/printresult", produces = "application/json;charset=UTF-8") | 2854 | @RequestMapping(value = "/printresult", produces = "application/json;charset=UTF-8") |
2830 | @ResponseBody | 2855 | @ResponseBody |
2831 | - public String printresult() throws Exception { | 2856 | + public String printresult() throws Exception { |
2832 | ResponseGson<Map> res = new ResponseGson(); | 2857 | ResponseGson<Map> res = new ResponseGson(); |
2833 | res.setData(FileUploadProgressListener.result); | 2858 | res.setData(FileUploadProgressListener.result); |
2834 | return res.toJson(); | 2859 | return res.toJson(); |
2835 | - | 2860 | + |
2836 | } | 2861 | } |
2837 | - | 2862 | + |
2838 | @RequestMapping(value = "/uploadfile", produces = "application/json;charset=UTF-8") | 2863 | @RequestMapping(value = "/uploadfile", produces = "application/json;charset=UTF-8") |
2839 | @ResponseBody | 2864 | @ResponseBody |
2840 | - public String uploadFile(@RequestParam(value="file",required=false)MultipartFile file, HttpServletRequest request) throws Exception{ | 2865 | + public String uploadFile( |
2866 | + @RequestParam(value = "file", required = false) MultipartFile file, | ||
2867 | + HttpServletRequest request) throws Exception { | ||
2841 | ResponseGson<String> res = new ResponseGson<String>(); | 2868 | ResponseGson<String> res = new ResponseGson<String>(); |
2842 | if (file != null) { | 2869 | if (file != null) { |
2843 | String path = request.getSession().getServletContext() | 2870 | String path = request.getSession().getServletContext() |
2844 | .getRealPath("/uploadFiles/uploadFile/"); | 2871 | .getRealPath("/uploadFiles/uploadFile/"); |
2845 | - String name = System.currentTimeMillis() + file.getOriginalFilename(); | 2872 | + String name = System.currentTimeMillis() |
2873 | + + file.getOriginalFilename(); | ||
2846 | File pathFile = new File(path); | 2874 | File pathFile = new File(path); |
2847 | pathFile.mkdirs(); | 2875 | pathFile.mkdirs(); |
2848 | File saveFile = new File(path + File.separator + name); | 2876 | File saveFile = new File(path + File.separator + name); |
2849 | - if(saveFile.exists()){ | 2877 | + if (saveFile.exists()) { |
2850 | saveFile.delete(); | 2878 | saveFile.delete(); |
2851 | } | 2879 | } |
2852 | saveFile.createNewFile(); | 2880 | saveFile.createNewFile(); |
2853 | file.transferTo(saveFile); | 2881 | file.transferTo(saveFile); |
2854 | path = request.getContextPath(); | 2882 | path = request.getContextPath(); |
2855 | - String basePath = request.getScheme() + "://" + request.getServerName() | ||
2856 | - + ":" + request.getServerPort() + path + "/"; | 2883 | + String basePath = request.getScheme() + "://" |
2884 | + + request.getServerName() + ":" + request.getServerPort() | ||
2885 | + + path + "/"; | ||
2857 | res.setData("/uploadFiles/uploadFile/" + name); | 2886 | res.setData("/uploadFiles/uploadFile/" + name); |
2858 | - }else{ | 2887 | + } else { |
2859 | res.setDataError(); | 2888 | res.setDataError(); |
2860 | } | 2889 | } |
2861 | return res.toJson(); | 2890 | return res.toJson(); |
2862 | } | 2891 | } |
2863 | - | ||
2864 | - | ||
2865 | - | ||
2866 | - | ||
2867 | - | 2892 | + |
2893 | + @RequestMapping(value = "/liuqin", produces = "application/json;charset=UTF-8") | ||
2894 | + @ResponseBody | ||
2895 | + public String dosunvotedata() /*throws Exception*/ { | ||
2896 | + | ||
2897 | + PageData pd = new PageData(); | ||
2898 | + pd.put("dbtype", "mysql"); | ||
2899 | + pd.put("username", "root"); | ||
2900 | + pd.put("password", "admin"); | ||
2901 | + pd.put("dbAddress", "120.78.57.84"); | ||
2902 | + pd.put("dbport", "3306"); | ||
2903 | + pd.put("databaseName", "sunvote"); | ||
2904 | + pd.put("dbport", "3306"); | ||
2905 | + List<PageData> resultList = new ArrayList<PageData>(); | ||
2906 | + | ||
2907 | + try { | ||
2908 | + Connection conn = DbFH.getFHCon(pd); | ||
2909 | + | ||
2910 | + Statement stmt = conn.createStatement(); | ||
2911 | + ResultSet rs = stmt | ||
2912 | + .executeQuery("select reportId,paperName,createTime,paperScore,classAverage,className from t_report where userId = '4000001' and className = 'G205' "); | ||
2913 | + while (rs.next()) { | ||
2914 | + PageData coloumData = new PageData(); | ||
2915 | + String reportId = rs.getString("reportId"); | ||
2916 | + coloumData.put("PAPER_ID", reportId); | ||
2917 | + coloumData.put("TESTPAPER_ID", reportId); | ||
2918 | + coloumData.put("NAME", rs.getString("paperName")); | ||
2919 | + coloumData.put("START_DATE", rs.getString("createTime")); | ||
2920 | + coloumData.put("END_DATE", rs.getString("createTime")); | ||
2921 | + coloumData.put("CREATE_DATE", rs.getString("createTime")); | ||
2922 | + coloumData.put("REMARK", rs.getString("paperScore")); | ||
2923 | + coloumData.put("TOTAL_SCORE", rs.getString("paperScore")); | ||
2924 | + coloumData.put("AVG_SCORE", rs.getString("classAverage")); | ||
2925 | + String className = rs.getString("className"); | ||
2926 | + if ("G201".equals(className)) { | ||
2927 | + coloumData.put("SCLASS_ID", | ||
2928 | + "2af1ca03c40c4acab7b7d0f8243c9849"); | ||
2929 | + } | ||
2930 | + if ("G202".equals(className)) { | ||
2931 | + coloumData.put("SCLASS_ID", | ||
2932 | + "49f1b14d10424bb6abc8aed56a4693cf"); | ||
2933 | + } | ||
2934 | + if ("G203".equals(className)) { | ||
2935 | + coloumData.put("SCLASS_ID", | ||
2936 | + "80b5dde0138b405bb2bcfc5f33bad649"); | ||
2937 | + } | ||
2938 | + if ("G204".equals(className)) { | ||
2939 | + coloumData.put("SCLASS_ID", | ||
2940 | + "f9de4a939ec54d7ba27d1248279a2f95"); | ||
2941 | + } | ||
2942 | + if ("G205".equals(className)) { | ||
2943 | + coloumData.put("SCLASS_ID", | ||
2944 | + "0f10ce0a3bf146769213c49825c35feb"); | ||
2945 | + } | ||
2946 | + if ("G206".equals(className)) { | ||
2947 | + coloumData.put("SCLASS_ID", | ||
2948 | + "d33edcd7a0f74ca9a0e92ebda9442869"); | ||
2949 | + } | ||
2950 | + if ("G207".equals(className)) { | ||
2951 | + coloumData.put("SCLASS_ID", | ||
2952 | + "ffef54ef21c64525831f266b6fae34fc"); | ||
2953 | + } | ||
2954 | + coloumData | ||
2955 | + .put("TEACHER_ID", "dbf8b49c641d47a8a811bb6d7480be72"); | ||
2956 | + coloumData.put("TEST_TYPE", "1"); | ||
2957 | + | ||
2958 | + List<PageData> detailList = new ArrayList<PageData>(); | ||
2959 | + | ||
2960 | + Statement stmt1 = conn.createStatement(); | ||
2961 | + ResultSet rs1 = stmt1 | ||
2962 | + .executeQuery("select studentName,answerStr,score,totalScore from t_reportdetail where reportId = '" | ||
2963 | + + reportId + "'"); | ||
2964 | + while (rs1.next()) { | ||
2965 | + PageData detailPd = new PageData(); | ||
2966 | + detailPd.put("NAME", rs1.getString("studentName")); | ||
2967 | + detailPd.put("answerStr", rs1.getString("answerStr")); | ||
2968 | + detailPd.put("SCORE", rs1.getString("totalScore")); | ||
2969 | + detailPd.put("totalScore", rs.getString("paperScore")); | ||
2970 | + detailList.add(detailPd); | ||
2971 | + } | ||
2972 | + rs1.close(); | ||
2973 | + stmt1.close(); | ||
2974 | + stmt1 = null; | ||
2975 | + coloumData.put("STUDENT", detailList); | ||
2976 | + | ||
2977 | + resultList.add(coloumData); | ||
2978 | + } | ||
2979 | + rs.close(); | ||
2980 | + stmt.close(); | ||
2981 | + conn.close(); | ||
2982 | + }catch(Exception e){ | ||
2983 | + e.printStackTrace(); | ||
2984 | + } | ||
2985 | + for (PageData paper : resultList) { | ||
2986 | + PageData testPd = new PageData(); | ||
2987 | + testPd.put("TESTPAPER_ID", paper.get("TESTPAPER_ID")); | ||
2988 | + testPd.put("PAPER_ID", paper.get("PAPER_ID")); | ||
2989 | + List<PageData> listData = null; | ||
2990 | + try { | ||
2991 | + listData = testpaperService.listAll(testPd); | ||
2992 | + } catch (Exception e) { | ||
2993 | + e.printStackTrace(); | ||
2994 | + } | ||
2995 | + if ((listData != null && listData.size() > 0)) { | ||
2996 | + String testPaperId = listData.get(0).getString("TESTPAPER_ID"); | ||
2997 | + try { | ||
2998 | + testpaperService.deleteList(testPd); | ||
2999 | + } catch (Exception e) { | ||
3000 | + e.printStackTrace(); | ||
3001 | + } | ||
3002 | + testPd.put("TEST_ID", testPaperId); | ||
3003 | + try { | ||
3004 | + testpaperinfoService.delete(testPd); | ||
3005 | + } catch (Exception e) { | ||
3006 | + e.printStackTrace(); | ||
3007 | + } | ||
3008 | + try { | ||
3009 | + studenttestService.delete(testPd); | ||
3010 | + } catch (Exception e) { | ||
3011 | + e.printStackTrace(); | ||
3012 | + } | ||
3013 | + listData.clear(); | ||
3014 | + } | ||
3015 | + if (!(listData != null && listData.size() > 0)) { | ||
3016 | + logger.info(paper); | ||
3017 | + try { | ||
3018 | + testpaperService.save(paper); | ||
3019 | + } catch (Exception e) { | ||
3020 | + e.printStackTrace(); | ||
3021 | + } | ||
3022 | + logger.info("添加测试名称成功:" + paper.get("TESTPAPER_ID")); | ||
3023 | + List<PageData> detailList = (List<PageData>) paper.get("STUDENT"); | ||
3024 | + int i = 0; | ||
3025 | + List<PageData> testInfoPdList = new ArrayList(); | ||
3026 | + for (PageData student : detailList) { | ||
3027 | + i++; | ||
3028 | + PageData studentDetail = null; | ||
3029 | + try { | ||
3030 | + studentDetail = studentService.findByName(student); | ||
3031 | + } catch (Exception e) { | ||
3032 | + e.printStackTrace(); | ||
3033 | + } | ||
3034 | + PageData studentPageData = new PageData(); | ||
3035 | + studentPageData.put("STUDENTTEST_ID", get32UUID()); | ||
3036 | + studentPageData.put("STUDENT_ID", studentDetail.get("ID")); | ||
3037 | + studentPageData.put("TEST_ID", paper.get("TESTPAPER_ID")); | ||
3038 | + studentPageData.put("PAPER_ID", paper.get("TESTPAPER_ID")); | ||
3039 | + studentPageData.put("SCORE", student.get("SCORE")); | ||
3040 | + studentPageData.put("CLASS_ID", paper.get("SCLASS_ID")); | ||
3041 | + logger.info("学生测试数据"); | ||
3042 | + logger.info(studentPageData); | ||
3043 | + try { | ||
3044 | + studenttestService.save(studentPageData); | ||
3045 | + } catch (Exception e) { | ||
3046 | + e.printStackTrace(); | ||
3047 | + } | ||
3048 | + logger.info("添加学生测试成功:" + studentDetail.get("NAME")); | ||
3049 | + | ||
3050 | + String answerStr = student.getString("answerStr"); | ||
3051 | + String[] answerStrs = answerStr.split(";"); | ||
3052 | + int j = 0; | ||
3053 | + for (String answers : answerStrs) { | ||
3054 | + j++; | ||
3055 | + PageData testInfoPd = new PageData(); | ||
3056 | + testInfoPd.put("TESTPAPERINFO_ID", this.get32UUID()); | ||
3057 | + testInfoPd.put("PAPER_ID", paper.get("TESTPAPER_ID")); | ||
3058 | + testInfoPd.put("STUDENT_ID", studentDetail.get("ID")); | ||
3059 | + testInfoPd.put("TEST_ID", paper.get("TESTPAPER_ID")); | ||
3060 | + testInfoPd.put("QUESTION_ID", paper.get("TESTPAPER_ID") + "" + i); | ||
3061 | + String[] ans = answers.split(","); | ||
3062 | + testInfoPd.put("ANSWER", ans[0]); | ||
3063 | + testInfoPd.put("RIGHT", ans[1]); | ||
3064 | + testInfoPd.put("SCORE", ""); | ||
3065 | + testInfoPd.put("LIKES", ""); | ||
3066 | + testInfoPd.put("ANSWER_TYPE", "1"); | ||
3067 | + testInfoPd.put("PRESS_TIME", ""); | ||
3068 | + testInfoPd.put("RECEIVER_DATE", ""); | ||
3069 | + testInfoPd.put("SUBJECTIVE", ""); | ||
3070 | + testInfoPd.put("MARK_NO", "" + j); | ||
3071 | + testInfoPd.put("RANDOM", "" + j); | ||
3072 | + testInfoPd.put("RANK", "" + j); | ||
3073 | + try { | ||
3074 | + logger.info("学生详细测试数据"); | ||
3075 | + logger.info(testInfoPd); | ||
3076 | + testpaperinfoService.save(testInfoPd); | ||
3077 | + logger.info("添加学生详细情况成功:"); | ||
3078 | + } catch (Exception e) { | ||
3079 | + // TODO Auto-generated catch block | ||
3080 | + e.printStackTrace(); | ||
3081 | + } | ||
3082 | +// testInfoPdList.add(testInfoPd); | ||
3083 | + } | ||
3084 | +// logger.info("学生详细测试数据"); | ||
3085 | +// logger.info(testInfoPdList); | ||
3086 | + try { | ||
3087 | +// testpaperinfoService.batchSave(testInfoPdList); | ||
3088 | + } catch (Exception e) { | ||
3089 | + e.printStackTrace(); | ||
3090 | + } | ||
3091 | +// logger.info("添加学生详细情况成功:"); | ||
3092 | + } | ||
3093 | + } | ||
3094 | + } | ||
3095 | + | ||
3096 | + ResponseGson<String> res = new ResponseGson<String>(); | ||
3097 | + return res.toJson(); | ||
3098 | + } | ||
3099 | + | ||
2868 | } | 3100 | } |
src/com/fh/controller/sunvote/paper/PaperController.java
@@ -28,6 +28,7 @@ import com.fh.entity.system.User; | @@ -28,6 +28,7 @@ import com.fh.entity.system.User; | ||
28 | import com.fh.service.api.V1Manager; | 28 | import com.fh.service.api.V1Manager; |
29 | import com.fh.service.sunvote.paper.PaperManager; | 29 | import com.fh.service.sunvote.paper.PaperManager; |
30 | import com.fh.service.sunvote.paperquestion.PaperQuestionManager; | 30 | import com.fh.service.sunvote.paperquestion.PaperQuestionManager; |
31 | +import com.fh.service.sunvote.question.QuestionManager; | ||
31 | import com.fh.util.AppUtil; | 32 | import com.fh.util.AppUtil; |
32 | import com.fh.util.Const; | 33 | import com.fh.util.Const; |
33 | import com.fh.util.Jurisdiction; | 34 | import com.fh.util.Jurisdiction; |
@@ -49,6 +50,9 @@ public class PaperController extends BaseController { | @@ -49,6 +50,9 @@ public class PaperController extends BaseController { | ||
49 | @Resource(name="paperquestionService") | 50 | @Resource(name="paperquestionService") |
50 | private PaperQuestionManager paperquestionService; | 51 | private PaperQuestionManager paperquestionService; |
51 | 52 | ||
53 | + @Resource(name="questionService") | ||
54 | + private QuestionManager questionService; | ||
55 | + | ||
52 | @Resource(name = "v1Service") | 56 | @Resource(name = "v1Service") |
53 | private V1Manager v1Service ; | 57 | private V1Manager v1Service ; |
54 | 58 | ||
@@ -94,6 +98,17 @@ public class PaperController extends BaseController { | @@ -94,6 +98,17 @@ public class PaperController extends BaseController { | ||
94 | PageData pd = new PageData(); | 98 | PageData pd = new PageData(); |
95 | pd = this.getPageData(); | 99 | pd = this.getPageData(); |
96 | String[] ArrayDATA_IDS = new String[]{pd.getString("PAPER_ID")}; | 100 | String[] ArrayDATA_IDS = new String[]{pd.getString("PAPER_ID")}; |
101 | + if(pd.getString("QINGSONGKAO") != null){ | ||
102 | + List<PageData> list = paperquestionService.listAll(pd); | ||
103 | + String[] qids = new String[list.size()]; | ||
104 | + int i = 0 ; | ||
105 | + for(PageData ptd : list){ | ||
106 | + qids[i++] = ptd.getString("QUESTION_ID"); | ||
107 | + } | ||
108 | + if(qids.length > 0){ | ||
109 | + questionService.deleteAll(qids); | ||
110 | + } | ||
111 | + } | ||
97 | paperquestionService.deleteAllPaper(ArrayDATA_IDS); | 112 | paperquestionService.deleteAllPaper(ArrayDATA_IDS); |
98 | paperService.delete(pd); | 113 | paperService.delete(pd); |
99 | out.write("success"); | 114 | out.write("success"); |
@@ -178,8 +193,8 @@ public class PaperController extends BaseController { | @@ -178,8 +193,8 @@ public class PaperController extends BaseController { | ||
178 | question.setDifficulty(qpd.getString("DIFFICULTY")); | 193 | question.setDifficulty(qpd.getString("DIFFICULTY")); |
179 | question.setAnalysis(qpd.getString("ANALYSIS")); | 194 | question.setAnalysis(qpd.getString("ANALYSIS")); |
180 | question.setQuestion_from(qpd.getString("QUESTION_FROM")); | 195 | question.setQuestion_from(qpd.getString("QUESTION_FROM")); |
181 | - question.setSug_score(qpd.getString("SUG_SCORE")); | ||
182 | - question.setSug_part_score(qpd.getString("SUG_PART_SCORE")); | 196 | + question.setSug_score(qpd.getString("SCORE")); |
197 | + question.setSug_part_score(qpd.getString("PART_SCORE")); | ||
183 | question.setRank(qpd.getString("RANK")); | 198 | question.setRank(qpd.getString("RANK")); |
184 | question.setNo_name(qpd.getString("NO_NAME")); | 199 | question.setNo_name(qpd.getString("NO_NAME")); |
185 | if("-1".equals("" + qpd.getString("P_ID"))){ | 200 | if("-1".equals("" + qpd.getString("P_ID"))){ |
@@ -201,8 +216,8 @@ public class PaperController extends BaseController { | @@ -201,8 +216,8 @@ public class PaperController extends BaseController { | ||
201 | qq.setDifficulty(q.getString("DIFFICULTY")); | 216 | qq.setDifficulty(q.getString("DIFFICULTY")); |
202 | qq.setAnalysis(q.getString("ANALYSIS")); | 217 | qq.setAnalysis(q.getString("ANALYSIS")); |
203 | qq.setQuestion_from(q.getString("QUESTION_FROM")); | 218 | qq.setQuestion_from(q.getString("QUESTION_FROM")); |
204 | - qq.setSug_score(q.getString("SUG_SCORE")); | ||
205 | - qq.setSug_part_score(q.getString("SUG_PART_SCORE")); | 219 | + qq.setSug_score(q.getString("SCORE")); |
220 | + qq.setSug_part_score(q.getString("PART_SCORE")); | ||
206 | qq.setRank(q.getString("RANK")); | 221 | qq.setRank(q.getString("RANK")); |
207 | qq.setNo_name(q.getString("NO_NAME")); | 222 | qq.setNo_name(q.getString("NO_NAME")); |
208 | question.getQuestions().add(qq); | 223 | question.getQuestions().add(qq); |
src/com/fh/service/sunvote/student/StudentManager.java
@@ -55,6 +55,14 @@ public interface StudentManager{ | @@ -55,6 +55,14 @@ public interface StudentManager{ | ||
55 | */ | 55 | */ |
56 | public PageData findById(PageData pd)throws Exception; | 56 | public PageData findById(PageData pd)throws Exception; |
57 | 57 | ||
58 | + /** | ||
59 | + * | ||
60 | + * @param pd | ||
61 | + * @return | ||
62 | + * @throws Exception | ||
63 | + */ | ||
64 | + public PageData findByName(PageData pd)throws Exception; | ||
65 | + | ||
58 | /**批量删除 | 66 | /**批量删除 |
59 | * @param ArrayDATA_IDS | 67 | * @param ArrayDATA_IDS |
60 | * @throws Exception | 68 | * @throws Exception |
src/com/fh/service/sunvote/student/impl/StudentService.java
@@ -90,6 +90,14 @@ public class StudentService implements StudentManager{ | @@ -90,6 +90,14 @@ public class StudentService implements StudentManager{ | ||
90 | return (PageData)dao.findForObject("StudentMapper.findById", pd); | 90 | return (PageData)dao.findForObject("StudentMapper.findById", pd); |
91 | } | 91 | } |
92 | 92 | ||
93 | + /**通过id获取数据 | ||
94 | + * @param pd | ||
95 | + * @throws Exception | ||
96 | + */ | ||
97 | + public PageData findByName(PageData pd)throws Exception{ | ||
98 | + return (PageData)dao.findForObject("StudentMapper.findByName", pd); | ||
99 | + } | ||
100 | + | ||
93 | /**批量删除 | 101 | /**批量删除 |
94 | * @param ArrayDATA_IDS | 102 | * @param ArrayDATA_IDS |
95 | * @throws Exception | 103 | * @throws Exception |