Package com.jeecms.cms.entity.assist

Examples of com.jeecms.cms.entity.assist.CmsMessage


    }
    WebErrors errors = validateCaptcha(captcha, request, response);
    if (errors.hasErrors()) {
      return FrontUtils.showError(request, response, model, errors);
    }
    CmsMessage message = messageMng.findById(id);
    message.setMsgBox(1);
    message.setSendTime(new Date());
    messageMng.update(message);
    Set<CmsReceiverMessage> receiverMessageSet = message.getReceiverMsgs();
    Iterator<CmsReceiverMessage> it = receiverMessageSet.iterator();
    CmsReceiverMessage receiverMessage;
    while (it.hasNext()) {
      receiverMessage = it.next();
      receiverMessage.setMsgBox(0);
      receiverMessage.setSendTime(new Date());
      receiverMessage.setMessage(message);
      // 接收端(有一定冗余)
      receiverMessageMng.update(receiverMessage);
    }
    log.info("member CmsMessage save CmsMessage success. id={}", message
        .getId());
    return FrontUtils.showSuccess(request, model, nextUrl);
  }
View Full Code Here


      return FrontUtils.showMessage(request, model, "member.memberClose");
    }
    if (user == null) {
      return FrontUtils.showLogin(request, model, site);
    }
    CmsMessage message = messageMng.findById(id);
    // 非发件人无权查看信件
    if (!message.getMsgSendUser().equals(user)) {
      WebErrors errors = WebErrors.create(request);
      errors.addErrorCode("error.noPermissionsView");
      return FrontUtils.showError(request, response, model, errors);
    }
    model.addAttribute("message", message);
View Full Code Here

                id);
      }
      model.addAttribute("message", message);
    } else {
      // 阅读已发信
      CmsMessage msg = messageMng.findById(id);
      model.addAttribute("message", msg);
    }
    model.addAttribute("box", box);
    return FrontUtils.getTplPath(request, site.getSolutionPath(),
        TPLDIR_MESSAGE, MESSAGE_READ);
