From aabd3fb155475168427f1c14966beb873bff6763 Mon Sep 17 00:00:00 2001
From: shinnosuke <tantao@1hoper.com>
Date: 星期二, 25 八月 2026 19:31:46 +0800
Subject: [PATCH] fix: complete appointment management data and filters

---
 talent-card-server/src/main/java/com/talentcard/server/service/ServiceAppointmentApplicationService.java |   29 ++++++++++++++++++++++++++---
 1 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/talent-card-server/src/main/java/com/talentcard/server/service/ServiceAppointmentApplicationService.java b/talent-card-server/src/main/java/com/talentcard/server/service/ServiceAppointmentApplicationService.java
index 82a1972..7796ae2 100644
--- a/talent-card-server/src/main/java/com/talentcard/server/service/ServiceAppointmentApplicationService.java
+++ b/talent-card-server/src/main/java/com/talentcard/server/service/ServiceAppointmentApplicationService.java
@@ -19,8 +19,10 @@
 import com.talentcard.server.common.SensitiveDataCrypto;
 import com.talentcard.server.entity.ChildInformation;
 import com.talentcard.server.entity.ServiceApplication;
+import com.talentcard.server.entity.ServiceApplicationOperationLog;
 import com.talentcard.server.mapper.ChildInformationMapper;
 import com.talentcard.server.mapper.ServiceApplicationMapper;
+import com.talentcard.server.mapper.ServiceApplicationOperationLogMapper;
 import org.springframework.dao.DuplicateKeyException;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -35,15 +37,18 @@
 
     private final ServiceApplicationMapper applicationMapper;
     private final ChildInformationMapper childInformationMapper;
+    private final ServiceApplicationOperationLogMapper operationLogMapper;
     private final SensitiveDataCrypto sensitiveDataCrypto;
 
     public ServiceAppointmentApplicationService(
             ServiceApplicationMapper applicationMapper,
             ChildInformationMapper childInformationMapper,
+            ServiceApplicationOperationLogMapper operationLogMapper,
             SensitiveDataCrypto sensitiveDataCrypto
     ) {
         this.applicationMapper = applicationMapper;
         this.childInformationMapper = childInformationMapper;
+        this.operationLogMapper = operationLogMapper;
         this.sensitiveDataCrypto = sensitiveDataCrypto;
     }
 
@@ -80,6 +85,19 @@
         ServiceApplication saved = applicationMapper.selectById(application.getId());
         if (saved == null) {
             throw new BusinessException(ErrorCode.INTERNAL_ERROR, "预约申请保存失败");
+        }
+        ServiceApplicationOperationLog log = new ServiceApplicationOperationLog();
+        log.setApplicationId(saved.getId());
+        log.setApplicationNo(saved.getApplicationNo());
+        log.setOperationType("SUBMIT");
+        log.setAfterStatus(saved.getStatus());
+        log.setOperatorType("TALENT");
+        log.setOperatorId(saved.getTalentId());
+        log.setOperatorName(saved.getTalentName());
+        log.setRemark("提交预约申请");
+        log.setCreatedAt(saved.getSubmittedAt());
+        if (operationLogMapper.insert(log) != 1) {
+            throw new BusinessException(ErrorCode.INTERNAL_ERROR, "预约申请操作日志保存失败");
         }
         return appResult(saved);
     }
@@ -139,7 +157,7 @@
         applyInstitution(application, merchant, request.merchantName(), request.contactMobile(), false);
         application.setApplicantName(first(clean(request.applicantName()), application.getTalentName()));
         application.setApplicantMobile(first(clean(request.applicantMobile()), application.getTalentMobile()));
-        application.setGuestCount(request.guestCount());
+        application.setGuestCount(request.guestCount() == null ? 1 : request.guestCount());
         application.setSubsidy(blankToNull(clean(request.subsidy())));
         applyHotelProduct(application, request.productId(), request.productName());
         LocalDate checkIn = date(request.checkInDate(), "入住日期格式不正确", false);
@@ -339,7 +357,12 @@
         if (merchant == null || merchant.isEmpty()) {
             throw new BusinessException(ErrorCode.NOT_FOUND, message);
         }
-        if (expectedType != null && !expectedType.equalsIgnoreCase(text(merchant, "merchantType", "merchant_type"))) {
+        String actualType = text(merchant, "merchantType", "merchant_type");
+        boolean medicalType = "medical".equalsIgnoreCase(expectedType)
+                && ("medical".equalsIgnoreCase(actualType) || "healthCheck".equalsIgnoreCase(actualType) || "免费体检".equals(actualType));
+        boolean hotelType = "hotel".equalsIgnoreCase(expectedType)
+                && ("hotel".equalsIgnoreCase(actualType) || "酒店".equals(actualType) || "酒店服务".equals(actualType));
+        if (expectedType != null && !medicalType && !hotelType && !expectedType.equalsIgnoreCase(actualType)) {
             throw new BusinessException(ErrorCode.CONFLICT, message);
         }
         return merchant;
@@ -580,4 +603,4 @@
     private String clean(String value) {
         return value == null ? "" : value.trim();
     }
-}
\ No newline at end of file
+}

--
Gitblit v1.7.1