Merge remote-tracking branch 'github/wvp-28181-2.0' into wvp-28181-2.0
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
package com.genersoft.iot.vmp.vmanager.bean;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
||||
import com.genersoft.iot.vmp.utils.node.INode;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "DeviceChannelTree对象", description = "DeviceChannelTree对象")
|
||||
public class DeviceChannelTree extends DeviceChannel implements INode<DeviceChannelTree> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 父节点ID
|
||||
*/
|
||||
private String parentId;
|
||||
|
||||
private String parentName;
|
||||
|
||||
private String title;
|
||||
|
||||
private String key;
|
||||
|
||||
private String value;
|
||||
|
||||
/**
|
||||
* 子孙节点
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private List<DeviceChannelTree> children;
|
||||
|
||||
/**
|
||||
* 是否有子孙节点
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private Boolean hasChildren;
|
||||
|
||||
@Override
|
||||
public List<DeviceChannelTree> getChildren() {
|
||||
if (this.children == null) {
|
||||
this.children = new ArrayList<>();
|
||||
}
|
||||
return this.children;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean getHasChildren() {
|
||||
if (children.size() > 0) {
|
||||
return true;
|
||||
} else {
|
||||
return this.hasChildren;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.genersoft.iot.vmp.vmanager.bean;
|
||||
|
||||
import com.genersoft.iot.vmp.utils.node.TreeNode;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class DeviceChannelTreeNode extends TreeNode {
|
||||
|
||||
private Integer status;
|
||||
|
||||
private String deviceId;
|
||||
|
||||
private String channelId;
|
||||
|
||||
private Double lng;
|
||||
|
||||
private Double lat;
|
||||
}
|
||||
@@ -1,32 +1,35 @@
|
||||
package com.genersoft.iot.vmp.vmanager.bean;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WVPResult<T> {
|
||||
|
||||
private int code;
|
||||
private String msg;
|
||||
private T data;
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
private static final Integer SUCCESS = 200;
|
||||
private static final Integer FAILED = 400;
|
||||
|
||||
public static <T> WVPResult<T> Data(T t, String msg) {
|
||||
return new WVPResult<>(SUCCESS, msg, t);
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
public static <T> WVPResult<T> Data(T t) {
|
||||
return Data(t, "成功");
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
public static <T> WVPResult<T> fail(int code, String msg) {
|
||||
return new WVPResult<>(code, msg, null);
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
public static <T> WVPResult<T> fail(String msg) {
|
||||
return fail(FAILED, msg);
|
||||
}
|
||||
|
||||
public T getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(T data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,8 +10,10 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
|
||||
import com.genersoft.iot.vmp.service.IDeviceService;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.DeviceChannelTree;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
@@ -25,6 +27,7 @@ import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.context.request.async.DeferredResult;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Api(tags = "国标设备查询", value = "国标设备查询")
|
||||
@@ -431,5 +434,9 @@ public class DeviceQuery {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/{deviceId}/tree")
|
||||
@ApiOperation(value = "通道树形结构", notes = "通道树形结构")
|
||||
public WVPResult<List<DeviceChannelTree>> tree(@PathVariable String deviceId) {
|
||||
return WVPResult.Data(storager.tree(deviceId));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user