临时提交
This commit is contained in:
@@ -646,6 +646,9 @@ public interface CommonGBChannelMapper {
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryListForSyMobile")
|
||||
List<CameraChannel> queryListForSyMobile(@Param("business") String business);
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryCameraChannelById")
|
||||
CameraChannel queryCameraChannelById(@Param("gbId") Integer id);
|
||||
|
||||
@Update("<script> " +
|
||||
"<foreach collection='channels' index='index' item='item' separator=';'> " +
|
||||
"UPDATE wvp_device_channel SET map_level=#{item.mapLevel} " +
|
||||
@@ -653,4 +656,7 @@ public interface CommonGBChannelMapper {
|
||||
"</foreach> " +
|
||||
"</script>")
|
||||
void saveLevel(List<ChannelForThin> channels);
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryCameraChannelByIds")
|
||||
List<CameraChannel> queryCameraChannelByIds(List<Integer> ids);
|
||||
}
|
||||
|
||||
@@ -162,6 +162,8 @@ public class ChannelProvider {
|
||||
" wdc.record_plan_id,\n" +
|
||||
" wdc.enable_broadcast,\n" +
|
||||
" wd.device_id as deviceCode,\n" +
|
||||
" wcg.alias as groupAlias,\n" +
|
||||
" wcg2.alias as topGroupGAlias,\n" +
|
||||
" coalesce(wdc.gb_device_id, wdc.device_id) as gb_device_id,\n" +
|
||||
" coalesce(wdc.gb_name, wdc.name) as gb_name,\n" +
|
||||
" coalesce(wdc.gb_manufacturer, wdc.manufacturer) as gb_manufacturer,\n" +
|
||||
@@ -197,7 +199,9 @@ public class ChannelProvider {
|
||||
" coalesce(wdc.gb_svc_space_support_mod, wdc.svc_space_support_mod) as gb_svc_space_support_mod,\n" +
|
||||
" coalesce(wdc.gb_svc_time_support_mode, wdc.svc_time_support_mode) as gb_svc_time_support_mode\n" +
|
||||
" from wvp_device_channel wdc\n" +
|
||||
" left join wvp_device wd on wdc.data_type = 1 AND wd.id = wdc.data_device_id"
|
||||
" left join wvp_device wd on wdc.data_type = 1 AND wd.id = wdc.data_device_id" +
|
||||
" left join wvp_common_group wcg on wcg.device_id = coalesce(wdc.gb_parent_id, wdc.parent_id)" +
|
||||
" left join wvp_common_group wcg2 on wcg2.device_id = wcg.business_group"
|
||||
;
|
||||
|
||||
public String queryByDeviceId(Map<String, Object> params ){
|
||||
@@ -212,6 +216,10 @@ public class ChannelProvider {
|
||||
return BASE_SQL + " where channel_type = 0 and data_type = #{dataType} and data_device_id = #{dataDeviceId}";
|
||||
}
|
||||
|
||||
public String queryCameraChannelById(Map<String, Object> params ){
|
||||
return BASE_SQL + " where id = #{gbId}";
|
||||
}
|
||||
|
||||
public String queryListByCivilCode(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL);
|
||||
@@ -824,6 +832,23 @@ public class ChannelProvider {
|
||||
sqlBuild.append(" )");
|
||||
return sqlBuild.toString() ;
|
||||
}
|
||||
public String queryCameraChannelByIds(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL_FOR_CAMERA_DEVICE);
|
||||
sqlBuild.append(" where wdc.id in ( ");
|
||||
|
||||
List<Integer> ids = (List<Integer>)params.get("ids");
|
||||
boolean first = true;
|
||||
for (Integer id : ids) {
|
||||
if (!first) {
|
||||
sqlBuild.append(",");
|
||||
}
|
||||
sqlBuild.append(id);
|
||||
first = false;
|
||||
}
|
||||
sqlBuild.append(" )");
|
||||
return sqlBuild.toString() ;
|
||||
}
|
||||
|
||||
public String queryListForSyMobile(Map<String, Object> params ){
|
||||
return BASE_SQL_FOR_CAMERA_DEVICE +
|
||||
|
||||
@@ -130,7 +130,7 @@ public class PlayServiceImpl implements IPlayService {
|
||||
* 流到来的处理
|
||||
*/
|
||||
@Async("taskExecutor")
|
||||
@org.springframework.context.event.EventListener
|
||||
@EventListener
|
||||
public void onApplicationEvent(MediaArrivalEvent event) {
|
||||
if ("broadcast".equals(event.getApp()) || "talk".equals(event.getApp())) {
|
||||
if (event.getStream().indexOf("_") > 0) {
|
||||
|
||||
@@ -6,16 +6,27 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Schema(description = "摄像头信息")
|
||||
public class CameraChannel extends CommonGBChannel {
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Schema(description = "摄像头设备国标编号")
|
||||
private String deviceCode;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
@Schema(description = "图标路径")
|
||||
private String icon;
|
||||
|
||||
/**
|
||||
* 分组别名
|
||||
*/
|
||||
@Schema(description = "所属组织结构别名")
|
||||
private String groupAlias;
|
||||
|
||||
/**
|
||||
* 分组所属业务分组别名
|
||||
*/
|
||||
@Schema(description = "所属业务分组别名")
|
||||
private String topGroupGAlias;
|
||||
}
|
||||
|
||||
@@ -8,8 +8,11 @@ import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.FrontEndControlCodeForPTZ;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Group;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.MobilePosition;
|
||||
import com.genersoft.iot.vmp.gb28181.dao.CommonGBChannelMapper;
|
||||
import com.genersoft.iot.vmp.gb28181.dao.GroupMapper;
|
||||
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
|
||||
import com.genersoft.iot.vmp.gb28181.event.subscribe.mobilePosition.MobilePositionEvent;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IGbChannelControlService;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IGbChannelPlayService;
|
||||
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
||||
@@ -23,6 +26,7 @@ import com.github.xiaoymin.knife4j.core.util.Assert;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -32,6 +36,9 @@ import java.util.*;
|
||||
@Service
|
||||
public class CameraChannelService implements CommandLineRunner {
|
||||
|
||||
private final String REDIS_GPS_MESSAGE = "VM_MSG_MOBILE_GPS";
|
||||
private final String REDIS_CHANNEL_MESSAGE = "VM_MSG_MOBILE_CHANNEL";
|
||||
|
||||
@Autowired
|
||||
private CommonGBChannelMapper channelMapper;
|
||||
|
||||
@@ -102,6 +109,77 @@ public class CameraChannelService implements CommandLineRunner {
|
||||
return true;
|
||||
}
|
||||
|
||||
// 监听通道变化,如果是移动设备则发送redis消息
|
||||
@EventListener
|
||||
public void onApplicationEvent(CatalogEvent event) {
|
||||
List<CommonGBChannel> channels = event.getChannels();
|
||||
if (channels.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<CameraChannel> mobilechannelList = null;
|
||||
if (event.getType().equals(CatalogEvent.DEL)) {
|
||||
mobilechannelList = new ArrayList<>();
|
||||
for (CommonGBChannel channel : channels) {
|
||||
if (channel.getGbPtzType() != null && channel.getGbPtzType() == 99) {
|
||||
CameraChannel cameraChannel = new CameraChannel();
|
||||
cameraChannel.setGbDeviceId(channel.getGbDeviceId());
|
||||
mobilechannelList.add(cameraChannel);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
List<Integer> ids = new ArrayList<>();
|
||||
channels.forEach((channel -> {
|
||||
if (channel.getGbPtzType() != null && channel.getGbPtzType() == 99) {
|
||||
ids.add(channel.getGbId());
|
||||
}
|
||||
}));
|
||||
if (ids.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
mobilechannelList = channelMapper.queryCameraChannelByIds(ids);
|
||||
}
|
||||
if (mobilechannelList == null || mobilechannelList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
String type = event.getType();
|
||||
if (type.equals(CatalogEvent.VLOST) || type.equals(CatalogEvent.DEFECT)) {
|
||||
type = CatalogEvent.OFF;
|
||||
}
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("type", type);
|
||||
jsonObject.put("list", mobilechannelList);
|
||||
log.info("[SY-redis发送通知] 发送 通道信息变化 {}: {}", REDIS_CHANNEL_MESSAGE, jsonObject.toString());
|
||||
redisTemplate.convertAndSend(REDIS_CHANNEL_MESSAGE, jsonObject);
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 监听GPS消息,如果是移动设备则发送redis消息
|
||||
@EventListener
|
||||
public void onApplicationEvent(MobilePositionEvent event) {
|
||||
MobilePosition mobilePosition = event.getMobilePosition();
|
||||
Integer channelId = mobilePosition.getChannelId();
|
||||
CameraChannel cameraChannel = channelMapper.queryCameraChannelById(channelId);
|
||||
|
||||
// 非移动设备类型 不发送
|
||||
if (cameraChannel == null || cameraChannel.getGbPtzType() != 99) {
|
||||
return;
|
||||
}
|
||||
// 发送redis消息
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("time", mobilePosition.getTime());
|
||||
jsonObject.put("deviceId", mobilePosition.getDeviceId());
|
||||
jsonObject.put("longitude", mobilePosition.getLongitude());
|
||||
jsonObject.put("latitude", mobilePosition.getLatitude());
|
||||
jsonObject.put("altitude", mobilePosition.getAltitude());
|
||||
jsonObject.put("direction", mobilePosition.getDirection());
|
||||
jsonObject.put("speed", mobilePosition.getSpeed());
|
||||
log.debug("[redis发送通知] 发送 移动设备位置信息移动位置 {}: {}", REDIS_GPS_MESSAGE, jsonObject.toString());
|
||||
redisTemplate.convertAndSend(REDIS_GPS_MESSAGE, jsonObject);
|
||||
}
|
||||
|
||||
|
||||
public PageInfo<CameraChannel> queryList(Integer page, Integer count, String groupAlias, Boolean status, String geoCoordSys) {
|
||||
// 构建组织结构信息
|
||||
|
||||
Reference in New Issue
Block a user