From 7167a7cdf3055fa15e5aba347138cd1d37394eea Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期四, 12 三月 2026 11:02:48 +0800
Subject: [PATCH] 运维人员导入校验手机号
---
xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/constant/I18nKeyConstant.java | 2 ++
xp-robotaxi-account-boot/src/main/resources/i18n/messages_en_US.properties | 3 ++-
xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/service/impl/XpOperationsUserServiceImpl.java | 5 +++++
xp-robotaxi-account-boot/src/main/resources/i18n/messages_zh_CN.properties | 1 +
xp-robotaxi-account-boot/src/main/resources/i18n/messages.properties | 1 +
5 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/constant/I18nKeyConstant.java b/xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/constant/I18nKeyConstant.java
index ea7cccf..0223650 100644
--- a/xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/constant/I18nKeyConstant.java
+++ b/xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/constant/I18nKeyConstant.java
@@ -29,6 +29,8 @@
String ACCOUNT_UNIQUE_NUMBER_DUPLICATE = "account.unique.number.duplicate";
String ACCOUNT_CURRENT_USER_NOT_DELETE = "account.current.user.not.delete";
String ACCOUNT_NOT_ALLOWED_OPERATE_ADMIN = "account.not.allowed.operate.admin";
+ //手机号格式错误
+ String ACCOUNT_FORMAT_ERROR = "account.format.error";
//========== 角色相关 ==========
String ROLE_NAME_EXISTS = "role.name.exists";
diff --git a/xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/service/impl/XpOperationsUserServiceImpl.java b/xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/service/impl/XpOperationsUserServiceImpl.java
index b524d86..16ef6cc 100644
--- a/xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/service/impl/XpOperationsUserServiceImpl.java
+++ b/xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/service/impl/XpOperationsUserServiceImpl.java
@@ -2,6 +2,7 @@
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.PhoneUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -353,6 +354,10 @@
xpOperationsUser.setNickName(exportOperationsUserVo.getNickName());
xpOperationsUser.setUniqueNumber(exportOperationsUserVo.getUniqueNumber());
xpOperationsUser.setAvatar(exportOperationsUserVo.getAvatar());
+ boolean isPhone = PhoneUtil.isPhone(exportOperationsUserVo.getPhoneNumber());
+ if (!isPhone) {
+ throw new ServiceException("以下帐号格式不正确:", I18nKeyConstant.ACCOUNT_FORMAT_ERROR, new Object[]{exportOperationsUserVo.getPhoneNumber()});
+ }
xpOperationsUser.setPhoneNumber(exportOperationsUserVo.getPhoneNumber());
xpOperationsUser.setPassword(SecurityUtils.encryptPassword("a123456"));
xpOperationsUser.setRemarks(exportOperationsUserVo.getRemarks());
diff --git a/xp-robotaxi-account-boot/src/main/resources/i18n/messages.properties b/xp-robotaxi-account-boot/src/main/resources/i18n/messages.properties
index 6e6adca..f67fc91 100644
--- a/xp-robotaxi-account-boot/src/main/resources/i18n/messages.properties
+++ b/xp-robotaxi-account-boot/src/main/resources/i18n/messages.properties
@@ -33,3 +33,4 @@
request.failed=请求失败,请稍后重试!
sms.push.failed=短信发送失败,请稍后重试!
sys.group.delete.fail=删除失败,该权限组已关联角色
+account.format.error=以下帐号格式不正确:{0}
diff --git a/xp-robotaxi-account-boot/src/main/resources/i18n/messages_en_US.properties b/xp-robotaxi-account-boot/src/main/resources/i18n/messages_en_US.properties
index e105e30..1b3d505 100644
--- a/xp-robotaxi-account-boot/src/main/resources/i18n/messages_en_US.properties
+++ b/xp-robotaxi-account-boot/src/main/resources/i18n/messages_en_US.properties
@@ -32,4 +32,5 @@
group.not.exists=Group is not exist
request.failed=Request failed. Please try again later!
sms.push.failed=SMS sending failed. Please try again later!
-sys.group.delete.fail=Deletion failed. This permission group has been associated with a role
\ No newline at end of file
+sys.group.delete.fail=Deletion failed. This permission group has been associated with a role
+account.format.error=The following account format is incorrect: {0}
\ No newline at end of file
diff --git a/xp-robotaxi-account-boot/src/main/resources/i18n/messages_zh_CN.properties b/xp-robotaxi-account-boot/src/main/resources/i18n/messages_zh_CN.properties
index 6e6adca..f67fc91 100644
--- a/xp-robotaxi-account-boot/src/main/resources/i18n/messages_zh_CN.properties
+++ b/xp-robotaxi-account-boot/src/main/resources/i18n/messages_zh_CN.properties
@@ -33,3 +33,4 @@
request.failed=请求失败,请稍后重试!
sms.push.failed=短信发送失败,请稍后重试!
sys.group.delete.fail=删除失败,该权限组已关联角色
+account.format.error=以下帐号格式不正确:{0}
--
Gitblit v1.7.1