Commit d6389252117de03e8f7c0f71a734d883c277ab2c

Authored by jack
1 parent f4a73594

1.增加年级卷测验统计

WebRoot/WEB-INF/jsp/sunvote/paper/test_list1.jsp
... ... @@ -86,36 +86,100 @@
86 86 <c:forEach items="${varList}" var="var" varStatus="vs">
87 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 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 129 <td >
96 130 <fmt:formatNumber type="number"
97 131 value="${var.student_num == 0 ? 0: (var.you / var.student_num * 100)}"
98 132 maxFractionDigits="2" />%
99 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 143 <td >
102 144 <fmt:formatNumber type="number"
103 145 value="${var.student_num == 0 ? 0: (var.liang / var.student_num * 100)}"
104 146 maxFractionDigits="2" />%
105 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 156 <td >
108 157 <fmt:formatNumber type="number"
109 158 value="${var.student_num == 0 ? 0: (var.jige / var.student_num * 100)}"
110 159 maxFractionDigits="2" />%
111 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 169 <td >
114 170 <fmt:formatNumber type="number"
115 171 value="${var.student_num == 0 ? 0: (var.difen / var.student_num * 100)}"
116 172 maxFractionDigits="2" />%
117 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 183 </tr>
120 184  
121 185 </c:forEach>
... ...
resources/mybatis1/sunvote/TestPaperInfoMapper.xml
... ... @@ -230,7 +230,11 @@
230 230 <include refid="tableName"></include>
231 231 where 1 =1
232 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 238 </if>
235 239 <if test="STUDENT_ID != null and STUDENT_ID != ''">
236 240 and STUDENT_ID = #{STUDENT_ID}
... ...
src/com/fh/controller/sunvote/paper/PaperController.java
... ... @@ -198,6 +198,7 @@ public class PaperController extends BaseController {
198 198 PageData pd = new PageData();
199 199 List<PageData> templist = new ArrayList<PageData>();
200 200 PageData saveData = new PageData();
  201 + DecimalFormat decimalFormat=new DecimalFormat("0.00");
201 202  
202 203 ResponseGson<PageData> res = new ResponseGson();
203 204 pd = this.getPageData();
... ... @@ -205,12 +206,21 @@ public class PaperController extends BaseController {
205 206 List<PageData> list = testpaperService.listAll(pd);
206 207  
207 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 217 for(int i = 0 ;i<list.size();i++){
209 218 PageData data = new PageData();
210 219  
211 220 PageData pdtemp = new PageData();
212 221 pdtemp.put("CLASS_ID", list.get(i).get("SCLASS_ID").toString());
213 222 List<PageData> studentlist = stundentService.listAllClass(pdtemp);
  223 + testpaperList+=list.get(i).get("TESTPAPER_ID").toString()+",";
214 224 data.put("testpaper_id", list.get(i).get("TESTPAPER_ID"));
215 225 data.put("student_num", studentlist.size());
216 226 data.put("creat_time", list.get(i).get("CREATE_DATE"));
... ... @@ -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 260 data.put("you",you);
245 261 data.put("liang",liang);
... ... @@ -248,7 +264,24 @@ public class PaperController extends BaseController {
248 264  
249 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 285 saveData.put("list", templist);
253 286  
254 287 mv.setViewName("sunvote/paper/test_list1");
... ... @@ -265,6 +298,7 @@ public class PaperController extends BaseController {
265 298 List<PageData> templist = new ArrayList<PageData>();
266 299 PageData saveData = new PageData();
267 300  
  301 +
268 302 ResponseGson<PageData> res = new ResponseGson();
269 303 pd = this.getPageData();
270 304 if(pd.containsKey("PAPER_ID")){
... ... @@ -402,8 +436,11 @@ public class PaperController extends BaseController {
402 436 option_num = Integer.valueOf(que.get("OPTION_NUM").toString());
403 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 444 List<PageData> queInfo = testpaperinfoService.listTestPaperQuestionIDinfo(temp);
408 445 int answer[] = new int[option_num+1];
409 446 int right = 0;
... ... @@ -487,7 +524,10 @@ public class PaperController extends BaseController {
487 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 531 List<PageData> queInfo = testpaperinfoService.listTestPaperQuestionIDinfo(temp);
492 532 int answer[] = new int[option_num+1];
493 533 int right = 0;
... ...