Commit Graph

221 Commits

Author SHA1 Message Date
lzh
d8fd0aa389 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. 修复 QueueSyncHandler 在直接派单场景下提前返回的问题
2. 修复 EventPublishHandler 日志级别便于排查
3. 统一 LogType.eventType 为大写下划线格式

Co-Authored-By: Claude (MiniMax-M2.1) <noreply@anthropic.com>
2026-01-29 19:01:27 +08:00
lzh
f44f422ba8 fix(ops): 修复设备上线时未更新区域索引缓存的问题
问题:设备上线时 updateBadgeOnlineStatus() 只更新了 currentAreaId 字段,
未调用 addToAreaIndex() 更新 ops:area:badges:{areaId} 缓存,
导致设备上线后区域设备查询返回空。

修复:当 areaId 不为空时,同时调用 addToAreaIndex() 更新区域设备索引缓存。

Co-Authored-By: Claude (MiniMax-M2.1) <noreply@anthropic.com>
2026-01-29 18:38:10 +08:00
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
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
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
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
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
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
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
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
lzh
a36ed90c3f feat(ops): 扩展调度上下文支持设备ID字段
新增 assigneeDeviceId 字段,用于同时记录人和设备的场景。

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 13:47:13 +08:00
lzh
06ca3070cd feat(iot): 支持按区域和设备类型查询配置
新增 getConfigByAreaIdAndRelationType 方法,用于跨设备获取配置场景。
例如:工牌设备需要获取该区域的信标配置。

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 13:46:49 +08:00
lzh
5bb3ff6979 test: Add comprehensive tests for dispatch strategies and IoT signal processing, fix SignalLossRuleProcessor bug 2026-01-23 11:44:49 +08:00
lzh
9750088ca6 test: Add comprehensive end-to-end tests for cleaning work order module 2026-01-22 23:55:05 +08:00
lzh
177350830a 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
1. VoiceBroadcastService 重构
   - 移除未使用的 volume 参数(JT808 协议不支持)
   - 添加 TTS 播报标志常量定义
   - 新增 broadcastNormal() 和 broadcastUrgent() 方法
   - 支持自定义播报标志

2. 更新调用方
   - CleanOrderConfirmEventHandler: 使用简化 API
   - CleanOrderAuditEventHandler: 使用简化 API

TTS 参数标准:
- identifier: "tts"
- tts_text: 播报文本内容
- tts_flag: 0x01=静默, 0x08=普通, 0x09=紧急

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 09:58:19 +08:00
lzh
842b40596d fix: 修复RocketMQ topic名称非法字符问题
RocketMQ topic 只允许 ^[%|a-zA-Z0-9_-]+$ 字符,不支持 `.`

IoT 模块 Topic 变更:
- integration.device.status → integration-device-status
- integration.device.property → integration-device-property
- integration.device.event → integration-device-event

Ops 模块 Topic 变更:
- ops.order.create → ops-order-create
- ops.order.arrive → ops-order-arrive
- ops.order.complete → ops-order-complete
- ops.order.audit → ops-order-audit
- ops.order.confirm → ops-order-confirm

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 22:35:22 +08:00
lzh
c4ef31bb98 refactor(ops): 保洁工单相关服务改用新业务日志框架
- CleanOrderAuditEventHandler 使用 @BusinessLog 注解
- CleanOrderConfirmEventHandler 使用 @BusinessLog 注解
- VoiceBroadcastService 使用新的日志记录方式

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 18:44:21 +08:00
lzh
457fc556e2 refactor(ops): 移除保洁工单清理日志相关代码
- 删除 OpsOrderCleanLogDO 实体类
- 删除 OpsOrderCleanLogMapper Mapper接口
- 统一使用新的业务日志框架

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 18:44:07 +08:00
lzh
5063fc8dd1 refactor(ops): 移除旧的publisher模式
- 删除 BusinessLogPublisher 接口
- 删除 DefaultBusinessLogPublisher 实现
- 改用 recorder 模式替代 publisher 模式

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 18:43:54 +08:00
lzh
a49994cc57 refactor(ops): 重构业务日志注解和切面
- 更新 BusinessLog 注解以支持新的事件日志模型
- 更新 BusinessLogAspect 切面使用 EventLogRecorder

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 18:43:39 +08:00
lzh
a82b59ac46 feat(ops): 新增业务日志枚举类
- 新增 EventDomain:事件领域枚举
- 新增 EventLevel:事件级别枚举

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 18:43:32 +08:00