Commit Graph

244 Commits

Author SHA1 Message Date
lzh
569ca2c0da fix(ops): 修复区域设备索引缓存问题并优化查询性能
Some checks failed
Java CI with Maven / build (11) (push) Has been cancelled
Java CI with Maven / build (17) (push) Has been cancelled
Java CI with Maven / build (8) (push) Has been cancelled
1. 修复 listAvailableBadges() 读穿透 bug
   - 改用 areaDeviceService.getDeviceIdsByArea() 获取设备列表
   - 缓存未命中时自动从数据库重建

2. 优化 N+1 查询问题
   - listBadgesByArea() 和 listAvailableBadges() 使用 batchGetBadgeStatus() 批量查询

3. 简化 BadgeDeviceStatusServiceImpl
   - 移除重复的 AREA_BADGES_KEY_PREFIX 常量
   - 区域索引操作委托给 AreaDeviceService 处理

4. 增强缓存可靠性
   - getDeviceIdsByArea() 支持读穿透缓存
   - 缓存 TTL 从 30 分钟延长到 24 小时

Co-Authored-By: Claude (MiniMax-M2.1) <noreply@anthropic.com>
2026-01-29 18:32:34 +08:00
lzh
6234709e19 fix: ops镜像修复
Some checks failed
Java CI with Maven / build (11) (push) Has been cancelled
Java CI with Maven / build (17) (push) Has been cancelled
Java CI with Maven / build (8) (push) Has been cancelled
2026-01-29 17:48:19 +08:00
lzh
68e432ead7 fix(ops): BadgeDeviceStatusInitializer修复无租户上下文的启动阶段可以全量同步
Some checks failed
Java CI with Maven / build (11) (push) Has been cancelled
Java CI with Maven / build (17) (push) Has been cancelled
Java CI with Maven / build (8) (push) Has been cancelled
2026-01-29 16:53:27 +08:00
lzh
44c7d7b9f5 refactor(ops): simplify badge status management by removing redundant heartbeat logic
Some checks failed
Java CI with Maven / build (11) (push) Has been cancelled
Java CI with Maven / build (17) (push) Has been cancelled
Java CI with Maven / build (8) (push) Has been cancelled
2026-01-29 13:04:19 +08:00
lzh
da19b87377 fix(ops): strictly control heartbeat logic to prevent ghost online status 2026-01-29 11:55:51 +08:00
lzh
1e5842756e config(ops): enable feign client for IotDeviceStatusQueryApi 2026-01-29 11:50:49 +08:00
lzh
5142b38d12 refactor(ops): optimize badge device status management and add sync job
Some checks failed
Java CI with Maven / build (11) (push) Has been cancelled
Java CI with Maven / build (17) (push) Has been cancelled
Java CI with Maven / build (8) (push) Has been cancelled
2026-01-29 11:35:11 +08:00
lzh
afa5837160 fix(ops): 修复区域设备索引初始化查询条件
Some checks failed
Java CI with Maven / build (11) (push) Has been cancelled
Java CI with Maven / build (17) (push) Has been cancelled
Java CI with Maven / build (8) (push) Has been cancelled
问题:selectListByAreaIdAndRelationType(null, "BADGE") 生成 WHERE area_id = NULL
导致查询结果为空,索引无法初始化

修复:areaId 为 null 时不添加该查询条件,查询所有 BADGE 类型设备

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 00:04:53 +08:00
lzh
ff858fc3b8 fix(ops): 修复区域设备 API 路径不匹配问题
Some checks failed
Java CI with Maven / build (11) (push) Has been cancelled
Java CI with Maven / build (17) (push) Has been cancelled
Java CI with Maven / build (8) (push) Has been cancelled
问题:Feign 客户端调用 /rpc-api/ops/area-device 但 Controller 映射为 /ops-api/area-device

修复:
- Controller @RequestMapping 改为使用 ApiConstants.PREFIX
- 路径统一为:/rpc-api/ops/area-device

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 23:32:47 +08:00
lzh
7f53debc43 fix(iot): 添加 AreaDeviceApi 到 Feign 客户端配置
Some checks failed
Java CI with Maven / build (11) (push) Has been cancelled
Java CI with Maven / build (17) (push) Has been cancelled
Java CI with Maven / build (8) (push) Has been cancelled
修复问题:
- 启动时 Bean 创建失败:iotCleanRuleMessageHandler 注入依赖失败
- 原因:@EnableFeignClients 未包含 AreaDeviceApi

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 23:14:58 +08:00
lzh
d87d4dd914 refactor(ops,iot): 重构区域设备关联模块并添加Redis缓存
Some checks failed
Java CI with Maven / build (11) (push) Has been cancelled
Java CI with Maven / build (17) (push) Has been cancelled
Java CI with Maven / build (8) (push) Has been cancelled
主要变更:
1. 将 ops_area_device_relation 表所有权移至 Ops 模块
   - 新增 OpsAreaDeviceRelationDO、Mapper、Service、Controller
   - 新增 AreaDeviceApi Feign 接口供其他模块调用
   - ���除 IoT 模块中的旧 DO 和 Mapper

