From e3bdcdf9123bb69d77ce42dfcd255047c09edafc Mon Sep 17 00:00:00 2001
From: czt <czt18638530771@163.com>
Date: 星期日, 11 一月 2026 16:53:04 +0800
Subject: [PATCH] 出入库视频及车牌识别

---
 fzzy-igdss-core/src/main/java/com/fzzy/igds/service/GatewaySerService.java |   27 +++++++++
 fzzy-igdss-web/src/main/resources/static/common/constant.js                |    3 
 fzzy-igdss-web/src/main/java/com/fzzy/common/manager/CommonManager.java    |   15 +++++
 fzzy-igdss-web/src/main/resources/static/inout/video-play.js               |   50 +++++++---------
 fzzy-igdss-web/src/main/java/com/fzzy/inout/InoutController.java           |    7 ++
 fzzy-igdss-web/src/main/resources/static/inout/inout-weight2.js            |   14 ++++
 fzzy-igdss-web/src/main/resources/static/inout/inout-register.js           |   18 ++++-
 fzzy-igdss-web/src/main/resources/templates/inout/weight.html              |    2 
 fzzy-igdss-web/src/main/resources/templates/inout/register.html            |    2 
 fzzy-igdss-web/src/main/resources/templates/inout/weight2.html             |    2 
 fzzy-igdss-web/src/main/resources/static/inout/inout-weight.js             |   15 ++++-
 11 files changed, 117 insertions(+), 38 deletions(-)

