1
0

2 Commits 2029f782fb ... fa2c83a72d

Autor SHA1 Nachricht Datum
  slowslo fa2c83a72d Merge remote-tracking branch 'origin/master' into master vor 4 Jahren
  slowslo b3082b80a3 1、视频推流 vor 4 Jahren
22 geänderte Dateien mit 506 neuen und 33 gelöschten Zeilen
  1. 6 0
      blade-service-api/community-api/src/main/java/org/springblade/community/feign/IResidentialClient.java
  2. 5 1
      blade-service-api/community-api/src/main/java/org/springblade/community/feign/ResidentialClientFallback.java
  3. 3 3
      blade-service-api/device-api/src/main/java/org/springblade/device/entity/DoorDevice.java
  4. 30 0
      blade-service-api/device-api/src/main/java/org/springblade/device/entity/GbDeviceChannel.java
  5. 97 0
      blade-service-api/device-api/src/main/java/org/springblade/device/vo/GbDeviceChannelTreeVO.java
  6. 3 0
      blade-service-api/device-api/src/main/java/org/springblade/device/vo/GbDeviceChannelVO.java
  7. 3 14
      blade-service/community/src/main/java/org/springblade/community/controller/ResidentialController.java
  8. 7 0
      blade-service/community/src/main/java/org/springblade/community/feign/ResidentialClient.java
  9. 37 2
      blade-service/device/src/main/java/org/springblade/device/controller/GbDeviceChannelController.java
  10. 1 1
      blade-service/device/src/main/java/org/springblade/device/controller/GbDeviceController.java
  11. 5 0
      blade-service/device/src/main/java/org/springblade/device/mapper/GbDeviceChannelMapper.java
  12. 10 0
      blade-service/device/src/main/java/org/springblade/device/mapper/GbDeviceChannelMapper.xml
  13. 3 0
      blade-service/device/src/main/java/org/springblade/device/mapper/GbDeviceMapper.java
  14. 4 0
      blade-service/device/src/main/java/org/springblade/device/mapper/GbDeviceMapper.xml
  15. 32 0
      blade-service/device/src/main/java/org/springblade/device/service/IGbDeviceChannelService.java
  16. 4 0
      blade-service/device/src/main/java/org/springblade/device/service/IGbDeviceService.java
  17. 188 2
      blade-service/device/src/main/java/org/springblade/device/service/impl/GbDeviceChannelServiceImpl.java
  18. 20 0
      blade-service/device/src/main/java/org/springblade/device/service/impl/GbDeviceServiceImpl.java
  19. 35 6
      blade-service/device/src/main/java/org/springblade/device/wrapper/GbDeviceChannelWrapper.java
  20. 2 2
      blade-service/person/src/main/java/org/springblade/person/service/impl/HouseUserServiceImpl.java
  21. 5 0
      blade-service/third/src/main/java/org/springblade/third/videodevice/wvp/controller/WvpDeviceController.java
  22. 6 2
      blade-service/third/src/main/java/org/springblade/third/videodevice/wvp/service/WvpService.java

+ 6 - 0
blade-service-api/community-api/src/main/java/org/springblade/community/feign/IResidentialClient.java

@@ -76,4 +76,10 @@ public interface IResidentialClient  {
 	List<Residential> getParkResidential() ;
 	@GetMapping("/listWithOutCompany")
 	List<Residential> listWithOutCompany(@RequestParam Map<String, Object> residential);
+
+	/**
+	 * 根据主键集合查询区域
+	 */
+	@GetMapping("/listByIds")
+	List<Residential> listByIds(@ApiParam(value = "主键集合", required = true) @RequestParam String ids);
 }

+ 5 - 1
blade-service-api/community-api/src/main/java/org/springblade/community/feign/ResidentialClientFallback.java

@@ -1,6 +1,5 @@
 package org.springblade.community.feign;
 
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import org.springblade.community.entity.Residential;
 import org.springblade.community.vo.ResidentialVO;
 import org.springframework.stereotype.Component;
@@ -88,5 +87,10 @@ public class ResidentialClientFallback implements IResidentialClient {
 		return new ArrayList<>();
 	}
 
+	@Override
+	public List<Residential> listByIds(String ids) {
+		return null;
+	}
+
 
 }

+ 3 - 3
blade-service-api/device-api/src/main/java/org/springblade/device/entity/DoorDevice.java

