shjung 2 年之前
父節點
當前提交
455409b171

+ 13 - 13
src/main/java/com/tsi/sig/server/controller/MainController.java

@@ -34,46 +34,46 @@ public class MainController {
 
     @RequestMapping(value="/error.do")
     public String error() throws Exception{
-        log.info("CALL.........................................: error");
+        //log.info("CALL.........................................: error");
         return "error";
     }
 
     @RequestMapping(value = "/main.do")
     public String main() throws Exception {
-        log.info("CALL.........................................: main");
+        //log.info("CALL.........................................: main");
         return "main";
     }
 
     @RequestMapping(value = "getBottomListFrame.do")
     public String getBottomListFrame() throws Exception {
-        log.info("CALL.........................................: getBottomListFrame");
+        //log.info("CALL.........................................: getBottomListFrame");
         return "bottomListFrame";
     }
 
     @RequestMapping(value = "getTreeListFrame.do")
     public String getTreeListFrame(Locale locale, Model model, HttpServletRequest request, HttpServletResponse response) throws Exception {
-        log.info("CALL.........................................: getTreeListFrame");
+        //log.info("CALL.........................................: getTreeListFrame");
         return "treeListFrame";
     }
 
     @RequestMapping(value = "/getIntTreeList.do", method = RequestMethod.POST)
     public @ResponseBody
     List<CvibNodeVO> getIntTreeList(Locale locale, Model model, HttpServletRequest request, HttpServletResponse response) throws Exception {
-        log.info("CALL.........................................: getIntTreeList");
+        //log.info("CALL.........................................: getIntTreeList");
         List<CvibNodeVO> nodes = mainService.getLodeList();
-        log.info("getIntTreeList: {}", nodes.toString());
+        //log.info("getIntTreeList: {}", nodes.toString());
         return nodes;
     }
 
     @RequestMapping(value = "/getSignalInfo.do", method = RequestMethod.POST)
     public @ResponseBody
     List<CvibNodeVO> getSignalInfo(Locale locale, Model model, HttpServletRequest request, HttpServletResponse response) throws Exception {
-        log.info("CALL.........................................: getSignalInfo");
+        //log.info("CALL.........................................: getSignalInfo");
 /*
-        log.info("minX: {}", request.getParameter("minX"));
-        log.info("minY: {}", request.getParameter("minY"));
-        log.info("maxX: {}", request.getParameter("maxX"));
-        log.info("maxY: {}", request.getParameter("maxY"));
+        //log.info("minX: {}", request.getParameter("minX"));
+        //log.info("minY: {}", request.getParameter("minY"));
+        //log.info("maxX: {}", request.getParameter("maxX"));
+        //log.info("maxY: {}", request.getParameter("maxY"));
 */
         HashMap<String, Object> paramMap = new HashMap<String, Object>();
         paramMap.put("minX", CommonUtil.checkNull(request.getParameter("minX")));
@@ -81,7 +81,7 @@ public class MainController {
         paramMap.put("maxX", CommonUtil.checkNull(request.getParameter("maxX")));
         paramMap.put("maxY", CommonUtil.checkNull(request.getParameter("maxY")));
         List<CvibNodeVO> nodes = mainService.getCvibMapNodeList(paramMap);
-        log.info("{} EA. {}", nodes.size(), nodes.toString());
+        //log.info("{} EA. {}", nodes.size(), nodes.toString());
         response.setContentType("application/json; charset=UTF-8");
 
         return nodes;
@@ -89,7 +89,7 @@ public class MainController {
 
     @RequestMapping(value = "cvibInfoDetail.do", method = RequestMethod.GET)
     public String cvibInfoDetail(@RequestParam("nodeId") String nodeId, Model model, HttpServletRequest request, HttpServletResponse response) throws Exception {
-        log.info("CALL.........................................: cvibInfoDetail");
+        //log.info("CALL.........................................: cvibInfoDetail");
         model.addAttribute("nodeId", nodeId);
         HashMap<String, Object> paramMap = new HashMap<String, Object>();
         paramMap.put("nodeId", nodeId);

+ 1 - 0
src/main/java/com/tsi/sig/server/vo/CvibNodeVO.java

@@ -14,5 +14,6 @@ public class CvibNodeVO {
     private String addr3;
     private String ipaddr;
     private int nodetype;
+    private String regionid;
 
 }

+ 10 - 10
src/main/java/com/tsi/sig/server/websocket/kafka/AllTopicConsumerThread.java

@@ -69,14 +69,14 @@ public class AllTopicConsumerThread implements Runnable {
         //int[]  light  	=  {1,2,3,1,2,3,1,2,3,1,2,3};		// 신호등정보 [직진,좌,보행]
         int[] dirAdd = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};            //연등지
 
-        int[] timeFlag = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};            //시간정보신뢰성
-        int[] walker = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};        //보행자
-        int[] unprotected = {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};            //비보호 상태
-        int[] stts = {3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};        //신호등상태
+        int[] timeFlag = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};                  //시간정보신뢰성
+        int[] walker = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};                    //보행자
+        int[] unprotected = {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};               //비보호 상태
+        int[] stts = {3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};                      //신호등상태
 
-        int[] dispTm = {30, 30, 20, 20, 20, 40, 40, 20, 10, 10, 01, 10, 10, 10, 10, 10};                        //표출시간
-        int[] remainTm = {0, 0, 0, 0, 0, 0, 0, 0, 20, 20, 5, 20, 0, 0, 0, 0};                    //잔여시간
-        int[] dirCode = {10, 10, 10, 10, 20, 20, 20, 20, 30, 30, 30, 30, 40, 40, 40, 40};                    //방향코드
+        int[] dispTm = {30, 30, 20, 20, 20, 40, 40, 20, 10, 10, 01, 10, 10, 10, 10, 10};    //표출시간
+        int[] remainTm = {0, 0, 0, 0, 0, 0, 0, 0, 20, 20, 5, 20, 0, 0, 0, 0};               //잔여시간
+        int[] dirCode = {10, 10, 10, 10, 20, 20, 20, 20, 30, 30, 30, 30, 40, 40, 40, 40};   //방향코드
 
         for (int ii = 0; ii < 16; ii++) {
             Map<String, Object> temp = new HashMap<>();
@@ -103,8 +103,8 @@ public class AllTopicConsumerThread implements Runnable {
         }
 
         int counter = value.get(39) & 0xff;
-        int sttsCount = value.get(40) & 0x7F;            //신호정보개수
-        int divFlag = (value.get(40) >> 7) & 0x01;    //분활flag
+        int sttsCount = value.get(40) & 0x7F;           //신호정보개수
+        int divFlag = (value.get(40) >> 7) & 0x01;      //분활flag
 
         int oprTrans = (value.get(37) >> 4) & 0x01;
         int oprInd = (value.get(37) >> 3) & 0x01;
@@ -209,7 +209,7 @@ public class AllTopicConsumerThread implements Runnable {
                             for (WebSocketSession session : this.sessionSet) {
                                 try {
                                     this.websocketHandler.sendMessage(session, new TextMessage(jsonInString));
-                                    log.info("AllTopicConsumerThread, Send to: {}, {}, {} bytes.", session.getRemoteAddress().getAddress(), record.key(), jsonInString.length());
+                                    //log.info("AllTopicConsumerThread, Send to: {}, {}, {} bytes.", session.getRemoteAddress().getAddress(), record.key(), jsonInString.length());
                                 }
                                 catch(Exception e) {
                                     log.error("AllTopicConsumerThread, Send Failed: {}, {}, {} bytes.", session, record.key(), jsonInString.length());

+ 2 - 2
src/main/resources/application.yml

@@ -58,12 +58,12 @@ spring:
   profiles: seoul
   datasource:
     mybatis:
-      jdbc-url: jdbc:mariadb://192.168.202.105:3306/cvim_db?characterEncoding=UTF-8&serverTimezone=UTC
+      jdbc-url: jdbc:mariadb://10.4.4.20:3306/cvim_db?characterEncoding=UTF-8&serverTimezone=UTC
 
 application:
   kafka:
     consumer:
-      bootstrap-servers: 192.168.202.105:9093
+      bootstrap-servers: 172.24.0.30:9092,172.24.0.31:9093,172.24.0.32:9094
 
 ---
 spring:

+ 1 - 1
src/main/resources/mybatis/mapper/main.xml

@@ -4,7 +4,7 @@
 <mapper namespace="com.tsi.sig.server.mapper.MainMapper">
 
 	<select id="getNodeList" resultType="com.tsi.sig.server.vo.CvibNodeVO">
-		SELECT nodeid as nodeid, name as name, FORMAT(latitude, 10) as lat, FORMAT(longitude, 9) as lng, addr1, addr2, addr3, addnode, ipaddr, nodetype
+		SELECT nodeid as nodeid, name as name, FORMAT(latitude, 10) as lat, FORMAT(longitude, 9) as lng, addr1, addr2, addr3, addnode, ipaddr, nodetype, region_id as regionid
           FROM tb_tsc_node
          WHERE useyn  = 'Y'
            AND nodeyn = 'Y'	

+ 7 - 15
src/main/resources/static/js/common/webSocket.js

@@ -33,12 +33,9 @@ function wsCloseConnection() {
 };
 
 function wsOnMessage(message) {
-    console.log('wsOnMessage!');
-    //console.log(_CvibNodeArr);
     //_CvibNodeArr = [];
     //if(_CvibNodeArr.length> 50)_CvibNodeArr=[];
     var recv = JSON.parse(message.data);
-
     recv.sort(dirCodeSort);
     //console.log(recv);
 
@@ -93,7 +90,6 @@ function wsOnMessage(message) {
                 continue;
             }
 
-
             //( recv[ii].light == 2 && recv[ii].stts == 3 && recv[ii].unprotected == 1 ) ? stts.push(1) : stts.push(recv[ii].stts);
             stts.push(recv[ii].stts)
             light.push(recv[ii].light);
@@ -105,14 +101,9 @@ function wsOnMessage(message) {
             remainTm.push(recv[ii].remainTm);
             dirCode.push(recv[ii].dirCode);
 
-
             cvibSttsArr[recv[ii].dirCode] = setCvibSttsFnc(recv[ii].unprotected, recv[ii].light, recv[ii].dirCode, recv[ii].stts, cvibSttsArr[recv[ii].dirCode]);
-            //console.log(cvibSttsArr);
-
-
         }
 
-
         for (var ii = 0; ii < signalArr.length; ii++) {
 
             if (recv[0].nodeId != signalArr[ii].nodeId) continue; //온 노드아이디랑 맵에있는 노드아이디랑 같은거만
@@ -122,9 +113,9 @@ function wsOnMessage(message) {
                     signalArr[ii].addr2, signalArr[ii].addr3, date, errCenter, errCont, errScu, oprBlink, oprInd, oprManual, oprTrans, oprTurnoff, dataCount, counter,
                     cvibSttsArr[10], cvibSttsArr[20], cvibSttsArr[30], cvibSttsArr[40], cvibSttsArr[50], cvibSttsArr[60], cvibSttsArr[70], cvibSttsArr[80],
                     light, dirAdd, timeFlag, walker, unprotected, stts, dispTm, remainTm, dirCode));
-            }else{//데이터가있으면
+            } else { //데이터가있으면
                 // 소켓으로온 데이터가 있으면 바꿔주고
-                var findFlag = _CvibNodeArr.find(function (el){
+                var findFlag = _CvibNodeArr.find(function (el) {
                     if(el.nodeId == recv[0].nodeId) return true;
                 });
                 if(findFlag){
@@ -158,7 +149,7 @@ function wsOnMessage(message) {
             _CvibNodeArr.forEach(function (el) {
                 for (var ii = 0; ii < signalArr.length; ii++) {
                     if(el.nodeId == signalArr[ii].nodeId){
-                        console.log(el.nodeId + " 셋팅");
+                        //console.log(el.nodeId + " 셋팅");
                         el.setCircle();
                         el.setCvibInfo();
                     }
@@ -223,17 +214,19 @@ function wsError(message) {
 	* 좌회전때 비보호가 1일때
  */
 function setCvibSttsFnc(unprotected, light, dirCode, stts, cvibStts) {
+    if (cvibStts === undefined || cvibStts != "") {
+        //TODO: 20230221
+        cvibStts = '9_9_9_9';
+    }
     if (light == '1') {
         var temp = cvibStts.substring(1);
         cvibStts = stts + temp;
-
     } else if (light == '2') {
         var tempS = cvibStts.substring(0, 2);
         var tempE = cvibStts.substring(3);
         //stts =(unprotected == 0) ? stts : 1;
         cvibStts = tempS + stts + tempE;
     } else if (light == '3') {
-
         var tempS = cvibStts.substring(0, 4);
         var tempE = cvibStts.substring(5);
         cvibStts = tempS + stts + tempE;
@@ -242,7 +235,6 @@ function setCvibSttsFnc(unprotected, light, dirCode, stts, cvibStts) {
         cvibStts = temp + stts;
     }
     return cvibStts;
-
 }
 
 function dirCodeSort(a, b) {

+ 2 - 2
src/main/webapp/WEB-INF/jsp/main.jsp

@@ -84,8 +84,8 @@
     <iframe src="/getTreeListFrame.do" id="iframeTreeList" class="iframeTreeList"></iframe>
     <div id="mapWrapper">
         <div id="map" class="map">
-            <div class="wideMap"><img alt="지도대축소" src="images/arrow_left.png"/></div>
-            <div class="upDownMap"><img alt="지도대축소" src="images/arrow_down.png"/></div>
+            <div class="wideMap"><img alt="지도대축소" src="images/arrow_left.png"/></div>
+            <div class="upDownMap"><img alt="지도대축소" src="images/arrow_down.png"/></div>
             <!-- 검색값-->
             <div class="bg_white" id="menu_wrap">
                 <div class="option">

+ 29 - 26
src/main/webapp/WEB-INF/jsp/treeListFrame.jsp

@@ -47,6 +47,28 @@
     var offlineCenterStatusData;
     var onlineIntStatusData;
     var offlineIntStatusData;
+    let _regionMap = new Map();
+
+    function setAddrMap(data) {
+        _regionMap.clear();
+        for (let ii = 0; ii < data.length; ii++) {
+            if (data[ii].addr1 == null || data[ii].addr1 == '-') {
+                continue;
+            }
+            _regionMap.set(data[ii].addr1, data[ii].regionid);
+        }
+    }
+
+    function getAddrSi() {
+        return Array.from(_regionMap.keys());
+    }
+    function getEngAddr(addr){
+        let region_id = _regionMap.get(addr);
+        if (region_id === null || region_id === undefined) {
+            return "U99"
+        }
+        return region_id;
+    }
 
     setTreeList();
     getIntTreeList();
@@ -58,19 +80,6 @@
     * 1 : 정상, 2: 교차로 시각 오류 0: 마지막통신 시간 3초이상 지연시
      */
     function controllerOnOffFuc() {
-        function getAddrSi() {
-            var arr = ["대구시","군포시"];
-            return arr;
-        }
-        function getEngAddr(addr){
-            if(addr == "대구시"){
-                return "daegu"
-            }
-            else if(addr == "군포시"){
-                return "gunpo";
-            }
-            return addr;
-        }
 
         var addrArr = getAddrSi();
 
@@ -83,7 +92,6 @@
             var nxtDate = moment(now.getTime()).add("30", "s").format("YYYY-MM-DD HH:mm:ss");
 
             window.parent._signalInfoArr.forEach(function (el) {
-
                 if (el.addr1 == addrArr[ll]) {
                     ctnlCount++;
                     if (el.commDate == null) {
@@ -252,18 +260,14 @@
         var nameCntOn;
         data.sort(nameSort);
 
-        function getengAddr(addr1) {
-            if(addr1 = "대구시"){
-                return "daegu"
-            }
-            else if(addr1 == "군포시"){
-                return "gunpo"
-            }
-            return addr1;
-        }
+        //TODO: 20230221
+        setAddrMap(data);
 
         for (var i = 0; i < data.length; i++) {
-            if (data[i].addr1 == null || data[i].addr1 == '-') continue;
+            if (data[i].addr1 == null || data[i].addr1 == '-') {
+                continue;
+            }
+
             nodeId = data[i].nodeid;
             name = data[i].name;
             lat = data[i].lat;
@@ -279,8 +283,7 @@
             //iframe이라서 직접 접근이 안됨
             window.parent._signalInfoArr.push(signal);
 
-            var engAddr = getengAddr(addr1);
-
+            var engAddr = getEngAddr(addr1);
 
             nameCntOn = '&nbsp;<strong class="centerNm_' + engAddr + '">' + addr1 + '</strong>&nbsp;( 전체 : <span class="intTotal" id="intTotal_'+engAddr+'" style="color:#0000FF"></span> / 이상 : '+
 					  '<span class="intErrCnt" id="intErrCnt_'+engAddr+'" style="color:#FF0000"></span> )';