Commit 89ac078319c247013667c1315e7b9bfbac720b6d

Authored by jack
1 parent 58e024ae

1.添加年级卷分析功能

2.添加学生时增加学校id判断
WebRoot/WEB-INF/jsp/sunvote/paper/paper_list5.jsp
... ... @@ -57,15 +57,15 @@
57 57 </div>
58 58 <div style="padding:0 5%;background:#fff;">
59 59 <table class="table table-striped">
60   - <col style="width: 10%" />
  60 + <col style="width: 8%" />
61 61 <col style="width: 15%" />
62 62 <col style="width: 15%" />
63 63 <col style="width: 8%" />
64 64 <col style="width: 8%" />
65 65 <col style="width: 13%" />
66 66 <col style="width: 8%" />
67   - <col style="width: 8%" />
68   - <col style="width: 15%" />
  67 + <col style="width: 6%" />
  68 + <col style="width: 19%" />
69 69 <thead>
70 70 <tr>
71 71 <th><input type="checkbox" name='ids' id="ids" />序号</th>
... ... @@ -84,15 +84,15 @@
84 84 </div>
85 85 <div class="table_box">
86 86 <table class="table table-striped">
87   - <col style="width: 10%" />
  87 + <col style="width: 8%" />
88 88 <col style="width: 15%" />
89 89 <col style="width: 15%" />
90 90 <col style="width: 8%" />
91 91 <col style="width: 8%" />
92 92 <col style="width: 13%" />
93 93 <col style="width: 8%" />
94   - <col style="width: 8%" />
95   - <col style="width: 15%" />
  94 + <col style="width: 6%" />
  95 + <col style="width: 19%" />
96 96 <tbody>
97 97 <c:choose>
98 98 <c:when test="${not empty varList}">
... ... @@ -108,6 +108,7 @@
108 108 <td >${var.SCORE}</td>
109 109 <td>
110 110 <a <c:if test="${var.TEST_NUM == 0}" >disabled style="pointer-events:none;color:#ccc" </c:if> href="<%=basePath%>paper/paperRep.do?MB1=nj&paper_id=${var.PAPER_ID}">查看成绩</a>
  111 + <a href="<%=basePath%>paper/paperRep3.do?MB1=${pd.MB1 }&PAPER_ID=${var.PAPER_ID}">年级分析</a>
111 112 <a href="#" onclick="del('${var.PAPER_ID}');"><img src="../static/images/remove.png" /></a>
112 113 </td>
113 114 </tr>
... ...
WebRoot/WEB-INF/jsp/sunvote/paper/test_list1.jsp
... ... @@ -179,6 +179,7 @@
179 179 </c:if>
180 180 <c:if test="${empty var.class_id }">
181 181 <a href="<%=basePath%>paper/paperRep2.do?MB1=${pd.MB1 }&PAPER_ID=${pd.PAPER_ID}&TESTPAPER_ID=${var.testpaperList}">查看成绩</a>
  182 +
