From 5882ba8863d77fdcc168b176c3ffb30e8a20556a Mon Sep 17 00:00:00 2001
From: longz <longzhaoz@qq.com>
Date: 星期一, 13 七月 2026 17:54:25 +0800
Subject: [PATCH] 缩短二维码原始参数

---
 backend/src/main/java/com/sinata/appointment/service/MiniAppointmentApplicationService.java |   30 ++++++++++++++++--------------
 1 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/backend/src/main/java/com/sinata/appointment/service/MiniAppointmentApplicationService.java b/backend/src/main/java/com/sinata/appointment/service/MiniAppointmentApplicationService.java
index 5345cfe..6006207 100644
--- a/backend/src/main/java/com/sinata/appointment/service/MiniAppointmentApplicationService.java
+++ b/backend/src/main/java/com/sinata/appointment/service/MiniAppointmentApplicationService.java
@@ -103,6 +103,8 @@
     private final ApprovalEngineService approvalEngineService;
     private final PostApprovalOrchestrationService postApprovalOrchestrationService;
     private final ApprovalFlowViewApplicationService approvalFlowViewApplicationService;
+    private final SensitiveWordFilterService sensitiveWordFilterService;
+    private final IntegrationHikvisionService integrationHikvisionService;
     private final ObjectMapper objectMapper;
     private final ApplicationEventPublisher applicationEventPublisher;
 
@@ -149,7 +151,7 @@
         order.setVisitedUserName(StringUtils.hasText(visited.getNickName()) ? visited.getNickName() : "员工");
         order.setVisitedDeptId(visited.getDeptId());
         order.setVisitReasonCode(req.getVisitReasonCode().trim());
-        order.setVisitReasonOther(trimToNull(req.getVisitReasonOther()));
+        order.setVisitReasonOther(sensitiveWordFilterService.filter(trimToNull(req.getVisitReasonOther())));
         order.setVisitorOrg(resolveVisitorOrg(visitorMap.values()));
         order.setVisitTimeMode(mode);
         order.setVisitTimeSlot(
@@ -618,14 +620,14 @@
         if (!StringUtils.hasText(c)) {
             throw new BizException(BizErrorCode.AUTH_INVALID_CREDENTIALS, "拜访事由不能为空");
         }
+        String txt = trimToNull(other);
+        if (!StringUtils.hasText(txt)) {
+            throw new BizException(BizErrorCode.AUTH_INVALID_CREDENTIALS, "请输入事由说明");
+        }
+        if (txt.length() > 15) {
+            throw new BizException(BizErrorCode.AUTH_INVALID_CREDENTIALS, "事由说明不能超过15个字");
+        }
         if (AppointmentBizConstants.VISIT_REASON_OTHER.equalsIgnoreCase(c)) {
-            String txt = trimToNull(other);
-            if (!StringUtils.hasText(txt)) {
-                throw new BizException(BizErrorCode.AUTH_INVALID_CREDENTIALS, "选择其他时须填写自定义内容");
-            }
-            if (txt.length() > 15) {
-                throw new BizException(BizErrorCode.AUTH_INVALID_CREDENTIALS, "自定义内容不能超过15字");
-            }
             return;
         }
         Long cnt =
@@ -1133,12 +1135,12 @@
     }
 
     private String buildVisitReasonText(AppointmentOrder row, Map<String, String> reasonNameMap) {
-        if (AppointmentBizConstants.VISIT_REASON_OTHER.equalsIgnoreCase(trimToNull(row.getVisitReasonCode()))) {
-            String other = trimToNull(row.getVisitReasonOther());
-            return StringUtils.hasText(other) ? "其他:" + other : "其他";
+        String code = trimToNull(row.getVisitReasonCode());
+        if (AppointmentBizConstants.VISIT_REASON_OTHER.equalsIgnoreCase(code)) {
+            return "其他";
         }
-        String reasonName = reasonNameMap.get(trimToNull(row.getVisitReasonCode()));
-        return StringUtils.hasText(reasonName) ? reasonName : trimToNull(row.getVisitReasonCode());
+        String reasonName = reasonNameMap.get(code);
+        return StringUtils.hasText(reasonName) ? reasonName : code;
     }
 
     private String buildAccessAreaText(String rawJson) {
@@ -1207,7 +1209,7 @@
         vo.setTicketId(ticket.getId());
         vo.setTicketUuid(ticket.getUuid());
         vo.setMpVisitorId(ticket.getMpVisitorId());
-        vo.setPayload(ticket.getPayload());
+        vo.setPayload(integrationHikvisionService.encryptQrcodePayload(ticket.getPayload()));
         vo.setGenerateTime(ticket.getGenerateTime());
         vo.setExpireTime(ticket.getExpireTime());
         vo.setVisitorName(resolveVisitorName(ticket.getMpVisitorId(), orderVisitors, visitorMap));

--
Gitblit v1.7.1