Exemplo n.º 1
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()));
    }
  }
Exemplo n.º 2
0
 public String list() throws Exception {
   Map<String, String> paramMap = new HashMap<String, String>();
   paramMap.put("msgTitle", msgTitle);
   paramMap.put("receiverName", receiverName);
   paramMap.put("senderName", senderName);
   paramMap.put("isRead", isRead);
   if ("1".equals(queryType)) {
     paramMap.put("senderId", Sessions.getSysUser().getId());
   } else {
     paramMap.put("receiverId", Sessions.getSysUser().getId());
   }
   page = intenalMessageService.findPage(page, paramMap);
   return LIST;
 }
Exemplo n.º 3
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;
 }