huangxz
2026-03-04 31620fa7106fb5ba0fa511de1454a5c690f3f076
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;
@@ -52,6 +63,14 @@
        
        // TODO: Call SMS interface to send code when available
        // 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);