| | |
| | | package com.ltkj.web.controller.system; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import cn.hutool.core.util.IdUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ltkj.common.core.domain.entity.SysUser; |
| | | import com.ltkj.common.core.domain.model.LoginUser; |
| | |
| | | import com.ltkj.hosp.domain.SysNoticeUser; |
| | | import com.ltkj.hosp.service.SysNoticeUserService; |
| | | import com.ltkj.system.service.ISysUserService; |
| | | import com.ltkj.web.websocket.ClientSessionInfo; |
| | | import com.ltkj.web.websocket.WebSockerManager; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | import com.ltkj.common.enums.BusinessType; |
| | | import com.ltkj.system.domain.SysNotice; |
| | | import com.ltkj.system.service.ISysNoticeService; |
| | | import org.springframework.web.socket.TextMessage; |
| | | import org.springframework.web.socket.WebSocketSession; |
| | | |
| | | /** |
| | | * 公告 信息操作处理 |
| | |
| | | private SysNoticeUserService sysNoticeUserService; |
| | | @Autowired |
| | | private ISysUserService userService; |
| | | @Autowired |
| | | private WebSockerManager webSockerManager; |
| | | |
| | | /** |
| | | * 获取通知公告列表 |
| | |
| | | sysNoticeUserService.save(user); |
| | | } |
| | | }else return AjaxResult.error(); |
| | | for (Map.Entry<String, ClientSessionInfo> entry : webSockerManager.userSessions.entrySet()) { |
| | | if (!notice.getUserIds().contains(entry.getKey())) continue; |
| | | WebSocketSession session = entry.getValue().getSession(); |
| | | try { |
| | | session.sendMessage(new TextMessage(JSONUtil.toJsonStr(notice))); |
| | | } catch (IOException ignored) { |
| | | } |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |