From 001617935606d2f101c2254d6db7a3c26daaf065 Mon Sep 17 00:00:00 2001 From: zhangsz Date: Tue, 21 Jan 2025 14:43:56 +0800 Subject: [PATCH] feat: user kyc support i18n --- .../java/org/wfc/user/service/impl/UKycServiceImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wfc-modules/wfc-user/src/main/java/org/wfc/user/service/impl/UKycServiceImpl.java b/wfc-modules/wfc-user/src/main/java/org/wfc/user/service/impl/UKycServiceImpl.java index 35fc8ff..5510ead 100644 --- a/wfc-modules/wfc-user/src/main/java/org/wfc/user/service/impl/UKycServiceImpl.java +++ b/wfc-modules/wfc-user/src/main/java/org/wfc/user/service/impl/UKycServiceImpl.java @@ -7,6 +7,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.wfc.common.core.domain.LoginUser; +import org.wfc.common.core.utils.MessageUtils; import org.wfc.common.security.utils.SecurityUtils; import org.wfc.user.api.domain.UUser; import org.wfc.user.domain.UKyc; @@ -16,7 +17,6 @@ import org.wfc.user.service.IUKycService; import org.wfc.user.service.IUUserService; import java.time.LocalDate; -import java.time.LocalDateTime; import java.time.Period; import java.time.format.DateTimeFormatter; import java.time.format.DateTimeParseException; @@ -111,14 +111,14 @@ public class UKycServiceImpl extends ServiceImpl implements IU uUser.setFullName(uKyc.getRealName()); if (uKyc.getBirthDate() == null) { - throw new IllegalArgumentException("BirthDate cannot be null"); + throw new IllegalArgumentException(MessageUtils.message("user.kyc.birthdate.not.blank")); } // Parse birthDate and calculate age try { LocalDate birthDate = LocalDate.parse(uKyc.getBirthDate(), DATE_FORMATTER); uUser.setAge(calculateAge(birthDate)); } catch (DateTimeParseException e) { - throw new IllegalArgumentException("Invalid birthDate format"); + throw new IllegalArgumentException(MessageUtils.message("user.kyc.birthdate.not.valid")); } return uUserService.updateUser(uUser); }