增加通道编辑以及通道重置功能
parent
92c6a10083
commit
d9c0d0637c
|
@ -211,6 +211,14 @@ public class CommonGBChannel {
|
||||||
@Schema(description = "关联的拉流代理Id(流来源是拉流代理时有效)")
|
@Schema(description = "关联的拉流代理Id(流来源是拉流代理时有效)")
|
||||||
private Integer streamProxyId;
|
private Integer streamProxyId;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
private String createTime;
|
||||||
|
|
||||||
|
@Schema(description = "更新时间")
|
||||||
|
private String updateTime;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public String encode(){
|
public String encode(){
|
||||||
return encode(null);
|
return encode(null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,12 +171,6 @@ public class DeviceChannel extends CommonGBChannel {
|
||||||
@Schema(description = "云台类型描述字符串")
|
@Schema(description = "云台类型描述字符串")
|
||||||
private String ptzTypeText;
|
private String ptzTypeText;
|
||||||
|
|
||||||
@Schema(description = "创建时间")
|
|
||||||
private String createTime;
|
|
||||||
|
|
||||||
@Schema(description = "更新时间")
|
|
||||||
private String updateTime;
|
|
||||||
|
|
||||||
@Schema(description = "子设备数")
|
@Schema(description = "子设备数")
|
||||||
private int subCount;
|
private int subCount;
|
||||||
|
|
||||||
|
|
|
@ -15,9 +15,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -66,4 +64,18 @@ public class CommonChannelController {
|
||||||
public List<NetworkIdentificationType> getNetworkIdentificationTypeList(){
|
public List<NetworkIdentificationType> getNetworkIdentificationTypeList(){
|
||||||
return channelService.getNetworkIdentificationTypeList();
|
return channelService.getNetworkIdentificationTypeList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "更新通道", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||||
|
@ResponseBody
|
||||||
|
@PostMapping("/update")
|
||||||
|
public void update(@RequestBody CommonGBChannel channel){
|
||||||
|
channelService.update(channel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "重置国标通道", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||||
|
@ResponseBody
|
||||||
|
@PostMapping("/reset")
|
||||||
|
public void reset(Integer id){
|
||||||
|
channelService.reset(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,17 +155,11 @@ public interface CommonGBChannelMapper {
|
||||||
|
|
||||||
@Select(" select\n" +
|
@Select(" select\n" +
|
||||||
" id as gb_id,\n" +
|
" id as gb_id,\n" +
|
||||||
" device_db_id,\n" +
|
" device_db_id as gb_device_db_id,\n" +
|
||||||
" stream_push_id,\n" +
|
" stream_push_id,\n" +
|
||||||
" stream_proxy_id,\n" +
|
" stream_proxy_id,\n" +
|
||||||
" create_time,\n" +
|
" create_time,\n" +
|
||||||
" update_time,\n" +
|
" update_time,\n" +
|
||||||
" sub_count,\n" +
|
|
||||||
" stream_id,\n" +
|
|
||||||
" has_audio,\n" +
|
|
||||||
" gps_time,\n" +
|
|
||||||
" stream_identification,\n" +
|
|
||||||
" device_db_id as gb_device_db_id,\n" +
|
|
||||||
" coalesce(gb_device_id, device_id) as gb_device_id,\n" +
|
" coalesce(gb_device_id, device_id) as gb_device_id,\n" +
|
||||||
" coalesce(gb_name, name) as gb_name,\n" +
|
" coalesce(gb_name, name) as gb_name,\n" +
|
||||||
" coalesce(gb_manufacturer, manufacturer) as gb_manufacturer,\n" +
|
" coalesce(gb_manufacturer, manufacturer) as gb_manufacturer,\n" +
|
||||||
|
@ -210,20 +204,6 @@ public interface CommonGBChannelMapper {
|
||||||
@Update(value = {" <script>" +
|
@Update(value = {" <script>" +
|
||||||
"UPDATE wvp_device_channel " +
|
"UPDATE wvp_device_channel " +
|
||||||
"SET update_time=#{updateTime}" +
|
"SET update_time=#{updateTime}" +
|
||||||
"<if test='streamPushId != null'>, stream_push_id = #{streamPushId}</if>" +
|
|
||||||
"<if test='streamPushId == null'>, stream_push_id = null</if>" +
|
|
||||||
"<if test='streamProxyId != null'>, stream_proxy_id = #{streamProxyId}</if>" +
|
|
||||||
"<if test='streamProxyId == null'>, stream_proxy_id = null</if>" +
|
|
||||||
"<if test='subCount != null'>, sub_count = #{subCount}</if>" +
|
|
||||||
"<if test='subCount == null'>, sub_count = null</if>" +
|
|
||||||
"<if test='streamId != null'>, stream_id = #{streamId}</if>" +
|
|
||||||
"<if test='streamId == null'>, stream_id = null</if>" +
|
|
||||||
"<if test='hasAudio != null'>, has_audio = #{hasAudio}</if>" +
|
|
||||||
"<if test='hasAudio == null'>, has_audio = null</if>" +
|
|
||||||
"<if test='gpsTime != null'>, gps_time = #{gpsTime}</if>" +
|
|
||||||
"<if test='gpsTime == null'>, gps_time = null</if>" +
|
|
||||||
"<if test='streamIdentification != null'>, stream_identification = #{streamIdentification}</if>" +
|
|
||||||
"<if test='streamIdentification == null'>, stream_identification = null</if>" +
|
|
||||||
"<if test='gbDeviceId != null'>, gb_device_id = #{gbDeviceId}</if>" +
|
"<if test='gbDeviceId != null'>, gb_device_id = #{gbDeviceId}</if>" +
|
||||||
"<if test='gbDeviceId == null'>, gb_device_id = null</if>" +
|
"<if test='gbDeviceId == null'>, gb_device_id = null</if>" +
|
||||||
"<if test='gbName != null'>, gb_name = #{gbName}</if>" +
|
"<if test='gbName != null'>, gb_name = #{gbName}</if>" +
|
||||||
|
@ -234,8 +214,8 @@ public interface CommonGBChannelMapper {
|
||||||
"<if test='gbModel == null'>, gb_model = null</if>" +
|
"<if test='gbModel == null'>, gb_model = null</if>" +
|
||||||
"<if test='gbOwner != null' >, gb_owner = #{gbOwner}</if>" +
|
"<if test='gbOwner != null' >, gb_owner = #{gbOwner}</if>" +
|
||||||
"<if test='gbOwner == null'>, gb_owner = null</if>" +
|
"<if test='gbOwner == null'>, gb_owner = null</if>" +
|
||||||
"<if test='gbCivilCode, != null' >, gb_civil_code = #{gbCivilCode}</if>" +
|
"<if test='gbCivilCode != null' >, gb_civil_code = #{gbCivilCode}</if>" +
|
||||||
"<if test='gbCivilCode, == null'>, gb_civil_code = null</if>" +
|
"<if test='gbCivilCode == null'>, gb_civil_code = null</if>" +
|
||||||
"<if test='gbBlock != null' >, gb_block = #{gbBlock}</if>" +
|
"<if test='gbBlock != null' >, gb_block = #{gbBlock}</if>" +
|
||||||
"<if test='gbBlock == null'>, gb_block = null</if>" +
|
"<if test='gbBlock == null'>, gb_block = null</if>" +
|
||||||
"<if test='gbAddress != null' >, gb_address = #{gbAddress}</if>" +
|
"<if test='gbAddress != null' >, gb_address = #{gbAddress}</if>" +
|
||||||
|
@ -476,4 +456,21 @@ public interface CommonGBChannelMapper {
|
||||||
"from wvp_device_channel wdc left join wvp_platform_gb_channel wpgc on wdc.id = wpgc.device_channel_id\n" +
|
"from wvp_device_channel wdc left join wvp_platform_gb_channel wpgc on wdc.id = wpgc.device_channel_id\n" +
|
||||||
"where wpgc.platform_id = #{platformId}"})
|
"where wpgc.platform_id = #{platformId}"})
|
||||||
List<CommonGBChannel> queryByPlatformId(@Param("platformId") Integer platformId);
|
List<CommonGBChannel> queryByPlatformId(@Param("platformId") Integer platformId);
|
||||||
|
|
||||||
|
|
||||||
|
@Update(value = {" <script>" +
|
||||||
|
" UPDATE wvp_device_channel " +
|
||||||
|
" SET update_time=#{updateTime}, gb_device_id = null, gb_name = null, gb_manufacturer = null," +
|
||||||
|
" gb_model = null, gb_owner = null, gb_civil_code = null, gb_block = null, gb_address = null," +
|
||||||
|
" gb_parental = null, gb_parent_id = null, gb_safety_way = null, gb_register_way = null, gb_cert_num = null," +
|
||||||
|
" gb_certifiable = null, gb_err_code = null, gb_end_time = null, gb_secrecy = null, gb_ip_address = null, " +
|
||||||
|
" gb_port = null, gb_password = null, gb_status = null, gb_longitude = null, gb_latitude = null, " +
|
||||||
|
" gb_ptz_type = null, gb_position_type = null, gb_room_type = null, gb_use_type = null, gb_supply_light_type = null, " +
|
||||||
|
" gb_direction_type = null, gb_resolution = null, gb_business_group_id = null, gb_download_speed = null, gb_svc_space_support_mod = null, " +
|
||||||
|
" gb_direction_type = null, gb_resolution = null, gb_business_group_id = null, gb_download_speed = null, gb_svc_space_support_mod = null, " +
|
||||||
|
" gb_svc_time_support_mode = null" +
|
||||||
|
" WHERE id = #{id} and device_db_id = #{gbDeviceDbId}"+
|
||||||
|
" </script>"})
|
||||||
|
void reset(@Param("id") int id, @Param("gbDeviceDbId") int gbDeviceDbId, @Param("updateTime") String updateTime);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,4 +38,6 @@ public interface IGbChannelService {
|
||||||
List<DeviceType> getDeviceTypeList();
|
List<DeviceType> getDeviceTypeList();
|
||||||
|
|
||||||
List<NetworkIdentificationType> getNetworkIdentificationTypeList();
|
List<NetworkIdentificationType> getNetworkIdentificationTypeList();
|
||||||
|
|
||||||
|
void reset(int id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
package com.genersoft.iot.vmp.gb28181.service.impl;
|
package com.genersoft.iot.vmp.gb28181.service.impl;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||||
import com.genersoft.iot.vmp.gb28181.dao.CommonGBChannelMapper;
|
import com.genersoft.iot.vmp.gb28181.dao.CommonGBChannelMapper;
|
||||||
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
||||||
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
|
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
|
||||||
import com.genersoft.iot.vmp.gb28181.service.IGbChannelService;
|
import com.genersoft.iot.vmp.gb28181.service.IGbChannelService;
|
||||||
|
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||||
|
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -51,6 +54,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int update(CommonGBChannel commonGBChannel) {
|
public int update(CommonGBChannel commonGBChannel) {
|
||||||
|
log.warn("[更新通道] 通道ID: {}, ", commonGBChannel.getGbId());
|
||||||
if (commonGBChannel.getGbId() <= 0) {
|
if (commonGBChannel.getGbId() <= 0) {
|
||||||
log.warn("[更新通道] 未找到数据库ID,更新失败, {}", commonGBChannel.getGbDeviceDbId());
|
log.warn("[更新通道] 未找到数据库ID,更新失败, {}", commonGBChannel.getGbDeviceDbId());
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -267,4 +271,20 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||||
Collections.sort(result);
|
Collections.sort(result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reset(int id) {
|
||||||
|
log.info("[重置国标通道] id: {}", id);
|
||||||
|
CommonGBChannel channel = getOne(id);
|
||||||
|
if (channel == null ) {
|
||||||
|
log.warn("[重置国标通道] 未找到对应Id的通道: id: {}", id);
|
||||||
|
throw new ControllerException(ErrorCode.ERROR400);
|
||||||
|
}
|
||||||
|
if (channel.getGbDeviceDbId() <= 0) {
|
||||||
|
log.warn("[重置国标通道] 非国标下级通道无法重置: id: {}", id);
|
||||||
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "非国标下级通道无法重置");
|
||||||
|
}
|
||||||
|
// 这个多加一个参数,为了防止将非国标的通道通过此方法清空内容,导致意外发生
|
||||||
|
commonGBChannelMapper.reset(id, channel.getGbDeviceDbId(), DateUtil.getNow());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
<template>
|
<template>
|
||||||
<div id="ChannelEdit" v-loading="locading" style="width: 100%">
|
<div id="ChannelEdit" v-loading="locading" style="width: 100%">
|
||||||
<div v-if="!form.gbId" class="page-header">
|
<div v-if="form.gbId" class="page-header">
|
||||||
<div class="page-title">
|
<div class="page-title">
|
||||||
<el-button icon="el-icon-back" size="mini" style="font-size: 20px; color: #000;" type="text" @click="showDevice" ></el-button>
|
<el-button icon="el-icon-back" size="mini" style="font-size: 20px; color: #000;" type="text" @click="close" ></el-button>
|
||||||
<el-divider direction="vertical"></el-divider>
|
<el-divider direction="vertical"></el-divider>
|
||||||
编辑通道
|
编辑通道
|
||||||
</div>
|
</div>
|
||||||
<div class="page-header-btn">
|
<div class="page-header-btn">
|
||||||
<div style="display: inline;">
|
<div style="display: inline;">
|
||||||
<el-button icon="el-icon-close" size="mini" style="font-size: 20px; color: #000;" type="text" @click="showDevice" ></el-button>
|
<el-button icon="el-icon-close" size="mini" style="font-size: 20px; color: #000;" type="text" @click="close" ></el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -208,6 +208,7 @@
|
||||||
<div style="float: right;">
|
<div style="float: right;">
|
||||||
<el-button type="primary" @click="onSubmit">保存</el-button>
|
<el-button type="primary" @click="onSubmit">保存</el-button>
|
||||||
<el-button @click="close">取消</el-button>
|
<el-button @click="close">取消</el-button>
|
||||||
|
<el-button v-if="form.gbDeviceDbId" @click="reset">重置</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -221,7 +222,7 @@ import channelCode from './dialog/channelCode'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "channelEdit",
|
name: "channelEdit",
|
||||||
props: [ 'id',],
|
props: [ 'id', 'closeEdit'],
|
||||||
components: {
|
components: {
|
||||||
channelCode,
|
channelCode,
|
||||||
},
|
},
|
||||||
|
@ -237,12 +238,51 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onSubmit: function () {
|
onSubmit: function () {
|
||||||
|
this.form.gbDownloadSpeed = this.form.gbDownloadSpeedArray.join("/")
|
||||||
|
this.$axios({
|
||||||
|
method: 'post',
|
||||||
|
url: "/api/common/channel/update",
|
||||||
|
data: this.form
|
||||||
|
}).then((res) => {
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
this.$message.success("保存成功");
|
||||||
|
this.close()
|
||||||
|
}
|
||||||
|
}).catch((error) => {
|
||||||
|
console.error(error)
|
||||||
|
}).finally(()=>[
|
||||||
|
this.locading = false
|
||||||
|
])
|
||||||
},
|
},
|
||||||
close: function () {
|
close: function () {
|
||||||
|
this.closeEdit()
|
||||||
},
|
},
|
||||||
showDevice: function () {
|
reset: function () {
|
||||||
|
this.$confirm("确定重置为默认内容?", '提示', {
|
||||||
|
dangerouslyUseHTMLString: true,
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.$axios({
|
||||||
|
method: 'post',
|
||||||
|
url: "/api/common/channel/reset",
|
||||||
|
params: {
|
||||||
|
id: this.form.gbId
|
||||||
|
}
|
||||||
|
}).then((res) => {
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
this.$message.success("重置成功 已保存");
|
||||||
|
this.getCommonChannel()
|
||||||
|
}
|
||||||
|
}).catch((error) => {
|
||||||
|
console.error(error)
|
||||||
|
}).finally(()=>[
|
||||||
|
this.locading = false
|
||||||
|
])
|
||||||
|
}).catch(() => {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
test: function () {
|
test: function () {
|
||||||
|
|
|
@ -161,7 +161,7 @@
|
||||||
</el-pagination>
|
</el-pagination>
|
||||||
</el-main>
|
</el-main>
|
||||||
</el-container>
|
</el-container>
|
||||||
<channel-edit v-if="editId" :id="editId"></channel-edit>
|
<channel-edit v-if="editId" :id="editId" :closeEdit="closeEdit"></channel-edit>
|
||||||
<!--设备列表-->
|
<!--设备列表-->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -549,7 +549,13 @@ export default {
|
||||||
// 编辑
|
// 编辑
|
||||||
handleEdit(row) {
|
handleEdit(row) {
|
||||||
this.editId = row.id
|
this.editId = row.id
|
||||||
|
},
|
||||||
|
// 结束编辑
|
||||||
|
closeEdit: function (){
|
||||||
|
this.editId = null
|
||||||
|
this.getDeviceChannelList()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue