yeg
2026-09-28 ccf7fa9210887633944bd4d78f90463b82807e6e
refs
用户 yeg <1347747024@qq.com>
星期一, 九月 28, 2026 17:29 +0800
提交者 yeg <1347747024@qq.com>
星期一, 九月 28, 2026 17:31 +0800
提交ccf7fa9210887633944bd4d78f90463b82807e6e
目录 3c0f2424415ac5dfe2369f4f11d60db7dda812d6 目录 | zip | gz
parent 9c93934b70ccfca081102944a47f3baafad3c218 查看 | 对比
实现 22 所推式来源闭环:接收端点、落地表与读落地表的适配器

按 ADR-0065 落地 PUSH_INGEST(22 所那台):只读取数程序把厂商原始行推到
POST /device-ingest/{adapterCode},后端解释后落进落地表 t_device_ingest_record,
适配器再从落地表读回统一观测,与直连来源共用同一契约、接缝形状不改。

- 接收端点:按来源实例区分,请求头携带该来源令牌(与厂商库口令共用
LocalCredentials 的取值顺序,不入库);凭据错、来源未启用、来源类型不对或
载荷不合法一律整批不落库,并按非 2xx 应答——取数程序只在 2xx 后推进水位。
- 落地表:一行 = 一条厂商原始行,按收到的键值原样保存原始行,另存解析出的
身份、设备时间、协议序号与测量列。幂等键为「来源定位 + Data_Point」
(22 所每个测试新建一个库,Data_Point 在每个测试内重新编号);
重复推送幂等忽略,同身份内容不同只报冲突、不覆盖。
- 适配器:候选来自拓扑上报并带各自最近数据时间,机器地址取实例 host
(登记检测柜时带进 IP 字段);心跳缺失或超过容忍窗口时发现明确失败,
沿用既有路径把已登记设备置为离线、撤下旧快照,离线不伪造测量值。
水位按 (设备时间, 协议序号) 只放行严格更晚的行。
- 取数程序 scripts/j22-collector.ps1(中文注释 + UTF-8 with BOM):只读
Windows 认证、固定 SELECT、不开入站端口、不传厂商库凭据;每条命令显式设
超时(连接串与命令都设)、无加锁读与长事务、增量过滤不排序(排序在客户端
做)、收到 2xx 才推进水位。
- 落地行未新增又查不到既有行时明确失败,而不是当作重复忽略:避免
insert ignore 把"转换失败被跳过"变成静默丢数后仍然回 2xx。

后端全量测试 371 项通过(battery-business 18、ruoyi-admin 273 含 4 跳过)。
19个文件已添加
5个文件已修改
2630 ■■■■■ 已修改文件
battery-business/src/main/java/com/battery/business/domain/TDeviceIngestRecord.java 79 ●●●●● 对比 | 查看 | 原始文档 | blame | 历史
battery-business/src/main/java/com/battery/business/domain/vo/TDeviceIngestChannel.java 23 ●●●●● 对比 | 查看 | 原始文档 | blame | 历史
battery-business/src/main/java/com/battery/business/mapper/TDeviceIngestRecordMapper.java 42 ●●●●● 对比 | 查看 | 原始文档 | blame | 历史
battery-business/src/main/java/com/battery/business/service/DeviceIngestErrorCodes.java 20 ●●●●● 对比 | 查看 | 原始文档 | blame | 历史
battery-business/src/main/java/com/battery/business/service/IDeviceIngestService.java 22 ●●●●● 对比 | 查看 | 原始文档 | blame | 历史
battery-business/src/main/java/com/battery/business/service/impl/DeviceAdapterServiceImpl.java 16 ●●●●● 对比 | 查看 | 原始文档 | blame | 历史
battery-business/src/main/java/com/battery/business/service/impl/DeviceIngestServiceImpl.java 386 ●●●●● 对比 | 查看 | 原始文档 | blame | 历史
battery-business/src/main/java/com/battery/business/service/impl/PushIngestAdapter.java 284 ●●●●● 对比 | 查看 | 原始文档 | blame | 历史
battery-business/src/main/java/com/battery/business/service/impl/PushIngestAdapterFactory.java 34 ●●●●● 对比 | 查看 | 原始文档 | blame | 历史
battery-business/src/main/resources/mapper/battery/TDeviceIngestRecordMapper.xml 113 ●●●●● 对比 | 查看 | 原始文档 | blame | 历史
battery-business/src/test/java/com/battery/business/service/impl/DeviceIngestServiceTest.java 201 ●●●●● 对比 | 查看 | 原始文档 | blame | 历史
battery-business/src/test/java/com/battery/business/service/impl/FakeIngestLanding.java 130 ●●●●● 对比 | 查看 | 原始文档 | blame | 历史
battery-business/src/test/java/com/battery/business/service/impl/PushIngestAdapterContractTest.java 215 ●●●●● 对比 | 查看 | 原始文档 | blame | 历史
battery-business/src/test/java/com/battery/business/service/impl/PushIngestReceptionContractTest.java 180 ●●●●● 对比 | 查看 | 原始文档 | blame | 历史
battery-device-api/src/main/java/com/battery/device/api/credentials/LocalCredentials.java 71 ●●●●● 对比 | 查看 | 原始文档 | blame | 历史
battery-device-neware/src/main/java/com/battery/device/neware/NewareMysqlAdapterFactory.java 45 ●●●●● 对比 | 查看 | 原始文档 | blame | 历史
battery-device-neware/src/test/java/com/battery/device/neware/NewareMysqlAdapterContractTest.java 11 ●●●●● 对比 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/battery/business/runtime/DeviceAdapterRuntimeConfig.java 8 ●●●●● 对比 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/battery/business/web/device/DeviceIngestController.java 75 ●●●●● 对比 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/resources/db/migration-final/V24__push_ingest_landing_table.sql 43 ●●●●● 对比 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/test/java/com/battery/business/runtime/DeviceAdapterRuntimeNoopStartupTest.java 5 ●●●●● 对比 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/test/java/com/battery/business/runtime/PushIngestLandingMigrationContractTest.java 270 ●●●●● 对比 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/test/java/com/battery/business/web/device/DeviceIngestControllerTest.java 71 ●●●●● 对比 | 查看 | 原始文档 | blame | 历史
scripts/j22-collector.ps1 286 ●●●●● 对比 | 查看 | 原始文档 | blame | 历史