Commit Graph

29 Commits

Author SHA1 Message Date
lzh
a9fd9313cc feat(ops): 重构派单队列评分逻辑,支持楼层差与等待老化综合排序
- 新增 QueueScoreCalculator/QueueScoreContext/QueueScoreResult,统一按优先级分 + 楼层差分 - 等待老化分计算队列总分,并将 PRIORITY_WEIGHT 调整为 1500
- OrderQueueService 新增 rebuildWaitingTasksByUserId 接口,OrderQueueServiceEnhanced 支持按执行人重算 WAITING 队列、以当前执行工单楼层为基准动态重排,并在事务提交后同步刷新 Redis
- RedisOrderQueueServiceImpl 支持持久化 baseFloorNo、targetFloorNo、floorDiff、waitMinutes、scoreUpdateTime 等评分明细,清队列时同时清理关联 Hash,避免脏数据残留
- DispatchEngineImpl、CleanerPriorityScheduleStrategy、BadgeDeviceScheduleStrategy 调整为非抢占式派单:P0 忙碌时仅入队等待,空闲时直接派发,自动派单前按总分重排并派发下一单
- CleanOrderServiceImpl 取消 P0 自动打断链路,升级到 P0 后仅重算等待队列并发送通知;补充 QueueScoreCalculatorTest、OrderQueueServiceEnhancedTest、CleanerPriorityScheduleStrategyTest、CleanOrderEndToEndTest 覆盖新行为
2026-03-07 21:15:10 +08:00
lzh
4f737a5dd1 refactor(ops): 重构 TTS 语音播报队列,解耦 ttsFlag 与队列优先级
移除 Thread.sleep(5000) 阻塞,改由 TTS 队列按设备维度控制播报顺序和间隔:
- 解耦 ttsFlag(硬件行为 0x09)与 priority(队列位置),全部使用 0x09 发送
- TtsQueueMessage 新增 inOrder/urgent 工厂方法,VoiceBroadcastService 精简为
  broadcastInOrder(FIFO rightPush)和 broadcastUrgent(leftPush 插队)两个入口
- 同设备播报间隔 3s → 6s,消息过期时间 30s → 60s
- 修复原 leftPush+leftPop LIFO 导致连续入队顺序反转的问题

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 00:19:24 +08:00
lzh
955c825e2c feat(ops,iot): 保洁前端 API 层和区域管理新增
新增保洁业务前端 API 接口层(工牌、工单、仪表盘)和运营区域管理完整功能,包含 Service/Controller/Test 三层结构。

主要功能:

1. IoT 设备查询 API(RPC 接口)
   - IotDeviceQueryApi: 提供设备简化信息查询
   - IotDeviceSimpleRespDTO: 设备简化 DTO

2. 保洁工牌管理
   - CleanBadgeService/Impl: 工牌通知、优先级调整、手动完成
   - BadgeNotifyReqDTO/UpgradePriorityReqDTO/ManualCompleteOrderReqDTO

3. 保洁工单管理
   - CleanWorkOrderService/Impl: 工单时间线查询

4. 保洁仪表盘
   - CleanDashboardService/Impl: 快速统计(待处理/进行中/已完成/在线工牌数)
   - QuickStatsRespDTO: 快速统计 DTO

5. 运营区域管理(Ops Biz)
   - OpsBusAreaService/Impl: 区域 CRUD(支持树形结构、分页查询)
   - AreaDeviceRelationService/Impl: 区域设备关联管理(绑定/解绑/批量更新)
   - OpsBusAreaMapper/AreaDeviceRelationMapper: 扩展 MyBatis 批量方法
   - 7 个 VO 类:CreateReqVO/UpdateReqVO/PageReqVO/RespVO/BindReqVO/RelationRespVO/DeviceUpdateReqVO

6. 前端 Controller(Ops Server)
   - OpsBusAreaController: 区域管理 REST API(11 个接口)
   - AreaDeviceRelationController: 设备关联 REST API(8 个接口)
   - CleanBadgeController: 工牌管理 REST API(5 个接口)
   - CleanDashboardController: 仪表盘 REST API(1 个接口)
   - CleanDeviceController: 设备管理 REST API(2 个接口)
   - CleanWorkOrderController: 工单管理 REST API(2 个接口)

