//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";
}
}
}