Commit 066f76730106262acf2e23801cf7bb45064beb57

Authored by 孙向锦
1 parent 4d39642d

修复bug

WebRoot/WEB-INF/jsp/sunvote/teacher/creat_question.jsp
@@ -203,7 +203,7 @@ @@ -203,7 +203,7 @@
203 </div><!-- /.modal-content --> 203 </div><!-- /.modal-content -->
204 </div><!-- /.modal-dialog --> 204 </div><!-- /.modal-dialog -->
205 </div><!-- /.modal --> 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 <img src="../static/images/loading.gif" width="200px" style="position:absolute;top:0;bottom:0;left:0;right:0;margin:auto;"/> 207 <img src="../static/images/loading.gif" width="200px" style="position:absolute;top:0;bottom:0;left:0;right:0;margin:auto;"/>
208 </div> 208 </div>
209 <script> 209 <script>
WebRoot/WEB-INF/jsp/sunvote/teacher/teacher_main.jsp
@@ -98,7 +98,7 @@ @@ -98,7 +98,7 @@
98 </div> 98 </div>
99 </c:forEach> 99 </c:forEach>
100 <div class="test">测验</div> 100 <div class="test">测验</div>
101 - <div class="analysis">分析</div> 101 + <!-- <div class="analysis">分析</div> -->
102 </div> 102 </div>
103 <div style="width:70%;height:100%;margin-left:30%;" class="content_r"> 103 <div style="width:70%;height:100%;margin-left:30%;" class="content_r">
104 <iframe name="mainFrame" id="mainFrame" frameborder="0" src="paper/list2.do?" ></iframe> 104 <iframe name="mainFrame" id="mainFrame" frameborder="0" src="paper/list2.do?" ></iframe>
@@ -212,9 +212,9 @@ @@ -212,9 +212,9 @@
212 var path = "student/listcs.do?class_id=" + classID + "&term_id=" + termID ; 212 var path = "student/listcs.do?class_id=" + classID + "&term_id=" + termID ;
213 $(".content_r").html('<iframe name="mainFrame" id="mainFrame" frameborder="0" style="width:100%;height:'+$(".content_l").height()+'px;" src=' + path + '></iframe>'); 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 $(".content_r").html('<img src="static/images/analysis.png" width="100%" />'); 216 $(".content_r").html('<img src="static/images/analysis.png" width="100%" />');
217 - }) 217 + }) */
218 </script> 218 </script>
219 219
220 </body> 220 </body>
WebRoot/WEB-INF/jsp/sunvote/teacher/teacher_report_test.jsp
@@ -33,15 +33,15 @@ @@ -33,15 +33,15 @@
33 <input type="hidden" name="CLASSID" id="CLASSID" value="${info.CLASS_ID}" /> 33 <input type="hidden" name="CLASSID" id="CLASSID" value="${info.CLASS_ID}" />
34 <table style="margin-top:5px;"> 34 <table style="margin-top:5px;">
35 <tr> 35 <tr>
36 - <td>试卷名称: ${info.testsize}</td> 36 + <td>试卷名称: ${testpaperInfo.NAME}</td>
37 </tr> 37 </tr>
38 <tr> 38 <tr>
39 - <td>收卷时间: ${info.CLASS_NAME}</td> 39 + <td>收卷时间: ${testpaperInfo.END_DATE}</td>
40 </tr> 40 </tr>
41 <tr> 41 <tr>
42 - <td>班级名册:${info.CLASS_NAME}</td> 42 + <td>班级名册:${classInfo.CLASS_NAME}</td>
43 <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td> 43 <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
44 - <td><span>学生人数: ${info.STUDENT_NUM}</span></td> 44 + <td><span>学生人数: ${classInfo.studentNum}</span></td>
45 45
46 </tr> 46 </tr>
47 </table> 47 </table>
@@ -56,8 +56,8 @@ @@ -56,8 +56,8 @@
56 <th class="center">得分</th> 56 <th class="center">得分</th>
57 <th class="center">正确率</th> 57 <th class="center">正确率</th>
58 <th class="center">排名</th> 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 </c:forEach> 61 </c:forEach>
62 <th class="center">非选择题得分</th> 62 <th class="center">非选择题得分</th>
63 <th class="center">总分</th> 63 <th class="center">总分</th>
@@ -71,28 +71,30 @@ @@ -71,28 +71,30 @@
71 <td class="center"></td> 71 <td class="center"></td>
72 <td class="center"></td> 72 <td class="center"></td>
73 <td class="center"></td> 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 </c:forEach> 78 </c:forEach>
77 <td class="center"></td> 79 <td class="center"></td>
78 <td class="center"></td> 80 <td class="center"></td>
79 </tr> 81 </tr>
80 82
81 <c:choose> 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 <tr> 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 </c:forEach> 95 </c:forEach>
  96 + <td class="center">${var.OTHER_SCORE}</td>
  97 + <td class="center">${var.GETSCORE}</td>
