|
@@ -106,9 +106,13 @@ public class WebSocket {
|
|
|
switch (type) {
|
|
switch (type) {
|
|
|
case Constants.META_WEBSOCKET_NOTICE_EMAIL:
|
|
case Constants.META_WEBSOCKET_NOTICE_EMAIL:
|
|
|
log.info("查询邮件");
|
|
log.info("查询邮件");
|
|
|
- List<MetaEmail> metaEmails = queryEmail(Long.parseLong(userId));
|
|
|
|
|
- if (CollectionUtils.isNotEmpty(metaEmails)) {
|
|
|
|
|
- websocketCommon.sendMessageTo(clients, JSON.toJSONString(metaEmails), userId);
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ List<MetaEmail> metaEmails = queryEmail(Long.parseLong(userId));
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(metaEmails)) {
|
|
|
|
|
+ websocketCommon.sendMessageTo(clients, JSON.toJSONString(metaEmails), userId);
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error(String.format("查询邮件失败,错误信息[%S]", e.getMessage()));
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
case Constants.META_WEBSOCKET_NOTICE_EMAIL_READ:
|
|
case Constants.META_WEBSOCKET_NOTICE_EMAIL_READ:
|
|
@@ -165,13 +169,13 @@ public class WebSocket {
|
|
|
*/
|
|
*/
|
|
|
private List<MetaEmail> queryEmail(Long userId) {
|
|
private List<MetaEmail> queryEmail(Long userId) {
|
|
|
init();
|
|
init();
|
|
|
- List<Long> delIds = metaEmailRecordRepo.findIdByUserIdAndEmailDel(userId, true);
|
|
|
|
|
|
|
+ List<Long> delIds = metaEmailRecordRepo.findEmailIdByDel(userId, true);
|
|
|
List<MetaEmail> metaEmails;
|
|
List<MetaEmail> metaEmails;
|
|
|
- metaEmails = CollectionUtils.isEmpty(delIds) ? metaEmailRepo.findAll() : metaEmailRepo.findAllByIdNotIn(delIds);
|
|
|
|
|
|
|
+ metaEmails = CollectionUtils.isEmpty(delIds) ? metaEmailRepo.findAllByDel(false) : metaEmailRepo.findAllByDelAndIdNotIn(false, delIds);
|
|
|
if (CollectionUtils.isEmpty(metaEmails)) {
|
|
if (CollectionUtils.isEmpty(metaEmails)) {
|
|
|
return metaEmails;
|
|
return metaEmails;
|
|
|
}
|
|
}
|
|
|
- List<Long> readIds = metaEmailRecordRepo.findIdByUserIdAndEmailRead(userId, true);
|
|
|
|
|
|
|
+ List<Long> readIds = metaEmailRecordRepo.findEmailIdRead(userId, true);
|
|
|
if (CollectionUtils.isEmpty(readIds)) {
|
|
if (CollectionUtils.isEmpty(readIds)) {
|
|
|
return metaEmails;
|
|
return metaEmails;
|
|
|
}
|
|
}
|