2. 实现 Redis JSON 缓存(IoT 可读)
   - 统一缓存 Key: ops:area:device:{deviceId}
   - 统一缓存 Key: ops:area:{areaId}:type:{relationType}
   - TTL: 30分钟,空值缓存: 1分钟

3. IoT 模块通过 Feign 调用 Ops
   - 优先读 Redis 缓存,未命中时调用 Ops API
   - 缓存由 Ops 模块统一管理

4. 删除 IoT 模块废弃文件
   - OpsAreaDeviceRelationDO.java
   - OpsAreaDeviceRelationMapper.java

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 22:35:41 +08:00
lzh
10eeb774a6 fix(ops): 修复其他id生成问题
Some checks failed
Java CI with Maven / build (11) (push) Has been cancelled
Java CI with Maven / build (17) (push) Has been cancelled
Java CI with Maven / build (8) (push) Has been cancelled
2026-01-28 18:12:23 +08:00
lzh
280562bc27 fix(ops): 修复工单业务日志id生成问题-去除这个引入
Some checks failed
Java CI with Maven / build (11) (push) Has been cancelled
Java CI with Maven / build (17) (push) Has been cancelled
Java CI with Maven / build (8) (push) Has been cancelled
2026-01-28 18:01:53 +08:00
lzh
d7c2a0800b fix(ops): 修复工单业务日志id生成问题 2026-01-28 18:01:03 +08:00
lzh
9ac1678031 fix(ops): 修复工单id生成问题
Some checks failed
Java CI with Maven / build (11) (push) Has been cancelled
Java CI with Maven / build (17) (push) Has been cancelled
Java CI with Maven / build (8) (push) Has been cancelled
2026-01-28 17:09:43 +08:00
lzh
862cbc3931 fix(test): 修正测试SQL中orderPriority为数字类型
Some checks failed
Java CI with Maven / build (11) (push) Has been cancelled
Java CI with Maven / build (17) (push) Has been cancelled
Java CI with Maven / build (8) (push) Has been cancelled
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 14:53:12 +08:00
lzh
5cc5cd5238 fix(iot): 统一CleanOrderCreateEvent.priority类型为Integer
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 14:50:35 +08:00
lzh
3c92bfc02c fix: 统一工单优先级类型为Integer
Some checks failed
Java CI with Maven / build (11) (push) Has been cancelled
Java CI with Maven / build (17) (push) Has been cancelled
Java CI with Maven / build (8) (push) Has been cancelled
修改:
- TrafficThresholdConfig.orderPriority: String -> Integer
- CleanOrderCreateEventDTO.priority: String -> Integer
- CleanOrderCreateEventHandler: 移除Integer.parseInt调用

与数据库tinyint类型保持一致

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 14:12:24 +08:00
lzh
eae021c464 fix(iot): 修复保洁规则处理器租户上下文丢失问题
Some checks failed
Java CI with Maven / build (11) (push) Has been cancelled
Java CI with Maven / build (17) (push) Has been cancelled
Java CI with Maven / build (8) (push) Has been cancelled
使用 TenantUtils.execute 包装消息处理逻辑,确保 Redis Stream
异步线程中正确传递租户上下文,避免数据库查询时报错
"TenantContextHolder 不存在租户编号"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 17:01:57 +08:00
lzh
b5972b03a8 fix(iot): 修改客流计数器上传数据解析时间作为reportTime
Some checks failed
Java CI with Maven / build (11) (push) Has been cancelled
Java CI with Maven / build (17) (push) Has been cancelled
Java CI with Maven / build (8) (push) Has been cancelled
2026-01-27 15:22:48 +08:00
lzh
767449dec4 feat(ops): 新增 trigger_data 字段存储触发详情
- OpsOrderDO: 新增 triggerData 字段(JSON 字符串)
- 存储触发时的详细信息:
  - 客流阈值:actualCount, baseValue, threshold, exceededCount
  - 蓝牙信标:rssi, beaconMac
  - 信号丢失:durationMs, timeoutSeconds
