临时提交

This commit is contained in:
panlinlin
2024-08-08 23:44:03 +08:00
parent 8ab88c0f02
commit a1671c3c3e
11 changed files with 172 additions and 74 deletions

View File

@@ -1,11 +1,14 @@
package com.genersoft.iot.vmp.gb28181.bean;
import lombok.Data;
import java.time.Instant;
import java.util.List;
/**
* @author lin
*/
@Data
public class CatalogData {
/**
* 命令序列号
@@ -13,6 +16,8 @@ public class CatalogData {
private int sn;
private int total;
private List<DeviceChannel> channelList;
private List<Region> regionListList;
private List<Group> groupListListList;
private Instant lastTime;
private Device device;
private String errorMsg;
@@ -21,61 +26,4 @@ public class CatalogData {
ready, runIng, end
}
private CatalogDataStatus status;
public int getSn() {
return sn;
}
public void setSn(int sn) {
this.sn = sn;
}
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public List<DeviceChannel> getChannelList() {
return channelList;
}
public void setChannelList(List<DeviceChannel> channelList) {
this.channelList = channelList;
}
public Instant getLastTime() {
return lastTime;
}
public void setLastTime(Instant lastTime) {
this.lastTime = lastTime;
}
public Device getDevice() {
return device;
}
public void setDevice(Device device) {
this.device = device;
}
public String getErrorMsg() {
return errorMsg;
}
public void setErrorMsg(String errorMsg) {
this.errorMsg = errorMsg;
}
public CatalogDataStatus getStatus() {
return status;
}
public void setStatus(CatalogDataStatus status) {
this.status = status;
}
}

View File

@@ -1,5 +1,6 @@
package com.genersoft.iot.vmp.gb28181.bean;
import com.genersoft.iot.vmp.utils.DateUtil;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.jetbrains.annotations.NotNull;
@@ -58,6 +59,25 @@ public class Group implements Comparable<Group>{
@Schema(description = "平台ID")
private Integer platformId;
public static Group getInstance(DeviceChannel channel) {
GbCode gbCode = GbCode.decode(channel.getDeviceId());
if (gbCode == null || (!gbCode.getTypeCode().equals("215") && !gbCode.getTypeCode().equals("216"))) {
return null;
}
Group group = new Group();
group.setName(channel.getName());
group.setDeviceId(channel.getDeviceId());
group.setCreateTime(DateUtil.getNow());
group.setUpdateTime(DateUtil.getNow());
if (gbCode.getTypeCode().equals("215")) {
group.setBusinessGroup(channel.getDeviceId());
}else if (gbCode.getTypeCode().equals("216")) {
group.setBusinessGroup(channel.getBusinessGroupId());
group.setParentDeviceId(channel.getParentId());
}
return group;
}
@Override
public int compareTo(@NotNull Group region) {
return Integer.compare(Integer.parseInt(this.deviceId), Integer.parseInt(region.getDeviceId()));

View File

@@ -1,6 +1,7 @@
package com.genersoft.iot.vmp.gb28181.bean;
import com.genersoft.iot.vmp.common.CivilCodePo;
import com.genersoft.iot.vmp.utils.CivilCodeUtil;
import com.genersoft.iot.vmp.utils.DateUtil;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@@ -70,6 +71,19 @@ public class Region implements Comparable<Region>{
return region;
}
public static Region getInstance(DeviceChannel channel) {
Region region = new Region();
region.setName(channel.getName());
region.setDeviceId(channel.getDeviceId());
CivilCodePo parentCode = CivilCodeUtil.INSTANCE.getParentCode(channel.getDeviceId());
if (parentCode != null) {
region.setParentDeviceId(parentCode.getCode());
}
region.setCreateTime(DateUtil.getNow());
region.setUpdateTime(DateUtil.getNow());
return region;
}
@Override
public int compareTo(@NotNull Region region) {
return Integer.compare(Integer.parseInt(this.deviceId), Integer.parseInt(region.getDeviceId()));