Commit d6389252117de03e8f7c0f71a734d883c277ab2c

Authored by jack
1 parent f4a73594

1.增加年级卷测验统计

WebRoot/WEB-INF/jsp/sunvote/paper/test_list1.jsp
@@ -86,36 +86,100 @@ @@ -86,36 +86,100 @@
86 <c:forEach items="${varList}" var="var" varStatus="vs"> 86 <c:forEach items="${varList}" var="var" varStatus="vs">
87 <tr> 87 <tr>
88 88
89 - <td>${vs.index+1}</td>  
90 - <td>${myelfun:findClassName(var.class_id)}</td>  
91 - <td >${var.creat_time}</td> 89 + <td>
  90 + <c:if test="${not empty var.class_id }">
  91 + ${vs.index+1}
  92 + </c:if>
  93 + <c:if test="${empty var.class_id }">
  94 + /
  95 + </c:if>
  96 + </td>
  97 + <td>
  98 + <c:if test="${not empty var.class_id }">
  99 + ${myelfun:findClassName(var.class_id)}
  100 + </c:if>
  101 + <c:if test="${empty var.class_id }">
  102 + 年级平均
  103 + </c:if>
  104 + </td>
  105 + <td >
  106 + <c:if test="${not empty var.class_id }">
  107 + ${var.creat_time}
  108 + </c:if>
  109 + <c:if test="${empty var.class_id }">
  110 + /
  111 + </c:if>
  112 + </td>
92 <td >${var.avg_score}</td> 113 <td >${var.avg_score}</td>
93 - <td >${var.student_num}</td>  
94 - <td >${var.you}</td> 114 + <td >
  115 + <c:if test="${not empty var.class_id }">
  116 + ${var.student_num}
  117 + </c:if>
  118 + <c:if test="${empty var.class_id }">
  119 + /
  120 + </c:if>
  121 + <td >
  122 + <c:if test="${not empty var.class_id }">
  123 + ${var.you}
  124 + </c:if>
  125 + <c:if test="${empty var.class_id }">
  126 + /
  127 + </c:if>
  128 + </td>
95 <td > 129 <td >
96 <fmt:formatNumber type="number" 130 <fmt:formatNumber type="number"
97 value="${var.student_num == 0 ? 0: (var.you / var.student_num * 100)}" 131 value="${var.student_num == 0 ? 0: (var.you / var.student_num * 100)}"
98 maxFractionDigits="2" />% 132 maxFractionDigits="2" />%
99 </td> 133 </td>
100 - <td >${var.liang}</td> 134 + <td >
  135 + <c:if test="${not empty var.class_id }">
  136 + ${var.liang}
  137 + </c:if>
  138 + <c:if test="${empty var.class_id }">
  139 + /
  140 + </c:if>
  141 +
  142 + </td>
101 <td > 143 <td >
102 <fmt:formatNumber type="number" 144 <fmt:formatNumber type="number"
103 value="${var.student_num == 0 ? 0: (var.liang / var.student_num * 100)}" 145 value="${var.student_num == 0 ? 0: (var.liang / var.student_num * 100)}"
104 maxFractionDigits="2" />% 146 maxFractionDigits="2" />%
105 </td> 147 </td>
106 - <td >${var.jige}</td> 148 + <td >
  149 + <c:if test="${not empty var.class_id }">
  150 + ${var.jige}
  151 + </c:if>
  152 + <c:if test="${empty var.class_id }">
  153 + /
  154 + </c:if>
  155 + </td>
107 <td > 156 <td >
108 <fmt:formatNumber type="number" 157 <fmt:formatNumber type="number"
109 value="${var.student_num == 0 ? 0: (var.jige / var.student_num * 100)}" 158 value="${var.student_num == 0 ? 0: (var.jige / var.student_num * 100)}"
110 maxFractionDigits="2" />% 159 maxFractionDigits="2" />%
111 </td> 160 </td>
112 - <td >${var.difen}</td> 161 + <td >
  162 + <c:if test="${not empty var.class_id }">
  163 + ${var.difen}
  164 + </c:if>
  165 + <c:if test="${empty var.class_id }">
  166 + /
  167 + </c:if>
  168 + </td>
