添加录制计划的页面与通道查询接口

This commit is contained in:
648540858
2024-11-19 16:42:11 +08:00
parent d2f9102ff0
commit ea2751e29b
12 changed files with 337 additions and 0 deletions

View File

@@ -126,6 +126,9 @@ public class CommonGBChannel {
@Schema(description = "关联的国标设备数据库ID")
private Integer gbDeviceDbId;
@Schema(description = "二进制保存的录制计划, 每一位表示每个小时的前半个小时")
private Long recordPLan;
@Schema(description = "关联的推流Id流来源是推流时有效")
private Integer streamPushId;

View File

@@ -101,11 +101,31 @@ public class CommonChannelController {
return channel;
}
@Operation(summary = "获取通道列表", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "page", description = "当前页", required = true)
@Parameter(name = "count", description = "每页查询数量", required = true)
@Parameter(name = "query", description = "查询内容")
@Parameter(name = "online", description = "是否在线")
@Parameter(name = "hasRecordPlan", description = "是否已设置录制计划")
@Parameter(name = "channelType", description = "通道类型, 0国标设备1推流设备2拉流代理")
@GetMapping("/list")
public PageInfo<CommonGBChannel> queryList(int page, int count,
@RequestParam(required = false) String query,
@RequestParam(required = false) Boolean online,
@RequestParam(required = false) Boolean hasRecordPlan,
@RequestParam(required = false) Integer channelType){
if (ObjectUtils.isEmpty(query)){
query = null;
}
return channelService.queryList(page, count, query, online, hasRecordPlan, channelType);
}
@Operation(summary = "获取关联行政区划通道列表", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "page", description = "当前页", required = true)
@Parameter(name = "count", description = "每页查询数量", required = true)
@Parameter(name = "query", description = "查询内容")
@Parameter(name = "online", description = "是否在线")
@Parameter(name = "channelType", description = "通道类型, 0国标设备1推流设备2拉流代理")
@Parameter(name = "civilCode", description = "行政区划")
@GetMapping("/civilcode/list")
public PageInfo<CommonGBChannel> queryListByCivilCode(int page, int count,
@@ -124,6 +144,7 @@ public class CommonChannelController {
@Parameter(name = "count", description = "每页查询数量", required = true)
@Parameter(name = "query", description = "查询内容")
@Parameter(name = "online", description = "是否在线")
@Parameter(name = "channelType", description = "通道类型, 0国标设备1推流设备2拉流代理")
@Parameter(name = "groupDeviceId", description = "业务分组下的父节点ID")
@GetMapping("/parent/list")
public PageInfo<CommonGBChannel> queryListByParentId(int page, int count,

View File

@@ -457,4 +457,6 @@ public interface CommonGBChannelMapper {
" </script>"})
void updateGpsByDeviceIdForStreamPush(List<CommonGBChannel> channels);
@SelectProvider(type = ChannelProvider.class, method = "queryList")
List<CommonGBChannel> queryList(@Param("query") String query, @Param("online") Boolean online, @Param("hasRecordPlan") Boolean hasRecordPlan, @Param("channelType") Integer channelType);
}

View File

@@ -17,6 +17,7 @@ public class ChannelProvider {
" stream_proxy_id,\n" +
" create_time,\n" +
" update_time,\n" +
" record_plan,\n" +
" coalesce(gb_device_id, device_id) as gb_device_id,\n" +
" coalesce(gb_name, name) as gb_name,\n" +
" coalesce(gb_manufacturer, manufacturer) as gb_manufacturer,\n" +
@@ -182,6 +183,37 @@ public class ChannelProvider {
return sqlBuild.toString();
}
public String queryList(Map<String, Object> params ){
StringBuilder sqlBuild = new StringBuilder();
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},'%') escape '/'" +
" OR coalesce(gb_name, name) LIKE concat('%',#{query},'%') escape '/' )")
;
}
if (params.get("online") != null && (Boolean)params.get("online")) {
sqlBuild.append(" AND coalesce(gb_status, status) = 'ON'");
}
if (params.get("online") != null && !(Boolean)params.get("online")) {
sqlBuild.append(" AND coalesce(gb_status, status) = 'OFF'");
}
if (params.get("hasRecordPlan") != null && !(Boolean)params.get("hasRecordPlan")) {
sqlBuild.append(" AND record_plan == 0");
}
if (params.get("channelType") != null) {
if ((Integer)params.get("channelType") == 0) {
sqlBuild.append(" AND device_db_id is not null");
}else if ((Integer)params.get("channelType") == 1) {
sqlBuild.append(" AND stream_push_id is not null");
}else if ((Integer)params.get("channelType") == 2) {
sqlBuild.append(" AND stream_proxy_id is not null");
}
}
return sqlBuild.toString();
}
public String queryInListByStatus(Map<String, Object> params ){
StringBuilder sqlBuild = new StringBuilder();
sqlBuild.append(BASE_SQL);

View File

@@ -84,4 +84,7 @@ public interface IGbChannelService {
List<CommonGBChannel> queryListByStreamPushList(List<StreamPush> streamPushList);
void updateGpsByDeviceIdForStreamPush(List<CommonGBChannel> channels);
PageInfo<CommonGBChannel> queryList(int page, int count, String query, Boolean online, Boolean hasRecordPlan, Integer channelType);
}

View File

@@ -714,4 +714,16 @@ public class GbChannelServiceImpl implements IGbChannelService {
public void updateGpsByDeviceIdForStreamPush(List<CommonGBChannel> channels) {
commonGBChannelMapper.updateGpsByDeviceIdForStreamPush(channels);
}
@Override
public PageInfo<CommonGBChannel> queryList(int page, int count, String query, Boolean online, Boolean hasRecordPlan, Integer channelType) {
PageHelper.startPage(page, count);
if (query != null) {
query = query.replaceAll("/", "//")
.replaceAll("%", "/%")
.replaceAll("_", "/_");
}
List<CommonGBChannel> all = commonGBChannelMapper.queryList(query, online, hasRecordPlan, channelType);
return new PageInfo<>(all);
}
}

View File

@@ -0,0 +1,15 @@
package com.genersoft.iot.vmp.vmanager.recordPlan;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Tag(name = "录制计划")
@Slf4j
@RestController
@RequestMapping("/api/record/plan")
public class RecordPlanController {
}