182 183 </c:if>
183 184 </td>
184 185 </tr>
... ...
WebRoot/WEB-INF/jsp/sunvote/paper/test_list3.jsp 0 → 100644
  1 +<%@ page language="java" contentType="text/html; charset=UTF-8"
  2 + pageEncoding="UTF-8"%>
  3 +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
  4 +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
  5 +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
  6 +<%@ taglib prefix="myelfun" uri="/WEB-INF/tld/elfun.tld"%>
  7 +<%
  8 + String path = request.getContextPath();
  9 + String basePath = request.getScheme() + "://"
  10 + + request.getServerName() + ":" + request.getServerPort() + path + "/";
  11 +%>
  12 +<html lang="zh-CN">
  13 +<head>
  14 +<meta charset="utf-8">
  15 +<meta http-equiv="X-UA-Compatible" content="IE=edge">
  16 +<meta name="viewport" content="width=device-width, initial-scale=1">
  17 +<title>教育管理系统</title>
  18 +
  19 +<!-- Bootstrap -->
  20 +<!-- <link
  21 + href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css"
  22 + rel="stylesheet"> -->
  23 + <link rel="stylesheet" href="../static/css/bootstrap.min.css" />
  24 +<link href="../static/css/teach.css" rel="stylesheet">
  25 +<link rel="stylesheet" href="../static/ace/css/datepicker.css" />
  26 +<link type="text/css" href="../static/css/tablescroller.css" rel="stylesheet" />
  27 +<script src="../static/js/loading.js"></script>
  28 +<script src="../static/js/remove.js?a=1"></script>
  29 +
  30 +
  31 +<!-- HTML5 shim 和 Respond.js 是为了让 IE8 支持 HTML5 元素和媒体查询(media queries)功能 -->
  32 +<!-- 警告:通过 file:// 协议(就是直接将 html 页面拖拽到浏览器中)访问页面时 Respond.js 不起作用 -->
  33 +<!--[if lt IE 9]>
  34 + <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  35 + <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
  36 + <![endif]-->
  37 +</head>
  38 +<body>
  39 +
  40 + <form action="../paper/list4.do" method="post" name="Form" id="Form">
  41 + <div class="head_box">
  42 + <div class="box_header">
  43 + <div class="head_box_l">
  44 + <p>
  45 + <span class="right_b"></span>试卷测验列表
  46 + </p>
  47 + </div>
  48 +
  49 + <div class="head_box_r">
  50 + <button type="button" class="btn btn-primary" onclick="window.history.go(-1)" autocomplete="off">返回</button>
  51 + <button type="button" class="btn btn-primary" onclick="export3()" autocomplete="off">导出</button>
  52 + </div>
  53 +
  54 + <div class="clear"></div>
  55 + </div>
  56 +
  57 + </div>
  58 + <div class="table_box" style="padding:0 5%;background:#fff;">
  59 + <div style="padding:15px 0;background:#fff;" class="paper_title">
  60 +
  61 + ${pd.MB1=="nj"?"年级卷":"个人卷"} > 班级对比 > 答题分析
  62 + <br/>
  63 + <br/>
  64 + <br/>
  65 + &nbsp;
  66 + <b>试卷名称:</b>${pd.PAPER_NAME}
  67 + <br>
  68 + <br>&nbsp;
  69 + <b>试卷总分:</b>${pd.SCORE}
  70 +
  71 +
  72 +
  73 + </div>
  74 + <table id="simple-table"
  75 + class="table table-striped table-bordered table-hover"
  76 + style="margin-top:0px;margin-bottom:0;">
  77 + <thead>
  78 + <tr>
  79 + <th><div style="width:80px;text-align:center">学生姓名</div></th>
  80 + <th><div style="width:80px;text-align:center">班级</div></th>
  81 + <th><div style="width:80px;text-align:center">综合排名</div></th>
  82 + <th><div style="width:100px;text-align:center">个人平均得分</div></th>
  83 + <th><div style="width:100px;text-align:center">个人平均得分率</div></th>
  84 + <th><div style="width:80px;text-align:center">个人得分</div></th>
  85 + <th><div style="width:80px;text-align:center">测验平均分</div></th>
  86 + <th><div style="width:80px;text-align:center">测验时间</div></th>
  87 + </tr>
  88 + </thead>
  89 + <tbody>
  90 + <c:choose>
  91 + <c:when test="${not empty varList}">
  92 + <c:forEach items="${varList}" var="var" varStatus="vs">
  93 + <c:set var="student_avg" value="${var.TEST_NUM==0?0:var.STUDENT_TOTAL/var.TEST_NUM}"></c:set>
  94 + <tr>
  95 + <td rowspan="${var.TEST_LIST.size()}" align="center">${var.STUDENT_NAME}</td>
  96 + <td rowspan="${var.TEST_LIST.size()}" align="center">${var.CLASS_NAME}</td>
  97 + <td rowspan="${var.TEST_LIST.size()}" align="center">${vs.index+1}</td>
  98 + <td rowspan="${var.TEST_LIST.size()}" align="center"><fmt:formatNumber type="number"
  99 + value="${student_avg}"
  100 + maxFractionDigits="2" /></td>
  101 + <td rowspan="${var.TEST_LIST.size()}" align="center"><fmt:formatNumber type="number"
  102 + value="${student_avg*100/pd.SCORE}"
  103 + maxFractionDigits="2" />%</td>
  104 + <c:forEach items="${var.TEST_LIST }" var ="var1" varStatus="vs1">
  105 + <c:if test="${!vs1.first}">
  106 + <tr>
  107 + </c:if>
  108 + <td>${var1.SCORE } </td>
  109 + <td>${var1.AVG_SCORE } </td>
  110 + <td>${var1.CREATE_DATE } </td>
  111 + </tr>
  112 + </c:forEach>
  113 + </c:forEach>
  114 + </c:when>
  115 + <c:otherwise>
  116 + <tr class="main_info">
  117 + <td colspan="100" class="center" >没有相关数据</td>
  118 + </tr>
  119 + </c:otherwise>
  120 + </c:choose>
  121 + </tbody>
  122 + </table>
  123 +
  124 +
  125 +
  126 + <div class="footer">
  127 + <!-- <div class="creat">
  128 + <input type="button" onclick="parent.$('.title_time').modal('show');" value="新建试卷" />
  129 + </div>
  130 + <div class="removeAll">
  131 + <input type="button" onclick="deleteAll()" value="批量删除" />
  132 + </div> -->
  133 + <div class="page_box">
  134 +
  135 + <div class="pagination" style="float: right;padding-top: 0px;margin-top: 0px;">${page.pageStr}</div>
  136 + </div>
  137 + </div>
  138 + </div>
  139 + </form>
  140 +</body>
  141 +
  142 +<%@ include file="../../system/index/foot2.jsp"%>
  143 +<script src="../static/ace/js/date-time/bootstrap-datepicker.js"></script>
  144 +
  145 + <script language="javascript" src="../static/js/tablescroller.js"></script>
  146 + <script language="javascript" src="../static/js/tablescroller.jquery.js"></script>
  147 +<script type="text/javascript">
  148 +
  149 + $(document).ready(function(){
  150 + window.top.loading.remove();
  151 + $(".table_box").css("padding-top",$(".head_box").height());
  152 +
  153 + var _heigh = $('#mainFrame', parent.document).height()-150;
  154 +
  155 + var options = {
  156 + width: '100%',
  157 + height: _heigh,
  158 + pinnedRows: 1,
  159 + pinnedCols: 5,
  160 + container: "#scrollableTable",
  161 + removeOriginal: true
  162 + };
  163 +
  164 + $("#simple-table").tablescroller(options);
  165 + });
  166 +
  167 +
  168 +
  169 + function tosearch(){
  170 + window.top.loading.remove();
  171 + $("#Form").submit();
  172 + }
  173 +
  174 + $('#ids').on('click', function(){
  175 + var th_checked = $("#ids").prop('checked');//checkbox inside "TH" table header
  176 +
  177 + $(".table_box .table").find('tbody > tr').each(function(){
  178 + var row = this;
  179 + if(th_checked) $(row).find('input[type=checkbox]').eq(0).prop('checked', true);
  180 + else $(row).find('input[type=checkbox]').eq(0).prop('checked', false);
  181 + });
  182 + });
  183 +
  184 + function del(Id){
  185 + //var remove = new remove();
  186 + window.top.remove.init({"title":"删除","func":function(success){
  187 + if(success){
  188 + var url = "<%=basePath%>paper/delete.do?PAPER_ID="+Id+"&qingsongkao=true&tm="+new Date().getTime();
  189 + window.top.loading.show();
  190 + $.get(url,function(data){
  191 + tosearch();
  192 + });
  193 + }
  194 + else{
  195 + console.log("false");
  196 + }
  197 + }});
  198 + remove.show();
  199 + }
  200 +
  201 + $(function() {
  202 +
  203 + //日期框
  204 + $('.date-picker').datepicker({
  205 + autoclose: true,
  206 + todayHighlight: true
  207 + });
  208 +
  209 + });
  210 +
  211 + function deleteAll(){
  212 + window.top.remove.init({"title":"删除","func":function(success){
  213 + if(success){
  214 + var str = '';
  215 + for(var i=0;i < document.getElementsByName('ids').length;i++){
  216 + if(document.getElementsByName('ids')[i].checked){
  217 + if(str=='') str += document.getElementsByName('ids')[i].value;
  218 + else str += ',' + document.getElementsByName('ids')[i].value;
  219 + }
  220 + }
  221 + if(str==''){
  222 +
  223 + }else{
  224 + $.ajax({
  225 + type: "POST",
  226 + url: '<%=basePath%>paper/deleteAll.do?tm='+new Date().getTime(),
  227 + data: {DATA_IDS:str},
  228 + dataType:'json',
  229 + //beforeSend: validateData,
  230 + cache: false,
  231 + success: function(data){
  232 + $.each(data.list, function(i, list){
  233 + tosearch();
  234 + });
  235 + }
  236 + });
  237 + }
  238 + }
  239 + else{
  240 + console.log("false");
  241 + }
  242 + }});
  243 + window.top.remove.show();
  244 + }
  245 + function export3(){
  246 + window.open("<%=basePath%>paper/export3?PAPER_ID=${pd.PAPER_ID}","_blank");
  247 + }
  248 +
  249 +</script>
  250 +</html>
