sse实时开发 微修

This commit is contained in:
weixin_45799331
2026-01-28 12:11:50 +08:00
parent b0f2eabf6b
commit a6a4e0ed58
3 changed files with 13 additions and 5 deletions

View File

@@ -245,7 +245,7 @@ public class TriageQueueAppServiceImpl implements TriageQueueAppService {
selected.setStatus(STATUS_CALLING).setUpdateTime(LocalDateTime.now());
triageQueueItemService.updateById(selected);
// 叫号后推送 SSE 消息(实时通知显示屏刷新)
// 叫号后推送 SSE 消息(实时通知显示屏刷新)
pushDisplayUpdate(selected.getOrganizationId(), selected.getQueueDate(), selected.getTenantId());
return R.ok(true);
@@ -332,7 +332,7 @@ public class TriageQueueAppServiceImpl implements TriageQueueAppService {
recalcOrders(actualOrgId, null);
// 完成后推送 SSE 消息(实时通知显示屏刷新)
// 完成后推送 SSE 消息(实时通知显示屏刷新)
pushDisplayUpdate(actualOrgId, calling.getQueueDate(), tenantId);
return R.ok(true);

View File

@@ -16,7 +16,9 @@ import java.util.concurrent.CopyOnWriteArraySet;
@Component
public class CallNumberSseManager {
private static final long NO_TIMEOUT = 0L;
private static final long NO_TIMEOUT = 0L; // 0 表示“永不超时”
// 按科室分组保存连接消化内科有3个屏、心内科有2个屏
// 很多屏幕同时连、同时断。故用 ConcurrentHashMap 存储,线程安全。内部分段锁,不阻塞其他科室的操作。
private static final Map<Long, CopyOnWriteArraySet<SseEmitter>> emitterMap = new ConcurrentHashMap<>();
/**