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