Commit 066f76730106262acf2e23801cf7bb45064beb57
1 parent
4d39642d
修复bug
Showing
10 changed files
with
156 additions
and
35 deletions
WebRoot/WEB-INF/jsp/sunvote/teacher/creat_question.jsp
... | ... | @@ -203,7 +203,7 @@ |
203 | 203 | </div><!-- /.modal-content --> |
204 | 204 | </div><!-- /.modal-dialog --> |
205 | 205 | </div><!-- /.modal --> |
206 | -<div class="loading" style="background:rgba(0,0,0,0.5);width:100%;height:100%;position:absolute;top:0;display:none;"> | |
206 | +<div class="loading" style="background:rgba(0,0,0,0.5);width:100%;height:100%;position:fixed;top:0;display:none;"> | |
207 | 207 | <img src="../static/images/loading.gif" width="200px" style="position:absolute;top:0;bottom:0;left:0;right:0;margin:auto;"/> |
208 | 208 | </div> |
209 | 209 | <script> | ... | ... |
WebRoot/WEB-INF/jsp/sunvote/teacher/teacher_main.jsp
... | ... | @@ -98,7 +98,7 @@ |
98 | 98 | </div> |
99 | 99 | </c:forEach> |
100 | 100 | <div class="test">测验</div> |
101 | - <div class="analysis">分析</div> | |
101 | + <!-- <div class="analysis">分析</div> --> | |
102 | 102 | </div> |
103 | 103 | <div style="width:70%;height:100%;margin-left:30%;" class="content_r"> |
104 | 104 | <iframe name="mainFrame" id="mainFrame" frameborder="0" src="paper/list2.do?" ></iframe> |
... | ... | @@ -212,9 +212,9 @@ |
212 | 212 | var path = "student/listcs.do?class_id=" + classID + "&term_id=" + termID ; |
213 | 213 | $(".content_r").html('<iframe name="mainFrame" id="mainFrame" frameborder="0" style="width:100%;height:'+$(".content_l").height()+'px;" src=' + path + '></iframe>'); |
214 | 214 | } |
215 | - $(".analysis").click(function(){ | |
215 | + /* $(".analysis").click(function(){ | |
216 | 216 | $(".content_r").html('<img src="static/images/analysis.png" width="100%" />'); |
217 | - }) | |
217 | + }) */ | |
218 | 218 | </script> |
219 | 219 | |
220 | 220 | </body> | ... | ... |
WebRoot/WEB-INF/jsp/sunvote/teacher/teacher_report_test.jsp
... | ... | @@ -33,15 +33,15 @@ |
33 | 33 | <input type="hidden" name="CLASSID" id="CLASSID" value="${info.CLASS_ID}" /> |
34 | 34 | <table style="margin-top:5px;"> |
35 | 35 | <tr> |
36 | - <td>试卷名称: ${info.testsize}</td> | |
36 | + <td>试卷名称: ${testpaperInfo.NAME}</td> | |
37 | 37 | </tr> |
38 | 38 | <tr> |
39 | - <td>收卷时间: ${info.CLASS_NAME}</td> | |
39 | + <td>收卷时间: ${testpaperInfo.END_DATE}</td> | |
40 | 40 | </tr> |
41 | 41 | <tr> |
42 | - <td>班级名册:${info.CLASS_NAME}</td> | |
42 | + <td>班级名册:${classInfo.CLASS_NAME}</td> | |
43 | 43 | <td> </td> |
44 | - <td><span>学生人数: ${info.STUDENT_NUM}</span></td> | |
44 | + <td><span>学生人数: ${classInfo.studentNum}</span></td> | |
45 | 45 | |
46 | 46 | </tr> |
47 | 47 | </table> |
... | ... | @@ -56,8 +56,8 @@ |
56 | 56 | <th class="center">得分</th> |
57 | 57 | <th class="center">正确率</th> |
58 | 58 | <th class="center">排名</th> |
59 | - <c:forEach items="${testpaperList}" var="var" varStatus="vs"> | |
60 | - <th class="center">${var.NAME}</th> | |
59 | + <c:forEach items="${questionInfo}" var="var" varStatus="vs"> | |
60 | + <th class="center">题目${vs.index+1}</th> | |
61 | 61 | </c:forEach> |
62 | 62 | <th class="center">非选择题得分</th> |
63 | 63 | <th class="center">总分</th> |
... | ... | @@ -71,28 +71,30 @@ |
71 | 71 | <td class="center"></td> |
72 | 72 | <td class="center"></td> |
73 | 73 | <td class="center"></td> |
74 | - <c:forEach items="${testpaperList}" var="var" varStatus="vs"> | |
75 | - <td class="center">${var.TOTAL_SCORE}</td> | |
74 | + <c:forEach items="${questionInfo}" var="var" varStatus="vs"> | |
75 | + <td class="center"><fmt:formatNumber type="number" | |
76 | + value="${var == 0 ? 0: (var / classInfo.studentNum * 100)}" | |
77 | + maxFractionDigits="1" />%</td> | |
76 | 78 | </c:forEach> |
77 | 79 | <td class="center"></td> |
78 | 80 | <td class="center"></td> |
79 | 81 | </tr> |
80 | 82 | |
81 | 83 | <c:choose> |
82 | - <c:when test="${not empty studentList}"> | |
83 | - <c:forEach items="${studentList}" var="var" varStatus="vs"> | |
84 | + <c:when test="${not empty studentInfo}"> | |
85 | + <c:forEach items="${studentInfo}" var="var" varStatus="vs"> | |
84 | 86 | <tr> |
85 | - <td class="center"><a | |
86 | - href="<%=basePath%>report/student_report。do?studentid=${var.ID}">${var.NAME}</a> | |
87 | - </td> | |
88 | - <td class="center"><fmt:formatNumber type="number" | |
89 | - value="${var.TOTALSCORE == 0 ? 0: (var.GETSCORE / var.TOTALSCORE * 100)}" | |
90 | - maxFractionDigits="1" />%</td> | |
91 | - <td class="center">${var.GETSCORE }</td> | |
92 | - <c:forEach items="${testpaperList}" var="var1" varStatus="vs1"> | |
93 | - <td class="center"><c:set var="TEST_ID" | |
94 | - value="${var1.TESTPAPER_ID}" /> ${var[TEST_ID] }</td> | |
87 | + <td class="center">${var.KEYPAD_ID}</td> | |
88 | + <td class="center">${var.SNO}</td> | |
89 | + <td class="center">${var.NAME}</td> | |
90 | + <td class="center">${var.GETSCORE}</td> | |
91 | + <td class="center">${var.RIGHT}</td> | |
92 | + <td class="center">${vs.index + 1}</td> | |
93 | + <c:forEach items="${questionInfo}" var="var1" varStatus="vs1"> | |
94 | + <td class="center">${var.detail[vs1.index].ANSWER}</td> | |
95 | 95 | </c:forEach> |
96 | + <td class="center">${var.OTHER_SCORE}</td> | |
97 | + <td class="center">${var.GETSCORE}</td> | |
96 | 98 | </tr> |
97 | 99 | </c:forEach> |
98 | 100 | </c:when> | ... | ... |
WebRoot/WEB-INF/jsp/system/index/head.jsp
... | ... | @@ -65,7 +65,7 @@ |
65 | 65 | <!-- <li> |
66 | 66 | <a onclick="editPhoto();" style="cursor:pointer;"><i class="ace-icon glyphicon glyphicon-picture"></i>修改头像</a>editUserH()在 WebRoot\static\js\myjs\head.js中 |
67 | 67 | </li> --> |
68 | - <li> | |
68 | + <li style="display:none"> | |
69 | 69 | <a onclick="editUserH();" style="cursor:pointer;"><i class="ace-icon fa fa-user"></i>修改资料</a><!-- editUserH()在 WebRoot\static\js\myjs\head.js中 --> |
70 | 70 | </li> |
71 | 71 | <li id="systemset" style="display:none" > | ... | ... |
WebRoot/static/js/control1.js
... | ... | @@ -9,8 +9,12 @@ |
9 | 9 | if (r != null) return unescape(r[2]); return null; |
10 | 10 | } |
11 | 11 | function getData(startDate,endDate){ |
12 | + var attend = "" ; | |
13 | + if(startDate != null && endDate != null){ | |
14 | + attend = "&start_Date="+startDate+"&end_Date="+endDate; | |
15 | + } | |
12 | 16 | $.ajax({ |
13 | - url:URL+"&start_Date="+startDate+"&end_Date="+endDate, | |
17 | + url:URL+ attend, | |
14 | 18 | type:"get", |
15 | 19 | async:false, |
16 | 20 | dataType:"json", | ... | ... |
resources/mybatis1/sunvote/TestPaperInfoMapper.xml
... | ... | @@ -194,6 +194,24 @@ |
194 | 194 | </if> |
195 | 195 | </select> |
196 | 196 | |
197 | + <!-- 列表(全部) --> | |
198 | + <select id="reportPaperDetail" parameterType="pd" resultType="pd"> | |
199 | + SELECT | |
200 | + sv_testpaperinfo.QUESTION_ID, | |
201 | + sv_testpaperinfo.SCORE, | |
202 | + sv_testpaperinfo.ANSWER, | |
203 | + sv_testpaperinfo.`RIGHT`, | |
204 | + sv_paperquestion.RANK | |
205 | + FROM | |
206 | + sv_testpaperinfo | |
207 | + LEFT JOIN sv_paperquestion ON sv_testpaperinfo.QUESTION_ID = sv_paperquestion.QUESTION_ID | |
208 | + WHERE | |
209 | + sv_testpaperinfo.STUDENT_ID = #{STUDENT_ID} | |
210 | + AND sv_testpaperinfo.TEST_ID = #{TEST_ID} | |
211 | + ORDER BY | |
212 | + sv_paperquestion.RANK | |
213 | + </select> | |
214 | + | |
197 | 215 | |
198 | 216 | <!-- 批量删除 --> |
199 | 217 | <delete id="deleteAll" parameterType="String"> | ... | ... |
src/com/fh/controller/sunvote/report/ReportController.java
1 | 1 | package com.fh.controller.sunvote.report; |
2 | 2 | |
3 | +import java.util.ArrayList; | |
4 | +import java.util.Collections; | |
5 | +import java.util.Comparator; | |
3 | 6 | import java.util.List; |
4 | 7 | |
5 | 8 | import javax.annotation.Resource; |
... | ... | @@ -15,6 +18,7 @@ import com.fh.service.sunvote.sclass.SClassManager; |
15 | 18 | import com.fh.service.sunvote.student.StudentManager; |
16 | 19 | import com.fh.service.sunvote.studenttest.StudentTestManager; |
17 | 20 | import com.fh.service.sunvote.testpaper.TestPaperManager; |
21 | +import com.fh.service.sunvote.testpaperinfo.TestPaperInfoManager; | |
18 | 22 | import com.fh.util.Jurisdiction; |
19 | 23 | import com.fh.util.PageData; |
20 | 24 | |
... | ... | @@ -34,6 +38,9 @@ public class ReportController extends BaseController { |
34 | 38 | @Resource(name="studenttestService") |
35 | 39 | private StudentTestManager studenttestService; |
36 | 40 | |
41 | + @Resource(name="testpaperinfoService") | |
42 | + private TestPaperInfoManager testpaperinfoService; | |
43 | + | |
37 | 44 | |
38 | 45 | |
39 | 46 | @RequestMapping(value="/report") |
... | ... | @@ -126,13 +133,13 @@ public class ReportController extends BaseController { |
126 | 133 | List<PageData> testpaperList = testpaperService.listAll(pd); |
127 | 134 | pd.put("ID", pd.get("CLASS_ID")); |
128 | 135 | PageData classPageData = sclassService.findById(pd); |
129 | - int totalScore = 0 ; | |
130 | - int avgScore = 0; | |
136 | + float totalScore = 0 ; | |
137 | + float avgScore = 0; | |
131 | 138 | for(PageData testPaperPageData:testpaperList){ |
132 | 139 | String totalScoreStr = testPaperPageData.getString("TOTAL_SCORE"); |
133 | 140 | if(totalScoreStr != null){ |
134 | 141 | try{ |
135 | - totalScore += Integer.parseInt(totalScoreStr); | |
142 | + totalScore += Float.parseFloat(totalScoreStr); | |
136 | 143 | }catch(Exception ex){ |
137 | 144 | logger.info(ex); |
138 | 145 | } |
... | ... | @@ -140,15 +147,15 @@ public class ReportController extends BaseController { |
140 | 147 | String avgScoreStr = testPaperPageData.getString("AVG_SCORE"); |
141 | 148 | if(avgScoreStr != null){ |
142 | 149 | try{ |
143 | - avgScore += Integer.parseInt(avgScoreStr); | |
150 | + avgScore += Float.parseFloat(avgScoreStr); | |
144 | 151 | }catch(Exception ex){ |
145 | 152 | logger.info(ex); |
146 | 153 | } |
147 | 154 | } |
148 | 155 | |
149 | 156 | } |
150 | - int allGetScore = 0; | |
151 | - int maxScore = 0 ; | |
157 | + float allGetScore = 0; | |
158 | + float maxScore = 0 ; | |
152 | 159 | // 查询学生名单及人数 |
153 | 160 | if(studentList != null && studentList.size() > 0){ |
154 | 161 | for(PageData studentPageData : studentList){ |
... | ... | @@ -163,12 +170,12 @@ public class ReportController extends BaseController { |
163 | 170 | List<PageData> studentTestList = studenttestService.reportListData(search); |
164 | 171 | studentPageData.put("testList", studentTestList); |
165 | 172 | |
166 | - int getScore = 0 ; | |
173 | + float getScore = 0 ; | |
167 | 174 | for(PageData studentTestPageData:studentTestList){ |
168 | 175 | String getScoreStr = studentTestPageData.getString("SCORE"); |
169 | 176 | if(getScoreStr != null){ |
170 | 177 | try{ |
171 | - getScore += Integer.parseInt(getScoreStr); | |
178 | + getScore += Float.parseFloat(getScoreStr); | |
172 | 179 | }catch(Exception ex){ |
173 | 180 | logger.info(ex); |
174 | 181 | } |
... | ... | @@ -212,6 +219,79 @@ public class ReportController extends BaseController { |
212 | 219 | public ModelAndView paper_report() throws Exception{ |
213 | 220 | logBefore(logger, Jurisdiction.getUsername()+"测试试卷报表"); |
214 | 221 | ModelAndView mv = this.getModelAndView(); |
222 | + PageData pd = getPageData(); | |
223 | + | |
224 | + // 查询班级信息 | |
225 | + pd.put("ID", pd.get("CLASS_ID")); | |
226 | + PageData classPageData = sclassService.findById(pd); | |
227 | + | |
228 | + // 查询测试试卷信息 | |
229 | + pd.put("TESTPAPER_ID", pd.get("TESTID")); | |
230 | + PageData testpaperPd = testpaperService.findById(pd); | |
231 | + | |
232 | + // 查询班级学生 | |
233 | + List<PageData> studentList = studentService.listAllClass(pd); | |
234 | + List<Integer> questionList = new ArrayList<Integer>(); | |
235 | + for(PageData studentPd : studentList){ | |
236 | + | |
237 | + // 查询答题情况 | |
238 | + studentPd.put("TEST_ID", pd.getString("TESTID")); | |
239 | + studentPd.put("STUDENT_ID", studentPd.getString("ID")); | |
240 | + List<PageData> detail = testpaperinfoService.reportPaperDetail(studentPd); | |
241 | + studentPd.put("detail", detail); | |
242 | + | |
243 | + float score = 0 ; | |
244 | + for(int i = 0 ; i < detail.size(); i++){ | |
245 | + PageData pad = detail.get(i); | |
246 | + if("1".equals(pad.getString("RIGHT"))){ | |
247 | + if (questionList.size() > i) { | |
248 | + questionList.set(i, questionList.get(i) + 1); | |
249 | + }else{ | |
250 | + questionList.add(1); | |
251 | + } | |
252 | + } | |
253 | + | |
254 | + String scoreStr = pad.getString("SCORE"); | |
255 | + | |
256 | + try{ | |
257 | + score += Float.parseFloat(scoreStr); | |
258 | + }catch(Exception ex){ | |
259 | + ex.printStackTrace(); | |
260 | + } | |
261 | + | |
262 | + } | |
263 | + studentPd.put("GETSCORE", score); | |
264 | + } | |
265 | + | |
266 | + | |
267 | + Collections.sort(studentList,new Comparator<PageData>(){ | |
268 | + | |
269 | + @Override | |
270 | + public int compare(PageData o1, PageData o2) { | |
271 | + String o1GetScore = o1.getString("GETSCORE"); | |
272 | + String o2GetScore = o2.getString("GETSCORE"); | |
273 | + float o1score = 0 ; | |
274 | + float o2score = 0 ; | |
275 | + try{ | |
276 | + o1score = Float.parseFloat(o1GetScore); | |
277 | + }catch(Exception e){ | |
278 | + o1score = -1 ; | |
279 | + } | |
280 | + try{ | |
281 | + o2score = Float.parseFloat(o2GetScore); | |
282 | + }catch(Exception e){ | |
283 | + o2score = -1 ; | |
284 | + } | |
285 | + return o2score - o1score > 0 ? 1 : -1; | |
286 | + } | |
287 | + | |
288 | + }); | |
289 | + | |
290 | + classPageData.put("studentNum", studentList.size()); | |
291 | + mv.addObject("classInfo", classPageData); | |
292 | + mv.addObject("testpaperInfo", testpaperPd); | |
293 | + mv.addObject("questionInfo", questionList); | |
294 | + mv.addObject("studentInfo", studentList); | |
215 | 295 | |
216 | 296 | mv.setViewName("sunvote/teacher/teacher_report_test"); |
217 | 297 | return mv; | ... | ... |
src/com/fh/service/sunvote/testpaperinfo/TestPaperInfoManager.java
... | ... | @@ -48,6 +48,11 @@ public interface TestPaperInfoManager{ |
48 | 48 | * @throws Exception |
49 | 49 | */ |
50 | 50 | public List<PageData> listAll(PageData pd)throws Exception; |
51 | + /**列表(全部) | |
52 | + * @param pd | |
53 | + * @throws Exception | |
54 | + */ | |
55 | + public List<PageData> reportPaperDetail(PageData pd)throws Exception; | |
51 | 56 | |
52 | 57 | /**通过id获取数据 |
53 | 58 | * @param pd | ... | ... |
src/com/fh/service/sunvote/testpaperinfo/impl/TestPaperInfoService.java
... | ... | @@ -68,6 +68,14 @@ public class TestPaperInfoService implements TestPaperInfoManager{ |
68 | 68 | public List<PageData> listAll(PageData pd)throws Exception{ |
69 | 69 | return (List<PageData>)dao.findForList("TestPaperInfoMapper.listAll", pd); |
70 | 70 | } |
71 | + /**列表(全部) | |
72 | + * @param pd | |
73 | + * @throws Exception | |
74 | + */ | |
75 | + @SuppressWarnings("unchecked") | |
76 | + public List<PageData> reportPaperDetail(PageData pd)throws Exception{ | |
77 | + return (List<PageData>)dao.findForList("TestPaperInfoMapper.reportPaperDetail", pd); | |
78 | + } | |
71 | 79 | |
72 | 80 | /**通过id获取数据 |
73 | 81 | * @param pd | ... | ... |
src/com/fh/util/PageData.java
... | ... | @@ -87,7 +87,11 @@ public class PageData extends HashMap implements Map{ |
87 | 87 | } |
88 | 88 | |
89 | 89 | public String getString(Object key) { |
90 | - return (String)get(key); | |
90 | + Object obj = get(key); | |
91 | + if(obj != null){ | |
92 | + return obj.toString(); | |
93 | + } | |
94 | + return ""; | |
91 | 95 | } |
92 | 96 | |
93 | 97 | @SuppressWarnings("unchecked") | ... | ... |