Commit eca4feb532faacb3a14531abd59b8946e463d0be
1 parent
4b6a5239
管理员功能完善
Showing
8 changed files
with
84 additions
and
22 deletions
WebRoot/WEB-INF/jsp/sunvote/admin/admin_main.jsp
| ... | ... | @@ -262,17 +262,17 @@ |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | function report(classId){ |
| 265 | - //window.open('<%=basePath%>report/report.do?classid=' + classId); | |
| 266 | - //if($("#mainFrame").attr('src') != ('<%=basePath%>report/report.do?classid=' + classId)){ | |
| 267 | - $("#mainFrame").attr('src','<%=basePath%>report/report.do?classid=' + classId); | |
| 265 | + //window.open('<%=basePath%>report/report.do?role=admin&classid=' + classId); | |
| 266 | + //if($("#mainFrame").attr('src') != ('<%=basePath%>report/report.do?role=admin&classid=' + classId)){ | |
| 267 | + $("#mainFrame").attr('src','<%=basePath%>report/report.do?role=admin&classid=' + classId); | |
| 268 | 268 | window.top.loading.show(); |
| 269 | 269 | //} |
| 270 | 270 | } |
| 271 | 271 | function report2(classId){ |
| 272 | 272 | //window.open('<%=basePath%>report/report.do?classid=' + classId); |
| 273 | 273 | //if($("#mainFrame").attr('src') != ('<%=basePath%>report/report.do?classid=' + classId)){ |
| 274 | - $("#mainFrame").attr('src','<%=basePath%>teacher/test_list.do?classid=' + classId); | |
| 275 | - window.top.loading.show(); | |
| 274 | + // $("#mainFrame").attr('src','<%=basePath%>teacher/test_list.do?classid=' + classId); | |
| 275 | + // window.top.loading.show(); | |
| 276 | 276 | //} |
| 277 | 277 | } |
| 278 | 278 | |
| ... | ... | @@ -313,8 +313,8 @@ |
| 313 | 313 | $("#jishice_paper").click(function (){ |
| 314 | 314 | var path = "../teacher/teach_paper.do?school_id=" + schoolId; |
| 315 | 315 | //if($("#mainFrame").attr('src') != (path)){ |
| 316 | - $("#mainFrame").attr('src',path); | |
| 317 | - window.top.loading.show(); | |
| 316 | + // $("#mainFrame").attr('src',path); | |
| 317 | + // window.top.loading.show(); | |
| 318 | 318 | //} |
| 319 | 319 | }); |
| 320 | 320 | </script> | ... | ... |
WebRoot/WEB-INF/jsp/sunvote/teacher/teacher_report_1.jsp
| ... | ... | @@ -33,6 +33,7 @@ |
| 33 | 33 | <div style="padding:20px 20px;"> |
| 34 | 34 | <form action="report/report.do" method="post" name="Form" id="Form" style="margin-bottom:0;"> |
| 35 | 35 | <input type="hidden" name="CLASSID" id="CLASSID" value="${info.CLASS_ID}" /> |
| 36 | + <input type="hidden" name="ROLE" id="ROLE" value="${pd.ROLE}" /> | |
| 36 | 37 | <table style="margin-top:5px;margin-bottom:20px;"> |
| 37 | 38 | <tr> |
| 38 | 39 | <td><div style="width:150px;text-align:center;">课程统计: ${info.testsize}</div></td> |
| ... | ... | @@ -40,6 +41,16 @@ |
| 40 | 41 | |
| 41 | 42 | <td><div style="width:150px;text-align:center;"><span>学生人数: ${info.STUDENT_NUM}</span></div></td> |
| 42 | 43 | <td></td> |
| 44 | + <c:if test="${not empty subjectInfos}"> | |
| 45 | + <td> | |
| 46 | + <select class="chosen-select form-control" name="SUBJECT_ID" id="SUBJECT_ID" data-placeholder="这里输入所属学校"> | |
| 47 | + <option value="">全部</option> | |
| 48 | + <c:forEach var="item" items="${subjectInfos}"> | |
| 49 | + <option value="${item.SUBJECT_ID}" <c:if test="${pd.SUBJECT_ID == item.SUBJECT_ID }">selected = ture</c:if>>${item.SCNAME}</option> | |
| 50 | + </c:forEach> | |
| 51 | + </select> | |
| 52 | + </td> | |
| 53 | + </c:if> | |
| 43 | 54 | <td style="padding-left:2px;"> |
| 44 | 55 | <input |
| 45 | 56 | class="span10 date-picker" name="lastStart" id="lastStart" |
| ... | ... | @@ -211,6 +222,7 @@ |
| 211 | 222 | }); |
| 212 | 223 | }); |
| 213 | 224 | |
| 225 | + var role = '${pd.ROLE}'; | |
| 214 | 226 | |
| 215 | 227 | function precent(avg,total){ |
| 216 | 228 | if(total == 0){ |
| ... | ... | @@ -223,7 +235,11 @@ |
| 223 | 235 | var url = "<%=basePath%>report/report.do?classid=${info.CLASS_ID}" ; |
| 224 | 236 | var startDate = $("#lastStart").val(); |
| 225 | 237 | var endDate = $("#lastEnd").val(); |
| 226 | - url = url + "&start_date=" + startDate + "&end_date=" + endDate ; | |
| 238 | + var subject_id = $("#SUBJECT_ID").val(); | |
| 239 | + url = url + "&start_date=" + startDate + "&end_date=" + endDate + "&SUBJECT_ID=" + subject_id; | |
| 240 | + if(role == "admin"){ | |
| 241 | + url = url + "&ROLE=admin" ; | |
| 242 | + } | |
| 227 | 243 | window.location.href = url; |
| 228 | 244 | /* $("#Form").sumbit(); */ |
| 229 | 245 | } | ... | ... |
WebRoot/WEB-INF/jsp/sunvote/teacher/teacher_report_test.jsp
| ... | ... | @@ -93,7 +93,7 @@ |
| 93 | 93 | <%-- <td class="center">${var.RIGHT}</td> --%> |
| 94 | 94 | <td class="center"><div style="width:80px;">${vs.index + 1}</div></td> |
| 95 | 95 | <c:forEach items="${questionInfo}" var="var1" varStatus="vs1"> |
| 96 | - <td class="center"><div style="width:80px;margin:0 auto;">${var.detail[vs1.index].ANSWER}</div></td> | |
| 96 | + <td class="center" <c:if test="${var.detail[vs1.index].RIGHT== '1'}">style="background:#0bb8b9"</c:if>div style="width:80px;margin:0 auto;">${var.detail[vs1.index].ANSWER}</div></td> | |
| 97 | 97 | </c:forEach> |
| 98 | 98 | <%-- <td class="center">${var.OTHER_SCORE}</td> --%> |
| 99 | 99 | <td class="center"><div style="width:80px;margin:0 auto;">${var.GETSCORE}</div></td> | ... | ... |
WebRoot/static/js/control-604.js
| 1 | -$(function(){ | |
| 1 | + var questionNUm = 0 ; | |
| 2 | +$(function(){ | |
| 2 | 3 | /*快速创建答案列表*/ |
| 3 | 4 | var score=0; |
| 4 | 5 | var total_score = 0; |
| 5 | - var questionNUm = 0 ; | |
| 6 | + | |
| 6 | 7 | function creat(str_ans,a_num,fraction){ |
| 7 | 8 | // $(".section").remove(); |
| 8 | 9 | answer_index_b=$(".section").length+1; |
| ... | ... | @@ -16,7 +17,7 @@ |
| 16 | 17 | } |
| 17 | 18 | } |
| 18 | 19 | q_num=str.length; |
| 19 | - $(".content").append('<div class="section section-' + answer_index_b +' single" data-fraction="'+fraction+'" data-score="'+(q_num * fraction)+'"><div class="title"><h3>第' +answer_index_b +'大题总分: ' + (q_num * fraction)+'分<!--<span>请在试题选项上点击,亮色为该试题的正确答案 </span> --></h3> </div><div class="question_list"></div></div>'); | |
| 20 | + $(".content").append('<div class="section section-' + answer_index_b +' single" data-fraction="'+fraction+'" data-score="'+(q_num * fraction)+'"><div class="title"><h3>第' +answer_index_b +'大题总分: ' + q_num + ' X ' + fraction + ' = ' + (q_num * fraction)+' 分<!--<span>请在试题选项上点击,亮色为该试题的正确答案 </span> --></h3> </div><div class="question_list"></div></div>'); | |
| 20 | 21 | for(var i=0;i<q_num;i++){ |
| 21 | 22 | str_temp=str[i]; |
| 22 | 23 | str_temp=str_temp.toUpperCase() |
| ... | ... | @@ -112,7 +113,7 @@ |
| 112 | 113 | }*/ |
| 113 | 114 | case 5: //多选题 |
| 114 | 115 | // $(".content").html(""); |
| 115 | - $(".content").append('<div class="section section-'+ answer_index_b +' check" data-fraction="'+fraction2+'" data-score="' + ((index_e_2- index_s_2 + 1 )* fraction2)+ '"> <div class="title"><h3>第' +answer_index_b +'大题总分: ' + ((index_e_2- index_s_2 + 1 )* fraction2)+'分<!--<span>请在试题选项上点击,亮色为该试题的正确答案 </span>--></h3> </div> <div class="question_list"></div></div>'); | |
| 116 | + $(".content").append('<div class="section section-'+ answer_index_b +' check" data-fraction="'+fraction2+'" data-score="' + ((index_e_2- index_s_2 + 1 )* fraction2)+ '"> <div class="title"><h3>第' +answer_index_b +'大题总分: ' + (index_e_2- index_s_2 + 1 ) + ' X ' + fraction2 + ' = ' + ((index_e_2- index_s_2 + 1 )* fraction2)+' 分<!--<span>请在试题选项上点击,亮色为该试题的正确答案 </span>--></h3> </div> <div class="question_list"></div></div>'); | |
| 116 | 117 | for(var i=index_s_2;i<=index_e_2;i++){ |
| 117 | 118 | questionNUm++; |
| 118 | 119 | $(".section-" + answer_index_b +" .question_list").append('<div class="question question'+questionNUm+'"><span>'+questionNUm+'、</span><ul></ul></div>'); |
| ... | ... | @@ -379,12 +380,12 @@ function creatHtml(data){ |
| 379 | 380 | |
| 380 | 381 | for(var i=0;i<data.questions.length;i++){ |
| 381 | 382 | if(data.questions[i].questions){ |
| 382 | - $(".content").append('<div class="section section-'+i+'" data-fraction="'+data.questions[i].score+'" style="margin-top:20px;"> <h3><span class="que_num">'+'第'+ (i+1) + '大题总分:'+ data.questions[i].sug_score +'</span>'+'<span class="que_name">'+data.questions[i].content+'</span></h3><!-- <input type="button" class="btn btn-danger pull-right remove" name="remove" value="删除" /> --> <div class="question_list"></div></div>'); | |
| 383 | + $(".content").append('<div class="section section-'+i+'" data-fraction="'+data.questions[i].score+'" style="margin-top:20px;"> <h3><span class="que_num">'+'第'+ (i+1) + '大题总分:'+data.questions[i].questions.length + " X " + (parseFloat(data.questions[i].sug_score) / data.questions[i].questions.length) + " = " + data.questions[i].sug_score +'</span>'+'<span class="que_name">'+data.questions[i].content+'</span></h3><!-- <input type="button" class="btn btn-danger pull-right remove" name="remove" value="删除" /> --> <div class="question_list"></div></div>'); | |
| 383 | 384 | }else{ |
| 384 | 385 | if(i == 0){ |
| 385 | 386 | $(".content").append('<div class="section section0"> <div class="question_list"></div></div>'); |
| 386 | 387 | } |
| 387 | - $(".section0").find(".question_list").append('<div class="question question'+(i+1)+'"><span>'+(i+1)+'、</span><ul></ul></div>'); | |
| 388 | + $(".section0").find(".question_list").append('<div class="question question'+(i+1)+'"><span>'+(++questionNUm)+'、</span><ul></ul></div>'); | |
| 388 | 389 | for(var k=0;k<parseInt(data.questions[i].option_num);k++){ |
| 389 | 390 | str_temp=data.questions[i].answer; |
| 390 | 391 | $(".section0").find(".question"+(i+1)+' ul').append('<li class="btn btn-default">'+String.fromCharCode(0x41+k)+'</li>'); |
| ... | ... | @@ -401,7 +402,7 @@ function creatHtml(data){ |
| 401 | 402 | |
| 402 | 403 | if(data.questions[i].questions){ |
| 403 | 404 | for(var j=0;j<data.questions[i].questions.length;j++){ |
| 404 | - $(".section-"+i).find(".question_list").append('<div class="question question'+(j+1)+'"><span>'+(j+1)+'、</span><ul></ul></div>'); | |
| 405 | + $(".section-"+i).find(".question_list").append('<div class="question question'+(j+1)+'"><span>'+(++questionNUm)+'、</span><ul></ul></div>'); | |
| 405 | 406 | if($(".section-"+i).find(".que_name").text()=="判断题"){ |
| 406 | 407 | for(var k=0;k<parseInt(data.questions[i].questions[j].option_num);k++){ |
| 407 | 408 | str_temp=data.questions[i].questions[j].answer; | ... | ... |
resources/mybatis1/sunvote/TestPaperMapper.xml
| ... | ... | @@ -23,6 +23,7 @@ |
| 23 | 23 | TOTAL_SCORE, |
| 24 | 24 | REMARK, |
| 25 | 25 | TEST_TYPE, |
| 26 | + SUBJECT_ID, | |
| 26 | 27 | TESTPAPER_ID |
| 27 | 28 | </sql> |
| 28 | 29 | |
| ... | ... | @@ -42,6 +43,7 @@ |
| 42 | 43 | #{TOTAL_SCORE}, |
| 43 | 44 | #{REMARK}, |
| 44 | 45 | #{TEST_TYPE}, |
| 46 | + #{SUBJECT_ID}, | |
| 45 | 47 | #{TESTPAPER_ID} |
| 46 | 48 | </sql> |
| 47 | 49 | |
| ... | ... | @@ -83,6 +85,7 @@ |
| 83 | 85 | TOTAL_SCORE = #{TOTAL_SCORE}, |
| 84 | 86 | REMARK = #{REMARK}, |
| 85 | 87 | TEST_TYPE = #{TEST_TYPE}, |
| 88 | + SUBJECT_ID = #{SUBJECT_ID}, | |
| 86 | 89 | TESTPAPER_ID = TESTPAPER_ID |
| 87 | 90 | where |
| 88 | 91 | TESTPAPER_ID = #{TESTPAPER_ID} |
| ... | ... | @@ -143,6 +146,9 @@ |
| 143 | 146 | <if test="NAME != null and NAME != ''"><!-- 关键词检索 --> |
| 144 | 147 | and (NAME = #{NAME}) |
| 145 | 148 | </if> |
| 149 | + <if test="SUBJECT_ID != null and SUBJECT_ID != ''"><!-- 关键词检索 --> | |
| 150 | + and (SUBJECT_ID = #{SUBJECT_ID}) | |
| 151 | + </if> | |
| 146 | 152 | <if test="TEST_TYPE != null and TEST_TYPE == '1'.toString()"><!-- 关键词检索 --> |
| 147 | 153 | and (TEST_TYPE = #{TEST_TYPE} or TEST_TYPE IS NULL) |
| 148 | 154 | </if> |
| ... | ... | @@ -185,6 +191,9 @@ |
| 185 | 191 | <if test="TEACHER_ID != null and TEACHER_ID != ''"><!-- 关键词检索 --> |
| 186 | 192 | and (TEACHER_ID = #{TEACHER_ID}) |
| 187 | 193 | </if> |
| 194 | + <if test="SUBJECT_ID != null and SUBJECT_ID != ''"><!-- 关键词检索 --> | |
| 195 | + and (SUBJECT_ID = #{SUBJECT_ID}) | |
| 196 | + </if> | |
| 188 | 197 | <if test="CREATE_DATE != null and CREATE_DATE != ''"><!-- 关键词检索 --> |
| 189 | 198 | and (CREATE_DATE = #{CREATE_DATE}) |
| 190 | 199 | </if> | ... | ... |
src/com/fh/controller/api/V1.java
| ... | ... | @@ -1787,7 +1787,9 @@ public class V1 extends BaseController { |
| 1787 | 1787 | } |
| 1788 | 1788 | } |
| 1789 | 1789 | } |
| 1790 | - testpaperinfoService.batchSave(testInfoPdList); | |
| 1790 | + if(testInfoPdList.size() > 0){ | |
| 1791 | + testpaperinfoService.batchSave(testInfoPdList); | |
| 1792 | + } | |
| 1791 | 1793 | } |
| 1792 | 1794 | res.setData(testPaperId); |
| 1793 | 1795 | } catch (Exception e) { | ... | ... |
src/com/fh/controller/sunvote/paper/PaperController.java
| ... | ... | @@ -255,10 +255,13 @@ public class PaperController extends BaseController { |
| 255 | 255 | Session session = Jurisdiction.getSession(); |
| 256 | 256 | User user = (User)session.getAttribute(Const.SESSION_USER); |
| 257 | 257 | paper.setUser_id(user.getUSER_ID()); |
| 258 | - paper.setPaper_type(paperType == null ? "1" :paperType); | |
| 259 | - paper.setSubject_id(pd.getString("SUBJECT_ID") == null ? getSubjectId():pd.getString("SUBJECT_ID")); | |
| 260 | - paper.setGrade_id(pd.getString("GRADE_ID") == null ? getGradeID() : pd.getString("GRADE_ID")); | |
| 261 | - paper.setSchool_id(pd.getString("SCHOOL_ID") == null ? getSchoolID() : pd.getString("SCHOOL_ID")); | |
| 258 | + paper.setPaper_type(paperType == null || "".equals(paperType.trim()) ? "1" :paperType); | |
| 259 | + String subjectId = pd.getString("SUBJECT_ID"); | |
| 260 | + paper.setSubject_id(subjectId == null || "".equals(subjectId.trim())? getSubjectId():subjectId); | |
| 261 | + String gradeId = pd.getString("GRADE_ID"); | |
| 262 | + paper.setGrade_id( gradeId== null || "".equals(gradeId.trim())? getGradeID() : gradeId); | |
| 263 | + String schoolId = pd.getString("SCHOOL_ID") ; | |
| 264 | + paper.setSchool_id(schoolId == null || "".equals(schoolId.trim())? getSchoolID() : schoolId); | |
| 262 | 265 | paper.setQuestions(new ArrayList<Question>()); |
| 263 | 266 | |
| 264 | 267 | pd.put("JSON", paper.toJson()); | ... | ... |
src/com/fh/controller/sunvote/report/ReportController.java
| ... | ... | @@ -14,6 +14,7 @@ import org.springframework.web.servlet.ModelAndView; |
| 14 | 14 | |
| 15 | 15 | import com.fh.controller.api.ResponseGson; |
| 16 | 16 | import com.fh.controller.base.BaseController; |
| 17 | +import com.fh.service.api.V1Manager; | |
| 17 | 18 | import com.fh.service.sunvote.sclass.SClassManager; |
| 18 | 19 | import com.fh.service.sunvote.student.StudentManager; |
| 19 | 20 | import com.fh.service.sunvote.studenttest.StudentTestManager; |
| ... | ... | @@ -41,6 +42,9 @@ public class ReportController extends BaseController { |
| 41 | 42 | @Resource(name="testpaperinfoService") |
| 42 | 43 | private TestPaperInfoManager testpaperinfoService; |
| 43 | 44 | |
| 45 | + @Resource(name = "v1Service") | |
| 46 | + private V1Manager v1Service; | |
| 47 | + | |
| 44 | 48 | |
| 45 | 49 | |
| 46 | 50 | @RequestMapping(value="/report") |
| ... | ... | @@ -51,7 +55,30 @@ public class ReportController extends BaseController { |
| 51 | 55 | pd.put("SCLASS_ID", pd.get("CLASSID")); |
| 52 | 56 | pd.put("ID", pd.get("CLASSID")); |
| 53 | 57 | pd.put("TEST_TYPE", "1"); |
| 54 | - pd.put("TEACHER_ID", getUserID()); | |
| 58 | + String role = pd.getString("ROLE"); | |
| 59 | + if( role != null && "admin".equals(role)){ | |
| 60 | + PageData tpd = new PageData(); | |
| 61 | + tpd.put("ID", getUserID()); | |
| 62 | + List<PageData> adminInfos = v1Service.getAdminInfo(tpd); | |
| 63 | + List<PageData> subjectInfos = new ArrayList<PageData>(); | |
| 64 | + for(PageData pad : adminInfos){ | |
| 65 | + PageData tmpd = new PageData(); | |
| 66 | + Object gradeId = pad.get("GRADE_ID"); | |
| 67 | + tmpd.put("SNAME", pad.get("SNAME"));// 学校名称 | |
| 68 | + tmpd.put("SCHOOL_ID", pad.get("SCHOOL_ID"));//学校ID | |
| 69 | + tmpd.put("GRADE_ID", pad.get("GRADE_ID"));//年级id | |
| 70 | + tmpd.put("GNAME", pad.get("GNAME"));//年级名称 | |
| 71 | + tmpd.put("SUBJECT_ID", pad.get("SUBJECT_ID"));// 科目id | |
| 72 | + tmpd.put("SCNAME", pad.get("SCNAME"));// 科目名称 | |
| 73 | + if(gradeId != null && !"".equals(gradeId)){ | |
| 74 | + }else{ | |
| 75 | + subjectInfos.add(tmpd); | |
| 76 | + } | |
| 77 | + } | |
| 78 | + mv.addObject("subjectInfos", subjectInfos); | |
| 79 | + }else{ | |
| 80 | + pd.put("TEACHER_ID", getUserID()); | |
| 81 | + } | |
| 55 | 82 | // 1 查询班级信息 |
| 56 | 83 | PageData classPageData = sclassService.findById(pd); |
| 57 | 84 | PageData info = new PageData(); |
| ... | ... | @@ -60,6 +87,9 @@ public class ReportController extends BaseController { |
| 60 | 87 | info.put("CLASS_ID", classPageData.getString("ID")); |
| 61 | 88 | pd.put("CLASS_ID", pd.get("CLASSID")); |
| 62 | 89 | List<PageData> studentList = studentService.listAllClass(pd); |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 63 | 93 | // 2查询班级考试 |
| 64 | 94 | pd.put("TEST_TYPE", "1"); |
| 65 | 95 | List<PageData> testpaperList = testpaperService.listAll(pd); |
| ... | ... | @@ -110,6 +140,7 @@ public class ReportController extends BaseController { |
| 110 | 140 | mv.addObject("info", info); |
| 111 | 141 | mv.addObject("start_date", pd.get("START_DATE")); |
| 112 | 142 | mv.addObject("end_date", pd.get("END_DATE")); |
| 143 | + mv.addObject("pd", pd); | |
| 113 | 144 | mv.setViewName("sunvote/teacher/teacher_report_1"); |
| 114 | 145 | return mv; |
| 115 | 146 | } | ... | ... |