Commit 6a210cdd7f54c084893dd89bf9afd029e261b424

Authored by 孙向锦
1 parent 10dd917c

添加数据

WebRoot/WEB-INF/jsp/sunvote/homework/homework_student_report.jsp
... ... @@ -119,13 +119,15 @@ li {
119 119 </script>
120 120 <script src="../static/js/control1.js?a=1"></script>
121 121 <!-- 日期框 -->
122   - <script>
  122 + <script>
123 123 //lay('#version').html('-v'+ laydate.v);
124 124 //日期范围
125 125 // laydate.render({
126 126 // elem: '#test6'
127 127 // ,range: true
128 128 // });
  129 +
  130 + var data = ${data};
129 131 $(document).ready(function(){
130 132 window.top.loading.remove();
131 133 });
... ...
src/com/fh/controller/sunvote/homework/HomeworkController.java
... ... @@ -392,21 +392,61 @@ public class HomeworkController extends BaseController {
392 392 pd.put("START_DATE", getWeekStart(current));
393 393 pd.put("END_DATE", getWeekEnd(current));
394 394 }
395   -
396   - if(pd.get("STUDENT_ID") != null){
397   - List<PageData> dataList = homeworkService.report(pd);
398   - pd.put("DATA", dataList);
399   - }
  395 + String studentId = pd.getString("STUDENT_ID") ;
  396 + pd.remove("STUDENT_ID");
  397 + List<PageData> dataList = homeworkService.report(pd);
  398 + pd.put("DATA", dataList);
400 399 if(pd.get("CLASS_ID") != null){
401 400 List<PageData> studentList = studentService.findByClassId(pd);
402 401 pd.put("STUDENTS", studentList);
403 402 }
404 403 pd.remove("JSON");
  404 + pd.put("STUDENT_ID", studentId);
405 405 mv.setViewName("sunvote/homework/homework_student_report");
406 406 mv.addObject("pd", pd);
  407 + Gson gson = new Gson();
  408 + mv.addObject("data",gson.toJson(pd));
407 409 return mv;
408 410 }
409 411  
  412 + /**
  413 + * 去修改页面
  414 + *
  415 + * @param
  416 + * @throws Exception
  417 + */
  418 + @RequestMapping(value = "/student_data", produces = "application/json;charset=UTF-8")
  419 + @ResponseBody
  420 + public String studentData() throws Exception {
  421 + PageData pd = new PageData();
  422 + pd = this.getPageData();
  423 + pd.put("TEACHER_ID", getTeacherID());
  424 + if(pd.get("CURRENT_WEEK") == null && pd.get("START_DATE") == null && pd.get("END_DATE") == null){
  425 + pd.put("CURRENT_WEEK", "0");
  426 + String currentWeek = pd.getString("CURRENT_WEEK");
  427 + int current = Integer.parseInt(currentWeek);
  428 + pd.put("START_DATE", getWeekStart(current));
  429 + pd.put("END_DATE", getWeekEnd(current));
  430 + }else if(pd.get("CURRENT_WEEK") != null){
  431 + String currentWeek = pd.getString("CURRENT_WEEK");
  432 + int current = Integer.parseInt(currentWeek);
  433 + pd.put("START_DATE", getWeekStart(current));
  434 + pd.put("END_DATE", getWeekEnd(current));
  435 + }
  436 + String studentId = pd.getString("STUDENT_ID") ;
  437 + pd.remove("STUDENT_ID");
  438 + List<PageData> dataList = homeworkService.report(pd);
  439 + pd.put("DATA", dataList);
  440 + if(pd.get("CLASS_ID") != null){
  441 + List<PageData> studentList = studentService.findByClassId(pd);
  442 + pd.put("STUDENTS", studentList);
  443 + }
  444 + pd.remove("JSON");
  445 + pd.put("STUDENT_ID", studentId);
  446 + Gson gson = new Gson();
  447 + return gson.toJson(pd);
  448 + }
  449 +
410 450  
411 451 /**
412 452 * 去修改页面
... ... @@ -447,6 +487,41 @@ public class HomeworkController extends BaseController {
447 487 mv.addObject("pd", pd);
448 488 return mv;
449 489 }
  490 +
  491 +
  492 + @RequestMapping(value = "/homework_report_data" , produces = "application/json;charset=UTF-8")
  493 + @ResponseBody
  494 + public String homeworkReportData() throws Exception {
  495 + ModelAndView mv = this.getModelAndView();
  496 + PageData pd = new PageData();
  497 + pd = this.getPageData();
  498 + pd.put("TEACHER_ID", getTeacherID());
  499 +
  500 + if(pd.get("CURRENT_WEEK") == null && pd.get("START_DATE") == null && pd.get("END_DATE") == null){
  501 + pd.put("CURRENT_WEEK", "0");
  502 + String currentWeek = pd.getString("CURRENT_WEEK");
  503 + int current = Integer.parseInt(currentWeek);
  504 + pd.put("START_DATE", getWeekStart(current));
  505 + pd.put("END_DATE", getWeekEnd(current));
  506 + }else if(pd.get("CURRENT_WEEK") != null){
  507 + String currentWeek = pd.getString("CURRENT_WEEK");
  508 + int current = Integer.parseInt(currentWeek);
  509 + pd.put("START_DATE", getWeekStart(current));
  510 + pd.put("END_DATE", getWeekEnd(current));
  511 + }
  512 + if(pd.get("HOMEWORK_ID") != null){
  513 + List<PageData> dataList = homeworkService.report(pd);
  514 + pd.put("DATA", dataList);
  515 + }
  516 + if(pd.get("CLASS_ID") != null){
  517 + List<PageData> studentList = studentService.findByClassId(pd);
  518 + pd.put("STUDENTS", studentList);
  519 + }
  520 +
  521 + pd.remove("JSON");
  522 + Gson gson = new Gson();
  523 + return gson.toJson(pd);
  524 + }
450 525  
451 526  
452 527  
... ...