- CleanOrderServiceImpl: 序列化 triggerData 到 JSON 存储

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-27 12:04:19 +08:00
lzh
35c120d883 fix(iot): 修改客流计数器应答升级链接
Some checks failed
Java CI with Maven / build (11) (push) Has been cancelled
Java CI with Maven / build (17) (push) Has been cancelled
Java CI with Maven / build (8) (push) Has been cancelled
2026-01-26 16:35:50 +08:00
lzh
d9ba73a4bc test: Add CleanOrderScenarioIT and finalize test coverage
Some checks failed
Java CI with Maven / build (11) (push) Has been cancelled
Java CI with Maven / build (17) (push) Has been cancelled
Java CI with Maven / build (8) (push) Has been cancelled
2026-01-25 22:33:16 +08:00
lzh
a3909a0482 test: Adapt tests to master branch refactoring (handlers and dispatch logic) 2026-01-25 18:41:00 +08:00
lzh
130048d958 Merge remote-tracking branch 'origin/master' into test/cleaning-coverage 2026-01-25 18:29:47 +08:00
lzh
a8d3fc84d2 refactor(ops): 服务层调整,统一使用设备ID
Some checks failed
Java CI with Maven / build (11) (push) Has been cancelled
Java CI with Maven / build (17) (push) Has been cancelled
Java CI with Maven / build (8) (push) Has been cancelled
- CleanOrderService: 将所有 cleanerId 参数改为 deviceId
- CleanOrderAutoCreateReqDTO: 新增 triggerData 字段
- EventPublishHandler: 添加 assigneeId/urgentOrderId 到 payload
- OrderQueueService: 修正注释说明 userId 实际为 deviceId
- EventDomain: 新增 AUDIT 域
- 更新测试用例适配接口变更

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 18:23:37 +08:00
lzh
373f379b01 refactor(iot): 移除Redis DAO,使用统一服务接口
- 删除 DeviceCurrentOrderRedisDAO
- 各 RuleProcessor 直接调用 BadgeDeviceStatusService
- 简化调用链,移除中间层

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 18:23:15 +08:00
lzh
116c1ec773 refactor(ops): 设备状态管理重构
- 删除 BadgeDeviceStatusEventHandler(职责不清)
- 新建 BadgeDeviceStatusEventListener 专门处理设备状态变更
- 使用 BEFORE_COMMIT 阶段同步更新设备工单关联
- 修复 CANCELLED 处理:仅当取消当前工单时才更新设备状态
- 修复 P0 打断场景:检测 urgentOrderId,不修改设备状态

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 18:22:52 +08:00
lzh
f4d2b0a5de refactor(ops): 简化工单Handler,移除冗余业务逻辑
- CleanOrderCreateEventHandler: 移除直接RPC调用,合并重复日志
- CleanOrderConfirmEventHandler: 移除TTS调用和日志记录
- CleanOrderArriveEventHandler: 移除设备缓存更新和日志记录
- CleanOrderCompleteEventHandler: 移除业务日志和自动调度调用

Handler只负责消息幂等性和状态转换,业务逻辑移至EventListener

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 18:22:32 +08:00
lzh
95dffa0ba5 refactor(ops): 工单事件监听器重构
- handleDispatched: 记录下发时间��处理暂停结束
- handlePaused: 记录暂停开始时间
- handleArrived: 记录到岗时间,计算响应时长
- handleConfirmed/handleCompleted: 使用 VoiceBuilder 播报
- 新增 recordDispatchedTime/handlePauseEnd/updateResponseSeconds 方法

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 18:22:07 +08:00
lzh
3e23f9c65c feat(ops): 扩展表增加时长统计字段
- 新增 dispatchedTime: 最近下发时间
- 新增 firstDispatchedTime: 首次下发时间(不受暂停影响)
- 新增 insertOrUpdateSelective 方法,保留 firstDispatchedTime

用于计算响应时长:arrivedTime - firstDispatchedTime - totalPauseSeconds

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 18:21:21 +08:00
lzh
8782a530fe feat(ops): 统一语音播报模板管理
- 新建 CleanNotificationConstants 类,集中管理所有播报模板
- VoiceTemplate: 定义各种场景的播报模板常量
- VoiceBuilder: 提供构建器方法,支持参数化和标题截断
- NotifyParamsBuilder: 站内信参数构建辅助方法
- 更新 CleanOrderAuditEventHandler 查询播报为显示当前工单而非位置

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 18:21:04 +08:00
lzh
577fd25f8e refactor(iot): 清理保洁配置服务中的冗余缓存设计
删除未使用的方法和缓存 key:
- getConfigByDeviceId() 方法:未被任何地方调用
- CONFIG_DEVICE_KEY_PATTERN:仅用于已删除的方法
- CONFIG_AREA_KEY_PATTERN:定义了但从未使用
- formatDeviceKey() 和 formatAreaKey():对应方法已删除

