Package com.ourlinc.conference.book

Examples of com.ourlinc.conference.book.Book


      //books中保存冲突的预定信息
      if(0 != books.size()){
        Iterator<Book> iter = books.iterator();
        StringBuilder msg = new StringBuilder();
        msg.append("预定失败 !<br />");
        Book book = null ;
        while (iter.hasNext()){
          book = iter.next();
          msg.append(stringDate + " ");
          msg.append(book.getStrBeginTime()+ " 至 ");
          msg.append(book.getStrEndTime()+ " 都已被");
          msg.append(" " + book.getDepartment() + " ");
          msg.append("占用 !<br />如有必要,请找预订人 "+book.getLinkman()+" 协商 !<br />");
        }
        //如果预定已经存在,那么就提示这个时间段已被某部门预定
        request.setAttribute("msg", msg);
        return "book/addbook";
      }else {
        //如果如果不存在冲突预定,就预定会议室,接着提示预定成功,并告知开会时间
        Book book = bookService.addBook(date, beginTime, continueTime, department, linkman);
        if ("".equals(title) || null == title){
          title = book.getDepartment() + "的会议" ;
        }
        if ("".equals(content) || null == content){
          content = book.getDepartment() + "的会议" ;
        }
        book.init(title, content);
        book.flush();//刷新对象
        request.setAttribute("msg", "预定成功,开会时间为 "+stringDate
            + " " + book.getStrBeginTime() + " 至 " + book.getStrEndTime()+" !");
        return "book/addbook";
      }
    }
  }
