示例#1
0
 /** 保存新增发送 */
 public String saveAdd() {
   String title = getRequest().getParameter("title");
   String content = getRequest().getParameter("content");
   String receids = getRequest().getParameter("receids");
   String[] rids = receids.split(",");
   for (String rid : rids) {
     User user = userManager.getById(rid);
     Message mess = new Message();
     mess.setTitle(title);
     mess.setContent(content);
     mess.setReceiverId(user.getId());
     mess.setReceiver(user.getUsername());
     mess.setStatus("1"); // 已发送
     mess.setTime(new Date());
     mess.setState("0"); // 消息状态    0为未查看
     mess.setTs(new Date());
     mess.setSponsor(this.getCurrUser().getUserName());
     mess.setSponsorId(this.getCurrUser().getUserID());
     this.messageManager.save(mess);
     if (file != null) {
       uploadFile(mess.getId()); // 上传附件
     }
     ReceiveMessage receicemess = new ReceiveMessage();
     receicemess.setReceiverId(user.getId());
     receicemess.setReceiver(user.getUsername());
     receicemess.setTitle(title);
     receicemess.setContent(content);
     receicemess.setTime(new Date()); // 发生时间
     receicemess.setState("0"); // 消息状态    0为未查看
     receicemess.setTs(new Date());
     receicemess.setSponsor(this.getCurrUser().getUserName());
     receicemess.setSponsorId(this.getCurrUser().getUserID());
     this.receiveMessageManager.save(receicemess);
     if (file != null) {
       uploadFile(receicemess.getId()); // 上传附件
     }
   }
   return "sendAction";
 }
示例#2
0
 /** 保存修改 */
 public String saveEdit() {
   this.message.setStatus("1");
   this.message.setTime(new Date());
   this.messageManager.update(this.message);
   if (file != null) {
     uploadFile(message.getId()); // 上传附件
   }
   ReceiveMessage receicemess = new ReceiveMessage();
   receicemess.setReceiverId(this.message.getReceiverId());
   receicemess.setReceiver(this.message.getReceiver());
   receicemess.setTitle(this.message.getTitle());
   receicemess.setContent(this.message.getContent());
   receicemess.setTime(new Date()); // 发生时间
   receicemess.setState("0"); // 消息状态    0为未查看
   receicemess.setTs(new Date());
   receicemess.setSponsor(this.getCurrUser().getUserName());
   receicemess.setSponsorId(this.getCurrUser().getUserID());
   this.receiveMessageManager.save(receicemess);
   if (file != null) {
     uploadFile(receicemess.getId()); // 上传附件
   }
   return "draftAction";
 }