Exemplo n.º 1
0
  /**
   * 只查询拓展课的记录<br>
   * 只包括拓展课,<b>不包括</b>班级拓展课
   */
  @SuppressWarnings("unchecked")
  public String scheduleRecords() {
    Date curDate = new Date();
    if (DateUtils.isLessCurDay(date, curDate) || DateUtils.isSameDay(date, curDate)) {
      expiration = "-1";
    } else {
      FzxDto fzx = FzxDto.getFzxDto(cid.trim());
      schedule.setStartDay(DateUtils.getTodayWeeHours(date));
      schedule.setEndDay(DateUtils.getTomorrowWeeHours(date));
      schedule.setSzfzx(fzx);
      schedule.setLessonType(LessonTypeDto.getComplement());

      page = new Page();
      page.setCur(0);
      page.setPageSize(Integer.MAX_VALUE);
      Map<String, Object> result = commonService.getSchedules(page, schedule);
      page = (Page) result.get(Constants.RESULT_MAP_PAGE);
      ss = (List<Schedule>) result.get(Constants.RESULT_MAP_LIST);
      for (Schedule s : ss) {
        int count = commonService.getOrderLessonCountBySchedule(s);
        s.setStudents(count);
        // TODO 根据人数判断是否可以订课,人数可由运营中心设置
        if (count < Constants.MAX_STUDENTS_IN_CLASS) {
          s.setScheduleState(ScheduleStateDto.getCanOrder());
        } else {
          s.setScheduleState(ScheduleStateDto.getIsFull());
        }
      }
      expiration = String.valueOf(page.getTotal());
    }
    return SUCCESS;
  }
  /**
   * 取消的订课列表
   *
   * @return
   */
  @SuppressWarnings("unchecked")
  public String canceledRecords() {
    xyxx.setId(sid);

    page = new Page();
    page.setCur(ct);
    page.setPageSize(Constants.PAGE_SIZE);

    skjl.setXyxx(xyxx);
    skjl.setLessonType(LessonTypeDto.getComplement());
    Map<String, Object> result =
        commonService.getLessonRecords(page, skjl, Constants.LESSONRECORD_CANCEL);
    page = (Page) result.get(Constants.RESULT_MAP_PAGE);
    lessonRecords = (List<Skjl>) result.get(Constants.RESULT_MAP_LIST);
    return SUCCESS;
  }
  /**
   * 查看已上课记录列表
   *
   * @return
   */
  @SuppressWarnings("unchecked")
  public String lessonRecords() {
    xyxx.setId(sid);

    page = new Page();
    page.setCur(ct);
    page.setPageSize(Constants.PAGE_SIZE);

    skjl.setXyxx(xyxx);
    if (!StringUtils.isBlank(type)) {
      skjl.setLessonType(LessonTypeDto.getLessonType(type));
    }
    if (!StringUtils.isBlank(kq)) {
      skjl.setKq(KqDto.getKq(kq));
    }
    skjl.setSignDateStart(start);
    skjl.setSignDateEnd(end);
    Map<String, Object> result =
        commonService.getLessonRecords(page, skjl, Constants.LESSONRECORD_RECORD);
    page = (Page) result.get(Constants.RESULT_MAP_PAGE);
    lessonRecords = (List<Skjl>) result.get(Constants.RESULT_MAP_LIST);
    return SUCCESS;
  }