0 251 \ No newline at end of file
... ...
WebRoot/WEB-INF/jsp/sunvote/sclass/sclass_list2.jsp
... ... @@ -86,7 +86,7 @@
86 86 <tr>
87 87 <td><input type="checkbox" name='ids' id="ids"
88 88 value="${var.ID}" />${vs.index+1}</td>
89   - <td class='center'><a href="student/listcs.do?class_id=${var.ID }">${var.CLASS_NAME}</a></td>
  89 + <td class='center'><a href="student/listcs.do?SCHOOL_ID=${pd.SCHOOL_ID}&class_id=${var.ID }">${var.CLASS_NAME}</a></td>
90 90 <td class='center'>${myelfun:findClassTypeName(var.CLASS_TYPE)}</td>
91 91 <%-- <td class='center'>${var.CLASS_CODE}</td> --%>
92 92 <td class='center'>${myelfun:findBasestationName(var.BASESTATION_ID)}</td>
... ...
WebRoot/WEB-INF/jsp/sunvote/student/student_edit2.jsp
... ... @@ -14,7 +14,7 @@
14 14 <head>
15 15 <base href="<%=basePath%>">
16 16 <!-- 日期框 -->
17   -<link rel="stylesheet" href="../static/ace/css/datepicker.css" />
  17 +<link rel="stylesheet" href="static/ace/css/datepicker.css" />
