Ejemplo n.º 1
0
  public void prepareRead() throws Exception {
    intenalMessage = intenalMessageService.get(id);

    // 获得附件
    setUploadFileList(getUploadFileService().findByOwnerId(intenalMessage.getId()));

    if ("0".equals(intenalMessage.getIsRead())) {
      intenalMessage.setIsRead("1"); // 已阅读
      intenalMessage.setReadTime(DateUtils.getCurrentDate());
      intenalMessageService.update(intenalMessage);
    }
  }
Ejemplo n.º 2
0
 /**
  * 定时检查是否有新消息
  *
  * @return
  * @throws Exception
  */
 @LoginValidation(validate = YN.N)
 public String getNewMessage() throws Exception {
   Map<String, String> paramMap = new HashMap<String, String>();
   paramMap.put("receiverId", Sessions.getSysUser().getId());
   paramMap.put("isRead", "0");
   List<OaIntenalMessage> list = intenalMessageService.findList(paramMap);
   if (list != null && list.size() > 0) {
     OaIntenalMessage omsg = list.get(0);
     Renders.renderJson(omsg.getId() + "|" + omsg.getMsgTitle());
   } else {
     Renders.renderJson("");
   }
   return NONE;
 }
Ejemplo n.º 3
0
  public void prepareModel() throws Exception {
    // 新增
    if (StringUtils.isEmpty(id)) {
      String[] receiverIdsa = receiverIds.split(",");
      if (receiverIdsa != null && receiverIdsa.length > 0) {
        SysUser receiver = null;
        for (String receiverId : receiverIdsa) {
          if (StringUtils.isNotEmpty(receiverId)) {
            receiver = userService.get(receiverId);
            intenalMessage = new OaIntenalMessage();
            intenalMessage.setIsRead("0"); // 0:未阅读,1:已阅读
            intenalMessage.setCreateTime(DateUtils.getCurrentDate());
            intenalMessage.setCreateUser(Sessions.getSysUser());
            intenalMessage.setSender(Sessions.getSysUser());
            intenalMessage.setSendTime(DateUtils.getCurrentDate());
            intenalMessage.setMsgTitle(msgTitle);
            intenalMessage.setMsgContent(msgContent);
            intenalMessage.setReceiver(receiver);

            iMsgList.add(intenalMessage);
          }
        }
      }
    } else { // 修改/查看
      intenalMessage = intenalMessageService.get(id);
      if ("2".equals(queryType) && "0".equals(intenalMessage.getIsRead())) {
        intenalMessage.setIsRead("1"); // 已阅读
        intenalMessage.setReadTime(DateUtils.getCurrentDate());
        intenalMessageService.update(intenalMessage);
      }

      // 获得附件
      setUploadFileList(getUploadFileService().findByOwnerId(intenalMessage.getId()));
    }
  }