diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/ChannelController.java b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/ChannelController.java index d7d3bd5a6..2a9a09f71 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/ChannelController.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/ChannelController.java @@ -518,4 +518,6 @@ public class ChannelController { return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null); } } + + } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/GroupMapper.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/GroupMapper.java index 365d2f9f8..81a7721cc 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/GroupMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/GroupMapper.java @@ -314,7 +314,8 @@ public interface GroupMapper { " SUM(CASE WHEN coalesce( wdc.gb_status, wdc.status) = 'ON' THEN 1 ELSE 0 END) AS onlineCount" + " FROM " + " wvp_device_channel wdc " + - " where coalesce( wdc.gb_parent_id, wdc.parent_id) in " + + " where wdc.channel_type = 0 AND wdc.data_type != 2 AND (wdc.gb_ptz_type is null || ( wdc.gb_ptz_type != 98 && wdc.gb_ptz_type != 99)) " + + " AND coalesce( wdc.gb_parent_id, wdc.parent_id) in " + " #{item.deviceId}" + " GROUP BY coalesce(wdc.gb_parent_id, wdc.parent_id)" + "") diff --git a/src/main/java/com/genersoft/iot/vmp/web/custom/conf/CachedBodyHttpServletRequest.java b/src/main/java/com/genersoft/iot/vmp/web/custom/conf/CachedBodyHttpServletRequest.java index 824745cda..a952d2f0c 100644 --- a/src/main/java/com/genersoft/iot/vmp/web/custom/conf/CachedBodyHttpServletRequest.java +++ b/src/main/java/com/genersoft/iot/vmp/web/custom/conf/CachedBodyHttpServletRequest.java @@ -121,3 +121,4 @@ public class CachedBodyHttpServletRequest extends HttpServletRequestWrapper { } } + diff --git a/src/main/resources/配置详情.yml b/src/main/resources/配置详情.yml index 22868f195..f9ae606a0 100644 --- a/src/main/resources/配置详情.yml +++ b/src/main/resources/配置详情.yml @@ -139,6 +139,10 @@ jt1078: #[可选] 设备鉴权的密码 password: admin123 +sy: + enable: false + # 云台控制开始到结束的时间间隔(毫秒) + ptz-control-time-interval: 300 #zlm 默认服务器配置 media: diff --git a/web/src/views/common/MapComponent.vue b/web/src/views/common/MapComponent.vue index a0c505aca..0e882355d 100755 --- a/web/src/views/common/MapComponent.vue +++ b/web/src/views/common/MapComponent.vue @@ -148,50 +148,82 @@ export default { this.$emit('zoomChange', olMap.getView().getZoom()) }) }, - addVectorTileLayer(tileUrl){ + addVectorTileLayer(tileUrl, clickEvent, errorEvent){ let source = new VectorTileSource({ - format: new MVT(), url: tileUrl }) + let layer = new VectorTileLayer({ source: source, - style: { - // 必须提供 style 配置,可以是对象或函数 - 'circle-radius': 4, - 'circle-fill-color': 'red', - 'circle-stroke-color': 'white', - 'circle-stroke-width': 0.5 - // 'icon-src': 'static/images/gis/sprite.png', - // 'icon-width': 120, - // 'icon-height': 40, - // 'icon-size': [40, 40], - // 'icon-anchor': [0.5, 1], - // 'icon-offset-origin': 'bottom-left', - // 'icon-offset': [ - // 'match', - // ['get', 'status'], - // 'ON', - // [0, 0], - // 'OFF', - // [40, 0], - // 'checked', - // [80, 0], - // [120, 60] - // ] + style: function(feature) { + let status = feature.properties_.gbStatus + if (status === 'ON') { + return new Style({ + image: new Icon({ + anchor: [0.5, 1], + crossOrigin: 'Anonymous', + src: 'static/images/gis/camera1.png', + opacity: 1 + }) + }) + }else if (status === 'OFF'){ + return new Style({ + image: new Icon({ + anchor: [0.5, 1], + crossOrigin: 'Anonymous', + src: 'static/images/gis/camera1-offline.png', + opacity: 1 + }) + }) + } } + // style: { + // // 必须提供 style 配置,可以是对象或函数 + // 'circle-radius': 4, + // 'circle-fill-color': 'red', + // 'circle-stroke-color': 'white', + // 'circle-stroke-width': 0.5 + // // 'icon-src': 'static/images/gis/sprite.png', + // // 'icon-width': 120, + // // 'icon-height': 40, + // // 'icon-size': [40, 40], + // // 'icon-anchor': [0.5, 1], + // // 'icon-offset-origin': 'bottom-left', + // // 'icon-offset': [ + // // 'match', + // // ['get', 'status'], + // // 'ON', + // // [0, 0], + // // 'OFF', + // // [40, 0], + // // 'checked', + // // [80, 0], + // // [120, 60] + // // ] + // } }) olMap.addLayer(layer) - layer.on('click', (event) => { - console.log(event) - if (event.features.length > 0) { - const items = [] - for (let i = 0; i < event.features.length; i++) { - items.push(event.features[i].customData) + if (clickEvent) { + layer.on('click', (event) => { + console.log(event) + if (event.features.length > 0) { + const items = [] + for (let i = 0; i < event.features.length; i++) { + items.push(event.features[i].properties_) + } + clickEvent(items) } - console.log(items) - } - }) + }) + } + if (errorEvent) { + source.on('tileloaderror', (event) => { + console.log(event) + errorEvent(event) + }) + } + + return layer }, setCenter(point) { @@ -708,6 +740,9 @@ export default { source.clear(true) olMap.removeLayer(vectorLayer) }) + }, + getCoordSys(){ + return this.mapTileList[this.mapTileIndex].coordinateSystem } } } diff --git a/web/src/views/common/MapComponent_bak.vue b/web/src/views/common/MapComponent_bak.vue new file mode 100755 index 000000000..738d224dc --- /dev/null +++ b/web/src/views/common/MapComponent_bak.vue @@ -0,0 +1,807 @@ + + + + + diff --git a/web/src/views/map/index.vue b/web/src/views/map/index.vue index 2af411763..6b10e2b99 100755 --- a/web/src/views/map/index.vue +++ b/web/src/views/map/index.vue @@ -830,8 +830,28 @@ export default { }) }, addVectorTileLayer() { - let tileUrl = 'http://192.168.1.3:18080/api/common/channel/map/tile/{z}/{x}/{y}?geoCoordSys=GCJ02' - this.$refs.mapComponent.addVectorTileLayer(tileUrl) + let geoCoordSys = this.$refs.mapComponent.getCoordSys() + const baseUrl = window.baseUrl ? window.baseUrl : '' + let tileUrl = ((process.env.NODE_ENV === 'development') ? process.env.VUE_APP_BASE_API : baseUrl) + + `/api/common/channel/map/tile/{z}/{x}/{y}?geoCoordSys=${geoCoordSys}&accessToken=${this.$store.getters.token}` + + let clientEvent = data => { + this.closeInfoBox() + this.$nextTick(() => { + this.showChannelInfo(data[0]) + // if (data[0].edit) { + // this.showEditInfo(data[0]) + // }else { + // this.showChannelInfo(data[0]) + // } + }) + } + + let tileEvent = error => { + console.log(error) + } + + let tileLayer = this.$refs.mapComponent.addVectorTileLayer(tileUrl, clientEvent, tileEvent) } }