临时提交

This commit is contained in:
lin 2025-10-13 15:35:12 +08:00
parent efb39fc158
commit f724451058
7 changed files with 224 additions and 44 deletions

View File

@ -148,6 +148,8 @@ public class VideoManagerConstants {
public static final String VM_MSG_SUBSCRIBE_DEVICE_STATUS = "device"; public static final String VM_MSG_SUBSCRIBE_DEVICE_STATUS = "device";
//************************** 第三方 **************************************** //************************** 第三方 ****************************************
public static final String WVP_STREAM_GB_ID_PREFIX = "memberNo_"; public static final String WVP_STREAM_GB_ID_PREFIX = "memberNo_";

View File

@ -642,4 +642,6 @@ public interface CommonGBChannelMapper {
@SelectProvider(type = ChannelProvider.class, method = "queryListInPolygonForKingBase", databaseId = "postgresql") @SelectProvider(type = ChannelProvider.class, method = "queryListInPolygonForKingBase", databaseId = "postgresql")
List<CameraChannel> queryListInPolygon(@Param("pointList") List<Point> pointList, @Param("level") Integer level, @Param("groupList") List<CameraGroup> groupList); List<CameraChannel> queryListInPolygon(@Param("pointList") List<Point> pointList, @Param("level") Integer level, @Param("groupList") List<CameraGroup> groupList);
@SelectProvider(type = ChannelProvider.class, method = "queryListForSyMobile")
List<CameraChannel> queryListForSyMobile(@Param("business") String business);
} }

View File

@ -820,4 +820,9 @@ public class ChannelProvider {
sqlBuild.append(" )"); sqlBuild.append(" )");
return sqlBuild.toString() ; return sqlBuild.toString() ;
} }
public String queryListForSyMobile(Map<String, Object> params ){
return BASE_SQL_FOR_CAMERA_DEVICE +
" WHERE wdc.gb_ptz_type = 99 AND coalesce(gb_business_group_id, business_group_id) = #{business}";
}
} }

View File

@ -69,7 +69,7 @@ public class CameraChannelController {
@Parameter(name = "geoCoordSys", description = "坐标系类型WGS84,GCJ02、BD09") @Parameter(name = "geoCoordSys", description = "坐标系类型WGS84,GCJ02、BD09")
@Parameter(name = "status", description = "摄像头状态") @Parameter(name = "status", description = "摄像头状态")
public PageInfo<CameraChannel> queryListWithChild(@RequestParam(required = false, value = "page", defaultValue = "1" )Integer page, public PageInfo<CameraChannel> queryListWithChild(@RequestParam(required = false, value = "page", defaultValue = "1" )Integer page,
@RequestParam(required = false, value = "page", defaultValue = "100")Integer count, @RequestParam(required = false, value = "count", defaultValue = "100")Integer count,
@RequestParam(required = false) String query, @RequestParam(required = false) String query,
@RequestParam(required = false) String sortName, @RequestParam(required = false) String sortName,
@RequestParam(required = false) Boolean order, @RequestParam(required = false) Boolean order,
@ -262,10 +262,19 @@ public class CameraChannelController {
result.setResult(wvpResult); result.setResult(wvpResult);
}); });
return result; return result;
} }
@GetMapping(value = "/camera/list-for-mobile")
@ResponseBody
@Operation(summary = "查询移动设备摄像机列表", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "page", description = "当前页")
@Parameter(name = "count", description = "每页查询数量")
@Parameter(name = "topGroupAlias", description = "分组别名")
public PageInfo<CameraChannel> queryListForMobile(@RequestParam(required = false, value = "page", defaultValue = "1" )Integer page,
@RequestParam(required = false, value = "count", defaultValue = "100")Integer count,
String topGroupAlias){
return channelService.queryListForMobile(page, count, topGroupAlias);
}
} }

View File

