临时提交

This commit is contained in:
lin
2025-10-15 18:25:42 +08:00
parent b135014aed
commit 83bba5d380
9 changed files with 148 additions and 88 deletions

View File

@@ -110,6 +110,9 @@ public interface GroupMapper {
@Select("SELECT * from wvp_common_group WHERE device_id = #{deviceId} and business_group = #{businessGroup}")
Group queryOneByDeviceId(@Param("deviceId") String deviceId, @Param("businessGroup") String businessGroup);
@Select("SELECT * from wvp_common_group WHERE device_id = #{deviceId}")
Group queryOneByOnlyDeviceId(@Param("deviceId") String deviceId);
@Delete("<script>" +
" DELETE FROM wvp_common_group WHERE id in " +
" <foreach collection='allChildren' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +

View File

@@ -23,7 +23,6 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import java.util.ArrayList;
@@ -548,7 +547,10 @@ public class GbChannelServiceImpl implements IGbChannelService {
@Override
public void updateBusinessGroup(String oldBusinessGroup, String newBusinessGroup) {
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByBusinessGroup(oldBusinessGroup);
Assert.notEmpty(channelList, "旧的业务分组的通道不存在");
if (channelList.isEmpty()) {
log.info("[更新业务分组] 发现未关联任何通道: {}", oldBusinessGroup);
return;
}
int result = commonGBChannelMapper.updateBusinessGroupByChannelList(newBusinessGroup, channelList);
if (result > 0) {

View File

@@ -166,7 +166,7 @@ public class GroupServiceImpl implements IGroupService {
@Override
public Group queryGroupByDeviceId(String regionDeviceId) {
return null;
return groupManager.queryOneByOnlyDeviceId(regionDeviceId);
}
@Override

View File

@@ -27,8 +27,8 @@ import java.util.concurrent.ConcurrentLinkedQueue;
* @Auther: JiangFeng
* @Date: 2022/8/16 11:32
* @Description: 接收redis发送的推流设备列表更新通知
* 监听: SUBSCRIBE VM_MSG_PUSH_STREAM_LIST_CHANGE
* 发布 PUBLISH VM_MSG_PUSH_STREAM_LIST_CHANGE '[{"app":1000,"stream":10000000,"gbId":"12345678901234567890","name":"A6","status":false},{"app":1000,"stream":10000021,"gbId":"24212345671381000021","name":"终端9273","status":false},{"app":1000,"stream":10000022,"gbId":"24212345671381000022","name":"终端9434","status":true},{"app":1000,"stream":10000025,"gbId":"24212345671381000025","name":"华为M10","status":false},{"app":1000,"stream":10000051,"gbId":"11111111111381111122","name":"终端9720","status":false}]'
* 监听: SUBSCRIBE VM_MSG_GROUP_LIST_CHANGE
* 发布 PUBLISH VM_MSG_GROUP_LIST_CHANGE '[{"groupName":"测试域修改新","topGroupGAlias":3,"messageType":"update","groupAlias":3}]'
*/
@Slf4j
@Component
@@ -50,7 +50,7 @@ public class RedisGroupChangeListener implements MessageListener {
@Override
public void onMessage(Message message, byte[] bytes) {
log.info("[REDIS: 分组信息更新] key {} {}", VideoManagerConstants.VM_MSG_GROUP_LIST_CHANGE, new String(message.getBody()));
log.info("[REDIS-分组信息改变] key {} {}", VideoManagerConstants.VM_MSG_GROUP_LIST_CHANGE, new String(message.getBody()));
taskQueue.offer(message);
}
@@ -90,7 +90,7 @@ public class RedisGroupChangeListener implements MessageListener {
}
if (ObjectUtils.isEmpty(groupMessage.getGroupName())
|| ObjectUtils.isEmpty(groupMessage.getTopGroupGbId()) ){
log.info("[REDIS消息-业务分组同步回复] 消息关键字段缺失, {}", groupMessage.toString());
log.info("[REDIS消息-分组信息新增] 消息关键字段缺失, {}", groupMessage.toString());
continue;
}
group = new Group();
@@ -119,27 +119,29 @@ public class RedisGroupChangeListener implements MessageListener {
String deviceId = buildGroupDeviceId(isTop);
group.setDeviceId(deviceId);
group.setAlias(groupMessage.getGroupAlias());
group.setName(groupMessage.getGroupName());
if (!isTop) {
if (ObjectUtils.isEmpty(groupMessage.getTopGroupGAlias()) || ObjectUtils.isEmpty(groupMessage.getParentGAlias())) {
log.info("[REDIS消息-业务分组同步回复] 消息缺失业务分组别名或者父节点别名, {}", groupMessage.toString());
if (ObjectUtils.isEmpty(groupMessage.getTopGroupGAlias()) ) {
log.info("[REDIS消息-分组信息新增] 消息缺失业务分组别名或者父节点别名, {}", groupMessage.toString());
continue;
}
Group topGroup = groupService.queryGroupByAlias(groupMessage.getTopGroupGAlias());
if (topGroup == null) {
log.info("[REDIS消息-业务分组同步回复] 业务分组信息未入库, {}", groupMessage.toString());
log.info("[REDIS消息-分组信息新增] 业务分组信息未入库, {}", groupMessage.toString());
continue;
}
group.setBusinessGroup(groupMessage.getTopGroupGbId());
group.setBusinessGroup(topGroup.getDeviceId());
group.setParentId(topGroup.getId());
}
if (groupMessage.getParentGAlias() != null) {
Group parentGroup = groupService.queryGroupByAlias(groupMessage.getParentGAlias());
if (parentGroup == null) {
log.info("[REDIS消息-业务分组同步回复] 虚拟组织父节点信息未入库, {}", groupMessage.toString());
log.info("[REDIS消息-分组信息新增] 虚拟组织父节点信息未入库, {}", groupMessage.toString());
continue;
}
group.setParentId(parentGroup.getId());
group.setParentDeviceId(parentGroup.getDeviceId());
}
group.setCreateTime(DateUtil.getNow());
group.setUpdateTime(DateUtil.getNow());
@@ -166,9 +168,8 @@ public class RedisGroupChangeListener implements MessageListener {
groupService.update(group);
}else {
// 此处使用别名作为判断依据别名此处常常是分组在第三方系统里的唯一ID
if (groupMessage.getGroupAlias() == null || ObjectUtils.isEmpty(groupMessage.getGroupName())
|| ObjectUtils.isEmpty(groupMessage.getTopGroupGAlias())) {
log.info("[REDIS消息-业务分组同步回复] 消息关键字段缺失, {}", groupMessage.toString());
if (groupMessage.getGroupAlias() == null) {
log.info("[REDIS消息-分组信息更新] 消息关键字段缺失, {}", groupMessage.toString());
continue;
}
Group group = groupService.queryGroupByAlias(groupMessage.getGroupAlias());
@@ -176,33 +177,25 @@ public class RedisGroupChangeListener implements MessageListener {
log.info("[REDIS消息-分组信息更新] 失败 {},别名不存在", groupMessage.getGroupAlias());
continue;
}
boolean isTop = groupMessage.getTopGroupGAlias().equals(groupMessage.getGroupAlias());
String deviceId = buildGroupDeviceId(isTop);
group.setDeviceId(deviceId);
group.setAlias(groupMessage.getGroupAlias());
if (!isTop) {
if (ObjectUtils.isEmpty(groupMessage.getTopGroupGAlias()) || ObjectUtils.isEmpty(groupMessage.getParentGAlias())) {
log.info("[REDIS消息-业务分组同步回复] 消息缺失业务分组别名或者父节点别名, {}", groupMessage.toString());
continue;
}
Group topGroup = groupService.queryGroupByDeviceId(group.getBusinessGroup());
if (topGroup == null) {
log.info("[REDIS消息-业务分组同步回复] 业务分组不存在, {}", groupMessage.toString());
continue;
}
group.setBusinessGroup(topGroup.getDeviceId());
group.setName(groupMessage.getGroupName());
group.setUpdateTime(DateUtil.getNow());
if (groupMessage.getParentGAlias() != null) {
Group parentGroup = groupService.queryGroupByAlias(groupMessage.getParentGAlias());
if (parentGroup == null) {
log.info("[REDIS消息-业务分组同步回复] 虚拟组织父节点信息未入库, {}", groupMessage.toString());
log.info("[REDIS消息-分组信息更新] 虚拟组织父节点信息未入库, {}", groupMessage.toString());
continue;
}
group.setParentId(parentGroup.getId());
group.setParentDeviceId(parentGroup.getDeviceId());
}else {
Group businessGroup = groupService.queryGroupByDeviceId(group.getBusinessGroup());
if (businessGroup == null ) {
log.info("[REDIS消息-分组信息更新] 失败 {},业务分组不存在", groupMessage.getGroupAlias());
continue;
}
group.setParentId(businessGroup.getId());
group.setParentDeviceId(null);
}
group.setUpdateTime(DateUtil.getNow());
groupService.update(group);
}
break;
@@ -220,21 +213,20 @@ public class RedisGroupChangeListener implements MessageListener {
groupService.delete(group.getId());
}else {
// 此处使用别名作为判断依据别名此处常常是分组在第三方系统里的唯一ID
if (groupMessage.getGroupAlias() == null || ObjectUtils.isEmpty(groupMessage.getGroupName())
|| ObjectUtils.isEmpty(groupMessage.getTopGroupGAlias())) {
log.info("[REDIS消息-业务分组同步回复] 消息关键字段缺失, {}", groupMessage.toString());
if (groupMessage.getGroupAlias() == null) {
log.info("[REDIS消息-分组信息删除] 消息关键字段缺失, {}", groupMessage.toString());
continue;
}
Group group = groupService.queryGroupByAlias(groupMessage.getGroupAlias());
if (group == null) {
log.info("[REDIS消息-分组信息更新] 失败 {},别名不存在", groupMessage.getGroupAlias());
log.info("[REDIS消息-分组信息删除] 失败 {},别名不存在", groupMessage.getGroupAlias());
continue;
}
groupService.delete(group.getId());
}
break;
default:
log.info("[REDIS消息-分组信息更新] 未识别的消息类型 {},目前支持的消息类型为 add、update、delete", groupMessage.getMessageType());
log.info("[REDIS消息-分组信息改变] 未识别的消息类型 {},目前支持的消息类型为 add、update、delete", groupMessage.getMessageType());
}
}

View File

@@ -79,7 +79,7 @@ public class RedisGroupMsgListener implements MessageListener {
log.info("[REDIS消息-业务分组同步回复] {}", groupMessage.toString());
if (!userSetting.isUseAliasForGroupSync()) {
if (groupMessage.getGroupGbId() == null) {
log.info("[REDIS消息-业务分组同步回复] 分组编号未设置,{}", groupMessage.toString());
log.warn("[REDIS消息-业务分组同步回复] 分组编号未设置,{}", groupMessage.toString());
continue;
}
Group group = groupService.queryGroupByDeviceId(groupMessage.getGroupGbId());
@@ -122,7 +122,6 @@ public class RedisGroupMsgListener implements MessageListener {
group.setAlias(groupMessage.getGroupAlias());
group.setName(groupMessage.getGroupName());
group.setCreateTime(DateUtil.getNow());
}
if (!isTop) {
@@ -137,16 +136,23 @@ public class RedisGroupMsgListener implements MessageListener {
continue;
}
group.setBusinessGroup(topGroup.getDeviceId());
}
if (groupMessage.getParentGAlias() != null) {
Group parentGroup = groupService.queryGroupByAlias(groupMessage.getParentGAlias());
if (parentGroup == null) {
log.info("[REDIS消息-业务分组同步回复] 虚拟组织父节点信息未入库, {}", groupMessage.toString());
continue;
if (groupMessage.getParentGAlias() != null) {
Group parentGroup = groupService.queryGroupByAlias(groupMessage.getParentGAlias());
if (parentGroup == null) {
log.info("[REDIS消息-业务分组同步回复] 虚拟组织父节点信息未入库, {}", groupMessage.toString());
continue;
}
group.setParentId(parentGroup.getId());
group.setParentDeviceId(parentGroup.getDeviceId());
}else {
group.setParentId(topGroup.getId());
group.setParentDeviceId(null);
}
group.setParentId(parentGroup.getId());
group.setParentDeviceId(parentGroup.getDeviceId());
}else {
group.setParentId(null);
group.setParentDeviceId(null);
}
group.setUpdateTime(DateUtil.getNow());
if (group.getId() > 0) {
groupService.update(group);

View File

@@ -104,6 +104,15 @@ public class CameraChannelController {
return channelService.queryListWithChild(page, count, query, sortName, order, groupAlias, status, geoCoordSys);
}
@GetMapping(value = "/camera/cont-with-child")
@ResponseBody
@Operation(summary = "查询摄像机列表的总数和在线数", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "groupAlias", description = "分组别名")
public CameraCont queryCountWithChild(String groupAlias){
return channelService.queryCountWithChild(groupAlias);
}
@GetMapping(value = "/camera/one")
@ResponseBody
@Operation(summary = "查询单个摄像头信息", security = @SecurityRequirement(name = JwtUtils.HEADER))

View File

@@ -0,0 +1,11 @@
package com.genersoft.iot.vmp.web.custom.bean;
import lombok.Data;
@Data
public class CameraCont {
private Long total;
private Long online;
}

View File

@@ -15,10 +15,7 @@ import com.genersoft.iot.vmp.gb28181.service.IGbChannelPlayService;
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
import com.genersoft.iot.vmp.utils.Coordtransform;
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
import com.genersoft.iot.vmp.web.custom.bean.CameraChannel;
import com.genersoft.iot.vmp.web.custom.bean.CameraGroup;
import com.genersoft.iot.vmp.web.custom.bean.CameraStreamInfo;
import com.genersoft.iot.vmp.web.custom.bean.Point;
import com.genersoft.iot.vmp.web.custom.bean.*;
import com.genersoft.iot.vmp.web.custom.conf.SyTokenManager;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@@ -161,6 +158,18 @@ public class CameraChannelService implements CommandLineRunner {
}
}
public CameraCont queryCountWithChild(String groupAlias) {
// 构建组织结构信息
CameraGroup group = groupMapper.queryGroupByAlias(groupAlias);
Assert.notNull(group, "组织结构不存在");
String groupDeviceId = group.getDeviceId();
// 获取所有子节点
List<CameraGroup> groupList = queryAllGroupChildren(group.getId(), group.getBusinessGroup());
groupList.add(group);
return null;
}
/**
* 为通道增加图片信息和转换坐标系
*/
@@ -446,4 +455,6 @@ public class CameraChannelService implements CommandLineRunner {
groupPageInfo.setList(list);
return groupPageInfo;
}
}

View File

@@ -12,6 +12,10 @@
<i class="iconfont icon-mti-jutai"></i>
</div>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="0" >
<span v-if="layerStyle !== 0">图层关闭</span>
<span v-if="layerStyle === 0" style="color: rgb(64, 158, 255);">图层关闭</span>
</el-dropdown-item>
<el-dropdown-item :command="1" >
<span v-if="layerStyle !== 1">直接展示</span>
<span v-if="layerStyle === 1" style="color: rgb(64, 158, 255);">直接展示</span>
@@ -162,9 +166,10 @@ export default {
showDrawThin: false,
quicklyDrawThinLoading: false,
saveDrawThinLoading: false,
layerStyle: 1,
layerStyle: 0,
drawThinLayer: null,
layerGroupSource: null
layerGroupSource: null,
infoBoxTempLayer: null
}
},
created() {
@@ -230,12 +235,28 @@ export default {
},
showChannelInfo: function(data) {
this.channel = data
if (this.infoBoxTempLayer) {
this.$refs.mapComponent.removeLayer(this.infoBoxTempLayer)
this.infoBoxTempLayer = null
}
if (this.layerStyle === 0 || this.layerStyle === 2) {
// 此时增加临时图标
let position = [data.gbLongitude, data.gbLatitude]
let cameraData = {
id: data.gbId,
position: position,
data: data,
image: {
anchor: [0.5, 1],
src: this.getImageByChannel(data)
}
}
this.infoBoxTempLayer = this.$refs.mapComponent.addPointLayer([cameraData])
}
let position = [data.gbLongitude, data.gbLatitude]
this.infoBoxId = this.$refs.mapComponent.openInfoBox(position, this.$refs.infobox, [0, -50])
},
zoomChange: function(zoom) {
},
zoomChange: function(zoom) {},
initChannelLayer: function () {
this.mapTileList = this.$refs.mapComponent.mapTileList
@@ -243,27 +264,23 @@ export default {
this.closeInfoBox()
this.$store.dispatch('commonChanel/getAllForMap', {}).then(data => {
cameraListForSource = data
let minLng, minLat, maxLng, maxLat
for (let i = 0; i < data.length; i++) {
let minLng = data[0].gbLongitude
let maxLng = data[0].gbLongitude
let minLat = data[0].gbLatitude
let maxLat = data[0].gbLatitude
for (let i = 1; i < data.length; i++) {
let item = data[i]
if (i === 0) {
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
}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) {
let position = [item.gbLongitude, item.gbLatitude]
@@ -313,6 +330,9 @@ export default {
this.updateChannelLayer()
},
updateChannelLayer: function() {
if (this.layerStyle === 0) {
return
}
let clientEvent = data => {
this.closeInfoBox()
this.$nextTick(() => {
@@ -370,6 +390,10 @@ export default {
}
this.channel = null
this.dragChannel = null
if (this.infoBoxTempLayer) {
this.$refs.mapComponent.removeLayer(this.infoBoxTempLayer)
this.infoBoxTempLayer = null
}
},
play: function (channel) {
const loading = this.$loading({
@@ -518,18 +542,20 @@ export default {
},
showDrawThinBox: function(show){
this.showDrawThin = show
if (!show) {
// 关闭抽稀预览
if (this.drawThinLayer !== null) {
this.$refs.mapComponent.removeLayer(this.drawThinLayer)
this.drawThinLayer = null
setTimeout(() => {
if (!show) {
// 关闭抽稀预览
if (this.drawThinLayer !== null) {
this.$refs.mapComponent.removeLayer(this.drawThinLayer)
this.drawThinLayer = null
}
// 清空预览数据
this.layerGroupSource = null
this.updateChannelLayer()
}else {
//
}
// 清空预览数据
this.layerGroupSource = null
this.updateChannelLayer()
}else {
//
}
}, 1)
},
quicklyDrawThin: function (){
if (this.channelLayer) {