Commit Graph

321 Commits

Author SHA1 Message Date
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
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
fffada3761 feat(iot): 调整信标和信号丢失处理器以支持配置拆分
配置已按设备类型拆分(BADGE/BEACON/TRAFFIC_COUNTER 各自存储),
工牌设备需要从区域的 BEACON 设备获取信标配置。

- BeaconDetectionRuleProcessor: 从区域 BEACON 设备获取 beaconPresence 配置
- SignalLossRuleProcessor: 从区域 BEACON 设备获取信标配置用于超时检测

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 13:47:04 +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
e4d07a5306 fix(ci): 修复多 commit 场景下服务构建检测遗漏
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
原 getChangedFiles() 只对比 HEAD~1 和 HEAD,导致一次 push 多个
commits 时只会检测最新一个 commit 的变更。

修改为使用 GIT_PREVIOUS_SUCCESSFUL_COMMIT(Jenkins 内置变量,上次
成功构建的 commit)作为基准,确保所有变更文件都能被正确检测。

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 10:30:02 +08:00
lzh
4cd520ab78 fix(iot-gateway): 兼容设备端消息体长度计算不准确的问题
修改 JT808 解码器,采用更宽松的消息体长度处理策略:
- 使用实际可用的长度(expected 与 actual 取最小值)
- 将长度差异日志降为 DEBUG 级别
- 继续解析消息而不是直接丢弃

原因:部分设备端计算消息体长度时存在偏差,导致位置上报等消息被跳过。

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 10:10:09 +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
b1ecc7786b feat(iot-gateway): JT808 新增 instruction_config 服务并修正 TTS 标志
1. 新增 instruction_config 服务
   - 用于下发服务指令配置(如 #2014*SET*TTS0:...#)
   - 使用 0x01 标志位(静默执行),设备解析后不发声
   - 通过文本信息下发 (0x8300) 发送

2. 修正 TTS 服务默认标志
   - 默认 tts_flag 从 4 改为 0x08(普通通知)
   - 日志输出改为十六进制格式 (0x08, 0x09)

JT808 播报标志规范:
- 0x01: 静默执行(配置指令)
- 0x08: TTS 普通通知
- 0x09: TTS 紧急通知

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 09:58:01 +08:00
lzh
a4cfbbcba1 fix(iot-gateway): 降级扩展字段长度越界日志级别
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
将 JT808 解码器中扩展字段长度越界的日志级别从 WARN 降为 DEBUG。
这是设备端数据格式问题,不影响正常消息解析,跳过该扩展字段即可。

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 23:30:48 +08:00
lzh
fa619710ef refactor(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
1. IntegrationEventPublisher 只保留设备状态变更事件发布
   - 注释掉 publishPropertyChanged 和 publishEventOccurred 接口
   - RocketMQIntegrationEventPublisher 对应实现改为注释

2. IotDevicePropertyServiceImpl 属性消息发布暂停
   - 注释掉 saveDeviceProperty 中的 publishPropertyMessage 调用
   - 注释掉 publishToIntegrationEventBus 中的实际发布逻辑

3. IotDeviceMessageServiceImpl 新增状态值解析兼容
   - 新增 parseStateValue 方法支持整数和字符串格式状态值
   - 支持 "online"/"offline" 字符串解析

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 22:56:13 +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
4e387e410c refactor(iot-gateway): JT808编解码器代码重构
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
- 提取 enrichParamsWithMetadata 方法统一处理元数据
- 提取 extractPhoneFromMap 和 extractFlowIdFromMap 方法
- 优化 getParamsAsMap 方法,同时支持 params 和 data 字段
- 优化代码注释格式

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 22:15:12 +08:00
lzh
110cfc8cf8 fix(iot-server): 消费者优先判断skipReply字段
- handleUpstreamDeviceMessage 优先检查 skipReply 字段
- 协议层已处理回复的消息跳过业务层回复逻辑

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 22:12:56 +08:00
lzh
0c2cd85915 fix(iot-gateway): JT808协议使用skipReply标记协议层已应答
- Jt808ProtocolHandler 使用 setSkipReply(true) 替代 setCode(0)
- 避免业务层重复发送回复消息

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 22:12:03 +08:00
lzh
529171aca6 feat(iot-core): 添加skipReply字段支持协议层回复标记
- IotDeviceMessage 新增 skipReply 字段,用于标记协议层已处理回复
- IotDeviceMessageUtils 新增 isSkipReply() 方法
- isUpstreamMessage() 支持 JT808 协议方法判断
  - jt808.terminal.* 为上行消息
  - jt808.platform.* 为下行消息

解决 JT808 等协议在协议层已发送应答时,业务层无需再回复��场景

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 22:10:29 +08:00
lzh
c75696c644 feat(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
- 新增 ops_business_event_log 表结构

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 18:44:30 +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
lzh
c88dc3fc10 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
- 包名从 handler 改为 listener
- 使用 TransactionalEventListener 替代 EventListener
- 线程池名修正为 ops-task-executor
- 状态从 ASSIGNED 改为 PENDING
- 清理测试文件中的重复代码

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