临时提交
parent
9bbc3c44e0
commit
d97accee4a
|
@ -35,10 +35,10 @@ public class GbCode {
|
||||||
code = code.trim();
|
code = code.trim();
|
||||||
GbCode gbCode = new GbCode();
|
GbCode gbCode = new GbCode();
|
||||||
gbCode.setCenterCode(code.substring(0, 8));
|
gbCode.setCenterCode(code.substring(0, 8));
|
||||||
gbCode.setIndustryCode(code.substring(9, 10));
|
gbCode.setIndustryCode(code.substring(8, 10));
|
||||||
gbCode.setTypeCode(code.substring(11, 13));
|
gbCode.setTypeCode(code.substring(10, 13));
|
||||||
gbCode.setNetCode(code.substring(14, 15));
|
gbCode.setNetCode(code.substring(13, 14));
|
||||||
gbCode.setSn(code.substring(15, 20));
|
gbCode.setSn(code.substring(14));
|
||||||
return gbCode;
|
return gbCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,28 +34,18 @@ public class GroupTree {
|
||||||
@Schema(description = "父区域国标ID")
|
@Schema(description = "父区域国标ID")
|
||||||
private String parentDeviceId;
|
private String parentDeviceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务分组ID
|
||||||
|
*/
|
||||||
|
@Schema(description = "父区域国标ID")
|
||||||
|
private String businessGroup;
|
||||||
|
|
||||||
@Schema(description = "是否有子节点")
|
@Schema(description = "是否有子节点")
|
||||||
private boolean isLeaf;
|
private boolean isLeaf;
|
||||||
|
|
||||||
@Schema(description = "类型, 行政区划:0 摄像头: 1")
|
@Schema(description = "类型, 行政区划:0 摄像头: 1")
|
||||||
private int type;
|
private int type;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static GroupTree getInstance(Region region) {
|
|
||||||
GroupTree regionTree = new GroupTree();
|
|
||||||
regionTree.setId(region.getDeviceId());
|
|
||||||
regionTree.setLabel(region.getName());
|
|
||||||
regionTree.setParentDeviceId(region.getParentDeviceId());
|
|
||||||
regionTree.setType(0);
|
|
||||||
if (region.getDeviceId().length() < 8) {
|
|
||||||
regionTree.setLeaf(false);
|
|
||||||
}else {
|
|
||||||
regionTree.setLeaf(true);
|
|
||||||
}
|
|
||||||
return regionTree;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GroupTree getInstance(CommonGBChannel channel) {
|
public static GroupTree getInstance(CommonGBChannel channel) {
|
||||||
GroupTree regionTree = new GroupTree();
|
GroupTree regionTree = new GroupTree();
|
||||||
regionTree.setId(channel.getGbDeviceId());
|
regionTree.setId(channel.getGbDeviceId());
|
||||||
|
|
|
@ -5,7 +5,9 @@ import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceType;
|
import com.genersoft.iot.vmp.gb28181.bean.DeviceType;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.IndustryCodeType;
|
import com.genersoft.iot.vmp.gb28181.bean.IndustryCodeType;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.NetworkIdentificationType;
|
import com.genersoft.iot.vmp.gb28181.bean.NetworkIdentificationType;
|
||||||
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelToRegionBYGbDeviceParam;
|
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelToGroupByGbDeviceParam;
|
||||||
|
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelToGroupParam;
|
||||||
|
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelToRegionByGbDeviceParam;
|
||||||
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelToRegionParam;
|
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelToRegionParam;
|
||||||
import com.genersoft.iot.vmp.gb28181.service.IGbChannelService;
|
import com.genersoft.iot.vmp.gb28181.service.IGbChannelService;
|
||||||
import com.genersoft.iot.vmp.media.service.IMediaServerService;
|
import com.genersoft.iot.vmp.media.service.IMediaServerService;
|
||||||
|
@ -119,16 +121,54 @@ public class CommonChannelController {
|
||||||
|
|
||||||
@Operation(summary = "通道设置行政区划-根据国标设备", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
@Operation(summary = "通道设置行政区划-根据国标设备", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||||
@PostMapping("/region/device/add")
|
@PostMapping("/region/device/add")
|
||||||
public void addChannelToRegionBYGbDevice(@RequestBody ChannelToRegionBYGbDeviceParam param){
|
public void addChannelToRegionByGbDevice(@RequestBody ChannelToRegionByGbDeviceParam param){
|
||||||
Assert.notEmpty(param.getDeviceIds(),"参数异常");
|
Assert.notEmpty(param.getDeviceIds(),"参数异常");
|
||||||
Assert.hasLength(param.getCivilCode(),"未添加行政区划");
|
Assert.hasLength(param.getCivilCode(),"未添加行政区划");
|
||||||
channelService.addChannelToRegionBYGbDevice(param.getCivilCode(), param.getDeviceIds());
|
channelService.addChannelToRegionByGbDevice(param.getCivilCode(), param.getDeviceIds());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "通道删除行政区划-根据国标设备", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
@Operation(summary = "通道删除行政区划-根据国标设备", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||||
@PostMapping("/region/device/delete")
|
@PostMapping("/region/device/delete")
|
||||||
public void deleteChannelToRegionBYGbDevice(@RequestBody ChannelToRegionBYGbDeviceParam param){
|
public void deleteChannelToRegionByGbDevice(@RequestBody ChannelToRegionByGbDeviceParam param){
|
||||||
Assert.notEmpty(param.getDeviceIds(),"参数异常");
|
Assert.notEmpty(param.getDeviceIds(),"参数异常");
|
||||||
channelService.deleteChannelToRegionBYGbDevice(param.getDeviceIds());
|
channelService.deleteChannelToRegionByGbDevice(param.getDeviceIds());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Operation(summary = "通道设置业务分组", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||||
|
@PostMapping("/group/add")
|
||||||
|
public void addChannelToGroup(@RequestBody ChannelToGroupParam param){
|
||||||
|
Assert.notEmpty(param.getChannelIds(),"通道ID不可为空");
|
||||||
|
Assert.hasLength(param.getParentId(),"未添加上级分组编号");
|
||||||
|
Assert.hasLength(param.getBusinessGroup(),"未添加业务分组");
|
||||||
|
channelService.addChannelToGroup(param.getParentId(), param.getBusinessGroup(), param.getChannelIds());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "通道删除业务分组", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||||
|
@PostMapping("/group/delete")
|
||||||
|
public void deleteChannelToGroup(@RequestBody ChannelToGroupParam param){
|
||||||
|
Assert.isTrue(!param.getChannelIds().isEmpty()
|
||||||
|
|| (!ObjectUtils.isEmpty(param.getParentId()) && !ObjectUtils.isEmpty(param.getBusinessGroup())),
|
||||||
|
"参数异常");
|
||||||
|
channelService.deleteChannelToGroup(param.getParentId(), param.getBusinessGroup(), param.getChannelIds());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "通道设置业务分组-根据国标设备", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||||
|
@PostMapping("/group/device/add")
|
||||||
|
public void addChannelToGroupByGbDevice(@RequestBody ChannelToGroupByGbDeviceParam param){
|
||||||
|
Assert.notEmpty(param.getDeviceIds(),"参数异常");
|
||||||
|
Assert.hasLength(param.getParentId(),"未添加上级分组编号");
|
||||||
|
Assert.hasLength(param.getBusinessGroup(),"未添加业务分组");
|
||||||
|
channelService.addChannelToGroupByGbDevice(param.getParentId(), param.getBusinessGroup(), param.getDeviceIds());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "通道删除业务分组-根据国标设备", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||||
|
@PostMapping("/group/device/delete")
|
||||||
|
public void deleteChannelToGroupByGbDevice(@RequestBody ChannelToGroupByGbDeviceParam param){
|
||||||
|
Assert.notEmpty(param.getDeviceIds(),"参数异常");
|
||||||
|
channelService.deleteChannelToGroupByGbDevice(param.getDeviceIds());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -255,7 +255,7 @@ public class PlatformController {
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean deleteResult = storager.deleteParentPlatform(parentPlatform);
|
boolean deleteResult = storager.deleteParentPlatform(parentPlatform);
|
||||||
storager.delCatalogByPlatformId(parentPlatform.getServerGBId());
|
// storager.delCatalogByPlatformId(parentPlatform.getServerGBId());
|
||||||
storager.delRelationByPlatformId(parentPlatform.getServerGBId());
|
storager.delRelationByPlatformId(parentPlatform.getServerGBId());
|
||||||
// 停止发送位置订阅定时任务
|
// 停止发送位置订阅定时任务
|
||||||
String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetting.getServerId() + "_MobilePosition_" + parentPlatform.getServerGBId();
|
String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetting.getServerId() + "_MobilePosition_" + parentPlatform.getServerGBId();
|
||||||
|
@ -382,124 +382,6 @@ public class PlatformController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取目录
|
|
||||||
*
|
|
||||||
* @param platformId 平台ID
|
|
||||||
* @param parentId 目录父ID
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Operation(summary = "获取目录", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
|
||||||
@Parameter(name = "platformId", description = "上级平台的国标编号", required = true)
|
|
||||||
@Parameter(name = "parentId", description = "父级目录的国标编号", required = true)
|
|
||||||
@GetMapping("/catalog")
|
|
||||||
@ResponseBody
|
|
||||||
public List<PlatformCatalog> getCatalogByPlatform(String platformId, String parentId) {
|
|
||||||
|
|
||||||
if (log.isDebugEnabled()) {
|
|
||||||
log.debug("查询目录,platformId: {}, parentId: {}", platformId, parentId);
|
|
||||||
}
|
|
||||||
ParentPlatform platform = storager.queryParentPlatByServerGBId(platformId);
|
|
||||||
if (platform == null) {
|
|
||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "平台未找到");
|
|
||||||
}
|
|
||||||
// if (platformId.equals(parentId)) {
|
|
||||||
// parentId = platform.getDeviceGBId();
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (platformId.equals(platform.getDeviceGBId())) {
|
|
||||||
parentId = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return storager.getChildrenCatalogByPlatform(platformId, parentId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加目录
|
|
||||||
*
|
|
||||||
* @param platformCatalog 目录
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Operation(summary = "添加目录", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
|
||||||
@PostMapping("/catalog/add")
|
|
||||||
@ResponseBody
|
|
||||||
public void addCatalog(@RequestBody PlatformCatalog platformCatalog) {
|
|
||||||
|
|
||||||
if (log.isDebugEnabled()) {
|
|
||||||
log.debug("添加目录,{}", JSON.toJSONString(platformCatalog));
|
|
||||||
}
|
|
||||||
PlatformCatalog platformCatalogInStore = storager.getCatalog(platformCatalog.getPlatformId(), platformCatalog.getId());
|
|
||||||
|
|
||||||
if (platformCatalogInStore != null) {
|
|
||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), platformCatalog.getId() + " already exists");
|
|
||||||
}
|
|
||||||
int addResult = storager.addCatalog(platformCatalog);
|
|
||||||
if (addResult <= 0) {
|
|
||||||
throw new ControllerException(ErrorCode.ERROR100);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 编辑目录
|
|
||||||
*
|
|
||||||
* @param platformCatalog 目录
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Operation(summary = "编辑目录", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
|
||||||
@PostMapping("/catalog/edit")
|
|
||||||
@ResponseBody
|
|
||||||
public void editCatalog(@RequestBody PlatformCatalog platformCatalog) {
|
|
||||||
|
|
||||||
if (log.isDebugEnabled()) {
|
|
||||||
log.debug("编辑目录,{}", JSON.toJSONString(platformCatalog));
|
|
||||||
}
|
|
||||||
PlatformCatalog platformCatalogInStore = storager.getCatalog(platformCatalog.getPlatformId(), platformCatalog.getId());
|
|
||||||
|
|
||||||
if (platformCatalogInStore == null) {
|
|
||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), platformCatalog.getId() + " not exists");
|
|
||||||
}
|
|
||||||
int addResult = storager.updateCatalog(platformCatalog);
|
|
||||||
if (addResult <= 0) {
|
|
||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "写入数据库失败");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除目录
|
|
||||||
*
|
|
||||||
* @param id 目录Id
|
|
||||||
* @param platformId 平台Id
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Operation(summary = "删除目录", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
|
||||||
@Parameter(name = "id", description = "目录Id", required = true)
|
|
||||||
@Parameter(name = "platformId", description = "平台Id", required = true)
|
|
||||||
@DeleteMapping("/catalog/del")
|
|
||||||
@ResponseBody
|
|
||||||
public void delCatalog(String id, String platformId) {
|
|
||||||
|
|
||||||
if (log.isDebugEnabled()) {
|
|
||||||
log.debug("删除目录,{}", id);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ObjectUtils.isEmpty(id) || ObjectUtils.isEmpty(platformId)) {
|
|
||||||
throw new ControllerException(ErrorCode.ERROR400);
|
|
||||||
}
|
|
||||||
|
|
||||||
int delResult = storager.delCatalog(platformId, id);
|
|
||||||
// 如果删除的是默认目录则根目录设置为默认目录
|
|
||||||
PlatformCatalog parentPlatform = storager.queryDefaultCatalogInPlatform(platformId);
|
|
||||||
|
|
||||||
// 默认节点被移除
|
|
||||||
if (parentPlatform == null) {
|
|
||||||
storager.setDefaultCatalog(platformId, platformId);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (delResult <= 0) {
|
|
||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "写入数据库失败");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除关联
|
* 删除关联
|
||||||
*
|
*
|
||||||
|
@ -522,29 +404,4 @@ public class PlatformController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改默认目录
|
|
||||||
*
|
|
||||||
* @param platformId 平台Id
|
|
||||||
* @param catalogId 目录Id
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Operation(summary = "修改默认目录", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
|
||||||
@Parameter(name = "catalogId", description = "目录Id", required = true)
|
|
||||||
@Parameter(name = "platformId", description = "平台Id", required = true)
|
|
||||||
@PostMapping("/catalog/default/update")
|
|
||||||
@ResponseBody
|
|
||||||
public void setDefaultCatalog(String platformId, String catalogId) {
|
|
||||||
|
|
||||||
if (log.isDebugEnabled()) {
|
|
||||||
log.debug("修改默认目录,{},{}", platformId, catalogId);
|
|
||||||
}
|
|
||||||
int updateResult = storager.setDefaultCatalog(platformId, catalogId);
|
|
||||||
|
|
||||||
if (updateResult <= 0) {
|
|
||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "写入数据库失败");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.genersoft.iot.vmp.gb28181.controller.bean;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ChannelToGroupByGbDeviceParam {
|
||||||
|
private List<Integer> deviceIds;
|
||||||
|
private String parentId;
|
||||||
|
private String businessGroup;
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.genersoft.iot.vmp.gb28181.controller.bean;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ChannelToGroupParam {
|
||||||
|
|
||||||
|
private String parentId;
|
||||||
|
private String businessGroup;
|
||||||
|
private List<Integer> channelIds;
|
||||||
|
|
||||||
|
}
|
|
@ -5,7 +5,7 @@ import lombok.Data;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class ChannelToRegionBYGbDeviceParam {
|
public class ChannelToRegionByGbDeviceParam {
|
||||||
private List<Integer> deviceIds;
|
private List<Integer> deviceIds;
|
||||||
private String civilCode;
|
private String civilCode;
|
||||||
}
|
}
|
|
@ -380,7 +380,7 @@ public interface CommonGBChannelMapper {
|
||||||
" WHERE id in "+
|
" WHERE id in "+
|
||||||
" <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbId}</foreach>" +
|
" <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbId}</foreach>" +
|
||||||
" </script>"})
|
" </script>"})
|
||||||
void updateBusinessGroupByChannelList(@Param("businessGroup") String businessGroup, List<CommonGBChannel> channelList);
|
int updateBusinessGroupByChannelList(@Param("businessGroup") String businessGroup, List<CommonGBChannel> channelList);
|
||||||
|
|
||||||
@Update(value = {" <script>" +
|
@Update(value = {" <script>" +
|
||||||
" UPDATE wvp_device_channel " +
|
" UPDATE wvp_device_channel " +
|
||||||
|
@ -388,5 +388,15 @@ public interface CommonGBChannelMapper {
|
||||||
" WHERE id in "+
|
" WHERE id in "+
|
||||||
" <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbId}</foreach>" +
|
" <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbId}</foreach>" +
|
||||||
" </script>"})
|
" </script>"})
|
||||||
void updateParentIdByChannelList(@Param("parentId") String parentId, List<CommonGBChannel> channelList);
|
int updateParentIdByChannelList(@Param("parentId") String parentId, List<CommonGBChannel> channelList);
|
||||||
|
|
||||||
|
@Update(value = {" <script>" +
|
||||||
|
" UPDATE wvp_device_channel " +
|
||||||
|
" SET gb_parent_id = #{parentId}, gb_business_group_id = #{businessGroup}" +
|
||||||
|
" WHERE id in "+
|
||||||
|
" <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbId}</foreach>" +
|
||||||
|
" </script>"})
|
||||||
|
int updateGroup(@Param("parentId") String parentId, @Param("businessGroup") String businessGroup,
|
||||||
|
List<CommonGBChannel> channelList);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.genersoft.iot.vmp.gb28181.dao;
|
package com.genersoft.iot.vmp.gb28181.dao;
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.Group;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.Group;
|
import com.genersoft.iot.vmp.gb28181.bean.Group;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.GroupTree;
|
import com.genersoft.iot.vmp.gb28181.bean.GroupTree;
|
||||||
import org.apache.ibatis.annotations.*;
|
import org.apache.ibatis.annotations.*;
|
||||||
|
@ -16,6 +15,11 @@ public interface GroupMapper {
|
||||||
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
|
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
|
||||||
int add(Group group);
|
int add(Group group);
|
||||||
|
|
||||||
|
@Insert("INSERT INTO wvp_common_group (device_id, name, business_group, platform_id, create_time, update_time) " +
|
||||||
|
"VALUES (#{deviceId}, #{name}, #{businessGroup}, #{platformId}, #{createTime}, #{updateTime})")
|
||||||
|
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
|
||||||
|
int addBusinessGroup(Group group);
|
||||||
|
|
||||||
@Delete("DELETE FROM wvp_common_group WHERE id=#{id}")
|
@Delete("DELETE FROM wvp_common_group WHERE id=#{id}")
|
||||||
int delete(@Param("id") int id);
|
int delete(@Param("id") int id);
|
||||||
|
|
||||||
|
@ -61,11 +65,12 @@ public interface GroupMapper {
|
||||||
" device_id," +
|
" device_id," +
|
||||||
" name, " +
|
" name, " +
|
||||||
" parent_device_id," +
|
" parent_device_id," +
|
||||||
|
" business_group," +
|
||||||
" create_time," +
|
" create_time," +
|
||||||
" update_time) " +
|
" update_time) " +
|
||||||
" VALUES " +
|
" VALUES " +
|
||||||
" <foreach collection='groupList' index='index' item='item' separator=','> " +
|
" <foreach collection='groupList' index='index' item='item' separator=','> " +
|
||||||
" (#{item.deviceId}, #{item.name}, #{item.parentDeviceId},#{item.createTime},#{item.updateTime})" +
|
" (#{item.deviceId}, #{item.name}, #{item.parentDeviceId}, #{item.businessGroup},#{item.createTime},#{item.updateTime})" +
|
||||||
" </foreach> " +
|
" </foreach> " +
|
||||||
" </script>")
|
" </script>")
|
||||||
int batchAdd(List<Group> groupList);
|
int batchAdd(List<Group> groupList);
|
||||||
|
@ -75,20 +80,40 @@ public interface GroupMapper {
|
||||||
" device_id as id," +
|
" device_id as id," +
|
||||||
" name as label, " +
|
" name as label, " +
|
||||||
" parent_device_id," +
|
" parent_device_id," +
|
||||||
|
" business_group," +
|
||||||
" id as db_id," +
|
" id as db_id," +
|
||||||
" 0 as type," +
|
" 0 as type," +
|
||||||
" false as is_leaf" +
|
" false as is_leaf" +
|
||||||
" from wvp_common_group " +
|
" from wvp_common_group " +
|
||||||
" where " +
|
" where 1=1 " +
|
||||||
" <if test='parentId != null'> parent_device_id = #{parentId} </if> " +
|
" <if test='parentId != null'> and parent_device_id = #{parentId} </if> " +
|
||||||
" <if test='parentId == null'> parent_device_id is null </if> " +
|
" <if test='parentId == null'> and parent_device_id is null </if> " +
|
||||||
" <if test='platformId != null'> platform_id = #{platformId} </if> " +
|
" <if test='platformId != null'> and platform_id = #{platformId} </if> " +
|
||||||
" <if test='platformId == null'> platform_id is null </if> " +
|
" <if test='platformId == null'> and platform_id is null </if> " +
|
||||||
" <if test='query != null'> AND (device_id LIKE concat('%',#{query},'%') OR name LIKE concat('%',#{query},'%'))</if> " +
|
" <if test='query != null'> AND (device_id LIKE concat('%',#{query},'%') OR name LIKE concat('%',#{query},'%'))</if> " +
|
||||||
" </script>")
|
" </script>")
|
||||||
List<GroupTree> queryForTree(@Param("query") String query, @Param("parentId") String parentId,
|
List<GroupTree> queryForTree(@Param("query") String query, @Param("parentId") String parentId,
|
||||||
@Param("platformId") Integer platformId);
|
@Param("platformId") Integer platformId);
|
||||||
|
|
||||||
|
@Select(" <script>" +
|
||||||
|
" SELECT " +
|
||||||
|
" device_id as id," +
|
||||||
|
" name as label, " +
|
||||||
|
" parent_device_id," +
|
||||||
|
" business_group," +
|
||||||
|
" id as db_id," +
|
||||||
|
" 0 as type," +
|
||||||
|
" false as is_leaf" +
|
||||||
|
" from wvp_common_group " +
|
||||||
|
" where parent_device_id is null and business_group = #{businessGroup} and device_id != #{businessGroup}" +
|
||||||
|
" <if test='platformId != null'> and platform_id = #{platformId} </if> " +
|
||||||
|
" <if test='platformId == null'> and platform_id is null </if> " +
|
||||||
|
" <if test='query != null'> AND (device_id LIKE concat('%',#{query},'%') OR name LIKE concat('%',#{query},'%'))</if> " +
|
||||||
|
" </script>")
|
||||||
|
List<GroupTree> queryForTreeByBusinessGroup(@Param("query") String query,
|
||||||
|
@Param("businessGroup") String businessGroup,
|
||||||
|
@Param("platformId") Integer platformId);
|
||||||
|
|
||||||
@Select(" <script>" +
|
@Select(" <script>" +
|
||||||
" SELECT " +
|
" SELECT " +
|
||||||
" device_id as id," +
|
" device_id as id," +
|
||||||
|
@ -123,5 +148,8 @@ public interface GroupMapper {
|
||||||
@Delete("DELETE FROM wvp_common_group WHERE business_group = #{businessGroup}")
|
@Delete("DELETE FROM wvp_common_group WHERE business_group = #{businessGroup}")
|
||||||
int deleteByBusinessGroup(@Param("businessGroup") String businessGroup);
|
int deleteByBusinessGroup(@Param("businessGroup") String businessGroup);
|
||||||
|
|
||||||
|
@Update(" UPDATE wvp_common_group " +
|
||||||
|
" SET parent_device_id=#{group.deviceId}, business_group = #{group.businessGroup}" +
|
||||||
|
" WHERE parent_device_id = #{oldDeviceId}")
|
||||||
|
int updateChild(@Param("oldDeviceId") String oldDeviceId, Group group);
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,5 +118,5 @@ public interface PlatformChannelMapper {
|
||||||
List<Device> queryDeviceInfoByPlatformIdAndChannelId(@Param("platformId") String platformId, @Param("channelId") String channelId);
|
List<Device> queryDeviceInfoByPlatformIdAndChannelId(@Param("platformId") String platformId, @Param("channelId") String 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}")
|
@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<String> queryParentPlatformByChannelId(@Param("channelId") String channelId);
|
List<Integer> queryParentPlatformByChannelId(@Param("channelId") String channelId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -208,7 +208,7 @@ public class ChannelProvider {
|
||||||
StringBuilder sqlBuild = new StringBuilder();
|
StringBuilder sqlBuild = new StringBuilder();
|
||||||
sqlBuild.append(getBaseSelectSql());
|
sqlBuild.append(getBaseSelectSql());
|
||||||
|
|
||||||
sqlBuild.append(" gb_business_group_id in ( ");
|
sqlBuild.append(" where gb_business_group_id in ( ");
|
||||||
Collection<Group> ids = (Collection<Group>)params.get("groupList");
|
Collection<Group> ids = (Collection<Group>)params.get("groupList");
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
for (Group group : ids) {
|
for (Group group : ids) {
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class EventPublisher {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void catalogEventPublish(String platformId, CommonGBChannel deviceChannel, String type) {
|
public void catalogEventPublish(Integer platformId, CommonGBChannel deviceChannel, String type) {
|
||||||
List<CommonGBChannel> deviceChannelList = new ArrayList<>();
|
List<CommonGBChannel> deviceChannelList = new ArrayList<>();
|
||||||
deviceChannelList.add(deviceChannel);
|
deviceChannelList.add(deviceChannel);
|
||||||
catalogEventPublish(platformId, deviceChannelList, type);
|
catalogEventPublish(platformId, deviceChannelList, type);
|
||||||
|
@ -72,7 +72,7 @@ public class EventPublisher {
|
||||||
* @param deviceChannels
|
* @param deviceChannels
|
||||||
* @param type
|
* @param type
|
||||||
*/
|
*/
|
||||||
public void catalogEventPublish(String platformId, List<CommonGBChannel> deviceChannels, String type) {
|
public void catalogEventPublish(Integer platformId, List<CommonGBChannel> deviceChannels, String type) {
|
||||||
CatalogEvent outEvent = new CatalogEvent(this);
|
CatalogEvent outEvent = new CatalogEvent(this);
|
||||||
List<CommonGBChannel> channels = new ArrayList<>();
|
List<CommonGBChannel> channels = new ArrayList<>();
|
||||||
if (deviceChannels.size() > 1) {
|
if (deviceChannels.size() > 1) {
|
||||||
|
|
|
@ -58,6 +58,6 @@ public class CatalogEvent extends ApplicationEvent {
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
@Getter
|
@Getter
|
||||||
private String platformId;
|
private Integer platformId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,16 @@
|
||||||
package com.genersoft.iot.vmp.gb28181.event.subscribe.catalog;
|
package com.genersoft.iot.vmp.gb28181.event.subscribe.catalog;
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.SubscribeHolder;
|
import com.genersoft.iot.vmp.gb28181.bean.SubscribeHolder;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.SubscribeInfo;
|
import com.genersoft.iot.vmp.gb28181.bean.SubscribeInfo;
|
||||||
|
import com.genersoft.iot.vmp.gb28181.service.IPlatformService;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
|
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
|
||||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||||
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.context.ApplicationListener;
|
import org.springframework.context.ApplicationListener;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.ObjectUtils;
|
|
||||||
|
|
||||||
import javax.sip.InvalidArgumentException;
|
import javax.sip.InvalidArgumentException;
|
||||||
import javax.sip.SipException;
|
import javax.sip.SipException;
|
||||||
|
@ -31,15 +30,15 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IVideoManagerStorage storager;
|
private IVideoManagerStorage storager;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IPlatformService platformService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISIPCommanderForPlatform sipCommanderFroPlatform;
|
private ISIPCommanderForPlatform sipCommanderFroPlatform;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SubscribeHolder subscribeHolder;
|
private SubscribeHolder subscribeHolder;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private UserSetting userSetting;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onApplicationEvent(CatalogEvent event) {
|
public void onApplicationEvent(CatalogEvent event) {
|
||||||
SubscribeInfo subscribe = null;
|
SubscribeInfo subscribe = null;
|
||||||
|
@ -47,13 +46,13 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> {
|
||||||
|
|
||||||
Map<String, List<ParentPlatform>> parentPlatformMap = new HashMap<>();
|
Map<String, List<ParentPlatform>> parentPlatformMap = new HashMap<>();
|
||||||
Map<String, CommonGBChannel> channelMap = new HashMap<>();
|
Map<String, CommonGBChannel> channelMap = new HashMap<>();
|
||||||
if (!ObjectUtils.isEmpty(event.getPlatformId())) {
|
if (event.getPlatformId() != null) {
|
||||||
subscribe = subscribeHolder.getCatalogSubscribe(event.getPlatformId());
|
parentPlatform = platformService.queryOne(event.getPlatformId());
|
||||||
if (subscribe == null) {
|
if (parentPlatform == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
parentPlatform = storager.queryParentPlatByServerGBId(event.getPlatformId());
|
subscribe = subscribeHolder.getCatalogSubscribe(parentPlatform.getServerGBId());
|
||||||
if (parentPlatform != null && !parentPlatform.isStatus()) {
|
if (subscribe == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +60,7 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> {
|
||||||
// 获取所用订阅
|
// 获取所用订阅
|
||||||
List<String> platforms = subscribeHolder.getAllCatalogSubscribePlatform();
|
List<String> platforms = subscribeHolder.getAllCatalogSubscribePlatform();
|
||||||
if (event.getChannels() != null) {
|
if (event.getChannels() != null) {
|
||||||
if (platforms.size() > 0) {
|
if (!platforms.isEmpty()) {
|
||||||
for (CommonGBChannel deviceChannel : event.getChannels()) {
|
for (CommonGBChannel deviceChannel : event.getChannels()) {
|
||||||
List<ParentPlatform> parentPlatformsForGB = storager.queryPlatFormListForGBWithGBId(deviceChannel.getGbDeviceId(), platforms);
|
List<ParentPlatform> parentPlatformsForGB = storager.queryPlatFormListForGBWithGBId(deviceChannel.getGbDeviceId(), platforms);
|
||||||
parentPlatformMap.put(deviceChannel.getGbDeviceId(), parentPlatformsForGB);
|
parentPlatformMap.put(deviceChannel.getGbDeviceId(), parentPlatformsForGB);
|
||||||
|
@ -75,13 +74,13 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> {
|
||||||
case CatalogEvent.OFF:
|
case CatalogEvent.OFF:
|
||||||
case CatalogEvent.DEL:
|
case CatalogEvent.DEL:
|
||||||
|
|
||||||
if (parentPlatform != null || subscribe != null) {
|
if (parentPlatform != null) {
|
||||||
List<CommonGBChannel> deviceChannelList = new ArrayList<>();
|
List<CommonGBChannel> deviceChannelList = new ArrayList<>();
|
||||||
if (event.getChannels() != null) {
|
if (event.getChannels() != null) {
|
||||||
deviceChannelList.addAll(event.getChannels());
|
deviceChannelList.addAll(event.getChannels());
|
||||||
}
|
}
|
||||||
if (deviceChannelList.size() > 0) {
|
if (!deviceChannelList.isEmpty()) {
|
||||||
log.info("[Catalog事件: {}]平台:{},影响通道{}个", event.getType(), event.getPlatformId(), deviceChannelList.size());
|
log.info("[Catalog事件: {}]平台:{},影响通道{}个", event.getType(), parentPlatform.getServerGBId(), deviceChannelList.size());
|
||||||
try {
|
try {
|
||||||
sipCommanderFroPlatform.sendNotifyForCatalogOther(event.getType(), parentPlatform, deviceChannelList, subscribe, null);
|
sipCommanderFroPlatform.sendNotifyForCatalogOther(event.getType(), parentPlatform, deviceChannelList, subscribe, null);
|
||||||
} catch (InvalidArgumentException | ParseException | NoSuchFieldException | SipException |
|
} catch (InvalidArgumentException | ParseException | NoSuchFieldException | SipException |
|
||||||
|
@ -89,10 +88,10 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> {
|
||||||
log.error("[命令发送失败] 国标级联 Catalog通知: {}", e.getMessage());
|
log.error("[命令发送失败] 国标级联 Catalog通知: {}", e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else if (parentPlatformMap.keySet().size() > 0) {
|
}else if (!parentPlatformMap.keySet().isEmpty()) {
|
||||||
for (String gbId : parentPlatformMap.keySet()) {
|
for (String gbId : parentPlatformMap.keySet()) {
|
||||||
List<ParentPlatform> parentPlatforms = parentPlatformMap.get(gbId);
|
List<ParentPlatform> parentPlatforms = parentPlatformMap.get(gbId);
|
||||||
if (parentPlatforms != null && parentPlatforms.size() > 0) {
|
if (parentPlatforms != null && !parentPlatforms.isEmpty()) {
|
||||||
for (ParentPlatform platform : parentPlatforms) {
|
for (ParentPlatform platform : parentPlatforms) {
|
||||||
SubscribeInfo subscribeInfo = subscribeHolder.getCatalogSubscribe(platform.getServerGBId());
|
SubscribeInfo subscribeInfo = subscribeHolder.getCatalogSubscribe(platform.getServerGBId());
|
||||||
if (subscribeInfo == null) {
|
if (subscribeInfo == null) {
|
||||||
|
@ -120,13 +119,13 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> {
|
||||||
break;
|
break;
|
||||||
case CatalogEvent.ADD:
|
case CatalogEvent.ADD:
|
||||||
case CatalogEvent.UPDATE:
|
case CatalogEvent.UPDATE:
|
||||||
if (parentPlatform != null || subscribe != null) {
|
if (parentPlatform != null) {
|
||||||
List<CommonGBChannel> deviceChannelList = new ArrayList<>();
|
List<CommonGBChannel> deviceChannelList = new ArrayList<>();
|
||||||
if (event.getChannels() != null) {
|
if (event.getChannels() != null) {
|
||||||
deviceChannelList.addAll(event.getChannels());
|
deviceChannelList.addAll(event.getChannels());
|
||||||
}
|
}
|
||||||
if (!deviceChannelList.isEmpty()) {
|
if (!deviceChannelList.isEmpty()) {
|
||||||
log.info("[Catalog事件: {}]平台:{},影响通道{}个", event.getType(), event.getPlatformId(), deviceChannelList.size());
|
log.info("[Catalog事件: {}]平台:{},影响通道{}个", event.getType(), parentPlatform.getServerGBId(), deviceChannelList.size());
|
||||||
try {
|
try {
|
||||||
sipCommanderFroPlatform.sendNotifyForCatalogAddOrUpdate(event.getType(), parentPlatform, deviceChannelList, subscribe, null);
|
sipCommanderFroPlatform.sendNotifyForCatalogAddOrUpdate(event.getType(), parentPlatform, deviceChannelList, subscribe, null);
|
||||||
} catch (InvalidArgumentException | ParseException | NoSuchFieldException | SipException |
|
} catch (InvalidArgumentException | ParseException | NoSuchFieldException | SipException |
|
||||||
|
|
|
@ -54,9 +54,9 @@ public interface IGbChannelService {
|
||||||
|
|
||||||
void deleteChannelToRegionByChannelIds(List<Integer> channelIds);
|
void deleteChannelToRegionByChannelIds(List<Integer> channelIds);
|
||||||
|
|
||||||
void addChannelToRegionBYGbDevice(String civilCode, List<Integer> deviceIds);
|
void addChannelToRegionByGbDevice(String civilCode, List<Integer> deviceIds);
|
||||||
|
|
||||||
void deleteChannelToRegionBYGbDevice(List<Integer> deviceIds);
|
void deleteChannelToRegionByGbDevice(List<Integer> deviceIds);
|
||||||
|
|
||||||
void removeParentIdByBusinessGroup(String businessGroup);
|
void removeParentIdByBusinessGroup(String businessGroup);
|
||||||
|
|
||||||
|
@ -65,4 +65,12 @@ public interface IGbChannelService {
|
||||||
void updateBusinessGroup(String oldBusinessGroup, String newBusinessGroup);
|
void updateBusinessGroup(String oldBusinessGroup, String newBusinessGroup);
|
||||||
|
|
||||||
void updateParentIdGroup(String oldParentId, String newParentId);
|
void updateParentIdGroup(String oldParentId, String newParentId);
|
||||||
|
|
||||||
|
void addChannelToGroup(String parentId, String businessGroup, List<Integer> channelIds);
|
||||||
|
|
||||||
|
void deleteChannelToGroup(String parentId, String businessGroup, List<Integer> channelIds);
|
||||||
|
|
||||||
|
void addChannelToGroupByGbDevice(String parentId, String businessGroup, List<Integer> deviceIds);
|
||||||
|
|
||||||
|
void deleteChannelToGroupByGbDevice(List<Integer> deviceIds);
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,4 +82,6 @@ public interface IPlatformService {
|
||||||
void stopBroadcast(ParentPlatform platform, DeviceChannel channel, String stream,boolean sendBye, MediaServer mediaServerItem);
|
void stopBroadcast(ParentPlatform platform, DeviceChannel channel, String stream,boolean sendBye, MediaServer mediaServerItem);
|
||||||
|
|
||||||
void addSimulatedSubscribeInfo(ParentPlatform parentPlatform);
|
void addSimulatedSubscribeInfo(ParentPlatform parentPlatform);
|
||||||
|
|
||||||
|
ParentPlatform queryOne(Integer platformId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -457,9 +457,9 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
||||||
deviceChannel.setHasAudio(channelInDb.isHasAudio());
|
deviceChannel.setHasAudio(channelInDb.isHasAudio());
|
||||||
deviceChannel.setId(channelInDb.getId());
|
deviceChannel.setId(channelInDb.getId());
|
||||||
if (channelInDb.getStatus().equalsIgnoreCase(deviceChannel.getStatus())){
|
if (channelInDb.getStatus().equalsIgnoreCase(deviceChannel.getStatus())){
|
||||||
List<String> strings = platformChannelMapper.queryParentPlatformByChannelId(deviceChannel.getDeviceId());
|
List<Integer> ids = platformChannelMapper.queryParentPlatformByChannelId(deviceChannel.getDeviceId());
|
||||||
if (!CollectionUtils.isEmpty(strings)){
|
if (!CollectionUtils.isEmpty(ids)){
|
||||||
strings.forEach(platformId->{
|
ids.forEach(platformId->{
|
||||||
eventPublisher.catalogEventPublish(platformId, deviceChannel, deviceChannel.getStatus().equals("ON")? CatalogEvent.ON:CatalogEvent.OFF);
|
eventPublisher.catalogEventPublish(platformId, deviceChannel, deviceChannel.getStatus().equals("ON")? CatalogEvent.ON:CatalogEvent.OFF);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -342,6 +342,9 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||||
if (channelList.isEmpty()) {
|
if (channelList.isEmpty()) {
|
||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "所有通道Id不存在");
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "所有通道Id不存在");
|
||||||
}
|
}
|
||||||
|
for (CommonGBChannel channel : channelList) {
|
||||||
|
channel.setGbCivilCode(civilCode);
|
||||||
|
}
|
||||||
int result = commonGBChannelMapper.updateRegion(civilCode, channelList);
|
int result = commonGBChannelMapper.updateRegion(civilCode, channelList);
|
||||||
// 发送通知
|
// 发送通知
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
|
@ -402,11 +405,14 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addChannelToRegionBYGbDevice(String civilCode, List<Integer> deviceIds) {
|
public void addChannelToRegionByGbDevice(String civilCode, List<Integer> deviceIds) {
|
||||||
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByGbDeviceIds(deviceIds);
|
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByGbDeviceIds(deviceIds);
|
||||||
if (channelList.isEmpty()) {
|
if (channelList.isEmpty()) {
|
||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "所有通道Id不存在");
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "所有通道Id不存在");
|
||||||
}
|
}
|
||||||
|
for (CommonGBChannel channel : channelList) {
|
||||||
|
channel.setGbCivilCode(civilCode);
|
||||||
|
}
|
||||||
int result = commonGBChannelMapper.updateRegion(civilCode, channelList);
|
int result = commonGBChannelMapper.updateRegion(civilCode, channelList);
|
||||||
// 发送通知
|
// 发送通知
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
|
@ -420,7 +426,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteChannelToRegionBYGbDevice(List<Integer> deviceIds) {
|
public void deleteChannelToRegionByGbDevice(List<Integer> deviceIds) {
|
||||||
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByGbDeviceIds(deviceIds);
|
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByGbDeviceIds(deviceIds);
|
||||||
if (channelList.isEmpty()) {
|
if (channelList.isEmpty()) {
|
||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "所有通道Id不存在");
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "所有通道Id不存在");
|
||||||
|
@ -431,7 +437,9 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||||
@Override
|
@Override
|
||||||
public void removeParentIdByBusinessGroup(String businessGroup) {
|
public void removeParentIdByBusinessGroup(String businessGroup) {
|
||||||
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByBusinessGroup(businessGroup);
|
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByBusinessGroup(businessGroup);
|
||||||
Assert.notEmpty(channelList, "所有业务分组的通道不存在");
|
if (channelList.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
int result = commonGBChannelMapper.removeParentIdByChannels(channelList);
|
int result = commonGBChannelMapper.removeParentIdByChannels(channelList);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -439,8 +447,10 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||||
@Override
|
@Override
|
||||||
public void removeParentIdByGroupList(List<Group> groupList) {
|
public void removeParentIdByGroupList(List<Group> groupList) {
|
||||||
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByGroupList(groupList);
|
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByGroupList(groupList);
|
||||||
Assert.notEmpty(channelList, "所有业务分组的通道不存在");
|
if (channelList.isEmpty()) {
|
||||||
int result = commonGBChannelMapper.removeParentIdByChannels(channelList);
|
return;
|
||||||
|
}
|
||||||
|
commonGBChannelMapper.removeParentIdByChannels(channelList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -448,7 +458,8 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||||
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByBusinessGroup(oldBusinessGroup);
|
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByBusinessGroup(oldBusinessGroup);
|
||||||
Assert.notEmpty(channelList, "旧的业务分组的通道不存在");
|
Assert.notEmpty(channelList, "旧的业务分组的通道不存在");
|
||||||
|
|
||||||
commonGBChannelMapper.updateBusinessGroupByChannelList(newBusinessGroup, channelList);
|
int result = commonGBChannelMapper.updateBusinessGroupByChannelList(newBusinessGroup, channelList);
|
||||||
|
if (result > 0) {
|
||||||
for (CommonGBChannel channel : channelList) {
|
for (CommonGBChannel channel : channelList) {
|
||||||
channel.setGbBusinessGroupId(newBusinessGroup);
|
channel.setGbBusinessGroupId(newBusinessGroup);
|
||||||
}
|
}
|
||||||
|
@ -459,13 +470,17 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||||
log.warn("[多个通道业务分组] 发送失败,数量:{}", channelList.size(), e);
|
log.warn("[多个通道业务分组] 发送失败,数量:{}", channelList.size(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateParentIdGroup(String oldParentId, String newParentId) {
|
public void updateParentIdGroup(String oldParentId, String newParentId) {
|
||||||
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByParentId(oldParentId);
|
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByParentId(oldParentId);
|
||||||
Assert.notEmpty(channelList, "旧的虚拟组织的通道不存在");
|
if (channelList.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
commonGBChannelMapper.updateParentIdByChannelList(newParentId, channelList);
|
int result = commonGBChannelMapper.updateParentIdByChannelList(newParentId, channelList);
|
||||||
|
if (result > 0) {
|
||||||
for (CommonGBChannel channel : channelList) {
|
for (CommonGBChannel channel : channelList) {
|
||||||
channel.setGbParentId(newParentId);
|
channel.setGbParentId(newParentId);
|
||||||
}
|
}
|
||||||
|
@ -476,4 +491,62 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||||
log.warn("[多个通道业务分组] 发送失败,数量:{}", channelList.size(), e);
|
log.warn("[多个通道业务分组] 发送失败,数量:{}", channelList.size(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addChannelToGroup(String parentId, String businessGroup, List<Integer> channelIds) {
|
||||||
|
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByIds(channelIds);
|
||||||
|
if (channelList.isEmpty()) {
|
||||||
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "所有通道Id不存在");
|
||||||
|
}
|
||||||
|
int result = commonGBChannelMapper.updateGroup(parentId, businessGroup, channelList);
|
||||||
|
// 发送通知
|
||||||
|
if (result > 0) {
|
||||||
|
for (CommonGBChannel channel : channelList) {
|
||||||
|
channel.setGbBusinessGroupId(businessGroup);
|
||||||
|
channel.setGbParentId(parentId);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
// 发送catalog
|
||||||
|
eventPublisher.catalogEventPublish(null, channelList, CatalogEvent.UPDATE);
|
||||||
|
}catch (Exception e) {
|
||||||
|
log.warn("[多个通道添加行政区划] 发送失败,数量:{}", channelList.size(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteChannelToGroup(String parentId, String businessGroup, List<Integer> channelIds) {
|
||||||
|
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByGbDeviceIds(channelIds);
|
||||||
|
if (channelList.isEmpty()) {
|
||||||
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "所有通道Id不存在");
|
||||||
|
}
|
||||||
|
int result = commonGBChannelMapper.removeParentIdByChannels(channelList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addChannelToGroupByGbDevice(String parentId, String businessGroup, List<Integer> deviceIds) {
|
||||||
|
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByGbDeviceIds(deviceIds);
|
||||||
|
if (channelList.isEmpty()) {
|
||||||
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "所有通道Id不存在");
|
||||||
|
}
|
||||||
|
for (CommonGBChannel channel : channelList) {
|
||||||
|
channel.setGbCivilCode(civilCode);
|
||||||
|
}
|
||||||
|
int result = commonGBChannelMapper.updateRegion(civilCode, channelList);
|
||||||
|
// 发送通知
|
||||||
|
if (result > 0) {
|
||||||
|
try {
|
||||||
|
// 发送catalog
|
||||||
|
eventPublisher.catalogEventPublish(null, channelList, CatalogEvent.UPDATE);
|
||||||
|
}catch (Exception e) {
|
||||||
|
log.warn("[多个通道添加行政区划] 发送失败,数量:{}", channelList.size(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteChannelToGroupByGbDevice(List<Integer> deviceIds) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,43 +45,55 @@ public class GroupServiceImpl implements IGroupService {
|
||||||
Assert.notNull(group, "参数不可为NULL");
|
Assert.notNull(group, "参数不可为NULL");
|
||||||
Assert.notNull(group.getDeviceId(), "设备编号不可为NULL");
|
Assert.notNull(group.getDeviceId(), "设备编号不可为NULL");
|
||||||
Assert.isTrue(group.getDeviceId().trim().length() == 20, "设备编号必须为20位");
|
Assert.isTrue(group.getDeviceId().trim().length() == 20, "设备编号必须为20位");
|
||||||
Assert.isTrue(group.getParentDeviceId().trim().length() == 20, "父级编号错误");
|
|
||||||
Assert.notNull(group.getName(), "设备编号不可为NULL");
|
Assert.notNull(group.getName(), "设备编号不可为NULL");
|
||||||
|
|
||||||
GbCode gbCode = GbCode.decode(group.getDeviceId());
|
GbCode gbCode = GbCode.decode(group.getDeviceId());
|
||||||
Assert.notNull(gbCode, "设备编号不满足国标定义");
|
Assert.notNull(gbCode, "设备编号不满足国标定义");
|
||||||
// 根据字段判断此处应使用什么规则校验
|
if ("215".equals(gbCode.getTypeCode())){
|
||||||
if (ObjectUtils.isEmpty(group.getParentDeviceId())) {
|
// 添加业务分组
|
||||||
if (ObjectUtils.isEmpty(group.getBusinessGroup())) {
|
addBusinessGroup(group);
|
||||||
// 如果是建立业务分组,那么编号必须20位,且10-13必须为215,
|
|
||||||
Assert.isTrue("215".equals(gbCode.getTypeCode()), "创建业务分组时设备编号11-13位应使用215");
|
|
||||||
group.setBusinessGroup(group.getDeviceId());
|
|
||||||
}else {
|
}else {
|
||||||
// 建立第一个虚拟组织
|
|
||||||
Assert.isTrue("216".equals(gbCode.getTypeCode()), "创建虚拟组织时设备编号11-13位应使用216");
|
Assert.isTrue("216".equals(gbCode.getTypeCode()), "创建虚拟组织时设备编号11-13位应使用216");
|
||||||
|
// 添加虚拟组织
|
||||||
|
addGroup(group);
|
||||||
}
|
}
|
||||||
}else {
|
|
||||||
// 建立第一个虚拟组织
|
|
||||||
Assert.isTrue("216".equals(gbCode.getTypeCode()), "创建虚拟组织时设备编号11-13位应使用216");
|
|
||||||
}
|
}
|
||||||
if (!ObjectUtils.isEmpty(group.getBusinessGroup())) {
|
|
||||||
// 校验业务分组是否存在
|
private void addGroup(Group group) {
|
||||||
|
// 建立虚拟组织
|
||||||
|
Assert.notNull(group.getBusinessGroup(), "所属的业务分组分组不存在");
|
||||||
Group businessGroup = groupManager.queryBusinessGroup(group.getBusinessGroup());
|
Group businessGroup = groupManager.queryBusinessGroup(group.getBusinessGroup());
|
||||||
Assert.notNull(businessGroup, "所属的业务分组分组不存在");
|
Assert.notNull(businessGroup, "所属的业务分组分组不存在");
|
||||||
}
|
|
||||||
if (!ObjectUtils.isEmpty(group.getParentDeviceId())) {
|
if (!ObjectUtils.isEmpty(group.getParentDeviceId())) {
|
||||||
Group parentGroup = groupManager.queryOneByDeviceId(group.getParentDeviceId(), group.getBusinessGroup());
|
Group parentGroup = groupManager.queryOneByDeviceId(group.getParentDeviceId(), group.getBusinessGroup());
|
||||||
Assert.notNull(parentGroup, "所属的上级分组分组不存在");
|
Assert.notNull(parentGroup, "所属的上级分组分组不存在");
|
||||||
|
}else {
|
||||||
|
group.setParentDeviceId(null);
|
||||||
}
|
}
|
||||||
group.setCreateTime(DateUtil.getNow());
|
group.setCreateTime(DateUtil.getNow());
|
||||||
group.setUpdateTime(DateUtil.getNow());
|
group.setUpdateTime(DateUtil.getNow());
|
||||||
groupManager.add(group);
|
groupManager.add(group);
|
||||||
// 添加新的虚拟组织需要发起同志
|
if (group.getPlatformId() != null) {
|
||||||
if (gbCode.getTypeCode().equals("216")) {
|
|
||||||
CommonGBChannel channel = CommonGBChannel.build(group);
|
CommonGBChannel channel = CommonGBChannel.build(group);
|
||||||
try {
|
try {
|
||||||
// 发送catalog
|
// 发送catalog
|
||||||
eventPublisher.catalogEventPublish(null, channel, CatalogEvent.ADD);
|
eventPublisher.catalogEventPublish(group.getPlatformId(), channel, CatalogEvent.ADD);
|
||||||
|
}catch (Exception e) {
|
||||||
|
log.warn("[添加虚拟组织] 发送失败, {}-{}", channel.getGbName(), channel.getGbDeviceDbId(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addBusinessGroup(Group group) {
|
||||||
|
group.setBusinessGroup(group.getDeviceId());
|
||||||
|
group.setCreateTime(DateUtil.getNow());
|
||||||
|
group.setUpdateTime(DateUtil.getNow());
|
||||||
|
groupManager.addBusinessGroup(group);
|
||||||
|
if (group.getPlatformId() != null) {
|
||||||
|
CommonGBChannel channel = CommonGBChannel.build(group);
|
||||||
|
try {
|
||||||
|
// 发送catalog
|
||||||
|
eventPublisher.catalogEventPublish(group.getPlatformId(), channel, CatalogEvent.ADD);
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
log.warn("[添加虚拟组织] 发送失败, {}-{}", channel.getGbName(), channel.getGbDeviceDbId(), e);
|
log.warn("[添加虚拟组织] 发送失败, {}-{}", channel.getGbName(), channel.getGbDeviceDbId(), e);
|
||||||
}
|
}
|
||||||
|
@ -110,7 +123,28 @@ public class GroupServiceImpl implements IGroupService {
|
||||||
group.setName(group.getName());
|
group.setName(group.getName());
|
||||||
group.setUpdateTime(DateUtil.getNow());
|
group.setUpdateTime(DateUtil.getNow());
|
||||||
groupManager.update(group);
|
groupManager.update(group);
|
||||||
|
// 修改他的子节点
|
||||||
|
if (!group.getDeviceId().equals(groupInDb.getDeviceId())
|
||||||
|
|| !group.getBusinessGroup().equals(groupInDb.getBusinessGroup())) {
|
||||||
|
List<Group> groupList = queryAllChildren(groupInDb.getDeviceId(), groupInDb.getPlatformId());
|
||||||
|
if (!groupList.isEmpty()) {
|
||||||
|
int result = groupManager.updateChild(groupInDb.getDeviceId(), group);
|
||||||
|
if (result > 0) {
|
||||||
|
for (Group chjildGroup : groupList) {
|
||||||
|
chjildGroup.setParentDeviceId(group.getDeviceId());
|
||||||
|
chjildGroup.setBusinessGroup(group.getBusinessGroup());
|
||||||
|
// 将变化信息发送通知
|
||||||
|
CommonGBChannel channel = CommonGBChannel.build(chjildGroup);
|
||||||
|
try {
|
||||||
|
// 发送catalog
|
||||||
|
eventPublisher.catalogEventPublish(null, channel, CatalogEvent.UPDATE);
|
||||||
|
}catch (Exception e) {
|
||||||
|
log.warn("[业务分组/虚拟组织变化] 发送失败,{}", group.getDeviceId(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// 将变化信息发送通知
|
// 将变化信息发送通知
|
||||||
CommonGBChannel channel = CommonGBChannel.build(group);
|
CommonGBChannel channel = CommonGBChannel.build(group);
|
||||||
try {
|
try {
|
||||||
|
@ -143,9 +177,15 @@ public class GroupServiceImpl implements IGroupService {
|
||||||
if (parent == null) {
|
if (parent == null) {
|
||||||
// 查询所有业务分组
|
// 查询所有业务分组
|
||||||
return groupManager.queryBusinessGroupForTree(query, platformId);
|
return groupManager.queryBusinessGroupForTree(query, platformId);
|
||||||
|
}else {
|
||||||
|
GbCode gbCode = GbCode.decode(parent);
|
||||||
|
if (gbCode.getTypeCode().equals("215")) {
|
||||||
|
return groupManager.queryForTreeByBusinessGroup(query, parent, platformId);
|
||||||
}else {
|
}else {
|
||||||
return groupManager.queryForTree(query, parent, platformId);
|
return groupManager.queryForTree(query, parent, platformId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -158,24 +198,33 @@ public class GroupServiceImpl implements IGroupService {
|
||||||
public boolean delete(int id) {
|
public boolean delete(int id) {
|
||||||
Group group = groupManager.queryOne(id);
|
Group group = groupManager.queryOne(id);
|
||||||
Assert.notNull(group, "分组不存在");
|
Assert.notNull(group, "分组不存在");
|
||||||
groupManager.delete(id);
|
List<Group> groupListForDelete = new ArrayList<>();
|
||||||
GbCode gbCode = GbCode.decode(group.getDeviceId());
|
GbCode gbCode = GbCode.decode(group.getDeviceId());
|
||||||
if (gbCode.getTypeCode().equals("215")) {
|
if (gbCode.getTypeCode().equals("215")) {
|
||||||
// 业务分组
|
List<Group> groupList = groupManager.queryByBusinessGroup(group.getDeviceId());
|
||||||
gbChannelService.removeParentIdByBusinessGroup(gbCode.getTypeCode());
|
if (!groupList.isEmpty()) {
|
||||||
}else {
|
groupListForDelete.addAll(groupList);
|
||||||
List<Group> groups = queryAllChildren(group.getDeviceId(), group.getPlatformId());
|
|
||||||
groups.add(group);
|
|
||||||
gbChannelService.removeParentIdByGroupList(groups);
|
|
||||||
}
|
}
|
||||||
// 发送分组移除通知
|
// 业务分组
|
||||||
|
gbChannelService.removeParentIdByBusinessGroup(group.getDeviceId());
|
||||||
|
}else {
|
||||||
|
List<Group> groupList = queryAllChildren(group.getDeviceId(), group.getPlatformId());
|
||||||
|
if (!groupList.isEmpty()) {
|
||||||
|
groupListForDelete.addAll(groupList);
|
||||||
|
}
|
||||||
|
groupListForDelete.add(group);
|
||||||
|
gbChannelService.removeParentIdByGroupList(groupListForDelete);
|
||||||
|
}
|
||||||
|
groupManager.batchDelete(groupListForDelete);
|
||||||
|
for (Group groupForDelete : groupListForDelete) {
|
||||||
// 将变化信息发送通知
|
// 将变化信息发送通知
|
||||||
CommonGBChannel channel = CommonGBChannel.build(group);
|
CommonGBChannel channel = CommonGBChannel.build(groupForDelete);
|
||||||
try {
|
try {
|
||||||
// 发送catalog
|
// 发送catalog
|
||||||
eventPublisher.catalogEventPublish(null, channel, CatalogEvent.DEL);
|
eventPublisher.catalogEventPublish(null, channel, CatalogEvent.DEL);
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
log.warn("[业务分组/虚拟组织删除] 发送失败,{}", group.getDeviceId(), e);
|
log.warn("[业务分组/虚拟组织删除] 发送失败,{}", groupForDelete.getDeviceId(), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,7 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
|
||||||
if (catalogSubscribe != null) {
|
if (catalogSubscribe != null) {
|
||||||
List<CommonGBChannel> deviceChannelList = getDeviceChannelListByChannelReduceList(channelReducesToAdd, catalogId, platform);
|
List<CommonGBChannel> deviceChannelList = getDeviceChannelListByChannelReduceList(channelReducesToAdd, catalogId, platform);
|
||||||
if (deviceChannelList != null) {
|
if (deviceChannelList != null) {
|
||||||
eventPublisher.catalogEventPublish(platformId, deviceChannelList, CatalogEvent.ADD);
|
eventPublisher.catalogEventPublish(platform.getId(), deviceChannelList, CatalogEvent.ADD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.info("[关联通道]国标通道 平台:{}, 存入数据库成功", platformId);
|
log.info("[关联通道]国标通道 平台:{}, 存入数据库成功", platformId);
|
||||||
|
@ -166,7 +166,7 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
|
||||||
}
|
}
|
||||||
|
|
||||||
List<CommonGBChannel> deviceChannels = platformChannelMapper.queryAllChannelInCatalog(platformId, catalogId);
|
List<CommonGBChannel> deviceChannels = platformChannelMapper.queryAllChannelInCatalog(platformId, catalogId);
|
||||||
eventPublisher.catalogEventPublish(platformId, deviceChannels, CatalogEvent.DEL);
|
eventPublisher.catalogEventPublish(platform.getId(), deviceChannels, CatalogEvent.DEL);
|
||||||
|
|
||||||
return platformChannelMapper.delChannelForGBByCatalogId(platformId, catalogId);
|
return platformChannelMapper.delChannelForGBByCatalogId(platformId, catalogId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -795,4 +795,9 @@ public class PlatformServiceImpl implements IPlatformService {
|
||||||
streamSession.remove(platform.getServerGBId(), channel.getDeviceId(), stream);
|
streamSession.remove(platform.getServerGBId(), channel.getDeviceId(), stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ParentPlatform queryOne(Integer platformId) {
|
||||||
|
return platformMapper.getParentPlatById(platformId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,7 +193,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
||||||
// 查询平台下是否有该通道
|
// 查询平台下是否有该通道
|
||||||
DeviceChannel channel = storager.queryChannelInParentPlatform(requesterId, channelId);
|
DeviceChannel channel = storager.queryChannelInParentPlatform(requesterId, channelId);
|
||||||
GbStream gbStream = storager.queryStreamInParentPlatform(requesterId, channelId);
|
GbStream gbStream = storager.queryStreamInParentPlatform(requesterId, channelId);
|
||||||
PlatformCatalog catalog = storager.getCatalog(requesterId, channelId);
|
// PlatformCatalog catalog = storager.getCatalog(requesterId, channelId);
|
||||||
|
|
||||||
MediaServer mediaServerItem = null;
|
MediaServer mediaServerItem = null;
|
||||||
StreamPush streamPushItem = null;
|
StreamPush streamPushItem = null;
|
||||||
|
@ -258,14 +258,15 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
||||||
} catch (SipException | InvalidArgumentException | ParseException e) {
|
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||||
log.error("[命令发送失败] invite CALL_IS_BEING_FORWARDED: {}", e.getMessage());
|
log.error("[命令发送失败] invite CALL_IS_BEING_FORWARDED: {}", e.getMessage());
|
||||||
}
|
}
|
||||||
} else if (catalog != null) {
|
// }
|
||||||
try {
|
// else if (catalog != null) {
|
||||||
// 目录不支持点播
|
// try {
|
||||||
responseAck(request, Response.BAD_REQUEST, "catalog channel can not play");
|
// // 目录不支持点播
|
||||||
} catch (SipException | InvalidArgumentException | ParseException e) {
|
// responseAck(request, Response.BAD_REQUEST, "catalog channel can not play");
|
||||||
log.error("[命令发送失败] invite 目录不支持点播: {}", e.getMessage());
|
// } catch (SipException | InvalidArgumentException | ParseException e) {
|
||||||
}
|
// log.error("[命令发送失败] invite 目录不支持点播: {}", e.getMessage());
|
||||||
return;
|
// }
|
||||||
|
// return;
|
||||||
} else {
|
} else {
|
||||||
log.info("通道不存在,返回404: {}", channelId);
|
log.info("通道不存在,返回404: {}", channelId);
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -91,36 +91,14 @@ public interface IVideoManagerStorage {
|
||||||
*/
|
*/
|
||||||
Device queryVideoDeviceByChannelId(String channelId);
|
Device queryVideoDeviceByChannelId(String channelId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取目录信息
|
|
||||||
* @param platformId
|
|
||||||
* @param parentId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<PlatformCatalog> getChildrenCatalogByPlatform(String platformId, String parentId);
|
|
||||||
|
|
||||||
int addCatalog(PlatformCatalog platformCatalog);
|
|
||||||
|
|
||||||
PlatformCatalog getCatalog(String platformId, String id);
|
|
||||||
|
|
||||||
int delCatalog(String platformId, String id);
|
|
||||||
|
|
||||||
int updateCatalog(PlatformCatalog platformCatalog);
|
|
||||||
|
|
||||||
int setDefaultCatalog(String platformId, String catalogId);
|
|
||||||
|
|
||||||
int delRelation(PlatformCatalog platformCatalog);
|
int delRelation(PlatformCatalog platformCatalog);
|
||||||
|
|
||||||
int updateStreamGPS(List<GPSMsgInfo> gpsMsgInfo);
|
int updateStreamGPS(List<GPSMsgInfo> gpsMsgInfo);
|
||||||
|
|
||||||
List<ParentPlatform> queryPlatFormListForGBWithGBId(String channelId, List<String> platforms);
|
List<ParentPlatform> queryPlatFormListForGBWithGBId(String channelId, List<String> platforms);
|
||||||
|
|
||||||
void delCatalogByPlatformId(String serverGBId);
|
|
||||||
|
|
||||||
void delRelationByPlatformId(String serverGBId);
|
void delRelationByPlatformId(String serverGBId);
|
||||||
|
|
||||||
PlatformCatalog queryDefaultCatalogInPlatform(String platformId);
|
|
||||||
|
|
||||||
List<ChannelSourceInfo> getChannelSource(String platformId, String gbId);
|
List<ChannelSourceInfo> getChannelSource(String platformId, String gbId);
|
||||||
|
|
||||||
List<ParentPlatform> queryEnablePlatformListWithAsMessageChannel();
|
List<ParentPlatform> queryEnablePlatformListWithAsMessageChannel();
|
||||||
|
|
|
@ -3,16 +3,14 @@ package com.genersoft.iot.vmp.storager.impl;
|
||||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
import com.genersoft.iot.vmp.conf.SipConfig;
|
import com.genersoft.iot.vmp.conf.SipConfig;
|
||||||
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.dao.*;
|
import com.genersoft.iot.vmp.gb28181.dao.*;
|
||||||
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.service.bean.GPSMsgInfo;
|
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
||||||
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.storager.dao.GbStreamMapper;
|
import com.genersoft.iot.vmp.storager.dao.GbStreamMapper;
|
||||||
import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo;
|
import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo;
|
||||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
|
||||||
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.jdbc.datasource.DataSourceTransactionManager;
|
||||||
|
@ -34,6 +32,7 @@ import java.util.List;
|
||||||
@DS("master")
|
@DS("master")
|
||||||
public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
EventPublisher eventPublisher;
|
EventPublisher eventPublisher;
|
||||||
|
|
||||||
|
@ -162,7 +161,7 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
||||||
deviceChannel.setGbDeviceId(channelReduce.getChannelId());
|
deviceChannel.setGbDeviceId(channelReduce.getChannelId());
|
||||||
deviceChannelList.add(deviceChannel);
|
deviceChannelList.add(deviceChannel);
|
||||||
}
|
}
|
||||||
eventPublisher.catalogEventPublish(platformId, deviceChannelList, CatalogEvent.DEL);
|
// eventPublisher.catalogEventPublish(platformId, deviceChannelList, CatalogEvent.DEL);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,175 +240,12 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<PlatformCatalog> getChildrenCatalogByPlatform(String platformId, String parentId) {
|
|
||||||
return catalogMapper.selectByParentId(platformId, parentId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int addCatalog(PlatformCatalog platformCatalog) {
|
|
||||||
ParentPlatform platform = platformMapper.getParentPlatByServerGBId(platformCatalog.getPlatformId());
|
|
||||||
if (platform == null) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (platformCatalog.getId().length() <= 8) {
|
|
||||||
platformCatalog.setCivilCode(platformCatalog.getParentId());
|
|
||||||
}else {
|
|
||||||
if (platformCatalog.getId().length() != 20) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (platformCatalog.getParentId() != null) {
|
|
||||||
switch (Integer.parseInt(platformCatalog.getId().substring(10, 13))){
|
|
||||||
case 200:
|
|
||||||
case 215:
|
|
||||||
if (platformCatalog.getParentId().length() <= 8) {
|
|
||||||
platformCatalog.setCivilCode(platformCatalog.getParentId());
|
|
||||||
}else {
|
|
||||||
PlatformCatalog catalog = catalogMapper.selectByPlatFormAndCatalogId(platformCatalog.getPlatformId(), platformCatalog.getParentId());
|
|
||||||
if (catalog != null) {
|
|
||||||
platformCatalog.setCivilCode(catalog.getCivilCode());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 216:
|
|
||||||
if (platformCatalog.getParentId().length() <= 8) {
|
|
||||||
platformCatalog.setCivilCode(platformCatalog.getParentId());
|
|
||||||
}else {
|
|
||||||
PlatformCatalog catalog = catalogMapper.selectByPlatFormAndCatalogId(platformCatalog.getPlatformId(),platformCatalog.getParentId());
|
|
||||||
if (catalog == null) {
|
|
||||||
log.warn("[添加目录] 无法获取目录{}的CivilCode和BusinessGroupId", platformCatalog.getPlatformId());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
platformCatalog.setCivilCode(catalog.getCivilCode());
|
|
||||||
if (Integer.parseInt(platformCatalog.getParentId().substring(10, 13)) == 215) {
|
|
||||||
platformCatalog.setBusinessGroupId(platformCatalog.getParentId());
|
|
||||||
}else {
|
|
||||||
if (Integer.parseInt(platformCatalog.getParentId().substring(10, 13)) == 216) {
|
|
||||||
platformCatalog.setBusinessGroupId(catalog.getBusinessGroupId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int result = catalogMapper.add(platformCatalog);
|
|
||||||
if (result > 0) {
|
|
||||||
DeviceChannel deviceChannel = getDeviceChannelByCatalog(platformCatalog);
|
|
||||||
eventPublisher.catalogEventPublish(platformCatalog.getPlatformId(), deviceChannel, CatalogEvent.ADD);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private PlatformCatalog getTopCatalog(String id, String platformId) {
|
|
||||||
PlatformCatalog catalog = catalogMapper.selectByPlatFormAndCatalogId(platformId, id);
|
|
||||||
if (catalog.getParentId().equals(platformId)) {
|
|
||||||
return catalog;
|
|
||||||
}else {
|
|
||||||
return getTopCatalog(catalog.getParentId(), platformId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PlatformCatalog getCatalog(String platformId, String id) {
|
|
||||||
return catalogMapper.selectByPlatFormAndCatalogId(platformId, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int delCatalog(String platformId, String id) {
|
|
||||||
return delCatalogExecute(id, platformId);
|
|
||||||
}
|
|
||||||
private int delCatalogExecute(String id, String platformId) {
|
|
||||||
int delresult = catalogMapper.del(platformId, id);
|
|
||||||
DeviceChannel deviceChannelForCatalog = new DeviceChannel();
|
|
||||||
if (delresult > 0){
|
|
||||||
deviceChannelForCatalog.setDeviceId(id);
|
|
||||||
eventPublisher.catalogEventPublish(platformId, deviceChannelForCatalog, CatalogEvent.DEL);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<GbStream> gbStreams = platformGbStreamMapper.queryChannelInParentPlatformAndCatalog(platformId, id);
|
|
||||||
if (!gbStreams.isEmpty()){
|
|
||||||
List<CommonGBChannel> deviceChannelList = new ArrayList<>();
|
|
||||||
for (GbStream gbStream : gbStreams) {
|
|
||||||
CommonGBChannel deviceChannel = new CommonGBChannel();
|
|
||||||
deviceChannel.setGbDeviceId(gbStream.getGbId());
|
|
||||||
deviceChannelList.add(deviceChannel);
|
|
||||||
}
|
|
||||||
eventPublisher.catalogEventPublish(platformId, deviceChannelList, CatalogEvent.DEL);
|
|
||||||
}
|
|
||||||
int delStreamresult = platformGbStreamMapper.delByPlatformAndCatalogId(platformId,id);
|
|
||||||
List<PlatformCatalog> platformCatalogs = platformChannelMapper.queryChannelInParentPlatformAndCatalog(platformId, id);
|
|
||||||
if (!platformCatalogs.isEmpty()){
|
|
||||||
List<CommonGBChannel> deviceChannelList = new ArrayList<>();
|
|
||||||
for (PlatformCatalog platformCatalog : platformCatalogs) {
|
|
||||||
CommonGBChannel deviceChannel = new CommonGBChannel();
|
|
||||||
deviceChannel.setGbDeviceId(platformCatalog.getId());
|
|
||||||
deviceChannelList.add(deviceChannel);
|
|
||||||
}
|
|
||||||
eventPublisher.catalogEventPublish(platformId, deviceChannelList, CatalogEvent.DEL);
|
|
||||||
}
|
|
||||||
int delChannelresult = platformChannelMapper.delByCatalogId(platformId, id);
|
|
||||||
// 查看是否存在子目录,如果存在一并删除
|
|
||||||
List<String> allChildCatalog = getAllChildCatalog(id, platformId);
|
|
||||||
if (!allChildCatalog.isEmpty()) {
|
|
||||||
int limitCount = 50;
|
|
||||||
if (allChildCatalog.size() > limitCount) {
|
|
||||||
for (int i = 0; i < allChildCatalog.size(); i += limitCount) {
|
|
||||||
int toIndex = i + limitCount;
|
|
||||||
if (i + limitCount > allChildCatalog.size()) {
|
|
||||||
toIndex = allChildCatalog.size();
|
|
||||||
}
|
|
||||||
delChannelresult += platformCatalogMapper.deleteAll(platformId, allChildCatalog.subList(i, toIndex));
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
delChannelresult += platformCatalogMapper.deleteAll(platformId, allChildCatalog);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return delresult + delChannelresult + delStreamresult;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<String> getAllChildCatalog(String id, String platformId) {
|
|
||||||
List<String> catalogList = platformCatalogMapper.queryCatalogFromParent(id, platformId);
|
|
||||||
List<String> catalogListChild = new ArrayList<>();
|
|
||||||
if (catalogList != null && !catalogList.isEmpty()) {
|
|
||||||
for (String childId : catalogList) {
|
|
||||||
List<String> allChildCatalog = getAllChildCatalog(childId, platformId);
|
|
||||||
if (allChildCatalog != null && !allChildCatalog.isEmpty()) {
|
|
||||||
catalogListChild.addAll(allChildCatalog);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!catalogListChild.isEmpty()) {
|
|
||||||
catalogList.addAll(catalogListChild);
|
|
||||||
}
|
|
||||||
return catalogList;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int updateCatalog(PlatformCatalog platformCatalog) {
|
|
||||||
int result = catalogMapper.update(platformCatalog);
|
|
||||||
if (result > 0) {
|
|
||||||
DeviceChannel deviceChannel = getDeviceChannelByCatalog(platformCatalog);
|
|
||||||
eventPublisher.catalogEventPublish(platformCatalog.getPlatformId(), deviceChannel, CatalogEvent.UPDATE);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int setDefaultCatalog(String platformId, String catalogId) {
|
|
||||||
return platformMapper.setDefaultCatalog(platformId, catalogId, DateUtil.getNow());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int delRelation(PlatformCatalog platformCatalog) {
|
public int delRelation(PlatformCatalog platformCatalog) {
|
||||||
if (platformCatalog.getType() == 1) {
|
if (platformCatalog.getType() == 1) {
|
||||||
CommonGBChannel deviceChannel = new CommonGBChannel();
|
CommonGBChannel deviceChannel = new CommonGBChannel();
|
||||||
deviceChannel.setGbDeviceId(platformCatalog.getId());
|
deviceChannel.setGbDeviceId(platformCatalog.getId());
|
||||||
eventPublisher.catalogEventPublish(platformCatalog.getPlatformId(), deviceChannel, CatalogEvent.DEL);
|
// eventPublisher.catalogEventPublish(platformCatalog.getPlatformId(), deviceChannel, CatalogEvent.DEL);
|
||||||
return platformChannelMapper.delByCatalogIdAndChannelIdAndPlatformId(platformCatalog);
|
return platformChannelMapper.delByCatalogIdAndChannelIdAndPlatformId(platformCatalog);
|
||||||
}else if (platformCatalog.getType() == 2) {
|
}else if (platformCatalog.getType() == 2) {
|
||||||
List<GbStream> gbStreams = platformGbStreamMapper.queryChannelInParentPlatformAndCatalog(platformCatalog.getPlatformId(), platformCatalog.getParentId());
|
List<GbStream> gbStreams = platformGbStreamMapper.queryChannelInParentPlatformAndCatalog(platformCatalog.getPlatformId(), platformCatalog.getParentId());
|
||||||
|
@ -417,7 +253,7 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
||||||
if (gbStream.getGbId().equals(platformCatalog.getId())) {
|
if (gbStream.getGbId().equals(platformCatalog.getId())) {
|
||||||
CommonGBChannel deviceChannel = new CommonGBChannel();
|
CommonGBChannel deviceChannel = new CommonGBChannel();
|
||||||
deviceChannel.setGbDeviceId(gbStream.getGbId());
|
deviceChannel.setGbDeviceId(gbStream.getGbId());
|
||||||
eventPublisher.catalogEventPublish(platformCatalog.getPlatformId(), deviceChannel, CatalogEvent.DEL);
|
// eventPublisher.catalogEventPublish(platformCatalog.getPlatformId(), deviceChannel, CatalogEvent.DEL);
|
||||||
return platformGbStreamMapper.delByAppAndStream(gbStream.getApp(), gbStream.getStream());
|
return platformGbStreamMapper.delByAppAndStream(gbStream.getApp(), gbStream.getStream());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -456,21 +292,12 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
||||||
return platformChannelMapper.queryPlatFormListForGBWithGBId(channelId, platforms);
|
return platformChannelMapper.queryPlatFormListForGBWithGBId(channelId, platforms);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void delCatalogByPlatformId(String serverGBId) {
|
|
||||||
catalogMapper.delByPlatformId(serverGBId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void delRelationByPlatformId(String serverGBId) {
|
public void delRelationByPlatformId(String serverGBId) {
|
||||||
platformGbStreamMapper.delByPlatformId(serverGBId);
|
platformGbStreamMapper.delByPlatformId(serverGBId);
|
||||||
platformChannelMapper.delByPlatformId(serverGBId);
|
platformChannelMapper.delByPlatformId(serverGBId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public PlatformCatalog queryDefaultCatalogInPlatform(String platformId) {
|
|
||||||
return catalogMapper.selectDefaultByPlatFormId(platformId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ChannelSourceInfo> getChannelSource(String platformId, String gbId) {
|
public List<ChannelSourceInfo> getChannelSource(String platformId, String gbId) {
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
>
|
>
|
||||||
<span class="custom-tree-node" slot-scope="{ node, data }">
|
<span class="custom-tree-node" slot-scope="{ node, data }">
|
||||||
<span @click.stop >
|
<span @click.stop >
|
||||||
<el-radio v-if="node.data.type === 0 && node.level !== 1 " style="margin-right: 0" v-model="chooseId" @input="chooseIdChange" :label="node.data.id">{{''}}</el-radio>
|
<el-radio v-if="node.data.type === 0 && node.level > 2 " style="margin-right: 0" v-model="chooseId" @input="chooseIdChange" :label="node.data.id">{{''}}</el-radio>
|
||||||
</span>
|
</span>
|
||||||
<span v-if="node.data.type === 0" style="color: #409EFF" class="iconfont icon-bianzubeifen3"></span>
|
<span v-if="node.data.type === 0" style="color: #409EFF" class="iconfont icon-bianzubeifen3"></span>
|
||||||
<span v-if="node.data.type === 1" style="color: #409EFF" class="iconfont icon-shexiangtou2"></span>
|
<span v-if="node.data.type === 1" style="color: #409EFF" class="iconfont icon-shexiangtou2"></span>
|
||||||
|
@ -74,7 +74,7 @@ export default {
|
||||||
isLeaf: false,
|
isLeaf: false,
|
||||||
type: 0
|
type: 0
|
||||||
}]);
|
}]);
|
||||||
} else if (node.data.id.length <= 8) {
|
} else {
|
||||||
this.$axios({
|
this.$axios({
|
||||||
method: 'get',
|
method: 'get',
|
||||||
url: `/api/group/tree/list`,
|
url: `/api/group/tree/list`,
|
||||||
|
@ -90,8 +90,6 @@ export default {
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
resolve([]);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
reset: function () {
|
reset: function () {
|
||||||
|
@ -145,7 +143,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: node.level === 1?"新建业务分组":"新建虚拟组织",
|
label: "新建节点",
|
||||||
icon: "el-icon-plus",
|
icon: "el-icon-plus",
|
||||||
disabled: false,
|
disabled: false,
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
|
@ -153,11 +151,11 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "重命名",
|
label: "编辑节点",
|
||||||
icon: "el-icon-edit",
|
icon: "el-icon-edit",
|
||||||
disabled: node.level === 1,
|
disabled: node.level === 1,
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
this.editCatalog(data, node);
|
this.editGroup(data, node);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -180,7 +178,7 @@ export default {
|
||||||
{
|
{
|
||||||
label: "添加设备",
|
label: "添加设备",
|
||||||
icon: "el-icon-plus",
|
icon: "el-icon-plus",
|
||||||
disabled: node.level === 1,
|
disabled: node.level <= 2,
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
this.addChannelFormDevice(data.id, node)
|
this.addChannelFormDevice(data.id, node)
|
||||||
}
|
}
|
||||||
|
@ -188,7 +186,7 @@ export default {
|
||||||
{
|
{
|
||||||
label: "移除设备",
|
label: "移除设备",
|
||||||
icon: "el-icon-delete",
|
icon: "el-icon-delete",
|
||||||
disabled: node.level === 1,
|
disabled: node.level <= 2,
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
this.removeChannelFormDevice(data.id, node)
|
this.removeChannelFormDevice(data.id, node)
|
||||||
}
|
}
|
||||||
|
@ -227,7 +225,7 @@ export default {
|
||||||
method: "delete",
|
method: "delete",
|
||||||
url: `/api/group/delete`,
|
url: `/api/group/delete`,
|
||||||
params: {
|
params: {
|
||||||
deviceId: id,
|
id: node.data.dbId,
|
||||||
}
|
}
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
|
@ -312,12 +310,29 @@ export default {
|
||||||
},
|
},
|
||||||
addGroup: function (id, node) {
|
addGroup: function (id, node) {
|
||||||
this.$refs.groupEdit.openDialog({
|
this.$refs.groupEdit.openDialog({
|
||||||
id: null
|
id: 0,
|
||||||
|
name: "",
|
||||||
|
deviceId: "",
|
||||||
|
parentDeviceId: node.level > 2 ? node.data.id:"",
|
||||||
|
businessGroup: node.level > 2 ? node.data.businessGroup: node.data.id,
|
||||||
},form => {
|
},form => {
|
||||||
node.loaded = false
|
node.loaded = false
|
||||||
node.expand();
|
node.expand();
|
||||||
}, id);
|
}, id);
|
||||||
},
|
},
|
||||||
|
editGroup: function (id, node) {
|
||||||
|
console.log(node)
|
||||||
|
this.$refs.groupEdit.openDialog({
|
||||||
|
id: node.data.dbId,
|
||||||
|
name: node.data.label,
|
||||||
|
deviceId: node.data.id,
|
||||||
|
parentDeviceId: node.data.parentDeviceId,
|
||||||
|
businessGroup: node.data.businessGroup,
|
||||||
|
},form => {
|
||||||
|
node.parent.loaded = false
|
||||||
|
node.parent.expand();
|
||||||
|
}, id);
|
||||||
|
},
|
||||||
nodeClickHandler: function (data, node, tree) {
|
nodeClickHandler: function (data, node, tree) {
|
||||||
console.log(data)
|
console.log(data)
|
||||||
console.log(node)
|
console.log(node)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div id="addUser" v-loading="getDeviceListLoading">
|
<div id="addUser" v-loading="getDeviceListLoading">
|
||||||
<el-dialog
|
<el-dialog
|
||||||
title="添加国标设备通道到行政区划"
|
title="添加国标设备通道"
|
||||||
width="60%"
|
width="60%"
|
||||||
top="2rem"
|
top="2rem"
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
|
@ -34,6 +34,8 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="deviceId" label="设备编号" min-width="200" >
|
<el-table-column prop="deviceId" label="设备编号" min-width="200" >
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column prop="channelCount" label="通道数" min-width="120" >
|
||||||
|
</el-table-column>
|
||||||
<el-table-column prop="manufacturer" label="厂家" min-width="120" >
|
<el-table-column prop="manufacturer" label="厂家" min-width="120" >
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="地址" min-width="160" >
|
<el-table-column label="地址" min-width="160" >
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
@close="close()"
|
@close="close()"
|
||||||
>
|
>
|
||||||
<div id="shared" style="margin-top: 1rem;margin-right: 100px;">
|
<div id="shared" style="margin-top: 1rem;margin-right: 100px;">
|
||||||
<el-form ref="form" :rules="rules" :model="group" label-width="140px" >
|
<el-form ref="form" :model="group" label-width="140px" >
|
||||||
<el-form-item label="节点编号" prop="id" >
|
<el-form-item label="节点编号" prop="id" >
|
||||||
<el-input v-model="group.deviceId" placeholder="请输入编码">
|
<el-input v-model="group.deviceId" placeholder="请输入编码">
|
||||||
<el-button slot="append" @click="buildDeviceIdCode(group.deviceId)">生成</el-button>
|
<el-button slot="append" @click="buildDeviceIdCode(group.deviceId)">生成</el-button>
|
||||||
|
@ -50,13 +50,23 @@ export default {
|
||||||
showDialog: false,
|
showDialog: false,
|
||||||
loading: false,
|
loading: false,
|
||||||
level: 0,
|
level: 0,
|
||||||
group: {},
|
group: {
|
||||||
|
id: 0,
|
||||||
|
deviceId: "",
|
||||||
|
name: "",
|
||||||
|
parentDeviceId: "",
|
||||||
|
businessGroup: "",
|
||||||
|
platformId: "",
|
||||||
|
|
||||||
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
openDialog: function (group, callback) {
|
openDialog: function (group, callback) {
|
||||||
console.log(group)
|
console.log(group)
|
||||||
|
if (group) {
|
||||||
this.group = group;
|
this.group = group;
|
||||||
|
}
|
||||||
this.showDialog = true;
|
this.showDialog = true;
|
||||||
this.submitCallback = callback;
|
this.submitCallback = callback;
|
||||||
},
|
},
|
||||||
|
@ -64,7 +74,7 @@ export default {
|
||||||
|
|
||||||
this.$axios({
|
this.$axios({
|
||||||
method:"post",
|
method:"post",
|
||||||
url: this.group.id ? '/api/group/add':'/api/group/update',
|
url: this.group.id ? '/api/group/update':'/api/group/add',
|
||||||
data: this.group
|
data: this.group
|
||||||
}).then((res)=> {
|
}).then((res)=> {
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
|
@ -88,13 +98,11 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
buildDeviceIdCode: function (deviceId){
|
buildDeviceIdCode: function (deviceId){
|
||||||
|
console.log(this.group)
|
||||||
|
let lockContent = this.group.businessGroup ? "216":"215"
|
||||||
this.$refs.channelCode.openDialog(code=>{
|
this.$refs.channelCode.openDialog(code=>{
|
||||||
console.log(this.form)
|
|
||||||
console.log("code===> " + code)
|
|
||||||
this.group.deviceId = code;
|
this.group.deviceId = code;
|
||||||
console.log("code22===> " + code)
|
}, deviceId, 5 , lockContent);
|
||||||
}, deviceId);
|
|
||||||
},
|
},
|
||||||
close: function () {
|
close: function () {
|
||||||
this.showDialog = false;
|
this.showDialog = false;
|
||||||
|
|
Loading…
Reference in New Issue