20230219
This commit is contained in:
@@ -3,7 +3,6 @@ package xyz.zhouxy.plusone.system.domain.model.account;
|
||||
import lombok.Getter;
|
||||
import xyz.zhouxy.plusone.domain.IValueObject;
|
||||
import xyz.zhouxy.plusone.util.Enumeration;
|
||||
import xyz.zhouxy.plusone.util.EnumerationValuesHolder;
|
||||
|
||||
/**
|
||||
* 账号状态
|
||||
@@ -21,7 +20,8 @@ public class AccountStatus extends Enumeration<AccountStatus> implements IValueO
|
||||
public static final AccountStatus LOCKED = new AccountStatus(1, "账号被锁定");
|
||||
|
||||
private static final EnumerationValuesHolder<AccountStatus> ENUMERATION_VALUES = new EnumerationValuesHolder<>(
|
||||
new AccountStatus[] { AVAILABLE, LOCKED });
|
||||
AVAILABLE,
|
||||
LOCKED);
|
||||
|
||||
public static AccountStatus of(int value) {
|
||||
return ENUMERATION_VALUES.get(value);
|
||||
|
@@ -10,7 +10,7 @@ import org.springframework.util.Assert;
|
||||
import xyz.zhouxy.plusone.constant.ErrorCodeConsts;
|
||||
import xyz.zhouxy.plusone.constant.RegexConsts;
|
||||
import xyz.zhouxy.plusone.domain.IValueObject;
|
||||
import xyz.zhouxy.plusone.exception.PlusoneException;
|
||||
import xyz.zhouxy.plusone.exception.BizException;
|
||||
import xyz.zhouxy.plusone.system.util.PasswordUtil;
|
||||
|
||||
/**
|
||||
@@ -37,7 +37,7 @@ public class Password implements IValueObject {
|
||||
}
|
||||
var salt = PasswordUtil.generateRandomSalt();
|
||||
if (salt == null) {
|
||||
throw new PlusoneException(ErrorCodeConsts.DEFAULT_ERROR_CODE, "未知错误:生成随机盐失败");
|
||||
throw new BizException(ErrorCodeConsts.DEFAULT_ERROR_CODE, "未知错误:生成随机盐失败");
|
||||
}
|
||||
this.saltVal = salt;
|
||||
this.passwordVal = PasswordUtil.hashPassword(password, salt);
|
||||
|
@@ -2,7 +2,6 @@ package xyz.zhouxy.plusone.system.domain.model.account;
|
||||
|
||||
import xyz.zhouxy.plusone.domain.IValueObject;
|
||||
import xyz.zhouxy.plusone.util.Enumeration;
|
||||
import xyz.zhouxy.plusone.util.EnumerationValuesHolder;
|
||||
|
||||
/**
|
||||
* 值对象:性别
|
||||
@@ -18,11 +17,10 @@ public class Sex extends Enumeration<Sex> implements IValueObject {
|
||||
super(value, name);
|
||||
}
|
||||
|
||||
private static EnumerationValuesHolder<Sex> values = new EnumerationValuesHolder<>(new Sex[] {
|
||||
UNSET,
|
||||
MALE,
|
||||
FEMALE
|
||||
});
|
||||
private static EnumerationValuesHolder<Sex> values = new EnumerationValuesHolder<>(
|
||||
UNSET,
|
||||
MALE,
|
||||
FEMALE);
|
||||
|
||||
public static Sex of(int value) {
|
||||
return values.get(value);
|
||||
|
Reference in New Issue
Block a user