/** 查看 */ public String view() { List<Attachment> attachments = attachmentManager.findAllBy("refId", this.message.getId()); getRequest().setAttribute("attachments", attachments); String rs = this.message.getReceiver(); String username = this.getCurrUser().getUserName(); if (rs.equals(username)) { this.message.setState("1"); if (message.getChackTime() == null) { this.message.setChackTime(new Date()); } this.messageManager.update(this.message); } return VIEW_JSP; }
/** 保存修改 */ 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"; }
/** 保存新增草稿 */ 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("0"); // 未发送 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()); // 上传附件 } } return "sendAction"; }