@@ -122,10 +122,10 @@ public class DoorDevice extends BaseEntity {
 	private Integer isOut;
 
 	/**
-	 * 1:公共位置
-	 * 2:特殊位
+	 * 1:普通点位
+	 * 2:特殊
 	 */
-	@ApiModelProperty(value = "位置特殊性")
+	@ApiModelProperty(value = "点位类型")
 	private Integer localType;
 
 	/**

+ 30 - 0
blade-service-api/device-api/src/main/java/org/springblade/device/entity/GbDeviceChannel.java

@@ -127,5 +127,35 @@ public class GbDeviceChannel extends BaseEntity {
 		@ApiModelProperty(value = "是否有音频,0无,1有")
 	private Boolean hasAudio;
 
+	/**
+	 * 园区id
+	 */
+	@ApiModelProperty(value = "园区ID")
+	private Long agencyId;
+	/**
+	 * 区域ID
+	 */
+	@ApiModelProperty(value = "区域ID")
+	private Long residentialId;
+	/**
+	 * 所属楼栋
+	 */
+	@ApiModelProperty(value = "所属楼栋")
+	private Long buildingId;
+
+	/**
+	 * 所属楼层
+	 */
+	@ApiModelProperty(value = "所属楼层")
+	private Long floorId;
+
+	/**
+	 * 安装具体位置
+	 */
+	@ApiModelProperty(value = "安装具体位置")
+	private String installAddress;
+
+	private String tenantId;
+
 
 }

+ 97 - 0
blade-service-api/device-api/src/main/java/org/springblade/device/vo/GbDeviceChannelTreeVO.java

@@ -0,0 +1,97 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.device.vo;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.tool.node.INode;
+import org.springblade.system.entity.Dept;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 视图实体类
+ *
+ * @author Chill
+ */
+@Data
+@ApiModel(value = "GbDeviceChannelTreeVOVO对象", description = "GbDeviceChannelTreeVO对象")
+public class GbDeviceChannelTreeVO {
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * 主键ID
+	 */
+	@JsonSerialize(using = ToStringSerializer.class)
+	private Long id;
+
+	/**
+	 * 父节点ID
+	 */
+	@JsonSerialize(using = ToStringSerializer.class)
+	private Long parentId;
+
+	/**
+	 * 子孙节点
+	 */
+	@JsonInclude(JsonInclude.Include.NON_EMPTY)
+	private List<GbDeviceChannelTreeVO> children;
+
+	/**
+	 * 是否有子孙节点
+	 */
+	@JsonInclude(JsonInclude.Include.NON_EMPTY)
+	private Boolean hasChildren;
+
+	/**
+	 * 设备ID
+	 */
+	private String deviceId;
+
+	/**
+	 * 通道ID
+	 */
+	private String channelId;
+
+	/**
+	 * 是否在线
+	 */
+	private Integer isOnline;
+
+	public List<GbDeviceChannelTreeVO> getChildren() {
+		if (this.children == null) {
+			this.children = new ArrayList<>();
+		}
+		return this.children;
+	}
+
+	/**
+	 * 上级名称
+	 */
+	private String parentLabelName;
+
+	/**
+	 * 名称
+	 */
+	private String label;
+
+}

+ 3 - 0
blade-service-api/device-api/src/main/java/org/springblade/device/vo/GbDeviceChannelVO.java

@@ -33,4 +33,7 @@ import io.swagger.annotations.ApiModel;
 public class GbDeviceChannelVO extends GbDeviceChannel {
 	private static final long serialVersionUID = 1L;
 
+	//安装点位,例如:A区|1栋|2层|机房
+	private String installLocal;
+
 }

+ 3 - 14
blade-service/community/src/main/java/org/springblade/community/controller/ResidentialController.java

@@ -18,6 +18,7 @@ package org.springblade.community.controller;
 
 import cn.hutool.core.lang.Assert;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
@@ -99,20 +100,8 @@ public class ResidentialController extends BladeController {
 	@ApiOperationSupport(order = 2)
 	@ApiOperation(value = "分页", notes = "传入residential")
 	public R<IPage<ResidentialVO>> list(@RequestParam Map<String,Object> residential, Query query, BladeUser bladeUser) {
-		Long agencyId = null;
-		String regionArea = null;
-		if(residential.get("agencyId") != null){
-			agencyId = Long.parseLong(String.valueOf(residential.get("agencyId")));
-			residential.remove("agencyId");
-		}
-		if(residential.get("regionArea") != null){
-			regionArea = String.valueOf(residential.get("regionArea"));
-			residential.remove("regionArea");
-		}
-		LambdaQueryWrapper<Residential> residentialLambdaQueryWrapper = new QueryWrapperUtil<Residential>().getBasicQueryWrapperByMap(Residential::getOrgPosition, residential, new Residential(), bladeUser, orgPositionClient);
-		residentialLambdaQueryWrapper.eq(agencyId != null, Residential::getAgencyId, agencyId);
-		residentialLambdaQueryWrapper.eq(regionArea != null, Residential::getRegionArea, regionArea);
-		IPage<Residential> pages = residentialService.page(Condition.getPage(query), residentialLambdaQueryWrapper);
+		QueryWrapper<Residential> queryWrapper = Condition.getQueryWrapper(residential, Residential.class);
+		IPage<Residential> pages = residentialService.page(Condition.getPage(query), queryWrapper);
 		return R.data(ResidentialWrapper.build(companyClient, confClient).pageVO(pages));
 	}
 

+ 7 - 0
blade-service/community/src/main/java/org/springblade/community/feign/ResidentialClient.java

@@ -161,5 +161,12 @@ public class ResidentialClient implements IResidentialClient {
 		return residentialService.list(wrapper);
 	}
 
+	@Override
+	@GetMapping("/listByIds")
+	public List<Residential> listByIds(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		List<Residential> residentialList = residentialService.listByIds(Func.toLongList(ids));
+		return residentialList;
+	}
+
 
 }

