Commit Graph

312 Commits

Author SHA1 Message Date
lzh
f818641b1a 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-30 09:46:36 +08:00
lzh
abd5933877 fix(ops): 入队和派单时设置assigneeDeviceId,修复查询工单功能 2026-01-30 09:45:36 +08:00
lzh
fe92b4cafb fix(ops): 工单完成添加语音播报和assigneeId传递 2026-01-30 09:45:16 +08:00
lzh
895fcc2712 fix(iot): 定时任务设置租户上下文,确保RocketMQ消息正确携带租户信息
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-30 09:09:08 +08:00
lzh
1bdcfa1cc0 fix(ops): 启动时初始化BEACON类型配置缓存,解决SignalLoss定时任务获取配置失败问题
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-30 01:25:14 +08:00
lzh
27704bf227 Merge remote-tracking branch 'origin/master'
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
# Conflicts:
#	viewsh-module-iot/viewsh-module-iot-server/src/main/java/com/viewsh/module/iot/service/rule/clean/processor/BeaconDetectionRuleProcessor.java
2026-01-30 00:51:19 +08:00
lzh
6ff40b61d7 fix(beacon): 修复信标检测重复触发到岗事件bug - determineState优先检查本地arrivedTime判断状态 - 离岗警告阶段保持IN_AREA状态不清除arrivedTime - arrivedTime仅在工单完成时由SignalLossRuleProcessor清除 2026-01-30 00:50:01 +08:00
lzh
cc9a84e30d fix(beacon): 修复信标检测重复触发到岗事件bug
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
- determineState优先检查本地arrivedTime判断状态
- handleLeaveConfirmed离岗时清除arrivedTime
- 避免依赖跨模块异步状态同步导致的事件重复
2026-01-30 00:27:53 +08:00
lzh
260d4b8220 fix(ops): 修复区域路径拼接重复问题
在构建区域完整路径时,跳过当前区域ID,避免parentPath中
包含当前区域时导致名称重复拼接

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude (MiniMax-M2.1) <noreply@anthropic.com>
2026-01-30 00:17:38 +08:00
lzh
fee974912e feat(ops): 添加工单到岗语音播报
1. VoiceBuilder 新增 buildOrderArrived() 方法
2. 到岗时播报"已到达作业区域,请开始清洁作业"

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude (MiniMax-M2.1) <noreply@anthropic.com>
2026-01-29 23:36:56 +08:00
lzh
d97125fdf6 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
1. 语音播报模板改为"工单来啦,请前往XXX进行清洁"
2. 工单创建时自动根据areaId从ops_bus_area构建完整路径
3. 使用parentPath批量查询上级区域,避免N+1问题

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude (MiniMax-M2.1) <noreply@anthropic.com>
2026-01-29 23:13:50 +08:00
lzh
3ec7590e12 fix(ops): 修复派单时未更新工单 assigneeId 的问题
工单派发(PENDING -> DISPATCHED)时,更新工单表的 assigneeId 字段,
确保 BadgeDeviceStatusEventListener 能正确获取执行人设备ID并更新 Redis 缓存。

Co-Authored-By: Claude (MiniMax-M2.1) <noreply@anthropic.com>
2026-01-29 23:04:43 +08:00
lzh
9d2bbabf1c 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
1. OrderEventPublisherImpl 状态变更事件发布日志改为 info 级别
2. BadgeDeviceStatusEventListener 状态变更日志改为 info 级别
3. 优化日志格式,输出 orderType 便于排查事件接收问题

Co-Authored-By: Claude (MiniMax-M2.1) <noreply@anthropic.com>
2026-01-29 22:17:03 +08:00
lzh
20ea25cf55 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. 移除 OrderStateMachine 中重复的事件发布逻辑
   - OrderStateMachine 不再发布 OrderStateChangedEvent
   - 事件发布统一由 EventPublishHandler 处理

2. 删除 enqueueAndDispatch 遗留方法
   - 该方法已无用,被 DispatchEngine 策略模式替代
   - 删除接口声明、实现类和测试用例

3. 清理无调用的备用接口方法
   - enqueueOrderOnly、dispatchToCleaner、confirmOrder、
     startWorkingOnBeacon、autoCompleteOnSignalLost、
     playVoiceForNewOrder、playVoiceForQueuedOrder、
     playVoiceForNextTask、upgradePriorityToP0、
     calculateActualDuration
   - 保留接口但标记 @Deprecated

问题修复:
- 工单派发时 TTS 语音播报不再重复触发
- 调度逻辑统一走 DispatchEngine 策略模式

Co-Authored-By: Claude (MiniMax-M2.1) <noreply@anthropic.com>
2026-01-29 21:38:50 +08:00
lzh
13c9b6564f fix(iot): 修复事件上报处理逻辑,支持 button_event 事件
1. CleanRuleProcessorManager 新增 processEventData() 方法
   - 区分处理属性上报和事件上报
   - 事件上报从 identifier 字段提取事件类型

2. ButtonEventRuleProcessor.parseButtonId() 支持事件上报格式
   - 属性上报:value 直接是按键ID
   - 事件上报:value 是 Map,包含 keyId 和 keyState 字段

Co-Authored-By: Claude (MiniMax-M2.1) <noreply@anthropic.com>
2026-01-29 21:28:43 +08:00
lzh
ab1cc2bc62 fix(ops): 事件监听从TransactionalEventListener改为EventListener
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 19:32:43 +08:00
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
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