manscdp recordInfo
This commit is contained in:
parent
76233345b5
commit
b072ef7c58
@ -1,22 +1,28 @@
|
||||
package cn.skcks.docking.gb28181.sip.manscdp.catalog.query;
|
||||
package cn.skcks.docking.gb28181.sip.manscdp.catalog.response;
|
||||
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@JacksonXmlRootElement(localName = "DeviceList")
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class CatalogDeviceListDTO {
|
||||
@Builder.Default
|
||||
@JacksonXmlProperty(isAttribute = true)
|
||||
private Integer num;
|
||||
private Integer num = 0;
|
||||
|
||||
@Builder.Default
|
||||
@JacksonXmlProperty(localName = "Item")
|
||||
@JacksonXmlElementWrapper(useWrapping = false)
|
||||
private List<CatalogItemDTO> deviceList;
|
||||
private List<CatalogItemDTO> deviceList = new ArrayList<>();
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package cn.skcks.docking.gb28181.sip.manscdp.catalog.query;
|
||||
package cn.skcks.docking.gb28181.sip.manscdp.catalog.response;
|
||||
|
||||
|
||||
import cn.skcks.docking.gb28181.constant.GB28181Constant;
|
@ -1,7 +1,6 @@
|
||||
package cn.skcks.docking.gb28181.sip.manscdp.catalog.response;
|
||||
|
||||
import cn.skcks.docking.gb28181.constant.CmdType;
|
||||
import cn.skcks.docking.gb28181.sip.manscdp.catalog.query.CatalogDeviceListDTO;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
@ -0,0 +1,50 @@
|
||||
package cn.skcks.docking.gb28181.sip.manscdp.recordinfo.request;
|
||||
|
||||
import cn.skcks.docking.gb28181.constant.CmdType;
|
||||
import cn.skcks.docking.gb28181.constant.GB28181Constant;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@JacksonXmlRootElement(localName = "Query")
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class RecordInfoRequestDTO {
|
||||
/**
|
||||
* 命令类型:设备信息查询(必选)
|
||||
*/
|
||||
@Builder.Default
|
||||
private String cmdType = CmdType.RECORD_INFO;
|
||||
|
||||
/**
|
||||
* 命令序列号(必选)
|
||||
*/
|
||||
@JacksonXmlProperty(localName = "SN")
|
||||
private String sn;
|
||||
|
||||
/**
|
||||
* 目标设备的设备编码(必选)
|
||||
*/
|
||||
@JacksonXmlProperty(localName = "DeviceID")
|
||||
private String deviceId;
|
||||
|
||||
@JsonFormat(pattern = GB28181Constant.DATETIME_FORMAT, timezone = GB28181Constant.TIME_ZONE)
|
||||
private Date startTime;
|
||||
|
||||
@JsonFormat(pattern = GB28181Constant.DATETIME_FORMAT, timezone = GB28181Constant.TIME_ZONE)
|
||||
private Date endTime;
|
||||
|
||||
@Builder.Default
|
||||
private Integer Secrecy = 0;
|
||||
|
||||
@Builder.Default
|
||||
private String type = "all";
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package cn.skcks.docking.gb28181.sip.manscdp.recordinfo.response;
|
||||
|
||||
import cn.skcks.docking.gb28181.constant.GB28181Constant;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Data
|
||||
@JacksonXmlRootElement(localName = "Item")
|
||||
public class RecordInfoItemDTO {
|
||||
/**
|
||||
* 目标设备的设备编码(必选)
|
||||
*/
|
||||
@JacksonXmlProperty(localName = "DeviceID")
|
||||
private String deviceId;
|
||||
|
||||
private String name;
|
||||
|
||||
private String address;
|
||||
|
||||
@JsonFormat(pattern = GB28181Constant.DATETIME_FORMAT, timezone = GB28181Constant.TIME_ZONE)
|
||||
private Date startTime;
|
||||
|
||||
@JsonFormat(pattern = GB28181Constant.DATETIME_FORMAT, timezone = GB28181Constant.TIME_ZONE)
|
||||
private Date endTime;
|
||||
|
||||
@Builder.Default
|
||||
private Integer secrecy = 0;
|
||||
|
||||
@Builder.Default
|
||||
private String type = "all";
|
||||
|
||||
private Long fileSize;
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package cn.skcks.docking.gb28181.sip.manscdp.recordinfo.response;
|
||||
|
||||
import cn.skcks.docking.gb28181.constant.CmdType;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Data
|
||||
@JacksonXmlRootElement(localName = "Response")
|
||||
public class RecordInfoResponseDTO {
|
||||
/**
|
||||
* 命令类型:设备信息查询(必选)
|
||||
*/
|
||||
@Builder.Default
|
||||
private String cmdType = CmdType.RECORD_INFO;
|
||||
|
||||
/**
|
||||
* 命令序列号(必选)
|
||||
*/
|
||||
@JacksonXmlProperty(localName = "SN")
|
||||
private String sn;
|
||||
|
||||
/**
|
||||
* 目标设备的设备编码(必选)
|
||||
*/
|
||||
@JacksonXmlProperty(localName = "DeviceID")
|
||||
private String deviceId;
|
||||
|
||||
private String name;
|
||||
|
||||
private Long sumNum;
|
||||
|
||||
private RecordListDTO recordList;
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package cn.skcks.docking.gb28181.sip.manscdp.recordinfo.response;
|
||||
|
||||
import cn.skcks.docking.gb28181.sip.manscdp.catalog.response.CatalogItemDTO;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@JacksonXmlRootElement(localName = "RecordList")
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class RecordListDTO {
|
||||
@Builder.Default
|
||||
@JacksonXmlProperty(isAttribute = true)
|
||||
private Integer num = 0;
|
||||
|
||||
@Builder.Default
|
||||
@JacksonXmlProperty(localName = "Item")
|
||||
@JacksonXmlElementWrapper(useWrapping = false)
|
||||
private List<RecordInfoItemDTO> recordList = new ArrayList<>();
|
||||
}
|
@ -58,6 +58,10 @@ public class MANSCDPUtils {
|
||||
return new XMLBuilder<>(data);
|
||||
}
|
||||
|
||||
public static <T> XMLBuilder<T> build(T data, String charset){
|
||||
return new XMLBuilder<>(charset, data);
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public static byte[] writeXmlWithEncoding(Object obj, String charset){
|
||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
|
@ -1,18 +1,23 @@
|
||||
package cn.skcks.docking.gb28181.sip.manscdp;
|
||||
|
||||
import cn.skcks.docking.gb28181.sip.manscdp.catalog.query.CatalogDeviceListDTO;
|
||||
import cn.skcks.docking.gb28181.sip.manscdp.catalog.query.CatalogItemDTO;
|
||||
import cn.skcks.docking.gb28181.sip.manscdp.catalog.response.CatalogDeviceListDTO;
|
||||
import cn.skcks.docking.gb28181.sip.manscdp.catalog.response.CatalogItemDTO;
|
||||
import cn.skcks.docking.gb28181.sip.manscdp.catalog.query.CatalogQueryDTO;
|
||||
import cn.skcks.docking.gb28181.sip.manscdp.catalog.response.CatalogResponseDTO;
|
||||
import cn.skcks.docking.gb28181.sip.manscdp.deviceinfo.request.DeviceInfoRequestDTO;
|
||||
import cn.skcks.docking.gb28181.sip.manscdp.deviceinfo.response.DeviceInfoResponseDTO;
|
||||
import cn.skcks.docking.gb28181.sip.manscdp.keepalive.notify.KeepaliveNotifyDTO;
|
||||
import cn.skcks.docking.gb28181.sip.manscdp.recordinfo.request.RecordInfoRequestDTO;
|
||||
import cn.skcks.docking.gb28181.sip.manscdp.recordinfo.response.RecordInfoItemDTO;
|
||||
import cn.skcks.docking.gb28181.sip.manscdp.recordinfo.response.RecordInfoResponseDTO;
|
||||
import cn.skcks.docking.gb28181.sip.manscdp.recordinfo.response.RecordListDTO;
|
||||
import cn.skcks.docking.gb28181.sip.utils.MANSCDPUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@ -116,4 +121,41 @@ public class MANSCDPTest {
|
||||
log.info("getDeviceName {}", parse.getDeviceName());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void recordInfo(){
|
||||
RecordInfoRequestDTO recordInfoRequestDTO = RecordInfoRequestDTO.builder()
|
||||
.type("all")
|
||||
.startTime(new Date())
|
||||
.endTime(new Date())
|
||||
.deviceId(deviceId)
|
||||
.sn(sn)
|
||||
.build();
|
||||
MANSCDPUtils.XMLBuilder<RecordInfoRequestDTO> recordInfoRequestDTOXMLBuilder = MANSCDPUtils.build(recordInfoRequestDTO);
|
||||
log.info("\n{}",MANSCDPUtils.toXml(recordInfoRequestDTOXMLBuilder));
|
||||
|
||||
|
||||
RecordInfoItemDTO recordInfoItemDTO = RecordInfoItemDTO.builder()
|
||||
.deviceId(deviceId)
|
||||
.startTime(new Date())
|
||||
.endTime(new Date())
|
||||
.name("record.mp4")
|
||||
.fileSize(0L)
|
||||
.build();
|
||||
List<RecordInfoItemDTO> recordInfoItemDTOList = new ArrayList<>(2);
|
||||
recordInfoItemDTOList.add(recordInfoItemDTO);
|
||||
recordInfoItemDTOList.add(recordInfoItemDTO);
|
||||
RecordInfoResponseDTO recordInfoResponseDTO = RecordInfoResponseDTO.builder()
|
||||
.name(deviceName)
|
||||
.deviceId(deviceId)
|
||||
.sn(sn)
|
||||
.sumNum(2L)
|
||||
.recordList(RecordListDTO.builder()
|
||||
.num(2)
|
||||
.recordList(recordInfoItemDTOList)
|
||||
.build())
|
||||
.build();
|
||||
MANSCDPUtils.XMLBuilder<RecordInfoResponseDTO> recordInfoResponseDTOXMLBuilder = MANSCDPUtils.build(recordInfoResponseDTO,"UTF8");
|
||||
log.info("\n{}", MANSCDPUtils.toXml(recordInfoResponseDTOXMLBuilder));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user