96 </tr> 98 </tr>
97 </c:forEach> 99 </c:forEach>
98 </c:when> 100 </c:when>
WebRoot/WEB-INF/jsp/system/index/head.jsp
@@ -65,7 +65,7 @@ @@ -65,7 +65,7 @@
65 <!-- <li> 65 <!-- <li>
66 <a onclick="editPhoto();" style="cursor:pointer;"><i class="ace-icon glyphicon glyphicon-picture"></i>修改头像</a>editUserH()在 WebRoot\static\js\myjs\head.js中 66 <a onclick="editPhoto();" style="cursor:pointer;"><i class="ace-icon glyphicon glyphicon-picture"></i>修改头像</a>editUserH()在 WebRoot\static\js\myjs\head.js中
67 </li> --> 67 </li> -->
68 - <li> 68 + <li style="display:none">
69 <a onclick="editUserH();" style="cursor:pointer;"><i class="ace-icon fa fa-user"></i>修改资料</a><!-- editUserH()在 WebRoot\static\js\myjs\head.js中 --> 69 <a onclick="editUserH();" style="cursor:pointer;"><i class="ace-icon fa fa-user"></i>修改资料</a><!-- editUserH()在 WebRoot\static\js\myjs\head.js中 -->
70 </li> 70 </li>
71 <li id="systemset" style="display:none" > 71 <li id="systemset" style="display:none" >
WebRoot/static/js/control1.js
@@ -9,8 +9,12 @@ @@ -9,8 +9,12 @@
9 if (r != null) return unescape(r[2]); return null; 9 if (r != null) return unescape(r[2]); return null;
10 } 10 }
11 function getData(startDate,endDate){ 11 function getData(startDate,endDate){
  12 + var attend = "" ;
  13 + if(startDate != null && endDate != null){
  14 + attend = "&start_Date="+startDate+"&end_Date="+endDate;
  15 + }
12 $.ajax({ 16 $.ajax({
13 - url:URL+"&start_Date="+startDate+"&end_Date="+endDate, 17 + url:URL+ attend,
14 type:"get", 18 type:"get",
15 async:false, 19 async:false,
16 dataType:"json", 20 dataType:"json",
resources/mybatis1/sunvote/TestPaperInfoMapper.xml
@@ -194,6 +194,24 @@ @@ -194,6 +194,24 @@
194 </if> 194 </if>
195 </select> 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 <delete id="deleteAll" parameterType="String"> 217 <delete id="deleteAll" parameterType="String">
src/com/fh/controller/sunvote/report/ReportController.java
1 package com.fh.controller.sunvote.report; 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 import java.util.List; 6 import java.util.List;
4 7
5 import javax.annotation.Resource; 8 import javax.annotation.Resource;
@@ -15,6 +18,7 @@ import com.fh.service.sunvote.sclass.SClassManager; @@ -15,6 +18,7 @@ import com.fh.service.sunvote.sclass.SClassManager;
15 import com.fh.service.sunvote.student.StudentManager; 18 import com.fh.service.sunvote.student.StudentManager;
16 import com.fh.service.sunvote.studenttest.StudentTestManager; 19 import com.fh.service.sunvote.studenttest.StudentTestManager;
17 import com.fh.service.sunvote.testpaper.TestPaperManager; 20 import com.fh.service.sunvote.testpaper.TestPaperManager;
  21 +import com.fh.service.sunvote.testpaperinfo.TestPaperInfoManager;
18 import com.fh.util.Jurisdiction; 22 import com.fh.util.Jurisdiction;
19 import com.fh.util.PageData; 23 import com.fh.util.PageData;
20 24
@@ -34,6 +38,9 @@ public class ReportController extends BaseController { @@ -34,6 +38,9 @@ public class ReportController extends BaseController {
34 @Resource(name="studenttestService") 38 @Resource(name="studenttestService")
35 private StudentTestManager studenttestService; 39 private StudentTestManager studenttestService;
36 40
  41 + @Resource(name="testpaperinfoService")
  42 + private TestPaperInfoManager testpaperinfoService;
  43 +
37 44
38 45
39 @RequestMapping(value="/report") 46 @RequestMapping(value="/report")
@@ -126,13 +133,13 @@ public class ReportController extends BaseController { @@ -126,13 +133,13 @@ public class ReportController extends BaseController {
126 List<PageData> testpaperList = testpaperService.listAll(pd); 133 List<PageData> testpaperList = testpaperService.listAll(pd);
127 pd.put("ID", pd.get("CLASS_ID")); 134 pd.put("ID", pd.get("CLASS_ID"));
128 PageData classPageData = sclassService.findById(pd); 135 PageData classPageData = sclassService.findById(pd);
129 - int totalScore = 0 ;  
130 - int avgScore = 0; 136 + float totalScore = 0 ;
  137 + float avgScore = 0;
131 for(PageData testPaperPageData:testpaperList){ 138 for(PageData testPaperPageData:testpaperList){
132 String totalScoreStr = testPaperPageData.getString("TOTAL_SCORE"); 139 String totalScoreStr = testPaperPageData.getString("TOTAL_SCORE");
133 if(totalScoreStr != null){ 140 if(totalScoreStr != null){
134 try{ 141 try{
135 - totalScore += Integer.parseInt(totalScoreStr); 142 + totalScore += Float.parseFloat(totalScoreStr);
136 }catch(Exception ex){ 143 }catch(Exception ex){
137 logger.info(ex); 144 logger.info(ex);
138 } 145 }
@@ -140,15 +147,15 @@ public class ReportController extends BaseController { @@ -140,15 +147,15 @@ public class ReportController extends BaseController {
140 String avgScoreStr = testPaperPageData.getString("AVG_SCORE"); 147 String avgScoreStr = testPaperPageData.getString("AVG_SCORE");
141 if(avgScoreStr != null){ 148 if(avgScoreStr != null){
142 try{ 149 try{
143 - avgScore += Integer.parseInt(avgScoreStr); 150 + avgScore += Float.parseFloat(avgScoreStr);
144 }catch(Exception ex){ 151 }catch(Exception ex){
145 logger.info(ex); 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 if(studentList != null && studentList.size() > 0){ 160 if(studentList != null && studentList.size() > 0){
154 for(PageData studentPageData : studentList){ 161 for(PageData studentPageData : studentList){
@@ -163,12 +170,12 @@ public class ReportController extends BaseController { @@ -163,12 +170,12 @@ public class ReportController extends BaseController {
163 List<PageData> studentTestList = studenttestService.reportListData(search); 170 List<PageData> studentTestList = studenttestService.reportListData(search);
164 studentPageData.put("testList", studentTestList); 171 studentPageData.put("testList", studentTestList);
165 172
166 - int getScore = 0 ; 173 + float getScore = 0 ;
167 for(PageData studentTestPageData:studentTestList){ 174 for(PageData studentTestPageData:studentTestList){
168 String getScoreStr = studentTestPageData.getString("SCORE"); 175 String getScoreStr = studentTestPageData.getString("SCORE");
169 if(getScoreStr != null){ 176 if(getScoreStr != null){
170 try{ 177 try{
171 - getScore += Integer.parseInt(getScoreStr); 178 + getScore += Float.parseFloat(getScoreStr);
172 }catch(Exception ex){ 179 }catch(Exception ex){
173 logger.info(ex); 180 logger.info(ex);
174 } 181 }
@@ -212,6 +219,79 @@ public class ReportController extends BaseController { @@ -212,6 +219,79 @@ public class ReportController extends BaseController {
212 public ModelAndView paper_report() throws Exception{ 219 public ModelAndView paper_report() throws Exception{
213 logBefore(logger, Jurisdiction.getUsername()+"测试试卷报表"); 220 logBefore(logger, Jurisdiction.getUsername()+"测试试卷报表");
214 ModelAndView mv = this.getModelAndView(); 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 mv.setViewName("sunvote/teacher/teacher_report_test"); 296 mv.setViewName("sunvote/teacher/teacher_report_test");
217 return mv; 297 return mv;
src/com/fh/service/sunvote/testpaperinfo/TestPaperInfoManager.java
@@ -48,6 +48,11 @@ public interface TestPaperInfoManager{ @@ -48,6 +48,11 @@ public interface TestPaperInfoManager{
48 * @throws Exception 48 * @throws Exception
49 */ 49 */
50 public List<PageData> listAll(PageData pd)throws Exception; 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 /**通过id获取数据 57 /**通过id获取数据
53 * @param pd 58 * @param pd
src/com/fh/service/sunvote/testpaperinfo/impl/TestPaperInfoService.java
@@ -68,6 +68,14 @@ public class TestPaperInfoService implements TestPaperInfoManager{ @@ -68,6 +68,14 @@ public class TestPaperInfoService implements TestPaperInfoManager{
68 public List<PageData> listAll(PageData pd)throws Exception{ 68 public List<PageData> listAll(PageData pd)throws Exception{
69 return (List<PageData>)dao.findForList("TestPaperInfoMapper.listAll", pd); 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 /**通过id获取数据 80 /**通过id获取数据
73 * @param pd 81 * @param pd
src/com/fh/util/PageData.java
@@ -87,7 +87,11 @@ public class PageData extends HashMap implements Map{ @@ -87,7 +87,11 @@ public class PageData extends HashMap implements Map{
87 } 87 }
88 88
89 public String getString(Object key) { 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 @SuppressWarnings("unchecked") 97 @SuppressWarnings("unchecked")