Ejemplo n.º 1
0
  protected ListInfo getDataList(String sortKey, boolean desc, long offset, int maxPagesize) {

    ListInfo listInfo = new ListInfo();
    String executorID = super.accessControl.getUserID();
    int j = Integer.parseInt(executorID);
    SchedularManagerImpl sch = new SchedularManagerImpl();
    String sdBeginTime = request.getParameter("beginTime");
    String sdEndTime = request.getParameter("endTime");
    try {
      String sql =
          "select * from TD_SD_SCHEDULAR where status = 0 and executor_id = "
              + j
              + " "
              + " and begintime < "
              + SQLManager.getInstance()
                  .getDBAdapter()
                  .getDateString(StringUtil.stringToDate(sdEndTime))
              + " "
              + " and endtime > "
              + SQLManager.getInstance()
                  .getDBAdapter()
                  .getDateString(StringUtil.stringToDate(sdBeginTime))
              + ""
              + " order by begintime";
      listInfo = sch.getSchedularList(sql, (int) offset, maxPagesize);
    } catch (Exception e) {
      e.printStackTrace();
    }
    return listInfo;
  }
  /** 得到某天某执行人的日程 */
  public List getDaySchedular(String date, int executorID) throws ManagerException {

    Date start = StringUtil.stringToDate(date + " 00:00:00");
    Date end = StringUtil.stringToDate(date + " 23:59:59");
    DBUtil dbUtil = new DBUtil();
    List list = new ArrayList();

    String sql =
        "select *  from TD_SD_SCHEDULAR  where status=0 and executor_id = "
            + executorID
            + " and beginTime>="
            + SQLManager.getInstance().getDBAdapter().getDateString(start)
            + ""
            + "and beginTime <="
            + SQLManager.getInstance().getDBAdapter().getDateString(end);
    try {

      dbUtil.executeSelect(sql);
      for (int i = 0; i < dbUtil.size(); i++) {
        Schedular sch = new Schedular();
        sch.setSchedularID(dbUtil.getInt(i, "SCHEDULAR_ID"));
        sch.setPlannerID(dbUtil.getInt(i, "PLANNER_ID"));
        sch.setExecutorID(dbUtil.getInt(i, "EXECUTOR_ID"));
        sch.setRequestID(dbUtil.getInt(i, "REQUEST_ID"));
        sch.setBeginTime(dbUtil.getDate(i, "BEGINTIME"));
        sch.setEndTime(dbUtil.getDate(i, "ENDTIME"));
        sch.setType(dbUtil.getString(i, "TYPE"));
        sch.setIsLeisure(dbUtil.getInt(i, "ISLEISURE"));
        sch.setIsPublicAffair(dbUtil.getInt(i, "ISPUBLICAFFAIR"));
        sch.setContent(dbUtil.getString(i, "CONTENT"));
        sch.setPlace(dbUtil.getString(i, "PLACE"));
        sch.setTopic(dbUtil.getString(i, "TOPIC"));
        sch.setEssentiality(dbUtil.getString(i, "ESSENTIALITY"));
        sch.setStatus(dbUtil.getInt(i, "STATUS"));
        sch.setIsHistory(dbUtil.getInt(i, "ISHISTORY"));
        list.add(sch);
      }
    } catch (SQLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    return list;
  }