+ 37 - 2
blade-service/device/src/main/java/org/springblade/device/controller/GbDeviceChannelController.java

@@ -27,9 +27,12 @@ import javax.validation.Valid;
 
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
+import org.springblade.core.secure.BladeUser;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.core.tool.utils.StringUtil;
+import org.springblade.device.vo.GbDeviceChannelTreeVO;
+import org.springblade.system.vo.DeptVO;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.RequestParam;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -39,6 +42,7 @@ import org.springblade.device.wrapper.GbDeviceChannelWrapper;
 import org.springblade.device.service.IGbDeviceChannelService;
 import org.springblade.core.boot.ctrl.BladeController;
 
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -135,18 +139,49 @@ public class GbDeviceChannelController extends BladeController {
 	}
 
 	@PostMapping("/play")
-	@ApiOperationSupport(order = 7)
+	@ApiOperationSupport(order = 8)
 	@ApiOperation(value = "播放", notes = "deviceId,channelId")
 	public R<JSONObject> play(@RequestParam(value = "deviceId", required = true) String deviceId, @RequestParam(value = "channelId", required = true) String channelId){
 		return gbDeviceChannelService.play(deviceId, channelId);
 	}
 
 	@PostMapping("/stop")
-	@ApiOperationSupport(order = 7)
+	@ApiOperationSupport(order = 9)
 	@ApiOperation(value = "播放", notes = "deviceId,channelId")
 	public R<String> stop(@RequestParam(value = "deviceId", required = true) String deviceId, @RequestParam(value = "channelId", required = true) String channelId){
 		return gbDeviceChannelService.stop(deviceId, channelId);
 	}
 
+	/**
+	 * 懒加载获取视频通道树形结构
+	 */
+	@GetMapping("/lazy-tree")
+	@ApiOperationSupport(order = 10)
+	@ApiOperation(value = "懒加载树形结构", notes = "树形结构")
+	public R<List<GbDeviceChannelTreeVO>> lazyTree(@RequestParam(value = "parentColumn", required = true) String parentColumn, @RequestParam(value = "parentId", required = false) Long parentId) {
+		List<GbDeviceChannelTreeVO> tree = gbDeviceChannelService.lazyTree(parentColumn, parentId);
+		return R.data(tree);
+	}
+
+	/**
+	 * 点位绑定
+	 * @param deviceId
+	 * @param channelId
+	 * @param residentialId
+	 * @param buildingId
+	 * @param floorId
+	 * @return
+	 */
+	@PostMapping("/bind")
+	@ApiOperationSupport(order = 9)
+	public R bind(@RequestParam(value = "deviceId", required = true) String deviceId,
+				  @RequestParam(value = "channelId", required = true) String channelId,
+				  @RequestParam(value = "residentialId", required = false) Long residentialId,
+				  @RequestParam(value = "buildingId", required = false) Long buildingId,
+				  @RequestParam(value = "floorId", required = false) Long floorId,
+				  @RequestParam(value = "installAddress", required = false) String installAddress){
+		return gbDeviceChannelService.bind(deviceId, channelId, residentialId, buildingId, floorId, installAddress);
+	}
+
 
 }

+ 1 - 1
blade-service/device/src/main/java/org/springblade/device/controller/GbDeviceController.java

@@ -127,7 +127,7 @@ public class GbDeviceController extends BladeController {
 	@ApiOperationSupport(order = 7)
 	@ApiOperation(value = "逻辑删除", notes = "传入ids")
 	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
-		return R.status(gbDeviceService.deleteLogic(Func.toLongList(ids)));
+		return gbDeviceService.deleteDevice(Func.toLongList(ids));
 	}
 
 	/**

+ 5 - 0
blade-service/device/src/main/java/org/springblade/device/mapper/GbDeviceChannelMapper.java

@@ -18,9 +18,12 @@ package org.springblade.device.mapper;
 
 import org.apache.ibatis.annotations.Param;
 import org.springblade.device.entity.GbDeviceChannel;
+import org.springblade.device.vo.GbDeviceChannelTreeVO;
 import org.springblade.device.vo.GbDeviceChannelVO;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.system.vo.DeptVO;
+
 import java.util.List;
 
 /**
@@ -40,4 +43,6 @@ public interface GbDeviceChannelMapper extends BaseMapper<GbDeviceChannel> {
 	 */
 	List<GbDeviceChannelVO> selectGbDeviceChannelPage(IPage page, GbDeviceChannelVO gbDeviceChannel);
 
