From 31620fa7106fb5ba0fa511de1454a5c690f3f076 Mon Sep 17 00:00:00 2001
From: huangxz <huangxz@xiaopeng.com>
Date: 星期六, 07 三月 2026 21:00:57 +0800
Subject: [PATCH] feat: 更新短信验证码发送逻辑,集成短信服务

---
 xp-robotaxi-automatic-pilot-boot/src/main/java/com/xiaopeng/automaticPilot/service/impl/VehicleRtInfoServiceImpl.java |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/xp-robotaxi-automatic-pilot-boot/src/main/java/com/xiaopeng/automaticPilot/service/impl/VehicleRtInfoServiceImpl.java b/xp-robotaxi-automatic-pilot-boot/src/main/java/com/xiaopeng/automaticPilot/service/impl/VehicleRtInfoServiceImpl.java
index 14e9f80..87fccfa 100644
--- a/xp-robotaxi-automatic-pilot-boot/src/main/java/com/xiaopeng/automaticPilot/service/impl/VehicleRtInfoServiceImpl.java
+++ b/xp-robotaxi-automatic-pilot-boot/src/main/java/com/xiaopeng/automaticPilot/service/impl/VehicleRtInfoServiceImpl.java
@@ -1,5 +1,7 @@
 package com.xiaopeng.automaticPilot.service.impl;
 
+import com.xiaopeng.api.feignClient.operation.SmsClient;
+import com.xiaopeng.api.vo.operation.SmsVo;
 import com.xiaopeng.automaticPilot.dto.XpCommonResponse;
 import com.xiaopeng.automaticPilot.dto.RobotaxiSmsCodeRequest;
 import com.xiaopeng.automaticPilot.dto.RobotaxiSmsValidateRequest;
@@ -11,6 +13,7 @@
 import com.xiaopeng.common.core.utils.StringUtils;
 import com.xiaopeng.common.redis.service.RedisService;
 import com.xiaopeng.automaticPilot.enums.RobotaxiErrorEnum;
+import com.xiaopeng.automaticPilot.enums.SmsPushType;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
@@ -18,6 +21,7 @@
 import javax.annotation.Resource;
 import java.util.Collections;
 import java.util.List;
+import java.util.Map;
 import java.util.concurrent.TimeUnit;
 
 @Slf4j
@@ -25,12 +29,19 @@
 public class VehicleRtInfoServiceImpl implements VehicleRtInfoService {
 
     private static final long CODE_TTL_MINUTES = 5L;
+    public static final String ROBOTAXI_VERIFY_CODE_SMS_TPL = "RobotaxiVerifyCodeSmsTpl";
 
     @Resource
     private RedisService redisService;
 
     @Resource
     private XpVehicleClient xpVehicleClient;
+
+    @Resource
+    private SmsClient smsClient;
+
+    @Value("${robotaxi.sms.app-id:1476153389173952512}")
+    private String smsAppId;
 
     @Value("#{'${robotaxi.sms.whitelist.mobiles:}'.split(',')}")
     private List<String> whitelistMobiles;
@@ -51,7 +62,15 @@
         log.info("Robotaxi SMS code generated for mobile {}: {}", request.getMobile(), code);
         
         // TODO: Call SMS interface to send code when available
-        // sendSms(request.getMobile(), code);
+//         sendSms(request.getMobile(), code);
+        Map<String, String> param = Collections.singletonMap("code", code);
+        SmsVo smsVo = new SmsVo();
+        smsVo.setAppId(smsAppId);
+        smsVo.setParams(param);
+        smsVo.setTemplateCode(ROBOTAXI_VERIFY_CODE_SMS_TPL);
+        smsVo.setReceivers(request.getMobile());
+        smsVo.setPushType(SmsPushType.SMS.getCode());
+        smsClient.pushSms(smsVo);
 
         String key = buildSmsCodeKey(request.getSmsType(), request.getVin(), request.getMobile());
         redisService.setCacheObject(key, code, CODE_TTL_MINUTES, TimeUnit.MINUTES);

--
Gitblit v1.7.1