Repository navigation
fix(gb28181): 级联录像查询(RecordInfo)响应支持按每页数量分页 - #2242
Merged
Merged
Conversation
|
@CieveMe is attempting to deploy a commit to the 648540858's projects Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
关联议题:#2138(作为下级平台,上级查询录像的结果太大,返回时没有分页,超过 MTU 导致上级收不到)
维护者在议题中已明确支持该方向:
问题
本服务作为下级平台被上级平台查询录像(
CmdType=RecordInfo)时,把整批录像记录拼成一条 SIP MESSAGE 直接回复给上级。记录条数多时,该报文体随条数线性增长,一旦超过链路 MTU(UDP 场景尤其明显),上级就收不到查询结果;当前也没有"每页数量"这样的配置项可以规避。根因
SIPCommanderForPlatform.recordInfo(...):recordInfo.getRecordList()里的全部记录写进同一个<RecordList Num="N">;headerProviderPlatformProvider.createMessageRequest(...)+sipSender.transmitRequest(...)。调用它的两条支路(国标设备的录像查询回调、云端录像
playService.queryRecord回调)都无法影响这个"一次发完"的行为,因此只要记录足够多就必然超 MTU。改动范围
user-settings.record-info-page-size→UserSetting.recordInfoPageSize> 0:单条 SIP MESSAGE 最多携带这么多条记录,超出部分按多页顺序发送(SN不变、SumNum仍为总条数、每页<RecordList Num="本页条数">,便于上级按SN聚合);<= 0:不分页,一次发送全部,与历史行为一致;src/main/resources/配置详情.yml,docker 部署在docker/wvp/wvp/application-docker.yml给了注释示例(# record-info-page-size: ${RecordInfoPageSize:1000})。SIPCommanderForPlatform:recordInfo(...)改为按页循环发送;抽出两个静态方法partitionRecordItems(recordList, pageSize):按每页数量切分(pageSize <= 0或记录数不超过一页时,仍是"一页",即原路径);buildRecordInfoXml(characterSet, sn, gbDeviceId, sumNum, pageItems):生成一页的 XML,输出格式与改动前逐字一致,只有RecordList Num随本页条数变化。记录总数 > record-info-page-size且record-info-page-size > 0。默认值下等价于"超过 1000 条才分页"。改动文件:
src/main/java/com/genersoft/iot/vmp/conf/UserSetting.javarecordInfoPageSize(默认 1000)src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderForPlatform.javapartitionRecordItems/buildRecordInfoXmlsrc/main/resources/配置详情.ymldocker/wvp/wvp/application-docker.ymlsrc/test/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/RecordInfoPagingTest.java验证方式
mvn -DskipTests -q compile→ exit 0。RecordInfoPagingTest(4 个用例)——pageSize <= 0/null时不分页(与历史行为一致);Num=0的单页;SumNum始终为总条数、RecordList Num为本页条数;单页输出与改动前逐字一致(含<Item>内字段顺序)。pom.xml默认<skipTests>true</skipTests>,本地验证时临时放开后运行,命令为mvn -Dtest=RecordInfoPagingTest -DfailIfNoTests=false test(结果:Tests run: 4, Failures: 0, Errors: 0)。提交内容不含对pom.xml的任何修改。未验证项
SN正确合并多页(国标要求按SN聚合并以SumNum判断结束,但各家实现存在差异)。备注
可复现命令块
本仓库
pom.xml里 surefire 插件的<skipTests>硬编码为true,直接跑会输出Tests are skipped.。本地复现需要先把它临时改成false(该 pom 改动未提交,PR 里不含),然后:mvn -Dtest=RecordInfoPagingTest test预期输出(本机实测 2026-09-26):
4 个用例覆盖:
pageSize <= 0与null→ 不分页(与历史行为一致);RecordList Num="0";SumNum始终为总条数、RecordList Num为本页条数;并断言单页输出与改动前逐字一致(含<Item>内字段顺序)。编译另有:
mvn -DskipTests -q compile(JDK 21)→ exit 0。