7. 测试覆盖
   - OpsBusAreaServiceTest: 区域服务测试(284 行)
   - AreaDeviceRelationServiceTest: 设备关联测试(240 行)
   - OpsBusAreaControllerTest: 区域 Controller 测试(186 行)
   - AreaDeviceRelationControllerTest: 设备关联 Controller 测试(182 行)

8. API 层扩展
   - ErrorCodeConstants: 错误码常量(区域、设备关联)
   - NotifyTypeEnum: 通知类型枚举(语音、文本、震动)
   - 4 个 Badge/Order DTO: BadgeStatusRespDTO/BadgeRealtimeStatusRespDTO/OrderTimelineRespDTO

9. RPC 配置
   - RpcConfiguration: 注入 IotDeviceQueryApi

影响模块:Ops API、Ops Biz、Ops Server、Ops Environment Biz、IoT API、IoT Server

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-02 22:42:45 +08:00
lzh
bccf992848 feat(ops): 工牌设备状态服务支持 nickname 透传
在工牌设备状态管理链路中全面支持 nickname 字段透传,从 IoT 事件接收到派单策略推荐均使用用户可读的昵称。

变更范围:
- IotDeviceStatusChangedEventDTO: 新增 nickname 字段
- BadgeDeviceStatusEventHandler: 接收并透传 nickname
- BadgeDeviceStatusService/Impl: updateBadgeOnlineStatus 增加 nickname 参数
- BadgeDeviceStatusSyncJob: 对账场景保留 Redis 已有 nickname
- BadgeDeviceAreaAssignStrategy: 推荐执行人时优先使用 nickname
- BadgeDeviceDispatchTest: 测试适配 nickname 参数

影响模块:Ops Environment Biz

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-02 22:30:06 +08:00
lzh
46096a6e6b fix(iot,ops): 确保信标相关审计事件包含orderId以支持工单关联查询
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. BeaconDetectionRuleProcessor.publishAuditEvent 添加 orderId 参数
   - BEACON_ARRIVE_CONFIRMED 事件包含当前工单ID
   - BEACON_LEAVE_WARNING_SENT 事件从设备状态获取工单ID
   - TTS_REQUEST 事件不包含工单ID(非工单特定)

2. SignalLossRuleProcessor.publishAuditEvent 添加 orderId 参数
   - BEACON_COMPLETE_REQUESTED 事件包含当前工单ID
   - COMPLETE_SUPPRESSED_INVALID 事件从设备状态获取工单ID

3. CleanOrderAuditEventHandler 使用 EventLogRecord.builder()
   - 显式设置 targetId 和 targetType 字段
   - 确保 targetType="order" 当 orderId 存在时

影响范围:
- ops_business_event_log 表新增记录将正确包含 targetId 和 targetType
- 支持按工单ID查询所有相关审计日志
- 解决信标到岗/离岗/完成事件缺失工单关联的问题

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 10:26:06 +08:00
lzh
fc1bc609e6 test(ops): 修复测试代码中 isNull() 参数匹配问题
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
使用 any(Long.class) 替代 isNull() 以正确匹配 Long 类型参数

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 02:45:05 +08:00
lzh
83c9fb98d7 test(ops): 修复测试代码中的参数验证问题
- 修复 broadcast 方法验证,使用 isNull() 匹配 orderId 参数

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 02:43:02 +08:00
lzh
3c3443aef0 test(ops): 修复测试代码以适配方法签名变更
- 修复 sendPriorityUpgradeNotification 方法调用,添加 orderId 参数
- 修复 broadcast 方法调用,添加 ttsFlag 参数

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 02:42:04 +08:00
lzh
d2f2e06c58 test: 更新测试数据以适配配置模型变更
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
- SignalLossRuleProcessorTest: 更新测试用例
- area_device_relation_full_config.sql: 移除buttonEvent配置
- badge_device_dispatch_test_data.sql: 更新测试数据

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 00:57:52 +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
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
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
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
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
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
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
4f2036d145 fix(ops): 修复编译错误2refactor-order-operations 2026-01-19 13:59:37 +08:00
lzh
568d37a0be feat(ops): refactor-order-operations 2026-01-19 13:32:23 +08:00