From a30a60245d6c724e2d98c27735e3146960ae60f9 Mon Sep 17 00:00:00 2001 From: lzh Date: Thu, 8 Jan 2026 15:01:03 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E3=80=90ops=E3=80=91=E4=BF=9D?= =?UTF-8?q?=E6=B4=81=E4=B8=9A=E5=8A=A1=E9=80=9A=E7=9F=A5=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E5=B8=B8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../constants/CleanNotificationConstants.java | 300 ++++++++++++++++++ 1 file changed, 300 insertions(+) create mode 100644 viewsh-module-ops/viewsh-module-environment-biz/src/main/java/com/viewsh/module/ops/environment/constants/CleanNotificationConstants.java diff --git a/viewsh-module-ops/viewsh-module-environment-biz/src/main/java/com/viewsh/module/ops/environment/constants/CleanNotificationConstants.java b/viewsh-module-ops/viewsh-module-environment-biz/src/main/java/com/viewsh/module/ops/environment/constants/CleanNotificationConstants.java new file mode 100644 index 0000000..03a025f --- /dev/null +++ b/viewsh-module-ops/viewsh-module-environment-biz/src/main/java/com/viewsh/module/ops/environment/constants/CleanNotificationConstants.java @@ -0,0 +1,300 @@ +package com.viewsh.module.ops.environment.constants; + +/** + * 保洁业务通知消息常量 + *

+ * 统一管理所有通知相关的消息内容: + * - 语音播报内容 + * - 站内信模板代码 + * - 站内信模板参数 + *

+ * 设计说明: + * - 集中管理便于国际化 + * - 避免硬编码散落在各处 + * - 修改消息只需改此处 + * + * @author lzh + */ +public class CleanNotificationConstants { + + /** + * 站内信模板代码 + *

+ * 需要在 system 模块的 notify_template 表中配置对应模板 + */ + public static class TemplateCode { + + /** + * 新工单通知模板 + * 参数: {orderCode}, {orderTitle}, {areaName} + */ + public static final String NEW_ORDER = "CLEAN_NEW_ORDER"; + + /** + * 待办增加通知模板 + * 参数: {queueCount}, {newCount} + */ + public static final String QUEUED_ORDER = "CLEAN_QUEUED_ORDER"; + + /** + * 下一任务通知模板 + * 参数: {queueCount}, {orderTitle} + */ + public static final String NEXT_TASK = "CLEAN_NEXT_TASK"; + + /** + * P0紧急任务通知模板 + * 参数: {orderCode}, {reason} + */ + public static final String PRIORITY_UPGRADE = "CLEAN_PRIORITY_UPGRADE"; + + /** + * 任务恢复通知模板 + * 参数: {areaName} + */ + public static final String TASK_RESUMED = "CLEAN_TASK_RESUMED"; + + /** + * 工单完成通知模板(巡检员) + * 参数: {orderCode}, {areaName}, {orderTitle} + */ + public static final String ORDER_COMPLETED = "CLEAN_ORDER_COMPLETED"; + } + + /** + * 语音播报内容 + */ + public static class VoiceMessage { + + /** + * 新工单播报 + */ + public static final String NEW_ORDER = "您有1条新的待办工单"; + + /** + * 待办增加播报 + * 参数: {queueCount} - 总待办数 + */ + public static final String QUEUED_ORDER_FORMAT = "新增%d项待办,您共有%d个待办工单"; + + /** + * 简化的待办播报(用于快速通知) + */ + public static final String QUEUED_ORDER_SIMPLE = "您有新的待办工单"; + + /** + * 下一任务播报 + * 参数: {queueCount} - 总待办数, {orderTitle} - 第一个任务标题 + */ + public static final String NEXT_TASK_FORMAT = "待办工单总数%d个,第一位待办工单%s"; + + /** + * P0紧急任务播报 + * 参数: {orderCode} - 工单编号 + */ + public static final String PRIORITY_UPGRADE_FORMAT = "紧急任务!工单%s已升级为P0,请立即处理"; + + /** + * 任务恢复播报 + * 参数: {areaName} - 区域名称 + */ + public static final String TASK_RESUMED_FORMAT = "任务恢复,请继续完成%s的清洁"; + + /** + * 工单完成播报(巡检员) + * 参数: {orderCode} - 工单编号 + */ + public static final String ORDER_COMPLETED_FORMAT = "保洁工单%s已完成,请前往验收"; + } + + /** + * 站内信标题 + */ + public static class MessageTitle { + + public static final String NEW_ORDER = "新工单通知"; + public static final String QUEUED_ORDER = "待办增加"; + public static final String NEXT_TASK = "下一任务"; + public static final String PRIORITY_UPGRADE = "紧急任务通知"; + public static final String TASK_RESUMED = "任务恢复"; + public static final String ORDER_COMPLETED = "工单完成通知"; + } + + /** + * 震动时长配置(毫秒) + */ + public static class VibrationDuration { + + /** + * 轻量震动(用于普通通知) + */ + public static final int LIGHT = 500; + + /** + * 标准震动(用于新工单) + */ + public static final int NORMAL = 1000; + + /** + * 强烈震动(用于紧急任务) + */ + public static final int STRONG = 2000; + } + + /** + * 语音播报辅助方法 + */ + public static class VoiceHelper { + + /** + * 格式化待办增加播报 + * + * @param newCount 新增数量 + * @param totalCount 总数量 + * @return 播报内容 + */ + public static String formatQueuedOrder(int newCount, int totalCount) { + if (totalCount <= 1) { + return VoiceMessage.QUEUED_ORDER_SIMPLE; + } + return String.format(VoiceMessage.QUEUED_ORDER_FORMAT, newCount, totalCount); + } + + /** + * 格式化下一任务播报 + * + * @param totalCount 总待办数 + * @param orderTitle 第一个任务标题 + * @return 播报内容 + */ + public static String formatNextTask(int totalCount, String orderTitle) { + return String.format(VoiceMessage.NEXT_TASK_FORMAT, totalCount, orderTitle); + } + + /** + * 格式化P0紧急任务��报 + * + * @param orderCode 工单编号 + * @return 播报内容 + */ + public static String formatPriorityUpgrade(String orderCode) { + return String.format(VoiceMessage.PRIORITY_UPGRADE_FORMAT, orderCode); + } + + /** + * 格式化任务恢复播报 + * + * @param areaName 区域名称 + * @return 播报内容 + */ + public static String formatTaskResumed(String areaName) { + return String.format(VoiceMessage.TASK_RESUMED_FORMAT, areaName); + } + + /** + * 格式化工单完成播报 + * + * @param orderCode 工单编号 + * @return 播报内容 + */ + public static String formatOrderCompleted(String orderCode) { + return String.format(VoiceMessage.ORDER_COMPLETED_FORMAT, orderCode); + } + } + + /** + * 站内信参数构建辅助方法 + */ + public static class NotifyParamsBuilder { + + /** + * 构建新工单通知参数 + * + * @param orderCode 工单编号 + * @param orderTitle 工单标题 + * @param areaName 区域名称 + * @return 参数 Map + */ + public static java.util.Map newOrderParams(String orderCode, String orderTitle, String areaName) { + java.util.Map params = new java.util.HashMap<>(); + params.put("orderCode", orderCode); + params.put("orderTitle", orderTitle); + params.put("areaName", areaName); + return params; + } + + /** + * 构建待办增加通知参数 + * + * @param queueCount 总待办数 + * @param newCount 新增数量 + * @return 参数 Map + */ + public static java.util.Map queuedOrderParams(int queueCount, int newCount) { + java.util.Map params = new java.util.HashMap<>(); + params.put("queueCount", queueCount); + params.put("newCount", newCount); + return params; + } + + /** + * 构建下一任务通知参数 + * + * @param queueCount 总待办数 + * @param orderTitle 任务标题 + * @return 参数 Map + */ + public static java.util.Map nextTaskParams(int queueCount, String orderTitle) { + java.util.Map params = new java.util.HashMap<>(); + params.put("queueCount", queueCount); + params.put("orderTitle", orderTitle); + return params; + } + + /** + * 构建P0紧急任务通知参数 + * + * @param orderCode 工单编号 + * @param reason 升级原因 + * @return 参数 Map + */ + public static java.util.Map priorityUpgradeParams(String orderCode, String reason) { + java.util.Map params = new java.util.HashMap<>(); + params.put("orderCode", orderCode); + params.put("reason", reason); + return params; + } + + /** + * 构建任务恢复通知参数 + * + * @param areaName 区域名称 + * @return 参数 Map + */ + public static java.util.Map taskResumedParams(String areaName) { + java.util.Map params = new java.util.HashMap<>(); + params.put("areaName", areaName); + return params; + } + + /** + * 构建工单完成通知参数 + * + * @param orderCode 工单编号 + * @param areaName 区域名称 + * @param orderTitle 工单标题 + * @return 参数 Map + */ + public static java.util.Map orderCompletedParams(String orderCode, String areaName, String orderTitle) { + java.util.Map params = new java.util.HashMap<>(); + params.put("orderCode", orderCode); + params.put("areaName", areaName); + params.put("orderTitle", orderTitle); + return params; + } + } + + private CleanNotificationConstants() { + // 防止实例化 + } +}