+	int deleteChannel(@Param(value = "deviceId") String deviceId, @Param(value = "tenantId") String tenantId);
+
 }

+ 10 - 0
blade-service/device/src/main/java/org/springblade/device/mapper/GbDeviceChannelMapper.xml

@@ -26,6 +26,12 @@
         <result column="stream_id" property="streamId"/>
         <result column="parental" property="parental"/>
         <result column="has_audio" property="hasAudio"/>
+        <result column="agency_id" property="agencyId"/>
+        <result column="residential_id" property="residentialId"/>
+        <result column="building_id" property="buildingId"/>
+        <result column="floor_id" property="floorId"/>
+        <result column="install_address" property="installAddress"/>
+        <result column="tenant_id" property="tenantId"/>
     </resultMap>
 
 
@@ -33,4 +39,8 @@
         select * from smart_gb_device_channel where is_deleted = 0
     </select>
 
+    <delete id="deleteChannel">
+        delete from smart_gb_device_channel WHERE device_id = #{deviceId} and tenant_id = #{tenantId}
+    </delete>
+
 </mapper>

+ 3 - 0
blade-service/device/src/main/java/org/springblade/device/mapper/GbDeviceMapper.java

@@ -16,6 +16,7 @@
  */
 package org.springblade.device.mapper;
 
+import org.apache.ibatis.annotations.Param;
 import org.springblade.device.entity.Gb28181Device;
 import org.springblade.device.vo.Gb28181DeviceVO;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -39,4 +40,6 @@ public interface GbDeviceMapper extends BaseMapper<Gb28181Device> {
 	 */
 	List<Gb28181DeviceVO> selectGbDevicePage(IPage page, Gb28181DeviceVO gbDevice);
 
+	int deleteDevice(@Param(value = "id") Long id);
+
 }

+ 4 - 0
blade-service/device/src/main/java/org/springblade/device/mapper/GbDeviceMapper.xml

@@ -31,4 +31,8 @@
         select * from smart_gb_device where is_deleted = 0
     </select>
 
+    <delete id="deleteDevice">
+        delete from smart_gb_device WHERE id = #{id}
+    </delete>
+
 </mapper>

+ 32 - 0
blade-service/device/src/main/java/org/springblade/device/service/IGbDeviceChannelService.java

@@ -19,9 +19,11 @@ package org.springblade.device.service;
 import com.alibaba.fastjson.JSONObject;
 import org.springblade.core.tool.api.R;
 import org.springblade.device.entity.GbDeviceChannel;
+import org.springblade.device.vo.GbDeviceChannelTreeVO;
 import org.springblade.device.vo.GbDeviceChannelVO;
 import org.springblade.core.mp.base.BaseService;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.system.vo.DeptVO;
 
 import java.util.List;
 
@@ -52,4 +54,34 @@ public interface IGbDeviceChannelService extends BaseService<GbDeviceChannel> {
 
 	List<GbDeviceChannel> selectByDeviceIds(List<String> deviceIdList);
 
+	/**
+	 * 懒加载树形结构
+	 *
+	 * @param parentColumn
+	 * @param parentId
+	 * @return
+	 */
+	List<GbDeviceChannelTreeVO> lazyTree(String parentColumn, Long parentId);
+
+	List<GbDeviceChannel> listByAgencyId(Long agencyId);
+
+	List<GbDeviceChannel> listByResidentialId(Long agencyId, Long residentialId);
+
+	List<GbDeviceChannel> listByBuildingId(Long agencyId, Long residentialId, Long buildingId);
+
+	List<GbDeviceChannel> listByFloorId(Long agencyId, Long residentialId, Long buildingId, Long floorId);
+
+	/**
+	 * 点位绑定
+	 * @param deviceId
+	 * @param channelId
+	 * @param residentialId
+	 * @param buildingId
+	 * @param floorId
+	 * @return
+	 */
+	R bind(String deviceId, String channelId, Long residentialId, Long buildingId, Long floorId, String installAddress);
+
+	R deleteChannel(String deviceId, String tenantId);
+
 }

+ 4 - 0
blade-service/device/src/main/java/org/springblade/device/service/IGbDeviceService.java

@@ -22,6 +22,8 @@ import org.springblade.device.vo.Gb28181DeviceVO;
 import org.springblade.core.mp.base.BaseService;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 