113 <td > 169 <td >
114 <fmt:formatNumber type="number" 170 <fmt:formatNumber type="number"
115 value="${var.student_num == 0 ? 0: (var.difen / var.student_num * 100)}" 171 value="${var.student_num == 0 ? 0: (var.difen / var.student_num * 100)}"
116 maxFractionDigits="2" />% 172 maxFractionDigits="2" />%
117 </td> 173 </td>
118 - <td ><a href="<%=basePath%>paper/paperRep2.do?PAPER_ID=${pd.PAPER_ID}&TESTPAPER_ID=${var.testpaper_id}">查看成绩</a></td> 174 + <td >
  175 +
  176 + <c:if test="${not empty var.class_id }">
  177 + <a href="<%=basePath%>paper/paperRep2.do?PAPER_ID=${pd.PAPER_ID}&TESTPAPER_ID=${var.testpaper_id}">查看成绩</a>
  178 + </c:if>
  179 + <c:if test="${empty var.class_id }">
  180 + <a href="<%=basePath%>paper/paperRep2.do?PAPER_ID=${pd.PAPER_ID}&TESTPAPER_ID=${var.testpaperList}">查看成绩</a>
  181 + </c:if>
  182 + </td>
119 </tr> 183 </tr>
120 184
121 </c:forEach> 185 </c:forEach>
resources/mybatis1/sunvote/TestPaperInfoMapper.xml
@@ -230,7 +230,11 @@ @@ -230,7 +230,11 @@
230 <include refid="tableName"></include> 230 <include refid="tableName"></include>
231 where 1 =1 231 where 1 =1
232 <if test="TEST_ID != null and TEST_ID != ''"> 232 <if test="TEST_ID != null and TEST_ID != ''">
233 - and TEST_ID = #{TEST_ID} 233 + <!--and TEST_ID = #{TEST_ID}-->
  234 + and TEST_ID in
  235 + <foreach item="TEST_ID" index="index" collection="TEST_ID" open="(" separator="," close=")">
  236 + #{TEST_ID}
  237 + </foreach>
