Commit 757dfed60b3df83319beec57c419dbdd179bb6d0

Authored by 孙向锦
1 parent d34f6711

样例报表

WebRoot/WEB-INF/jsp/sunvote/teacher/paper_view.jsp
... ... @@ -17,7 +17,7 @@
17 17 <!-- Bootstrap -->
18 18 <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
19 19 <link href="../static/css/teach.css" rel="stylesheet">
20   - <link href="../static/css/paper_view.css" rel="stylesheet">
  20 + <link href="../static/css/paper_view.css?t=1" rel="stylesheet">
21 21  
22 22 <!-- HTML5 shim 和 Respond.js 是为了让 IE8 支持 HTML5 元素和媒体查询(media queries)功能 -->
23 23 <!-- 警告:通过 file:// 协议(就是直接将 html 页面拖拽到浏览器中)访问页面时 Respond.js 不起作用 -->
... ... @@ -28,68 +28,25 @@
28 28 <style>
29 29 .analysis table{display:inline-block;vertical-align:middle;}
30 30 .resolve_box img{vertical-align:top;}
  31 + .up{width:20px;hiehgt:20px;}
  32 + .down{width:20px;height:20px;margin-left:10px;}
  33 + .save_box{width:100%;height:80px;background:#fff;text-align:center;position:fixed;bottom:0;left:0;}
  34 + .container{height:100%;}
  35 + .content_report{padding-bottom:80px;min-height:calc(100% - 126px);}
31 36 </style>
32 37 </head>
33 38 <body>
34 39 <div class="container">
35 40 <div class="page-header">
36 41 <h3 class="col-md-6" id="paper_title"></h3>
37   - <h3 class="col-md-6">考试时:<span id="time"></span>分钟</h3>
  42 + <h3 class="col-md-6">考试时:<span id="time"></span>分钟</h3>
38 43 <div class="clearfix"></div>
39 44 </div>
40 45 <div class="content_report">
41   - <div class="col-md-3 left_menu">
42   - <ul>
43   - <li class="active">学生完成情况</li>
44   - <li>题目分析</li>
45   - </ul>
46   - </div>
47   - <div class="col-md-9 report">
48   - <div class="report_info">
49   - <ul>
50   - <li>未完成学生 1/1</li>
51   - <li>平均错题数 0</li>
52   - <li>正确率 0%</li>
53   - <li>平均用时 0秒</li>
54   - </ul>
55   - <div class="clearfix"></div>
56   - </div>
57   - <div class="table_box">
58   - <table class="table table-striped">
59   - <thead>
60   - <tr>
61   - <th>姓名</th>
62   - <th>答题时间</th>
63   - <th>答对数</th>
64   - <th>答错数</th>
65   - <th>错题详情</th>
66   - <th>一键催交</th>
67   - </tr>
68   - </thead>
69   - <tbody>
70   - <tr>
71   - <td>杨大辉</td>
72   - <td>未完成</td>
73   - <td>--</td>
74   - <td>--</td>
75   - <td>--</td>
76   - <td>催作业</td>
77   - </tr>
78   - <tr>
79   - <td>何禾</td>
80   - <td>2018/6/21</td>
81   - <td>--</td>
82   - <td>--</td>
83   - <td>--</td>
84   - <td>催作业</td>
85   - </tr>
86   - </tbody>
87   - </table>
88   - </div>
89   - </div>
90   - <div class="col-md-9 analysis" style="display:none;">
  46 +
  47 + <div class="col-md-12 analysis">
91 48 <ul>
92   - <li>
  49 + <!--<li>
93 50 <div class="stem">
94 51 <p>1.如图,检测4个足球,其中超过标准质量的克数记为正数,不足标准质量的克数记为负数.从轻重的角度看,最接近标准的是(  )</p>
95 52 </div>
... ... @@ -111,32 +68,10 @@
111 68 <p>【考点】 10以内数的认识</p>
112 69 </div>
113 70 <div class="clearfix"></div>
114   - <div class="tab_report_box">
115   - <div class="col-md-3">
116   - <p>答错人数</p>
117   - <div class="round_w_orange">
118   - <div class="round_n_orange">
119   - <span>0/0</span>
120   - </div>
121   - </div>
122   - </div>
123   - <div class="col-md-3">
124   - <p>错误率</p>
125   - <div class="round_w_red">
126   - <div class="round_n_red">
127   - <span>100%</span>
128   - </div>
129   - </div>
130   - </div>
131   - <div class="col-md-6">
132   - <div id="main" style="width:250px;height:140px;"></div>
133   - </div>
134   - <div class="clearfix"></div>
135   - </div>
136 71 </div>
137 72  
138 73 <div class="star_box">
139   - <div class="col-md-6">错误学生:0/0</div>
  74 + <div class="col-md-6"><img src="../static/images/up_ico.png"/><img src="../static/images/down_ico.png"/></div>
140 75 <div class="col-md-6">
141 76 <div class="star">
142 77 <span style="float:left;">难度</span>
... ... @@ -154,16 +89,21 @@
154 89 </div>
155 90 <div class="clearfix"></div>
156 91 </div>
157   - </li>
  92 + </li> -->
158 93 </ul>
159 94 </div>
  95 + <div class="clearfix"></div>
  96 + </div>
  97 + <div class="save_box">
  98 + <input type="button" value="保存" class="btn btn-primary btn-lg topic save" disabled="disabled"/>
160 99 </div>
161   -
162 100 </div>
163 101 <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
164   - <script src="js/echars.js"></script>
  102 + <script src="../static/js/echars.js"></script>
  103 + <script src="../static/js/loading.js"></script>
165 104 <script>
166   - var url="http://127.0.0.1:8080/SunvoteEducation/"
  105 + var url="http://127.0.0.1:8080/SunvoteEducation";
  106 + var question_box=[];
167 107 function slide(obj){ //查看解析
168 108 obj.closest(".star_box").siblings(".resolve").slideToggle(function(){
169 109 if($(".resolve").css("display") == "none")
... ... @@ -172,92 +112,19 @@
172 112 obj.text("收起解析");
173 113 });
174 114 }
175   - $(".left_menu li").click(function(){
176   - if($(this).index()==0){
177   - $(this).siblings().removeClass("active");
178   - $(this).addClass("active");
179   - $(".analysis").css("display","none");
180   - $(".report").css("display","block");
181   - }else if($(this).index()==1){
182   - $(this).siblings().removeClass("active");
183   - $(this).addClass("active");
184   - $(".report").css("display","none");
185   - $(".analysis").css("display","block");
186   - }
187   - })
188   -
189   - function bar(index){
190   - var myChart = echarts.init(document.getElementById('main'+index));
191   - myChart.setOption({
192   - color: ['#3398DB'],
193   - tooltip : {
194   - trigger: 'axis',
195   - axisPointer : { // 坐标轴指示器,坐标轴触发有效
196   - type : 'line' // 默认为直线,可选为:'line' | 'shadow'
197   - }
198   - },
199   - grid: {
200   - top: 15,
201   - left: '0%',
202   - right: '0%',
203   - bottom: '0%',
204   - containLabel: true
205   - },
206   - xAxis : [
207   - {
208   - type : 'category',
209   - data : ['A', 'B', 'C', 'D'],
210   - axisTick: {
211   - alignWithLabel: true
212   - },
213   - axisLabel: {
214   - show:true,
215   - textStyle:{
216   - color: function (value){
217   - console.log(value);
218   - return value == "C" ? '#75b3ff' : '#fcb35b';
219   - }
220   - }
221   - }
222   - }
223   -
224   -
225   - ],
226   - yAxis : [
227   - {
228   - type : 'value'
229   - }
230   - ],
231   - series : [
232   - {
233   - name:'直接访问',
234   - type:'bar',
235   - barWidth: '60%',
236   - data:[10, 0, 20, 5],
237   - itemStyle: {
238   - //通常情况下:
239   - normal:{
240   - //每个柱子的颜色即为colorList数组里的每一项,如果柱子数目多于colorList的长度,则柱子颜色循环使用该数组
241   - color: function (params){
242   - var colorList = ['#fcb35b','#fcb35b','#75b3ff','#fcb35b'];
243   - return colorList[params.dataIndex];
244   - },
245   - label : {show: true,position:'top',distance:-4}
246   - }
247   - }
248   - }
249   - ]
250   - });
251   - }
252   -
  115 +
253 116 function getQueryString(name) {
254 117 var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
255 118 var r = window.location.search.substr(1).match(reg);
256 119 if (r != null) return unescape(r[2]); return null;
257 120 }
258 121 var PAPER_ID=getQueryString("PAPER_ID");
  122 + var classId=getQueryString("classId");
  123 + var userid=getQueryString("userid");
  124 +
259 125 var _html="";
260 126 $(document).ready(function(){
  127 + window.top.loading.remove();
261 128 $.ajax({
262 129 url:url+"/api/v1/paperinfo",
263 130 async:false,
... ... @@ -269,24 +136,29 @@ function getQueryString(name) {
269 136 $("#time").html(data.data.exam_time);
270 137 if(data.data.questions.length>0){
271 138 for(var i=0;i<data.data.questions.length;i++){
272   - _html += '<li><div class="stem"></div><div class="option"><ul></ul><div class="clearfix"></div></div><div class="resolve"><div class="resolve_box"><p>【答案】 '+data.data.questions[i].answer+'</p><p><span>【解析】</span>'+data.data.questions[i].analysis+'</p></div><div class="clearfix"></div><div class="tab_report_box"><div class="col-md-3"><p>答错人数</p><div class="round_w_orange"><div class="round_n_orange"><span>0/0</span></div></div></div><div class="col-md-3"><p>错误率</p><div class="round_w_red"><div class="round_n_red"><span>100%</span></div></div></div><div class="col-md-6"><div id="main'+i+'" style="width:250px;height:140px;"></div></div><div class="clearfix"></div></div></div><div class="star_box"><div class="col-md-6">错误学生:0/0</div><div class="col-md-6"><div class="star"><span style="float:left;">难度</span></div><div class="resolve_click"><a onclick="slide($(this))">查看解析</a></div></div><div class="clearfix"></div></div></li>';
  139 + _html += '<li class="question_li" data-id="'+data.data.questions[i].question_id+'"><div class="stem"></div><div class="option"><ul></ul><div class="clearfix"></div></div><div class="resolve"><div class="resolve_box"><p>【答案】 '+data.data.questions[i].answer+'</p><p><span>【解析】</span>'+data.data.questions[i].analysis+'</p></div><div class="clearfix"></div></div><div class="star_box"><div class="col-md-6 move"><img src="../static/images/up_ico.png" class="up"/><img src="../static/images/down_ico.png" class="down"/></div><div class="col-md-6"><div class="star"><span style="float:left;">难度</span></div><div class="resolve_click"><a onclick="slide($(this))">查看解析</a></div></div><div class="clearfix"></div></div></li>';
273 140 }
274 141 console.log(_html);
275 142 $(".analysis ul").html(_html);
276 143 for(var j=0;j<data.data.questions.length;j++){
277 144 var option_html="";
278   - $(".analysis li .stem").eq(j).append('<span>'+(j+1)+'、</span>'+data.data.questions[j].content);
  145 + var sum=0;
  146 + var right_num=0;
  147 + var data1=[];
  148 + var data2=[];
  149 + var answer="";
  150 + var color=[];
  151 + $(".analysis li .stem").eq(j).append('<span class="li_index">'+(j+1)+'</span>、'+data.data.questions[j].content);
279 152 var arry_option=data.data.questions[j].option_content;
280 153 arry_option=arry_option.replace("[","");
281 154 arry_option=arry_option.replace("]","");
282 155 arry_option=arry_option.split(",");
  156 +
283 157 for(var x=0;x<arry_option.length;x++){
284 158 option_html += '<li><span>'+String.fromCharCode(64 + parseInt(x+1))+'.</span>'+arry_option[x]+'</li>';
285 159 }
286   - $(".option").eq(j).find("ul").html(option_html);
287   -
  160 + $(".option").eq(j).html(option_html);
288 161 star(j,parseInt(data.data.questions[j].difficulty));
289   - bar(j);
290 162 }
291 163 }
292 164 }
... ... @@ -304,10 +176,88 @@ function getQueryString(name) {
304 176  
305 177 $(".star").eq(index).find("ul").html(li_html);
306 178 }
  179 + $(document).on('click', '.move img', function(event) {
  180 + event.preventDefault();
  181 + $(".save").removeAttr('disabled');
  182 + var parent=$(this).closest("li");
  183 + var this_index=parent.children(".stem").find(".li_index").html();
  184 + var up_index=parent.prev().children(".stem").find(".li_index").html()
  185 + console.log(this_index);
  186 + console.log(up_index);
  187 + var parents=$(this).closest(".analysis").children("ul");
  188 + var len=parents.children().length;
  189 + if(($(this).is(".up") || $(this).is(".top")) && parent.index()==0){
  190 + alert("已经置顶!");
  191 + return false;
  192 + }else if(($(this).is(".down") || $(this).is(".bottom")) && parent.index()==len-1){
  193 + alert("已经置底!");
  194 + return false;
  195 + }
  196 + switch (true) {
  197 + case $(this).is(".up"):
  198 + var prev = parent.prev();
  199 + var this_index=parent.children(".stem").find(".li_index").html();
  200 + var up_index=prev.children(".stem").find(".li_index").html();
  201 + prev.children(".stem").find(".li_index").html(this_index);
  202 + parent.children(".stem").find(".li_index").html(up_index);
  203 + parent.insertBefore(prev);
  204 + break;
  205 + case $(this).is(".down"):
  206 + var next = parent.next();
  207 + var this_index=parent.children(".stem").find(".li_index").html();
  208 + var up_index=next.children(".stem").find(".li_index").html();
  209 + next.children(".stem").find(".li_index").html(this_index);
  210 + parent.children(".stem").find(".li_index").html(up_index);
  211 + parent.insertAfter(next);
  212 + break;
  213 + case $(this).is(".top"):
  214 + parents.prepend(parent);
  215 + break;
  216 + case $(this).is(".bottom"):
  217 + parents.append(parent);
  218 + break;
  219 + }
  220 + // alert("操作完成!!");
  221 + });
  222 + $(".save").click(function(){
  223 + var question_arry=[];
  224 + for(var i=0;i<$(".question_li").length;i++){
  225 + question_arry[i]={
  226 + score: "0",
  227 + part_score: "0",
  228 + question_id: $(".question_li").eq(i).attr("data-id"),
  229 + rank: i.toString(),
  230 + no_name: i.toString()
  231 + };
  232 +
  233 + }
  234 + var data={
  235 + title: $("#paper_title").html(),
  236 + exam_time: $("#time").html(),
  237 + paper_type: "101",
  238 + subject_id: "20",
  239 + grade_id: "",
  240 + class_id: classId,
  241 + user_id: userid,
  242 + score: "100",
  243 + questions: question_arry
  244 + };
  245 + //console.log(data);
  246 + $.ajax({
  247 + url:url+"/api/v1/publishpaper",
  248 + async:false,
  249 + type:"post",
  250 + dataType: "json",
  251 + headers: {'Content-Type': 'application/json'},
  252 + data:JSON.stringify(data),
  253 + success:function(data){
  254 + alert("上传成功");
  255 + window.history.go(-1);
  256 + }
  257 + })
  258 + })
307 259 </script>
308 260  
309   -<!-- <li><div class="stem"></div><div class="option"><ul></ul><div class="clearfix"></div></div><div class="resolve"><div class="resolve_box"><p>【答案】 A</p><p>【解析】</p></div><div class="clearfix"></div><div class="tab_report_box"><div class="col-md-3"><p>答错人数</p><div class="round_w_orange"><div class="round_n_orange"><span>0/0</span></div></div></div><div class="col-md-3"><p>错误率</p><div class="round_w_red"><div class="round_n_red"><span>100%</span></div></div></div><div class="col-md-6"><div id="main" style="width:250px;height:140px;"></div></div><div class="clearfix"></div></div></div><div class="star_box"><div class="col-md-6">错误学生:0/0</div><div class="col-md-6"><div class="star"><span style="float:left;">难度</span></div><div class="resolve_click"><a onclick="slide($(this))">查看解析</a></div></div><div class="clearfix"></div></div></li> -->
310   -
311 261 </html>
312 262  
313 263  
... ...
WebRoot/WEB-INF/jsp/sunvote/teacher/paper_view1.jsp 0 → 100644
  1 +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2 +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
  3 +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
  4 +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
  5 +<%
  6 + String path = request.getContextPath();
  7 + String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
  8 +%>
  9 +<!DOCTYPE html>
  10 +<html lang="zh-CN">
  11 + <head>
  12 + <meta charset="utf-8">
  13 + <meta http-equiv="X-UA-Compatible" content="IE=edge">
  14 + <meta name="viewport" content="width=device-width, initial-scale=1">
  15 + <title>中天电子-教育管理系统</title>
  16 +
  17 + <!-- Bootstrap -->
  18 + <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
  19 + <link href="../static/css/teach.css" rel="stylesheet">
  20 + <link href="../static/css/paper_view.css?t=1" rel="stylesheet">
  21 +
  22 + <!-- HTML5 shim 和 Respond.js 是为了让 IE8 支持 HTML5 元素和媒体查询(media queries)功能 -->
  23 + <!-- 警告:通过 file:// 协议(就是直接将 html 页面拖拽到浏览器中)访问页面时 Respond.js 不起作用 -->
  24 + <!--[if lt IE 9]>
  25 + <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  26 + <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
  27 + <![endif]-->
  28 + <style>
  29 + .analysis table{display:inline-block;vertical-align:middle;}
  30 + .resolve_box img{vertical-align:top;}
  31 + </style>
  32 + </head>
  33 + <body>
  34 + <div class="container">
  35 + <div class="page-header">
  36 + <h3 class="col-md-6" id="paper_title"></h3>
  37 + <h3 class="col-md-6">考试时间:<span id="time"></span></h3>
  38 + <div class="clearfix"></div>
  39 + </div>
  40 + <div class="content_report">
  41 +
  42 + <div class="col-md-12 analysis">
  43 + <ul>
  44 + <li>
  45 + <div class="stem">
  46 + <p>1.如图,检测4个足球,其中超过标准质量的克数记为正数,不足标准质量的克数记为负数.从轻重的角度看,最接近标准的是(  )</p>
  47 + </div>
  48 + <div class="option">
  49 + <ul>
  50 + <li><span>A.</span><img src="images/option_1.png" /></li>
  51 + <li><span>B.</span><img src="images/option_2.png" /></li>
  52 + <li><span>C.</span><img src="images/option_3.png" /></li>
  53 + <li><span>D.</span><img src="images/option_4.png" /></li>
  54 + </ul>
  55 + <div class="clearfix"></div>
  56 + </div>
  57 + <div class="resolve">
  58 + <div class="resolve_box">
  59 + <p>【答案】 A</p>
  60 + <p>【解析】由图数一数,可知总共有7位小同学,其中扎小辫的女孩有2人,男孩有5人。
  61 + 故选A。</p>
  62 +
  63 + <p>【考点】 10以内数的认识</p>
  64 + </div>
  65 + <div class="clearfix"></div>
  66 + <div class="tab_report_box">
  67 + <div class="col-md-3">
  68 + <p>答错人数</p>
  69 + <div class="round_w_orange">
  70 + <div class="round_n_orange">
  71 + <span>0/0</span>
  72 + </div>
  73 + </div>
  74 + </div>
  75 + <div class="col-md-3">
  76 + <p>错误率</p>
  77 + <div class="round_w_red">
  78 + <div class="round_n_red">
  79 + <span>100%</span>
  80 + </div>
  81 + </div>
  82 + </div>
  83 + <div class="col-md-6">
  84 + <div id="main" style="width:250px;height:140px;"></div>
  85 + </div>
  86 + <div class="clearfix"></div>
  87 + </div>
  88 + </div>
  89 +
  90 + <div class="star_box">
  91 + <div class="col-md-6">错误学生:0/0</div>
  92 + <div class="col-md-6">
  93 + <div class="star">
  94 + <span style="float:left;">难度</span>
  95 + <ul>
  96 + <li class="on"></li>
  97 + <li class="on"></li>
  98 + <li class="off"></li>
  99 + <li class="off"></li>
  100 + <li class="off"></li>
  101 + </ul>
  102 + </div>
  103 + <div class="resolve_click">
  104 + <a onclick="slide($(this))">查看解析</a>
  105 + </div>
  106 + </div>
  107 + <div class="clearfix"></div>
  108 + </div>
  109 + </li>
  110 + </ul>
  111 + </div>
  112 + </div>
  113 +
  114 + </div>
  115 + <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
  116 + <script src="../static/js/echars.js"></script>
  117 + <script src="../static/js/loading.js"></script>
  118 + <script>
  119 + var url="http://127.0.0.1:8080/SunvoteEducation";
  120 + function slide(obj){ //查看详情
  121 + obj.closest(".star_box").siblings(".resolve").slideToggle(function(){
  122 + if($(".resolve").css("display") == "none")
  123 + obj.text("查看详情");
  124 + else
  125 + obj.text("收起详情");
  126 + });
  127 + }
  128 +
  129 +
  130 + function bar(index,data1,data2,answer,color){
  131 + var myChart = echarts.init(document.getElementById('main'+index));
  132 + myChart.setOption({
  133 + color: ['#3398DB'],
  134 + tooltip : {
  135 + trigger: 'axis',
  136 + axisPointer : { // 坐标轴指示器,坐标轴触发有效
  137 + type : 'line' // 默认为直线,可选为:'line' | 'shadow'
  138 + }
  139 + },
  140 + grid: {
  141 + top: 15,
  142 + left: '0%',
  143 + right: '0%',
  144 + bottom: '0%',
  145 + containLabel: true
  146 + },
  147 + xAxis : [
  148 + {
  149 + type : 'category',
  150 + data : data2,
  151 + axisTick: {
  152 + alignWithLabel: true
  153 + },
  154 + axisLabel: {
  155 + show:true,
  156 + textStyle:{
  157 + color: function (value){
  158 + console.log(value);
  159 + return value == answer ? '#75b3ff' : '#fcb35b';
  160 + }
  161 + }
  162 + }
  163 + }
  164 +
  165 +
  166 + ],
  167 + yAxis : [
  168 + {
  169 + type : 'value'
  170 + }
  171 + ],
  172 + series : [
  173 + {
  174 + name:'直接访问',
  175 + type:'bar',
  176 + barWidth: '60%',
  177 + data:data1,
  178 + itemStyle: {
  179 + //通常情况下:
  180 + normal:{
  181 + //每个柱子的颜色即为colorList数组里的每一项,如果柱子数目多于colorList的长度,则柱子颜色循环使用该数组
  182 + color: function (params){
  183 + var colorList = color;
  184 + return colorList[params.dataIndex];
  185 + },
  186 + label : {show: true,position:'top',distance:-4}
  187 + }
  188 + }
  189 + }
  190 + ]
  191 + });
  192 + }
  193 +
  194 +function getQueryString(name) {
  195 + var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
  196 + var r = window.location.search.substr(1).match(reg);
  197 + if (r != null) return unescape(r[2]); return null;
  198 + }
  199 + var testpaperId=getQueryString("testpaperId");
  200 +
  201 + var _html="";
  202 + $(document).ready(function(){
  203 + window.top.loading.remove();
  204 + $.ajax({
  205 + url:url+"/api/v1/testpaperinfo",
  206 + async:false,
  207 + type:"post",
  208 + data:{ID:testpaperId},
  209 + success:function(data){
  210 + console.log(data);
  211 + $("#paper_title").html(data.data.name);
  212 + $("#time").html(data.data.CREATE_DATE);
  213 + if(data.data.QUESTIONS.length>0){
  214 + for(var i=0;i<data.data.QUESTIONS.length;i++){
  215 + _html += '<li class="question_li"><div class="stem"></div><div class="option"><ul></ul><div class="clearfix"></div></div><div class="resolve"><div class="resolve_box"><p>【答案】 '+data.data.QUESTIONS[i].ANSWER+'</p><p><span>【解析】</span>'+data.data.QUESTIONS[i].ANALYSIS+'</p></div><div class="clearfix"></div><div class="tab_report_box"><div class="col-md-3"><p>答错人数</p><div class="round_w_orange"><div class="round_n_orange"><span>0/0</span></div></div></div><div class="col-md-3"><p>错误率</p><div class="round_w_red"><div class="round_n_red"><span>100%</span></div></div></div><div class="col-md-6"><div id="main'+i+'" style="width:250px;height:140px;"></div></div><div class="clearfix"></div></div></div><div class="star_box"><div class="col-md-6">错误学生:0/0</div><div class="col-md-6"><div class="star"><span style="float:left;">难度</span></div><div class="resolve_click"><a onclick="slide($(this))">查看详情</a></div></div><div class="clearfix"></div></div></li>';
  216 + }
  217 + console.log(_html);
  218 + $(".analysis ul").html(_html);
  219 + for(var j=0;j<data.data.QUESTIONS.length;j++){
  220 + var option_html="";
  221 + var sum=0;
  222 + var right_num=0;
  223 + var data1=[];
  224 + var data2=[];
  225 + var answer="";
  226 + var color=[];
  227 + $(".analysis li .stem").eq(j).append('<span>'+(j+1)+'、</span>'+data.data.QUESTIONS[j].CONTENT);
  228 + var arry_option=data.data.QUESTIONS[j].OPTION_CONTENT;
  229 + var answerinfo=data.data.QUESTIONS[j].ANSWERINFO;
  230 +
  231 + for(var x=0;x<arry_option.length;x++){
  232 + option_html += '<li><span>'+String.fromCharCode(64 + parseInt(x+1))+'.</span>'+arry_option[x]+'</li>';
  233 + }
  234 + for(k=0;k<answerinfo.length;k++){
  235 + data1[k]=parseInt(answerinfo[k].COUNT);
  236 + data2[k]=answerinfo[k].ANSWER;
  237 + color[k]="#fcb35b";
  238 + if(answerinfo[k].ISRIGHT==1){
  239 + right_num=answerinfo[k].COUNT;
  240 + answer=answerinfo[k].ANSWER;
  241 + color[k]="#75b3ff";
  242 + }
  243 + sum += parseInt(answerinfo[k].COUNT);
  244 + }
  245 + $(".round_n_orange span").eq(j).text((sum-right_num)+"/"+sum);
  246 + $(".round_n_red span").eq(j).text(((sum-right_num)/sum).toFixed(2)*100+"%");
  247 + $(".option").eq(j).find("ul").html(option_html);
  248 +
  249 + star(j,parseInt(data.data.QUESTIONS[j].DIFFICULTY));
  250 + console.log(data1,data2);
  251 + bar(j,data1,data2,answer,color);
  252 + if(data.data.QUESTIONS[j].RANDOM=="1")
  253 + $(".analysis ul").children("li").eq(j).append('<div class="chou">抽</div>');
  254 + }
  255 + }
  256 + }
  257 + })
  258 + })
  259 + function star(index,num){ //难度星级
  260 + $(".star").eq(index).append('<ul></ul>');
  261 + var li_html="";
  262 + for(var i=1;i<=num;i++){
  263 + li_html +='<li class="on"></li>';
  264 + }
  265 + for(var j=num;j<5;j++){
  266 + li_html += '<li class="off"></li>';
  267 + }
  268 +
  269 + $(".star").eq(index).find("ul").html(li_html);
  270 + }
  271 +
  272 +
  273 + console.log(${pd.A});
  274 + </script>
  275 +
  276 +</html>
  277 +
  278 +
  279 +
  280 +
  281 +
... ...
WebRoot/WEB-INF/jsp/sunvote/teacher/set_question.jsp
... ... @@ -9,7 +9,7 @@
9 9 <!-- Bootstrap -->
10 10 <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
11 11 <link href="../static/css/teach.css" rel="stylesheet">
12   - <link href="../static/css/set_quetion.css" rel="stylesheet">
  12 + <link href="../static/css/set_quetion.css?t=11" rel="stylesheet">
13 13  
14 14 <!-- HTML5 shim 和 Respond.js 是为了让 IE8 支持 HTML5 元素和媒体查询(media queries)功能 -->
15 15 <!-- 警告:通过 file:// 协议(就是直接将 html 页面拖拽到浏览器中)访问页面时 Respond.js 不起作用 -->
... ... @@ -23,89 +23,31 @@
23 23 </style>
24 24 </head>
25 25 <body>
26   - <div class="container">
27   - <div class="choose_class">
  26 + <div class="col-md-12">
  27 + <!--<div class="choose_class">
28 28 <div class="col-md-2">
29 29 <p>选择班级</p>
30 30 </div>
31   - <div class="col-md-10">
  31 + <div class="col-md-10 classList">
32 32 <ul>
33 33 <li>一年级1502班</li>
34 34 </ul>
35 35 </div>
36 36 <div class="clearfix"></div>
37   - </div>
  37 + </div>-->
38 38 <div class="col-md-3 left_menu">
39 39 <div class="tab">
40 40 <ul>
41   - <li class="active" data-index=0><p>同步教材</p></li>
42   - <li data-index=1><p>知识点</p></li>
  41 + <li data-index=0><p>同步教材</p></li>
  42 + <li class="active" data-index=1><p>知识点</p></li>
43 43 <div class="clearfix"></div>
44 44 </ul>
45 45 </div>
46 46 <div class="choose_book">
47   - <div class="book"><p><span>西师大版/一年级上</span></p><img src="../static/images/down_arrow.png" /><div class="clearfix"></div></div>
  47 + <div class="book"><p><span id="book_name">西师大版/一年级上</span></p><img src="../static/images/down_arrow.png" /><div class="clearfix"></div></div>
48 48 <div class="book_box">
49 49 <ul>
50   - <li>
51   - <p>人教版</p>
52   - <img src="../static/images/arrow_right.png" />
53   - <div class="clearfix"></div>
54   - <div class="float_box">
55   - <ul>
56   - <li>一年级1502班</li>
57   - <li>一年级1502班</li>
58   - <li>一年级1502班</li>
59   - <li>一年级1502班</li>
60   - <li>一年级1502班</li>
61   - <div class="clearfix"></div>
62   - </ul>
63   - </div>
64   - </li>
65   - <li>
66   - <p>人教版</p>
67   - <img src="../static/images/arrow_right.png" />
68   - <div class="clearfix"></div>
69   - </li>
70   - <li>
71   - <p>人教版</p>
72   - <img src="../static/images/arrow_right.png" />
73   - <div class="clearfix"></div>
74   - </li>
75   - <li>
76   - <p>人教版</p>
77   - <img src="../static/images/arrow_right.png" />
78   - <div class="clearfix"></div>
79   - </li>
80   - <li>
81   - <p>人教版</p>
82   - <img src="../static/images/arrow_right.png" />
83   - <div class="clearfix"></div>
84   - </li>
85   - <li>
86   - <p>人教版</p>
87   - <img src="../static/images/arrow_right.png" />
88   - <div class="clearfix"></div>
89   - </li><li>
90   - <p>人教版</p>
91   - <img src="../static/images/arrow_right.png" />
92   - <div class="clearfix"></div>
93   - </li>
94   - <li>
95   - <p>人教版</p>
96   - <img src="../static/images/arrow_right.png" />
97   - <div class="clearfix"></div>
98   - <div class="float_box">
99   - <ul>
100   - <li>一年级1502班</li>
101   - <li>一年级1502班</li>
102   - <li>一年级1502班</li>
103   - <li>一年级1502班</li>
104   - <li>一年级1502班</li>
105   - <div class="clearfix"></div>
106   - </ul>
107   - </div>
108   - </li>
  50 +
109 51 </ul>
110 52  
111 53 </div>
... ... @@ -246,38 +188,57 @@
246 188 var url="http://127.0.0.1:8080";
247 189 var temp_tag;
248 190 var temp_data;
  191 + var TEXTBOOK_ID="";
  192 + var question_box=[];
  193 + var question_num=0;
  194 +
249 195  
250 196 $(document).ready(function(){
251   - getChapter();
252   - getTeachingMaterial();
  197 + //getClassName();
  198 +
  199 + getPoint();
  200 +
253 201 });
  202 +
  203 + function getQueryString(name) {
  204 + var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
  205 + var r = window.location.search.substr(1).match(reg);
  206 + if (r != null) return unescape(r[2]); return null;
  207 + }
  208 +
  209 + var subject_id=getQueryString("subject_id");
  210 + var class_id=getQueryString("class_id");
  211 +
  212 + //alert(subject_id+";"+class_id);
  213 +
254 214 function getPoint(){ //获取知识点
255 215 $.ajax({
256 216 url:url+"/SunvoteEducation/api/v1/point",
257 217 async:false,
258 218 type:"post",
259   - data:{depth:"",subject_id:20,p_id:"",knowledge_from:101},
  219 + data:{depth:"",subject_id:subject_id,p_id:"",knowledge_from:101},
260 220 success:function(data){
261 221 console.log(data);
262 222 var point_html="";
263 223 for(var i=0;i<data.data.length;i++){
264   - point_html +='<li data-id="'+data.data[i].KNOWLEDGE_ID+'" data-click=0><img src="../static/images/add.png" /><span>'+(i+1)+data.data[i].NAME+'</span></li>';
  224 + point_html +='<li data-id="'+data.data[i].KNOWLEDGE_ID+'" data-img-click=0 data-span-click=0><img src="../static/images/add.png" class="add" /><span>'+(i+1)+data.data[i].NAME+'</span></li>';
265 225 }
266 226 $(".section").children("ul").html(point_html);
  227 + getQuestion($(".section li").eq(0));
267 228 }
268 229 })
269 230 }
270   - function getChapter(){ //获取章节
  231 + function getChapter(TEXTBOOK_ID){ //获取章节
271 232 $(".section").children("ul").html("");
272 233 $.ajax({
273 234 url:url+"/SunvoteEducation/api/v1/chapter",
274 235 async:false,
275 236 type:"post",
276   - data:{TEACHINGMATERIAL_ID:"14f2ad40-d4d6-4558-af5b-c9e3703c1ee8"},
  237 + data:{TEXTBOOK_ID:TEXTBOOK_ID},
277 238 success:function(data){
278 239 console.log(data);
279 240 for(var i=0;i<data.data.length;i++){
280   - $(".section").children("ul").append('<li data-id="'+data.data[i].ID+'" data-click=0><img src="../static/images/add.png" /><span>'+data.data[i].NAME+'</span></li>');
  241 + $(".section").children("ul").append('<li data-id="'+data.data[i].ID+'" data-img-click=0 data-span-click=0><img src="../static/images/add.png" class="add"/><span>'+data.data[i].NAME+'</span></li>');
281 242 if(data.data[i].CHILDREN.length>0){
282 243 $(".section").children("ul").children("li").eq(i).append("<ul></ul>");
283 244 for(var j=0;j<data.data[i].CHILDREN.length;j++){
... ... @@ -302,9 +263,9 @@
302 263 for(var i=0;i<data.data.length;i++){
303 264 console.log(typeof(data.data[i].CHILDREN));
304 265 if(data.data[i].CHILDREN===undefined)
305   - _html +='<li data-id="'+data.data[i].KNOWLEDGE_ID+'" data-click=0 onclick="getQuestion($(this))"><span>●</span><span>'+(i+1)+data.data[i].NAME+'</span></li>';
  266 + _html +='<li data-id="'+data.data[i].KNOWLEDGE_ID+'" data-span-click=0 "><span>●</span><span>'+(i+1)+data.data[i].NAME+'</span></li>';
306 267 else
307   - _html +='<li data-id="'+data.data[i].KNOWLEDGE_ID+'" data-click=0><img src="../static/images/add.png" /><span>'+(i+1)+data.data[i].NAME+'</span></li>';
  268 + _html +='<li data-id="'+data.data[i].KNOWLEDGE_ID+'" data-img-click=0 data-span-click=0 ><img src="../static/images/add.png" class="add"/><span>'+(i+1)+data.data[i].NAME+'</span></li>';
308 269 }
309 270 obj.children('ul').html(_html);
310 271 }
... ... @@ -320,6 +281,7 @@
320 281  
321 282 }
322 283 function getQuestion(obj){ //获取题目
  284 +
323 285 var knowledge_id="",chapter_id="";
324 286 if($(".tab .active").attr("data-index")==1){
325 287 knowledge_id=obj.attr("data-id");
... ... @@ -331,11 +293,11 @@
331 293  
332 294 $.ajax({
333 295 url:url+"/SunvoteEducation/api/v1/questions",
334   - async:false,
  296 + async:true,
335 297 type:"post",
336   - data:{chapter_id:chapter_id,teachingmaterial_id:"",knowledge_id:knowledge_id,question_from:101,user_id:"",problem_type:"",subject_id:"",count:""},
  298 + data:{chapter_id:chapter_id,teachingmaterial_id:"",knowledge_id:knowledge_id,question_from:101,user_id:"",problem_type:"",subject_id:"",count:"5"},
337 299 success:function(data){
338   - console.log(data);
  300 + window.top.loading.remove();
339 301 if(data.data.length>0){
340 302 for(var i=0;i<data.data.length;i++){
341 303 _html += '<li data-id="'+data.data[i].QUESTION_ID+'"><div class="content"></div><div class="option"><ul></ul></div><div class="resolve"><div class="resolve_box"><p><span>【答案】</span> '+data.data[i].ANSWER+'</p><p><span>【解析】</span>'+data.data[i].ANALYSIS+'</p></div></div><div class="star_box"><div class="col-md-6"><div class="star"><span style="float:left;">难度</span></div><div class="resolve_click"><a onclick="slide($(this))">查看解析</a><div class="check_box"></div></div></div><div class="clearfix"></div></div></li>';
... ... @@ -345,9 +307,12 @@
345 307 var option_html="";
346 308 $(".question_box li .content").eq(j).append('<span>'+(j+1)+'、</span>'+data.data[j].CONTENT);
347 309 var arry_option=data.data[j].OPTION_CONTENT;
348   - arry_option=arry_option.replace("[","");
349   - arry_option=arry_option.replace("]","");
350   - arry_option=arry_option.split(",");
  310 + if(question_box.indexOf(data.data[j].QUESTION_ID)>=0){
  311 + $(".check_box").eq(j).addClass("checked");
  312 + }
  313 + //arry_option=arry_option.replace("[","");
  314 + //arry_option=arry_option.replace("]","");
  315 + //arry_option=arry_option.split(",");
351 316 for(var x=0;x<arry_option.length;x++){
352 317 option_html += '<li><span>'+String.fromCharCode(64 + parseInt(x+1))+'.</span>'+arry_option[x]+'</li>';
353 318 }
... ... @@ -356,28 +321,88 @@
356 321 star(j,parseInt(data.data[j].DIFFICULTY));
357 322  
358 323 }
  324 + }else{
  325 + $(".question_box ul").html("");
359 326 }
  327 +
360 328 }
361 329 })
362 330 }
363 331 function getTeachingMaterial(){ //获取教材版本
  332 +
364 333 $.ajax({
365 334 url:url+"/SunvoteEducation/api/v1/teachingmaterial",
366   - async:false,
  335 + async:true,
367 336 type:"post",
368   - data:{subject_id:20},
  337 + data:{subject_id:subject_id},
369 338 success:function(data){
370 339 console.log(data);
371 340 if(data.data.length>0){
372 341 var teach_html="";
  342 +
  343 +
373 344 for(var i=0;i<data.data.length;i++){
374   - teach_html += '<li data-id="'+data.data[i].ID+'"><p>'+data.data[i].NAME+'</p><img src="../static/images/arrow_right.png" /><div class="clearfix"></div></li>';
  345 + teach_html += '<li data-id="'+data.data[i].ID+'" class="li_name"><p class="name">'+data.data[i].NAME+'</p><img src="../static/images/arrow_right.png" /><div class="clearfix"></div></li>';
375 346 }
376 347 $(".book_box ul").html(teach_html);
  348 + var li_length=$(".book_box ul li").length;
  349 + for(var k=0;k<li_length;k++){
  350 + var books=[];
  351 + var book_html="";
  352 + var book_id=$(".book_box ul").children("li").eq(k).attr("data-id");
  353 +
  354 + if(textBook(book_id).length>0){
  355 +
  356 + books=textBook($(".book_box ul li").eq(k).attr("data-id"));
  357 + $(".book_box ul li").eq(k).append('<div class="float_box"><ul><div class="clearfix"></div></ul></div>');
  358 +
  359 + for(var j=0;j<books.length;j++){
  360 + console.log("j:"+j);
  361 + book_html += '<li data-id='+books[j].id+'>'+books[j].name+'</li>';
  362 + }
  363 + $(".float_box").eq(k).children("ul").find(".clearfix").before(book_html);
  364 + TEXTBOOK_ID=books[0].id;
  365 + }
  366 +
  367 + }
  368 + getChapter(TEXTBOOK_ID);
  369 + $("#book_name").text($(".name").eq(0).text()+"/"+$(".float_box").eq(0).find('li').eq(0).text());
377 370 }
378 371  
379 372 }
380 373 })
  374 +
  375 + }
  376 + function textBook(id){
  377 + var textBookName=[];
  378 + $.ajax({
  379 + url:url+"/SunvoteEducation/api/v1/textbook",
  380 + async:false,
  381 + type:"post",
  382 + data:{teaching_material_id:id,subject_id:subject_id,grade_id:""},
  383 + success:function(data){
  384 + //alert(data.data);
  385 + if(data.data.length>0){
  386 + for(var i=0;i<data.data.length;i++){
  387 + textBookName[i]={"name":data.data[i].NAME,"id":data.data[i].ID};
  388 + }
  389 + }
  390 + }
  391 + })
  392 + return textBookName;
  393 + }
  394 + function getClassName(){
  395 + //var className="";
  396 + $.ajax({
  397 + url:url+"/SunvoteEducation/api/v1/classname",
  398 + async:false,
  399 + type:"post",
  400 + data:{id:class_id},
  401 + success:function(data){
  402 + //alert(data.data);
  403 + $(".classList li").html(data.data);
  404 + }
  405 + })
381 406 }
382 407 function star(index,num){ //难度星级
383 408 $(".star").eq(index).append('<ul></ul>');
... ... @@ -392,15 +417,24 @@
392 417 $(".star").eq(index).find("ul").html(li_html);
393 418 }
394 419  
395   - $(".section").on("click","li",function(event){
  420 + $(".section").on("click",".add",function(event){ //展开菜单
396 421 event.stopPropagation();
397   - var that=$(this);
  422 +
  423 + var that=$(this).closest("li");
  424 + //alert(that.attr("data-img-click"));
398 425  
399 426 //console.log(that.attr("data-click"));
400 427 if($(".tab .active").attr("data-index")==1){
401   - if(that.attr("data-click")==0)
  428 + if(that.attr("data-img-click")==0){
402 429 getMenu(that.attr("data-id"),that);
403   - that.attr("data-click",1);
  430 + //getQuestion(that);
  431 + }
  432 + that.attr("data-img-click",1);
  433 + }else{
  434 + if(that.attr("data-img-click")==0){
  435 + //getQuestion(that);
  436 + }
  437 + that.attr("data-img-click",1);
404 438 }
405 439  
406 440 if(that.children('ul').length>0)
... ... @@ -411,43 +445,74 @@
411 445 that.children('img').attr("src","../static/images/add.png");
412 446 });
413 447 });
  448 + $(".section").on("click","span",function(event){ //点击菜单获取题目
  449 + window.top.loading.show();
  450 + event.stopPropagation();
  451 +
  452 + var that=$(this).closest("li");
  453 + if($(".tab .active").attr("data-index")==1){
  454 + getQuestion(that);
  455 + }else{
  456 + getQuestion(that);
  457 + }
  458 +
  459 + });
414 460 $(".book_box").children("ul").on("mouseover","li",function(event){ //教材版本交互
415 461 event.stopPropagation();
416   - $(this).siblings().css("background","#fff");
417   - $(this).css("background","#e9f0ff");
  462 + //$(this).siblings("li").css("background","#fff");
  463 + //$(this).css("background","#e9f0ff");
418 464 //$(".float_box").css("display","none");
419 465 $(this).children(".float_box").css("display","block");
420 466 });
421 467 $(".book_box").children("ul").on("mouseleave","li",function(event){ //教材版本交互
422 468 event.stopPropagation();
423   - $(this).css("background","#fff");
424   - //$(this).children(".float_box").css("display","none");
  469 + //$(this).css("background","#fff");
  470 + $(this).children(".float_box").css("display","none");
425 471 });
426 472 $(".float_box").on("mouseleave",function(event){ //教材版本交互
427 473 event.stopPropagation();
428 474 $(this).css("display","none");
429 475 });
  476 + $(document).on("click",".float_box li",function(event){ //教材版本交互
  477 + //alert($(this).index());
  478 + event.stopPropagation();
  479 + var id=$(this).attr("data-id");
  480 + $("#book_name").text($(this).closest(".li_name").children(".name").text()+"/"+$(this).text());
  481 + $(".float_box").css("display","none");
  482 + $(".book_box").slideToggle();
  483 + getChapter(id);
  484 + });
430 485 $(".book").click(function(){ //教材版本下拉框交互
431 486 $(".book_box").slideToggle();
432 487 })
433 488 $(document).on("click",".check_box",function(){ //选中题目
  489 +
434 490 if($(this).hasClass("checked")){
  491 + var id=$(this).closest("li").attr("data-id");
  492 + var que_index=question_box.indexOf(id);
435 493 $(this).removeClass("checked");
  494 + question_box.splice(que_index,1);
  495 + question_num--;
436 496 }else{
  497 + question_box[question_num]=$(this).closest("li").attr("data-id");
  498 + question_num++;
437 499 $(this).addClass("checked");
438 500 }
439   - $("#all_que_num").html($(".checked").length);
  501 + $("#all_que_num").html(question_num);
440 502 });
441 503 $(".clear_que").click(function(){ //清空
  504 + question_num=0;
  505 + question_box=[];
442 506 $(".checked").removeClass("checked");
443   - $("#all_que_num").html($(".checked").length);
  507 + $("#all_que_num").html(question_num);
444 508 });
445 509 $(".tab li").click(function(){ //教材与知识点选择
446 510 $(this).siblings().removeClass("active");
447 511 $(this).addClass("active");
448 512 if($(this).index()==0){
  513 + getTeachingMaterial();
449 514 $(".choose_book").css("display","block");
450   - getChapter();
  515 + getChapter(TEXTBOOK_ID);
451 516 }else{
452 517 $(".choose_book").css("display","none");
453 518 getPoint();
... ... @@ -461,11 +526,11 @@
461 526 });
462 527 $("#submit").click(function(){
463 528 var question_arry=[];
464   - for(var i=0;i<$(".checked").length;i++){
  529 + for(var i=0;i<question_num;i++){
465 530 question_arry[i]={
466 531 score: "0",
467 532 part_score: "0",
468   - question_id: $(".checked").eq(i).closest("li").attr("data-id"),
  533 + question_id: question_box[i],
469 534 rank: i.toString(),
470 535 no_name: i.toString()
471 536 };
... ... @@ -477,7 +542,7 @@
477 542 paper_type: "101",
478 543 subject_id: "20",
479 544 grade_id: "",
480   - class_id: "30378682ca9c4c648118afe55569aa97",
  545 + class_id: class_id,
481 546 user_id: "8dbef15bb6d043ec94b719ede583b033",
482 547 score: "100",
483 548 questions: question_arry
... ... @@ -493,6 +558,7 @@
493 558 success:function(data){
494 559 alert("上传成功");
495 560 $('#myModal').modal('hide');
  561 + window.history.go(-1);
496 562 }
497 563 })
498 564  
... ...
WebRoot/WEB-INF/jsp/sunvote/teacher/teach_paper.jsp
... ... @@ -16,114 +16,159 @@
16 16  
17 17 <!-- Bootstrap -->
18 18 <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
  19 +
  20 + <link rel="stylesheet" href="../static/ace/css/datepicker.css" />
19 21 <link href="../static/css/teach.css" rel="stylesheet">
20   - <link href="../static/css/paper.css" rel="stylesheet">
  22 + <link href="../static/css/paper.css?t=1" rel="stylesheet">
21 23 </head>
22 24 <body>
23   - <div class="container">
24   - <div class="page-header">
25   - <h3 class="col-md-6">布置练习</h3>
26   - <a href="set_question" class="btn btn-info">出题</a>
27   - <div class="clearfix"></div>
28   - </div>
29   - <div class="choose_class">
30   - <div class="col-md-2"><h4>选择班级</h4></div>
31   - <div class="col-md-10">
32   - <ul>
33   - <li>一年级1501班</li>
34   - <li class="active">一年级1502班</li>
35   - <li>一年级1503班</li>
36   - <li>一年级1504班</li>
37   - <li>一年级1505班</li>
38   - </ul>
  25 +
  26 + <div class="head_box">
  27 + <div class="box_header">
  28 + <div class="head_box_l">
  29 + <p>
  30 + <span class="right_b"></span>即时测试卷管理
  31 + </p>
  32 + </div>
  33 + <div class="head_box_r">
  34 + <input class="date-picker" type="text" placeholder="开始日期" name="lastStart" id="lastStart" data-date-format="yyyy-mm-dd" readonly="readonly" value=""/>
  35 + <input type="text" class="date-picker" placeholder="结束日期" name="lastEnd" id="lastEnd" data-date-format="yyyy-mm-dd" readonly="readonly" value=""/>
  36 + <select name="dealer_id_2" id="dealer_id_2" class="selectpicker show-tick form-control" data-width="98%" data-first-option="false" required data-live-search="true">
  37 + <!--<option value="0">初一1501班</option>
  38 + <option value="0">初一1502班</option>
  39 + <option value="0">初一1503班</option>
  40 + <option value="0">初一1504班</option>
  41 + <option value="0">初一1505班</option>-->
  42 + </select>
  43 + <a onclick="tosearch();"><img
  44 + src="../static/images/search.png" /></a>
  45 + </div>
  46 + <div class="clear"></div>
  47 + </div>
  48 + <div style="padding:0 5%;background:#fff;">
  49 + <table class="table table-striped">
  50 + <col style="width: 10%" />
  51 + <col style="width: 20%" />
  52 + <col style="width: 10%" />
  53 + <col style="width: 10%" />
  54 + <col style="width: 10%" />
  55 + <col style="width: 20%" />
  56 + <col style="width: 10%" />
  57 + <col style="width: 10%" />
  58 + <thead>
  59 + <tr>
  60 + <th><input type="checkbox" name='ids' id="ids" />序号</th>
  61 + <th>试卷名称</th>
  62 + <th>班级</th>
  63 + <th>科目</th>
  64 + <th>考试时长</th>
  65 + <th>创建时间</th>
  66 + <th>查看</th>
  67 + <th>操作</th>
  68 + </tr>
  69 + </thead>
  70 + </table>
  71 + </div>
  72 + <div class="clearfix"></div>
39 73 </div>
40   - <div class="clearfix"></div>
41   - </div>
42   - <div class="screen">
43   - <div class="col-md-2">按条件筛选</div>
44   - <div class="col-md-10">
45   - <ul>
46   - <li>
47   - <div class="form-group">
48   - <div class="col-sm-3">
49   - <select name="dealer_id_1" id="dealer_id_1" class="selectpicker show-tick form-control" data-width="98%" data-first-option="false" title='请选择经销商(必选)' required data-live-search="true">
50   - <option value="0">现在</option>
51   - <option value="0">6月</option>
52   - <option value="0">7月</option>
53   - </select>
54   - </div>
55   - </div>
56   - </li>
57   - <li>
58   - <div class="form-group">
59   - <div class="col-sm-3">
60   - <select name="dealer_id_2" id="dealer_id_2" class="selectpicker show-tick form-control" data-width="98%" data-first-option="false" title='请选择经销商(必选)' required data-live-search="true">
61   - <option value="0">初一1501班</option>
62   - <option value="0">初一1502班</option>
63   - <option value="0">初一1503班</option>
64   - <option value="0">初一1504班</option>
65   - <option value="0">初一1505班</option>
66   - </select>
67   - </div>
68   - </div>
69   - </li>
70   - <li>
71   - <button type="button" class="btn btn-info">搜索</button>
72   - </li>
73   - </ul>
  74 + <div class="table_box">
  75 + <table class="table table-striped">
  76 + <col style="width: 10%" />
  77 + <col style="width: 20%" />
  78 + <col style="width: 10%" />
  79 + <col style="width: 10%" />
  80 + <col style="width: 10%" />
  81 + <col style="width: 20%" />
  82 + <col style="width: 10%" />
  83 + <tbody id="tab_body">
  84 +
  85 + </tbody>
  86 + </table>
  87 +
  88 +
  89 + <div class="footer">
  90 + <div class="creat">
  91 + <input type="button" id="creatPaper" value="新建试卷" />
  92 + </div>
  93 + <div class="removeAll">
  94 + <input type="button" onclick="deleteAll()" value="批量删除" />
  95 + </div>
  96 + <div class="page_box">
  97 +
  98 + <div class="pagination" style="float: right;padding-top: 0px;margin-top: 0px;">${page.pageStr}</div>
  99 + </div>
  100 + </div>
74 101 </div>
75   - <div class="clearfix"></div>
76   - </div>
77   - <div class="result">
78   - <table class="table table-striped">
79   - <thead>
80   - <tr>
81   - <th>序号</th>
82   - <th>创建时间</th>
83   - <th>班级</th>
84   - <th>科目</th>
85   - <th>完成情况</th>
86   - <th>试卷名称</th>
87   - <th>考试时长</th>
88   - <th>状态</th>
89   - <th>查看</th>
90   - </tr>
91   - </thead>
92   - <tbody id="tab_body">
93   - <tr>
94   - <td>1</td>
95   - <td>2018/7/31</td>
96   - <td>一年级1502班</td>
97   - <td>小学数学</td>
98   - <td>0/2</td>
99   - <td>数一数</td>
100   - <td>2018/08/05 08:00</td>
101   - <td>已截止</td>
102   - <td>查看</td>
103   - </tr>
104   - <tr>
105   - <td>2</td>
106   - <td>2018/6/21</td>
107   - <td>一年级1502班</td>
108   - <td>小学数学</td>
109   - <td>0/2</td>
110   - <td>1.1 认识平面图形</td>
111   - <td>2018/06/24 08:00</td>
112   - <td>已截止</td>
113   - <td>查看</td>
114   - </tr>
115   - </tbody>
116   - </table>
117   - </div>
118   - </div>
  102 + <div class="modal fade" id="myModal" tabindex="-1" role="dialog">
  103 + <div class="modal-dialog" role="document">
  104 + <div class="modal-content">
  105 + <div class="modal-header">
  106 + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  107 + <h4 class="modal-title">请选择班级</h4>
  108 + </div>
  109 + <div class="modal-body">
  110 + <form class="form-horizontal">
  111 + <div class="classList">
  112 + <ul>
  113 +
  114 + </ul>
  115 + </div>
  116 + </form>
  117 + </div>
  118 + <div class="modal-footer">
  119 + <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
  120 + <button type="button" class="btn btn-primary" id="submit" onclick="setQUestion()">确定</button>
  121 + </div>
  122 + </div><!-- /.modal-content -->
  123 + </div><!-- /.modal-dialog -->
  124 + </div><!-- /.modal -->
  125 +
  126 +
119 127 <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
  128 + <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
  129 + <script src="../static/ace/js/date-time/bootstrap-datepicker.js"></script>
  130 + <script src="../static/ace/js/bootbox.js"></script>
  131 +
120 132 <script>
121   - var url="http://127.0.0.1:8080/SunvoteEducation";
122   - var tab_html="";
123   - var user_id= "8dbef15bb6d043ec94b719ede583b033",
  133 + var url="/SunvoteEducation";
  134 +
  135 + var class_html="",option_html="";
  136 + var user_id= "",
124 137 subject_id="",
125 138 class_id="";
126 139 $(document).ready(function(){
  140 + getList();
  141 + timeList();
  142 + $.ajax({
  143 + url:url+"/teacher/info",
  144 + async:false,
  145 + type:"post",
  146 + success:function(data){
  147 + console.log(data);
  148 + subject_id=data.data.subjectList[0].SUBJECT_ID;
  149 + user_id=data.data.ID;
  150 +
  151 + if(data.data.classInfoList.length>0){
  152 + for(var i=0;i<data.data.classInfoList.length;i++){
  153 + class_html += '<li data-classId="'+data.data.classInfoList[i].CLASS_ID+'">'+data.data.classInfoList[i].CLASS_NAME+'</li>';
  154 + option_html += '<option value="'+data.data.classInfoList[i].CLASS_ID+'">'+data.data.classInfoList[i].CLASS_NAME+'</option>'
  155 + }
  156 + $(".classList").html(class_html+'<div class="clearfix"></div>');
  157 + $("#dealer_id_2").html(option_html);
  158 + }
  159 + }
  160 + })
  161 +
  162 + //日期框
  163 + $('.date-picker').datepicker({
  164 + autoclose: true,
  165 + todayHighlight: true
  166 + });
  167 + window.top.loading.remove();
  168 + })
  169 +
  170 + function getList(start_date,end_date,class_id){
  171 + var tab_html="";
127 172 $.ajax({
128 173 url:url+"/api/v1/paper",
129 174 async:false,
... ... @@ -133,22 +178,178 @@
133 178 user_id:user_id,
134 179 subject_id:subject_id,
135 180 class_id:class_id,
136   - currentpage:"",
137   - showcount:"10"
  181 + currentpage:"1",
  182 + showcount:"",
  183 + start_date:start_date,
  184 + end_date:end_date
138 185 },
139 186 success:function(data){
  187 + console.log(data);
140 188 for(var i=0;i<data.data.length;i++){
141   - tab_html += '<tr><td>'+(i+1)+'</td><td>'+data.data[i].CREATE_DATE+'</td><td>一年级1502班</td><td>小学数学</td><td>0/2</td><td>'+data.data[i].TITLE+'</td><td>'+data.data[i].EXAM_TIME+'分钟</td><td>已截止</td><td><a onclick="jump($(this));" data-id="'+data.data[i].PAPER_ID+'" >查看</a></td></tr>'
  189 + tab_html += '<tr data-id="'+data.data[i].PAPER_ID+'" data-classid="'+data.data[i].CLASS_ID+'"><td><input type="checkbox" name="ids" id="ids" value="'+data.data[i].PAPER_ID+'"/>'+(i+1)+'</td><td>'+data.data[i].TITLE+'</td><td>'+getClassName(data.data[i].CLASS_ID)+'</td><td>'+getSubjectName(data.data[i].SUBJECT_ID)+'</td><td>'+data.data[i].EXAM_TIME+'分钟</td><td>'+data.data[i].CREATE_DATE+'</td><td><a onclick="jump($(this))">查看</a></td><td><a href="#" onclick="del($(this));"><img src="../static/images/remove.png" /></a></td></tr>';
142 190 }
143 191 $("#tab_body").html(tab_html);
  192 + window.top.loading.remove();
144 193 }
145   - })
146   - })
  194 + });
  195 + }
  196 + $('#ids').on('click', function(){
  197 + var th_checked = $("#ids").prop('checked');//checkbox inside "TH" table header
  198 +
  199 + $(".table_box .table").find('tbody > tr').each(function(){
  200 + var row = this;
  201 + if(th_checked) $(row).find('input[type=checkbox]').eq(0).prop('checked', true);
  202 + else $(row).find('input[type=checkbox]').eq(0).prop('checked', false);
  203 + });
  204 + });
147 205 function jump(obj){
148   - var id=obj.attr("data-id");
149   - location.href="paper_view.do?PAPER_ID="+id;
  206 + var id=obj.closest("tr").attr("data-id");
  207 + var classid=obj.closest("tr").attr("data-classid");
  208 + location.href="paper_view.do?PAPER_ID="+id+"&classID="+classid+"&userid="+user_id;
  209 + }
  210 + $(".classList").on("click","li",function(){
  211 + $(this).siblings().removeClass("active");
  212 + $(this).addClass("active");
  213 + class_id=$(this).attr("data-classid");
  214 + });
  215 + $("#creatPaper").click(function(){
  216 + $('#myModal').modal('show');
  217 + });
  218 + function setQUestion(){
  219 + if($(".classList .active").length>0){
  220 + location.href="set_question.do?subject_id="+subject_id+"&class_id="+class_id;
  221 + }else{
  222 + alert("请先选择班级");
  223 + }
  224 + window.top.loading.show();
  225 + console.log($(".classList .active").length);
  226 + //location.href="";
  227 + }
  228 + function getSubjectName(id){
  229 + var subjectName="";
  230 + $.ajax({
  231 + url:url+"/api/v1/subjectcname",
  232 + async:false,
  233 + type:"post",
  234 + data:{id:id},
  235 + success:function(data){
  236 + subjectName=data.data;
  237 + }
  238 + })
  239 + return subjectName;
  240 + }
  241 + function getClassName(id){
  242 + var className="";
  243 + $.ajax({
  244 + url:url+"/api/v1/classname",
  245 + async:false,
  246 + type:"post",
  247 + data:{id:id},
  248 + success:function(data){
  249 + className=data.data;
  250 + }
  251 + })
  252 + return className;
  253 + }
  254 + function getday(month){
  255 + var time=[];
  256 + var d= new Date();
  257 + d.setMonth(month-1);
  258 + d.setDate(1);
  259 + var day=d.getDate();
  260 + var month=d.getMonth()+1;
  261 + if((d.getMonth()+1)<10){
  262 + var month="0"+(d.getMonth()+1);
  263 + }
  264 + var year=d.getFullYear();
  265 + var startTime=year+"-"+month+"-"+day;
  266 + d.setMonth(month);
  267 + var end_day=d.getDate();
  268 + var end_month=d.getMonth()+1;
  269 + if((d.getMonth()+1)<10){
  270 + var end_month="0"+(d.getMonth()+1);
  271 + }
  272 + var end_year=d.getFullYear();
  273 + var endTime=end_year+"-"+end_month+"-"+end_day;
  274 + time[0]=startTime;
  275 + time[1]=endTime;
  276 + return time;
  277 + }
  278 + function timeList(){
  279 + var time = new Date();
  280 + var now_month=time.getMonth()+1;
  281 + time.setMonth(now_month-1)
  282 + if(time.getMonth()!= 0 ){
  283 + var preceding_month = time.getMonth();
  284 + }else
  285 + var preceding_month = 12;
  286 + time.setMonth(now_month-2)
  287 + if(time.getMonth()!= 0 ){
  288 + var last_month = time.getMonth();
  289 + }else
  290 + var last_month = 12;
  291 + var option_html="";
  292 + option_html += '<option value="'+now_month+'">'+now_month+'月</option><option value="'+preceding_month+'">'+preceding_month+'月</option><option value="'+last_month+'">'+last_month+'月</option>';
  293 + $("#dealer_id_1").html(option_html);
  294 + }
  295 + function tosearch(){
  296 + //var timeBox=getday($("#dealer_id_1").val());
  297 + var start_date=$("#lastStart").val();
  298 + var end_date=$("#lastEnd").val();
  299 + var class_id=$("#dealer_id_2").val();
  300 + getList(start_date,end_date,class_id);
  301 + }
  302 +
  303 + function del(obj){
  304 + //var remove = new remove();
  305 + var id=obj.closest("tr").attr("data-id");
  306 + window.top.remove.init({"title":"删除","func":function(success){
  307 + if(success){
  308 + var url = "<%=basePath%>paper/delete.do?PAPER_ID="+id+"&tm="+new Date().getTime();
  309 + window.top.loading.show();
  310 + $.get(url,function(data){
  311 + tosearch();
  312 + });
  313 + }
  314 + else{
  315 + console.log("false");
  316 + }
  317 + }});
  318 + window.top.remove.show();
  319 + }
  320 + function deleteAll(){
  321 + window.top.remove.init({"title":"删除","func":function(success){
  322 + if(success){
  323 + var str = '';
  324 + for(var i=0;i < document.getElementsByName('ids').length;i++){
  325 + if(document.getElementsByName('ids')[i].checked){
  326 + if(str=='') str += document.getElementsByName('ids')[i].value;
  327 + else str += ',' + document.getElementsByName('ids')[i].value;
  328 + }
  329 + }
  330 + if(str==''){
  331 +
  332 + }else{
  333 + $.ajax({
  334 + type: "POST",
  335 + url: '<%=basePath%>paper/deleteAll.do?tm='+new Date().getTime(),
  336 + data: {DATA_IDS:str},
  337 + dataType:'json',
  338 + //beforeSend: validateData,
  339 + cache: false,
  340 + success: function(data){
  341 + $.each(data.list, function(i, list){
  342 + tosearch();
  343 + });
  344 + }
  345 + });
  346 + }
  347 + }
  348 + else{
  349 + console.log("false");
  350 + }
  351 + }});
  352 + window.top.remove.show();
150 353 }
151   -
152   -
153 354 </script>
154 355 </html>
155 356 \ No newline at end of file
... ...
WebRoot/WEB-INF/jsp/sunvote/teacher/teacher_main.jsp
... ... @@ -104,7 +104,7 @@
104 104 <p>云测验测验分析</p>
105 105 <ul class="menu_2">
106 106 <c:forEach items="${pd.TEACHER}" var="var" varStatus="vs">
107   - <li onclick="event.stopPropagation();report('${var.CLASS_ID}')"><p>${var.CLASS_NAME} 成绩</p></li>
  107 + <li onclick="event.stopPropagation();report2('${var.CLASS_ID}')"><p>${var.CLASS_NAME} 成绩</p></li>
108 108 </c:forEach>
109 109 </ul>
110 110 </li>
... ... @@ -177,6 +177,13 @@
177 177 window.top.loading.show();
178 178 //}
179 179 }
  180 + function report2(classId){
  181 + //window.open('<%=basePath%>report/report.do?classid=' + classId);
  182 + //if($("#mainFrame").attr('src') != ('<%=basePath%>report/report.do?classid=' + classId)){
  183 + $("#mainFrame").attr('src','<%=basePath%>teacher/test_list.do?classid=' + classId);
  184 + window.top.loading.show();
  185 + //}
  186 + }
180 187  
181 188 $("#time_submit").click(function(){
182 189 var name = $("#enter_title").val();
... ... @@ -205,7 +212,7 @@
205 212 var path = "../teacher/teach_paper.do?" ;
206 213 //if($("#mainFrame").attr('src') != (path)){
207 214 $("#mainFrame").attr('src',path);
208   - //window.top.loading.show();
  215 + window.top.loading.show();
209 216 //}
210 217 });
211 218 </script>
... ...
WebRoot/WEB-INF/jsp/sunvote/teacher/test_list.jsp 0 → 100644
  1 +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2 +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
  3 +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
  4 +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
  5 +<%
  6 + String path = request.getContextPath();
  7 + String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
  8 +%>
  9 +<!DOCTYPE html>
  10 +<html lang="zh-CN">
  11 + <head>
  12 + <meta charset="utf-8">
  13 + <meta http-equiv="X-UA-Compatible" content="IE=edge">
  14 + <meta name="viewport" content="width=device-width, initial-scale=1">
  15 + <title>即时测</title>
  16 +
  17 + <!-- Bootstrap -->
  18 + <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
  19 + <link rel="stylesheet" href="../static/ace/css/datepicker.css" />
  20 + <link href="../static/css/teach.css" rel="stylesheet">
  21 + <link href="../static/css/paper.css?t=1" rel="stylesheet">
  22 + </head>
  23 + <body>
  24 + <div class="head_box">
  25 + <div class="box_header">
  26 + <div class="head_box_l">
  27 + <p>
  28 + <span class="right_b"></span>云测验测验分析
  29 + </p>
  30 + </div>
  31 + <div class="head_box_r">
  32 + <input class="date-picker" type="text" placeholder="开始日期" name="lastStart" id="lastStart" data-date-format="yyyy-mm-dd" readonly="readonly" value=""/>
  33 + <input type="text" class="date-picker" placeholder="结束日期" name="lastEnd" id="lastEnd" data-date-format="yyyy-mm-dd" readonly="readonly" value=""/>
  34 + <a onclick="tosearch();"><img
  35 + src="../static/images/search.png" /></a>
  36 + </div>
  37 + <div class="clear"></div>
  38 + </div>
  39 + <div style="padding:0 5%;background:#fff;">
  40 + <table class="table table-striped">
  41 + <col style="width: 10%" />
  42 + <col style="width: 20%" />
  43 + <col style="width: 10%" />
  44 + <col style="width: 20%" />
  45 + <col style="width: 10%" />
  46 + <thead>
  47 + <tr>
  48 + <th>序号</th>
  49 + <th>创建时间</th>
  50 + <th>班级</th>
  51 + <th>试卷名称</th>
  52 + <th>查看</th>
  53 + </tr>
  54 + </thead>
  55 + </table>
  56 + </div>
  57 + <div class="clearfix"></div>
  58 + </div>
  59 + <div class="table_box">
  60 + <table class="table table-striped">
  61 + <col style="width: 10%" />
  62 + <col style="width: 20%" />
  63 + <col style="width: 10%" />
  64 + <col style="width: 20%" />
  65 + <col style="width: 10%" />
  66 + <tbody id="tab_body">
  67 +
  68 + </tbody>
  69 + </table>
  70 +
  71 +
  72 + <div class="footer">
  73 + <!--<div class="creat">
  74 + <input type="button" id="creatPaper" value="新建试卷" />
  75 + </div>
  76 + <div class="removeAll">
  77 + <input type="button" onclick="deleteAll()" value="批量删除" />
  78 + </div>-->
  79 + <div class="page_box">
  80 +
  81 + <div class="pagination" style="float: right;padding-top: 0px;margin-top: 0px;">${page.pageStr}</div>
  82 + </div>
  83 + </div>
  84 + </div>
  85 + <!--<div class="container">
  86 + <div class="screen">
  87 + <div class="col-md-2">按条件筛选</div>
  88 + <div class="col-md-10">
  89 + <ul>
  90 + <li>
  91 + <div class="form-group">
  92 + <div class="col-sm-3">
  93 + <select name="dealer_id_1" id="dealer_id_1" class="selectpicker show-tick form-control" data-width="98%" data-first-option="false" title='请选择经销商(必选)' required data-live-search="true">
  94 + <option value="0">现在</option>
  95 + <option value="0">6月</option>
  96 + <option value="0">7月</option>
  97 + </select>
  98 + </div>
  99 + </div>
  100 + </li>
  101 + <li>
  102 + <div class="form-group">
  103 + <div class="col-sm-3">
  104 + <select name="dealer_id_2" id="dealer_id_2" class="selectpicker show-tick form-control" data-width="98%" data-first-option="false" title='请选择经销商(必选)' required data-live-search="true">
  105 + <option value="0">初一1501班</option>
  106 + <option value="0">初一1502班</option>
  107 + <option value="0">初一1503班</option>
  108 + <option value="0">初一1504班</option>
  109 + <option value="0">初一1505班</option>
  110 + </select>
  111 + </div>
  112 + </div>
  113 + </li>
  114 + <li>
  115 + <button type="button" class="btn btn-info" onclick="search()">搜索</button>
  116 + </li>
  117 + </ul>
  118 + </div>
  119 + <div class="clearfix"></div>
  120 + </div>
  121 + <div class="result">
  122 + <table class="table table-striped">
  123 + <thead>
  124 + <tr>
  125 + <th>序号</th>
  126 + <th>创建时间</th>
  127 + <th>班级</th>
  128 + <th>科目</th>
  129 + <th>试卷名称</th>
  130 + <th>考试时长</th>
  131 + <th>查看</th>
  132 + </tr>
  133 + </thead>
  134 + <tbody id="tab_body">
  135 + <tr>
  136 + <td>1</td>
  137 + <td>2018/7/31</td>
  138 + <td>一年级1502班</td>
  139 + <td>小学数学</td>
  140 + <td>0/2</td>
  141 + <td>数一数</td>
  142 + <td>2018/08/05 08:00</td>
  143 + <td>已截止</td>
  144 + <td>查看</td>
  145 + </tr>
  146 + <tr>
  147 + <td>2</td>
  148 + <td>2018/6/21</td>
  149 + <td>一年级1502班</td>
  150 + <td>小学数学</td>
  151 + <td>0/2</td>
  152 + <td>1.1 认识平面图形</td>
  153 + <td>2018/06/24 08:00</td>
  154 + <td>已截止</td>
  155 + <td>查看</td>
  156 + </tr>
  157 + </tbody>
  158 + </table>
  159 + </div>
  160 + </div> -->
  161 + <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
  162 + <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
  163 + <script src="../static/ace/js/date-time/bootstrap-datepicker.js"></script>
  164 +
  165 + <script>
  166 + var url="http://127.0.0.1:8080/SunvoteEducation";
  167 +
  168 + var option_html="";
  169 + var user_id= "8dbef15bb6d043ec94b719ede583b033",
  170 + subject_id="";
  171 +
  172 + function getQueryString(name) {
  173 + var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
  174 + var r = window.location.search.substr(1).match(reg);
  175 + if (r != null) return unescape(r[2]); return null;
  176 + }
  177 + var class_id=getQueryString("classid");
  178 + $(document).ready(function(){
  179 + getList();
  180 + //timeList();
  181 + $.ajax({
  182 + url:url+"/teacher/info",
  183 + async:false,
  184 + type:"post",
  185 + success:function(data){
  186 + subject_id=data.data.subjectList[0].SUBJECT_ID;
  187 + user_id=data.data.ID;
  188 + if(data.data.classInfoList.length>0){
  189 + for(var i=0;i<data.data.classInfoList.length;i++){
  190 + option_html += '<option value="'+data.data.classInfoList[i].CLASS_ID+'">'+data.data.classInfoList[i].CLASS_NAME+'</option>'
  191 + }
  192 + $("#dealer_id_2").html(option_html);
  193 + }
  194 + }
  195 + })
  196 + //日期框
  197 + $('.date-picker').datepicker({
  198 + autoclose: true,
  199 + todayHighlight: true
  200 + });
  201 + window.top.loading.remove();
  202 + })
  203 + function getList(start_date,end_date,class_id){
  204 + var tab_html="";
  205 + $.ajax({
  206 + url:url+"/api/v1/testpaper",
  207 + async:false,
  208 + type:"post",
  209 + data:{
  210 + paper_type:"101",
  211 + user_id:user_id,
  212 + subject_id:subject_id,
  213 + class_id:class_id,
  214 + currentpage:"1",
  215 + showcount:"",
  216 + start_date:start_date,
  217 + end_date:end_date
  218 + },
  219 + success:function(data){
  220 + console.log(data);
  221 + for(var i=0;i<data.data.length;i++){
  222 + tab_html += '<tr><td>'+(i+1)+'</td><td>'+data.data[i].createDate+'</td><td>'+getClassName(data.data[i].classId)+'</td><td>'+data.data[i].name+'</td><td><a onclick="window.top.loading.show();jump($(this));" data-id="'+data.data[i].testpaperId+'" >查看</a></td></tr>'
  223 + }
  224 + $("#tab_body").html(tab_html);
  225 + }
  226 + });
  227 + }
  228 + function jump(obj){
  229 + var id=obj.attr("data-id");
  230 + location.href="paper_view1.do?testpaperId="+id + "&a={a:b}";
  231 + }
  232 + $(".classList").on("click","li",function(){
  233 + $(this).siblings().removeClass("active");
  234 + $(this).addClass("active");
  235 + })
  236 + function getSubjectName(id){
  237 + var subjectName="";
  238 + $.ajax({
  239 + url:url+"/api/v1/subjectcname",
  240 + async:false,
  241 + type:"post",
  242 + data:{id:id},
  243 + success:function(data){
  244 + subjectName=data.data;
  245 + }
  246 + })
  247 + return subjectName;
  248 + }
  249 + function getClassName(id){
  250 + var className="";
  251 + $.ajax({
  252 + url:url+"/api/v1/classname",
  253 + async:false,
  254 + type:"post",
  255 + data:{id:id},
  256 + success:function(data){
  257 + className=data.data;
  258 + }
  259 + })
  260 + return className;
  261 + }
  262 + function tosearch(){
  263 + var start_date=$("#lastStart").val();
  264 + var end_date=$("#lastEnd").val();
  265 + var class_id=$("#dealer_id_2").val();
  266 + getList(start_date,end_date,class_id);
  267 + }
  268 +
  269 + </script>
  270 +</html>
0 271 \ No newline at end of file
... ...
WebRoot/static/css/paper.css
1 1 li{list-style:none;}
2   -.choose_class{border-bottom:1px solid #eee;padding:2% 0 5% 0;}
3   -.choose_class li{width:20%;margin:0 2.5%;margin-top:2%;float:left;border:1px solid #3c7ae3;text-align:center;border-radius:3px;line-height:50px;font-size:16px;}
4   -.choose_class li.active{color:#fff;background:#3c7ae3;}
5   -.screen{border-bottom:1px dashed #eee;padding:3% 0;}
6 2 \ No newline at end of file
  3 +.classList{padding:2% 0 5% 0;}
  4 +.classList li{width:20%;margin:0 2.5%;margin-top:2%;float:left;border:1px solid #3c7ae3;text-align:center;border-radius:3px;line-height:50px;font-size:16px;}
  5 +.classList li.active{color:#fff;background:#3c7ae3;}
  6 +.screen{border-bottom:1px dashed #eee;padding:3% 0;}
  7 +.head_box_r{width:70%;text-align:right;}
  8 +.form-control{height:26px;padding:2px 12px;width:185px;display: inline-block;border-radius: 0px;}
7 9 \ No newline at end of file
... ...
WebRoot/static/css/paper_view.css
... ... @@ -20,4 +20,6 @@
20 20 .tab_report_box .round_n_orange span{color:#fff;line-height:70px;text-align:center;display:inline-block;width:100%;}
21 21 .tab_report_box .round_w_red{width:100px;height:100px;background:#ffd0c6;position:relative;overflow:hidden;border-radius:50px;margin:0 auto;}
22 22 .tab_report_box .round_n_red{width:70px;height:70px;background:#ff8a71;position:absolute;top:15px;left:15px;overflow:hidden;border-radius:35px;}
23   -.tab_report_box .round_n_red span{color:#fff;line-height:70px;text-align:center;display:inline-block;width:100%;}
24 23 \ No newline at end of file
  24 +.tab_report_box .round_n_red span{color:#fff;line-height:70px;text-align:center;display:inline-block;width:100%;}
  25 +.analysis .question_li{position:relative;padding-top:15px;}
  26 +.chou{width:24px;height:24px;text-align:center;line-height:24px;border-radius:12px;border:1px solid #f00;color:#f00;position:absolute;top:15px;right:0;opacity:0.5}
25 27 \ No newline at end of file
... ...
WebRoot/static/css/set_quetion.css
... ... @@ -10,23 +10,27 @@ li{list-style:none;}
10 10 .left_menu .tab .active{border-bottom: 2px solid #3c7ae3;}
11 11 .left_menu .tab .active p{color:#3c7ae3;}
12 12 .left_menu .tab li:first-child{border-right:1px solid #ccc;}
  13 +.left_menu .choose_book{display:none;}
13 14 .left_menu .choose_book .book{background:#e9f0ff;padding:0 6px;}
14 15 .left_menu .choose_book .book p{float:left;line-height:34px;margin-bottom:0;}
15 16 .left_menu .choose_book .book img{float:right;width:20px;height:20px;margin-top:4.5px;}
16 17 .left_menu .choose_book .book_box{display:none;}
17 18 .left_menu .choose_book .book_box ul{padding:0;margin:0;}
18   -.left_menu .choose_book .book_box ul li{border-bottom:1px solid #ccc;position:relative;}
  19 +.left_menu .choose_book .book_box ul li{border-bottom:1px solid #ccc;position:relative;cursor:pointer}
  20 +.left_menu .choose_book .book_box ul li:hover{background:#e9f0ff;}
  21 +
19 22 .left_menu .choose_book .book_box p{float:left;line-height:34px;margin-bottom:0;font-size:14px;}
20 23 .left_menu .choose_book .book_box img{float:right;width:20px;height:20px;margin-top:4.5px;}
21 24 .left_menu .choose_book .gary{width:100%;height:15px;background:#eee;}
22 25 .left_menu .section{padding:20px 0;}
23 26 .left_menu .section ul{padding:0;margin:0;}
24   -.left_menu .section ul li{padding:10px 0;border-bottom:1px solid #ccc;}
  27 +.left_menu .section ul li{padding:10px 0;border-bottom:1px solid #ccc;cursor:pointer}
25 28 .left_menu .section ul li img{width:20px;height:20px;margin-right:10px;}
26 29 .left_menu .section ul li ul{padding-left:25px;display:none;}
27 30 .left_menu .section ul li ul li{border:0;}
28 31 .float_box{position:absolute;top:0;background:#e9f0ff;left:100%;width:400px;height:200px;display:none;z-index:99;}
29   -.float_box li{width:27%;margin:0 2.5%;margin-top:10px;padding:5px 0px;text-align:center;border-radius:3px;border:1px solid #ccc;overflow:hidden;float:left;}
  32 +.float_box li{width:27%;margin:0 2.5%;margin-top:10px;padding:5px 0px;text-align:center;border-radius:3px;border:1px solid #ccc;overflow:hidden;float:left;cursor:pointer}
  33 +.left_menu .choose_book .book_box ul li .float_box li:hover{background:#fff;}
30 34 .screen{width:100%;height:150px;background:#fff;box-shadow: 0 0 10px #ccc;margin-top:10px;padding:10px;}
31 35 .tag dt,dd{display:inline-block;}
32 36  
... ...
WebRoot/static/images/down_ico.png 0 → 100644

901 Bytes

WebRoot/static/images/up_ico.png 0 → 100644

14.9 KB

resources/mybatis1/api/V1Mapper.xml
... ... @@ -95,6 +95,7 @@
95 95 sv_question.ANSWER,
96 96 sv_question.OPTION_CONTENT,
97 97 sv_question.PROBLEM_TYPE_ID,
  98 + sv_question.KNOWLEDGE_ID,
98 99 sv_question.P_ID
99 100 FROM
100 101 sv_paperquestion
... ... @@ -161,6 +162,24 @@
161 162  
162 163 </select>
163 164  
  165 + <!-- 通过教师ID获取科目数据 -->
  166 + <select id="getQuestionWrongInfo" parameterType="pd" resultType="pd">
  167 + SELECT
  168 + sv_student.`NAME`,
  169 + sv_testpaperinfo.ANSWER,
  170 + sv_testpaperinfo.PRESS_TIME,
  171 + sv_testpaperinfo.RECEIVER_DATE,
  172 + sv_testpaperinfo.`RIGHT`
  173 + FROM
  174 + sv_testpaperinfo
  175 + LEFT JOIN sv_student ON sv_testpaperinfo.STUDENT_ID = sv_student.ID
  176 + WHERE
  177 + sv_testpaperinfo.QUESTION_ID = #{QUESTION_ID}
  178 + AND sv_testpaperinfo.TEST_ID = #{TEST_ID}
  179 + AND sv_testpaperinfo.`RIGHT` = '0'
  180 +
  181 + </select>
  182 +
164 183  
165 184  
166 185  
... ...
resources/mybatis1/sunvote/PaperMapper.xml
... ... @@ -173,8 +173,54 @@
173 173 and CLASS_ID = #{pd.CLASS_ID}
174 174 </if>
175 175  
  176 + <if test="pd.START_DATE != null and pd.START_DATE != ''"><!-- 关键词检索 -->
  177 + and (CREATE_DATE &gt; #{pd.START_DATE})
  178 + </if>
  179 + <if test="pd.END_DATE != null and pd.END_DATE != ''"><!-- 关键词检索 -->
  180 + and (CREATE_DATE &lt; #{pd.END_DATE})
  181 + </if>
  182 +
176 183 order by CREATE_DATE DESC
177 184 </select>
  185 + <!-- 指定类型列表(全部) -->
  186 + <select id="listAllByType" parameterType="pd" resultType="pd">
  187 + select
  188 + <include refid="Field"></include>
  189 + from
  190 + <include refid="tableName"></include>
  191 + where 1 = 1
  192 + <if test="PAPER_TYPE != null and PAPER_TYPE != ''">
  193 + and PAPER_TYPE = #{PAPER_TYPE}
  194 + </if>
  195 +
  196 + <if test="USER_ID != null and USER_ID != ''">
  197 + and USER_ID = #{USER_ID}
  198 + </if>
  199 + <if test="SUBJECT_ID != null and SUBJECT_ID != ''">
  200 + and SUBJECT_ID = #{SUBJECT_ID}
  201 + </if>
  202 + <if test="CLASS_ID != null and CLASS_ID != ''">
  203 + and CLASS_ID = #{CLASS_ID}
  204 + </if>
  205 +
  206 + <if test="START_DATE != null and START_DATE != ''"><!-- 关键词检索 -->
  207 + and (CREATE_DATE &gt; #{START_DATE})
  208 + </if>
  209 + <if test="END_DATE != null and END_DATE != ''"><!-- 关键词检索 -->
  210 + and (CREATE_DATE &lt; #{END_DATE})
  211 + </if>
  212 +
  213 + order by CREATE_DATE DESC
  214 +
  215 + <choose>
  216 + <when test="CURRENTPAGE != null and CURRENTPAGE != '' and SHOWCOUNT != null and SHOWCOUNT != ''">
  217 + limit ${CURRENTPAGE}, ${SHOWCOUNT}
  218 + </when>
  219 + <otherwise>
  220 + limit 0,30
  221 + </otherwise>
  222 + </choose>
  223 + </select>
178 224  
179 225 <!-- 批量删除 -->
180 226 <delete id="deleteAll" parameterType="String">
... ...
resources/mybatis1/sunvote/TeachingMaterialMapper.xml
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3   -<mapper namespace="TextbookMapper">
  3 +<mapper namespace="TeachingMaterialMapper">
4 4  
5 5 <!--表名 -->
6 6 <sql id="tableName">
7   - SV_TEXTBOOK
  7 + SV_TEACHINGMATERIAL
8 8 </sql>
9 9  
10 10 <!-- 字段 -->
11 11 <sql id="Field">
12   - ID,
13   - NAME,
14   - SUBJECT_ID,
15   - GRADEID,
16   - REMARK,
17   - TEACHING_MATERIAL_ID
  12 + NAME,
  13 + SUBJECT_ID,
  14 + GRADE_ID,
  15 + VERSION_CODE,
  16 + VERSION_NAME,
  17 + ID
18 18 </sql>
19 19  
20 20 <!-- 字段值 -->
21 21 <sql id="FieldValue">
22   - #{ID},
23 22 #{NAME},
24 23 #{SUBJECT_ID},
25 24 #{GRADE_ID},
  25 + #{VERSION_CODE},
26 26 #{VERSION_NAME},
27   - #{REMARK},
28   - #{TEACHING_MATERIAL_ID}
  27 + #{ID}
29 28 </sql>
30 29  
31 30 <!-- 新增-->
... ... @@ -56,9 +55,9 @@
56 55 NAME = #{NAME},
57 56 SUBJECT_ID = #{SUBJECT_ID},
58 57 GRADE_ID = #{GRADE_ID},
59   - REMARK = #{REMARK},
60   - TEACHING_MATERIAL_ID = #{TEACHING_MATERIAL_ID},
61   - ID = #{ID}
  58 + VERSION_CODE = #{VERSION_CODE},
  59 + VERSION_NAME = #{VERSION_NAME},
  60 + ID = #{ID}
62 61 where
63 62 ID = #{ID}
64 63 </update>
... ... @@ -98,6 +97,8 @@
98 97 <include refid="Field"></include>
99 98 from
100 99 <include refid="tableName"></include>
  100 +
  101 +
101 102 </select>
102 103  
103 104 <!-- 批量删除 -->
... ... @@ -111,5 +112,4 @@
111 112 </foreach>
112 113 </delete>
113 114  
114   - <!-- fh313596790qq(青苔) -->
115 115 </mapper>
116 116 \ No newline at end of file
... ...
resources/mybatis1/sunvote/TestPaperInfoMapper.xml
... ... @@ -24,6 +24,7 @@
24 24 NOTE,
25 25 MARK_NO,
26 26 RANK,
  27 + RANDOM,
27 28 TESTPAPERINFO_ID
28 29 </sql>
29 30  
... ... @@ -44,6 +45,7 @@
44 45 #{NOTE},
45 46 #{MARK_NO},
46 47 #{RANK},
  48 + #{RANDOM},
47 49 #{TESTPAPERINFO_ID}
48 50 </sql>
49 51  
... ... @@ -83,6 +85,7 @@
83 85 #{item.NOTE},
84 86 #{item.MARK_NO},
85 87 #{item.RANK},
  88 + #{item.RANDOM},
86 89 #{item.TESTPAPERINFO_ID}
87 90 )
88 91 </foreach>
... ... @@ -197,7 +200,7 @@
197 200 <!-- 测验,题目列表 -->
198 201 <select id="listTestPaperQuestionIDs" parameterType="pd" resultType="pd">
199 202 select
200   - QUESTION_ID
  203 + QUESTION_ID,RANDOM,PAPER_ID
201 204 from
202 205 <include refid="tableName"></include>
203 206 where 1 =1
... ... @@ -215,6 +218,7 @@
215 218 </if>
216 219  
217 220 group by QUESTION_ID
  221 + order by RANK
218 222 </select>
219 223  
220 224  
... ...
resources/mybatis1/sunvote/TestPaperMapper.xml
... ... @@ -22,6 +22,7 @@
22 22 AVG_SCORE,
23 23 TOTAL_SCORE,
24 24 REMARK,
  25 + TEST_TYPE,
25 26 TESTPAPER_ID
26 27 </sql>
27 28  
... ... @@ -40,6 +41,7 @@
40 41 #{AVG_SCORE},
41 42 #{TOTAL_SCORE},
42 43 #{REMARK},
  44 + #{TEST_TYPE},
43 45 #{TESTPAPER_ID}
44 46 </sql>
45 47  
... ... @@ -80,6 +82,7 @@
80 82 AVG_SCORE = #{AVG_SCORE},
81 83 TOTAL_SCORE = #{TOTAL_SCORE},
82 84 REMARK = #{REMARK},
  85 + TEST_TYPE = #{TEST_TYPE},
83 86 TESTPAPER_ID = TESTPAPER_ID
84 87 where
85 88 TESTPAPER_ID = #{TESTPAPER_ID}
... ... @@ -140,6 +143,12 @@
140 143 <if test="NAME != null and NAME != ''"><!-- 关键词检索 -->
141 144 and (NAME = #{NAME})
142 145 </if>
  146 + <if test="TEST_TYPE != null and TEST_TYPE == '1'"><!-- 关键词检索 -->
  147 + and (TEST_TYPE = #{TEST_TYPE} or TEST_TYPE IS NULL)
  148 + </if>
  149 + <if test="TEST_TYPE != null and TEST_TYPE == '101'"><!-- 关键词检索 -->
  150 + and (TEST_TYPE = #{TEST_TYPE})
  151 + </if>
143 152 <if test="START_DATE != null and START_DATE != ''"><!-- 关键词检索 -->
144 153 and (CREATE_DATE &gt; #{START_DATE})
145 154 </if>
... ...
resources/mybatis1/sunvote/TextbookMapper.xml
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3   -<mapper namespace="TeachingMaterialMapper">
  3 +<mapper namespace="TextbookMapper">
4 4  
5 5 <!--表名 -->
6 6 <sql id="tableName">
7   - SV_TEACHINGMATERIAL
  7 + SV_TEXTBOOK
8 8 </sql>
9 9  
10 10 <!-- 字段 -->
11 11 <sql id="Field">
12   - NAME,
13   - SUBJECT_ID,
14   - GRADE_ID,
15   - VERSION_CODE,
16   - VERSION_NAME,
17   - ID
  12 + ID,
  13 + NAME,
  14 + SUBJECT_ID,
  15 + GRADEID,
  16 + REMARK,
  17 + TEACHING_MATERIAL_ID
18 18 </sql>
19 19  
20 20 <!-- 字段值 -->
21 21 <sql id="FieldValue">
  22 + #{ID},
22 23 #{NAME},
23 24 #{SUBJECT_ID},
24 25 #{GRADE_ID},
25   - #{VERSION_CODE},
26 26 #{VERSION_NAME},
27   - #{ID}
  27 + #{REMARK},
  28 + #{TEACHING_MATERIAL_ID}
28 29 </sql>
29 30  
30 31 <!-- 新增-->
... ... @@ -55,9 +56,9 @@
55 56 NAME = #{NAME},
56 57 SUBJECT_ID = #{SUBJECT_ID},
57 58 GRADE_ID = #{GRADE_ID},
58   - VERSION_CODE = #{VERSION_CODE},
59   - VERSION_NAME = #{VERSION_NAME},
60   - ID = #{ID}
  59 + REMARK = #{REMARK},
  60 + TEACHING_MATERIAL_ID = #{TEACHING_MATERIAL_ID},
  61 + ID = #{ID}
61 62 where
62 63 ID = #{ID}
63 64 </update>
... ... @@ -98,6 +99,7 @@
98 99 from
99 100 <include refid="tableName"></include>
100 101  
  102 +
101 103 where 1 = 1
102 104  
103 105 <if test="TEACHING_MATERIAL_ID != null and TEACHING_MATERIAL_ID != ''">
... ...
src/com/fh/bean/Paper.java
... ... @@ -17,6 +17,8 @@ public class Paper {
17 17 private String grade_id = "";
18 18  
19 19 private String user_id = "";
  20 +
  21 + private String class_id = "" ;
20 22  
21 23 private List<Question> questions = new ArrayList<Question>();
22 24  
... ... @@ -89,6 +91,16 @@ public class Paper {
89 91 this.score = score;
90 92 }
91 93  
  94 +
  95 +
  96 + public String getClass_id() {
  97 + return class_id;
  98 + }
  99 +
  100 + public void setClass_id(String class_id) {
  101 + this.class_id = class_id;
  102 + }
  103 +
92 104 public static Paper parse(String json){
93 105 Gson gson = new Gson();
94 106 return gson.fromJson(json, Paper.class);
... ...
src/com/fh/bean/TestPaper.java
... ... @@ -47,6 +47,8 @@ public class TestPaper {
47 47 // 备注
48 48 private String remark ;
49 49  
  50 + private String test_type ;
  51 +
50 52 private List<StudentAnswer> students = new ArrayList<StudentAnswer>();
51 53  
52 54 public String getTestpaperId() {
... ... @@ -155,6 +157,14 @@ public class TestPaper {
155 157 this.remark = remark;
156 158 }
157 159  
  160 + public String getTest_type() {
  161 + return test_type;
  162 + }
  163 +
  164 +
  165 + public void setTest_type(String test_type) {
  166 + this.test_type = test_type;
  167 + }
158 168  
159 169 public List<StudentAnswer> getStudents() {
160 170 return students;
... ...
src/com/fh/bean/TestPaperInfo.java
... ... @@ -44,6 +44,12 @@ public class TestPaperInfo {
44 44 // 排序
45 45 private String rank ;
46 46  
  47 + // 是否随机
  48 + private String random;
  49 +
  50 + // 试卷ID
  51 + private String paperId ;
  52 +
47 53  
48 54 public String getTestPaperInfoId() {
49 55 return testPaperInfoId;
... ... @@ -148,6 +154,24 @@ public class TestPaperInfo {
148 154 public void setRank(String rank) {
149 155 this.rank = rank;
150 156 }
  157 +
  158 +
  159 +
  160 + public String getRandom() {
  161 + return random;
  162 + }
  163 +
  164 + public void setRandom(String random) {
  165 + this.random = random;
  166 + }
  167 +
  168 + public String getPaperId() {
  169 + return paperId;
  170 + }
  171 +
  172 + public void setPaperId(String paperId) {
  173 + this.paperId = paperId;
  174 + }
151 175  
152 176 public static TestPaperInfo parse(String json){
153 177 Gson gson = new Gson();
... ...
src/com/fh/controller/api/V1.java
1 1 package com.fh.controller.api;
2 2  
  3 +import java.io.File;
3 4 import java.util.ArrayList;
  5 +import java.util.Collections;
  6 +import java.util.Comparator;
4 7 import java.util.Date;
5 8 import java.util.Iterator;
6 9 import java.util.List;
7 10 import java.util.Map;
8   -import java.util.Set;
9 11  
10 12 import javax.annotation.Resource;
11 13 import javax.servlet.http.HttpServletRequest;
... ... @@ -14,7 +16,9 @@ import org.apache.commons.lang.StringUtils;
14 16 import org.apache.shiro.crypto.hash.SimpleHash;
15 17 import org.springframework.stereotype.Controller;
16 18 import org.springframework.web.bind.annotation.RequestMapping;
  19 +import org.springframework.web.bind.annotation.RequestParam;
17 20 import org.springframework.web.bind.annotation.ResponseBody;
  21 +import org.springframework.web.multipart.MultipartFile;
18 22  
19 23 import com.fh.bean.Paper;
20 24 import com.fh.bean.Point;
... ... @@ -24,7 +28,6 @@ import com.fh.bean.TestPaper;
24 28 import com.fh.bean.TestPaperInfo;
25 29 import com.fh.controller.base.BaseController;
26 30 import com.fh.controller.sunvote.Myelfun;
27   -import com.fh.entity.Page;
28 31 import com.fh.service.api.V1Manager;
29 32 import com.fh.service.feedback.feedback.FeedbackManager;
30 33 import com.fh.service.feedback.problemphenomenon.ProblemPhenomenonManager;
... ... @@ -431,7 +434,7 @@ public class V1 extends BaseController {
431 434 @RequestMapping(value = "/subjectname", produces = "application/json;charset=UTF-8")
432 435 @ResponseBody
433 436 public Object subjectName() throws Exception {
434   - event("subject");
  437 + event("subjectName");
435 438 long cur = System.currentTimeMillis();
436 439 PageData pd = this.getPageData();
437 440 ResponseGson<List<PageData>> res = new ResponseGson();
... ... @@ -487,30 +490,18 @@ public class V1 extends BaseController {
487 490 PageData pd = this.getPageData();
488 491 ResponseGson<List<PageData>> res = new ResponseGson<List<PageData>>();
489 492 if (pd.containsKey("PAPER_TYPE") && pd.containsKey("USER_ID")) {
490   - Page page = new Page();
491   - page.getPd().put("PAPER_TYPE", pd.get("PAPER_TYPE"));
492   - page.getPd().put("USER_ID", pd.get("USER_ID"));
493   - page.getPd().put("SUBJECT_ID", pd.get("SUBJECT_ID"));
494   - if (pd.containsKey("CURRENTPAGE")) {
495   - String curpage = pd.getString("CURRENTPAGE");
496   - try {
497   - page.setCurrentPage(Integer.parseInt(curpage));
498   - } catch (Exception ex) {
499   - }
  493 + String CURRENTPAGE = pd.getString("CURRENTPAGE");
  494 + String SHOWCOUNT = pd.getString("SHOWCOUNT");
  495 + if(CURRENTPAGE != null && SHOWCOUNT != null && !"".equals(CURRENTPAGE.trim()) && !"".equals(SHOWCOUNT.trim())){
  496 + int currentPage = Integer.parseInt(CURRENTPAGE);
  497 + int showcount = Integer.parseInt(SHOWCOUNT);
  498 + currentPage = (currentPage > 0 ? currentPage -1 : 0) * showcount;
  499 + pd.put("CURRENTPAGE", currentPage);
500 500 }
501   - if (pd.containsKey("SHOWCOUNT")) {
502   - String showCount = pd.getString("SHOWCOUNT");
503   - try {
504   - page.setShowCount(Integer.parseInt(showCount));
505   - } catch (Exception ex) {
506   - }
507   - } else {
508   - page.setShowCount(100);
509   - }
510   - List<PageData> pageList = paperService.listAllByType(page);
  501 + List<PageData> pageList = paperService.listAllByType(pd);
511 502 res.setData(pageList);
512 503 } else {
513   - res.setParmError();
  504 + res.setDataError();
514 505 }
515 506 logger.info("paper cost time : " + (System.currentTimeMillis() - cur));
516 507 return res.toJson();
... ... @@ -527,6 +518,119 @@ public class V1 extends BaseController {
527 518 event("paperInfo");
528 519 long cur = System.currentTimeMillis();
529 520 PageData pd = this.getPageData();
  521 + ResponseGson<Paper> res = new ResponseGson<Paper>();
  522 + if (pd.containsKey("PAPER_ID")) {
  523 + try {
  524 + try {
  525 + Paper paper = new Paper();
  526 + PageData ppd = paperService.findById(pd);
  527 + if (ppd != null) {
  528 + paper.setTitle(ppd.getString("TITLE"));
  529 + paper.setExam_time(ppd.getString("EXAM_TIME"));
  530 + paper.setUser_id(ppd.getString("USER_ID"));
  531 + paper.setPaper_type(ppd.getString("PAPER_TYPE"));
  532 + paper.setSubject_id(ppd.getString("SUBJECT_ID"));
  533 + paper.setGrade_id(ppd.getString("GRADE_ID"));
  534 + paper.setScore(ppd.getString("SCORE"));
  535 + paper.setQuestions(new ArrayList<Question>());
  536 +
  537 + List<PageData> questList = v1Service
  538 + .getTestPaperInfo(pd);
  539 + for (PageData qpd : questList) {
  540 + Question question = new Question();
  541 + question.setAnswer(qpd.getString("ANSWER"));
  542 + question.setQuestion_id(qpd
  543 + .getString("QUESTION_ID"));
  544 + question.setSubject_id(qpd.getString("SUBJECT_ID"));
  545 + question.setChapter_id(qpd.getString("CHAPTER_ID"));
  546 + question.setProblem_type_id(qpd
  547 + .getString("PROBLEM_TYPE_ID"));
  548 + question.setKnowledge_id(qpd
  549 + .getString("KNOWLEDGE_ID"));
  550 + question.setContent(qpd.getString("CONTENT"));
  551 + question.setOption_num(qpd.getString("OPTION_NUM"));
  552 + question.setOption_content(qpd
  553 + .getString("OPTION_CONTENT"));
  554 + question.setDifficulty(qpd.getString("DIFFICULTY"));
  555 + question.setAnalysis(qpd.getString("ANALYSIS"));
  556 + question.setQuestion_from(qpd
  557 + .getString("QUESTION_FROM"));
  558 + question.setScore(qpd.getString("SCORE"));
  559 + question.setPart_score(qpd.getString("PART_SCORE"));
  560 + question.setQuestionType(qpd
  561 + .getString("PROBLEM_TYPE_ID"));
  562 + question.setRank(qpd.getString("RANK"));
  563 + question.setNo_name(qpd.getString("NO_NAME"));
  564 + if ("-1".equals("" + qpd.getString("P_ID"))) {
  565 + PageData pidPd = new PageData();
  566 + pidPd.put("PID", question.getQuestion_id());
  567 + question.setQuestions(new ArrayList<Question>());
  568 + List<PageData> qs = v1Service
  569 + .getQuestionsByPID(pidPd);
  570 + for (PageData q : qs) {
  571 + Question qq = new Question();
  572 + qq.setAnswer(q.getString("ANSWER"));
  573 + qq.setQuestion_id(q
  574 + .getString("QUESTION_ID"));
  575 + qq.setSubject_id(q.getString("SUBJECT_ID"));
  576 + qq.setChapter_id(q.getString("CHAPTER_ID"));
  577 + qq.setProblem_type_id(q
  578 + .getString("PROBLEM_TYPE_ID"));
  579 + qq.setKnowledge_id(q
  580 + .getString("KNOWLEDGE_ID"));
  581 + qq.setContent(q.getString("CONTENT"));
  582 + qq.setOption_num(q.getString("OPTION_NUM"));
  583 + qq.setOption_content(q
  584 + .getString("OPTION_CONTENT"));
  585 + qq.setDifficulty(q.getString("DIFFICULTY"));
  586 + qq.setAnalysis(q.getString("ANALYSIS"));
  587 + qq.setQuestion_from(q
  588 + .getString("QUESTION_FROM"));
  589 + qq.setScore(q.getString("SCORE"));
  590 + qq.setPart_score(q.getString("PART_SCORE"));
  591 + qq.setQuestionType(qpd
  592 + .getString("PROBLEM_TYPE_ID"));
  593 + qq.setRank(q.getString("RANK"));
  594 + qq.setNo_name(q.getString("NO_NAME"));
  595 + question.getQuestions().add(qq);
  596 + }
  597 + }
  598 + if ("-1".equals(qpd.getString("P_ID"))
  599 + || "0".equals(qpd.getString("P_ID"))) {
  600 + paper.getQuestions().add(question);
  601 + }
  602 + }
  603 + // pd.put("JSON", paper.toJson());
  604 + res.setData(paper);
  605 + logger.info(paper.toJson());
  606 +
  607 + }
  608 + } catch (Exception ex) {
  609 + ex.printStackTrace();
  610 + }
  611 + } catch (Exception ex) {
  612 + ex.printStackTrace();
  613 + res.setError();
  614 + }
  615 + } else {
  616 + res.setOtherError();
  617 + }
  618 + logger.info("paperInfo cost time : "
  619 + + (System.currentTimeMillis() - cur));
  620 + return res.toJson();
  621 + }
  622 +
  623 +/* *//**
  624 + * 试卷详细信息
  625 + * @return
  626 + * @throws Exception
  627 + *//*
  628 + @RequestMapping(value = "/paperinfo", produces = "application/json;charset=UTF-8")
  629 + @ResponseBody
  630 + public Object paperInfo() throws Exception {
  631 + event("paperInfo");
  632 + long cur = System.currentTimeMillis();
  633 + PageData pd = this.getPageData();
530 634 ResponseGson<PageData> res = new ResponseGson<PageData>();
531 635 if (pd.containsKey("PAPER_ID")) {
532 636 try {
... ... @@ -537,7 +641,7 @@ public class V1 extends BaseController {
537 641 .getTestPaperInfo(pd);
538 642 ppd.put("QUESTIONS", questList);
539 643 for (PageData qpd : questList) {
540   -
  644 +
541 645 String optionContent = qpd
542 646 .getString("OPTION_CONTENT");
543 647 if (optionContent != null
... ... @@ -565,7 +669,7 @@ public class V1 extends BaseController {
565 669 .substring(
566 670 1,
567 671 optionContent1.length() - 1)
568   - .split(",");
  672 + .split(",");
569 673 pcd.put("OPTION_CONTENT", options);
570 674 } else {
571 675 pcd.put("OPTION_CONTENT",
... ... @@ -588,7 +692,7 @@ public class V1 extends BaseController {
588 692 qpd.put(key.toLowerCase(), qpd.get(key));
589 693 qpd.remove(key.toUpperCase());
590 694 }
591   -
  695 +
592 696 }
593 697 String[] keys = new String[ppd.keySet().size()];
594 698 ppd.keySet().toArray(keys);
... ... @@ -599,7 +703,88 @@ public class V1 extends BaseController {
599 703 // pd.put("JSON", paper.toJson());
600 704 res.setData(ppd);
601 705 logger.info(res.toJson());
602   -
  706 +
  707 + }
  708 + } catch (Exception ex) {
  709 + ex.printStackTrace();
  710 + }
  711 + } catch (Exception ex) {
  712 + ex.printStackTrace();
  713 + res.setError();
  714 + }
  715 + } else {
  716 + res.setOtherError();
  717 + }
  718 + logger.info("paperInfo cost time : "
  719 + + (System.currentTimeMillis() - cur));
  720 + return res.toJson();
  721 + }
  722 +
  723 +*/ /**
  724 + * 试卷详细信息
  725 + * @return
  726 + * @throws Exception
  727 + */
  728 + @RequestMapping(value = "/paperinfo2", produces = "application/json;charset=UTF-8")
  729 + @ResponseBody
  730 + public Object paperInfo2() throws Exception {
  731 + event("paperInfo2");
  732 + long cur = System.currentTimeMillis();
  733 + PageData pd = this.getPageData();
  734 + ResponseGson<PageData> res = new ResponseGson<PageData>();
  735 + if (pd.containsKey("PAPER_ID")) {
  736 + try {
  737 + try {
  738 + PageData ppd = paperService.findById(pd);
  739 + if (ppd != null) {
  740 + List<PageData> questList = v1Service
  741 + .getTestPaperInfo(pd);
  742 + ppd.put("QUESTIONS", questList);
  743 + for (PageData qpd : questList) {
  744 +
  745 + String optionContent = qpd
  746 + .getString("OPTION_CONTENT");
  747 + if (optionContent != null
  748 + && optionContent.startsWith("[")
  749 + && optionContent.endsWith("]")) {
  750 + String[] options = optionContent.substring(1,
  751 + optionContent.length() - 1).split(",");
  752 + qpd.put("OPTION_CONTENT", options);
  753 + } else {
  754 + qpd.put("OPTION_CONTENT",
  755 + new String[] { optionContent });
  756 + }
  757 + if ("-1".equals("" + qpd.getString("P_ID"))) {
  758 + PageData pidPd = new PageData();
  759 + pidPd.put("PID", qpd.getString("QUESTION_ID"));
  760 + List<PageData> qs = v1Service
  761 + .getQuestionsByPID(pidPd);
  762 + for (PageData pcd : qs) {
  763 + String optionContent1 = pcd
  764 + .getString("OPTION_CONTENT");
  765 + if (optionContent1 != null
  766 + && optionContent1.startsWith("[")
  767 + && optionContent1.endsWith("]")) {
  768 + String[] options = optionContent1
  769 + .substring(
  770 + 1,
  771 + optionContent1.length() - 1)
  772 + .split(",");
  773 + pcd.put("OPTION_CONTENT", options);
  774 + } else {
  775 + pcd.put("OPTION_CONTENT",
  776 + new String[] { optionContent1 });
  777 + }
  778 + }
  779 + qpd.put("QUESTIONS", qs);
  780 + }
  781 +
  782 +
  783 +
  784 + }
  785 + res.setData(ppd);
  786 + logger.info(res.toJson());
  787 +
603 788 }
604 789 } catch (Exception ex) {
605 790 ex.printStackTrace();
... ... @@ -638,15 +823,6 @@ public class V1 extends BaseController {
638 823 testInfof.put("PAPER_ID", testPd.getString("PAPER_ID"));
639 824 testInfof.put("TEST_ID", paperId);
640 825 List<PageData> list = testpaperinfoService.listTestPaperQuestionIDs(testInfof);
641   - for(PageData pad:list){
642   - String optionContent = pad.getString("OPTION_CONTENT");
643   - if(optionContent != null && optionContent.startsWith("[") && optionContent.endsWith("]")){
644   - String[] options = optionContent.substring(1, optionContent.length() -1).split(",");
645   - pad.put("OPTION_CONTENT", options);
646   - }else{
647   - pad.put("OPTION_CONTENT", new String[]{optionContent});
648   - }
649   - }
650 826 for(PageData pqd : list){
651 827 PageData tpqd = questionService.findById(pqd);
652 828 pqd.putAll(tpqd);
... ... @@ -665,6 +841,7 @@ public class V1 extends BaseController {
665 841 pqd.put("TEST_ID", paperId);
666 842 List<PageData> listinfo = testpaperinfoService.listTestPaperQuestionIDinfo(pqd);
667 843 List<PageData> answerInfos = new ArrayList<PageData>();
  844 + List<String> answerList = new ArrayList<String>();
668 845 for(PageData pid : listinfo){
669 846 String answer = pid.getString("ANSWER");
670 847 PageData answerPd = null;
... ... @@ -675,12 +852,14 @@ public class V1 extends BaseController {
675 852 answerPd.put("ANSWER", answer);
676 853 answerPd.put("ISRIGHT", pid.getString("RIGHT"));
677 854 answerInfos.add(answerPd);
  855 + answerList.add(answer);
678 856 }
679 857 }else{
680 858 answerPd = new PageData();
681 859 answerPd.put("ANSWER", answer);
682 860 answerPd.put("ISRIGHT", pid.getString("RIGHT"));
683 861 answerInfos.add(answerPd);
  862 + answerList.add(answer);
684 863 }
685 864 String strCount = answerPd.getString("COUNT");
686 865 int count = 0 ;
... ... @@ -692,9 +871,37 @@ public class V1 extends BaseController {
692 871 count ++ ;
693 872 answerPd.put("COUNT", count);
694 873 }
  874 + String questionNumStr = pqd.getString("OPTION_NUM");
  875 + int questionNum = Integer.parseInt(questionNumStr);
  876 + for(int i = 0 ; i < questionNum ;i++){
  877 + if((!answerList.contains("" + (char)('A' + i))) && !(answerList.contains("" + (char)('a' + i)))){
  878 + PageData answerPd = new PageData();
  879 + answerPd.put("ANSWER", "" + (char)('A' + i));
  880 + answerPd.put("ISRIGHT", pqd.get("ANSWER").equals(('A' + i)) ? "1" : "0");
  881 + answerPd.put("COUNT", 0);
  882 + answerInfos.add(answerPd);
  883 + }
  884 + }
  885 + Collections.sort(answerInfos, new Comparator<PageData>(){
  886 +
  887 + @Override
  888 + public int compare(PageData p1, PageData p2) {
  889 + return p1.getString("ANSWER").compareToIgnoreCase(p2.getString("ANSWER"));
  890 + }
  891 +
  892 + });
695 893 pqd.put("ANSWERINFO", answerInfos);
696 894 pqd.remove("TEST_ID");
697 895 }
  896 + for(PageData pad:list){
  897 + String optionContent = pad.getString("OPTION_CONTENT");
  898 + if(optionContent != null && optionContent.startsWith("[") && optionContent.endsWith("]")){
  899 + String[] options = optionContent.substring(1, optionContent.length() -1).split(",");
  900 + pad.put("OPTION_CONTENT", options);
  901 + }else{
  902 + pad.put("OPTION_CONTENT", new String[]{optionContent});
  903 + }
  904 + }
698 905 testPd.put("QUESTIONS", list);
699 906  
700 907 }
... ... @@ -718,7 +925,7 @@ public class V1 extends BaseController {
718 925 @RequestMapping(value = "/questionintestreportinfo", produces = "application/json;charset=UTF-8")
719 926 @ResponseBody
720 927 public Object questionInTestReportInfo() throws Exception {
721   - event("testpaperinfo");
  928 + event("questionInTestReportInfo");
722 929 long cur = System.currentTimeMillis();
723 930 PageData pd = this.getPageData();
724 931 ResponseGson<PageData> res = new ResponseGson();
... ... @@ -727,66 +934,72 @@ public class V1 extends BaseController {
727 934 PageData pqd = new PageData();
728 935 pqd.put("QUESTION_ID", questionId);
729 936 PageData tpqd = questionService.findById(pqd);
730   - pqd.putAll(tpqd);
731   - pqd.remove("P_ID");
732   - pqd.remove("SUBJECT_ID");
733   - pqd.remove("PROBLEM_TYPE_ID");
734   - pqd.remove("CHAPTER_ID");
735   - pqd.remove("TEACHER_ID");
736   - pqd.remove("SCHOOL_ID");
737   - pqd.remove("SUG_SCORE");
738   - pqd.remove("SUG_PART_SCORE");
739   - pqd.remove("USER_ID");
740   - pqd.remove("CREATE_DATE");
741   - pqd.remove("QUESTION_FROM");
742   - pqd.remove("REMARK");
743   - String optionContent = pqd.getString("OPTION_CONTENT");
744   - if(optionContent != null && optionContent.startsWith("[") && optionContent.endsWith("]")){
745   - String[] options = optionContent.substring(1, optionContent.length() -1).split(",");
746   - pqd.put("OPTION_CONTENT", options);
747   - }else{
748   - pqd.put("OPTION_CONTENT", new String[]{optionContent});
749   - }
750   - if(pd.getString("TEST_ID") != null){
751   - pqd.put("TEST_ID", pd.getString("TEST_ID"));
752   - }
753   - List<PageData> listinfo = testpaperinfoService
754   - .listTestPaperQuestionIDinfo(pqd);
755   - List<PageData> answerInfos = new ArrayList<PageData>();
756   - for (PageData pid : listinfo) {
757   - String answer = pid.getString("ANSWER");
758   - PageData answerPd = null;
759   - if (answerInfos.size() > 0) {
760   - answerPd = answerInfos.get(answerInfos.size() - 1);
761   - if (!answer.equals(answerPd.getString("ANSWER"))) {
  937 + if (tpqd != null) {
  938 + pqd.putAll(tpqd);
  939 + pqd.remove("P_ID");
  940 + pqd.remove("SUBJECT_ID");
  941 + pqd.remove("PROBLEM_TYPE_ID");
  942 + pqd.remove("CHAPTER_ID");
  943 + pqd.remove("TEACHER_ID");
  944 + pqd.remove("SCHOOL_ID");
  945 + pqd.remove("SUG_SCORE");
  946 + pqd.remove("SUG_PART_SCORE");
  947 + pqd.remove("USER_ID");
  948 + pqd.remove("CREATE_DATE");
  949 + pqd.remove("QUESTION_FROM");
  950 + pqd.remove("REMARK");
  951 + String optionContent = pqd.getString("OPTION_CONTENT");
  952 + if (optionContent != null && optionContent.startsWith("[")
  953 + && optionContent.endsWith("]")) {
  954 + String[] options = optionContent.substring(1,
  955 + optionContent.length() - 1).split(",");
  956 + pqd.put("OPTION_CONTENT", options);
  957 + } else {
  958 + pqd.put("OPTION_CONTENT", new String[] { optionContent });
  959 + }
  960 + if (pd.getString("TEST_ID") != null) {
  961 + pqd.put("TEST_ID", pd.getString("TEST_ID"));
  962 + }
  963 + List<PageData> listinfo = testpaperinfoService
  964 + .listTestPaperQuestionIDinfo(pqd);
  965 + List<PageData> answerInfos = new ArrayList<PageData>();
  966 + for (PageData pid : listinfo) {
  967 + String answer = pid.getString("ANSWER");
  968 + PageData answerPd = null;
  969 + if (answerInfos.size() > 0) {
  970 + answerPd = answerInfos.get(answerInfos.size() - 1);
  971 + if (!answer.equals(answerPd.getString("ANSWER"))) {
  972 + answerPd = new PageData();
  973 + answerPd.put("ANSWER", answer);
  974 + answerPd.put("ISRIGHT", pid.getString("RIGHT"));
  975 + answerInfos.add(answerPd);
  976 + }
  977 + } else {
762 978 answerPd = new PageData();
763 979 answerPd.put("ANSWER", answer);
764 980 answerPd.put("ISRIGHT", pid.getString("RIGHT"));
765 981 answerInfos.add(answerPd);
766 982 }
767   - } else {
768   - answerPd = new PageData();
769   - answerPd.put("ANSWER", answer);
770   - answerPd.put("ISRIGHT", pid.getString("RIGHT"));
771   - answerInfos.add(answerPd);
772   - }
773   - String strCount = answerPd.getString("COUNT");
774   - int count = 0;
775   - if (strCount != null) {
776   - try {
777   - count = Integer.parseInt(strCount);
778   - } catch (NumberFormatException ex) {
  983 + String strCount = answerPd.getString("COUNT");
  984 + int count = 0;
  985 + if (strCount != null) {
  986 + try {
  987 + count = Integer.parseInt(strCount);
  988 + } catch (NumberFormatException ex) {
  989 + }
779 990 }
  991 + count++;
  992 + answerPd.put("COUNT", count);
780 993 }
781   - count++;
782   - answerPd.put("COUNT", count);
  994 + pqd.put("ANSWERINFO", answerInfos);
  995 + res.setData(pqd);
  996 + }else{
  997 + res.setDataError();
783 998 }
784   - pqd.put("ANSWERINFO", answerInfos);
785   - res.setData(pqd);
786 999 }else{
787 1000 res.setDataError();
788 1001 }
789   - logger.info("testpaperinfo cost time:"
  1002 + logger.info("questionInTestReportInfo cost time:"
790 1003 + (System.currentTimeMillis() - cur));
791 1004 return res.toJson();
792 1005 }
... ... @@ -857,7 +1070,7 @@ public class V1 extends BaseController {
857 1070 } else {
858 1071 res.setOtherError();
859 1072 }
860   - logger.info("paperInfo cost time : "
  1073 + logger.info("paperBriefInfo cost time : "
861 1074 + (System.currentTimeMillis() - cur));
862 1075 return res.toBrifJson();
863 1076 }
... ... @@ -927,6 +1140,7 @@ public class V1 extends BaseController {
927 1140 @RequestMapping(value = "/knowledgename", produces = "application/json;charset=UTF-8")
928 1141 @ResponseBody
929 1142 public Object knowledgename() throws Exception {
  1143 + event("knowledgename");
930 1144 ResponseGson<List<PageData>> res = new ResponseGson();
931 1145 List<PageData> list = new ArrayList<PageData>();
932 1146 PageData pd = getPageData();
... ... @@ -957,6 +1171,7 @@ public class V1 extends BaseController {
957 1171 @RequestMapping(value = "/chaptername", produces = "application/json;charset=UTF-8")
958 1172 @ResponseBody
959 1173 public Object chaptername() throws Exception {
  1174 + event("chaptername");
960 1175 ResponseGson<List<PageData>> res = new ResponseGson();
961 1176 List<PageData> list = new ArrayList<PageData>();
962 1177 PageData pd = getPageData();
... ... @@ -1161,6 +1376,7 @@ public class V1 extends BaseController {
1161 1376 paperPd.put("SUBJECT_ID", paper.getSubject_id());
1162 1377 paperPd.put("GRADE_ID", paper.getGrade_id());
1163 1378 paperPd.put("EXAM_TIME", paper.getExam_time());
  1379 + paperPd.put("CLASS_ID", paper.getClass_id());
1164 1380 paperPd.put("SCORE", paper.getScore());
1165 1381 paperPd.put("PAPER_STATE", "0");
1166 1382 paperPd.put("REMARK", "");
... ... @@ -1168,8 +1384,8 @@ public class V1 extends BaseController {
1168 1384 paperPd.put("SCHOOL_ID", schoolID);
1169 1385 paperPd.put("CREATE_DATE", Tools.date2Str(new Date()));
1170 1386 paperPd.put("MODIFY_DATE", Tools.date2Str(new Date()));
1171   - int questionNum = 0;
1172 1387 List<Question> questions = paper.getQuestions();
  1388 + int questionNum = questions.size();
1173 1389 if (questions != null) {
1174 1390 for (Question question : questions) {
1175 1391 PageData pqPd = new PageData();
... ... @@ -1191,7 +1407,7 @@ public class V1 extends BaseController {
1191 1407 } else {
1192 1408 res.setDataError();
1193 1409 }
1194   - logger.info("uploadpaper cost time : "
  1410 + logger.info("publishpaper cost time : "
1195 1411 + (System.currentTimeMillis() - cur));
1196 1412 return res.toJson();
1197 1413 }
... ... @@ -1255,6 +1471,7 @@ public class V1 extends BaseController {
1255 1471 testPaper.getCreateDate() == null ? Tools
1256 1472 .date2Str(new Date()) : testPaper
1257 1473 .getCreateDate());
  1474 + testPd.put("TEST_TYPE", testPaper.getTest_type() != null ? testPaper.getTest_type() :"101");
1258 1475 List<PageData> listData = testpaperService.listAll(testPd);
1259 1476 if (!(listData != null && listData.size() > 0)) {
1260 1477 testPd.put("START_DATE", testPaper.getStartDate());
... ... @@ -1341,7 +1558,7 @@ public class V1 extends BaseController {
1341 1558 } else {
1342 1559 res.setDataError();
1343 1560 }
1344   - logger.info("uploadtestpaper cost time:"
  1561 + logger.info("uploadTestpaper cost time:"
1345 1562 + (System.currentTimeMillis() - cur));
1346 1563  
1347 1564 return res.toJson();
... ... @@ -1373,6 +1590,7 @@ public class V1 extends BaseController {
1373 1590 testPaper.getCreateDate() == null ? Tools
1374 1591 .date2Str(new Date()) : testPaper
1375 1592 .getCreateDate());
  1593 + testPd.put("TEST_TYPE", testPaper.getTest_type() != null ? testPaper.getTest_type() :"101");
1376 1594 List<PageData> listData = testpaperService.listAll(testPd);
1377 1595 if ((listData != null && listData.size() > 0)) {
1378 1596 testPaperId = listData.get(0).getString("TESTPAPER_ID");
... ... @@ -1457,12 +1675,131 @@ public class V1 extends BaseController {
1457 1675 } else {
1458 1676 res.setDataError();
1459 1677 }
1460   - logger.info("uploadtestpaper cost time:"
  1678 + logger.info("uploadupdatetestpaper cost time:"
1461 1679 + (System.currentTimeMillis() - cur));
1462 1680  
1463 1681 return res.toJson();
1464 1682  
1465 1683 }
  1684 +
  1685 + /**
  1686 + * 上传测验成绩
  1687 + * @return
  1688 + */
  1689 + @RequestMapping(value = "/uploadupdatetestpaper2", produces = "application/json;charset=UTF-8")
  1690 + @ResponseBody
  1691 + public Object uploadupdateTestpaper2() {
  1692 + event("uploadupdateTestpaper2");
  1693 + long cur = System.currentTimeMillis();
  1694 + PageData pd = this.getPageData();
  1695 + ResponseGson<String> res = new ResponseGson();
  1696 + if (!StringUtils.isEmpty(pd.getJsonString())) {
  1697 + logger.info(pd.getJsonString());
  1698 + TestPaper testPaper = TestPaper.parse(pd.getJsonString());
  1699 + try {
  1700 + PageData testPd = new PageData();
  1701 + String testPaperId = this.get32UUID();
  1702 + testPd.put("TEACHER_ID", testPaper.getTeacherId());
  1703 + testPd.put("PAPER_ID", testPaper.getPaperId());
  1704 + testPd.put("SCLASS_ID", testPaper.getClassId());
  1705 + testPd.put(
  1706 + "CREATE_DATE",
  1707 + testPaper.getCreateDate() == null ? Tools
  1708 + .date2Str(new Date()) : testPaper
  1709 + .getCreateDate());
  1710 + List<PageData> listData = testpaperService.listAll(testPd);
  1711 + if ((listData != null && listData.size() > 0)) {
  1712 + testPaperId = listData.get(0).getString("TESTPAPER_ID");
  1713 + testpaperService.deleteList(testPd);
  1714 + testPd.put("TEST_ID", testPaperId);
  1715 + testpaperinfoService.delete(testPd);
  1716 + studenttestService.delete(testPd);
  1717 + }
  1718 + testPd.put("TEST_TYPE", testPaper.getTest_type() != null ? testPaper.getTest_type() :"101");
  1719 + testPd.put("START_DATE", testPaper.getStartDate());
  1720 + testPd.put("END_DATE", testPaper.getEndDate());
  1721 + testPd.put("NAME", testPaper.getName());
  1722 + testPd.put("TESTPAPER_ID", testPaperId);
  1723 + testPd.put("OTHER_SCORE", testPaper.getOtherScore());
  1724 + testPd.put("HIGHT_SCORE", testPaper.getHighScore());
  1725 + testPd.put("LOW_SCORE", testPaper.getLowScore());
  1726 + testPd.put("AVG_SCORE", testPaper.getAvgScore());
  1727 + testPd.put("TOTAL_SCORE", testPaper.getTotalScore());
  1728 + testPd.put("REMARK", testPaper.getRemark());
  1729 + testpaperService.save(testPd);
  1730 + if (testPaper.getStudents() != null) {
  1731 + List<PageData> testInfoPdList = new ArrayList();
  1732 + PageData testInfoPd = null;
  1733 + for (StudentAnswer studentAnswer : testPaper.getStudents()) {
  1734 + if (studentAnswer.getQuestions() != null) {
  1735 + PageData studentPageData = new PageData();
  1736 + studentPageData.put("STUDENT_ID",
  1737 + studentAnswer.getStudentId());
  1738 + studentPageData.put("TEST_ID", testPaperId);
  1739 + studentPageData.put("PAPER_ID",
  1740 + testPaper.getPaperId());
  1741 + studentPageData.put("SCORE",
  1742 + studentAnswer.getScore());
  1743 + studentPageData.put("CLASS_ID",
  1744 + testPaper.getClassId());
  1745 + studentPageData.put("STUDENTTEST_ID", get32UUID());
  1746 + studenttestService.save(studentPageData);
  1747 +
  1748 + for (TestPaperInfo testPaperInfo : studentAnswer
  1749 + .getQuestions()) {
  1750 + testInfoPd = new PageData();
  1751 + testInfoPd.put("TESTPAPERINFO_ID",
  1752 + this.get32UUID());
  1753 + testInfoPd.put("PAPER_ID",
  1754 + testPaperInfo.getPaperId());
  1755 + testInfoPd.put("STUDENT_ID",
  1756 + studentAnswer.getStudentId());
  1757 + testInfoPd.put("TEST_ID", testPaperId);
  1758 + testInfoPd.put("QUESTION_ID",
  1759 + testPaperInfo.getQuestionId());
  1760 + testInfoPd.put("ANSWER",
  1761 + testPaperInfo.getAnswer());
  1762 + testInfoPd.put("RIGHT",
  1763 + testPaperInfo.getRight());
  1764 + testInfoPd.put("SCORE",
  1765 + testPaperInfo.getScore());
  1766 + testInfoPd.put("LIKES",
  1767 + testPaperInfo.getLikes());
  1768 + testInfoPd.put("ANSWER_TYPE", testPaperInfo
  1769 + .getAnswerType() == null ? "1"
  1770 + : testPaperInfo.getAnswerType());
  1771 + testInfoPd.put("PRESS_TIME",
  1772 + testPaperInfo.getPressTime());
  1773 + testInfoPd.put("RECEIVER_DATE",
  1774 + testPaperInfo.getReceiverDate());
  1775 + testInfoPd.put("SUBJECTIVE",
  1776 + testPaperInfo.getSubjective());
  1777 + testInfoPd.put("NOTE", testPaperInfo.getNote());
  1778 + testInfoPd.put("MARK_NO",
  1779 + testPaperInfo.getMarkNo());
  1780 + testInfoPd.put("RANDOM", testPaperInfo.getRandom());
  1781 + testInfoPd.put("RANK", testPaperInfo.getRank());
  1782 + testInfoPdList.add(testInfoPd);
  1783 + }
  1784 + }
  1785 + }
  1786 + testpaperinfoService.batchSave(testInfoPdList);
  1787 + }
  1788 + res.setData(testPaperId);
  1789 + } catch (Exception e) {
  1790 + e.printStackTrace();
  1791 + res.setError();
  1792 + res.setMessage(e.getMessage());
  1793 + }
  1794 + } else {
  1795 + res.setDataError();
  1796 + }
  1797 + logger.info("uploadupdatetestpaper cost time:"
  1798 + + (System.currentTimeMillis() - cur));
  1799 +
  1800 + return res.toJson();
  1801 +
  1802 + }
1466 1803  
1467 1804 /**
1468 1805 * 查询知识点
... ... @@ -1472,6 +1809,7 @@ public class V1 extends BaseController {
1472 1809 @RequestMapping(value = "/point", produces = "application/json;charset=UTF-8")
1473 1810 @ResponseBody
1474 1811 public Object point() throws Exception {
  1812 + event("point");
1475 1813 ResponseGson<List<PageData>> res = new ResponseGson();
1476 1814  
1477 1815 PageData pd = getPageData();
... ... @@ -2412,4 +2750,55 @@ public class V1 extends BaseController {
2412 2750 return res.toJson();
2413 2751  
2414 2752 }
  2753 +
  2754 + /**
  2755 + * 根据ID班级名称
  2756 + * @param id
  2757 + * @return
  2758 + * @throws Exception
  2759 + */
  2760 + @RequestMapping(value = "/qstudentinfo", produces = "application/json;charset=UTF-8")
  2761 + @ResponseBody
  2762 + public String qstudentinfo() throws Exception {
  2763 + ResponseGson<List<PageData>> res = new ResponseGson();
  2764 + PageData pageData = this.getPageData();
  2765 + if (pageData.containsKey("TEST_ID")
  2766 + && pageData.containsKey("QUESTION_ID")) {
  2767 + List<PageData> list = v1Service.getQuestionWrongInfo(pageData);
  2768 + res.setData(list);
  2769 + }else{
  2770 + res.setDataError();
  2771 + }
  2772 + return res.toJson();
  2773 +
  2774 + }
  2775 +
  2776 + @RequestMapping(value = "/uploadfile", produces = "application/json;charset=UTF-8")
  2777 + @ResponseBody
  2778 + public String uploadFile(@RequestParam(value="file",required=false)MultipartFile file, HttpServletRequest request) throws Exception{
  2779 + ResponseGson<String> res = new ResponseGson<String>();
  2780 + if (file != null) {
  2781 + String path = request.getSession().getServletContext()
  2782 + .getRealPath("/uploadFiles/uploadFile/");
  2783 + String name = System.currentTimeMillis() + file.getOriginalFilename();
  2784 + File pathFile = new File(path);
  2785 + pathFile.mkdirs();
  2786 + File saveFile = new File(path + File.separator + name);
  2787 + if(saveFile.exists()){
  2788 + saveFile.delete();
  2789 + }
  2790 + saveFile.createNewFile();
  2791 + file.transferTo(saveFile);
  2792 + path = request.getContextPath();
  2793 + String basePath = request.getScheme() + "://" + request.getServerName()
  2794 + + ":" + request.getServerPort() + path + "/";
  2795 + res.setData("/uploadFiles/uploadFile/" + name);
  2796 + }else{
  2797 + res.setDataError();
  2798 + }
  2799 + return res.toJson();
  2800 + }
  2801 +
  2802 +
  2803 +
2415 2804 }
... ...
src/com/fh/controller/sunvote/report/ReportController.java
... ... @@ -50,6 +50,7 @@ public class ReportController extends BaseController {
50 50 PageData pd = getPageData();
51 51 pd.put("SCLASS_ID", pd.get("CLASSID"));
52 52 pd.put("ID", pd.get("CLASSID"));
  53 + pd.put("TEST_TYPE", "1");
53 54 // 1 查询班级信息
54 55 PageData classPageData = sclassService.findById(pd);
55 56 PageData info = new PageData();
... ...
src/com/fh/controller/sunvote/teacher/TeacherController.java
... ... @@ -167,6 +167,24 @@ public class TeacherController extends BaseController {
167 167 PageData pd = new PageData();
168 168 pd = this.getPageData();
169 169 mv.setViewName("sunvote/teacher/teach_paper");
  170 + pd.put("userId", userId);
  171 + mv.addObject("pd", pd);
  172 + return mv;
  173 + }
  174 + /**
  175 + * 列表
  176 + *
  177 + * @param page
  178 + * @throws Exception
  179 + */
  180 + @RequestMapping(value = "/test_list")
  181 + public ModelAndView test_list(Page page) throws Exception {
  182 + logBefore(logger, Jurisdiction.getUsername() + "列表Paper");
  183 + String userId = this.getUserID();
  184 + ModelAndView mv = this.getModelAndView();
  185 + PageData pd = new PageData();
  186 + pd = this.getPageData();
  187 + mv.setViewName("sunvote/teacher/test_list");
170 188 mv.addObject("pd", pd);
171 189 return mv;
172 190 }
... ... @@ -188,6 +206,24 @@ public class TeacherController extends BaseController {
188 206 mv.addObject("pd", pd);
189 207 return mv;
190 208 }
  209 +
  210 + /**
  211 + * 列表
  212 + *
  213 + * @param page
  214 + * @throws Exception
  215 + */
  216 + @RequestMapping(value = "/paper_view1")
  217 + public ModelAndView paper_view1(Page page) throws Exception {
  218 + logBefore(logger, Jurisdiction.getUsername() + "列表Paper");
  219 + String userId = this.getUserID();
  220 + ModelAndView mv = this.getModelAndView();
  221 + PageData pd = new PageData();
  222 + pd = this.getPageData();
  223 + mv.setViewName("sunvote/teacher/paper_view1");
  224 + mv.addObject("pd", pd);
  225 + return mv;
  226 + }
191 227  
192 228 /**
193 229 * 列表
... ...
src/com/fh/service/api/V1Manager.java
... ... @@ -19,5 +19,7 @@ public interface V1Manager {
19 19  
20 20 public List<PageData> getTeacherInfo(PageData pd) throws Exception;
21 21  
  22 + public List<PageData> getQuestionWrongInfo(PageData pd) throws Exception ;
  23 +
22 24  
23 25 }
... ...
src/com/fh/service/api/impl/V1Service.java
... ... @@ -45,5 +45,10 @@ public class V1Service implements V1Manager {
45 45 public List<PageData> getTeacherInfo(PageData pd) throws Exception {
46 46 return (List<PageData>)dao.findForList("V1Mapper.getTeacherInfo", pd);
47 47 }
  48 +
  49 + @Override
  50 + public List<PageData> getQuestionWrongInfo(PageData pd) throws Exception {
  51 + return (List<PageData>)dao.findForList("V1Mapper.getQuestionWrongInfo", pd);
  52 + }
48 53  
49 54 }
... ...
src/com/fh/service/sunvote/paper/PaperManager.java
... ... @@ -36,6 +36,9 @@ public interface PaperManager{
36 36 */
37 37 public List<PageData> list(Page page)throws Exception;
38 38  
  39 +
  40 + public List<PageData> listAllByType(PageData pd)throws Exception;
  41 +
39 42 /**列表(全部)
40 43 * @param pd
41 44 * @throws Exception
... ...
src/com/fh/service/sunvote/paper/impl/PaperService.java
... ... @@ -70,6 +70,15 @@ public class PaperService implements PaperManager{
70 70 return (List<PageData>)dao.findForList("PaperMapper.listAllByTypelistPage", pd);//.*listPage.*
71 71 }
72 72  
  73 + /**列表(全部)
  74 + * @param pd
  75 + * @throws Exception
  76 + */
  77 + @SuppressWarnings("unchecked")
  78 + public List<PageData> listAllByType(PageData pd)throws Exception{
  79 + return (List<PageData>)dao.findForList("PaperMapper.listAllByType", pd);//.*listPage.*
  80 + }
  81 +
73 82 /**通过id获取数据
74 83 * @param pd
75 84 * @throws Exception
... ...