Package com.jeecms.cms.entity.assist

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


      Boolean status, Integer box, ModelMap model,
      HttpServletRequest request, HttpServletResponse response) {
    CmsSite site = CmsUtils.getSite(request);
    CmsUser user = CmsUtils.getUser(request);
    Date now = new Date();
    CmsReceiverMessage receiverMessage = new CmsReceiverMessage();
    CmsUser msgReceiverUser = userMng.findByUsername(username);
    if (msgReceiverUser != null) {
      messageInfoSet(message, receiverMessage, user, msgReceiverUser,
          now, site, request);
    }
    // 按会员组推送站内信
    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


    // 作为草稿和发件箱的区别
    message.setSendTime(null);
    // message.setSendTime(new Date());
    message.setSite(site);
    messageMng.save(message);
    CmsReceiverMessage receiverMessage = new CmsReceiverMessage(message);
    receiverMessage.setMsgBox(2);
    receiverMessage.setMessage(message);
    // 接收端(有一定冗余)
    receiverMessageMng.save(receiverMessage);
    cmsLogMng.operating(request, "cmsMessage.log.save", "id="
        + message.getId() + ";title=" + message.getMsgTitle());
    return list(pageNo, title, sendBeginTime, sendEndTime, status, 2,
View Full Code Here

    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());
View Full Code Here

      HttpServletResponse response) {
    message = messageMng.update(message);
    // 更新发送表的信息,收件表的信息同步更新
    Set<CmsReceiverMessage> receiverMessageSet = message.getReceiverMsgs();
    Iterator<CmsReceiverMessage> it = receiverMessageSet.iterator();
    CmsReceiverMessage receiverMessage;
    while (it.hasNext()) {
      receiverMessage = it.next();
      receiverMessage.setMsgContent(message.getContentHtml());
      receiverMessage.setMsgReceiverUser(message.getMsgReceiverUser());
      receiverMessage.setMsgTitle(message.getMsgTitle());
      receiverMessage.setMessage(message);
      // 接收端(有一定冗余)
      receiverMessageMng.update(receiverMessage);
    }
    log.info("member CmsMessage update CmsMessage success. id={}", message
        .getId());
View Full Code Here

  @RequestMapping("/message/v_read.do")
  public String read(Integer id, Integer box, HttpServletRequest request,
      ModelMap model) {

    CmsUser user = CmsUtils.getUser(request);
    CmsReceiverMessage message = receiverMessageMng.findById(id);
    if (message != null) {
      // 阅读收信
      // 收件人查看更新已读状态
      if (message.getMsgReceiverUser().equals(user)) {
        message.setMsgStatus(true);
        receiverMessageMng.update(message);
      }
      model.addAttribute("message", message);
    } else {
      // 阅读已发信
View Full Code Here

    return "message/read";
  }

  @RequestMapping("/message/v_forward.do")
  public String forward(Integer id, HttpServletRequest request, ModelMap model) {
    CmsReceiverMessage receiverMessage = receiverMessageMng.findById(id);
    CmsMessage message;
    if (receiverMessage != null) {
      model.addAttribute("message", receiverMessage);
    } else {
      message = messageMng.findById(id);
View Full Code Here

    return "message/add";
  }
 
  @RequestMapping("/message/v_reply.do")
  public String reply(Integer id, HttpServletRequest request, ModelMap model) {
    CmsReceiverMessage receiverMessage = receiverMessageMng.findById(id);
    model.addAttribute("message", receiverMessage);
    List<CmsGroup> groups = groupMng.getList();
    model.addAttribute("groupList", groups);
    return "message/reply";
  }
View Full Code Here

  public void 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)) {
          // 清空发信表的同时复制该数据到收信表(收信人未空)
          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();
          CmsReceiverMessage tempReceiverMessage;
          if (receiverMessages != null && receiverMessages.size() > 0) {
            it = receiverMessages.iterator();
            while (it.hasNext()) {
              tempReceiverMessage= it.next();
              tempReceiverMessage.setMessage(null);
              receiverMessageMng.update(tempReceiverMessage);
            }
          }
          messageMng.deleteById(ids[i]);
          cmsLogMng.operating(request, "cmsMessage.log.trash", "id="
View Full Code Here

  @RequestMapping("/message/v_revert.do")
  public void revert(Integer ids[], HttpServletRequest request,
      HttpServletResponse response, ModelMap model) throws JSONException {
    CmsUser user = CmsUtils.getUser(request);
    JSONObject object = new JSONObject();
    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)) {
          receiverMessage.setMsgBox(0);
          receiverMessageMng.update(receiverMessage);
          cmsLogMng.operating(request, "cmsMessage.log.revert", "id="
              + receiverMessage.getId() + ";title=" + receiverMessage.getMsgTitle());
        }
        log.info("member CmsMessage revert CmsMessage success. id={}",
            ids[i]);
      }
      object.put("result", true);
View Full Code Here

  public void empty(Integer ids[], HttpServletRequest request,
      HttpServletResponse response, ModelMap model) throws JSONException {
    CmsUser user = CmsUtils.getUser(request);
    JSONObject object = new JSONObject();
    CmsMessage message = null;
    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(message==null){ message=messageMng.findById(ids[i]); }
           */
          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());
          }
View Full Code Here

TOP

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

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.