diff --git a/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/GatewaySerService.java b/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/GatewaySerService.java
index 835baad..aaeaa6e 100644
--- a/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/GatewaySerService.java
+++ b/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/GatewaySerService.java
@@ -165,6 +165,33 @@
     /**
      * 鏍规嵁鍒嗘満ID鑾峰彇鍒嗘満淇℃伅
      *
+     * @param deptId
+     * @return
+     */
+    public GatewaySer getCacheSerByDeptId(String deptId) {
+        if (StringUtils.isEmpty(deptId)) {
+            return null;
+        }
+
+        String patten = RedisConst.buildKey(ContextUtil.getCompanyId(), RedisConst.KEY_GATEWAY_SER_LIST) + "*";
+        Collection<String> keys = redisCache.keys(patten);
+        if (null == keys) {
+            return null;
+        }
+
+        GatewaySer ser = null;
+        for (String key : keys) {
+            ser = (GatewaySer) redisCache.getCacheObject(key);
+            if(deptId.equals(ser.getDeptId())){
+                return ser;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * 鏍规嵁鍒嗘満ID鑾峰彇鍒嗘満淇℃伅
+     *
      * @param companyId
      * @param id
      * @return
diff --git a/fzzy-igdss-web/src/main/java/com/fzzy/common/manager/CommonManager.java b/fzzy-igdss-web/src/main/java/com/fzzy/common/manager/CommonManager.java
index 97ca6be..cc00fcc 100644
--- a/fzzy-igdss-web/src/main/java/com/fzzy/common/manager/CommonManager.java
+++ b/fzzy-igdss-web/src/main/java/com/fzzy/common/manager/CommonManager.java
@@ -59,6 +59,21 @@
     private EventInfoService eventInfoService;
     @Resource
     private SnapRecordService snapRecordService;
+    @Resource
+    private GatewaySerService gatewaySerService;
+
+    /**
+     * 鏍规嵁搴撳尯缂栫爜鑾峰彇搴撳尯缃戝叧淇℃伅
+     * @param deptId
+     * @return
+     */
+    public GatewaySer getGatewaySerByDeptId(String deptId) {
+        if(StringUtils.isBlank(deptId)){
+            deptId = ContextUtil.subDeptId(null);
+        }
+
+        return gatewaySerService.getCacheSerByDeptId(deptId);
+    }
 
     /**
      * 鏍规嵁搴撳尯缂栫爜鑾峰彇搴撳尯涓嬫墍鏈変粨搴撳垪琛�
diff --git a/fzzy-igdss-web/src/main/java/com/fzzy/inout/InoutController.java b/fzzy-igdss-web/src/main/java/com/fzzy/inout/InoutController.java
index be31851..fedf4cd 100644
--- a/fzzy-igdss-web/src/main/java/com/fzzy/inout/InoutController.java
+++ b/fzzy-igdss-web/src/main/java/com/fzzy/inout/InoutController.java
@@ -92,6 +92,10 @@
         InoutConf conf = inoutManager.getInoutConf(listInoutConf, sort, Constant.CONF_TYPE_10, Constant.PROGRESS_REGISTER, 1);
         view.put("lprDto", conf);
 
+        //搴撳尯缃戝叧淇℃伅
+        GatewaySer gatewaySer = commonManager.getGatewaySerByDeptId(deptId);
+        view.put("gatewaySer", gatewaySer);
+
         return prefix + "/register";
     }
 
@@ -278,6 +282,9 @@
         view.put("endTime", DateFormatUtils.format(new Date(), "yyyy-MM-dd"));
         view.put("startTime", DateFormatUtils.format(DateUtil.getNewByDay(null, -30), "yyyy-MM-dd"));
 
+        //搴撳尯缃戝叧淇℃伅
+        GatewaySer gatewaySer = commonManager.getGatewaySerByDeptId(deptId);
+        view.put("gatewaySer", gatewaySer);
 
         String viewStr = prefix + "/weight";
         if ("1".equals(viewTag)) {
diff --git a/fzzy-igdss-web/src/main/resources/static/common/constant.js b/fzzy-igdss-web/src/main/resources/static/common/constant.js
index 039a366..9742c8f 100644
--- a/fzzy-igdss-web/src/main/resources/static/common/constant.js
+++ b/fzzy-igdss-web/src/main/resources/static/common/constant.js
@@ -79,8 +79,7 @@
 //鎽勫儚澶存挱鏀炬柟寮�
 var PlayType = {
     VLC: "VLC", //鏈湴锛讹棘锛f彃浠�
-    PLAY_TYPE_WEB_RTC_DH: "WEB_RTC_DH", //WEB-RTC-澶у崕
-    PLAY_TYPE_WEB_RTC_HIK: "WEB_RTC_HIK", //WEB-RTC-娴峰悍
+    PLAY_TYPE_WEB_RTC: "WEB_RTC", //WEB-RTC-澶у崕
     FZZY_GB: "FZZY_GB",//FZZY娴佸獟浣撴挱鏀�
     EASY_GBS: "EASY_GBS",//fzzy-easy娴佸獟浣撴挱鏀�
     EASY_DSS: "EASY_DSS",//钀ょ煶浜戞挱鏀�
diff --git a/fzzy-igdss-web/src/main/resources/static/inout/inout-register.js b/fzzy-igdss-web/src/main/resources/static/inout/inout-register.js
index 7144648..3ecc099 100644
--- a/fzzy-igdss-web/src/main/resources/static/inout/inout-register.js
+++ b/fzzy-igdss-web/src/main/resources/static/inout/inout-register.js
@@ -130,11 +130,16 @@
  * 璇诲彇杞︾墝鍙�
  */
 function flushPlateNum() {
+    if (!gatewaySer) {
+        layer.msg("鏈幏鍙栧埌搴撳尯缃戝叧淇℃伅锛岃溅鐗岃鍙栧け璐ワ紒");
+        return;
+    }
+    var url = "http://" + gatewaySer.ip + ":" + gatewaySer.apiPort + gatewaySer.plateNumUrl;
     var param = JSON.stringify(lprDto);
     var index = layer.load();
     $.ajax({
         type: "POST",
-        url: "/inout/api/get-plateNum",
+        url: url,
         dataType: "json",
         contentType: "application/json;charset=UTF-8",
         data: param,
@@ -191,13 +196,18 @@
         progress: progress,
         bizType: type,
         plateNum: data.plateNum,
-        id1: (null != lprDto) ? lprDto.id : null,
-        id2: (null != lprDto) ? lprDto.id : null,
+        id1: (null != lprDto) ? lprDto.id : null
     };
+    if (!gatewaySer) {
+        layer.msg("鏈幏鍙栧埌搴撳尯缃戝叧淇℃伅锛屾姄鍥惧け璐ワ紒");
+        submitData(data);
+        return;
+    }
+    var url = "http://" + gatewaySer.ip + ":" + gatewaySer.apiPort + gatewaySer.snapUrl;
     $.ajax({
         sync: false,
         type: "POST",
-        url: "../../inout/api/snap-img",
+        url: url,
         dataType: "json",
         contentType: "application/json;charset=UTF-8",
         data: JSON.stringify(snapData),
diff --git a/fzzy-igdss-web/src/main/resources/static/inout/inout-weight.js b/fzzy-igdss-web/src/main/resources/static/inout/inout-weight.js
index 77d367e..d7906d8 100644
--- a/fzzy-igdss-web/src/main/resources/static/inout/inout-weight.js
+++ b/fzzy-igdss-web/src/main/resources/static/inout/inout-weight.js
@@ -99,13 +99,17 @@
         id3: snapDto3.id,
         sort: $("#scaleName").val()
     };
-
+    if (!gatewaySer) {
+        layer.msg("鏈幏鍙栧埌搴撳尯缃戝叧淇℃伅锛屾姄鍥惧け璐ワ紒");
+        return;
+    }
+    var url = "http://" + gatewaySer.ip + ":" + gatewaySer.apiPort + gatewaySer.snapUrl;
     //褰撳墠AJAX鏈嶅姟涓哄悓姝ユ湇鍔★紝杩斿洖鏁版嵁鍖呰鐓х墖淇℃伅
     var index = layer.load();
     $.ajax({
         sync: false,
         type: "POST",
-        url: "/inout/api/snap-img",
+        url: url,
         dataType: "json",
         contentType: "application/json;charset=UTF-8",
         data: JSON.stringify(snapData),
@@ -309,11 +313,16 @@
  * 璇诲彇杞︾墝鍙�
  */
 function flushPlateNum() {
+    if (!gatewaySer) {
+        layer.msg("鏈幏鍙栧埌搴撳尯缃戝叧淇℃伅锛岃溅鐗岃鍙栧け璐ワ紒");
+        return;
+    }
+    var url = "http://" + gatewaySer.ip + ":" + gatewaySer.apiPort + gatewaySer.plateNumUrl;
     var param = JSON.stringify(snapDto1);
     var index = layer.load();
     $.ajax({
         type: "POST",
-        url: "/inout/api/get-plateNum",
+        url: url,
         dataType: "json",
         contentType: "application/json;charset=UTF-8",
         data: param,
diff --git a/fzzy-igdss-web/src/main/resources/static/inout/inout-weight2.js b/fzzy-igdss-web/src/main/resources/static/inout/inout-weight2.js
index 2f4c536..5814b78 100644
--- a/fzzy-igdss-web/src/main/resources/static/inout/inout-weight2.js
+++ b/fzzy-igdss-web/src/main/resources/static/inout/inout-weight2.js
@@ -486,13 +486,18 @@
         id3: snapDto3.id,
         sort: $("#scaleName").val()
     };
+    if (!gatewaySer) {
+        layer.msg("鏈幏鍙栧埌搴撳尯缃戝叧淇℃伅锛屾姄鍥惧け璐ワ紒");
+        return;
+    }
+    var url = "http://" + gatewaySer.ip + ":" + gatewaySer.apiPort + gatewaySer.snapUrl;
 
     //褰撳墠AJAX鏈嶅姟涓哄悓姝ユ湇鍔★紝杩斿洖鏁版嵁鍖呰鐓х墖淇℃伅
     var index = layer.load();
     $.ajax({
         sync: false,
         type: "POST",
-        url: "/inout/api/snap-img",
+        url: url,
         dataType: "json",
         contentType: "application/json;charset=UTF-8",
         data: JSON.stringify(snapData),
@@ -671,11 +676,16 @@
  * 璇诲彇杞︾墝鍙�
  */
 function flushPlateNum() {
+    if (!gatewaySer) {
+        layer.msg("鏈幏鍙栧埌搴撳尯缃戝叧淇℃伅锛岃溅鐗岃鍙栧け璐ワ紒");
+        return;
+    }
+    var url = "http://" + gatewaySer.ip + ":" + gatewaySer.apiPort + gatewaySer.plateNumUrl;
     var param = JSON.stringify(snapDto1);
     var index = layer.load();
     $.ajax({
         type: "POST",
-        url: "/inout/api/get-plateNum",
+        url: url,
         dataType: "json",
         contentType: "application/json;charset=UTF-8",
         data: param,
diff --git a/fzzy-igdss-web/src/main/resources/static/inout/video-play.js b/fzzy-igdss-web/src/main/resources/static/inout/video-play.js
index 3a37c09..42f96a1 100644
--- a/fzzy-igdss-web/src/main/resources/static/inout/video-play.js
+++ b/fzzy-igdss-web/src/main/resources/static/inout/video-play.js
@@ -7,6 +7,7 @@
 let mediaStream2;
 let webrtc3;
 let mediaStream3;
+
 /**
  * 椤甸潰鏈�澶氬悓鏃惰皟鐢ㄤ笁涓棰戯紝涓�涓溅鐗岃瘑鍒紝鎶撴媿锛屼笁涓『搴忔墽琛�
  * @param lprParam 杞︾墝璇嗗埆鍙傛暟
@@ -15,11 +16,17 @@
  */
 function initVideo(snapParam1, snapParam2, snapPram3) {
 
+    if (!gatewaySer) {
+        layer.msg("鏈幏鍙栧埌搴撳尯缃戝叧淇℃伅锛岃棰戞挱鏀惧け璐ワ紒");
+        initVideo2(snapParam2, snapPram3);
+        return;
+    }
+    var url = "http://" + gatewaySer.ip + ":" + gatewaySer.apiPort + gatewaySer.playUrl;
     //杞︾墝璇嗗埆鎾斁
     if (snapParam1) {
         $.ajax({
             type: "POST",
-            url: "../../inout/api/inout-video-play",
+            url: url,
             dataType: "json",
             contentType: "application/json;charset=UTF-8",
             data: JSON.stringify(snapParam1),
@@ -44,10 +51,16 @@
 }
 
 function initVideo2(snapParam2, snapParam3) {
+    if (!gatewaySer) {
+        layer.msg("鏈幏鍙栧埌搴撳尯缃戝叧淇℃伅锛岃棰戞挱鏀惧け璐ワ紒");
+        initVideo3(snapParam3)
+        return;
+    }
+    var url = "http://" + gatewaySer.ip + ":" + gatewaySer.apiPort + gatewaySer.playUrl;
     if (snapParam2) {
         $.ajax({
             type: "POST",
-            url: "../../inout/api/inout-video-play",
+            url: url,
             dataType: "json",
             contentType: "application/json;charset=UTF-8",
             data: JSON.stringify(snapParam2),
@@ -72,10 +85,15 @@
 }
 
 function initVideo3(snapParam3) {
+    if (!gatewaySer) {
+        layer.msg("鏈幏鍙栧埌搴撳尯缃戝叧淇℃伅锛岃棰戞挱鏀惧け璐ワ紒");
+        return;
+    }
     if (!snapParam3) return;
+    var url = "http://" + gatewaySer.ip + ":" + gatewaySer.apiPort + gatewaySer.playUrl;
     $.ajax({
         type: "POST",
-        url: "../../inout/api/inout-video-play",
+        url: url,
         dataType: "json",
         contentType: "application/json;charset=UTF-8",
         data: JSON.stringify(snapParam3),
@@ -100,31 +118,9 @@
  */
 function initSnapVideo(data, order) {
     var htm = "";
-    //娴峰悍web4.0鎾斁
-    if (PlayType.HIK_WEB4 == data.playType) {
-        var url = "../../inout/api/iframe-hik?id=" + data.id;
-        if (ship && ship == "ship") { //鑸硅繍绉伴噸椤甸潰
-            url += "&length=340&width=195";
-        } else { //绉伴噸椤甸潰
-            url += "&length=310&width=170";
-        }
-        htm = '<iframe src=' + url + ' style="width: 100%;height: 100%"></iframe>';
-    }
-    //VLC鎾斁
-    if (PlayType.VLC == data.playType) {
-        htm = "<object type='application/x-vlc-plugin' "
-            + "events='true' width='100%' height='100%'"
-            + "pluginspage='http://www.videolan.org'"
-            + "th:codebase='@{../../static/plugins/vlc/npapi-vlc-2.2.2.tar.xz}'>\n"
-            + "<param name='mrl' value='" + data.playUrl + "'/>\n"
-            + "<param name='volume' value='50'/>\n"
-            + "<param name='autoplay' value='true'/>\n"
-            + "<param name='loop' value='false'/>\n"
-            + "<param name='fullscreen' value='true'/>\n"
-            + "<param name='toolbar' value='false'/>\n" + "</object>";
-    }
+
     //web-rtc鎾斁鏂瑰紡
-    if (PlayType.PLAY_TYPE_WEB_RTC_DH == data.playType || PlayType.PLAY_TYPE_WEB_RTC_HIK == data.playType) {
+    if (PlayType.PLAY_TYPE_WEB_RTC == data.playType) {
         playUrl = data.playUrl;
         playNum = order;
         videoId = data.cameraId;
diff --git a/fzzy-igdss-web/src/main/resources/templates/inout/register.html b/fzzy-igdss-web/src/main/resources/templates/inout/register.html
index 7804f6d..2bbd76c 100644
--- a/fzzy-igdss-web/src/main/resources/templates/inout/register.html
+++ b/fzzy-igdss-web/src/main/resources/templates/inout/register.html
@@ -326,6 +326,8 @@
     var companyId = [[${loginUser.companyId}]];
     //杞︾墝璇嗗埆
     var lprDto = [[${lprDto}]];
+    //缃戝叧淇℃伅
+    var gatewaySer = [[${gatewaySer}]];
 </script>
 
 <script th:src="@{/ajax/libs/layui/layui.js}"></script>
diff --git a/fzzy-igdss-web/src/main/resources/templates/inout/weight.html b/fzzy-igdss-web/src/main/resources/templates/inout/weight.html
index 6616e31..afafc0a 100644
--- a/fzzy-igdss-web/src/main/resources/templates/inout/weight.html
+++ b/fzzy-igdss-web/src/main/resources/templates/inout/weight.html
@@ -679,6 +679,8 @@
     var snapDto1 = [[${snapDto1}]];
     var snapDto2 = [[${snapDto2}]];
     var snapDto3 = [[${snapDto3}]];
+    //缃戝叧淇℃伅
+    var gatewaySer = [[${gatewaySer}]];
 
 </script>
 
diff --git a/fzzy-igdss-web/src/main/resources/templates/inout/weight2.html b/fzzy-igdss-web/src/main/resources/templates/inout/weight2.html
index 249fd31..3566325 100644
--- a/fzzy-igdss-web/src/main/resources/templates/inout/weight2.html
+++ b/fzzy-igdss-web/src/main/resources/templates/inout/weight2.html
@@ -333,6 +333,8 @@
     var snapDto1 = [[${snapDto1}]];
     var snapDto2 = [[${snapDto2}]];
     var snapDto3 = [[${snapDto3}]];
+    //缃戝叧淇℃伅
+    var gatewaySer = [[${gatewaySer}]];
     //榛樿鏌ヨ鏃堕棿
     var startTime = [[${startTime}]];
     var endTime = [[${endTime}]];

--
Gitblit v1.9.3