File was renamed from src/main/java/com/whyc/webSocket/DevRtStateSocket.java |
| | |
| | | |
| | | |
| | | /** |
| | | * 设备实时连接信息 |
| | | * 锂电设备实时连接信息 |
| | | */ |
| | | @Component |
| | | @ServerEndpoint(value = "/rtstateSocket",encoders = WebSocketEncoder.class,configurator = WebSocketConfig.class) |
| | | public class DevRtStateSocket { |
| | | @ServerEndpoint(value = "/DevLithiumRtState",encoders = WebSocketEncoder.class,configurator = WebSocketConfig.class) |
| | | public class DevLithiumRtStateSocket { |
| | | private Session session; |
| | | |
| | | private Thread thread; |
| | | |
| | | private static BattRtDataService rtdataService; |
| | | private static BattRtDataService battRtDataService; |
| | | |
| | | private static A200RealStateService a200Service; |
| | | private static A200RealStateService a200RtStateService; |
| | | |
| | | private static ActmRealStateService actmService; |
| | | private static ActmRealStateService actmRtStateService; |
| | | |
| | | private static WorkStateChangeEventService eventService; |
| | | |
| | |
| | | private volatile Map<Long,Boolean> threadFlagMap = new HashMap<>(); |
| | | |
| | | @Autowired |
| | | public void setBattRtdataService(BattRtDataService rtdataService) { |
| | | DevRtStateSocket.rtdataService = rtdataService; |
| | | public void setBattRtDataService(BattRtDataService battRtDataService) { |
| | | DevLithiumRtStateSocket.battRtDataService = battRtDataService; |
| | | } |
| | | |
| | | @Autowired |
| | | public void setA200RealstateService(A200RealStateService a200Service) { |
| | | DevRtStateSocket.a200Service = a200Service; |
| | | public void setA200RealStateService(A200RealStateService a200RtStateService) { |
| | | DevLithiumRtStateSocket.a200RtStateService = a200RtStateService; |
| | | } |
| | | |
| | | @Autowired |
| | | public void setActmRealstateService(ActmRealStateService actmService) { |
| | | DevRtStateSocket.actmService = actmService; |
| | | public void setActmRealStateService(ActmRealStateService actmRtStateService) { |
| | | DevLithiumRtStateSocket.actmRtStateService = actmRtStateService; |
| | | } |
| | | |
| | | @Autowired |
| | | public void setWorkstateChangeeventService(WorkStateChangeEventService eventService) { |
| | | DevRtStateSocket.eventService = eventService; |
| | | public void setWorkStateChangeEventService(WorkStateChangeEventService eventService) { |
| | | DevLithiumRtStateSocket.eventService = eventService; |
| | | } |
| | | |
| | | @OnOpen |
| | |
| | | @OnMessage |
| | | public void onMessage(Session session, String message) { |
| | | RtStateDto dto= ActionUtil.getGson().fromJson(message, RtStateDto.class); |
| | | thread = new Thread("Thread_RtstateSocket") { |
| | | thread = new Thread("DevLithiumRtStateSocket") { |
| | | @Override |
| | | public void run() { |
| | | while (runFlag && !isInterrupted()) { |
| | |
| | | //均衡仪Actm实时数据 |
| | | private Response getActmState(int devId) { |
| | | Map<String, Response> map = new HashMap<>(); |
| | | Response resActmState=actmService.getActmState(devId); |
| | | Response rtdataState0=rtdataService.getActmRtdataState(devId,0); |
| | | Response rtdataState1=rtdataService.getActmRtdataState(devId,1); |
| | | Response resActmState=actmRtStateService.getActmState(devId); |
| | | Response rtDataState0=battRtDataService.getActmRtdataState(devId,0); |
| | | Response rtDataState1=battRtDataService.getActmRtdataState(devId,1); |
| | | Response event=eventService.getWorkEvent(devId); |
| | | map.put("resActmState",resActmState); |
| | | map.put("rtdataState0",rtdataState0); |
| | | map.put("rtdataState1",rtdataState1); |
| | | map.put("rtDataState0",rtDataState0); |
| | | map.put("rtDataState1",rtDataState1); |
| | | map.put("event",event); |
| | | return new Response().setII(1,true,map,"均衡仪Actm实时数据"); |
| | | } |
| | |
| | | //一体机A200实时数据 |
| | | private Response getA200State(int devId) { |
| | | Map<String, Response> map = new HashMap<>(); |
| | | Response resA200State=a200Service.getA200State(devId); |
| | | Response rtdataState=rtdataService.getA200RtdataState(devId); |
| | | Response resA200State=a200RtStateService.getA200State(devId); |
| | | Response rtDataState=battRtDataService.getA200RtdataState(devId); |
| | | Response event=eventService.getWorkEvent(devId); |
| | | map.put("resA200State",resA200State); |
| | | map.put("rtdataState",rtdataState); |
| | | map.put("rtDataState",rtDataState); |
| | | map.put("event",event); |
| | | return new Response().setII(1,true,map,"一体机A200实时数据"); |
| | | } |