Exemple #1
0
  @Override
  @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
  public void deleteMessageReceives(Set<Integer> receives) throws LogicException {
    for (Integer id : receives) {
      MessageReceive receive = loadMessageReceive(id);
      super.doAuthencation(UserContext.getUser(), receive.getReceiver());

      messageReceiveDao.deleteById(id);

      if (!receive.getIsRead()) {
        addCount(receive.getReceiver(), -1);
      }
    }
  }
Exemple #2
0
  @Override
  @Transactional(readOnly = true)
  public MessageReceive getMessageReceive(Integer id) throws LogicException {
    MessageReceive receive = loadMessageReceive(id);
    super.doAuthencation(UserContext.getUser(), receive.getReceiver());

    cleanMessageDetail(receive.getMessage().getDetail());

    return receive;
  }
Exemple #3
0
  @Override
  @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
  public void updateMessageRecieveStatus(Set<Integer> receives, MessageStatus status)
      throws LogicException {
    for (Integer id : receives) {
      MessageReceive receive = loadMessageReceive(id);
      super.doAuthencation(UserContext.getUser(), receive.getReceiver());

      if (!receive.getStatus().equals(status)) {
        receive.setStatus(status);
        messageReceiveDao.update(receive);
      }
    }
  }
Exemple #4
0
  @Override
  @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
  public void updateIsRead(Set<Integer> receives, boolean isRead) throws LogicException {
    for (Integer id : receives) {
      MessageReceive receive = loadMessageReceive(id);
      super.doAuthencation(UserContext.getUser(), receive.getReceiver());

      boolean _isRead = receive.getIsRead();

      if (!Boolean.valueOf(receive.getIsRead()).equals(isRead)) {
        receive.setIsRead(isRead);
        messageReceiveDao.update(receive);
      }

      if (!_isRead && isRead) {
        addCount(receive.getReceiver(), -1);
      }

      if (_isRead && !isRead) {
        addCount(receive.getReceiver(), 1);
      }
    }
  }