+import java.util.List;
+
 /**
  *  服务类
  *
@@ -45,4 +47,6 @@ public interface IGbDeviceService extends BaseService<Gb28181Device> {
 
 	R sync(Gb28181Device gb28181Device);
 
+	R deleteDevice(List<Long> idList);
+
 }

+ 188 - 2
blade-service/device/src/main/java/org/springblade/device/service/impl/GbDeviceChannelServiceImpl.java

@@ -18,8 +18,26 @@ package org.springblade.device.service.impl;
 
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import org.springblade.common.constant.CommonConstant;
+import org.springblade.community.entity.Agency;
+import org.springblade.community.entity.Building;
+import org.springblade.community.entity.Floor;
+import org.springblade.community.entity.Residential;
+import org.springblade.community.feign.IAgencyClient;
+import org.springblade.community.feign.IBuildingClient;
+import org.springblade.community.feign.IFloorClient;
+import org.springblade.community.feign.IResidentialClient;
+import org.springblade.community.vo.AgencyVO;
+import org.springblade.community.vo.BuildingVO;
+import org.springblade.community.vo.FloorVO;
+import org.springblade.community.vo.ResidentialVO;
+import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.node.ForestNodeMerger;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.core.tool.utils.StringPool;
 import org.springblade.device.entity.GbDeviceChannel;
+import org.springblade.device.vo.GbDeviceChannelTreeVO;
 import org.springblade.device.vo.GbDeviceChannelVO;
 import org.springblade.device.mapper.GbDeviceChannelMapper;
 import org.springblade.device.service.IGbDeviceChannelService;
@@ -28,9 +46,10 @@ import org.springblade.third.videodevice.gb28181.feign.IThirdGbDeviceClient;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springframework.util.Assert;
 
-import java.util.Date;
-import java.util.List;
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  *  服务实现类
@@ -43,6 +62,14 @@ public class GbDeviceChannelServiceImpl extends BaseServiceImpl<GbDeviceChannelM
 
 	@Autowired
 	private IThirdGbDeviceClient thirdGbDeviceClient;
+	@Autowired
+	private IAgencyClient agencyClient;
+	@Autowired
+	private IResidentialClient residentialClient;
+	@Autowired
+	private IBuildingClient buildingClient;
+	@Autowired
+	private IFloorClient floorClient;
 
 	@Override
 	public IPage<GbDeviceChannelVO> selectGbDeviceChannelPage(IPage<GbDeviceChannelVO> page, GbDeviceChannelVO gbDeviceChannel) {
@@ -103,4 +130,163 @@ public class GbDeviceChannelServiceImpl extends BaseServiceImpl<GbDeviceChannelM
 
 	}
 
+	@Override
+	public List<GbDeviceChannelTreeVO> lazyTree(String parentColumn, Long parentId) {
+		String tenantId = AuthUtil.getTenantId();
+		List<GbDeviceChannelTreeVO> treeVOList = new ArrayList<>();
+		if(parentColumn.equals("0")){
+			if(tenantId.equals("000000")){
+				List<AgencyVO> agencyList = agencyClient.list(new Agency());
+				for(AgencyVO agencyVO : agencyList){
+					GbDeviceChannelTreeVO vo = new GbDeviceChannelTreeVO();
+					List<GbDeviceChannel> listByAgency = listByAgencyId(agencyVO.getId());
+					if(listByAgency.size() > 0){
+						vo.setHasChildren(true);
+						vo.setId(agencyVO.getId());
+						vo.setLabel(agencyVO.getName());
+						vo.setParentId(0L);
+						vo.setParentLabelName("");
+						treeVOList.add(vo);
+					}
+				}
+			}else{
+				Map<String, Object> residentialMap = new HashMap<>();
+				residentialMap.put("tenantId", tenantId);
+				List<ResidentialVO> residentialVOList = residentialClient.list(residentialMap);
+				for(ResidentialVO residentialVO : residentialVOList){
+					GbDeviceChannelTreeVO vo = new GbDeviceChannelTreeVO();
+					List<GbDeviceChannel> listByResidential = listByResidentialId(parentId, residentialVO.getId());
+					if(listByResidential.size() > 0){
+						vo.setHasChildren(true);
+						vo.setId(residentialVO.getId());
+						vo.setLabel(residentialVO.getName());
+						vo.setParentId(parentId);
+						treeVOList.add(vo);
+					}
+				}
+			}
+		}else if(parentColumn.equals("agency")){
+			Map<String, Object> residentialMap = new HashMap<>();
+			residentialMap.put("agencyId", parentId);
+			List<ResidentialVO> residentialVOList = residentialClient.list(residentialMap);
+			for(ResidentialVO residentialVO : residentialVOList){
+				GbDeviceChannelTreeVO vo = new GbDeviceChannelTreeVO();
+				List<GbDeviceChannel> listByResidential = listByResidentialId(parentId, residentialVO.getId());
+				if(listByResidential.size() > 0){
+					vo.setHasChildren(true);
+					vo.setId(residentialVO.getId());
+					vo.setLabel(residentialVO.getName());
+					vo.setParentId(parentId);
+					treeVOList.add(vo);
+				}
+			}
+		}else if(parentColumn.equals("residential")){
+			List<GbDeviceChannel> listByResidential = listByResidentialId(null, parentId);
+			for(GbDeviceChannel channel : listByResidential){
+				GbDeviceChannelTreeVO vo = new GbDeviceChannelTreeVO();
+				if(channel.getBuildingId() == null){
+					vo.setHasChildren(false);
+					vo.setId(channel.getId());
+					vo.setLabel(channel.getName());
+					vo.setParentId(parentId);
+					vo.setDeviceId(channel.getDeviceId());
+					vo.setChannelId(channel.getChannelId());
+				}else{
+					vo.setHasChildren(true);
+					Building building = buildingClient.getById(channel.getBuildingId());
+					vo.setId(building.getId());
+					vo.setLabel(building.getName());
+					vo.setParentId(parentId);
+				}
+				treeVOList.add(vo);
+			}
+		}else if(parentColumn.equals("building")){
+			List<GbDeviceChannel> listByBuilding = listByBuildingId(null, null, parentId);
+			for(GbDeviceChannel channel : listByBuilding){
+				GbDeviceChannelTreeVO vo = new GbDeviceChannelTreeVO();
+				if(channel.getFloorId() == null){
+					vo.setHasChildren(false);
+					vo.setId(channel.getId());
+					vo.setLabel(channel.getName());
+					vo.setParentId(parentId);
+					vo.setDeviceId(channel.getDeviceId());
+					vo.setChannelId(channel.getChannelId());
+				}else{
+					vo.setHasChildren(true);
+					Floor floor = floorClient.getById(channel.getFloorId());
+					vo.setId(floor.getId());
+					vo.setLabel(floor.getName());
+					vo.setParentId(parentId);
+				}
+				treeVOList.add(vo);
+			}
+		}else if(parentColumn.equals("floor")){
+			LambdaQueryWrapper<GbDeviceChannel> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+			lambdaQueryWrapper.eq(GbDeviceChannel::getFloorId, parentId);
+			List<GbDeviceChannel> channelList = list(lambdaQueryWrapper);
+			for(GbDeviceChannel gbDeviceChannel : channelList){
+				GbDeviceChannelTreeVO vo = new GbDeviceChannelTreeVO();
+				vo.setHasChildren(false);
+				vo.setId(gbDeviceChannel.getId());
+				vo.setLabel(gbDeviceChannel.getName());
+				vo.setParentId(parentId);
+				vo.setDeviceId(gbDeviceChannel.getDeviceId());
+				vo.setChannelId(gbDeviceChannel.getChannelId());
+				treeVOList.add(vo);
+			}
+		}
+		return treeVOList;
+	}
+
+	@Override
+	public List<GbDeviceChannel> listByAgencyId(Long agencyId) {
+		LambdaQueryWrapper<GbDeviceChannel> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+		lambdaQueryWrapper.eq(GbDeviceChannel::getAgencyId, agencyId);
+		return list(lambdaQueryWrapper);
+	}
+
+	@Override
+	public List<GbDeviceChannel> listByResidentialId(Long agencyId, Long residentialId) {
+		LambdaQueryWrapper<GbDeviceChannel> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+		lambdaQueryWrapper.eq(agencyId != null, GbDeviceChannel::getAgencyId, agencyId);
+		lambdaQueryWrapper.eq(GbDeviceChannel::getResidentialId, residentialId);
+		return list(lambdaQueryWrapper);
+	}
+
+	@Override
+	public List<GbDeviceChannel> listByBuildingId(Long agencyId, Long residentialId, Long buildingId) {
+		LambdaQueryWrapper<GbDeviceChannel> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+		lambdaQueryWrapper.eq(agencyId != null, GbDeviceChannel::getAgencyId, agencyId);
+		lambdaQueryWrapper.eq(residentialId != null,GbDeviceChannel::getResidentialId, residentialId);
+		lambdaQueryWrapper.eq(GbDeviceChannel::getBuildingId, buildingId);
+		return list(lambdaQueryWrapper);
+	}
+
+	@Override
+	public List<GbDeviceChannel> listByFloorId(Long agencyId, Long residentialId, Long buildingId, Long floorId) {
+		LambdaQueryWrapper<GbDeviceChannel> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+		lambdaQueryWrapper.eq(agencyId != null, GbDeviceChannel::getAgencyId, agencyId);
+		lambdaQueryWrapper.eq(residentialId != null, GbDeviceChannel::getResidentialId, residentialId);
+		lambdaQueryWrapper.eq(buildingId != null,GbDeviceChannel::getBuildingId, buildingId);
+		lambdaQueryWrapper.eq(GbDeviceChannel::getFloorId, floorId);
+		return list(lambdaQueryWrapper);
+	}
+
+	@Override
+	public R bind(String deviceId, String channelId, Long residentialId, Long buildingId, Long floorId, String installAddress) {
+		GbDeviceChannel channel = getByChannelId(deviceId, channelId);
+		Assert.notNull(channel, "设备通道不存在");
+		channel.setResidentialId(residentialId);
+		channel.setBuildingId(buildingId);
+		channel.setFloorId(floorId);
+		channel.setInstallAddress(installAddress);
+		return R.status(updateById(channel));
+	}
+
+	@Override
+	public R deleteChannel(String deviceId, String tenantId) {
+		int i = this.baseMapper.deleteChannel(deviceId, tenantId);
+		return R.status(i > 0);
+	}
+
 }

+ 20 - 0
blade-service/device/src/main/java/org/springblade/device/service/impl/GbDeviceServiceImpl.java

@@ -23,6 +23,7 @@ import org.springblade.community.feign.IAgencyClient;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.BeanUtil;
 import org.springblade.device.entity.Gb28181Device;
+import org.springblade.device.service.IGbDeviceChannelService;
 import org.springblade.device.vo.Gb28181DeviceVO;
 import org.springblade.device.mapper.GbDeviceMapper;
 import org.springblade.device.service.IGbDeviceService;
@@ -36,6 +37,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.springframework.util.Assert;
 
 import java.util.Date;
+import java.util.List;
 
 /**
  *  服务实现类
@@ -50,6 +52,8 @@ public class GbDeviceServiceImpl extends BaseServiceImpl<GbDeviceMapper, Gb28181
 	private IAgencyClient agencyClient;
 	@Autowired
 	private IThirdGbDeviceClient thirdGbDeviceClient;
+	@Autowired
+	private IGbDeviceChannelService deviceChannelService;
 
 	@Override
 	public IPage<Gb28181DeviceVO> selectGbDevicePage(IPage<Gb28181DeviceVO> page, Gb28181DeviceVO gbDevice) {
@@ -106,4 +110,20 @@ public class GbDeviceServiceImpl extends BaseServiceImpl<GbDeviceMapper, Gb28181
 		}
 	}
 
+	@Override
+	public R deleteDevice(List<Long> idList) {
+		for(Long id : idList){
+			Gb28181Device device = this.getById(id);
+			String deviceId = device.getDeviceId();
+			String tenantId = device.getTenantId();
+			R r = this.deviceChannelService.deleteChannel(deviceId, tenantId);
+			if(r.isSuccess()){
+				this.baseMapper.deleteDevice(id);
+			}else{
+				return R.status(false);
+			}
+		}
+		return R.status(true);
+	}
+
 }

+ 35 - 6
blade-service/device/src/main/java/org/springblade/device/wrapper/GbDeviceChannelWrapper.java

@@ -16,8 +16,16 @@
  */
 package org.springblade.device.wrapper;
 