View Full Code Here


   */
  @RequestMapping
  String delete(HttpServletRequest request, HttpServletResponse response){
    String id = request.getParameter("id");
    String from = request.getParameter("from");
    Book book = bookService.cancleBook(id);
    request.setAttribute("msg", "取消成功,"+ book.getStrDate()+" "+book.getStrBeginTime()+" 至 "+book.getStrEndTime()+" 的会议已被成功取消 !");
    if ("index".equals(from)){
      List<Book> todaybooks = bookService.searchBook(DateUtil.formatDate(new Date()));
      request.setAttribute("todaybooks", todaybooks);
      return "book/"+from;
    }
View Full Code Here

   * @return
   */
  @RequestMapping
  String update(HttpServletRequest request, HttpServletResponse response){
    String id = request.getParameter("id");
    Book book = bookService.getBook(id);
    request.setAttribute("book", book);
    if (book.getDepartment().trim().equals("市场部")){
      request.setAttribute("market", "selected");
    }else if (book.getDepartment().trim().equals("数据部")){
      request.setAttribute("data", "selected");
    }else if (book.getDepartment().trim().equals("开发部")){
      request.setAttribute("dev", "selected");
    }else if (book.getDepartment().trim().equals("人事部")){
      request.setAttribute("hr", "selected");
    }else {
      request.setAttribute("finance", "selected");
    }
    return "book/update";
View Full Code Here

      int beginTime = Integer.parseInt(strbeginTimes[0])*60 + Integer.parseInt(strbeginTimes[1]);
      int continueTime = Integer.parseInt(strcontinueTime);
      //存放冲突的Book对象
      List<Book> books = new ArrayList<Book>();
      Date date = DateUtil.strFormatDate(stringDate);
      Book oldBook = bookService.cancleBook(id);
      oldBook.flush();//刷新对象
      books = bookService.getExistBook(date, beginTime, continueTime);
      //如果books存在元素,那么说明存在冲突的预定信息
      if(0 != books.size()){
        oldBook = bookService.activateBook(id);
        oldBook.flush();//刷新对象
        Iterator<Book> iter = books.iterator();
        StringBuilder msg = new StringBuilder();
        msg.append("更改失败 !<br />");
        Book book = null;
        while (iter.hasNext()){
          book = iter.next();
          msg.append(stringDate + " ");
          msg.append(book.getStrBeginTime()+ " 至 ");
          msg.append(book.getStrEndTime()+ " 都已被");
          msg.append(" " + book.getDepartment() + " ");
          msg.append("占用 !<br />如有必要,请找预订人 "+book.getLinkman()+" 协商 !<br />");
        }
        //如果预定已经存在,那么就提示这个时间段已被某部门预定
        request.setAttribute("msg", msg);
        request.setAttribute("book",oldBook);
        return "book/update";
      }else {
        //如果如果不存在冲突预定,那么就提示预定成功,并告知开会时间
        Book book = bookService.addBook(date, beginTime, continueTime, department,linkman);
        if ("".equals(title) || null == title){
          title = book.getDepartment() + "的会议" ;
        }
        if ("".equals(content) || null == content){
          content = book.getDepartment() + "的会议" ;
        }
        book.init(title, content);
        book.flush();//刷新对象
        request.setAttribute("msg", "更改成功,开会时间更改为 "+stringDate
            + " " + book.getStrBeginTime() + " 至 " + book.getStrEndTime()+ " !");
        //如果来自index.jspx,那么操作后,跳转到原页面
        if ("index".equals(from)){
          List<Book> todaybooks = bookService.searchBook(DateUtil.formatDate(new Date()));
          request.setAttribute("todaybooks", todaybooks);
          return "book/"+from;
View Full Code Here

        xmlDoc.append("暂无预定");
      }else {
        String url = "  <a href=\"onedate.jspx?date=" + strOneDate + "\">查看详细</a>";
        xmlDoc.append("日期:" + strOneDate + url + "<br />");
      }
      Book book = null ;
      while (iterbooks.hasNext()){
        book = iterbooks.next();
        xmlDoc.append("使用部门:"+book.getDepartment()+"<br />");
        xmlDoc.append("会议主题:"+book.getTitle()+ "<br />");
        xmlDoc.append("使用时间:"+book.getStrBeginTime()+" 至 ");
        xmlDoc.append(book.getStrEndTime()+"<br />");
        xmlDoc.append("<a href=\"javascript:show_confirm('"+book.getId().getIdentify()+"');\">" +
            "取 消</a> | <a href=\"update.jspx?id="+book.getId().getIdentify()+"&from=listall\">更 改</a><br />");
        xmlDoc.append("------------------------<br />");
      }
      try {
        Thread.sleep(100);
        response.getWriter().write(xmlDoc.toString());
View Full Code Here

   * @param continueTime 持续时间
   * @param department 预定部门
   * @return 返回新增后的预定对象
   */
  public Book addBook(Date date, int beginTime, int continueTime, String department, String linkman) {
    return new Book(m_Podi, date, beginTime, continueTime, department,linkman,Book.STATUS_ENABLE.getId()) ;
  }
View Full Code Here

    List<Book> list = new ArrayList<Book>();
    if ("全部".equals(department)){
      department = "";
    }
    rp.setPageSize(128);
    Book book = null;
   
    if (null == beginDate && null == endDate ){
      while (rp.gotoPage(rp.getPage()+1)){
        while (rp.hasNext()) {
          book = rp.next();
          if (book.getDepartment().contains(department)
              && book.getLinkman().contains(linkman)
              && book.getTitle().contains(title)
              && book.getContent().contains(content)
              && book.getStatus() == Book.STATUS_ENABLE.getId()) {
            list.add(book);
          }
        }
      }
    }else if (null == beginDate && null != endDate){
      while (rp.gotoPage(rp.getPage()+1)){
        while (rp.hasNext()) {
          book = rp.next();
          if (book.getDepartment().contains(department)
              && book.getLinkman().contains(linkman)
              && book.getTitle().contains(title)
              && book.getContent().contains(content)
              && book.getDate().equals(endDate)
              && book.getStatus() == Book.STATUS_ENABLE.getId()) {
            list.add(book);
          }
        }
      }
    }else if (null != beginDate && null == endDate){
      while (rp.gotoPage(rp.getPage()+1)){
        while (rp.hasNext()) {
          book = rp.next();
          if (book.getDepartment().contains(department)
              && book.getLinkman().contains(linkman)
              && book.getTitle().contains(title)
              && book.getContent().contains(content)
              && book.getDate().equals(beginDate)
              && book.getStatus() == Book.STATUS_ENABLE.getId()) {
            list.add(book);
          }
        }
      }
    }else {
      while (rp.gotoPage(rp.getPage()+1)){
        while (rp.hasNext()) {
          book = rp.next();
          if (book.getDepartment().contains(department)
              && book.getLinkman().contains(linkman)
              && book.getTitle().contains(title)
              && book.getContent().contains(content)
              && !book.getDate().before(beginDate) && !book.getDate().after(endDate)
              && book.getStatus() == Book.STATUS_ENABLE.getId()) {
            list.add(book);
          }
        }
      }
    }
View Full Code Here

   * 根据ID删除相应的预定信息
   * @param id
   * @return 返回删除后的预定信息
   */
  public Book cancleBook(String id) {
    Book book = getBook(id);
    book.cancle();
    return book;
  }
View Full Code Here

   * 根据ID激活相应的预定信息
   * @param id
   * @return 返回激活后的预定信息
   */
  public Book activateBook(String id) {
    Book book = getBook(id);
    book.activate();
    return book;
  }
View Full Code Here

TOP

Related Classes of com.ourlinc.conference.book.Book

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.