...websocket先收到消息?
This commit is contained in:
parent
4b99279d87
commit
544a673f2a
|
@ -31,6 +31,7 @@ import java.util.ArrayList;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
|
@ -141,16 +142,14 @@ public class SysNoticeServiceImpl extends CrudServiceImpl<SysNoticeDao, SysNotic
|
|||
|
||||
//全部用户
|
||||
if (notice.getReceiverType() == ReceiverTypeEnum.ALL.value()) {
|
||||
executor.execute(() -> {
|
||||
CompletableFuture.runAsync(() -> {
|
||||
//发送给全部用户
|
||||
sendAllUser(notice);
|
||||
});
|
||||
|
||||
executor.execute(() -> {
|
||||
}, executor).thenRunAsync(() -> {
|
||||
//通过WebSocket,提示全部用户,有新通知
|
||||
MessageData<String> message = new MessageData<String>().msg(notice.getTitle());
|
||||
webSocketServer.sendMessageAll(message);
|
||||
});
|
||||
}, executor);
|
||||
|
||||
} else { //选中用户
|
||||
List<Long> userIdList = new ArrayList<>();
|
||||
|
@ -167,16 +166,13 @@ public class SysNoticeServiceImpl extends CrudServiceImpl<SysNoticeDao, SysNotic
|
|||
}
|
||||
|
||||
List<Long> finalUserIdList = userIdList;
|
||||
executor.execute(() -> {
|
||||
//发送给选中用户
|
||||
CompletableFuture.runAsync(() -> {
|
||||
sendUser(notice, finalUserIdList);
|
||||
});
|
||||
|
||||
executor.execute(() -> {
|
||||
}, executor).thenRunAsync(() -> {
|
||||
//通过WebSocket,提示选中用户,有新通知
|
||||
MessageData<String> message = new MessageData<String>().msg(notice.getTitle());
|
||||
webSocketServer.sendMessage(finalUserIdList, message);
|
||||
});
|
||||
}, executor);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue