| | |
| | | import com.whyc.config.WebSocketConfig; |
| | | import com.whyc.dto.PageAlarm; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.db_abe_ram.AbeInf; |
| | | import com.whyc.pojo.db_abe_ram.AbeRam; |
| | | import com.whyc.pojo.db_abe_ram.AbeState; |
| | | import com.whyc.service.AbeInfService; |
| | | import com.whyc.service.AbeRamService; |
| | | import com.whyc.service.AbeStateService; |
| | | import com.whyc.service.BattStationTempAlarmService; |
| | |
| | | |
| | | private Thread thread; |
| | | |
| | | private static AbeInfService infService; |
| | | |
| | | private static AbeRamService ramService; |
| | | |
| | | private static AbeStateService stateService; |
| | |
| | | AbeStateSocket.stateService = stateService; |
| | | } |
| | | |
| | | @Autowired |
| | | public void setInfService(AbeInfService infService) { |
| | | AbeStateSocket.infService = infService; |
| | | } |
| | | |
| | | @OnOpen |
| | | public void onOpen(Session session, EndpointConfig config) { |
| | | this.session = session; |
| | |
| | | if (session.isOpen()) { |
| | | //推送信息 |
| | | synchronized (session) { |
| | | AbeInf inf = infService.get(); |
| | | Response<AbeState> state = stateService.get(); |
| | | Response<AbeRam> ram = ramService.get(); |
| | | Response<AbeRam> ram = ramService.get(inf.getAbeMonId()); |
| | | Map<String, Response> resMap = new HashMap<>(); |
| | | resMap.put("state",state); |
| | | resMap.put("ram",ram); |