whyclxw
2025-05-28 e16302f9d475c7cc4dd18c5abf1a23cb5502e362
src/main/java/com/whyc/webSocket/BattAlarmDataSocket.java
@@ -3,6 +3,7 @@
import com.whyc.config.WebSocketConfig;
import com.whyc.dto.Response;
import com.whyc.dto.paramter.AlarmPar;
import com.whyc.service.BattAlarmDataVerifyService;
import com.whyc.service.BattalarmDataService;
import com.whyc.util.ActionUtil;
import org.springframework.beans.factory.annotation.Autowired;
@@ -29,15 +30,20 @@
    private static BattalarmDataService service;
    private static BattAlarmDataVerifyService verifyService;
    private Session session;
    private HttpSession httpSession;
    private String lang;
    @Autowired
    public void setService(BattalarmDataService service) {
        BattAlarmDataSocket.service = service;
    }
    @Autowired
    public void setVerifyService(BattAlarmDataVerifyService verifyService) {
        BattAlarmDataSocket.verifyService = verifyService;
    }
    @OnOpen
@@ -49,7 +55,7 @@
    @OnMessage
    public synchronized void onMessage(Session session, String message) {
        AlarmPar alarmPar = ActionUtil.getGson().fromJson(message, AlarmPar.class);
        this.lang = (String) this.httpSession.getAttribute("lang");
        String lang = (String) this.httpSession.getAttribute("lang");
        thread = new Thread("Thread_battAlarmData") {
            @Override
            public void run() {
@@ -68,6 +74,9 @@
                        //查询分级告警的个数
                        Response levelRes = service.serchByLevel(alarmPar.getUId());
                        res.put("levelRes", levelRes);
                        //告警手动确认
                        Response verifyListRes = verifyService.getPageOfWebSocket(alarmPar,lang);
                        res.put("verifyListRes",verifyListRes);
                        if (session.isOpen()) {
                            //推送信息
                            synchronized (session) {