+import org.springblade.community.entity.Building;
+import org.springblade.community.entity.Floor;
+import org.springblade.community.entity.Residential;
+import org.springblade.community.feign.IBuildingClient;
+import org.springblade.community.feign.IFloorClient;
+import org.springblade.community.feign.IResidentialClient;
 import org.springblade.core.mp.support.BaseEntityWrapper;
 import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.core.tool.utils.SpringUtil;
+import org.springblade.core.tool.utils.StringUtil;
 import org.springblade.device.entity.GbDeviceChannel;
 import org.springblade.device.vo.GbDeviceChannelVO;
 import java.util.Objects;
@@ -30,19 +38,40 @@ import java.util.Objects;
  */
 public class GbDeviceChannelWrapper extends BaseEntityWrapper<GbDeviceChannel, GbDeviceChannelVO>  {
 
+	private static IResidentialClient residentialClient;
+	private static IBuildingClient buildingClient;
+	private static IFloorClient floorClient;
+
 	public static GbDeviceChannelWrapper build() {
 		return new GbDeviceChannelWrapper();
  	}
 
+ 	static {
+		residentialClient = SpringUtil.getBean(IResidentialClient.class);
+		buildingClient = SpringUtil.getBean(IBuildingClient.class);
+		floorClient = SpringUtil.getBean(IFloorClient.class);
+	}
+
 	@Override
 	public GbDeviceChannelVO entityVO(GbDeviceChannel gbDeviceChannel) {
 		GbDeviceChannelVO gbDeviceChannelVO = Objects.requireNonNull(BeanUtil.copy(gbDeviceChannel, GbDeviceChannelVO.class));
-
-		//User createUser = UserCache.getUser(gbDeviceChannel.getCreateUser());
-		//User updateUser = UserCache.getUser(gbDeviceChannel.getUpdateUser());
-		//gbDeviceChannelVO.setCreateUserName(createUser.getName());
-		//gbDeviceChannelVO.setUpdateUserName(updateUser.getName());
-
+		StringBuilder sb = new StringBuilder();
+		if(gbDeviceChannelVO.getResidentialId() != null){
+			Residential residential = residentialClient.getById(gbDeviceChannelVO.getResidentialId());
+			sb.append(residential.getName());
+			if(gbDeviceChannelVO.getBuildingId() != null){
+				Building building = buildingClient.getById(gbDeviceChannelVO.getBuildingId());
+				sb.append("|").append(building.getName());
+			}
+			if(gbDeviceChannelVO.getFloorId() != null){
+				Floor floor = floorClient.getById(gbDeviceChannelVO.getFloorId());
+				sb.append("|").append(floor.getName());
+			}
+		}
+		if(StringUtil.isNotBlank(gbDeviceChannelVO.getInstallAddress())){
+			sb.append("|").append(gbDeviceChannelVO.getInstallAddress());
+		}
+		gbDeviceChannelVO.setInstallLocal(sb.toString());
 		return gbDeviceChannelVO;
 	}
 

+ 2 - 2
blade-service/person/src/main/java/org/springblade/person/service/impl/HouseUserServiceImpl.java

@@ -149,7 +149,7 @@ public class HouseUserServiceImpl extends BaseServiceImpl<HouseUserMapper, House
 		String confValue = confClient.getValueByToken("file.server.host");
 		UserInfoDto userInfoDto = new UserInfoDto();
 		userInfoDto.setFaceUrl(houseUser.getImageUri());
-		userInfoDto.setId(CommonConstant.UserFlag.USER_NUMBER_FLAG.getValue() + houseUser.getId());
+		userInfoDto.setId(CommonConstant.UserFlag.HOUSE_USER_FLAG.getValue() + houseUser.getId());
 
 		Date begin = new Date();
 		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@@ -177,7 +177,7 @@ public class HouseUserServiceImpl extends BaseServiceImpl<HouseUserMapper, House
 		for(HouseUser houseUser : userInfoList){
 			if(StringUtil.isNotBlank(houseUser.getImageUri())){
 				UserInfoDto dto = new UserInfoDto();
-				dto.setId(CommonConstant.UserFlag.USER_NUMBER_FLAG.getValue() + houseUser.getId());
+				dto.setId(CommonConstant.UserFlag.HOUSE_USER_FLAG.getValue() + houseUser.getId());
 				dto.setFaceCodeList(new ArrayList<>(0));
 				DispatchTask task = new DispatchTask();
 				task.setUnitId(houseUser.getUnitId());

+ 5 - 0
blade-service/third/src/main/java/org/springblade/third/videodevice/wvp/controller/WvpDeviceController.java

@@ -49,6 +49,8 @@ public class WvpDeviceController {
 	private IGbDeviceClient gbDeviceClient;
 	@Autowired
 	private IGbDeviceChannelClient gbDeviceChannelClient;
+	@Autowired
+	private IAgencyClient agencyClient;
 
 	@ApiOperation("设备绑定")
 	@ApiOperationSupport(order = 11)
@@ -66,11 +68,14 @@ public class WvpDeviceController {
 			gb28181Device.setResidentialId(residentialId);
 			R bind = gbDeviceClient.bind(gb28181Device);
 			if(bind.isSuccess()){
+				Agency agency = agencyClient.getById(agencyId);
 				List<GbDeviceChannel> deviceChannelList = new ArrayList<>();
 				R<List<GbChannel>> channelsR = this.wvpService.getChannelByDeviceId(deviceId);
 				for(GbChannel channel : channelsR.getData()){
 					GbDeviceChannel deviceChannel = org.springblade.core.tool.utils.BeanUtil.copy(channel, GbDeviceChannel.class);
 					deviceChannel.setPtzType(channel.getPTZType());
+					deviceChannel.setTenantId(agency.getTenantId());
+					deviceChannel.setAgencyId(agencyId);
 					deviceChannelList.add(deviceChannel);
 				}
 				if(deviceChannelList.size() > 0){

+ 6 - 2
blade-service/third/src/main/java/org/springblade/third/videodevice/wvp/service/WvpService.java

@@ -115,8 +115,12 @@ public class WvpService {
 		HttpResponse response = HttpRequest.get(wvpUrl + reqUrl).execute();
 		log.info("【wvp】devicePlay", "【requestParam】:" + reqUrl + "【response】:" + response.body());
 		String data = response.body();
-		if(StringUtils.hasText(data) && data.equals("success")){
-			return R.success("停止点播成功");
+		if(StringUtils.hasText(data)){
+			if(!data.equals("点播未找到") && !data.equals("streamId null") && !data.equals("Timeout")){
+				return R.success("停止成功");
+			}else{
+				return R.fail(data);
+			}
 		}else{
 			return R.fail(data);
 		}