简化后的设计只保留两个缓存 key:
- CONFIG_WRAPPER_KEY_PATTERN:按 deviceId 缓存完整配置
- CONFIG_AREA_TYPE_KEY_PATTERN:按 areaId + relationType 缓存

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 09:49:29 +08:00
lzh
54b5e7ec77 config(iot): 修改网关 RPC 地址端口
48080 → 48091

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 09:38:44 +08:00
lzh
0ee7611a7d feat(iot): 优化保洁工单配置缓存服务
- 新增空值缓存机制,防止缓存穿透
- 新增区域+类型配置查询缓存
- 统一缓存 TTL 为 5 分钟,空值缓存 60 秒
- 新增缓存失效方法 evictAreaCache

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 09:38:36 +08:00
lzh
0a5fe13e68 refactor(iot): 移除属性保存中的同步规则处理
规则处理已迁移到独立消息订阅者 IotCleanRuleMessageHandler
通过订阅同一消息总线的 Topic 异步处理,不再阻塞属性保存主流程

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 09:38:28 +08:00
lzh
2a2cfb9030 fix(iot): 修复 TrafficThresholdRuleProcessor 编译错误
- 将 StringRedisTemplate 声明移至类顶部字段区域
- 修复变量使用顺序导致的编译错误

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 09:38:20 +08:00
lzh
22d7a31194 feat(iot): 新增保洁规则消息订阅者,实现规则处理异步解耦
新增 IotCleanRuleMessageHandler 订阅设备消息总线,与属性保存主流程解耦
新增 CleanRuleProcessorManager 统一管理保洁规则处理器

优化点:
- 独立消费组,不阻塞属性保存主流程
- 与场景规则引擎架构一致,便于维护
- 支持 PROPERTY_POST 和 EVENT_POST 两种消息类型

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 09:38:12 +08:00
lzh
ea1d369e61 test: Add dispatchToCleaner test case for complete coverage 2026-01-25 00:00:00 +08:00
lzh
0813856b18 test: Complete coverage with duration calculation and priority upgrade tests 2026-01-24 20:40:27 +08:00
lzh
dc67ae90bd test: Resolve conflicts with master and complete comprehensive test suite 2026-01-24 20:35:09 +08:00
lzh
7cf8e5ed2f fix(ops): fix DispatchEngine instantiation error in test config
Some checks failed
Java CI with Maven / build (11) (push) Has been cancelled
Java CI with Maven / build (17) (push) Has been cancelled
Java CI with Maven / build (8) (push) Has been cancelled
2026-01-24 19:20:43 +08:00
lzh
850a9b1f9f fix(ops): 修复CleanOrderCreateEventHandler语法错误
移除多余的闭合大括号。

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 17:55:37 +08:00
lzh
fc28afd1c9 feat(ops): 补充工单状态变更业务日志
- pauseOrder: 记录工单暂停日志
- resumeOrder: 记录工单恢复日志
- interruptOrder: 记录P0插队打断日志
- cancelOrder: 记录工单取消日志
- completeOrder: 记录手动完成日志

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 17:48:27 +08:00
lzh
e0ad02afbc feat(ops): 补充工单生命周期业务日志记录
- CleanOrderCreateEventHandler: 记录工单创建日志
- CleanOrderArriveEventHandler: 记录到岗日志
- CleanOrderCompleteEventHandler: 记录完成日志

支持客流/信标触发等不同场景的日志分类记录。

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 17:48:18 +08:00
lzh
bd8dd73e50 test: Add audit log test case to CleanOrderEndToEndTest 2026-01-23 14:58:30 +08:00
lzh
382e4d6ae2 test: Fix master branch test configs and add comprehensive tests for Badge Device Dispatch and Signal Loss logic 2026-01-23 14:29:46 +08:00
lzh
bb1ee0be1d Merge branch 'master' of http://124.221.55.225:3000/XW-AIOT/aiot-platform-cloud into test/cleaning-coverage 2026-01-23 13:57:49 +08:00
lzh
ebbefe7980 Merge branch 'test/cleaning-coverage' 2026-01-23 13:49:00 +08:00
lzh
0de8441672 refactor(ops): 禁用保洁员调度策略,改用工牌设备策略
Some checks failed
Java CI with Maven / build (11) (push) Has been cancelled
Java CI with Maven / build (17) (push) Has been cancelled
Java CI with Maven / build (8) (push) Has been cancelled
原有 CleanerAreaAssignStrategy 和 CleanerPriorityScheduleStrategy 已禁用,
改为使用 BadgeDeviceAreaAssignStrategy 和 BadgeDeviceScheduleStrategy。

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 13:47:22 +08:00