feat: user kyc support i18n
This commit is contained in:
@@ -7,6 +7,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.wfc.common.core.domain.LoginUser;
|
import org.wfc.common.core.domain.LoginUser;
|
||||||
|
import org.wfc.common.core.utils.MessageUtils;
|
||||||
import org.wfc.common.security.utils.SecurityUtils;
|
import org.wfc.common.security.utils.SecurityUtils;
|
||||||
import org.wfc.user.api.domain.UUser;
|
import org.wfc.user.api.domain.UUser;
|
||||||
import org.wfc.user.domain.UKyc;
|
import org.wfc.user.domain.UKyc;
|
||||||
@@ -16,7 +17,6 @@ import org.wfc.user.service.IUKycService;
|
|||||||
import org.wfc.user.service.IUUserService;
|
import org.wfc.user.service.IUUserService;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.Period;
|
import java.time.Period;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.time.format.DateTimeParseException;
|
import java.time.format.DateTimeParseException;
|
||||||
@@ -111,14 +111,14 @@ public class UKycServiceImpl extends ServiceImpl<UKycMapper, UKyc> implements IU
|
|||||||
uUser.setFullName(uKyc.getRealName());
|
uUser.setFullName(uKyc.getRealName());
|
||||||
|
|
||||||
if (uKyc.getBirthDate() == null) {
|
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
|
// Parse birthDate and calculate age
|
||||||
try {
|
try {
|
||||||
LocalDate birthDate = LocalDate.parse(uKyc.getBirthDate(), DATE_FORMATTER);
|
LocalDate birthDate = LocalDate.parse(uKyc.getBirthDate(), DATE_FORMATTER);
|
||||||
uUser.setAge(calculateAge(birthDate));
|
uUser.setAge(calculateAge(birthDate));
|
||||||
} catch (DateTimeParseException e) {
|
} catch (DateTimeParseException e) {
|
||||||
throw new IllegalArgumentException("Invalid birthDate format");
|
throw new IllegalArgumentException(MessageUtils.message("user.kyc.birthdate.not.valid"));
|
||||||
}
|
}
|
||||||
return uUserService.updateUser(uUser);
|
return uUserService.updateUser(uUser);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user