feat(ops): 优化工单查询语音播报内容

- 播报当前工单作业区域(替代工单标题)
- 播报剩余待办工单数量
- 简化播报文案,更人性化

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
lzh
2026-02-01 01:49:35 +08:00
parent d2f2e06c58
commit fecaa28bc7
2 changed files with 27 additions and 14 deletions

View File

@@ -174,9 +174,9 @@ public class CleanNotificationConstants {
/**
* 按键查询播报(有工单时)
* 参数: {orderTitle} - 当前工单标题
* 参数: {areaName} - 作业区域
*/
public static final String QUERY_HAS_ORDER = "当前工单%s";
public static final String QUERY_HAS_ORDER = "当前工单%s";
/**
* 按键查询播报(无工单时)
@@ -187,7 +187,13 @@ public class CleanNotificationConstants {
* 按键查询播报(待办数量提示)
* 参数: {count} - 待办数量
*/
public static final String QUEUE_COUNT = "还有%d个待办工单";
public static final String QUEUE_COUNT = "还有%d个待办";
/**
* 按键查询播报(区域+待办数量)
* 参数: {areaName} - 作业区域, {count} - 待办数量
*/
public static final String QUERY_AREA_AND_PENDING = "当前工单在%s还有%d个待办";
}
/**
@@ -350,15 +356,22 @@ public class CleanNotificationConstants {
/**
* 构建按键查询播报
*
* @param currentOrderTitle 当前工单标题
* @param pendingCount 待办数量(不含当前工单)
* @param areaName 当前工单作业区域
* @param pendingCount 待办数量(不含当前工单)
* @return 播报内容
*/
public static String buildQuery(String currentOrderTitle, int pendingCount) {
// 优先显示当前正在处理的工单
if (currentOrderTitle != null && !currentOrderTitle.isEmpty()) {
String title = truncateTitle(currentOrderTitle);
return String.format(VoiceTemplate.QUERY_HAS_ORDER, title);
public static String buildQuery(String areaName, int pendingCount) {
// 处理区域名称
String name = (areaName != null && !areaName.isEmpty()) ? areaName : DEFAULT_AREA_NAME;
// 有当前工单
if (name != null && !name.isEmpty()) {
if (pendingCount > 0) {
// 当前工单 + 待办数量
return String.format(VoiceTemplate.QUERY_AREA_AND_PENDING, name, pendingCount);
}
// 只有当前工单,无待办
return String.format(VoiceTemplate.QUERY_HAS_ORDER, name);
}
// 没有当前工单,显示待办数量
if (pendingCount > 0) {

View File

@@ -159,7 +159,7 @@ public class CleanOrderAuditEventHandler implements RocketMQListener<String> {
}
// 1. 获取当前正在处理的工单DISPATCHED, CONFIRMED, ARRIVED 状态)
String currentOrderTitle = null;
String currentAreaName = null;
OpsOrderDO currentOrder = opsOrderMapper.selectOne(new LambdaQueryWrapperX<OpsOrderDO>()
.eq(OpsOrderDO::getAssigneeDeviceId, deviceId)
.in(OpsOrderDO::getStatus, Arrays.asList(
@@ -169,8 +169,8 @@ public class CleanOrderAuditEventHandler implements RocketMQListener<String> {
.orderByAsc(OpsOrderDO::getId)
.last("LIMIT 1"));
if (currentOrder != null && currentOrder.getTitle() != null) {
currentOrderTitle = currentOrder.getTitle();
if (currentOrder != null && currentOrder.getLocation() != null) {
currentAreaName = currentOrder.getLocation();
}
// 2. 查询待办工单数量QUEUED 状态,不含当前处理中工单)
@@ -179,7 +179,7 @@ public class CleanOrderAuditEventHandler implements RocketMQListener<String> {
.eq(OpsOrderDO::getStatus, WorkOrderStatusEnum.QUEUED.getStatus()));
// 3. 构建 TTS 文本(使用统一模板构建器)
String ttsText = CleanNotificationConstants.VoiceBuilder.buildQuery(currentOrderTitle, pendingCount.intValue());
String ttsText = CleanNotificationConstants.VoiceBuilder.buildQuery(currentAreaName, pendingCount.intValue());
// 4. 下发 TTS
Long orderId = currentOrder != null ? currentOrder.getId() : null;