| | |
| | | package com.whyc.webSocket; |
| | | |
| | | import com.whyc.config.WebSocketConfig; |
| | | import com.whyc.dto.Page; |
| | | import com.whyc.dto.DevInfDto; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.db_user.UserInf; |
| | | import com.whyc.service.DevInfService; |
| | | import com.whyc.util.ActionUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | } |
| | | @OnMessage |
| | | public void onMessage(Session session, String message) { |
| | | Page page= ActionUtil.getGson().fromJson(message,Page.class); |
| | | //UserInf user = (UserInf) this.httpSession.getAttribute("user"); |
| | | //final int userId = user.getUid(); |
| | | final int userId = 101; |
| | | DevInfDto devInfDto = ActionUtil.getGson("yyyy-MM-dd").fromJson(message, DevInfDto.class); |
| | | UserInf user = (UserInf) this.httpSession.getAttribute("user"); |
| | | final int userId = user.getUid(); |
| | | //final int userId = 101; |
| | | thread = new Thread("Thread_DinfSocket") { |
| | | @Override |
| | | public void run() { |
| | |
| | | Thread thread = currentThread(); |
| | | threadFlagMap.put(thread.getId(), true); |
| | | try { |
| | | Response res=dinfService.getAllInf(userId,page); |
| | | Response res=dinfService.getAllInf(userId, devInfDto); |
| | | if (session.isOpen()) { |
| | | //推送信息 |
| | | synchronized (session) { |