234 </if> 238 </if>
235 <if test="STUDENT_ID != null and STUDENT_ID != ''"> 239 <if test="STUDENT_ID != null and STUDENT_ID != ''">
236 and STUDENT_ID = #{STUDENT_ID} 240 and STUDENT_ID = #{STUDENT_ID}
src/com/fh/controller/sunvote/paper/PaperController.java
@@ -198,6 +198,7 @@ public class PaperController extends BaseController { @@ -198,6 +198,7 @@ public class PaperController extends BaseController {
198 PageData pd = new PageData(); 198 PageData pd = new PageData();
199 List<PageData> templist = new ArrayList<PageData>(); 199 List<PageData> templist = new ArrayList<PageData>();
200 PageData saveData = new PageData(); 200 PageData saveData = new PageData();
  201 + DecimalFormat decimalFormat=new DecimalFormat("0.00");
201 202
202 ResponseGson<PageData> res = new ResponseGson(); 203 ResponseGson<PageData> res = new ResponseGson();
203 pd = this.getPageData(); 204 pd = this.getPageData();
@@ -205,12 +206,21 @@ public class PaperController extends BaseController { @@ -205,12 +206,21 @@ public class PaperController extends BaseController {
205 List<PageData> list = testpaperService.listAll(pd); 206 List<PageData> list = testpaperService.listAll(pd);
206 207
207 pd.put("testpaperlist", list); 208 pd.put("testpaperlist", list);
  209 + Integer you_sum = 0; //优秀总人数
  210 + Integer liang_sum = 0; //良好总人数
  211 + Integer jige_sum = 0; //及格总人数
  212 + Integer difen_sum = 0; //低分总人数
  213 + Integer num_sum =0; //年级总人数
  214 + Float avg_sum = (float)0; //平均分的和
  215 + String testpaperList = "";
  216 +
208 for(int i = 0 ;i<list.size();i++){ 217 for(int i = 0 ;i<list.size();i++){
209 PageData data = new PageData(); 218 PageData data = new PageData();
210 219
211 PageData pdtemp = new PageData(); 220 PageData pdtemp = new PageData();
212 pdtemp.put("CLASS_ID", list.get(i).get("SCLASS_ID").toString()); 221 pdtemp.put("CLASS_ID", list.get(i).get("SCLASS_ID").toString());
213 List<PageData> studentlist = stundentService.listAllClass(pdtemp); 222 List<PageData> studentlist = stundentService.listAllClass(pdtemp);
  223 + testpaperList+=list.get(i).get("TESTPAPER_ID").toString()+",";
214 data.put("testpaper_id", list.get(i).get("TESTPAPER_ID")); 224 data.put("testpaper_id", list.get(i).get("TESTPAPER_ID"));
215 data.put("student_num", studentlist.size()); 225 data.put("student_num", studentlist.size());
216 data.put("creat_time", list.get(i).get("CREATE_DATE")); 226 data.put("creat_time", list.get(i).get("CREATE_DATE"));
@@ -240,6 +250,12 @@ public class PaperController extends BaseController { @@ -240,6 +250,12 @@ public class PaperController extends BaseController {
240 } 250 }
241 251
242 } 252 }
  253 + you_sum+=you;
  254 + liang_sum += liang;
  255 + jige_sum+=jige;
  256 + difen_sum+=difen;
  257 + num_sum+=studentlist.size();
  258 + avg_sum+=Float.valueOf(list.get(i).get("AVG_SCORE").toString());
243 259
244 data.put("you",you); 260 data.put("you",you);
245 data.put("liang",liang); 261 data.put("liang",liang);
@@ -248,7 +264,24 @@ public class PaperController extends BaseController { @@ -248,7 +264,24 @@ public class PaperController extends BaseController {
248 264
249 templist.add(data); 265 templist.add(data);
250 } 266 }
  267 + if(list.size()>0){
  268 + PageData dataTemp = new PageData();
  269 + dataTemp.put("testpaper_id", "");
  270 + dataTemp.put("student_num", num_sum);
  271 + dataTemp.put("creat_time", "");
  272 + dataTemp.put("avg_score", decimalFormat.format(avg_sum/list.size()));
  273 + dataTemp.put("class_id", "");
  274 + dataTemp.put("you",you_sum);
  275 + dataTemp.put("liang",liang_sum);
  276 + dataTemp.put("jige",jige_sum);
  277 + dataTemp.put("difen",difen_sum);
  278 + dataTemp.put("testpaperList", testpaperList);
  279 + templist.add(dataTemp);
  280 + }
251 } 281 }
  282 +
  283 +
  284 +
252 saveData.put("list", templist); 285 saveData.put("list", templist);
253 286
254 mv.setViewName("sunvote/paper/test_list1"); 287 mv.setViewName("sunvote/paper/test_list1");
@@ -265,6 +298,7 @@ public class PaperController extends BaseController { @@ -265,6 +298,7 @@ public class PaperController extends BaseController {
265 List<PageData> templist = new ArrayList<PageData>(); 298 List<PageData> templist = new ArrayList<PageData>();
266 PageData saveData = new PageData(); 299 PageData saveData = new PageData();
267 300
  301 +
268 ResponseGson<PageData> res = new ResponseGson(); 302 ResponseGson<PageData> res = new ResponseGson();
269 pd = this.getPageData(); 303 pd = this.getPageData();
270 if(pd.containsKey("PAPER_ID")){ 304 if(pd.containsKey("PAPER_ID")){
@@ -402,8 +436,11 @@ public class PaperController extends BaseController { @@ -402,8 +436,11 @@ public class PaperController extends BaseController {
402 option_num = Integer.valueOf(que.get("OPTION_NUM").toString()); 436 option_num = Integer.valueOf(que.get("OPTION_NUM").toString());
403 onum[i]=option_num; 437 onum[i]=option_num;
404 } 438 }
405 -  
406 - temp.put("TEST_ID", pd.get("TESTPAPER_ID")); 439 + String tpList = pd.get("TESTPAPER_ID").toString();
  440 + String tpListArray[] = tpList.split(",");
  441 +
  442 + temp.put("TEST_ID", tpListArray);
  443 +
407 List<PageData> queInfo = testpaperinfoService.listTestPaperQuestionIDinfo(temp); 444 List<PageData> queInfo = testpaperinfoService.listTestPaperQuestionIDinfo(temp);
408 int answer[] = new int[option_num+1]; 445 int answer[] = new int[option_num+1];
409 int right = 0; 446 int right = 0;
@@ -487,7 +524,10 @@ public class PaperController extends BaseController { @@ -487,7 +524,10 @@ public class PaperController extends BaseController {
487 onum[i]=option_num; 524 onum[i]=option_num;
488 } 525 }
489 526
490 - temp.put("TEST_ID", pd.get("TESTPAPER_ID")); 527 + String tpList = pd.get("TESTPAPER_ID").toString();
  528 + String tpListArray[] = tpList.split(",");
  529 +
  530 + temp.put("TEST_ID", tpListArray);
491 List<PageData> queInfo = testpaperinfoService.listTestPaperQuestionIDinfo(temp); 531 List<PageData> queInfo = testpaperinfoService.listTestPaperQuestionIDinfo(temp);
492 int answer[] = new int[option_num+1]; 532 int answer[] = new int[option_num+1];
493 int right = 0; 533 int right = 0;