public String resend() { String id = getRequest().getParameter("id"); NoteSend noteSend = noteSendManager.getById(this.id); String[] sendids = noteSend.getSendid().split(","); String[] sendnames = noteSend.getRecipient().split(","); // 发件人存档 noteSend.setCid(0); noteSend.setCdate(new Date()); noteSend.setSendid(sendid); noteSend.setNotestatus("nosee"); noteSend.setUuid(UUID.randomUUID().toString()); noteSendManager.save(noteSend); noteSend.setUrl("/pages/NoteSend/showNoteReceiveView.do?id=" + noteSend.getId()); // 收件人存档 for (int i = 0; i < sendids.length; i++) { NoteReceive noteReceive = new NoteReceive(); noteReceive.setCid(0); noteReceive.setCdate(new Date()); noteReceive.setRecipient(sendnames[i]); noteReceive.setSendid(sendids[i]); noteReceive.setNotestatus("nosee"); noteReceive.setUuid(UUID.randomUUID().toString()); noteReceive.setMessage(noteSend.getMessage()); noteReceive.setMsgTxt(noteSend.getMessage()); noteReceiveManager.save(noteReceive); noteReceive.setUrl( "/pages/NoteSend/showNoteReceiveView.do?id=" + noteReceive.getId() + "&uuid=" + noteReceive.getUuid()); noteReceiveManager.saveOrUpdate(noteReceive); } showMessage2("发送短信成功!", "/pages/NoteSend/list.do"); return LIST_ACTION; }
public void prepare() throws Exception { if (isNullOrEmptyString(id)) { noteSend = new NoteSend(); } else { noteSend = (NoteSend) noteSendManager.getById(id); } }
/** 执行搜索 */ public String search() { NoteSendQuery sendQuery = new NoteSendQuery(); String searchType = getRequest().getParameter("searchType"); String searchInfo = getRequest().getParameter("searchInfo").trim(); try { searchInfo = java.net.URLDecoder.decode(searchInfo, "UTF-8"); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (null != searchInfo && !searchInfo.equals("")) { if ("sendid".equals(searchType)) { sendQuery.setSendid(searchInfo); } if ("recipient".equals(searchType)) { sendQuery.setRecipient(searchInfo); } if ("message".equals(searchType)) { sendQuery.setMessage(searchInfo); } } Page page = noteSendManager.findPage(sendQuery); savePage(page, sendQuery); return LIST_JSP; }
public String delete() { String id = getRequest().getParameter("id"); if (id != null) { noteSendManager.removeById(Integer.parseInt(id)); } showMessage2("删除成功!", "/pages/NoteSend/list.do"); return LIST_ACTION; }
/** 删除对象 */ public String delBatch() { for (int i = 0; i < items.length; i++) { Hashtable params = HttpUtils.parseQueryString(items[i]); java.lang.Integer id = new java.lang.Integer((String) params.get("id")); noteSendManager.removeById(id); } Flash.current().success(DELETE_SUCCESS); return LIST_ACTION; }
/** 进入更新页面 */ public String edit() { getRelative(); String id = getRequest().getParameter("id"); if (id != null) { NoteSend noteSend = noteSendManager.getById(Integer.parseInt(id)); getRequest().setAttribute("noteSend", noteSend); } return EDIT_JSP; }
/** 执行搜索 */ public String list() { // NoteSendQuery query = newQuery(NoteSendQuery.class,DEFAULT_SORT_COLUMNS); NoteSendQuery query = newQuery(NoteSendQuery.class, DEFAULT_SORT_COLUMNS); query.setCid(getMySession().getUser().getId()); Page page = noteSendManager.findPage(query); savePage(page, query); return LIST_JSP; }
/** 保存新增对象 */ public String save() { try { String[] sendids = sendid.split(","); String[] sendnames = sendname.split(","); // 发件人存档 noteSend.setCid(getMySession().getUser().getId()); noteSend.setCdate(new Date()); noteSend.setRecipient("【发送】" + sendname); noteSend.setSendid(sendid); noteSend.setNotestatus("nosee"); noteSend.setType(0); noteSend.setUuid(UUID.randomUUID().toString()); noteSendManager.save(noteSend); noteSend.setUrl("/pages/NoteSend/showNoteReceiveView.do?id=" + noteSend.getId()); // 收件人存档 for (int i = 0; i < sendids.length; i++) { NoteReceive noteReceive = new NoteReceive(); noteReceive.setCid(getMySession().getUser().getId()); noteReceive.setCdate(new Date()); noteReceive.setRecipient(sendnames[i]); noteReceive.setSendid(sendids[i]); noteReceive.setFromid(noteSend.getId()); noteReceive.setNotestatus("nosee"); noteReceive.setUuid(UUID.randomUUID().toString()); noteReceive.setMessage(noteSend.getMessage()); noteReceive.setType(0); noteReceive.setMsgTxt(noteSend.getMessage()); noteReceiveManager.save(noteReceive); noteReceive.setUrl( "/pages/NoteSend/showNoteReceiveView.do?id=" + noteReceive.getId() + "&uuid=" + noteReceive.getUuid()); noteReceiveManager.saveOrUpdate(noteReceive); } showMessage2("发送短信成功!", "/pages/NoteSend/list.do"); } catch (Exception e) { // TODO: handle exception. showMessage2("发送短信失败!", "/pages/NoteSend/list.do"); } return LIST_ACTION; }
/** 保存更新对象 */ public String update() { noteSendManager.update(this.noteSend); Flash.current().success(UPDATE_SUCCESS); return LIST_ACTION; }