Compare commits

..

1 Commits

Author SHA1 Message Date
阿斌
88d076e69d
Pre Merge pull request !43 from 阿斌/N/A 2026-04-27 06:54:06 +00:00
8 changed files with 102 additions and 65 deletions

View File

@ -145,7 +145,7 @@ public interface DeviceChannelMapper {
" LEFT JOIN wvp_device de ON dc.data_device_id = de.id " +
" WHERE dc.data_type = 1 " +
" <if test='deviceId != null'> AND de.device_id = #{deviceId} </if> " +
" <if test='query != null'> AND (dc.device_id LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%'))</if> " +
" <if test='query != null'> AND (dc.device_id LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " +
" <if test='parentChannelId != null'> AND dc.parent_id=#{parentChannelId} </if> " +
" <if test='online == true' > AND dc.status='ON'</if>" +
" <if test='online == false' > AND dc.status='OFF'</if>" +

View File

@ -173,7 +173,7 @@ public interface DeviceMapper {
"media_server_id,"+
"(SELECT count(0) FROM wvp_device_channel dc WHERE dc.data_type = #{dataType} and dc.data_device_id= de.id) as channel_count " +
"FROM wvp_device de" +
"<if test='online != null'> where de.on_line=#{online}</if>"+
"<if test='online != null'> where de.on_line=${online}</if>"+
" order by de.create_time desc "+
" </script>"
)
@ -366,7 +366,7 @@ public interface DeviceMapper {
",(SELECT count(0) FROM wvp_device_channel dc WHERE dc.data_type = #{dataType} and dc.data_device_id= de.id) as channel_count " +
" FROM wvp_device de" +
" where 1 = 1 "+
" <if test='status != null'> AND de.on_line=#{status}</if>"+
" <if test='status != null'> AND de.on_line=${status}</if>"+
" <if test='query != null'> AND (" +
" coalesce(custom_name, name) LIKE concat('%',#{query},'%') escape '/' " +
" OR device_id LIKE concat('%',#{query},'%') escape '/' " +

View File

@ -360,15 +360,16 @@ public class ChannelProvider {
sqlBuild.append("where channel_type = 0 and coalesce(gb_device_id, device_id) in ( ");
Collection<String> ids = (Collection<String>)params.get("deviceIds");
int index = 0;
for (String ignored : ids) {
if (index > 0) {
boolean first = true;
for (String id : ids) {
if (!first) {
sqlBuild.append(",");
}
sqlBuild.append("#{deviceIds[").append(index).append("]}");
index++;
sqlBuild.append("'");
sqlBuild.append(id);
sqlBuild.append("'");
first = false;
}
sqlBuild.append(" )");
return sqlBuild.toString() ;
}
@ -444,13 +445,13 @@ public class ChannelProvider {
sqlBuild.append(" where channel_type = 0 and gb_parent_id in ( ");
Collection<Group> ids = (Collection<Group>)params.get("groupList");
int index = 0;
boolean first = true;
for (Group group : ids) {
if (index > 0) {
if (!first) {
sqlBuild.append(",");
}
sqlBuild.append("#{groupList[").append(index).append("].deviceId}");
index++;
sqlBuild.append(group.getDeviceId());
first = false;
}
sqlBuild.append(" )");
@ -609,11 +610,13 @@ public class ChannelProvider {
List<Device> deviceList = (List<Device>)params.get("deviceList");
if (deviceList != null && !deviceList.isEmpty()) {
sqlBuild.append(" AND data_device_id in (");
for (int i = 0; i < deviceList.size(); i++) {
if (i > 0) {
boolean first = true;
for (Device device : deviceList) {
if (!first) {
sqlBuild.append(",");
}
sqlBuild.append("#{deviceList[").append(i).append("].id}");
sqlBuild.append("'" + device.getId() + "'");
first = false;
}
sqlBuild.append(" )");
}
@ -645,11 +648,13 @@ public class ChannelProvider {
List<CameraGroup> groupList = (List<CameraGroup>)params.get("groupList");
if (groupList != null && !groupList.isEmpty()) {
sqlBuild.append(" AND coalesce(wdc.gb_parent_id, wdc.parent_id) in (");
for (int i = 0; i < groupList.size(); i++) {
if (i > 0) {
boolean first = true;
for (CameraGroup group : groupList) {
if (!first) {
sqlBuild.append(",");
}
sqlBuild.append("#{groupList[").append(i).append("].deviceId}");
sqlBuild.append("'" + group.getDeviceId() + "'");
first = false;
}
sqlBuild.append(" )");
}
@ -714,12 +719,15 @@ public class ChannelProvider {
sqlBuild.append(" where wdc.channel_type = 0 AND wdc.data_type != 2 AND (wdc.gb_ptz_type is null or ( wdc.gb_ptz_type != 98 AND wdc.gb_ptz_type != 99)) " +
" AND coalesce(wdc.gb_parent_id, wdc.parent_id) in (");
sqlBuild.append(" ");
List<CameraGroup> groupList = (List<CameraGroup>)params.get("groupList");
for (int i = 0; i < groupList.size(); i++) {
if (i > 0) {
boolean first = true;
for (CameraGroup group : groupList) {
if (!first) {
sqlBuild.append(",");
}
sqlBuild.append("#{groupList[").append(i).append("].deviceId}");
sqlBuild.append("'" + group.getDeviceId() + "'");
first = false;
}
sqlBuild.append(" )");
@ -739,16 +747,21 @@ public class ChannelProvider {
sqlBuild.append(" where wdc.channel_type = 0 AND wdc.data_type != 2 AND (wdc.gb_ptz_type is null or ( wdc.gb_ptz_type != 98 AND wdc.gb_ptz_type != 99)) " +
" AND coalesce(wdc.gb_parent_id, wdc.parent_id) in (");
sqlBuild.append(" ");
List<CameraGroup> groupList = (List<CameraGroup>)params.get("groupList");
for (int i = 0; i < groupList.size(); i++) {
if (i > 0) {
boolean first = true;
for (CameraGroup group : groupList) {
if (!first) {
sqlBuild.append(",");
}
sqlBuild.append("#{groupList[").append(i).append("].deviceId}");
sqlBuild.append("'" + group.getDeviceId() + "'");
first = false;
}
sqlBuild.append(" )");
sqlBuild.append("AND ST_Distance_Sphere(point(coalesce(wdc.gb_longitude, wdc.longitude), coalesce(wdc.gb_latitude, wdc.latitude)), ST_GeomFromText(CONCAT('point(', #{centerLongitude}, ' ', #{centerLatitude}, ')'))) < #{radius}");
String geomTextBuilder = "point(" + params.get("centerLongitude") + " " + params.get("centerLatitude") + ")";
sqlBuild.append("AND ST_Distance_Sphere(point(coalesce(wdc.gb_longitude, wdc.longitude), coalesce(wdc.gb_latitude, wdc.latitude)), ST_GeomFromText('").append(geomTextBuilder).append("')) < #{radius}");
if (params.get("level") != null) {
sqlBuild.append(" AND ( map_level <= #{level} or map_level is null )");
@ -763,16 +776,21 @@ public class ChannelProvider {
sqlBuild.append(" where wdc.channel_type = 0 AND wdc.data_type != 2 AND (wdc.gb_ptz_type is null or ( wdc.gb_ptz_type != 98 AND wdc.gb_ptz_type != 99)) " +
" AND coalesce(wdc.gb_parent_id, wdc.parent_id) in (");
sqlBuild.append(" ");
List<CameraGroup> groupList = (List<CameraGroup>)params.get("groupList");
for (int i = 0; i < groupList.size(); i++) {
if (i > 0) {
boolean first = true;
for (CameraGroup group : groupList) {
if (!first) {
sqlBuild.append(",");
}
sqlBuild.append("#{groupList[").append(i).append("].deviceId}");
sqlBuild.append("'" + group.getDeviceId() + "'");
first = false;
}
sqlBuild.append(" )");
sqlBuild.append("AND ST_DistanceSphere(ST_MakePoint(coalesce(wdc.gb_longitude, wdc.longitude), coalesce(wdc.gb_latitude, wdc.latitude)), ST_GeomFromText(CONCAT('point(', #{centerLongitude}, ' ', #{centerLatitude}, ')'))) < #{radius}");
String geomTextBuilder = "point(" + params.get("centerLongitude") + " " + params.get("centerLatitude") + ")";
sqlBuild.append("AND ST_DistanceSphere(ST_MakePoint(coalesce(wdc.gb_longitude, wdc.longitude), coalesce(wdc.gb_latitude, wdc.latitude)), ST_GeomFromText('").append(geomTextBuilder).append("')) < #{radius}");
if (params.get("level") != null) {
sqlBuild.append(" AND ( map_level <= #{level} or map_level is null )");
@ -787,25 +805,30 @@ public class ChannelProvider {
sqlBuild.append(" where wdc.channel_type = 0 AND wdc.data_type != 2 AND (wdc.gb_ptz_type is null or ( wdc.gb_ptz_type != 98 AND wdc.gb_ptz_type != 99)) " +
" AND coalesce(wdc.gb_parent_id, wdc.parent_id) in (");
sqlBuild.append(" ");
List<CameraGroup> groupList = (List<CameraGroup>)params.get("groupList");
for (int i = 0; i < groupList.size(); i++) {
if (i > 0) {
boolean first = true;
for (CameraGroup group : groupList) {
if (!first) {
sqlBuild.append(",");
}
sqlBuild.append("#{groupList[").append(i).append("].deviceId}");
sqlBuild.append("'" + group.getDeviceId() + "'");
first = false;
}
sqlBuild.append(" )");
StringBuilder geomSql = new StringBuilder("CONCAT('POLYGON(('");
StringBuilder geomTextBuilder = new StringBuilder();
geomTextBuilder.append("POLYGON((");
List<Point> pointList = (List<Point>)params.get("pointList");
for (int i = 0; i < pointList.size(); i++) {
geomSql.append(", #{pointList[").append(i).append("].lng}, ' ', #{pointList[").append(i).append("].lat}");
if (i < pointList.size() - 1) {
geomSql.append(", ', '");
if (i > 0) {
geomTextBuilder.append(", ");
}
Point point = pointList.get(i);
geomTextBuilder.append(point.getLng()).append(" ").append(point.getLat());
}
geomSql.append(", '))')");
sqlBuild.append("AND ST_Within(point(coalesce(wdc.gb_longitude, wdc.longitude), coalesce(wdc.gb_latitude, wdc.latitude)), ST_GeomFromText(").append(geomSql).append("))");
geomTextBuilder.append("))");
sqlBuild.append("AND ST_Within(point(coalesce(wdc.gb_longitude, wdc.longitude), coalesce(wdc.gb_latitude, wdc.latitude)), ST_GeomFromText('").append(geomTextBuilder).append("'))");
if (params.get("level") != null) {
sqlBuild.append(" AND ( map_level <= #{level} or map_level is null )");
@ -820,25 +843,30 @@ public class ChannelProvider {
sqlBuild.append(" where wdc.channel_type = 0 AND wdc.data_type != 2 AND (wdc.gb_ptz_type is null or ( wdc.gb_ptz_type != 98 AND wdc.gb_ptz_type != 99)) " +
" AND coalesce(wdc.gb_parent_id, wdc.parent_id) in (");
sqlBuild.append(" ");
List<CameraGroup> groupList = (List<CameraGroup>)params.get("groupList");
for (int i = 0; i < groupList.size(); i++) {
if (i > 0) {
boolean first = true;
for (CameraGroup group : groupList) {
if (!first) {
sqlBuild.append(",");
}
sqlBuild.append("#{groupList[").append(i).append("].deviceId}");
sqlBuild.append("'" + group.getDeviceId() + "'");
first = false;
}
sqlBuild.append(" )");
StringBuilder geomSql = new StringBuilder("CONCAT('POLYGON(('");
StringBuilder geomTextBuilder = new StringBuilder();
geomTextBuilder.append("POLYGON((");
List<Point> pointList = (List<Point>)params.get("pointList");
for (int i = 0; i < pointList.size(); i++) {
geomSql.append(", #{pointList[").append(i).append("].lng}, ' ', #{pointList[").append(i).append("].lat}");
if (i < pointList.size() - 1) {
geomSql.append(", ', '");
if (i > 0) {
geomTextBuilder.append(", ");
}
Point point = pointList.get(i);
geomTextBuilder.append(point.getLng()).append(" ").append(point.getLat());
}
geomSql.append(", '))')");
sqlBuild.append("AND ST_Within(ST_MakePoint(coalesce(wdc.gb_longitude, wdc.longitude), coalesce(wdc.gb_latitude, wdc.latitude)), ST_GeomFromText(").append(geomSql).append("))");
geomTextBuilder.append("))");
sqlBuild.append("AND ST_Within(ST_MakePoint(coalesce(wdc.gb_longitude, wdc.longitude), coalesce(wdc.gb_latitude, wdc.latitude)), ST_GeomFromText('").append(geomTextBuilder).append("'))");
if (params.get("level") != null) {
sqlBuild.append(" AND ( map_level <= #{level} or map_level is null )");

View File

@ -104,11 +104,13 @@ public class DeviceChannelProvider {
List<String> channelIds = (List<String>)params.get("channelIds");
if (channelIds != null && !channelIds.isEmpty()) {
sqlBuild.append(" AND dc.device_id in (");
for (int i = 0; i < channelIds.size(); i++) {
if (i > 0) {
boolean first = true;
for (String id : channelIds) {
if (!first) {
sqlBuild.append(",");
}
sqlBuild.append("#{channelIds[").append(i).append("]}");
sqlBuild.append(id);
first = false;
}
sqlBuild.append(" )");
}

View File

@ -27,7 +27,9 @@ public class JTChannelProvider {
sqlBuild.append(BASE_SQL);
sqlBuild.append(" WHERE jc.terminal_db_id = #{terminalDbId} ");
if (params.get("query") != null) {
sqlBuild.append(" AND jc.name LIKE concat('%',#{query},'%')");
sqlBuild.append(" AND ")
.append(" jc.name LIKE ").append("'%").append(params.get("query")).append("%'")
;
}
sqlBuild.append(" ORDER BY jc.channel_id ");
return sqlBuild.toString();

View File

@ -295,7 +295,7 @@ public class jt1078PlayServiceImpl implements Ijt1078PlayService {
return;
}
// 补充鉴权参数
receiveRtpServerService.addAuthenticateInfo(streamId, streamReplace, channel.isHasAudio(), jt1078Config.getRecord(), null);
receiveRtpServerService.addAuthenticateInfo(streamId, streamReplace, !channel.isHasAudio(), jt1078Config.getRecord(), null);
log.info("[JT-点播] phoneNumber {} channelId {}IP: {}, 端口: {}", phoneNumber, channelId, mediaServer.getSdpIp(), port);
J9101 j9101 = new J9101();
@ -514,7 +514,7 @@ public class jt1078PlayServiceImpl implements Ijt1078PlayService {
log.info("[JT-回放] logInfo {} 端口: {}", logInfo, port);
// 补充鉴权参数
receiveRtpServerService.addAuthenticateInfo(streamId, streamReplace, channel.isHasAudio(), jt1078Config.getRecord(), null);
receiveRtpServerService.addAuthenticateInfo(streamId, streamReplace, !channel.isHasAudio(), jt1078Config.getRecord(), null);
J9201 j9201 = new J9201();
j9201.setChannel(channelId);

View File

@ -174,7 +174,7 @@ public class RtpServerServiceImpl implements IReceiveRtpServerService {
ssrcInfo.setAllocatedSsrc(ssrc);
}
openRtpServer(mediaServer, ssrcInfo, checkSsrc, !channel.isHasAudio(), false, tcpMode, callback);
addAuthenticateInfo(streamId, streamReplace, channel.isHasAudio(), record, null);
addAuthenticateInfo(streamId, streamReplace, !channel.isHasAudio(), record, null);
return ssrcInfo;
}
@ -214,7 +214,7 @@ public class RtpServerServiceImpl implements IReceiveRtpServerService {
SSRCInfo ssrcInfo = new SSRCInfo(0, ssrc, MediaStreamUtil.RTP_APP, streamReplace != null ? streamReplace : streamId);
ssrcInfo.setAllocatedSsrc(ssrc);
openRtpServer(mediaServer, ssrcInfo, checkSsrc, !channel.isHasAudio(), false, tcpMode, callback);
addAuthenticateInfo(streamId, streamReplace, channel.isHasAudio(), false,null);
addAuthenticateInfo(streamId, streamReplace, !channel.isHasAudio(), false,null);
return ssrcInfo;
}
@ -260,7 +260,7 @@ public class RtpServerServiceImpl implements IReceiveRtpServerService {
long difference = DateUtil.getDifference(startTime, endTime) / 1000;
addAuthenticateInfo(streamId, null, channel.isHasAudio(), true, (int) difference);
addAuthenticateInfo(streamId, null, !channel.isHasAudio(), true, (int) difference);
return ssrcInfo;
}

View File

@ -19,7 +19,7 @@ public class StreamProxyProvider {
}
public String select(Map<String, Object> params ){
return getBaseSelectSql() + " WHERE st.id = #{id}";
return getBaseSelectSql() + " WHERE st.id = " + params.get("id");
}
public String selectForPushingInMediaServer(Map<String, Object> params ){
@ -27,7 +27,8 @@ public class StreamProxyProvider {
}
public String selectOneByAppAndStream(Map<String, Object> params ){
return getBaseSelectSql() + " WHERE st.app=#{app} AND st.stream=#{stream} order by st.create_time desc";
return getBaseSelectSql() + String.format(" WHERE st.app='%s' AND st.stream='%s' order by st.create_time desc",
params.get("app"), params.get("stream"));
}
public String selectAll(Map<String, Object> params ){
@ -35,11 +36,15 @@ public class StreamProxyProvider {
sqlBuild.append(getBaseSelectSql());
sqlBuild.append(" WHERE 1=1 ");
if (params.get("query") != null) {
sqlBuild.append(" AND (")
.append(" st.app LIKE concat('%',#{query},'%') escape '/'")
.append(" OR st.stream LIKE concat('%',#{query},'%') escape '/'")
.append(" OR wdc.gb_device_id LIKE concat('%',#{query},'%') escape '/'")
.append(" OR wdc.gb_name LIKE concat('%',#{query},'%') escape '/'")
sqlBuild.append(" AND ")
.append(" (")
.append(" st.app LIKE ").append("'%").append(params.get("query")).append("%' escape '/'")
.append(" OR")
.append(" st.stream LIKE ").append("'%").append(params.get("query")).append("%' escape '/'")
.append(" OR")
.append(" wdc.gb_device_id LIKE ").append("'%").append(params.get("query")).append("%' escape '/'")
.append(" OR")
.append(" wdc.gb_name LIKE ").append("'%").append(params.get("query")).append("%' escape '/'")
.append(" )")
;
}
@ -52,7 +57,7 @@ public class StreamProxyProvider {
}
}
if (params.get("mediaServerId") != null) {
sqlBuild.append(" AND st.media_server_id=#{mediaServerId}");
sqlBuild.append(" AND st.media_server_id='").append(params.get("mediaServerId")).append("'");
}
sqlBuild.append(" order by st.create_time desc");
return sqlBuild.toString();