From 7bdf147a26675542054563a5727977c54cfda9ef Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期四, 13 二月 2025 14:19:53 +0800
Subject: [PATCH] 实现功能:远程模块remote接收通信中间件消息,补全取水口名称(编号)后,通过websocket向前端推送。

---
 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/msCenter/CenterMsReceiveCtrl.java |   34 +++++++++++++++++++++++++---------
 1 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/msCenter/CenterMsReceiveCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/msCenter/CenterMsReceiveCtrl.java
index f4705ec..839d8f0 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/msCenter/CenterMsReceiveCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/msCenter/CenterMsReceiveCtrl.java
@@ -3,19 +3,20 @@
 import com.alibaba.fastjson2.JSONObject;
 import com.dy.common.contant.Constant;
 import com.dy.common.multiDataSource.DataSourceContext;
+import com.dy.common.util.NumUtil;
 import com.dy.common.webUtil.BaseResponse;
+import com.dy.pipIrrRemote.largeScreen.WebSocketServer;
 import io.swagger.v3.oas.annotations.Hidden;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import jakarta.servlet.http.HttpServletRequest;
 import jakarta.servlet.http.HttpServletResponse;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
-
-import java.util.Iterator;
 import java.util.List;
 
 /**
@@ -29,6 +30,9 @@
 @RestController
 @RequestMapping(path="msCenter")
 public class CenterMsReceiveCtrl{
+
+    @Autowired
+    private CenterMsReceiveSv sv ;
 
     /**
      * 閫氫俊涓棿娑堟伅涓績鎺ㄩ�佹秷鎭帴鏀�
@@ -45,14 +49,26 @@
         if(list != null && list.size() > 0){
             for (JSONObject jo : list) {
                 if(jo != null){
-                    log.info("----------------start " + token + " 娑堟伅鏁版嵁--------------") ;
-                    Iterator<String> it = jo.keySet().iterator() ;
-                    String key ;
-                    while (it.hasNext()){
-                        key = it.next() ;
-                        log.info(key + "锛�" + jo.get(key));
+                    if(jo.containsKey("intakeId")){
+                        Object intakeIdObj = jo.get("intakeId") ;
+                        Long intakeId = null ;
+                        if(intakeIdObj != null && intakeIdObj instanceof Long){
+                            intakeId = (Long) intakeIdObj ;
+                        }else if(intakeIdObj != null && intakeIdObj instanceof String){
+                            if(NumUtil.isPlusIntNumber(intakeIdObj.toString())){
+                                intakeId = Long.parseLong(intakeIdObj.toString()) ;
+                            }
+                        }
+                        if(intakeId != null){
+                            String intakeNum = this.sv.selectIntakeName(intakeId) ;
+                            jo.put("intakeNum", intakeNum) ;
+                        }
                     }
-                    log.info("----------------end " + token + " 娑堟伅鏁版嵁--------------") ;
+                    try {
+                        WebSocketServer.sendAllMessage(jo.toJSONString());
+                    }catch (Exception e){
+                        log.error("鎺ㄩ�佹秷鎭け璐�", e) ;
+                    }
                 }
             }
         }

--
Gitblit v1.8.0