File was renamed from src/main/java/com/whyc/websocket/CkDevRsAndRtAlmSocket.java |
| | |
| | | |
| | | import com.whyc.config.WebSocketConfig; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.db_ckpwrdev_data_rt.CKPowerDevHrTestParam; |
| | | import com.whyc.pojo.db_ckpwrdev_data_rt.CkpowerdevBattRsalarm; |
| | | import com.whyc.service.CKPowerDevHrTestParamService; |
| | | import com.whyc.service.CkpowerdevBattRsalarmService; |
| | | import com.whyc.service.CkpowerdevBattRsalarmSetService; |
| | | import com.whyc.service.CkpowerdevBattRtalarmService; |
| | | import com.whyc.service.CKPowerDevBattRsAlarmService; |
| | | import com.whyc.service.CKPowerDevBattRtAlarmService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | import javax.websocket.server.ServerEndpoint; |
| | | import java.io.IOException; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Component |
| | | @ServerEndpoint(value = "/ckDevRsAndRtAlm",encoders = WebSocketEncoder.class,configurator = WebSocketConfig.class) |
| | | public class CkDevRsAndRtAlmSocket { |
| | | public class CKDevRsAndRtAlmSocket { |
| | | |
| | | private Session session; |
| | | |
| | | private Thread thread; |
| | | |
| | | private static CkpowerdevBattRsalarmService rsalarmService; |
| | | private static CKPowerDevBattRsAlarmService rsAlarmService; |
| | | |
| | | private static CkpowerdevBattRtalarmService rtalarmService; |
| | | private static CKPowerDevBattRtAlarmService rtAlarmService; |
| | | |
| | | @Autowired |
| | | public void setCkpowerdevBattRsalarmService(CkpowerdevBattRsalarmService rsalarmService) { |
| | | CkDevRsAndRtAlmSocket.rsalarmService = rsalarmService; |
| | | public void setRsAlarmService(CKPowerDevBattRsAlarmService rsAlarmService) { |
| | | CKDevRsAndRtAlmSocket.rsAlarmService = rsAlarmService; |
| | | } |
| | | |
| | | @Autowired |
| | | public void setCkpowerdevBattRtalarmService(CkpowerdevBattRtalarmService rtalarmService) { |
| | | CkDevRsAndRtAlmSocket.rtalarmService = rtalarmService; |
| | | public void setRtAlarmService(CKPowerDevBattRtAlarmService rtAlarmService) { |
| | | CKDevRsAndRtAlmSocket.rtAlarmService = rtAlarmService; |
| | | } |
| | | |
| | | |
| | |
| | | try{ |
| | | while (!currentThread().isInterrupted()) { |
| | | Map<String,Object>map=new HashMap<>(); |
| | | Response rsAlmRes = rsalarmService.getRsAlm(); |
| | | Response rsAlmRes = rsAlarmService.getRsAlm(); |
| | | map.put("rsAlmRes",rsAlmRes); |
| | | Response rtAlmRes = rtalarmService.getRtAlm(); |
| | | Response rtAlmRes = rtAlarmService.getRtAlm(); |
| | | map.put("rtAlmRes",rtAlmRes); |
| | | session.getBasicRemote().sendObject(new Response<>().set(1,map,"查询完成")); |
| | | sleep(4000); |