recordInfo 格式修正

This commit is contained in:
shikong 2023-09-30 17:24:28 +08:00
parent 3e11b95ac6
commit b58053f20b
4 changed files with 51 additions and 11 deletions

View File

@ -7,6 +7,7 @@ import cn.skcks.docking.gb28181.common.xml.XmlUtils;
import cn.skcks.docking.gb28181.core.sip.message.processor.message.types.recordinfo.query.dto.RecordInfoRequestDTO;
import cn.skcks.docking.gb28181.mocking.core.sip.message.processor.message.request.recordinfo.dto.RecordInfoItemDTO;
import cn.skcks.docking.gb28181.mocking.core.sip.message.processor.message.request.recordinfo.dto.RecordInfoResponseDTO;
import cn.skcks.docking.gb28181.mocking.core.sip.message.processor.message.request.recordinfo.dto.RecordListDTO;
import cn.skcks.docking.gb28181.mocking.core.sip.request.SipRequestBuilder;
import cn.skcks.docking.gb28181.mocking.core.sip.response.SipResponseBuilder;
import cn.skcks.docking.gb28181.mocking.core.sip.sender.SipSender;
@ -88,7 +89,11 @@ public class RecordInfoRequestProcessor {
recordInfoResponseDTO.setDeviceId(device.getGbChannelId());
recordInfoResponseDTO.setName(device.getName());
recordInfoResponseDTO.setSumNum((long) recordInfoItemDTOList.size());
recordInfoResponseDTO.setRecordList(recordList);
RecordListDTO recordListDTO = RecordListDTO.builder()
.recordList(recordList)
.num(recordList.size())
.build();
recordInfoResponseDTO.setRecordList(recordListDTO);
sender.sendRequest((provider, ip, port) -> {
CallIdHeader callIdHeader = provider.getNewCallId();

View File

@ -5,11 +5,16 @@ import cn.skcks.docking.gb28181.core.sip.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 jakarta.validation.constraints.Min;
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 {
@ -29,9 +34,10 @@ public class RecordInfoItemDTO {
@JsonFormat(pattern = DatePattern.UTC_SIMPLE_PATTERN, timezone = GB28181Constant.TIME_ZONE)
private Date endTime;
@Min(value = 0)
@Builder.Default
private Integer secrecy = 0;
@Builder.Default
private String type = "all";
private Long fileSize;

View File

@ -1,20 +1,23 @@
package cn.skcks.docking.gb28181.mocking.core.sip.message.processor.message.request.recordinfo.dto;
import cn.skcks.docking.gb28181.core.sip.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 {
/**
* 命令类型:设备信息查询(必选)
*/
private String cmdType = CmdType.RECORD_INFO;
@Builder.Default
private String cmdType = "RecordInfo";
/**
* 命令序列号(必选)
@ -32,7 +35,5 @@ public class RecordInfoResponseDTO {
private Long sumNum;
@JacksonXmlElementWrapper(localName = "RecordList")
@JacksonXmlProperty(localName = "Item")
private List<RecordInfoItemDTO> recordList;
private RecordListDTO recordList;
}

View File

@ -0,0 +1,28 @@
package cn.skcks.docking.gb28181.mocking.core.sip.message.processor.message.request.recordinfo.dto;
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<>();
}