648540858 11 månader sedan
förälder
incheckning
86879aa58d

+ 2 - 5
src/main/java/com/genersoft/iot/vmp/gb28181/controller/MediaController.java

@@ -18,16 +18,13 @@ import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 
 
 @Tag(name  = "媒体流相关")
-@Controller
+@RestController
 @Slf4j
 @RequestMapping(value = "/api/media")
 public class MediaController {

+ 4 - 4
src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/ChannelProvider.java

@@ -122,8 +122,8 @@ public class ChannelProvider {
         sqlBuild.append(BASE_SQL);
         sqlBuild.append(" where channel_type = 0 ");
         if (params.get("query") != null) {
-            sqlBuild.append(" AND (coalesce(gb_device_id, device_id) LIKE concat('%',#{query},'%')" +
-                    " OR coalesce(gb_name, name) LIKE concat('%',#{query},'%') )")
+            sqlBuild.append(" AND (coalesce(gb_device_id, device_id) LIKE concat('%',#{query},'%') escape '/'" +
+                    " OR coalesce(gb_name, name) LIKE concat('%',#{query},'%') escape '/' )")
             ;
         }
         if (params.get("online") != null && (Boolean)params.get("online")) {
@@ -154,8 +154,8 @@ public class ChannelProvider {
         sqlBuild.append(BASE_SQL);
         sqlBuild.append(" where channel_type = 0 ");
         if (params.get("query") != null) {
-            sqlBuild.append(" AND (coalesce(gb_device_id, device_id) LIKE concat('%',#{query},'%')" +
-                    " OR coalesce(gb_name, name) LIKE concat('%',#{query},'%') )")
+            sqlBuild.append(" AND (coalesce(gb_device_id, device_id) LIKE concat('%',#{query},'%') escape '/'" +
+                    " OR coalesce(gb_name, name) LIKE concat('%',#{query},'%') escape '/' )")
             ;
         }
         if (params.get("online") != null && (Boolean)params.get("online")) {

+ 2 - 2
src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/DeviceChannelProvider.java

@@ -71,8 +71,8 @@ public class DeviceChannelProvider {
                     "OR (LENGTH(coalesce(dc.gb_device_id, dc.device_id))=LENGTH(#{civilCode}) + 2) AND coalesce(dc.gb_device_id, dc.device_id) LIKE concat(#{civilCode},'%'))");
         }
         if (params.get("query") != null && !ObjectUtils.isEmpty(params.get("query"))) {
-            sqlBuild.append(" AND (coalesce(dc.gb_device_id, dc.device_id) LIKE concat('%',#{query},'%')" +
-                    " OR coalesce(dc.gb_name, dc.name) LIKE concat('%',#{query},'%'))")
+            sqlBuild.append(" AND (coalesce(dc.gb_device_id, dc.device_id) LIKE concat('%',#{query},'%') escape '/'" +
+                    " OR coalesce(dc.gb_name, dc.name) LIKE concat('%',#{query},'%') escape '/')")
             ;
         }
         if (params.get("online") != null && (Boolean)params.get("online")) {

+ 10 - 1
src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/DeviceChannelServiceImpl.java

@@ -609,6 +609,11 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
                 parentId = channelId;
             }
         }
+        if (query != null) {
+            query = query.replaceAll("/", "//")
+                    .replaceAll("%", "/%")
+                    .replaceAll("_", "/_");
+        }
         List<DeviceChannel> all = channelMapper.queryChannels(deviceDbId, civilCode, businessGroupId, parentId, query, channelType, online,null);
         return new PageInfo<>(all);
     }
@@ -624,7 +629,11 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
         if (device == null) {
             throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到设备:" + deviceId);
         }
-        // 获取到所有正在播放的流
+        if (query != null) {
+            query = query.replaceAll("/", "//")
+                    .replaceAll("%", "/%")
+                    .replaceAll("_", "/_");
+        }
         PageHelper.startPage(page, count);
         List<DeviceChannel> all = channelMapper.queryChannels(device.getId(), null,null, null, query, hasSubChannel, online,null);
         return new PageInfo<>(all);

+ 10 - 0
src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelServiceImpl.java

@@ -390,6 +390,11 @@ public class GbChannelServiceImpl implements IGbChannelService {
     @Override
     public PageInfo<CommonGBChannel> queryListByCivilCode(int page, int count, String query, Boolean online, Integer channelType, String civilCode) {
         PageHelper.startPage(page, count);
+        if (query != null) {
+            query = query.replaceAll("/", "//")
+                    .replaceAll("%", "/%")
+                    .replaceAll("_", "/_");
+        }
         List<CommonGBChannel> all = commonGBChannelMapper.queryListByCivilCode(query, online, channelType, civilCode);
         return new PageInfo<>(all);
     }
@@ -397,6 +402,11 @@ public class GbChannelServiceImpl implements IGbChannelService {
     @Override
     public PageInfo<CommonGBChannel> queryListByParentId(int page, int count, String query, Boolean online, Integer channelType, String groupDeviceId) {
         PageHelper.startPage(page, count);
+        if (query != null) {
+            query = query.replaceAll("/", "//")
+                    .replaceAll("%", "/%")
+                    .replaceAll("_", "/_");
+        }
         List<CommonGBChannel> all = commonGBChannelMapper.queryListByParentId(query, online, channelType, groupDeviceId);
         return new PageInfo<>(all);
     }

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/streamProxy/controller/StreamProxyController.java

@@ -30,7 +30,7 @@ import java.util.Map;
  * 拉流代理接口
  */
 @Tag(name = "拉流代理", description = "")
-@Controller
+@RestController
 @Slf4j
 @RequestMapping(value = "/api/proxy")
 public class StreamProxyController {

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/streamPush/controller/StreamPushController.java

@@ -43,7 +43,7 @@ import java.util.Map;
 import java.util.UUID;
 
 @Tag(name  = "推流信息管理")
-@Controller
+@RestController
 @Slf4j
 @RequestMapping(value = "/api/push")
 public class StreamPushController {