完成通道共享
parent
976c089b7f
commit
326025ee85
|
@ -0,0 +1,10 @@
|
||||||
|
package com.genersoft.iot.vmp.gb28181.bean;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class PlatformChannel extends CommonGBChannel{
|
||||||
|
private int platformId;
|
||||||
|
}
|
|
@ -1,6 +1,5 @@
|
||||||
package com.genersoft.iot.vmp.gb28181.controller;
|
package com.genersoft.iot.vmp.gb28181.controller;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
||||||
import com.genersoft.iot.vmp.conf.DynamicTask;
|
import com.genersoft.iot.vmp.conf.DynamicTask;
|
||||||
|
@ -9,12 +8,11 @@ import com.genersoft.iot.vmp.conf.UserSetting;
|
||||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||||
import com.genersoft.iot.vmp.conf.security.JwtUtils;
|
import com.genersoft.iot.vmp.conf.security.JwtUtils;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||||
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelReduce;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.controller.bean.UpdateChannelParam;
|
import com.genersoft.iot.vmp.gb28181.controller.bean.UpdateChannelParam;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.service.IDeviceChannelService;
|
import com.genersoft.iot.vmp.gb28181.service.IDeviceChannelService;
|
||||||
import com.genersoft.iot.vmp.gb28181.service.IPlatformChannelService;
|
import com.genersoft.iot.vmp.gb28181.service.IPlatformChannelService;
|
||||||
import com.genersoft.iot.vmp.gb28181.service.IPlatformService;
|
import com.genersoft.iot.vmp.gb28181.service.IPlatformService;
|
||||||
|
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||||
|
@ -33,7 +31,6 @@ import org.springframework.web.bind.annotation.*;
|
||||||
import javax.sip.InvalidArgumentException;
|
import javax.sip.InvalidArgumentException;
|
||||||
import javax.sip.SipException;
|
import javax.sip.SipException;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 级联平台管理
|
* 级联平台管理
|
||||||
|
@ -289,17 +286,6 @@ public class PlatformController {
|
||||||
return parentPlatform != null;
|
return parentPlatform != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询级联平台的所有所有通道
|
|
||||||
*
|
|
||||||
* @param page 当前页
|
|
||||||
* @param count 每页条数
|
|
||||||
* @param platformId 上级平台ID
|
|
||||||
* @param query 查询内容
|
|
||||||
* @param online 是否在线
|
|
||||||
* @param channelType 通道类型
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@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)
|
||||||
|
@ -309,7 +295,7 @@ public class PlatformController {
|
||||||
@Parameter(name = "hasShare", description = "是否已经共享")
|
@Parameter(name = "hasShare", description = "是否已经共享")
|
||||||
@GetMapping("/channel/list")
|
@GetMapping("/channel/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public PageInfo<CommonGBChannel> channelList(int page, int count,
|
public PageInfo<PlatformChannel> queryChannelList(int page, int count,
|
||||||
@RequestParam(required = false) Integer platformId,
|
@RequestParam(required = false) Integer platformId,
|
||||||
@RequestParam(required = false) String query,
|
@RequestParam(required = false) String query,
|
||||||
@RequestParam(required = false) Boolean online,
|
@RequestParam(required = false) Boolean online,
|
||||||
|
@ -323,29 +309,22 @@ public class PlatformController {
|
||||||
return platformChannelService.queryChannelList(page, count, query, online, platformId, hasShare);
|
return platformChannelService.queryChannelList(page, count, query, online, platformId, hasShare);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 向上级平台添加国标通道
|
|
||||||
*
|
|
||||||
* @param param 通道关联参数
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Operation(summary = "向上级平台添加国标通道", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
@Operation(summary = "向上级平台添加国标通道", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||||
@PostMapping("/update_channel_for_gb")
|
@PostMapping("/channel/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public void updateChannelForGB(@RequestBody UpdateChannelParam param) {
|
public void addChannel(@RequestBody UpdateChannelParam param) {
|
||||||
|
|
||||||
if (log.isDebugEnabled()) {
|
if (log.isDebugEnabled()) {
|
||||||
log.debug("给上级平台添加国标通道API调用");
|
log.debug("给上级平台添加国标通道API调用");
|
||||||
}
|
}
|
||||||
int result = 0;
|
int result = 0;
|
||||||
if (param.getChannelReduces() == null || param.getChannelReduces().size() == 0) {
|
if (param.getChannelIds() == null || param.getChannelIds().isEmpty()) {
|
||||||
if (param.isAll()) {
|
if (param.isAll()) {
|
||||||
log.info("[国标级联]添加所有通道到上级平台, {}", param.getPlatformId());
|
log.info("[国标级联]添加所有通道到上级平台, {}", param.getPlatformId());
|
||||||
List<ChannelReduce> allChannelForDevice = deviceChannelService.queryAllChannelList(param.getPlatformId());
|
result = platformChannelService.addAllChannel(param.getPlatformId());
|
||||||
result = platformChannelService.updateChannelForGB(param.getPlatformId(), allChannelForDevice, param.getCatalogId());
|
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
result = platformChannelService.updateChannelForGB(param.getPlatformId(), param.getChannelReduces(), param.getCatalogId());
|
result = platformChannelService.addChannels(param.getPlatformId(), param.getChannelIds());
|
||||||
}
|
}
|
||||||
if (result <= 0) {
|
if (result <= 0) {
|
||||||
throw new ControllerException(ErrorCode.ERROR100);
|
throw new ControllerException(ErrorCode.ERROR100);
|
||||||
|
@ -359,7 +338,7 @@ public class PlatformController {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Operation(summary = "从上级平台移除国标通道", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
@Operation(summary = "从上级平台移除国标通道", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||||
@DeleteMapping("/del_channel_for_gb")
|
@DeleteMapping("/channel/remove")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public void delChannelForGB(@RequestBody UpdateChannelParam param) {
|
public void delChannelForGB(@RequestBody UpdateChannelParam param) {
|
||||||
|
|
||||||
|
@ -367,39 +346,16 @@ public class PlatformController {
|
||||||
log.debug("给上级平台删除国标通道API调用");
|
log.debug("给上级平台删除国标通道API调用");
|
||||||
}
|
}
|
||||||
int result = 0;
|
int result = 0;
|
||||||
if (param.getChannelReduces() == null || param.getChannelReduces().size() == 0) {
|
if (param.getChannelIds() == null || param.getChannelIds().isEmpty()) {
|
||||||
if (param.isAll()) {
|
if (param.isAll()) {
|
||||||
log.info("[国标级联]移除所有通道,上级平台, {}", param.getPlatformId());
|
log.info("[国标级联]移除所有通道,上级平台, {}", param.getPlatformId());
|
||||||
result = platformChannelService.delAllChannelForGB(param.getPlatformId(), param.getCatalogId());
|
result = platformChannelService.removeAllChannel(param.getPlatformId());
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
result = storager.delChannelForGB(param.getPlatformId(), param.getChannelReduces());
|
result = platformChannelService.removeChannels(param.getPlatformId(), param.getChannelIds());
|
||||||
}
|
}
|
||||||
if (result <= 0) {
|
if (result <= 0) {
|
||||||
throw new ControllerException(ErrorCode.ERROR100);
|
throw new ControllerException(ErrorCode.ERROR100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除关联
|
|
||||||
*
|
|
||||||
* @param platformCatalog 关联的信息
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Operation(summary = "删除关联", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
|
||||||
@DeleteMapping("/catalog/relation/del")
|
|
||||||
@ResponseBody
|
|
||||||
public void delRelation(@RequestBody PlatformCatalog platformCatalog) {
|
|
||||||
|
|
||||||
if (log.isDebugEnabled()) {
|
|
||||||
log.debug("删除关联,{}", JSON.toJSONString(platformCatalog));
|
|
||||||
}
|
|
||||||
// int delResult = storager.delRelation(platformCatalog);
|
|
||||||
//
|
|
||||||
// if (delResult <= 0) {
|
|
||||||
// throw new ControllerException(ErrorCode.ERROR100.getCode(), "写入数据库失败");
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,57 +1,21 @@
|
||||||
package com.genersoft.iot.vmp.gb28181.controller.bean;
|
package com.genersoft.iot.vmp.gb28181.controller.bean;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
@Data
|
||||||
* 通道关联参数
|
|
||||||
* @author lin
|
|
||||||
*/
|
|
||||||
@Schema(description = "通道关联参数")
|
@Schema(description = "通道关联参数")
|
||||||
public class UpdateChannelParam {
|
public class UpdateChannelParam {
|
||||||
|
|
||||||
@Schema(description = "上级平台的国标编号")
|
@Schema(description = "上级平台的数据库ID")
|
||||||
private String platformId;
|
private Integer platformId;
|
||||||
|
|
||||||
@Schema(description = "目录的国标编号")
|
|
||||||
private String catalogId;
|
|
||||||
|
|
||||||
@Schema(description = "处理所有通道")
|
@Schema(description = "关联所有通道")
|
||||||
private boolean all;
|
private boolean all;
|
||||||
|
|
||||||
@Schema(description = "")
|
@Schema(description = "待关联的通道ID")
|
||||||
private List<ChannelReduce> channelReduces;
|
List<Integer> channelIds;
|
||||||
|
|
||||||
public String getPlatformId() {
|
|
||||||
return platformId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPlatformId(String platformId) {
|
|
||||||
this.platformId = platformId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ChannelReduce> getChannelReduces() {
|
|
||||||
return channelReduces;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setChannelReduces(List<ChannelReduce> channelReduces) {
|
|
||||||
this.channelReduces = channelReduces;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCatalogId() {
|
|
||||||
return catalogId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCatalogId(String catalogId) {
|
|
||||||
this.catalogId = catalogId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAll() {
|
|
||||||
return all;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAll(boolean all) {
|
|
||||||
this.all = all;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,55 +223,6 @@ public interface CommonGBChannelMapper {
|
||||||
"</script>")
|
"</script>")
|
||||||
int updateStatus(List<CommonGBChannel> commonGBChannels);
|
int updateStatus(List<CommonGBChannel> commonGBChannels);
|
||||||
|
|
||||||
@Select(value = {"select\n" +
|
|
||||||
" wdc.id as gb_id,\n" +
|
|
||||||
" wdc.device_db_id,\n" +
|
|
||||||
" wdc.create_time,\n" +
|
|
||||||
" wdc.update_time,\n" +
|
|
||||||
" wdc.sub_count,\n" +
|
|
||||||
" wdc.stream_id,\n" +
|
|
||||||
" wdc.has_audio,\n" +
|
|
||||||
" wdc.gps_time,\n" +
|
|
||||||
" wdc.stream_identification,\n" +
|
|
||||||
" coalesce(wpgc.device_id, wdc.gb_device_id, wdc.device_id) as gb_device_id,\n" +
|
|
||||||
" coalesce(wpgc.name, wdc.gb_name, wdc.name) as gb_name,\n" +
|
|
||||||
" coalesce(wdc.gb_manufacturer, wdc.manufacturer) as gb_manufacturer,\n" +
|
|
||||||
" coalesce(wdc.gb_model, wdc.model) as gb_model,\n" +
|
|
||||||
" coalesce(wdc.gb_owner, wdc.owner) as gb_owner,\n" +
|
|
||||||
" coalesce(wdc.gb_civil_code, wdc.civil_code) as gb_civil_code,\n" +
|
|
||||||
" coalesce(wdc.gb_block, wdc.block) as gb_block,\n" +
|
|
||||||
" coalesce(wdc.gb_address, wdc.address) as gb_address,\n" +
|
|
||||||
" coalesce(wpgc.parental, wdc.gb_parental, wdc.parental) as gb_parental,\n" +
|
|
||||||
" coalesce(wpgc.parent_id, wdc.gb_parent_id, wdc.parent_id) as gb_parent_id,\n" +
|
|
||||||
" coalesce(wdc.gb_safety_way, wdc.safety_way) as gb_safety_way,\n" +
|
|
||||||
" coalesce(wdc.gb_register_way, wdc.register_way) as gb_register_way,\n" +
|
|
||||||
" coalesce(wdc.gb_cert_num, wdc.cert_num) as gb_cert_num,\n" +
|
|
||||||
" coalesce(wdc.gb_certifiable, wdc.certifiable) as gb_certifiable,\n" +
|
|
||||||
" coalesce(wdc.gb_err_code, wdc.err_code) as gb_err_code,\n" +
|
|
||||||
" coalesce(wdc.gb_end_time, wdc.end_time) as gb_end_time,\n" +
|
|
||||||
" coalesce(wdc.gb_secrecy, wdc.secrecy) as gb_secrecy,\n" +
|
|
||||||
" coalesce(wdc.gb_ip_address, wdc.ip_address) as gb_ip_address,\n" +
|
|
||||||
" coalesce(wdc.gb_port, wdc.port) as gb_port,\n" +
|
|
||||||
" coalesce(wdc.gb_password, wdc.password) as gb_password,\n" +
|
|
||||||
" coalesce(wdc.gb_status, wdc.status) as gb_status,\n" +
|
|
||||||
" coalesce(wdc.gb_longitude, wdc.longitude) as gb_longitude,\n" +
|
|
||||||
" coalesce(wdc.gb_latitude, wdc.latitude) as gb_latitude,\n" +
|
|
||||||
" coalesce(wdc.gb_ptz_type, wdc.ptz_type) as gb_ptz_type,\n" +
|
|
||||||
" coalesce(wdc.gb_position_type, wdc.position_type) as gb_position_type,\n" +
|
|
||||||
" coalesce(wdc.gb_room_type, wdc.room_type) as gb_room_type,\n" +
|
|
||||||
" coalesce(wdc.gb_use_type, wdc.use_type) as gb_use_type,\n" +
|
|
||||||
" coalesce(wdc.gb_supply_light_type, wdc.supply_light_type) as gb_supply_light_type,\n" +
|
|
||||||
" coalesce(wdc.gb_direction_type, wdc.direction_type) as gb_direction_type,\n" +
|
|
||||||
" coalesce(wdc.gb_resolution, wdc.resolution) as gb_resolution,\n" +
|
|
||||||
" coalesce(wpgc.business_group_id, wdc.gb_business_group_id, wdc.business_group_id) as gb_business_group_id,\n" +
|
|
||||||
" coalesce(wdc.gb_download_speed, wdc.download_speed) as gb_download_speed,\n" +
|
|
||||||
" coalesce(wdc.gb_svc_space_support_mod, wdc.svc_space_support_mod) as gb_svc_space_support_mod,\n" +
|
|
||||||
" coalesce(wdc.gb_svc_time_support_mode,wdc.svc_time_support_mode) as gb_svc_time_support_mode\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}"})
|
|
||||||
List<CommonGBChannel> queryByPlatformId(@Param("platformId") Integer platformId);
|
|
||||||
|
|
||||||
|
|
||||||
@Update(value = {" <script>" +
|
@Update(value = {" <script>" +
|
||||||
" UPDATE wvp_device_channel " +
|
" UPDATE wvp_device_channel " +
|
||||||
" SET update_time=#{updateTime}, gb_device_id = null, gb_name = null, gb_manufacturer = null," +
|
" SET update_time=#{updateTime}, gb_device_id = null, gb_name = null, gb_manufacturer = null," +
|
||||||
|
@ -500,56 +451,11 @@ public interface CommonGBChannelMapper {
|
||||||
" coalesce(wpgc.svc_time_support_mode, wdc.gb_svc_time_support_mode, wdc.svc_time_support_mode) as gb_svc_time_support_mode\n" +
|
" coalesce(wpgc.svc_time_support_mode, wdc.gb_svc_time_support_mode, wdc.svc_time_support_mode) as gb_svc_time_support_mode\n" +
|
||||||
" from wvp_device_channel wdc" +
|
" from wvp_device_channel wdc" +
|
||||||
" left join wvp_platform_gb_channel wpgc on wdc.id = wpgc.device_channel_id" +
|
" left join wvp_platform_gb_channel wpgc on wdc.id = wpgc.device_channel_id" +
|
||||||
" where wpgc.platform_id = #{platformId}"
|
" where wpgc.platform_id = #{platformId} "
|
||||||
|
|
||||||
)
|
)
|
||||||
List<CommonGBChannel> queryWithPlatform(@Param("platformId") Integer platformId);
|
List<CommonGBChannel> queryWithPlatform(@Param("platformId") Integer platformId);
|
||||||
|
|
||||||
@Select("select\n" +
|
|
||||||
" wdc.id as gb_id,\n" +
|
|
||||||
" wdc.device_db_id as gb_device_db_id,\n" +
|
|
||||||
" wdc.stream_push_id,\n" +
|
|
||||||
" wdc.stream_proxy_id,\n" +
|
|
||||||
" wdc.create_time,\n" +
|
|
||||||
" wdc.update_time,\n" +
|
|
||||||
" coalesce(wpgc.device_id, wdc.gb_device_id, wdc.device_id) as gb_device_id,\n" +
|
|
||||||
" coalesce(wpgc.name, wdc.gb_name, wdc.name) as gb_name,\n" +
|
|
||||||
" coalesce(wpgc.manufacturer, wdc.gb_manufacturer, wdc.manufacturer) as gb_manufacturer,\n" +
|
|
||||||
" coalesce(wpgc.model, wdc.gb_model, wdc.model) as gb_model,\n" +
|
|
||||||
" coalesce(wpgc.owner, wdc.gb_owner, wdc.owner) as gb_owner,\n" +
|
|
||||||
" coalesce(wpgc.civil_code, wdc.gb_civil_code, wdc.civil_code),\n" +
|
|
||||||
" coalesce(wpgc.block, wdc.gb_block, wdc.block) as gb_block,\n" +
|
|
||||||
" coalesce(wpgc.address, wdc.gb_address, wdc.address) as gb_address,\n" +
|
|
||||||
" coalesce(wpgc.parental, wdc.gb_parental, wdc.parental) as gb_parental,\n" +
|
|
||||||
" coalesce(wpgc.parent_id, wdc.gb_parent_id, wdc.parent_id) as gb_parent_id,\n" +
|
|
||||||
" coalesce(wpgc.safety_way, wdc.gb_safety_way, wdc.safety_way) as gb_safety_way,\n" +
|
|
||||||
" coalesce(wpgc.register_way, wdc.gb_register_way, wdc.register_way) as gb_register_way,\n" +
|
|
||||||
" coalesce(wpgc.cert_num, wdc.gb_cert_num, wdc.cert_num) as gb_cert_num,\n" +
|
|
||||||
" coalesce(wpgc.certifiable, wdc.gb_certifiable, wdc.certifiable) as gb_certifiable,\n" +
|
|
||||||
" coalesce(wpgc.err_code, wdc.gb_err_code, wdc.err_code) as gb_err_code,\n" +
|
|
||||||
" coalesce(wpgc.end_time, wdc.gb_end_time, wdc.end_time) as gb_end_time,\n" +
|
|
||||||
" coalesce(wpgc.secrecy, wdc.gb_secrecy, wdc.secrecy) as gb_secrecy,\n" +
|
|
||||||
" coalesce(wpgc.ip_address, wdc.gb_ip_address, wdc.ip_address) as gb_ip_address,\n" +
|
|
||||||
" coalesce(wpgc.port, wdc.gb_port, wdc.port) as gb_port,\n" +
|
|
||||||
" coalesce(wpgc.password, wdc.gb_password, wdc.password) as gb_password,\n" +
|
|
||||||
" coalesce(wpgc.status, wdc.gb_status, wdc.status) as gb_status,\n" +
|
|
||||||
" coalesce(wpgc.longitude, wdc.gb_longitude, wdc.longitude) as gb_longitude,\n" +
|
|
||||||
" coalesce(wpgc.latitude, wdc.gb_latitude, wdc.latitude) as gb_latitude,\n" +
|
|
||||||
" coalesce(wpgc.ptz_type, wdc.gb_ptz_type, wdc.ptz_type) as gb_ptz_type,\n" +
|
|
||||||
" coalesce(wpgc.position_type, wdc.gb_position_type, wdc.position_type) as gb_position_type,\n" +
|
|
||||||
" coalesce(wpgc.room_type, wdc.gb_room_type, wdc.room_type) as gb_room_type,\n" +
|
|
||||||
" coalesce(wpgc.use_type, wdc.gb_use_type, wdc.use_type) as gb_use_type,\n" +
|
|
||||||
" coalesce(wpgc.supply_light_type, wdc.gb_supply_light_type, wdc.supply_light_type) as gb_supply_light_type,\n" +
|
|
||||||
" coalesce(wpgc.direction_type, wdc.gb_direction_type, wdc.direction_type) as gb_direction_type,\n" +
|
|
||||||
" coalesce(wpgc.resolution, wdc.gb_resolution, wdc.resolution) as gb_resolution,\n" +
|
|
||||||
" coalesce(wpgc.business_group_id, wdc.gb_business_group_id, wdc.business_group_id) as gb_business_group_id,\n" +
|
|
||||||
" coalesce(wpgc.download_speed, wdc.gb_download_speed, wdc.download_speed) as gb_download_speed,\n" +
|
|
||||||
" coalesce(wpgc.svc_space_support_mod, wdc.gb_svc_space_support_mod, wdc.svc_space_support_mod) as gb_svc_space_support_mod,\n" +
|
|
||||||
" coalesce(wpgc.svc_time_support_mode, wdc.gb_svc_time_support_mode, wdc.svc_time_support_mode) as gb_svc_time_support_mode\n" +
|
|
||||||
" from wvp_device_channel wdc" +
|
|
||||||
" left join wvp_platform_gb_channel wpgc on wdc.id = wpgc.device_channel_id" +
|
|
||||||
" where wpgc.platform_id = #{platformId} and coalesce(wpgc.device_id, wdc.gb_device_id, wdc.device_id) = #{channelDeviceId}"
|
|
||||||
|
|
||||||
)
|
|
||||||
CommonGBChannel queryOneWithPlatform(@Param("platformId") Integer platformId, @Param("channelDeviceId") String channelDeviceId);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,12 +25,12 @@ public interface PlatformChannelMapper {
|
||||||
List<Integer> findChannelRelatedPlatform(@Param("platformId") String platformId, @Param("channelReduces") List<ChannelReduce> channelReduces);
|
List<Integer> findChannelRelatedPlatform(@Param("platformId") String platformId, @Param("channelReduces") List<ChannelReduce> channelReduces);
|
||||||
|
|
||||||
@Insert("<script> "+
|
@Insert("<script> "+
|
||||||
"INSERT INTO wvp_platform_gb_channel (platform_id, device_channel_id, catalog_id) VALUES" +
|
"INSERT INTO wvp_platform_gb_channel (platform_id, device_channel_id) VALUES" +
|
||||||
"<foreach collection='channelReducesToAdd' item='item' separator=','>" +
|
"<foreach collection='channelList' item='item' separator=','>" +
|
||||||
" (#{platformId}, #{item.id} , #{item.catalogId} )" +
|
" (#{platformId}, #{item.gbId} )" +
|
||||||
"</foreach>" +
|
"</foreach>" +
|
||||||
"</script>")
|
"</script>")
|
||||||
int addChannels(@Param("platformId") String platformId, @Param("channelReducesToAdd") List<ChannelReduce> channelReducesToAdd);
|
int addChannels(@Param("platformId") Integer platformId, @Param("channelList") List<CommonGBChannel> channelList);
|
||||||
|
|
||||||
@Delete("<script> "+
|
@Delete("<script> "+
|
||||||
"DELETE from wvp_platform_gb_channel WHERE platform_id=#{platformId} AND device_channel_id in" +
|
"DELETE from wvp_platform_gb_channel WHERE platform_id=#{platformId} AND device_channel_id in" +
|
||||||
|
@ -119,4 +119,228 @@ public interface PlatformChannelMapper {
|
||||||
|
|
||||||
@Select("SELECT pgc.platform_id from wvp_platform_gb_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE dc.device_id=#{channelId}")
|
@Select("SELECT pgc.platform_id from wvp_platform_gb_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE dc.device_id=#{channelId}")
|
||||||
List<Integer> queryParentPlatformByChannelId(@Param("channelId") String channelId);
|
List<Integer> queryParentPlatformByChannelId(@Param("channelId") String channelId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Select("<script>" +
|
||||||
|
" select " +
|
||||||
|
" wdc.id as gb_id,\n" +
|
||||||
|
" wdc.device_db_id as gb_device_db_id,\n" +
|
||||||
|
" wdc.stream_push_id,\n" +
|
||||||
|
" wdc.stream_proxy_id,\n" +
|
||||||
|
" wdc.create_time,\n" +
|
||||||
|
" wdc.update_time,\n" +
|
||||||
|
" coalesce(wpgc.device_id, wdc.gb_device_id, wdc.device_id) as gb_device_id,\n" +
|
||||||
|
" coalesce(wpgc.name, wdc.gb_name, wdc.name) as gb_name,\n" +
|
||||||
|
" coalesce(wpgc.manufacturer, wdc.gb_manufacturer, wdc.manufacturer) as gb_manufacturer,\n" +
|
||||||
|
" coalesce(wpgc.model, wdc.gb_model, wdc.model) as gb_model,\n" +
|
||||||
|
" coalesce(wpgc.owner, wdc.gb_owner, wdc.owner) as gb_owner,\n" +
|
||||||
|
" coalesce(wpgc.civil_code, wdc.gb_civil_code, wdc.civil_code),\n" +
|
||||||
|
" coalesce(wpgc.block, wdc.gb_block, wdc.block) as gb_block,\n" +
|
||||||
|
" coalesce(wpgc.address, wdc.gb_address, wdc.address) as gb_address,\n" +
|
||||||
|
" coalesce(wpgc.parental, wdc.gb_parental, wdc.parental) as gb_parental,\n" +
|
||||||
|
" coalesce(wpgc.parent_id, wdc.gb_parent_id, wdc.parent_id) as gb_parent_id,\n" +
|
||||||
|
" coalesce(wpgc.safety_way, wdc.gb_safety_way, wdc.safety_way) as gb_safety_way,\n" +
|
||||||
|
" coalesce(wpgc.register_way, wdc.gb_register_way, wdc.register_way) as gb_register_way,\n" +
|
||||||
|
" coalesce(wpgc.cert_num, wdc.gb_cert_num, wdc.cert_num) as gb_cert_num,\n" +
|
||||||
|
" coalesce(wpgc.certifiable, wdc.gb_certifiable, wdc.certifiable) as gb_certifiable,\n" +
|
||||||
|
" coalesce(wpgc.err_code, wdc.gb_err_code, wdc.err_code) as gb_err_code,\n" +
|
||||||
|
" coalesce(wpgc.end_time, wdc.gb_end_time, wdc.end_time) as gb_end_time,\n" +
|
||||||
|
" coalesce(wpgc.secrecy, wdc.gb_secrecy, wdc.secrecy) as gb_secrecy,\n" +
|
||||||
|
" coalesce(wpgc.ip_address, wdc.gb_ip_address, wdc.ip_address) as gb_ip_address,\n" +
|
||||||
|
" coalesce(wpgc.port, wdc.gb_port, wdc.port) as gb_port,\n" +
|
||||||
|
" coalesce(wpgc.password, wdc.gb_password, wdc.password) as gb_password,\n" +
|
||||||
|
" coalesce(wpgc.status, wdc.gb_status, wdc.status) as gb_status,\n" +
|
||||||
|
" coalesce(wpgc.longitude, wdc.gb_longitude, wdc.longitude) as gb_longitude,\n" +
|
||||||
|
" coalesce(wpgc.latitude, wdc.gb_latitude, wdc.latitude) as gb_latitude,\n" +
|
||||||
|
" coalesce(wpgc.ptz_type, wdc.gb_ptz_type, wdc.ptz_type) as gb_ptz_type,\n" +
|
||||||
|
" coalesce(wpgc.position_type, wdc.gb_position_type, wdc.position_type) as gb_position_type,\n" +
|
||||||
|
" coalesce(wpgc.room_type, wdc.gb_room_type, wdc.room_type) as gb_room_type,\n" +
|
||||||
|
" coalesce(wpgc.use_type, wdc.gb_use_type, wdc.use_type) as gb_use_type,\n" +
|
||||||
|
" coalesce(wpgc.supply_light_type, wdc.gb_supply_light_type, wdc.supply_light_type) as gb_supply_light_type,\n" +
|
||||||
|
" coalesce(wpgc.direction_type, wdc.gb_direction_type, wdc.direction_type) as gb_direction_type,\n" +
|
||||||
|
" coalesce(wpgc.resolution, wdc.gb_resolution, wdc.resolution) as gb_resolution,\n" +
|
||||||
|
" coalesce(wpgc.business_group_id, wdc.gb_business_group_id, wdc.business_group_id) as gb_business_group_id,\n" +
|
||||||
|
" coalesce(wpgc.download_speed, wdc.gb_download_speed, wdc.download_speed) as gb_download_speed,\n" +
|
||||||
|
" coalesce(wpgc.svc_space_support_mod, wdc.gb_svc_space_support_mod, wdc.svc_space_support_mod) as gb_svc_space_support_mod,\n" +
|
||||||
|
" coalesce(wpgc.svc_time_support_mode, wdc.gb_svc_time_support_mode, wdc.svc_time_support_mode) as gb_svc_time_support_mode, \n" +
|
||||||
|
" wpgc.platform_id " +
|
||||||
|
" from wvp_device_channel wdc" +
|
||||||
|
" left join wvp_platform_gb_channel wpgc on wdc.id = wpgc.device_channel_id and wpgc.platform_id = #{platformId}" +
|
||||||
|
" where 1=1" +
|
||||||
|
" <if test='query != null'> AND (coalesce(wpgc.device_id, wdc.gb_device_id, wdc.device_id) LIKE concat('%',#{query},'%') " +
|
||||||
|
" OR coalesce(wpgc.name, wdc.gb_name, wdc.name) LIKE concat('%',#{query},'%'))</if> " +
|
||||||
|
" <if test='online == true'> AND coalesce(wpgc.status, wdc.gb_status, wdc.status) = 'ON'</if> " +
|
||||||
|
" <if test='online == false'> AND coalesce(wpgc.status, wdc.gb_status, wdc.status) = 'OFF'</if> " +
|
||||||
|
" <if test='hasShare == true'> AND wpgc.platform_id = #{platformId}</if> " +
|
||||||
|
" <if test='hasShare == false'> AND wpgc.platform_id is null</if> " +
|
||||||
|
|
||||||
|
"</script>")
|
||||||
|
List<PlatformChannel> queryForPlatformSearch(@Param("platformId") Integer platformId, @Param("query") String query,
|
||||||
|
@Param("online") Boolean online, @Param("hasShare") Boolean hasShare);
|
||||||
|
|
||||||
|
@Select("select\n" +
|
||||||
|
" wdc.id as gb_id,\n" +
|
||||||
|
" wdc.device_db_id as gb_device_db_id,\n" +
|
||||||
|
" wdc.stream_push_id,\n" +
|
||||||
|
" wdc.stream_proxy_id,\n" +
|
||||||
|
" wdc.create_time,\n" +
|
||||||
|
" wdc.update_time,\n" +
|
||||||
|
" coalesce(wpgc.device_id, wdc.gb_device_id, wdc.device_id) as gb_device_id,\n" +
|
||||||
|
" coalesce(wpgc.name, wdc.gb_name, wdc.name) as gb_name,\n" +
|
||||||
|
" coalesce(wpgc.manufacturer, wdc.gb_manufacturer, wdc.manufacturer) as gb_manufacturer,\n" +
|
||||||
|
" coalesce(wpgc.model, wdc.gb_model, wdc.model) as gb_model,\n" +
|
||||||
|
" coalesce(wpgc.owner, wdc.gb_owner, wdc.owner) as gb_owner,\n" +
|
||||||
|
" coalesce(wpgc.civil_code, wdc.gb_civil_code, wdc.civil_code),\n" +
|
||||||
|
" coalesce(wpgc.block, wdc.gb_block, wdc.block) as gb_block,\n" +
|
||||||
|
" coalesce(wpgc.address, wdc.gb_address, wdc.address) as gb_address,\n" +
|
||||||
|
" coalesce(wpgc.parental, wdc.gb_parental, wdc.parental) as gb_parental,\n" +
|
||||||
|
" coalesce(wpgc.parent_id, wdc.gb_parent_id, wdc.parent_id) as gb_parent_id,\n" +
|
||||||
|
" coalesce(wpgc.safety_way, wdc.gb_safety_way, wdc.safety_way) as gb_safety_way,\n" +
|
||||||
|
" coalesce(wpgc.register_way, wdc.gb_register_way, wdc.register_way) as gb_register_way,\n" +
|
||||||
|
" coalesce(wpgc.cert_num, wdc.gb_cert_num, wdc.cert_num) as gb_cert_num,\n" +
|
||||||
|
" coalesce(wpgc.certifiable, wdc.gb_certifiable, wdc.certifiable) as gb_certifiable,\n" +
|
||||||
|
" coalesce(wpgc.err_code, wdc.gb_err_code, wdc.err_code) as gb_err_code,\n" +
|
||||||
|
" coalesce(wpgc.end_time, wdc.gb_end_time, wdc.end_time) as gb_end_time,\n" +
|
||||||
|
" coalesce(wpgc.secrecy, wdc.gb_secrecy, wdc.secrecy) as gb_secrecy,\n" +
|
||||||
|
" coalesce(wpgc.ip_address, wdc.gb_ip_address, wdc.ip_address) as gb_ip_address,\n" +
|
||||||
|
" coalesce(wpgc.port, wdc.gb_port, wdc.port) as gb_port,\n" +
|
||||||
|
" coalesce(wpgc.password, wdc.gb_password, wdc.password) as gb_password,\n" +
|
||||||
|
" coalesce(wpgc.status, wdc.gb_status, wdc.status) as gb_status,\n" +
|
||||||
|
" coalesce(wpgc.longitude, wdc.gb_longitude, wdc.longitude) as gb_longitude,\n" +
|
||||||
|
" coalesce(wpgc.latitude, wdc.gb_latitude, wdc.latitude) as gb_latitude,\n" +
|
||||||
|
" coalesce(wpgc.ptz_type, wdc.gb_ptz_type, wdc.ptz_type) as gb_ptz_type,\n" +
|
||||||
|
" coalesce(wpgc.position_type, wdc.gb_position_type, wdc.position_type) as gb_position_type,\n" +
|
||||||
|
" coalesce(wpgc.room_type, wdc.gb_room_type, wdc.room_type) as gb_room_type,\n" +
|
||||||
|
" coalesce(wpgc.use_type, wdc.gb_use_type, wdc.use_type) as gb_use_type,\n" +
|
||||||
|
" coalesce(wpgc.supply_light_type, wdc.gb_supply_light_type, wdc.supply_light_type) as gb_supply_light_type,\n" +
|
||||||
|
" coalesce(wpgc.direction_type, wdc.gb_direction_type, wdc.direction_type) as gb_direction_type,\n" +
|
||||||
|
" coalesce(wpgc.resolution, wdc.gb_resolution, wdc.resolution) as gb_resolution,\n" +
|
||||||
|
" coalesce(wpgc.business_group_id, wdc.gb_business_group_id, wdc.business_group_id) as gb_business_group_id,\n" +
|
||||||
|
" coalesce(wpgc.download_speed, wdc.gb_download_speed, wdc.download_speed) as gb_download_speed,\n" +
|
||||||
|
" coalesce(wpgc.svc_space_support_mod, wdc.gb_svc_space_support_mod, wdc.svc_space_support_mod) as gb_svc_space_support_mod,\n" +
|
||||||
|
" coalesce(wpgc.svc_time_support_mode, wdc.gb_svc_time_support_mode, wdc.svc_time_support_mode) as gb_svc_time_support_mode\n" +
|
||||||
|
" from wvp_device_channel wdc" +
|
||||||
|
" left join wvp_platform_gb_channel wpgc on wdc.id = wpgc.device_channel_id" +
|
||||||
|
" where wpgc.platform_id = #{platformId} and coalesce(wpgc.device_id, wdc.gb_device_id, wdc.device_id) = #{channelDeviceId}"
|
||||||
|
|
||||||
|
)
|
||||||
|
CommonGBChannel queryOneWithPlatform(@Param("platformId") Integer platformId, @Param("channelDeviceId") String channelDeviceId);
|
||||||
|
|
||||||
|
|
||||||
|
@Select("<script>" +
|
||||||
|
" select " +
|
||||||
|
" wdc.id as gb_id,\n" +
|
||||||
|
" wdc.device_db_id as gb_device_db_id,\n" +
|
||||||
|
" wdc.stream_push_id,\n" +
|
||||||
|
" wdc.stream_proxy_id,\n" +
|
||||||
|
" wdc.create_time,\n" +
|
||||||
|
" wdc.update_time,\n" +
|
||||||
|
" coalesce(wpgc.device_id, wdc.gb_device_id, wdc.device_id) as gb_device_id,\n" +
|
||||||
|
" coalesce(wpgc.name, wdc.gb_name, wdc.name) as gb_name,\n" +
|
||||||
|
" coalesce(wpgc.manufacturer, wdc.gb_manufacturer, wdc.manufacturer) as gb_manufacturer,\n" +
|
||||||
|
" coalesce(wpgc.model, wdc.gb_model, wdc.model) as gb_model,\n" +
|
||||||
|
" coalesce(wpgc.owner, wdc.gb_owner, wdc.owner) as gb_owner,\n" +
|
||||||
|
" coalesce(wpgc.civil_code, wdc.gb_civil_code, wdc.civil_code),\n" +
|
||||||
|
" coalesce(wpgc.block, wdc.gb_block, wdc.block) as gb_block,\n" +
|
||||||
|
" coalesce(wpgc.address, wdc.gb_address, wdc.address) as gb_address,\n" +
|
||||||
|
" coalesce(wpgc.parental, wdc.gb_parental, wdc.parental) as gb_parental,\n" +
|
||||||
|
" coalesce(wpgc.parent_id, wdc.gb_parent_id, wdc.parent_id) as gb_parent_id,\n" +
|
||||||
|
" coalesce(wpgc.safety_way, wdc.gb_safety_way, wdc.safety_way) as gb_safety_way,\n" +
|
||||||
|
" coalesce(wpgc.register_way, wdc.gb_register_way, wdc.register_way) as gb_register_way,\n" +
|
||||||
|
" coalesce(wpgc.cert_num, wdc.gb_cert_num, wdc.cert_num) as gb_cert_num,\n" +
|
||||||
|
" coalesce(wpgc.certifiable, wdc.gb_certifiable, wdc.certifiable) as gb_certifiable,\n" +
|
||||||
|
" coalesce(wpgc.err_code, wdc.gb_err_code, wdc.err_code) as gb_err_code,\n" +
|
||||||
|
" coalesce(wpgc.end_time, wdc.gb_end_time, wdc.end_time) as gb_end_time,\n" +
|
||||||
|
" coalesce(wpgc.secrecy, wdc.gb_secrecy, wdc.secrecy) as gb_secrecy,\n" +
|
||||||
|
" coalesce(wpgc.ip_address, wdc.gb_ip_address, wdc.ip_address) as gb_ip_address,\n" +
|
||||||
|
" coalesce(wpgc.port, wdc.gb_port, wdc.port) as gb_port,\n" +
|
||||||
|
" coalesce(wpgc.password, wdc.gb_password, wdc.password) as gb_password,\n" +
|
||||||
|
" coalesce(wpgc.status, wdc.gb_status, wdc.status) as gb_status,\n" +
|
||||||
|
" coalesce(wpgc.longitude, wdc.gb_longitude, wdc.longitude) as gb_longitude,\n" +
|
||||||
|
" coalesce(wpgc.latitude, wdc.gb_latitude, wdc.latitude) as gb_latitude,\n" +
|
||||||
|
" coalesce(wpgc.ptz_type, wdc.gb_ptz_type, wdc.ptz_type) as gb_ptz_type,\n" +
|
||||||
|
" coalesce(wpgc.position_type, wdc.gb_position_type, wdc.position_type) as gb_position_type,\n" +
|
||||||
|
" coalesce(wpgc.room_type, wdc.gb_room_type, wdc.room_type) as gb_room_type,\n" +
|
||||||
|
" coalesce(wpgc.use_type, wdc.gb_use_type, wdc.use_type) as gb_use_type,\n" +
|
||||||
|
" coalesce(wpgc.supply_light_type, wdc.gb_supply_light_type, wdc.supply_light_type) as gb_supply_light_type,\n" +
|
||||||
|
" coalesce(wpgc.direction_type, wdc.gb_direction_type, wdc.direction_type) as gb_direction_type,\n" +
|
||||||
|
" coalesce(wpgc.resolution, wdc.gb_resolution, wdc.resolution) as gb_resolution,\n" +
|
||||||
|
" coalesce(wpgc.business_group_id, wdc.gb_business_group_id, wdc.business_group_id) as gb_business_group_id,\n" +
|
||||||
|
" coalesce(wpgc.download_speed, wdc.gb_download_speed, wdc.download_speed) as gb_download_speed,\n" +
|
||||||
|
" coalesce(wpgc.svc_space_support_mod, wdc.gb_svc_space_support_mod, wdc.svc_space_support_mod) as gb_svc_space_support_mod,\n" +
|
||||||
|
" coalesce(wpgc.svc_time_support_mode, wdc.gb_svc_time_support_mode, wdc.svc_time_support_mode) as gb_svc_time_support_mode\n" +
|
||||||
|
" from wvp_device_channel wdc" +
|
||||||
|
" left join wvp_platform_gb_channel wpgc on wdc.id = wpgc.device_channel_id and wpgc.platform_id = #{platformId}" +
|
||||||
|
" where wpgc.platform_id is null" +
|
||||||
|
"<if test='channelIds != null'> AND wdc.id in <foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>" +
|
||||||
|
"#{item} " +
|
||||||
|
"</foreach> </if>" +
|
||||||
|
|
||||||
|
"</script>")
|
||||||
|
List<CommonGBChannel> queryNotShare(@Param("platformId") Integer platformId, List<Integer> channelIds);
|
||||||
|
|
||||||
|
@Select("<script>" +
|
||||||
|
" select " +
|
||||||
|
" wdc.id as gb_id,\n" +
|
||||||
|
" wdc.device_db_id as gb_device_db_id,\n" +
|
||||||
|
" wdc.stream_push_id,\n" +
|
||||||
|
" wdc.stream_proxy_id,\n" +
|
||||||
|
" wdc.create_time,\n" +
|
||||||
|
" wdc.update_time,\n" +
|
||||||
|
" coalesce(wpgc.device_id, wdc.gb_device_id, wdc.device_id) as gb_device_id,\n" +
|
||||||
|
" coalesce(wpgc.name, wdc.gb_name, wdc.name) as gb_name,\n" +
|
||||||
|
" coalesce(wpgc.manufacturer, wdc.gb_manufacturer, wdc.manufacturer) as gb_manufacturer,\n" +
|
||||||
|
" coalesce(wpgc.model, wdc.gb_model, wdc.model) as gb_model,\n" +
|
||||||
|
" coalesce(wpgc.owner, wdc.gb_owner, wdc.owner) as gb_owner,\n" +
|
||||||
|
" coalesce(wpgc.civil_code, wdc.gb_civil_code, wdc.civil_code),\n" +
|
||||||
|
" coalesce(wpgc.block, wdc.gb_block, wdc.block) as gb_block,\n" +
|
||||||
|
" coalesce(wpgc.address, wdc.gb_address, wdc.address) as gb_address,\n" +
|
||||||
|
" coalesce(wpgc.parental, wdc.gb_parental, wdc.parental) as gb_parental,\n" +
|
||||||
|
" coalesce(wpgc.parent_id, wdc.gb_parent_id, wdc.parent_id) as gb_parent_id,\n" +
|
||||||
|
" coalesce(wpgc.safety_way, wdc.gb_safety_way, wdc.safety_way) as gb_safety_way,\n" +
|
||||||
|
" coalesce(wpgc.register_way, wdc.gb_register_way, wdc.register_way) as gb_register_way,\n" +
|
||||||
|
" coalesce(wpgc.cert_num, wdc.gb_cert_num, wdc.cert_num) as gb_cert_num,\n" +
|
||||||
|
" coalesce(wpgc.certifiable, wdc.gb_certifiable, wdc.certifiable) as gb_certifiable,\n" +
|
||||||
|
" coalesce(wpgc.err_code, wdc.gb_err_code, wdc.err_code) as gb_err_code,\n" +
|
||||||
|
" coalesce(wpgc.end_time, wdc.gb_end_time, wdc.end_time) as gb_end_time,\n" +
|
||||||
|
" coalesce(wpgc.secrecy, wdc.gb_secrecy, wdc.secrecy) as gb_secrecy,\n" +
|
||||||
|
" coalesce(wpgc.ip_address, wdc.gb_ip_address, wdc.ip_address) as gb_ip_address,\n" +
|
||||||
|
" coalesce(wpgc.port, wdc.gb_port, wdc.port) as gb_port,\n" +
|
||||||
|
" coalesce(wpgc.password, wdc.gb_password, wdc.password) as gb_password,\n" +
|
||||||
|
" coalesce(wpgc.status, wdc.gb_status, wdc.status) as gb_status,\n" +
|
||||||
|
" coalesce(wpgc.longitude, wdc.gb_longitude, wdc.longitude) as gb_longitude,\n" +
|
||||||
|
" coalesce(wpgc.latitude, wdc.gb_latitude, wdc.latitude) as gb_latitude,\n" +
|
||||||
|
" coalesce(wpgc.ptz_type, wdc.gb_ptz_type, wdc.ptz_type) as gb_ptz_type,\n" +
|
||||||
|
" coalesce(wpgc.position_type, wdc.gb_position_type, wdc.position_type) as gb_position_type,\n" +
|
||||||
|
" coalesce(wpgc.room_type, wdc.gb_room_type, wdc.room_type) as gb_room_type,\n" +
|
||||||
|
" coalesce(wpgc.use_type, wdc.gb_use_type, wdc.use_type) as gb_use_type,\n" +
|
||||||
|
" coalesce(wpgc.supply_light_type, wdc.gb_supply_light_type, wdc.supply_light_type) as gb_supply_light_type,\n" +
|
||||||
|
" coalesce(wpgc.direction_type, wdc.gb_direction_type, wdc.direction_type) as gb_direction_type,\n" +
|
||||||
|
" coalesce(wpgc.resolution, wdc.gb_resolution, wdc.resolution) as gb_resolution,\n" +
|
||||||
|
" coalesce(wpgc.business_group_id, wdc.gb_business_group_id, wdc.business_group_id) as gb_business_group_id,\n" +
|
||||||
|
" coalesce(wpgc.download_speed, wdc.gb_download_speed, wdc.download_speed) as gb_download_speed,\n" +
|
||||||
|
" coalesce(wpgc.svc_space_support_mod, wdc.gb_svc_space_support_mod, wdc.svc_space_support_mod) as gb_svc_space_support_mod,\n" +
|
||||||
|
" coalesce(wpgc.svc_time_support_mode, wdc.gb_svc_time_support_mode, wdc.svc_time_support_mode) as gb_svc_time_support_mode\n" +
|
||||||
|
" from wvp_device_channel wdc" +
|
||||||
|
" left join wvp_platform_gb_channel wpgc on wdc.id = wpgc.device_channel_id" +
|
||||||
|
" where wpgc.platform_id = #{platformId}" +
|
||||||
|
"<if test='channelIds != null'> AND wdc.id in " +
|
||||||
|
" <foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>" +
|
||||||
|
" #{item} " +
|
||||||
|
" </foreach> " +
|
||||||
|
"</if>" +
|
||||||
|
"</script>")
|
||||||
|
List<CommonGBChannel> queryShare(@Param("platformId") Integer platformId, List<Integer> channelIds);
|
||||||
|
|
||||||
|
@Delete("<script> " +
|
||||||
|
"DELETE from wvp_platform_gb_channel WHERE platform_id=#{platformId} " +
|
||||||
|
"<if test='channelList != null'> AND device_channel_id in " +
|
||||||
|
" <foreach item='item' index='index' collection='channelList' open='(' separator=',' close=')'>" +
|
||||||
|
" #{item.gbId} " +
|
||||||
|
" </foreach> " +
|
||||||
|
"</if>" +
|
||||||
|
"</script>")
|
||||||
|
int removeChannels(@Param("platformId") Integer platformId, List<CommonGBChannel> channelList);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.genersoft.iot.vmp.gb28181.service;
|
package com.genersoft.iot.vmp.gb28181.service;
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelReduce;
|
import com.genersoft.iot.vmp.gb28181.bean.PlatformChannel;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -10,20 +11,13 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public interface IPlatformChannelService {
|
public interface IPlatformChannelService {
|
||||||
|
|
||||||
/**
|
PageInfo<PlatformChannel> queryChannelList(int page, int count, String query, Boolean online, Integer platformId, Boolean hasShare);
|
||||||
* 更新目录下的通道
|
|
||||||
* @param platformId 平台编号
|
|
||||||
* @param channelReduces 通道信息
|
|
||||||
* @param catalogId 目录编号
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
int updateChannelForGB(String platformId, List<ChannelReduce> channelReduces, String catalogId);
|
|
||||||
|
|
||||||
/**
|
int addAllChannel(Integer platformId);
|
||||||
* 移除目录下的所有通道
|
|
||||||
* @param platformId
|
int removeAllChannel(Integer platformId);
|
||||||
* @param catalogId
|
|
||||||
* @return
|
int addChannels(Integer platformId, List<Integer> channelIds);
|
||||||
*/
|
|
||||||
int delAllChannelForGB(String platformId, String catalogId);
|
int removeChannels(Integer platformId, List<Integer> channelIds);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ 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.dao.GroupMapper;
|
import com.genersoft.iot.vmp.gb28181.dao.GroupMapper;
|
||||||
|
import com.genersoft.iot.vmp.gb28181.dao.PlatformChannelMapper;
|
||||||
import com.genersoft.iot.vmp.gb28181.dao.RegionMapper;
|
import com.genersoft.iot.vmp.gb28181.dao.RegionMapper;
|
||||||
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;
|
||||||
|
@ -34,6 +35,9 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private CommonGBChannelMapper commonGBChannelMapper;
|
private CommonGBChannelMapper commonGBChannelMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PlatformChannelMapper platformChannelMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RegionMapper regionMapper;
|
private RegionMapper regionMapper;
|
||||||
|
|
||||||
|
@ -635,6 +639,6 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommonGBChannel queryOneWithPlatform(Integer platformId, String channelDeviceId) {
|
public CommonGBChannel queryOneWithPlatform(Integer platformId, String channelDeviceId) {
|
||||||
return commonGBChannelMapper.queryOneWithPlatform(platformId, channelDeviceId);
|
return platformChannelMapper.queryOneWithPlatform(platformId, channelDeviceId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +1,20 @@
|
||||||
package com.genersoft.iot.vmp.gb28181.service.impl;
|
package com.genersoft.iot.vmp.gb28181.service.impl;
|
||||||
|
|
||||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
||||||
|
import com.genersoft.iot.vmp.gb28181.bean.PlatformChannel;
|
||||||
|
import com.genersoft.iot.vmp.gb28181.dao.PlatformChannelMapper;
|
||||||
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.IPlatformChannelService;
|
import com.genersoft.iot.vmp.gb28181.service.IPlatformChannelService;
|
||||||
import com.genersoft.iot.vmp.gb28181.dao.DeviceChannelMapper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.genersoft.iot.vmp.gb28181.dao.PlatformMapper;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.genersoft.iot.vmp.gb28181.dao.PlatformChannelMapper;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelReduce;
|
|
||||||
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.jdbc.datasource.DataSourceTransactionManager;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.TransactionDefinition;
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.transaction.TransactionStatus;
|
|
||||||
import org.springframework.util.ObjectUtils;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author lin
|
* @author lin
|
||||||
|
@ -33,137 +27,82 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private PlatformChannelMapper platformChannelMapper;
|
private PlatformChannelMapper platformChannelMapper;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
TransactionDefinition transactionDefinition;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
DataSourceTransactionManager dataSourceTransactionManager;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SubscribeHolder subscribeHolder;
|
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private DeviceChannelMapper deviceChannelMapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private PlatformMapper platformMapper;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
EventPublisher eventPublisher;
|
EventPublisher eventPublisher;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int updateChannelForGB(String platformId, List<ChannelReduce> channelReduces, String catalogId) {
|
public PageInfo<PlatformChannel> queryChannelList(int page, int count, String query, Boolean online, Integer platformId, Boolean hasShare) {
|
||||||
Platform platform = platformMapper.getParentPlatByServerGBId(platformId);
|
PageHelper.startPage(page, count);
|
||||||
if (platform == null) {
|
List<PlatformChannel> all = platformChannelMapper.queryForPlatformSearch(platformId, query, online, hasShare);
|
||||||
log.warn("更新级联通道信息时未找到平台{}的信息", platformId);
|
return new PageInfo<>(all);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
Map<Integer, ChannelReduce> deviceAndChannels = new HashMap<>();
|
|
||||||
for (ChannelReduce channelReduce : channelReduces) {
|
|
||||||
channelReduce.setCatalogId(catalogId);
|
|
||||||
deviceAndChannels.put(channelReduce.getId(), channelReduce);
|
|
||||||
}
|
|
||||||
List<Integer> deviceAndChannelList = new ArrayList<>(deviceAndChannels.keySet());
|
|
||||||
// 查询当前已经存在的
|
|
||||||
List<Integer> channelIds = platformChannelMapper.findChannelRelatedPlatform(platformId, channelReduces);
|
|
||||||
if (deviceAndChannelList != null) {
|
|
||||||
deviceAndChannelList.removeAll(channelIds);
|
|
||||||
}
|
|
||||||
for (Integer channelId : channelIds) {
|
|
||||||
deviceAndChannels.remove(channelId);
|
|
||||||
}
|
|
||||||
List<ChannelReduce> channelReducesToAdd = new ArrayList<>(deviceAndChannels.values());
|
|
||||||
// 对剩下的数据进行存储
|
|
||||||
int allCount = 0;
|
|
||||||
boolean result = false;
|
|
||||||
TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition);
|
|
||||||
int limitCount = 50;
|
|
||||||
if (channelReducesToAdd.size() > 0) {
|
|
||||||
if (channelReducesToAdd.size() > limitCount) {
|
|
||||||
for (int i = 0; i < channelReducesToAdd.size(); i += limitCount) {
|
|
||||||
int toIndex = i + limitCount;
|
|
||||||
if (i + limitCount > channelReducesToAdd.size()) {
|
|
||||||
toIndex = channelReducesToAdd.size();
|
|
||||||
}
|
|
||||||
int count = platformChannelMapper.addChannels(platformId, channelReducesToAdd.subList(i, toIndex));
|
|
||||||
result = result || count < 0;
|
|
||||||
allCount += count;
|
|
||||||
log.info("[关联通道]国标通道 平台:{}, 共需关联通道数:{}, 已关联:{}", platformId, channelReducesToAdd.size(), toIndex);
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
allCount = platformChannelMapper.addChannels(platformId, channelReducesToAdd);
|
|
||||||
result = result || allCount < 0;
|
|
||||||
log.info("[关联通道]国标通道 平台:{}, 关联通道数:{}", platformId, channelReducesToAdd.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result) {
|
|
||||||
//事务回滚
|
|
||||||
dataSourceTransactionManager.rollback(transactionStatus);
|
|
||||||
allCount = 0;
|
|
||||||
}else {
|
|
||||||
log.info("[关联通道]国标通道 平台:{}, 正在存入数据库", platformId);
|
|
||||||
dataSourceTransactionManager.commit(transactionStatus);
|
|
||||||
|
|
||||||
}
|
|
||||||
SubscribeInfo catalogSubscribe = subscribeHolder.getCatalogSubscribe(platformId);
|
|
||||||
if (catalogSubscribe != null) {
|
|
||||||
List<CommonGBChannel> deviceChannelList = getDeviceChannelListByChannelReduceList(channelReducesToAdd, catalogId, platform);
|
|
||||||
if (deviceChannelList != null) {
|
|
||||||
eventPublisher.catalogEventPublish(platform.getId(), deviceChannelList, CatalogEvent.ADD);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
log.info("[关联通道]国标通道 平台:{}, 存入数据库成功", platformId);
|
|
||||||
}
|
|
||||||
return allCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<CommonGBChannel> getDeviceChannelListByChannelReduceList(List<ChannelReduce> channelReduces, String catalogId, Platform platform) {
|
|
||||||
List<CommonGBChannel> deviceChannelList = new ArrayList<>();
|
|
||||||
// if (!channelReduces.isEmpty()){
|
|
||||||
// PlatformCatalog catalog = catalogManager.selectByPlatFormAndCatalogId(platform.getServerGBId(),catalogId);
|
|
||||||
// if (catalog == null && catalogId.equals(platform.getDeviceGBId())) {
|
|
||||||
// for (ChannelReduce channelReduce : channelReduces) {
|
|
||||||
// DeviceChannel deviceChannel = deviceChannelMapper.getOne(channelReduce.getId());
|
|
||||||
// deviceChannel.setParental(0);
|
|
||||||
// deviceChannel.setCivilCode(platform.getServerGBDomain());
|
|
||||||
// deviceChannelList.add(deviceChannel);
|
|
||||||
// }
|
|
||||||
// return deviceChannelList;
|
|
||||||
// } else if (catalog == null && !catalogId.equals(platform.getDeviceGBId())) {
|
|
||||||
// log.warn("未查询到目录{}的信息", catalogId);
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
// for (ChannelReduce channelReduce : channelReduces) {
|
|
||||||
// DeviceChannel deviceChannel = deviceChannelMapper.getOne(channelReduce.getId());
|
|
||||||
// deviceChannel.setParental(0);
|
|
||||||
// deviceChannel.setCivilCode(catalog.getCivilCode());
|
|
||||||
// deviceChannel.setParentId(catalog.getParentId());
|
|
||||||
// deviceChannel.setBusinessGroupId(catalog.getBusinessGroupId());
|
|
||||||
// deviceChannelList.add(deviceChannel);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
return deviceChannelList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int delAllChannelForGB(String platformId, String catalogId) {
|
public int addAllChannel(Integer platformId) {
|
||||||
|
List<CommonGBChannel> channelListNotShare = platformChannelMapper.queryNotShare(platformId, null);
|
||||||
int result;
|
Assert.notEmpty(channelListNotShare, "所有通道已共享");
|
||||||
if (platformId == null) {
|
int result = platformChannelMapper.addChannels(platformId, channelListNotShare);
|
||||||
return 0;
|
if (result > 0) {
|
||||||
|
// 发送消息
|
||||||
|
try {
|
||||||
|
// 发送catalog
|
||||||
|
eventPublisher.catalogEventPublish(platformId, channelListNotShare, CatalogEvent.ADD);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("[关联全部通道] 发送失败,数量:{}", channelListNotShare.size(), e);
|
||||||
}
|
}
|
||||||
Platform platform = platformMapper.getParentPlatByServerGBId(platformId);
|
|
||||||
if (platform == null) {
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
if (ObjectUtils.isEmpty(catalogId)) {
|
return result;
|
||||||
catalogId = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<CommonGBChannel> deviceChannels = platformChannelMapper.queryAllChannelInCatalog(platformId, catalogId);
|
@Override
|
||||||
eventPublisher.catalogEventPublish(platform.getId(), deviceChannels, CatalogEvent.DEL);
|
public int addChannels(Integer platformId, List<Integer> channelIds) {
|
||||||
|
List<CommonGBChannel> channelListNotShare = platformChannelMapper.queryNotShare(platformId, channelIds);
|
||||||
|
Assert.notEmpty(channelListNotShare, "通道已共享");
|
||||||
|
int result = platformChannelMapper.addChannels(platformId, channelListNotShare);
|
||||||
|
if (result > 0) {
|
||||||
|
// 发送消息
|
||||||
|
try {
|
||||||
|
// 发送catalog
|
||||||
|
eventPublisher.catalogEventPublish(platformId, channelListNotShare, CatalogEvent.ADD);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("[关联通道] 发送失败,数量:{}", channelListNotShare.size(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
return platformChannelMapper.delChannelForGBByCatalogId(platformId, catalogId);
|
@Override
|
||||||
|
public int removeAllChannel(Integer platformId) {
|
||||||
|
List<CommonGBChannel> channelListNotShare = platformChannelMapper.queryNotShare(platformId, null);
|
||||||
|
Assert.notEmpty(channelListNotShare, "未共享任何通道");
|
||||||
|
int result = platformChannelMapper.removeChannels(platformId, channelListNotShare);
|
||||||
|
if (result > 0) {
|
||||||
|
// 发送消息
|
||||||
|
try {
|
||||||
|
// 发送catalog
|
||||||
|
eventPublisher.catalogEventPublish(platformId, channelListNotShare, CatalogEvent.DEL);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("[移除全部关联通道] 发送失败,数量:{}", channelListNotShare.size(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int removeChannels(Integer platformId, List<Integer> channelIds) {
|
||||||
|
List<CommonGBChannel> channelList = platformChannelMapper.queryShare(platformId, channelIds);
|
||||||
|
Assert.notEmpty(channelList, "所选通道未共享");
|
||||||
|
int result = platformChannelMapper.removeChannels(platformId, channelList);
|
||||||
|
if (result > 0) {
|
||||||
|
// 发送消息
|
||||||
|
try {
|
||||||
|
// 发送catalog
|
||||||
|
eventPublisher.catalogEventPublish(platformId, channelList, CatalogEvent.DEL);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("[移除关联通道] 发送失败,数量:{}", channelList.size(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,7 +153,7 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
chooseChannel: function(platform) {
|
chooseChannel: function(platform) {
|
||||||
this.$refs.shareChannel.openDialog(platform.serverGBId, this.initData)
|
this.$refs.shareChannel.openDialog(platform.id, this.initData)
|
||||||
},
|
},
|
||||||
initData: function() {
|
initData: function() {
|
||||||
this.$axios({
|
this.$axios({
|
||||||
|
|
|
@ -27,7 +27,9 @@
|
||||||
<el-button v-if="hasShare ==='true'" size="mini" type="danger" @click="remove()">
|
<el-button v-if="hasShare ==='true'" size="mini" type="danger" @click="remove()">
|
||||||
移除
|
移除
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button icon="el-icon-refresh-right" circle size="mini" @click="getChannelList()"></el-button>
|
<el-button size="mini" @click="addAll()">全部添加</el-button>
|
||||||
|
<el-button size="mini" @click="removeAll()">全部移除</el-button>
|
||||||
|
<el-button size="mini" @click="getChannelList()">刷新</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -86,6 +88,7 @@
|
||||||
export default {
|
export default {
|
||||||
name: 'shareChannelAdd',
|
name: 'shareChannelAdd',
|
||||||
components: {},
|
components: {},
|
||||||
|
props: [ 'platformId'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
channelList: [],
|
channelList: [],
|
||||||
|
@ -190,6 +193,42 @@ export default {
|
||||||
this.$message.error(error)
|
this.$message.error(error)
|
||||||
this.loading = false
|
this.loading = false
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
addAll: function (row) {
|
||||||
|
this.$confirm("确定全部添加?", '提示', {
|
||||||
|
dangerouslyUseHTMLString: true,
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.loading = true
|
||||||
|
|
||||||
|
this.$axios({
|
||||||
|
method: 'post',
|
||||||
|
url: `/api/platform/channel/add`,
|
||||||
|
data: {
|
||||||
|
platformId: this.platformId,
|
||||||
|
all: true
|
||||||
|
}
|
||||||
|
}).then((res)=> {
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
this.$message.success("保存成功")
|
||||||
|
this.getChannelList()
|
||||||
|
}else {
|
||||||
|
this.$message.error(res.data.msg)
|
||||||
|
}
|
||||||
|
this.loading = false
|
||||||
|
}).catch((error)=> {
|
||||||
|
this.$message.error(error)
|
||||||
|
this.loading = false
|
||||||
|
});
|
||||||
|
}).catch(() => {
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
remove: function (row) {
|
remove: function (row) {
|
||||||
let channels = []
|
let channels = []
|
||||||
|
@ -203,9 +242,10 @@ export default {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
|
|
||||||
this.$axios({
|
this.$axios({
|
||||||
method: 'post',
|
method: 'delete',
|
||||||
url: `/api/platform/channel/delete`,
|
url: `/api/platform/channel/remove`,
|
||||||
data: {
|
data: {
|
||||||
|
platformId: this.platformId,
|
||||||
channelIds: channels
|
channelIds: channels
|
||||||
}
|
}
|
||||||
}).then((res)=> {
|
}).then((res)=> {
|
||||||
|
@ -221,6 +261,38 @@ export default {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
removeAll: function (row) {
|
||||||
|
|
||||||
|
this.$confirm("确定全部移除?", '提示', {
|
||||||
|
dangerouslyUseHTMLString: true,
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.loading = true
|
||||||
|
this.$axios({
|
||||||
|
method: 'delete',
|
||||||
|
url: `/api/platform/channel/remove`,
|
||||||
|
data: {
|
||||||
|
platformId: this.platformId,
|
||||||
|
all: true
|
||||||
|
}
|
||||||
|
}).then((res)=> {
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
this.$message.success("保存成功")
|
||||||
|
this.getChannelList()
|
||||||
|
}else {
|
||||||
|
this.$message.error(res.data.msg)
|
||||||
|
}
|
||||||
|
this.loading = false
|
||||||
|
}).catch((error)=> {
|
||||||
|
this.$message.error(error)
|
||||||
|
this.loading = false
|
||||||
|
});
|
||||||
|
}).catch(() => {
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
search: function () {
|
search: function () {
|
||||||
this.currentPage = 1;
|
this.currentPage = 1;
|
||||||
this.total = 0;
|
this.total = 0;
|
||||||
|
|
Loading…
Reference in New Issue