|
@@ -2,7 +2,6 @@ package com.bosshand.virgo.message.service;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.bosshand.virgo.core.dao.MgrUserDao;
|
|
|
-import com.bosshand.virgo.core.model.MgrUser;
|
|
|
import com.bosshand.virgo.exception.ServiceException;
|
|
|
import com.bosshand.virgo.message.beetl.FlowMessageGenerator;
|
|
|
import com.bosshand.virgo.message.beetl.MessageGenerator;
|
|
@@ -46,14 +45,6 @@ public class MessageService {
|
|
|
@Autowired
|
|
|
private MgrUserDao mgrUserDao;
|
|
|
|
|
|
- private String getUserName(String userId) {
|
|
|
- MgrUser user = mgrUserDao.getById(Long.parseLong(userId));
|
|
|
- if (user != null) {
|
|
|
- return user.getName();
|
|
|
- }
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
public int insert(NotificationMessage notificationMessage) {
|
|
|
return notificationMessageDao.insert(notificationMessage);
|
|
|
}
|
|
@@ -63,41 +54,23 @@ public class MessageService {
|
|
|
}
|
|
|
|
|
|
public NotificationMessage get(long id) {
|
|
|
- NotificationMessage notificationMessage = notificationMessageDao.get(id);
|
|
|
- notificationMessage.setSendUserName(this.getUserName(notificationMessage.getSender()));
|
|
|
- return notificationMessage;
|
|
|
+ return notificationMessageDao.get(id);
|
|
|
}
|
|
|
|
|
|
public List<NotificationMessage> getMessageByUserId(long userId) {
|
|
|
- List<NotificationMessage> list = notificationMessageDao.getMessageByUserId(userId);
|
|
|
- for (NotificationMessage message : list) {
|
|
|
- message.setSendUserName(this.getUserName(message.getSender()));
|
|
|
- }
|
|
|
- return list;
|
|
|
+ return notificationMessageDao.getMessageByUserId(userId);
|
|
|
}
|
|
|
|
|
|
public List<NotificationMessage> getMessageByUserId(int messageType, long userId) {
|
|
|
- List<NotificationMessage> list = notificationMessageDao.getMessageByMessageType(messageType, userId);
|
|
|
- for (NotificationMessage message : list) {
|
|
|
- message.setSendUserName(this.getUserName(message.getSender()));
|
|
|
- }
|
|
|
- return list;
|
|
|
+ return notificationMessageDao.getMessageByMessageType(messageType, userId);
|
|
|
}
|
|
|
|
|
|
public List<NotificationMessage> count(int messageType, long userId, boolean viewed) {
|
|
|
- List<NotificationMessage> list = notificationMessageDao.count(messageType, userId, viewed);
|
|
|
- for (NotificationMessage message : list) {
|
|
|
- message.setSendUserName(this.getUserName(message.getSender()));
|
|
|
- }
|
|
|
- return list;
|
|
|
+ return notificationMessageDao.count(messageType, userId, viewed);
|
|
|
}
|
|
|
|
|
|
public List<NotificationMessage> getMessageByViewed(long userId, boolean viewed) {
|
|
|
- List<NotificationMessage> list = notificationMessageDao.getMessageByViewed(userId, viewed);
|
|
|
- for (NotificationMessage message : list) {
|
|
|
- message.setSendUserName(this.getUserName(message.getSender()));
|
|
|
- }
|
|
|
- return list;
|
|
|
+ return notificationMessageDao.getMessageByViewed(userId, viewed);
|
|
|
}
|
|
|
|
|
|
public void pushMessage(List<Long> receiptList, NotificationMessage message) throws ServiceException {
|