18 18 <style type="text/css">
19 19 li {
20 20 list-style: none;
... ... @@ -86,6 +86,7 @@ input[type=&quot;text&quot;],select {
86 86 <body>
87 87 <form action="student/${msg }.do" name="Form" id="Form"
88 88 method="post">
  89 + <input type="hidden" name="SCHOOL_ID" id="SCHOOL_ID" value="${pd.SCHOOL_ID}" />
89 90 <input type="hidden" name="ID" id="ID" value="${pd.ID}" /> <input
90 91 type="hidden" name="CLASS_ID" id="CLASS_ID" value="${pd.CLASS_ID}" />
91 92 <input type="hidden" name="TERM_ID" id="TERM_ID" value="${pd.TERM_ID}" />
... ... @@ -141,11 +142,11 @@ input[type=&quot;text&quot;],select {
141 142 <!-- 页面底部js¨ -->
142 143 <%@ include file="../../system/index/foot2.jsp"%>
143 144 <!-- 下拉框 -->
144   - <script src="../static/ace/js/chosen.jquery.js"></script>
  145 + <script src="static/ace/js/chosen.jquery.js"></script>
145 146 <!-- 日期框 -->
146   - <script src="../static/ace/js/date-time/bootstrap-datepicker.js"></script>
  147 + <script src="static/ace/js/date-time/bootstrap-datepicker.js"></script>
147 148 <!--提示框-->
148   - <script type="text/javascript" src="../static/js/jquery.tips.js"></script>
  149 + <script type="text/javascript" src="static/js/jquery.tips.js"></script>
149 150 <script type="text/javascript">
150 151 //保存
151 152 function save() {
... ...
WebRoot/WEB-INF/jsp/sunvote/student/student_list2.jsp
... ... @@ -34,7 +34,7 @@
34 34 </head>
35 35 <body>
36 36  
37   -<form action="../student/listcs.do" method="post" name="Form" id="Form">
  37 +<form action="../student/listcs.do?SCHOOL_ID=${pd.SCHOOL_ID}&class_id=${pd.ID }" method="post" name="Form" id="Form">
38 38 <input type="hidden" name="CLASS_ID" id="CLASS_ID" value="${pd.CLASS_ID}"/>
39 39 <input type="hidden" name="TERM_ID" id="TERM_ID" value="${pd.TERM_ID}"/>
40 40 <div class="head_box">
... ... @@ -170,7 +170,7 @@
170 170 function add(){
171 171 window.top.modal.init({
172 172 'title':'添加学生',
173   - 'url':'<%=basePath%>student/goAdd2.do?class_id=${pd.CLASS_ID}&term_id=${pd.TERM_ID}',
  173 + 'url':'<%=basePath%>student/goAdd2.do?SCHOOL_ID=${pd.SCHOOL_ID}&class_id=${pd.CLASS_ID}&term_id=${pd.TERM_ID}',
174 174 func:function() {
175 175 tosearch();
176 176 }
... ... @@ -181,7 +181,7 @@
181 181 function edit(Id){
182 182 window.top.modal.init({
183 183 'title':'添加学生',
184   - 'url':'<%=basePath%>student/goEdit2.do?class_id=${pd.CLASS_ID}&term_id=${pd.TERM_ID}&ID='+Id,
  184 + 'url':'<%=basePath%>student/goEdit2.do?SCHOOL_ID=${pd.SCHOOL_ID}&class_id=${pd.CLASS_ID}&term_id=${pd.TERM_ID}&ID='+Id,
185 185 func:function() {
186 186 tosearch();
187 187 }
... ... @@ -225,7 +225,7 @@
225 225 function upload(){
226 226 window.top.modal.init({
227 227 'title':'EXCEL导入学生名单',
228   - 'url':'<%=basePath%>student/goUploadExcel.do?class_id=${pd.CLASS_ID}&term_id=${pd.TERM_ID}',
  228 + 'url':'<%=basePath%>student/goUploadExcel.do?SCHOOL_ID=${pd.SCHOOL_ID}&class_id=${pd.CLASS_ID}&term_id=${pd.TERM_ID}',
229 229 func:function() {
230 230 tosearch();
231 231 }
... ... @@ -233,7 +233,7 @@
233 233 window.top.modal.show();
234 234 }
235 235 function export2(){
236   - window.open('<%=basePath%>student/excel?class_id=${pd.CLASS_ID}','_blank');
  236 + window.open('<%=basePath%>student/excel?SCHOOL_ID=${pd.SCHOOL_ID}&class_id=${pd.CLASS_ID}','_blank');
237 237 }
238 238 $("input[type=checkbox]").on('click',function(){
239 239 var str = '';
... ...
WebRoot/WEB-INF/jsp/sunvote/student/uploadexcel.jsp
... ... @@ -107,8 +107,9 @@ display: block;
107 107 <div class="page-content">
108 108 <div class="row">
109 109 <div class="col-xs-12">
110   - <form action="student/readExcel.do?CLASS_ID=${pd.CLASS_ID}&TERM_ID=${pd.TERM_ID}" name="Form" id="Form" method="post" enctype="multipart/form-data">
  110 + <form action="student/readExcel.do?SCHOOL_ID=${pd.SCHOOL_ID }&CLASS_ID=${pd.CLASS_ID}&TERM_ID=${pd.TERM_ID}" name="Form" id="Form" method="post" enctype="multipart/form-data">
111 111 <div id="zhongxin">
  112 + <input type="hidden" name="SCHOOL_ID" id="SCHOOL_ID" value="${pd.SCHOOL_ID}"/>
112 113 <input type="hidden" name="CLASS_ID" id="CLASS_ID" value="${pd.CLASS_ID}"/>
113 114 <input type="hidden" name="TERM_ID" id="TERM_ID" value="${pd.TERM_ID}"/>
114 115 <table style="width:95%;" >
... ...
WebRoot/WEB-INF/jsp/system/index/login.jsp
... ... @@ -75,13 +75,13 @@ body{
75 75 <div class="form_box">
76 76 <div id="loginbox" >
77 77 <div class="name_box">
78   -
  78 + <input type="text" id="username1" placeholder="账号" value="" style="opacity:0;position: absolute;top:0;height:0px;z-index:-1" autoComplete="off"/>
79 79 <input type="text" id="loginname" value="" placeholder="用户名" autoComplete="off"/>
80 80 <svg t="1554790328236" class="icon_down" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2161" xmlns:xlink="http://www.w3.org/1999/xlink" width="32" height="32"><defs><style type="text/css"></style></defs><path d="M863.321996 251.674996 194.108395 251.674996 528.677333 621.186771Z" p-id="2162" fill="#333333"></path></svg>
81 81 </div>
82 82 <div class="psw_box">
83   - <input type="text" id="username1" placeholder="账号" value="" style="opacity:1;position: absolute;top:0;height:50px;z-index:-1" autoComplete="off"/>
84   - <input type="password" id="password1" placeholder="密 码" value="" style="opacity:1;position: absolute;top:0;height:50px;z-index:-1" autoComplete="off"/>
  83 +
  84 + <input type="password" id="password1" placeholder="密 码" value="" style="opacity:0;position: absolute;top:0;height:0px;z-index:-1" autoComplete="off"/>
85 85 <input type="text" id="password" placeholder="密 码" value="" autoComplete="off"/>
86 86 <div class="rember" style="width:50%;float:left;text-align:left;margin-top:10px;display:inline-block;line-height:34px;">
87 87 <input type="checkbox" id="rem_flag"/>
... ...
resources/mybatis1/sunvote/StudentMapper.xml
... ... @@ -89,13 +89,27 @@
89 89  
90 90 <!-- 通过ID获取数据 -->
91 91 <select id="findByNumberAndKeyPadId" parameterType="pd" resultType="pd">
92   - select
93   - <include refid="Field"></include>
94   - from
95   - <include refid="tableName"></include>
96   - where
97   - NUMBER = #{NUMBER}
98   - or KEYPAD_ID = #{KEYPAD_ID}
  92 + SELECT
  93 + `NAME`,
  94 + SNO,
  95 + NUMBER,
  96 + SEX,
  97 + GROUPID,
  98 + SIGN_NO,
  99 + PARENT_NAME,
  100 + PARENT_PHONE,
  101 + KEYPAD_ID,
  102 + REMARK,
  103 + CLASS_ID,
  104 + SV_STUDENT.ID ,
  105 + sv_sclass.SCHOOL_ID
  106 +FROM
  107 + SV_STUDENT
  108 + left join sv_sclass on sv_sclass.ID = sv_student.CLASS_ID
  109 +WHERE
  110 + ( NUMBER = #{NUMBER} AND sv_sclass.SCHOOL_ID = #{SCHOOL_ID} )
  111 + OR
  112 + ( KEYPAD_ID = #{KEYPAD_ID} AND sv_sclass.SCHOOL_ID = #{SCHOOL_ID})
99 113 </select>
100 114 <!-- 通过ID获取数据 -->
101 115 <select id="findByClassId" parameterType="pd" resultType="pd">
... ...
resources/mybatis1/sunvote/StudentTestMapper.xml
... ... @@ -92,7 +92,7 @@
92 92 select
93 93 sv_studenttest.STUDENT_ID,
94 94 sv_studenttest.TEST_ID,
95   - sv_studenttest.PAPER_ID as pid,
  95 + sv_studenttest.PAPER_ID as PID,
96 96 sv_studenttest.SCORE,
97 97 sv_studenttest.CLASS_ID,
98 98 sv_studenttest.LOST_TEST,
... ... @@ -107,7 +107,7 @@
107 107 LEFT JOIN sv_sclass on sv_studenttest.CLASS_ID = sv_sclass.ID
108 108 LEFT JOIN sv_student on sv_studenttest.STUDENT_ID = sv_student.ID
109 109 where
110   - sv_studenttest.PAPER_ID = = #{PAPER_ID}
  110 + sv_studenttest.PAPER_ID = #{PAPER_ID}
111 111 </select>
112 112  
113 113 <!-- 列表 -->
... ...
src/com/fh/controller/base/BaseController.java
... ... @@ -224,7 +224,7 @@ public class BaseController {
224 224 */
225 225 public Integer indexOfStrInList(List<String> list,String str){
226 226 for(int i = 0 ;i<list.size();i++){
227   - if(list.get(i).indexOf(str) !=-1 ) return list.get(i).indexOf(str);
  227 + if(list.get(i).equals(str)) return i;
228 228 }
229 229 return -1;
230 230 }
... ...
src/com/fh/controller/sunvote/paper/PaperController.java
... ... @@ -48,6 +48,7 @@ import com.fh.util.AppUtil;
48 48 import com.fh.util.Const;
49 49 import com.fh.util.Jurisdiction;
50 50 import com.fh.util.ObjectExcelView;
  51 +import com.fh.util.ObjectExcelView2;
51 52 import com.fh.util.PageData;
52 53  
53 54 /**
... ... @@ -652,43 +653,219 @@ public class PaperController extends BaseController {
652 653 public ModelAndView paperRep3() throws Exception{
653 654 ModelAndView mv = this.getModelAndView();
654 655 PageData pd = new PageData();
655   - List<PageData> templist = new ArrayList<PageData>();
  656 + List<PageData> temp = new ArrayList<PageData>();
656 657 PageData saveData = new PageData();
657 658  
658 659 ResponseGson<PageData> res = new ResponseGson();
659 660 pd = this.getPageData();
660 661 if(pd.containsKey("PAPER_ID")){
  662 +
661 663 List<PageData> list = studenttestService.findTestInfoByPid(pd);
662   - List<PageData> temp = new ArrayList<PageData>();
  664 + PageData paper = paperService.findById(pd);
  665 + if(paper!=null){
  666 + pd.put("SCORE", paper.get("SCORE"));
  667 + pd.put("PAPER_NAME", paper.get("TITLE"));
  668 + }
663 669 List<String> sid = new ArrayList<String>();
  670 + Integer test_num = 0;
  671 + Integer lost_num = 0;
664 672 for(PageData item : list){
665 673  
666 674 Integer index = this.indexOfStrInList(sid, item.getString("STUDENT_ID"));
667 675 if(index!=-1){
668 676  
  677 + test_num++;
  678 + List<PageData> test_list = (List<PageData>) temp.get(index).get("TEST_LIST");
  679 + PageData test = new PageData();
  680 + test.put("CREATE_DATE", item.get("CREATE_DATE"));
  681 + if(item.getString("LOST_TEST").isEmpty()){
  682 + test.put("SCORE", item.get("SCORE"));
  683 + }else{
  684 + test.put("SCORE", "--");
  685 + temp.get(index).put("LOST_NUM", Integer.valueOf(temp.get(index).getString("LOST_NUM"))+1);
  686 + }
  687 + test.put("AVG_SCORE", item.get("AVG_SCORE"));
  688 + test_list.add(test);
  689 + Float total = Float.valueOf(temp.get(index).getString("STUDENT_TOTAL"));
  690 + temp.get(index).put("STUDENT_TOTAL",total+Float.valueOf(item.getString("SCORE")));
  691 + temp.get(index).put("TEST_LIST", test_list);
  692 + temp.get(index).put("TEST_NUM", test_list.size()-Integer.valueOf(temp.get(index).getString("LOST_NUM")));
  693 +
669 694 }else{
  695 + test_num=1;
  696 + lost_num=0;
670 697 PageData stu = new PageData();
671 698 stu.put("STUDENT_NAME", item.get("STUDENT_NAME"));
672 699 stu.put("CLASS_NAME", item.get("CLASS_NAME"));
673   - List<PageData> test = new ArrayList<PageData>();
674   - test.get(0).put("CREAT_DATE", item.get("CREAT_DATE"));
675   - test.get(0).put("SCORE", item.get("SCORE"));
676   - test.get(0).put("AVG_SCORE", item.get("AVG_SCORE"));
677   - stu.put("TEST_LIST", test);
  700 + List<PageData> testList = new ArrayList<PageData>();
  701 + PageData test = new PageData();
  702 + test.put("CREATE_DATE", item.get("CREATE_DATE"));
  703 + if(item.getString("LOST_TEST").isEmpty()){
  704 + test.put("SCORE", item.get("SCORE"));
  705 + }else{
  706 + test.put("SCORE", "--");
  707 + lost_num++;
  708 + }
  709 + test.put("AVG_SCORE", item.get("AVG_SCORE"));
  710 + testList.add(test);
  711 + stu.put("STUDENT_TOTAL",item.get("SCORE"));
  712 + stu.put("TEST_LIST", testList);
  713 + stu.put("TEST_NUM", testList.size()-lost_num);
  714 + stu.put("LOST_NUM", lost_num);
  715 + sid.add(item.getString("STUDENT_ID"));
678 716 temp.add(stu);
679 717 }
680 718  
681   -
682 719 }
683 720 }
  721 + Collections.sort(temp,new Comparator<PageData>(){
  722 +
  723 + @Override
  724 + public int compare(PageData o1, PageData o2) {
  725 + Float o1GetScore = Float.valueOf(o1.getString("STUDENT_TOTAL"))/Float.valueOf(o1.getString("TEST_NUM"));
  726 + Float o2GetScore = Float.valueOf(o2.getString("STUDENT_TOTAL"))/Float.valueOf(o2.getString("TEST_NUM"));
  727 + return o2GetScore.compareTo(o1GetScore);
  728 + }
  729 +
  730 + });
684 731 mv.setViewName("sunvote/paper/test_list3");
685   - mv.addObject("varList", templist);
  732 + mv.addObject("varList", temp);
686 733 mv.addObject("pd",pd);
687 734 res.setData(saveData);
688 735 return mv;
689 736 }
690 737  
691 738  
  739 + @RequestMapping(value="/export3")
  740 + public ModelAndView export3() throws Exception{
  741 + ModelAndView mv = this.getModelAndView();
  742 + PageData pd = new PageData();
  743 + List<PageData> temp = new ArrayList<PageData>();
  744 + PageData saveData = new PageData();
  745 +
  746 + ResponseGson<PageData> res = new ResponseGson();
  747 + pd = this.getPageData();
  748 + if(pd.containsKey("PAPER_ID")){
  749 +
  750 + List<PageData> list = studenttestService.findTestInfoByPid(pd);
  751 + PageData paper = paperService.findById(pd);
  752 + if(paper!=null){
  753 + pd.put("SCORE", paper.get("SCORE"));
  754 + pd.put("PAPER_NAME", paper.get("TITLE"));
  755 + }
  756 + List<String> sid = new ArrayList<String>();
  757 + Integer test_num = 0;
  758 + Integer lost_num = 0;
  759 + for(PageData item : list){
  760 +
  761 + Integer index = this.indexOfStrInList(sid, item.getString("STUDENT_ID"));
  762 + if(index!=-1){
  763 +
  764 + test_num++;
  765 + List<PageData> test_list = (List<PageData>) temp.get(index).get("TEST_LIST");
  766 + PageData test = new PageData();
  767 + test.put("CREATE_DATE", item.get("CREATE_DATE"));
  768 + if(item.getString("LOST_TEST").isEmpty()){
  769 + test.put("SCORE", item.get("SCORE"));
  770 + }else{
  771 + test.put("SCORE", "--");
  772 + temp.get(index).put("LOST_NUM", Integer.valueOf(temp.get(index).getString("LOST_NUM"))+1);
  773 + }
  774 + test.put("AVG_SCORE", item.get("AVG_SCORE"));
  775 + test_list.add(test);
  776 + Float total = Float.valueOf(temp.get(index).getString("STUDENT_TOTAL"));
  777 + temp.get(index).put("STUDENT_TOTAL",total+Float.valueOf(item.getString("SCORE")));
  778 + temp.get(index).put("TEST_LIST", test_list);
  779 + temp.get(index).put("TEST_NUM", test_list.size()-Integer.valueOf(temp.get(index).getString("LOST_NUM")));
  780 +
  781 + }else{
  782 + test_num=1;
  783 + lost_num=0;
  784 + PageData stu = new PageData();
  785 + stu.put("STUDENT_NAME", item.get("STUDENT_NAME"));
  786 + stu.put("CLASS_NAME", item.get("CLASS_NAME"));
  787 + List<PageData> testList = new ArrayList<PageData>();
  788 + PageData test = new PageData();
  789 + test.put("CREATE_DATE", item.get("CREATE_DATE"));
  790 + if(item.getString("LOST_TEST").isEmpty()){
  791 + test.put("SCORE", item.get("SCORE"));
  792 + }else{
  793 + test.put("SCORE", "--");
  794 + lost_num++;
  795 + }
  796 + test.put("AVG_SCORE", item.get("AVG_SCORE"));
  797 + testList.add(test);
  798 + stu.put("STUDENT_TOTAL",item.get("SCORE"));
  799 + stu.put("TEST_LIST", testList);
  800 + stu.put("TEST_NUM", testList.size()-lost_num);
  801 + stu.put("LOST_NUM", lost_num);
  802 + sid.add(item.getString("STUDENT_ID"));
  803 + temp.add(stu);
  804 + }
  805 +
  806 + }
  807 + }
  808 + Collections.sort(temp,new Comparator<PageData>(){
  809 +
  810 + @Override
  811 + public int compare(PageData o1, PageData o2) {
  812 + Float o1GetScore = Float.valueOf(o1.getString("STUDENT_TOTAL"))/Float.valueOf(o1.getString("TEST_NUM"));
  813 + Float o2GetScore = Float.valueOf(o2.getString("STUDENT_TOTAL"))/Float.valueOf(o2.getString("TEST_NUM"));
  814 + return o2GetScore.compareTo(o1GetScore);
  815 + }
  816 +
  817 + });
  818 +
  819 + mv.addObject("varList", temp);
  820 + mv.addObject("pd",pd);
  821 +
  822 + Map<String,Object> dataMap = new HashMap<String,Object>();
  823 + List<String> titles = new ArrayList<String>();
  824 + titles.add("学生姓名"); //1
  825 + titles.add("班级"); //2
  826 + titles.add("综合排名"); //3
  827 + titles.add("个人平均得分"); //4
  828 + titles.add("个人平均得分率"); //5
  829 + titles.add("个人得分"); //6
  830 + titles.add("测验平均分"); //7
  831 + titles.add("测验时间"); //8
  832 +
  833 + dataMap.put("titles", titles);
  834 + List<PageData> varOList = temp;
  835 + List<PageData> varList = new ArrayList<PageData>();
  836 + DecimalFormat decimalFormat=new DecimalFormat("0.00");
  837 + for(int i=0;i<varOList.size();i++){
  838 + PageData vpd = new PageData();
  839 +
  840 + vpd.put("var1", varOList.get(i).getString("STUDENT_NAME")); //1
  841 + vpd.put("var2", varOList.get(i).getString("CLASS_NAME")); //2
  842 + vpd.put("var3", i+1); //3
  843 + vpd.put("var4", varOList.get(i).getString("TEST_NUM").equals("0")?0:decimalFormat.format(Double.valueOf(varOList.get(i).getString("STUDENT_TOTAL"))/Double.valueOf(varOList.get(i).getString("TEST_NUM")))); //4
  844 + vpd.put("var5", varOList.get(i).getString("TEST_NUM").equals("0")?0:decimalFormat.format((Double.valueOf(varOList.get(i).getString("STUDENT_TOTAL"))*100/Double.valueOf(varOList.get(i).getString("TEST_NUM")))/Double.valueOf(pd.getString("SCORE")))); //5
  845 + List<PageData> test_list = (List<PageData>)varOList.get(i).get("TEST_LIST");
  846 +
  847 + List<String> score = new ArrayList<String>();
  848 + List<String> AVG_SCORE = new ArrayList<String>();
  849 + List<String> CREATE_DATE = new ArrayList<String>();
  850 + for(int x=0;x<test_list.size();x++){
  851 + score.add(test_list.get(x).getString("SCORE"));
  852 + AVG_SCORE.add(test_list.get(x).getString("AVG_SCORE"));
  853 + CREATE_DATE.add(test_list.get(x).getString("CREATE_DATE"));
  854 +
  855 + }
  856 + vpd.put("var6", score);
  857 + vpd.put("var7", AVG_SCORE);
  858 + vpd.put("var8", CREATE_DATE);
  859 + varList.add(vpd);
  860 + }
  861 + dataMap.put("varList", varList);
  862 + ObjectExcelView2 erv = new ObjectExcelView2();
  863 + mv = new ModelAndView(erv,dataMap);
  864 +
  865 +
  866 + return mv;
  867 + }
  868 +
692 869 @RequestMapping(value="/iteminfo")
693 870 public ModelAndView iteminfo() throws Exception{
694 871 logBefore(logger, Jurisdiction.getUsername()+"Paper详细信息");
... ...
src/com/fh/controller/sunvote/student/StudentController.java
... ... @@ -172,6 +172,7 @@ public class StudentController extends BaseController {
172 172 }
173 173 }
174 174 }
  175 + savePd.put("SCHOOL_ID", tpd.get("SCHOOL_ID"));
175 176 List<PageData> lnum = studentService.findByNumberAndKeyPadId(savePd);
176 177  
177 178 if(lnum.size()<1){
... ...
src/com/fh/service/sunvote/studenttest/impl/StudentTestService.java
... ... @@ -78,7 +78,7 @@ public class StudentTestService implements StudentTestManager{
78 78 * @throws Exception
79 79 */
80 80 public List<PageData> findTestInfoByPid(PageData pd)throws Exception{
81   - return (List<PageData>)dao.findForObject("StudentTestMapper.findTestInfoByPid", pd);
  81 + return (List<PageData>)dao.findForList("StudentTestMapper.findTestInfoByPid", pd);
82 82 }
83 83  
84 84 /**批量删除
... ...
src/com/fh/util/ObjectExcelView2.java 0 → 100644
  1 +package com.fh.util;
  2 +
  3 +import java.util.Date;
  4 +import java.util.List;
  5 +import java.util.Map;
  6 +
  7 +import javax.servlet.http.HttpServletRequest;
  8 +import javax.servlet.http.HttpServletResponse;
  9 +
  10 +import org.apache.poi.hssf.usermodel.HSSFCell;
  11 +import org.apache.poi.hssf.usermodel.HSSFCellStyle;
  12 +import org.apache.poi.hssf.usermodel.HSSFFont;
  13 +import org.apache.poi.hssf.usermodel.HSSFSheet;
  14 +import org.apache.poi.hssf.usermodel.HSSFWorkbook;
  15 +import org.apache.poi.hssf.util.CellRangeAddress;
  16 +import org.springframework.web.servlet.view.document.AbstractExcelView;
  17 +
  18 +import com.fh.util.PageData;
  19 +import com.fh.util.Tools;
  20 +public class ObjectExcelView2 extends AbstractExcelView{
  21 +
  22 + @Override
  23 + protected void buildExcelDocument(Map<String, Object> model,
  24 + HSSFWorkbook workbook, HttpServletRequest request,
  25 + HttpServletResponse response) throws Exception {
  26 + // TODO Auto-generated method stub
  27 + Date date = new Date();
  28 + String filename = Tools.date2Str(date, "yyyyMMddHHmmss");
  29 + HSSFSheet sheet;
  30 + HSSFCell cell;
  31 + response.setContentType("application/octet-stream");
  32 + response.setHeader("Content-Disposition", "attachment;filename="+filename+".xls");
  33 + if(model.get("class")!=null && !model.get("class").toString().isEmpty()){
  34 + sheet = workbook.createSheet(model.get("class").toString());
  35 + }else{
  36 + sheet = workbook.createSheet("sheet1");
  37 + }
  38 +
  39 +
  40 + List<String> titles = (List<String>) model.get("titles");
  41 + int len = titles.size();
  42 + HSSFCellStyle headerStyle = workbook.createCellStyle(); //标题样式
  43 + headerStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
  44 + headerStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
  45 + HSSFFont headerFont = workbook.createFont(); //标题字体
  46 + headerFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
  47 + headerFont.setFontHeightInPoints((short)11);
  48 + headerStyle.setFont(headerFont);
  49 + short width = 20,height=25*20;
  50 + sheet.setDefaultColumnWidth(width);
  51 + for(int i=0; i<len; i++){ //设置标题
  52 + String title = titles.get(i);
  53 + cell = getCell(sheet, 0, i);
  54 + cell.setCellStyle(headerStyle);
  55 + setText(cell,title);
  56 + }
  57 + sheet.getRow(0).setHeight(height);
  58 +
  59 + HSSFCellStyle contentStyle = workbook.createCellStyle(); //内容样式
  60 + contentStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
  61 + List<PageData> varList = (List<PageData>) model.get("varList");
  62 + int varCount = varList.size();
  63 + for(int i=0; i<varCount; i++){
  64 + PageData vpd = varList.get(i);
  65 +
  66 + for(int j=0;j<len;j++){
  67 + if(j<5){
  68 + List<String> score = (List<String>)vpd.get("var6");
  69 + if(score.size()>0){
  70 + CellRangeAddress region = new CellRangeAddress(i*score.size()+1, i*score.size()+score.size(), j, j);
  71 + sheet.addMergedRegion(region);
  72 + }
  73 +
  74 + String varstr = vpd.getString("var"+(j+1)) != null ? vpd.getString("var"+(j+1)) : "";
  75 + cell = getCell(sheet, i*score.size()+1, j);
  76 + cell.setCellStyle(contentStyle);
  77 + setText(cell,varstr);
  78 + }else{
  79 + List<String> score = (List<String>)vpd.get("var6");
  80 + for(int x=0;x<score.size();x++){
  81 + String varstr = vpd.getString("var"+(j+1)) != null ? vpd.getString("var"+(j+1)) : "";
  82 + varstr = varstr.replace("[", "");
  83 + varstr = varstr.replace("]", "");
  84 + String[] s = varstr.split(",");
  85 + cell = getCell(sheet, i*score.size()+1+x, j);
  86 + cell.setCellStyle(contentStyle);
  87 + setText(cell,s[x]);
  88 + }
  89 +
  90 + }
  91 + }
  92 +
  93 + }
  94 +
  95 + }
  96 +
  97 +}
... ...