Commit Graph

374 Commits

Author SHA1 Message Date
lzh
5d8c4045d4 refactor(ops): 简化AreaDevice与BadgeDevice服务实现
- AreaDeviceService: 移���设备索引缓存逻辑(由IoT模块管理)
- AreaDeviceServiceImpl: 简化实现,直接查询数据库
- BadgeDeviceStatusService: 更新接口方法签名
- BadgeDeviceStatusServiceImpl: 修复语法错误,简化实现
- BadgeDeviceStatusEventListener: 适配事件处理逻辑
- CleanOrderEventListener: 更新事件处理

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 00:57:38 +08:00
lzh
3839da2966 refactor(iot): 适配规则处理器使用新的配置查询方法
- ButtonEventRuleProcessor: 改为从设备 config 读取按键配置
- TrafficThresholdRuleProcessor: 使用 getConfigWrapperByDeviceId 方法
- BeaconDetectionRuleProcessor: 使用 getConfigByAreaIdAndRelationType 方法
- SignalLossRuleProcessor: 使用 getConfigByAreaIdAndRelationType 方法
- CleanRuleProcessorManager: 更新处理流程
- 添加性能优化 TODO 注释

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 00:57:23 +08:00
lzh
89e68eceb2 refactor(iot): 重构配置模型与实现双层缓存优化
- 将 buttonEvent 配置从区域级移至设备级(iot_device.config)
- 添加 getConfigWrapperByDeviceId 方法支持一对一设备查询
- 实现设备索引缓存 + 区域配置缓存的双层缓存设计
- 添加设备类型常量 DEVICE_RELATION_TYPES
- 完善 JavaDoc 注释说明配置层级划分

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 00:57:03 +08:00
lzh
b73ef4f39f fix(ops): 迁移updateStatus修复到Enhanced实现
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
REMOVED 状态改为同步更新 Redis,避免自动派单查询到已完成任务

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 19:05:26 +08:00
lzh
009fab543f refactor(ops): 删除重复的OrderQueueServiceImpl实现类
保留 OrderQueueServiceEnhanced 作为唯一实现,避免Bean冲突

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 18:53:41 +08:00
lzh
f9742137c5 fix(ops): 修复工单队列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
- Redis Sorted Set 改用 queueId 作为 member,详细信息存储在 Hash
- REMOVED 状态同步更新 Redis,避免自动派单查询到已完成任务
- 新增 getWaitingTasksByUserIdFromDb() 强制从 MySQL 读取最新数据
- 修复队列状态枚举值统一为大写

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 18:28:27 +08:00
lzh
5c31f5eb71 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-31 00:54:13 +08:00
lzh
b95674b9e0 fix(ops): 修复改为分步构建责任链-不构建队列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
2026-01-31 00:08:43 +08:00
lzh
4d34951799 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 14:50:38 +08:00
lzh
28b9a32cb6 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
- 实现空闲设备待办工单检查定时任务

- 修复事件日志 orderId 关联 (使用 targetId)

- 增强语音播报和工单事件的日志完整性
2026-01-30 12:03:24 +08:00
lzh
80278f64f6 fix(ops): 修改新工单语音 2026-01-30 10:52:53 +08:00
lzh
dbf96e521a fix(beacon): 修复RSSI滑动窗口检测逻辑 - 窗口大小改用max(enter/exit.windowSize) - 进入/退出检测分别使用各自的windowSize子窗口 - 到岗确认时清理RSSI窗口避免历史脏数据
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 10:24:20 +08:00
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