| | |
| | | package com.whyc.webSocket; |
| | | |
| | | import com.whyc.config.WebSocketConfig; |
| | | import com.whyc.dto.Page; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.dto.RtstateDto; |
| | | import com.whyc.service.A200RealstateService; |
| | | import com.whyc.service.ActmRealstateService; |
| | | import com.whyc.service.BattRtdataService; |
| | | import com.whyc.service.DevInfService; |
| | | import com.whyc.service.WorkstateChangeeventService; |
| | | import com.whyc.util.ActionUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.servlet.http.HttpSession; |
| | | import javax.websocket.*; |
| | | import javax.websocket.server.ServerEndpoint; |
| | | import java.util.HashMap; |
| | |
| | | |
| | | private static ActmRealstateService actmService; |
| | | |
| | | private static WorkstateChangeeventService eventService; |
| | | |
| | | |
| | | private volatile boolean runFlag = true; |
| | | |
| | |
| | | @Autowired |
| | | public void setActmRealstateService(ActmRealstateService actmService) { |
| | | DevRtstateSocket.actmService = actmService; |
| | | } |
| | | |
| | | @Autowired |
| | | public void setWorkstateChangeeventService(WorkstateChangeeventService eventService) { |
| | | DevRtstateSocket.eventService = eventService; |
| | | } |
| | | |
| | | @OnOpen |
| | |
| | | private Response getActmState(int devId) { |
| | | Map<String, Response> map = new HashMap<>(); |
| | | Response resActmState=actmService.getActmState(devId); |
| | | Response rtdataState=rtdataService.getRtdataState(devId); |
| | | Response rtdataState0=rtdataService.getActmRtdataState(devId,0); |
| | | Response rtdataState1=rtdataService.getActmRtdataState(devId,1); |
| | | Response event=eventService.getWorkEvent(devId); |
| | | map.put("resActmState",resActmState); |
| | | map.put("rtdataState",rtdataState); |
| | | map.put("rtdataState0",rtdataState0); |
| | | map.put("rtdataState1",rtdataState1); |
| | | map.put("event",event); |
| | | return new Response().setII(1,true,map,"均衡仪Actm实时数据"); |
| | | } |
| | | |
| | |
| | | private Response getA200State(int devId) { |
| | | Map<String, Response> map = new HashMap<>(); |
| | | Response resA200State=a200Service.getA200State(devId); |
| | | Response rtdataState=rtdataService.getRtdataState(devId); |
| | | Response rtdataState=rtdataService.getA200RtdataState(devId); |
| | | Response event=eventService.getWorkEvent(devId); |
| | | map.put("resA200State",resA200State); |
| | | map.put("rtdataState",rtdataState); |
| | | map.put("event",event); |
| | | return new Response().setII(1,true,map,"一体机A200实时数据"); |
| | | } |
| | | |