diff --git a/gb28181-mocking-service/src/main/java/cn/skcks/docking/gb28181/mocking/core/sip/message/processor/message/request/recordinfo/RecordInfoRequestProcessor.java b/gb28181-mocking-service/src/main/java/cn/skcks/docking/gb28181/mocking/core/sip/message/processor/message/request/recordinfo/RecordInfoRequestProcessor.java index 2f48b40..c749dbb 100644 --- a/gb28181-mocking-service/src/main/java/cn/skcks/docking/gb28181/mocking/core/sip/message/processor/message/request/recordinfo/RecordInfoRequestProcessor.java +++ b/gb28181-mocking-service/src/main/java/cn/skcks/docking/gb28181/mocking/core/sip/message/processor/message/request/recordinfo/RecordInfoRequestProcessor.java @@ -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(); diff --git a/gb28181-mocking-service/src/main/java/cn/skcks/docking/gb28181/mocking/core/sip/message/processor/message/request/recordinfo/dto/RecordInfoItemDTO.java b/gb28181-mocking-service/src/main/java/cn/skcks/docking/gb28181/mocking/core/sip/message/processor/message/request/recordinfo/dto/RecordInfoItemDTO.java index 595913c..99b09f0 100644 --- a/gb28181-mocking-service/src/main/java/cn/skcks/docking/gb28181/mocking/core/sip/message/processor/message/request/recordinfo/dto/RecordInfoItemDTO.java +++ b/gb28181-mocking-service/src/main/java/cn/skcks/docking/gb28181/mocking/core/sip/message/processor/message/request/recordinfo/dto/RecordInfoItemDTO.java @@ -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; diff --git a/gb28181-mocking-service/src/main/java/cn/skcks/docking/gb28181/mocking/core/sip/message/processor/message/request/recordinfo/dto/RecordInfoResponseDTO.java b/gb28181-mocking-service/src/main/java/cn/skcks/docking/gb28181/mocking/core/sip/message/processor/message/request/recordinfo/dto/RecordInfoResponseDTO.java index 4ed325d..858d54f 100644 --- a/gb28181-mocking-service/src/main/java/cn/skcks/docking/gb28181/mocking/core/sip/message/processor/message/request/recordinfo/dto/RecordInfoResponseDTO.java +++ b/gb28181-mocking-service/src/main/java/cn/skcks/docking/gb28181/mocking/core/sip/message/processor/message/request/recordinfo/dto/RecordInfoResponseDTO.java @@ -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 recordList; + private RecordListDTO recordList; } diff --git a/gb28181-mocking-service/src/main/java/cn/skcks/docking/gb28181/mocking/core/sip/message/processor/message/request/recordinfo/dto/RecordListDTO.java b/gb28181-mocking-service/src/main/java/cn/skcks/docking/gb28181/mocking/core/sip/message/processor/message/request/recordinfo/dto/RecordListDTO.java new file mode 100644 index 0000000..62582bf --- /dev/null +++ b/gb28181-mocking-service/src/main/java/cn/skcks/docking/gb28181/mocking/core/sip/message/processor/message/request/recordinfo/dto/RecordListDTO.java @@ -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 recordList = new ArrayList<>(); +}