Package com.jeecms.cms.entity.assist

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


        receiverMessageMng.update(message);
      }
      model.addAttribute("message", message);
    } else {
      // 阅读已发信
      CmsMessage msg = messageMng.findById(id);
      model.addAttribute("message", msg);
    }
    model.addAttribute("box", box);
    return "message/read";
  }
View Full Code Here


  }

  @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);
      model.addAttribute("message", message);
View Full Code Here

  @RequestMapping("/message/v_trash.do")
  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="
              + message.getId() + ";title="
              + message.getMsgTitle());
        }
        if (receiverMessage != null
            && receiverMessage.getMsgReceiverUser().equals(user)) {
          receiverMessage.setMsgBox(3);
          receiverMessageMng.update(receiverMessage);
View Full Code Here

  @RequestMapping("/message/v_empty.do")
  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());
          }
          cmsLogMng.operating(request, "cmsMessage.log.empty", "id="
              + message.getId() + ";title="
              + message.getMsgTitle());
        }
        log.info("member CmsMessage empty CmsMessage success. id={}",
            ids[i]);
      }
      object.put("result", true);
View Full Code Here

  private boolean vldExist(Integer id, Integer siteId, WebErrors errors) {
    if (errors.ifNull(id, "id")) {
      return true;
    }
    CmsMessage entity = messageMng.findById(id);
    if (errors.ifNotExist(entity, CmsMessage.class, id)) {
      return true;
    }
    if (!entity.getSite().getId().equals(siteId)) {
      errors.notInSite(CmsMessage.class, id);
      return true;
    }
    return false;
  }
View Full Code Here

    getSession().update(bean);
    return bean;
  }

  public CmsMessage deleteById(Integer id) {
    CmsMessage entity = super.get(id);
    if (entity != null) {
      getSession().delete(entity);
    }
    return entity;
  }
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.