View Full Code Here

    }
    if (user == null) {
      return FrontUtils.showLogin(request, model, site);
    }
    CmsReceiverMessage receiverMessage = receiverMessageMng.findById(id);
    CmsMessage message;
    if (receiverMessage != null) {
      model.addAttribute("message", receiverMessage);
    } else {
      message = messageMng.findById(id);
      model.addAttribute("message", message);
View Full Code Here

  @RequestMapping(value = "/member/message_trash.jspx")
  public void message_trash(Integer ids[], HttpServletRequest request,
      HttpServletResponse response, ModelMap model) throws JSONException {
    CmsUser user = CmsUtils.getUser(request);
    JSONObject object = new JSONObject();
    CmsMessage message;
    CmsReceiverMessage receiverMessage;
    if (user == null) {
      object.put("result", false);
    } else {
      Iterator<CmsReceiverMessage> it;
      for (Integer i = 0; i < ids.length; i++) {
        message = messageMng.findById(ids[i]);
        receiverMessage = receiverMessageMng.findById(ids[i]);
        if (message != null && message.getMsgSendUser().equals(user)) {
          message.setMsgBox(3);
          receiverMessage = new CmsReceiverMessage();
          receiverMessage.setMsgBox(3);
          receiverMessage.setMsgContent(message.getMsgContent());
          receiverMessage.setMsgSendUser(message.getMsgSendUser());
          receiverMessage.setMsgReceiverUser(user);
          receiverMessage.setMsgStatus(message.getMsgStatus());
          receiverMessage.setMsgTitle(message.getMsgTitle());
          receiverMessage.setSendTime(message.getSendTime());
          receiverMessage.setSite(message.getSite());
          receiverMessage.setMessage(null);
          // 接收端(有一定冗余)
          receiverMessageMng.save(receiverMessage);
          // 清空该发件对应的收件关联关系
          Set<CmsReceiverMessage> receiverMessages = message
              .getReceiverMsgs();
          if (receiverMessages != null && receiverMessages.size() > 0) {
            it = receiverMessages.iterator();
            CmsReceiverMessage tempReceiverMessage;
            while (it.hasNext()) {
View Full Code Here

  @RequestMapping(value = "/member/message_empty.jspx")
  public void message_empty(Integer ids[], HttpServletRequest request,
      HttpServletResponse response, ModelMap model) throws JSONException {
    CmsUser user = CmsUtils.getUser(request);
    JSONObject object = new JSONObject();
    CmsMessage message;
    CmsReceiverMessage receiverMessage;
    if (user == null) {
      object.put("result", false);
    } else {
      for (Integer i = 0; i < ids.length; i++) {
        // 清空收到的站内信
        receiverMessage = receiverMessageMng.findById(ids[i]);
        if (receiverMessage != null
            && receiverMessage.getMsgReceiverUser().equals(user)) {
          receiverMessageMng.deleteById(ids[i]);
        } else {
          // 清空发送的站内信
          message = receiverMessage.getMessage();
          if (receiverMessage.getMsgBox().equals(3)) {
            // 草稿直接删除
            receiverMessage.setMessage(null);
            if (message != null) {
              messageMng.deleteById(message.getId());
            }
          } else {
            // 非草稿删除和主表的关联
            receiverMessage.setMessage(null);
          }
          if (message != null
              && message.getMsgSendUser().equals(user)) {
            messageMng.deleteById(message.getId());
          }
        }
        log.info("member CmsMessage empty CmsMessage success. id={}",
            ids[i]);
      }
View Full Code Here

      return FrontUtils.showMessage(request, model, "member.memberClose");
    }
    if (user == null) {
      return FrontUtils.showLogin(request, model, site);
    }
    CmsMessage message;
    Boolean permission = true;
    if (ids != null && ids.length > 0) {
      for (Integer i = 0; i < ids.length; i++) {
        message = messageMng.findById(ids[i]);
        // 非收件人和发件人无权查看信件
        if (!message.getMsgReceiverUser().equals(user)
            && !message.getMsgSendUser().equals(user)) {
          permission = false;
        }
      }
      if (permission) {
        messageMng.deleteByIds(ids);
View Full Code Here

    }
    // 按会员组推送站内信
    if (groupId != null && !groupId.equals(-1)) {
      List<CmsUser> users;
      CmsUser tempUser;
      CmsMessage tempMsg;
      CmsReceiverMessage tempReceiverMsg;
      if (groupId.equals(0)) {
        // 所有未禁用会员
        users = userMng.getList(null, null, null, null, false, false,null);
        if (users != null && users.size() > 0) {
          for (int i = 0; i < users.size(); i++) {
            tempUser = users.get(i);
            tempMsg = new CmsMessage();
            tempMsg.setMsgTitle(message.getMsgTitle());
            tempMsg.setMsgContent(message.getMsgContent());
            tempReceiverMsg = new CmsReceiverMessage();
            if (msgReceiverUser != null) {
              if (!tempUser.equals(msgReceiverUser)) {
                messageInfoSet(tempMsg, tempReceiverMsg, user,
                    tempUser, now, site, request);
              }
            } else {
              messageInfoSet(tempMsg, tempReceiverMsg, user,
                  tempUser, now, site, request);
            }
          }
        }
      } else {
        // 非禁用的会员
        users = userMng.getList(null, null, null, groupId, false,
            false, null);
        if (users != null && users.size() > 0) {
          for (int i = 0; i < users.size(); i++) {
            tempUser = users.get(i);
            tempMsg = new CmsMessage();
            tempMsg.setMsgTitle(message.getMsgTitle());
            tempMsg.setMsgContent(message.getMsgContent());
            tempReceiverMsg = new CmsReceiverMessage();
            if (msgReceiverUser != null) {
              if (!tempUser.equals(msgReceiverUser)) {
                messageInfoSet(tempMsg, tempReceiverMsg, user,
                    tempUser, now, site, request);
View Full Code Here

  @RequestMapping("/message/v_tosend.do")
  public String message_tosend(Integer id, Integer pageNo, String title,
      Date sendBeginTime, Date sendEndTime, Boolean status, Integer box,
      ModelMap model, HttpServletRequest request,
      HttpServletResponse response) {
    CmsMessage message = messageMng.findById(id);
    message.setMsgBox(1);
    message.setSendTime(new Date());
    messageMng.update(message);
    Set<CmsReceiverMessage> receiverMessageSet = message.getReceiverMsgs();
    Iterator<CmsReceiverMessage> it = receiverMessageSet.iterator();
    CmsReceiverMessage receiverMessage;
    while (it.hasNext()) {
      receiverMessage = it.next();
      receiverMessage.setMsgBox(0);
      receiverMessage.setSendTime(new Date());
      receiverMessage.setMessage(message);
      // 接收端(有一定冗余)
      receiverMessageMng.update(receiverMessage);
    }
    log.info("member CmsMessage send CmsMessage success. id={}", message
        .getId());
    cmsLogMng.operating(request, "cmsMessage.log.send", "id="
        + message.getId() + ";title=" + message.getMsgTitle());
    return list(pageNo, title, sendBeginTime, sendEndTime, status, 1,
        request, response, model);
  }
View Full Code Here

  public String edit(Integer id, HttpServletRequest request, ModelMap model) {
    WebErrors errors = validateEdit(id, request);
    if (errors.hasErrors()) {
      return errors.showErrorPage(model);
    }
    CmsMessage message = messageMng.findById(id);
    model.addAttribute("message", message);
    return "message/edit";
  }
View Full Code Here

TOP

Related Classes of com.jeecms.cms.entity.assist.CmsMessage

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.