优化国标级联接口

结构优化
648540858 2024-01-23 16:20:36 +08:00
parent 1411de77fe
commit 407828e880
11 changed files with 167 additions and 137 deletions

View File

@ -28,6 +28,43 @@ public class SipConfig {
private boolean alarm; private boolean alarm;
private String name = "WVP视频平台";
/**
*
*/
private String manufacturer = "WVP视频平台";
/**
*
*/
private String model;
/**
*
*/
private String owner;
/**
*
*/
private String civilCode;
/**
*
*/
private String address;
/**
*
*/
private int registerWay = 1;
/**
*
*/
private int secrecy = 0;
public void setIp(String ip) { public void setIp(String ip) {
this.ip = ip; this.ip = ip;
} }
@ -107,4 +144,68 @@ public class SipConfig {
public void setShowIp(String showIp) { public void setShowIp(String showIp) {
this.showIp = showIp; this.showIp = showIp;
} }
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getManufacturer() {
return manufacturer;
}
public void setManufacturer(String manufacturer) {
this.manufacturer = manufacturer;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public String getOwner() {
return owner;
}
public void setOwner(String owner) {
this.owner = owner;
}
public String getCivilCode() {
return civilCode;
}
public void setCivilCode(String civilCode) {
this.civilCode = civilCode;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public int getRegisterWay() {
return registerWay;
}
public void setRegisterWay(int registerWay) {
this.registerWay = registerWay;
}
public int getSecrecy() {
return secrecy;
}
public void setSecrecy(int secrecy) {
this.secrecy = secrecy;
}
} }

View File

@ -129,12 +129,6 @@ public class ParentPlatform {
@Schema(description = "共享的通道数量") @Schema(description = "共享的通道数量")
private int channelCount; private int channelCount;
/**
* Id,
*/
@Schema(description = "默认目录Id,自动添加的通道多放在这个目录下")
private String catalogId;
/** /**
* *
*/ */
@ -165,12 +159,6 @@ public class ParentPlatform {
@Schema(description = "目录分组-每次向上级发送通道信息时单个包携带的通道数量取值1,2,4,8") @Schema(description = "目录分组-每次向上级发送通道信息时单个包携带的通道数量取值1,2,4,8")
private int catalogGroup; private int catalogGroup;
/**
*
*/
@Schema(description = "行政区划")
private String administrativeDivision;
/** /**
* *
*/ */
@ -198,6 +186,9 @@ public class ParentPlatform {
@Schema(description = "是否共享区域") @Schema(description = "是否共享区域")
private boolean shareRegion; private boolean shareRegion;
@Schema(description = "推送系统目录")
private boolean systemCatalog;
public Integer getId() { public Integer getId() {
return id; return id;
} }
@ -358,14 +349,6 @@ public class ParentPlatform {
this.channelCount = channelCount; this.channelCount = channelCount;
} }
public String getCatalogId() {
return catalogId;
}
public void setCatalogId(String catalogId) {
this.catalogId = catalogId;
}
public boolean isCatalogSubscribe() { public boolean isCatalogSubscribe() {
return catalogSubscribe; return catalogSubscribe;
} }
@ -406,14 +389,6 @@ public class ParentPlatform {
this.catalogGroup = catalogGroup; this.catalogGroup = catalogGroup;
} }
public String getAdministrativeDivision() {
return administrativeDivision;
}
public void setAdministrativeDivision(String administrativeDivision) {
this.administrativeDivision = administrativeDivision;
}
public String getUpdateTime() { public String getUpdateTime() {
return updateTime; return updateTime;
} }

View File

@ -677,7 +677,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
SubscribeInfo subscribeInfo, Integer index) throws InvalidArgumentException, ParseException, NoSuchFieldException, SipException, IllegalAccessException { SubscribeInfo subscribeInfo, Integer index) throws InvalidArgumentException, ParseException, NoSuchFieldException, SipException, IllegalAccessException {
if (parentPlatform == null if (parentPlatform == null
|| channelList == null || channelList == null
|| channelList.size() == 0 || channelList.isEmpty()
|| subscribeInfo == null) { || subscribeInfo == null) {
logger.warn("[缺少必要参数]"); logger.warn("[缺少必要参数]");
return; return;

View File

@ -101,7 +101,6 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem
deviceChannel.setName(platform.getName()); deviceChannel.setName(platform.getName());
deviceChannel.setManufacture("wvp-pro"); deviceChannel.setManufacture("wvp-pro");
deviceChannel.setOwner("wvp-pro"); deviceChannel.setOwner("wvp-pro");
deviceChannel.setCivilCode(platform.getAdministrativeDivision());
deviceChannel.setAddress("wvp-pro"); deviceChannel.setAddress("wvp-pro");
deviceChannel.setRegisterWay(0); deviceChannel.setRegisterWay(0);
deviceChannel.setSecrecy("0"); deviceChannel.setSecrecy("0");

View File

@ -21,7 +21,7 @@ public interface IPlatformService {
* @param count * @param count
* @return * @return
*/ */
PageInfo<ParentPlatform> queryParentPlatformList(int page, int count, String query, Boolean online); PageInfo<ParentPlatform> queryParentPlatformList(int page, int count, String query, Boolean online, Boolean enable);
/** /**
* *

View File

@ -95,9 +95,9 @@ public class PlatformServiceImpl implements IPlatformService {
} }
@Override @Override
public PageInfo<ParentPlatform> queryParentPlatformList(int page, int count, String query, Boolean online) { public PageInfo<ParentPlatform> queryParentPlatformList(int page, int count, String query, Boolean online, Boolean enable) {
PageHelper.startPage(page, count); PageHelper.startPage(page, count);
List<ParentPlatform> all = platformMapper.getParentPlatformList(query, online); List<ParentPlatform> all = platformMapper.getParentPlatformList(query, online, enable);
PageInfo<ParentPlatform> platformPageInfo = new PageInfo<>(all); PageInfo<ParentPlatform> platformPageInfo = new PageInfo<>(all);
int allCount = commonChannelMapper.getAllCount(); int allCount = commonChannelMapper.getAllCount();
platformPageInfo.getList().stream().forEach(parentPlatform -> { platformPageInfo.getList().stream().forEach(parentPlatform -> {
@ -115,11 +115,6 @@ public class PlatformServiceImpl implements IPlatformService {
// 每次发送目录的数量默认为1 // 每次发送目录的数量默认为1
parentPlatform.setCatalogGroup(1); parentPlatform.setCatalogGroup(1);
} }
if (parentPlatform.getAdministrativeDivision() == null) {
// 行政区划默认去编号的前6位
parentPlatform.setAdministrativeDivision(parentPlatform.getServerGBId().substring(0,6));
}
parentPlatform.setCatalogId(parentPlatform.getDeviceGBId());
int result = platformMapper.addParentPlatform(parentPlatform); int result = platformMapper.addParentPlatform(parentPlatform);
// 添加缓存 // 添加缓存
ParentPlatformCatch parentPlatformCatch = new ParentPlatformCatch(); ParentPlatformCatch parentPlatformCatch = new ParentPlatformCatch();
@ -171,10 +166,6 @@ public class PlatformServiceImpl implements IPlatformService {
if (parentPlatform.getCatalogGroup() == 0) { if (parentPlatform.getCatalogGroup() == 0) {
parentPlatform.setCatalogGroup(1); parentPlatform.setCatalogGroup(1);
} }
if (parentPlatform.getAdministrativeDivision() == null) {
parentPlatform.setAdministrativeDivision(parentPlatform.getAdministrativeDivision());
}
platformMapper.updateParentPlatform(parentPlatform); platformMapper.updateParentPlatform(parentPlatform);
// 更新redis // 更新redis
redisCatchStorage.delPlatformCatchInfo(parentPlatformOld.getServerGBId()); redisCatchStorage.delPlatformCatchInfo(parentPlatformOld.getServerGBId());
@ -478,7 +469,7 @@ public class PlatformServiceImpl implements IPlatformService {
redisCatchStorage.delPlatformRegister(parentPlatform.getServerGBId()); redisCatchStorage.delPlatformRegister(parentPlatform.getServerGBId());
} }
} }
return true; return platformMapper.delParentPlatform(parentPlatform) > 0;
} }
@Override @Override

View File

@ -19,11 +19,11 @@ public interface ParentPlatformMapper {
@Insert("INSERT INTO wvp_platform (enable, name, server_gb_id, server_gb_domain, server_ip, server_port,device_gb_id,device_ip,"+ @Insert("INSERT INTO wvp_platform (enable, name, server_gb_id, server_gb_domain, server_ip, server_port,device_gb_id,device_ip,"+
"device_port,username,password,expires,keep_timeout,transport,character_set,ptz,rtcp,as_message_channel,auto_push_channel," + "device_port,username,password,expires,keep_timeout,transport,character_set,ptz,rtcp,as_message_channel,auto_push_channel," +
"share_all_channel,share_group,share_region,"+ "share_all_channel,share_group,share_region,"+
"status,start_offline_push,catalog_id,administrative_division,catalog_group,create_time,update_time) " + "status,start_offline_push,catalog_group,create_time,update_time) " +
" VALUES (#{enable}, #{name}, #{serverGBId}, #{serverGBDomain}, #{serverIP}, #{serverPort}, #{deviceGBId}, #{deviceIp}, " + " VALUES (#{enable}, #{name}, #{serverGBId}, #{serverGBDomain}, #{serverIP}, #{serverPort}, #{deviceGBId}, #{deviceIp}, " +
" #{devicePort}, #{username}, #{password}, #{expires}, #{keepTimeout}, #{transport}, #{characterSet}, #{ptz}, " + " #{devicePort}, #{username}, #{password}, #{expires}, #{keepTimeout}, #{transport}, #{characterSet}, #{ptz}, " +
" #{rtcp}, #{asMessageChannel}, #{autoPushChannel}, #{shareAllChannel}, #{shareGroup}, #{shareRegion}, " + " #{rtcp}, #{asMessageChannel}, #{autoPushChannel}, #{shareAllChannel}, #{shareGroup}, #{shareRegion}, " +
" #{status}, #{startOfflinePush}, #{catalogId}, #{administrativeDivision}, #{catalogGroup}, #{createTime}, #{updateTime})") " #{status}, #{startOfflinePush}, #{catalogGroup}, #{createTime}, #{updateTime})")
int addParentPlatform(ParentPlatform parentPlatform); int addParentPlatform(ParentPlatform parentPlatform);
@Update("UPDATE wvp_platform " + @Update("UPDATE wvp_platform " +
@ -52,10 +52,8 @@ public interface ParentPlatformMapper {
"status=#{status}, " + "status=#{status}, " +
"start_offline_push=#{startOfflinePush}, " + "start_offline_push=#{startOfflinePush}, " +
"catalog_group=#{catalogGroup}, " + "catalog_group=#{catalogGroup}, " +
"administrative_division=#{administrativeDivision}, " +
"create_time=#{createTime}, " + "create_time=#{createTime}, " +
"update_time=#{updateTime}, " + "update_time=#{updateTime} " +
"catalog_id=#{catalogId} " +
"WHERE id=#{id}") "WHERE id=#{id}")
int updateParentPlatform(ParentPlatform parentPlatform); int updateParentPlatform(ParentPlatform parentPlatform);
@ -67,13 +65,18 @@ public interface ParentPlatformMapper {
"(SELECT count(0) as channel_count FROM wvp_common_channel_platform wccp WHERE wccp.platform_id = pp.id) " + "(SELECT count(0) as channel_count FROM wvp_common_channel_platform wccp WHERE wccp.platform_id = pp.id) " +
"FROM wvp_platform pp where 1=1 " + "FROM wvp_platform pp where 1=1 " +
"<if test='query != null'> " + "<if test='query != null'> " +
"and (pp.name LIKE '%${query}%' OR de.server_gb_id LIKE '%${query}%' OR de.device_gb_id LIKE '%${query}%')" + "and (pp.name LIKE '%${query}%' OR pp.server_gb_id LIKE '%${query}%' OR pp.device_gb_id LIKE '%${query}%')" +
"</if>" + "</if>" +
"<if test='online != null'> " + "<if test='online != null'> " +
"and status = #{online}" + "and status = #{online}" +
"</if>" + "</if>" +
"<if test='enable != null'> " +
"and enable = #{enable}" +
"</if>" +
"</script>") "</script>")
List<ParentPlatform> getParentPlatformList(@Param("query") String query, @Param("online") Boolean online); List<ParentPlatform> getParentPlatformList(@Param("query") String query,
@Param("online") Boolean online,
@Param("enable") Boolean enable);
@Select("SELECT * FROM wvp_platform WHERE enable=#{enable} ") @Select("SELECT * FROM wvp_platform WHERE enable=#{enable} ")
List<ParentPlatform> getEnableParentPlatformList(boolean enable); List<ParentPlatform> getEnableParentPlatformList(boolean enable);

View File

@ -84,18 +84,19 @@ public class PlatformController {
* @param count * @param count
* @return * @return
*/ */
@GetMapping("/list/{count}/{page}") @GetMapping("/list")
@Operation(summary = "分页查询级联平台", security = @SecurityRequirement(name = JwtUtils.HEADER)) @Operation(summary = "分页查询级联平台", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "page", description = "当前页", required = true) @Parameter(name = "page", description = "当前页", required = true)
@Parameter(name = "count", description = "每页条数", required = true) @Parameter(name = "count", description = "每页条数", required = true)
public PageInfo<ParentPlatform> platforms(int page, int count, public PageInfo<ParentPlatform> platforms(int page, int count,
@RequestParam(required = false)String query, @RequestParam(required = false)String query,
@RequestParam(required = false)Boolean online) { @RequestParam(required = false)Boolean online,
@RequestParam(required = false)Boolean enable) {
if (ObjectUtils.isEmpty(query)) { if (ObjectUtils.isEmpty(query)) {
query = null; query = null;
} }
PageInfo<ParentPlatform> parentPlatformPageInfo = platformService.queryParentPlatformList(page, count, query, online); PageInfo<ParentPlatform> parentPlatformPageInfo = platformService.queryParentPlatformList(page, count, query, online, enable);
if (!parentPlatformPageInfo.getList().isEmpty()) { if (!parentPlatformPageInfo.getList().isEmpty()) {
for (ParentPlatform platform : parentPlatformPageInfo.getList()) { for (ParentPlatform platform : parentPlatformPageInfo.getList()) {
platform.setMobilePositionSubscribe(subscribeHolder.getMobilePositionSubscribe(platform.getId()) != null); platform.setMobilePositionSubscribe(subscribeHolder.getMobilePositionSubscribe(platform.getId()) != null);

View File

@ -164,6 +164,12 @@ alter table wvp_stream_push
alter table wvp_stream_proxy alter table wvp_stream_proxy
drop column src_url; drop column src_url;
alter table wvp_platform
drop column administrative_division;
alter table wvp_platform
drop column catalog_id;

View File

@ -186,12 +186,10 @@ create table wvp_platform (
keep_timeout character varying(50), keep_timeout character varying(50),
transport character varying(50), transport character varying(50),
character_set character varying(50), character_set character varying(50),
catalog_id character varying(50),
ptz bool default false, ptz bool default false,
rtcp bool default false, rtcp bool default false,
status bool default false, status bool default false,
start_offline_push bool default false, start_offline_push bool default false,
administrative_division character varying(50),
catalog_group integer, catalog_group integer,
create_time character varying(50), create_time character varying(50),
update_time character varying(50), update_time character varying(50),
@ -200,32 +198,6 @@ create table wvp_platform (
constraint uk_platform_unique_server_gb_id unique (server_gb_id) constraint uk_platform_unique_server_gb_id unique (server_gb_id)
); );
create table wvp_platform_catalog (
id character varying(50),
platform_id character varying(50),
name character varying(255),
parent_id character varying(50),
civil_code character varying(50),
business_group_id character varying(50),
constraint uk_platform_catalog_id_platform_id unique (id, platform_id)
);
create table wvp_platform_gb_channel (
id serial primary key ,
platform_id character varying(50),
catalog_id character varying(50),
device_channel_id integer,
constraint uk_platform_gb_channel_platform_id_catalog_id_device_channel_id unique (platform_id, catalog_id, device_channel_id)
);
create table wvp_platform_gb_stream (
id serial primary key,
platform_id character varying(50),
catalog_id character varying(50),
gb_stream_id integer,
constraint uk_platform_gb_stream_platform_id_catalog_id_gb_stream_id unique (platform_id, catalog_id, gb_stream_id)
);
create table wvp_stream_proxy ( create table wvp_stream_proxy (
id serial primary key, id serial primary key,
type character varying(50), type character varying(50),
@ -303,15 +275,6 @@ create table wvp_user_role (
create_time character varying(50), create_time character varying(50),
update_time character varying(50) update_time character varying(50)
); );
create table wvp_resources_tree (
id serial primary key ,
is_catalog bool default true,
device_channel_id integer ,
gb_stream_id integer,
name character varying(255),
parentId integer,
path character varying(255)
);
/*初始数据*/ /*初始数据*/

View File

@ -177,7 +177,6 @@ create table wvp_platform (
rtcp bool default false, rtcp bool default false,
status bool default false, status bool default false,
start_offline_push bool default false, start_offline_push bool default false,
administrative_division character varying(50),
catalog_group integer, catalog_group integer,
create_time character varying(50), create_time character varying(50),
update_time character varying(50), update_time character varying(50),
@ -186,14 +185,6 @@ create table wvp_platform (
constraint uk_platform_unique_server_gb_id unique (server_gb_id) constraint uk_platform_unique_server_gb_id unique (server_gb_id)
); );
create table wvp_platform_gb_channel (
id serial primary key ,
platform_id character varying(50),
catalog_id character varying(50),
device_channel_id integer,
constraint uk_platform_gb_channel_platform_id_catalog_id_device_channel_id unique (platform_id, catalog_id, device_channel_id)
);
create table wvp_stream_proxy ( create table wvp_stream_proxy (
id serial primary key, id serial primary key,
type character varying(50), type character varying(50),