Merge remote-tracking branch 'origin/dev/springBoot3' into dev/springBoot3

This commit is contained in:
lin
2025-10-26 20:51:28 +08:00
20 changed files with 221 additions and 195 deletions

View File

@@ -101,7 +101,8 @@ public class CommonGBChannel {
@Schema(description = "国标-虚拟组织所属的业务分组ID")
private String gbBusinessGroupId;
@Schema(description = "国标-摄像机结构类型,标识摄像机类型: 1-球机; 2-半球; 3-固定枪机; 4-遥控枪机;5-遥控半球;6-多目设备的全景/拼接通道;7-多目设备的分割通道; 99-移动设备(非标)")
@Schema(description = "国标-摄像机结构类型,标识摄像机类型: 1-球机; 2-半球; 3-固定枪机; 4-遥控枪机;5-遥控半球;6-多目设备的全景/拼接通道;" +
"7-多目设备的分割通道; 99-移动设备非标98-会议设备(非标)")
private Integer gbPtzType;
// 2016

View File

@@ -3,6 +3,8 @@ package com.genersoft.iot.vmp.gb28181.bean;
import gov.nist.javax.sip.message.SIPResponse;
import lombok.Data;
import javax.sip.header.EventHeader;
@Data
public class SipTransactionInfo {
@@ -12,6 +14,7 @@ public class SipTransactionInfo {
private String viaBranch;
private int expires;
private String user;
private String eventId;
// 自己是否媒体流发送者
private boolean asSender;
@@ -22,6 +25,10 @@ public class SipTransactionInfo {
this.toTag = response.getToTag();
this.viaBranch = response.getTopmostViaHeader().getBranch();
this.asSender = asSender;
EventHeader header = (EventHeader)response.getHeader(EventHeader.NAME);
if (header != null) {
this.eventId = header.getEventId();
}
}
public SipTransactionInfo(SIPResponse response) {
@@ -30,6 +37,10 @@ public class SipTransactionInfo {
this.toTag = response.getToTag();
this.viaBranch = response.getTopmostViaHeader().getBranch();
this.asSender = false;
EventHeader header = (EventHeader)response.getHeader(EventHeader.NAME);
if (header != null) {
this.eventId = header.getEventId();
}
}
public SipTransactionInfo() {

View File

@@ -665,4 +665,7 @@ public interface CommonGBChannelMapper {
@SelectProvider(type = ChannelProvider.class, method = "queryOldChanelListByChannels")
List<CommonGBChannel> queryOldChanelListByChannels(List<CommonGBChannel> channelList);
@SelectProvider(type = ChannelProvider.class, method = "queryMeetingChannelList")
List<CameraChannel> queryMeetingChannelList(@Param("business") String business);
}

View File

@@ -567,13 +567,14 @@ public class ChannelProvider {
public String queryListForSy(Map<String, Object> params ){
StringBuilder sqlBuild = new StringBuilder();
sqlBuild.append(BASE_SQL_FOR_CAMERA_DEVICE);
sqlBuild.append(" where wdc.channel_type = 0 AND (wdc.gb_ptz_type is null || wdc.gb_ptz_type != 99) AND coalesce(wdc.gb_parent_id, wdc.parent_id) = #{groupDeviceId}");
sqlBuild.append(" 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) = #{groupDeviceId}");
if (params.get("online") != null && (Boolean)params.get("online")) {
sqlBuild.append(" AND coalesce(wdc.gb_status, wdc.status) = 'ON'");
}
if (params.get("online") != null && !(Boolean)params.get("online")) {
sqlBuild.append(" AND coalesce(wdc.gb_status, wdc.status) = 'OFF'");
}
sqlBuild.append(" order by coalesce(wdc.gb_status, wdc.status) desc");
return sqlBuild.toString();
}
@@ -581,21 +582,22 @@ public class ChannelProvider {
public String queryListWithChildForSy(Map<String, Object> params ){
StringBuilder sqlBuild = new StringBuilder();
sqlBuild.append(BASE_SQL_FOR_CAMERA_DEVICE);
sqlBuild.append(" where wdc.channel_type = 0 AND (wdc.gb_ptz_type is null || wdc.gb_ptz_type != 99) " +
" AND coalesce(wdc.gb_parent_id, wdc.parent_id) in (");
sqlBuild.append(" 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)) ");
sqlBuild.append(" ");
List<CameraGroup> groupList = (List<CameraGroup>)params.get("groupList");
boolean first = true;
for (CameraGroup group : groupList) {
if (!first) {
sqlBuild.append(",");
if (groupList != null && !groupList.isEmpty()) {
sqlBuild.append(" AND coalesce(wdc.gb_parent_id, wdc.parent_id) in (");
boolean first = true;
for (CameraGroup group : groupList) {
if (!first) {
sqlBuild.append(",");
}
sqlBuild.append("'" + group.getDeviceId() + "'");
first = false;
}
sqlBuild.append("'" + group.getDeviceId() + "'");
first = false;
sqlBuild.append(" )");
}
sqlBuild.append(" )");
if (params.get("query") != null) {
sqlBuild.append(" AND (coalesce(wdc.gb_device_id, wdc.device_id) LIKE concat('%',#{query},'%') escape '/'" +
" OR coalesce(wdc.gb_name, wdc.name) LIKE concat('%',#{query},'%') escape '/' )")
@@ -654,7 +656,7 @@ public class ChannelProvider {
public String queryListInBox(Map<String, Object> params ){
StringBuilder sqlBuild = new StringBuilder();
sqlBuild.append(BASE_SQL_FOR_CAMERA_DEVICE);
sqlBuild.append(" where wdc.channel_type = 0 AND (wdc.gb_ptz_type is null || wdc.gb_ptz_type != 99) " +
sqlBuild.append(" 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 (");
sqlBuild.append(" ");
@@ -682,7 +684,7 @@ public class ChannelProvider {
public String queryListInCircleForMysql(Map<String, Object> params ){
StringBuilder sqlBuild = new StringBuilder();
sqlBuild.append(BASE_SQL_FOR_CAMERA_DEVICE);
sqlBuild.append(" where wdc.channel_type = 0 AND (wdc.gb_ptz_type is null || wdc.gb_ptz_type != 99) " +
sqlBuild.append(" 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 (");
sqlBuild.append(" ");
@@ -711,7 +713,7 @@ public class ChannelProvider {
public String queryListInCircleForKingBase(Map<String, Object> params ){
StringBuilder sqlBuild = new StringBuilder();
sqlBuild.append(BASE_SQL_FOR_CAMERA_DEVICE);
sqlBuild.append(" where wdc.channel_type = 0 AND (wdc.gb_ptz_type is null || wdc.gb_ptz_type != 99) " +
sqlBuild.append(" 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 (");
sqlBuild.append(" ");
@@ -740,7 +742,7 @@ public class ChannelProvider {
public String queryListInPolygonForMysql(Map<String, Object> params ){
StringBuilder sqlBuild = new StringBuilder();
sqlBuild.append(BASE_SQL_FOR_CAMERA_DEVICE);
sqlBuild.append(" where wdc.channel_type = 0 AND (wdc.gb_ptz_type is null || wdc.gb_ptz_type != 99) " +
sqlBuild.append(" 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 (");
sqlBuild.append(" ");
@@ -778,7 +780,7 @@ public class ChannelProvider {
public String queryListInPolygonForKingBase(Map<String, Object> params ){
StringBuilder sqlBuild = new StringBuilder();
sqlBuild.append(BASE_SQL_FOR_CAMERA_DEVICE);
sqlBuild.append(" where wdc.channel_type = 0 AND (wdc.gb_ptz_type is null || wdc.gb_ptz_type != 99) " +
sqlBuild.append(" 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 (");
sqlBuild.append(" ");
@@ -836,19 +838,11 @@ public class ChannelProvider {
public String queryListByDeviceIds(Map<String, Object> params ){
StringBuilder sqlBuild = new StringBuilder();
sqlBuild.append("<script> ");
sqlBuild.append(BASE_SQL_FOR_CAMERA_DEVICE);
sqlBuild.append(" where coalesce(wdc.gb_device_id, wdc.device_id) in ( ");
List<String> deviceIds = (List<String>)params.get("deviceIds");
boolean first = true;
for (String deviceId : deviceIds) {
if (!first) {
sqlBuild.append(",");
}
sqlBuild.append(deviceId);
first = false;
}
sqlBuild.append(" )");
sqlBuild.append(" where coalesce(wdc.gb_device_id, wdc.device_id) in ");
sqlBuild.append(" <foreach item='item' index='index' collection='deviceIds' open='(' separator=',' close=')'> #{item} </foreach>");
sqlBuild.append(" </script>");
return sqlBuild.toString() ;
}
@@ -873,13 +867,20 @@ public class ChannelProvider {
public String queryListForSyMobile(Map<String, Object> params ){
StringBuilder sqlBuild = new StringBuilder();
sqlBuild.append(BASE_SQL_FOR_CAMERA_DEVICE);
sqlBuild.append(" WHERE wdc.gb_ptz_type = 99 ");
sqlBuild.append(" WHERE wdc.gb_ptz_type = 99 and wdc.channel_type = 0 AND wdc.data_type != 2 ");
if (params.get("business") != null) {
sqlBuild.append(" AND coalesce(gb_business_group_id, business_group_id) = #{business}");
}
return sqlBuild.toString();
}
public String queryMeetingChannelList(Map<String, Object> params ){
StringBuilder sqlBuild = new StringBuilder();
sqlBuild.append(BASE_SQL_FOR_CAMERA_DEVICE);
sqlBuild.append(" WHERE wdc.channel_type = 0 AND wdc.data_type = 3 and wdc.gb_ptz_type = 98 and coalesce(wdc.gb_business_group_id, wdc.business_group_id) = #{business}");
return sqlBuild.toString();
}
public String queryCameraChannelById(Map<String, Object> params ){
return BASE_SQL_FOR_CAMERA_DEVICE + " where wdc.id = #{gbId}";

View File

@@ -11,7 +11,6 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
import javax.sip.InvalidArgumentException;
import javax.sip.SipException;
@@ -25,7 +24,7 @@ import java.util.Map;
* catalog事件
*/
@Slf4j
@Component
//@Component
public class CatalogEventLister implements ApplicationListener<CatalogEvent> {
@Autowired

View File

@@ -269,12 +269,15 @@ public class SIPRequestHeaderProvider {
ExpiresHeader expireHeader = SipFactory.getInstance().createHeaderFactory().createExpiresHeader(expires);
request.addHeader(expireHeader);
// Event
EventHeader eventHeader = SipFactory.getInstance().createHeaderFactory().createEventHeader(event);
int random = (int) Math.floor(Math.random() * 10000);
eventHeader.setEventId(random + "");
request.addHeader(eventHeader);
// Event
EventHeader eventHeader = SipFactory.getInstance().createHeaderFactory().createEventHeader(event);
if (sipTransactionInfo != null && sipTransactionInfo.getEventId() != null) {
eventHeader.setEventId(sipTransactionInfo.getEventId());
}else {
int random = (int) Math.floor(Math.random() * 10000);
eventHeader.setEventId(random + "");
}
request.addHeader(eventHeader);
ContentTypeHeader contentTypeHeader = SipFactory.getInstance().createHeaderFactory().createContentTypeHeader("Application", "MANSCDP+xml");
request.setContent(content, contentTypeHeader);

View File

@@ -1203,7 +1203,13 @@ public class SIPCommander implements ISIPCommander {
} else {
callIdHeader = sipSender.getNewCallIdHeader(sipLayer.getLocalIp(device.getLocalIp()),device.getTransport());
}
SIPRequest request = (SIPRequest) headerProvider.createSubscribeRequest(device, subscribePostitionXml.toString(), sipTransactionInfo, device.getSubscribeCycleForMobilePosition(), "presence",callIdHeader); //Position;id=" + tm.substring(tm.length() - 4));
int subscribeCycleForMobilePosition = device.getSubscribeCycleForMobilePosition();
if (subscribeCycleForMobilePosition > 0) {
// 移动位置订阅有效期不小于 30 秒
subscribeCycleForMobilePosition = Math.max(subscribeCycleForMobilePosition, 30);
}
SIPRequest request = (SIPRequest) headerProvider.createSubscribeRequest(device, subscribePostitionXml.toString(), sipTransactionInfo, subscribeCycleForMobilePosition, "presence",callIdHeader); //Position;id=" + tm.substring(tm.length() - 4));
sipSender.transmitRequest(sipLayer.getLocalIp(device.getLocalIp()), request, errorEvent, okEvent);
return request;
@@ -1275,8 +1281,13 @@ public class SIPCommander implements ISIPCommander {
callIdHeader = sipSender.getNewCallIdHeader(sipLayer.getLocalIp(device.getLocalIp()),device.getTransport());
}
int subscribeCycleForCatalog = device.getSubscribeCycleForCatalog();
if (subscribeCycleForCatalog > 0) {
// 目录订阅有效期不小于 30 秒
subscribeCycleForCatalog = Math.max(subscribeCycleForCatalog, 30);
}
// 有效时间默认为60秒以上
SIPRequest request = (SIPRequest) headerProvider.createSubscribeRequest(device, cmdXml.toString(), sipTransactionInfo, device.getSubscribeCycleForCatalog(), "Catalog",
SIPRequest request = (SIPRequest) headerProvider.createSubscribeRequest(device, cmdXml.toString(), sipTransactionInfo, subscribeCycleForCatalog, "Catalog",
callIdHeader);
sipSender.transmitRequest(sipLayer.getLocalIp(device.getLocalIp()), request, errorEvent, okEvent);
return request;

View File

@@ -17,5 +17,8 @@ public class ABLUrls {
@JSONField(name = "http-mp4")
private String httpMp4;
@JSONField(name = "http-hls")
private String httpHls;
private String download;
}

View File

@@ -1,58 +0,0 @@
package com.genersoft.iot.vmp.media.abl.bean;
public class AblUrls {
private String rtsp;
private String rtmp;
private String httpFlv;
private String wsFlv;
private String httpMp4;
private String httpHls;
public String getRtsp() {
return rtsp;
}
public void setRtsp(String rtsp) {
this.rtsp = rtsp;
}
public String getRtmp() {
return rtmp;
}
public void setRtmp(String rtmp) {
this.rtmp = rtmp;
}
public String getHttpFlv() {
return httpFlv;
}
public void setHttpFlv(String httpFlv) {
this.httpFlv = httpFlv;
}
public String getWsFlv() {
return wsFlv;
}
public void setWsFlv(String wsFlv) {
this.wsFlv = wsFlv;
}
public String getHttpMp4() {
return httpMp4;
}
public void setHttpMp4(String httpMp4) {
this.httpMp4 = httpMp4;
}
public String getHttpHls() {
return httpHls;
}
public void setHttpHls(String httpHls) {
this.httpHls = httpHls;
}
}

View File

@@ -1,6 +1,6 @@
package com.genersoft.iot.vmp.media.abl.bean.hook;
import com.genersoft.iot.vmp.media.abl.bean.AblUrls;
import com.genersoft.iot.vmp.media.abl.bean.ABLUrls;
import lombok.Getter;
import lombok.Setter;
@@ -108,5 +108,5 @@ public class OnStreamArriveABLHookParam extends ABLHookParam{
private Integer audioBitrate;
private AblUrls url;
private ABLUrls url;
}

View File

@@ -93,4 +93,5 @@ public interface IStreamProxyService {
StreamProxy getStreamProxy(int id);
void delete(int id);
}

View File

@@ -13,6 +13,7 @@ import com.genersoft.iot.vmp.service.bean.CloudRecordItem;
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
import com.genersoft.iot.vmp.service.bean.InviteErrorCode;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.streamProxy.service.IStreamProxyService;
import com.genersoft.iot.vmp.streamPush.service.IStreamPushPlayService;
import com.genersoft.iot.vmp.utils.DateUtil;
import com.genersoft.iot.vmp.utils.HttpUtils;
@@ -72,6 +73,9 @@ public class CameraChannelController {
@Autowired
private IStreamPushPlayService streamPushPlayService;
@Autowired
private IStreamProxyService streamProxyService;
@GetMapping(value = "/camera/list")
@ResponseBody
@@ -108,7 +112,7 @@ public class CameraChannelController {
@RequestParam(required = false) String query,
@RequestParam(required = false) String sortName,
@RequestParam(required = false) Boolean order,
String groupAlias,
@RequestParam(required = false) String groupAlias,
@RequestParam(required = false) String geoCoordSys,
@RequestParam(required = false) Boolean status){
if (ObjectUtils.isEmpty(query)) {
@@ -552,4 +556,14 @@ public class CameraChannelController {
public void stop(String app, String stream){
streamPushPlayService.stop(app, stream);
}
@GetMapping(value = "/camera/meeting/list")
@ResponseBody
@Operation(summary = "查询会议设备", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "topGroupAlias", description = "分组别名")
public List<CameraChannel> queryMeetingChannelList(String topGroupAlias){
return channelService.queryMeetingChannelList(topGroupAlias);
}
}

View File

@@ -45,6 +45,10 @@ public class SignAuthenticationFilter extends OncePerRequestFilter {
chain.doFilter(request, response);
return;
}
// if (request.getParameter("ccerty") != null) {
// chain.doFilter(request, response);
// return;
// }
// 设置响应内容类型
response.setContentType("application/json;charset=UTF-8");
@@ -150,9 +154,11 @@ public class SignAuthenticationFilter extends OncePerRequestFilter {
}catch (Exception e) {
log.info("[SY-接口验签] 读取body失败, 请求地址: {} ", requestURI, e);
response.setStatus(Response.OK);
PrintWriter out = response.getWriter();
out.println(getErrorResult(6017, "接口鉴权异常"));
out.close();
if (!response.isCommitted()) {
PrintWriter out = response.getWriter();
out.println(getErrorResult(6017, "接口鉴权异常"));
out.close();
}
return;
}
chain.doFilter(request, response);

View File

@@ -207,13 +207,13 @@ public class CameraChannelService implements CommandLineRunner {
sendChannelMessage(resultListForAdd, ChannelEvent.ChannelEventMessageType.ADD);
}
if (!resultListForUpdate.isEmpty()) {
sendChannelMessage(resultListForAdd, ChannelEvent.ChannelEventMessageType.UPDATE);
sendChannelMessage(resultListForUpdate, ChannelEvent.ChannelEventMessageType.UPDATE);
}
if (!resultListForOnline.isEmpty()) {
sendChannelMessage(resultListForAdd, ChannelEvent.ChannelEventMessageType.ON);
sendChannelMessage(resultListForOnline, ChannelEvent.ChannelEventMessageType.ON);
}
if (!resultListForOffline.isEmpty()) {
sendChannelMessage(resultListForAdd, ChannelEvent.ChannelEventMessageType.OFF);
sendChannelMessage(resultListForOffline, ChannelEvent.ChannelEventMessageType.OFF);
}
}
@@ -273,13 +273,18 @@ 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) {
List<CameraGroup> groupList = null;
// 构建组织结构信息
CameraGroup group = groupMapper.queryGroupByAlias(groupAlias);
Assert.notNull(group, "组织结构不存在");
String groupDeviceId = group.getDeviceId();
// 获取所有子节点
List<CameraGroup> groupList = queryAllGroupChildren(group.getId(), group.getBusinessGroup());
groupList.add(group);
if (groupAlias != null) {
CameraGroup group = groupMapper.queryGroupByAlias(groupAlias);
Assert.notNull(group, "组织结构不存在");
String groupDeviceId = group.getDeviceId();
// 获取所有子节点
groupList = queryAllGroupChildren(group.getId(), group.getBusinessGroup());
groupList.add(group);
}
// 构建分页
PageHelper.startPage(page, count);
if (query != null) {
@@ -635,4 +640,12 @@ public class CameraChannelService implements CommandLineRunner {
}
public List<CameraChannel> queryMeetingChannelList(String topGroupAlias) {
CameraGroup cameraGroup = groupMapper.queryGroupByAlias(topGroupAlias);
Assert.notNull(cameraGroup, "域不存在");
String business = cameraGroup.getDeviceId();
Assert.notNull(business, "域不存在");
return channelMapper.queryMeetingChannelList(business);
}
}