@ -109,7 +109,7 @@ public class CameraChannelService implements CommandLineRunner {
public PageInfo<CameraChannel> queryList(Integer page, Integer count, String groupAlias, Boolean status, String geoCoordSys) { public PageInfo<CameraChannel> queryList(Integer page, Integer count, String groupAlias, Boolean status, String geoCoordSys) {
// 构建组织结构信息 // 构建组织结构信息
Group group = groupMapper.queryGroupByAlias(groupAlias); Group group = groupMapper.queryGroupByAlias(groupAlias);
Assert.notNull(group, "获取组织结构失败"); Assert.notNull(group, "组织结构不存在");
String groupDeviceId = group.getDeviceId(); String groupDeviceId = group.getDeviceId();
// 构建分页 // 构建分页
@ -125,7 +125,7 @@ public class CameraChannelService implements CommandLineRunner {
public PageInfo<CameraChannel> queryListWithChild(Integer page, Integer count, String query, String sortName, Boolean order, String groupAlias, Boolean status, String geoCoordSys) { public PageInfo<CameraChannel> queryListWithChild(Integer page, Integer count, String query, String sortName, Boolean order, String groupAlias, Boolean status, String geoCoordSys) {
// 构建组织结构信息 // 构建组织结构信息
CameraGroup group = groupMapper.queryGroupByAlias(groupAlias); CameraGroup group = groupMapper.queryGroupByAlias(groupAlias);
Assert.notNull(group, "获取组织结构失败"); Assert.notNull(group, "组织结构不存在");
String groupDeviceId = group.getDeviceId(); String groupDeviceId = group.getDeviceId();
// 获取所有子节点 // 获取所有子节点
List<CameraGroup> groupList = queryAllGroupChildren(group.getId(), group.getBusinessGroup()); List<CameraGroup> groupList = queryAllGroupChildren(group.getId(), group.getBusinessGroup());
@ -346,7 +346,7 @@ public class CameraChannelService implements CommandLineRunner {
public List<CameraChannel> queryListInBox(Double minLongitude, Double maxLongitude, Double minLatitude, Double maxLatitude, Integer level, String groupAlias, String geoCoordSys) { public List<CameraChannel> queryListInBox(Double minLongitude, Double maxLongitude, Double minLatitude, Double maxLatitude, Integer level, String groupAlias, String geoCoordSys) {
// 构建组织结构信息 // 构建组织结构信息
CameraGroup group = groupMapper.queryGroupByAlias(groupAlias); CameraGroup group = groupMapper.queryGroupByAlias(groupAlias);
Assert.notNull(group, "获取组织结构失败"); Assert.notNull(group, "组织结构不存在");
// 获取所有子节点 // 获取所有子节点
List<CameraGroup> groupList = queryAllGroupChildren(group.getId(), group.getBusinessGroup()); List<CameraGroup> groupList = queryAllGroupChildren(group.getId(), group.getBusinessGroup());
groupList.add(group); groupList.add(group);
@ -380,7 +380,7 @@ public class CameraChannelService implements CommandLineRunner {
public List<CameraChannel> queryListInCircle(Double centerLongitude, Double centerLatitude, Double radius, Integer level, String groupAlias, String geoCoordSys) { public List<CameraChannel> queryListInCircle(Double centerLongitude, Double centerLatitude, Double radius, Integer level, String groupAlias, String geoCoordSys) {
// 构建组织结构信息 // 构建组织结构信息
CameraGroup group = groupMapper.queryGroupByAlias(groupAlias); CameraGroup group = groupMapper.queryGroupByAlias(groupAlias);
Assert.notNull(group, "获取组织结构失败"); Assert.notNull(group, "组织结构不存在");
// 获取所有子节点 // 获取所有子节点
List<CameraGroup> groupList = queryAllGroupChildren(group.getId(), group.getBusinessGroup()); List<CameraGroup> groupList = queryAllGroupChildren(group.getId(), group.getBusinessGroup());
groupList.add(group); groupList.add(group);
@ -407,7 +407,7 @@ public class CameraChannelService implements CommandLineRunner {
public List<CameraChannel> queryListInPolygon(List<Point> pointList, String groupAlias, Integer level, String geoCoordSys) { public List<CameraChannel> queryListInPolygon(List<Point> pointList, String groupAlias, Integer level, String geoCoordSys) {
// 构建组织结构信息 // 构建组织结构信息
CameraGroup group = groupMapper.queryGroupByAlias(groupAlias); CameraGroup group = groupMapper.queryGroupByAlias(groupAlias);
Assert.notNull(group, "获取组织结构失败"); Assert.notNull(group, "组织结构不存在");
// 获取所有子节点 // 获取所有子节点
List<CameraGroup> groupList = queryAllGroupChildren(group.getId(), group.getBusinessGroup()); List<CameraGroup> groupList = queryAllGroupChildren(group.getId(), group.getBusinessGroup());
groupList.add(group); groupList.add(group);
@ -431,4 +431,19 @@ public class CameraChannelService implements CommandLineRunner {
List<CameraChannel> all = channelMapper.queryListInPolygon(pointList, level, groupList); List<CameraChannel> all = channelMapper.queryListInPolygon(pointList, level, groupList);
return addIconPathAndPositionForCameraChannelList(all, geoCoordSys); return addIconPathAndPositionForCameraChannelList(all, geoCoordSys);
} }
public PageInfo<CameraChannel> queryListForMobile(Integer page, Integer count, String topGroupAlias) {
CameraGroup cameraGroup = groupMapper.queryGroupByAlias(topGroupAlias);
Assert.notNull(cameraGroup, "组织结构不存在");
// 构建分页
PageHelper.startPage(page, count);
List<CameraChannel> all = channelMapper.queryListForSyMobile(cameraGroup.getDeviceId());
PageInfo<CameraChannel> groupPageInfo = new PageInfo<>(all);
List<CameraChannel> list = addIconPathAndPositionForCameraChannelList(groupPageInfo.getList(), null);
groupPageInfo.setList(list);
return groupPageInfo;
}
} }

View File

@ -138,6 +138,9 @@ export default {
features = {} features = {}
layer = {} layer = {}
}) })
olMap.getView().on('change:resolution', ()=> {
console.log(olMap.getView().getZoom())
})
}, },
setCenter(point) { setCenter(point) {
@ -250,9 +253,12 @@ export default {
* @param data * @param data
* @param clickEvent * @param clickEvent
*/ */
addPointLayer(data, clickEvent) { addPointLayer(data, clickEvent, option) {
console.log(option.minZoom + ' ========= ' + data.length)
if (data.length > 0) { if (data.length > 0) {
const features = [] const features = []
let maxZoom = option.maxZoom | olMap.getView().getMaxZoom()
let minZoom = option.minZoom | olMap.getView().getMinZoom()
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
const feature = new Feature(new Point(fromLonLat(data[i].position))) const feature = new Feature(new Point(fromLonLat(data[i].position)))
feature.setId(data[i].id) feature.setId(data[i].id)
@ -272,7 +278,9 @@ export default {
const vectorLayer = new VectorLayer({ const vectorLayer = new VectorLayer({
source: source, source: source,
renderMode: 'image', renderMode: 'image',
declutter: false declutter: false,
maxZoom: maxZoom,
minZoom: minZoom
}) })
olMap.addLayer(vectorLayer) olMap.addLayer(vectorLayer)
if (typeof clickEvent === 'function') { if (typeof clickEvent === 'function') {
@ -311,7 +319,7 @@ export default {
if (postponement) { if (postponement) {
olMap.removeLayer(layer) olMap.removeLayer(layer)
setTimeout(() => { setTimeout(() => {
olMap.addPointLayer(layer) olMap.addLayer(layer)
}, 100) }, 100)
} }
return layer return layer
@ -372,7 +380,7 @@ export default {
const vectorLayer = new VectorLayer({ const vectorLayer = new VectorLayer({
source: source source: source
}) })
olMap.addPointLayer(vectorLayer) olMap.addLayer(vectorLayer)
return vectorLayer return vectorLayer
} }
}, },
@ -392,6 +400,9 @@ export default {
olMap.getView().setCenter(fromLonLat(center)) olMap.getView().setCenter(fromLonLat(center))
} }
}, },
getZoomExtent(){
return [olMap.getView().getMinZoom(), olMap.getView().getMaxZoom()]
},
/** /**
* 根据距离计算经纬度差值方便前端抽稀计算 * 根据距离计算经纬度差值方便前端抽稀计算
* @param distance 距离 单位像素值 * @param distance 距离 单位像素值
@ -401,17 +412,58 @@ export default {
if (!distance) { if (!distance) {
return [] return []
} }
let resolution; let resolution
if (!zoom) { if (!zoom) {
resolution = olMap.getView().getResolution() resolution = olMap.getView().getResolution()
}else { }else {
resolution = olMap.getView().getResolutionForZoom(zoom) resolution = olMap.getView().getResolutionForZoom(zoom)
} }
let diff = resolution * distance let diff = resolution * distance
let position = toLonLat([diff, diff]) return toLonLat([diff, diff])[0]
console.log(position)
// let extent = olMap.getView().calculateExtent(olMap.getSize())
//
//
// let minLng = extent[0]
// let maxLng = extent[2]
// let minLat = extent[1]
// let maxLat = extent[3]
//
// let style = new Style({
// stroke: new Stroke({
// width: 1,
// color: 'rgba(65,65,65,0.8)'
// })
// })
// const source = new VectorSource()
// let lng = minLng
// while (lng <= maxLng) {
//
// const points = [[lng, minLat], [lng, maxLat]]
// const line = new LineString(points)
// const lineFeature = new Feature(line)
// lineFeature.setStyle(style)
// source.addFeature(lineFeature)
// lng += diff
// }
//
// let lat = minLat
// while (lat <= maxLat) {
//
// const points = [[minLng, lat], [maxLng, lat]]
// console.log(points)
// const line = new LineString(points)
// const lineFeature = new Feature(line)
// lineFeature.setStyle(style)
// source.addFeature(lineFeature)
// lat += diff
// }
//
// const vectorLayer = new VectorLayer({
// source: source
// })
// olMap.addLayer(vectorLayer)
} }
} }
} }

View File

@ -32,27 +32,31 @@
</div> </div>
<div class="map-tool-box-top-left"> <div class="map-tool-box-top-left">
<div class="map-tool-btn-group"> <div class="map-tool-btn-group">
<div class="map-tool-btn" title="图层抽稀" @click="drawThin"> <el-dropdown >
<div class="map-tool-btn" title="图层抽稀">
<i class="iconfont icon-mti-sandian"></i> <span>图层抽稀</span> <i class="iconfont icon-mti-sandian"></i> <span>图层抽稀</span>
</div> </div>
<div class="map-tool-btn" title="位置编辑" @click="testArray"> <el-dropdown-menu slot="dropdown">
<i class="el-icon-edit"></i> <span>位置编辑</span> <el-dropdown-item @click.native="quicklyDrawThin">快速抽稀</el-dropdown-item>
</div> <el-dropdown-item>局部抽稀</el-dropdown-item>
</div> </el-dropdown-menu>
</div> </el-dropdown>
<div class="map-tool-box-top-right">
<div class="map-tool-btn-group">
<div class="map-tool-btn" title="抽稀">
<i class="iconfont icon-mti-sandian"></i>
</div>
<div class="map-tool-btn" title="聚合">
<i class="iconfont icon-mti-jutai"></i>
</div>
<div class="map-tool-btn" title="默认">
<i class="iconfont icon-mti-jutai"></i>
</div>
</div> </div>
</div> </div>
<!-- <div class="map-tool-box-top-right">-->
<!-- <div class="map-tool-btn-group">-->
<!-- <div class="map-tool-btn" title="抽稀">-->
<!-- <i class="iconfont icon-mti-sandian"></i>-->
<!-- </div>-->
<!-- <div class="map-tool-btn" title="聚合">-->
<!-- <i class="iconfont icon-mti-jutai"></i>-->
<!-- </div>-->
<!-- <div class="map-tool-btn" title="默认">-->
<!-- <i class="iconfont icon-mti-jutai"></i>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<div ref="infobox"> <div ref="infobox">
<transition name="el-zoom-in-center"> <transition name="el-zoom-in-center">
<div class="infobox-content" v-if="channel"> <div class="infobox-content" v-if="channel">
@ -93,8 +97,9 @@ import DeviceTree from '../common/DeviceTree.vue'
import queryTrace from './queryTrace.vue' import queryTrace from './queryTrace.vue'
import MapComponent from '../common/MapComponent.vue' import MapComponent from '../common/MapComponent.vue'
import devicePlayer from '../common/channelPlayer/index.vue' import devicePlayer from '../common/channelPlayer/index.vue'
import gcoord from 'gcoord'
let cameraLayerList = []
let cameraLayerExtent = []
export default { export default {
name: 'Map', name: 'Map',
components: { components: {
@ -118,7 +123,8 @@ export default {
isLoging: false, isLoging: false,
longitudeStr: 'longitude', longitudeStr: 'longitude',
latitudeStr: 'latitude', latitudeStr: 'latitude',
mapTileList: [] mapTileList: [],
diffPixels: 40
} }
}, },
created() { created() {
@ -190,9 +196,30 @@ export default {
// //
this.closeInfoBox() this.closeInfoBox()
this.$store.dispatch('commonChanel/getAllForMap', {}).then(data => { this.$store.dispatch('commonChanel/getAllForMap', {}).then(data => {
cameraLayerList = data
let minLng, minLat, maxLng, maxLat
let array = [] let array = []
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
let item = data[i] let item = data[i]
if (i === 0) {
minLng = item.gbLongitude
maxLng = item.gbLongitude
minLat = item.gbLatitude
maxLat = item.gbLatitude
}else {
if (item.gbLongitude < minLng) {
minLng = item.gbLongitude
}
if (item.gbLongitude > maxLng) {
maxLng = item.gbLongitude
}
if (item.gbLatitude < minLat) {
minLat = item.gbLatitude
}
if (item.gbLatitude > maxLat) {
maxLat = item.gbLatitude
}
}
if (item.gbLongitude && item.gbLatitude) { if (item.gbLongitude && item.gbLatitude) {
let position = [item.gbLongitude, item.gbLatitude] let position = [item.gbLongitude, item.gbLatitude]
array.push({ array.push({
@ -206,7 +233,8 @@ export default {
}) })
} }
} }
this.updateChannelLayer(array) cameraLayerExtent = [minLng, minLat, maxLng, maxLat]
// this.updateChannelLayer(array)
}) })
}, },
changeMapTile: function (index) { changeMapTile: function (index) {
@ -259,7 +287,6 @@ export default {
}).finally(() => { }).finally(() => {
loading.close() loading.close()
}) })
}, },
edit: function (channel) { edit: function (channel) {
this.closeInfoBox() this.closeInfoBox()
@ -389,12 +416,80 @@ export default {
testArray: function (){ testArray: function (){
this.$store.dispatch('commonChanel/test') this.$store.dispatch('commonChanel/test')
}, },
drawThin: function (){ quicklyDrawThin: function (){
// console.log(cameraLayerList.length)
let distance = 1000 let allCameraList = cameraLayerList.slice()
// //
let diff = this.$refs.mapComponent.computeDiff(distance) let zoomExtent = this.$refs.mapComponent.getZoomExtent()
let zoom = zoomExtent[0]
let zoomCameraMap = new Map()
let useCameraMap = new Map()
while (zoom < zoomExtent[1]) {
//
let diff = this.$refs.mapComponent.computeDiff(this.diffPixels, zoom)
let cameraMap = new Map()
for (let i = 0; i < allCameraList.length; i++) {
let value = allCameraList[i]
if (useCameraMap.has(value.gbId) || !value.gbLongitude || !value.gbLatitude) {
continue
}
let lngGrid = Math.trunc(value.gbLongitude / diff)
let latGrid = Math.trunc(value.gbLatitude / diff)
let gridKey = latGrid + ':' + lngGrid
if (cameraMap.has(gridKey)) {
let oldValue = cameraMap.get(gridKey)
if (value.gbLongitude % diff < oldValue.gbLongitude % diff) {
cameraMap.set(gridKey, value)
useCameraMap.set(value.gbId, value)
useCameraMap.delete(oldValue.gbId)
}
}else {
cameraMap.set(gridKey, value)
useCameraMap.set(value.gbId, value)
}
}
let cameraArray = Array.from(cameraMap.values())
zoomCameraMap.set(zoom, cameraArray)
this.addZoomLayer(cameraArray, zoom)
zoom += 1
}
let cameraArray = []
for (let i = 0; i < allCameraList.length; i++) {
let value = allCameraList[i]
if (useCameraMap.has(value.gbId) || !value.gbLongitude || !value.gbLatitude) {
continue
}
cameraArray.push(value)
}
this.addZoomLayer(cameraArray, zoomExtent[1])
},
addZoomLayer(cameraArray, zoom) {
let dataArray = []
for (let i = 0; i < cameraArray.length; i++) {
let item = cameraArray[i]
let position = [item.gbLongitude, item.gbLatitude]
dataArray.push({
id: item.gbId,
position: position,
data: item,
image: {
anchor: [0.5, 1],
src: this.getImageByChannel(item)
}
})
}
this.$refs.mapComponent.addPointLayer(dataArray, data => {
}, {
minZoom: zoom
})
} }
} }