新增用户可以手动填写用户id
This commit is contained in:
@@ -98,6 +98,11 @@ public class UserParam {
|
|||||||
@NotBlank(message = UserValidMessage.LOGIN_NAME_NOT_BLANK)
|
@NotBlank(message = UserValidMessage.LOGIN_NAME_NOT_BLANK)
|
||||||
@Pattern(regexp = PatternRegex.LOGIN_NAME_REGEX, message = UserValidMessage.LOGIN_NAME_FORMAT_ERROR)
|
@Pattern(regexp = PatternRegex.LOGIN_NAME_REGEX, message = UserValidMessage.LOGIN_NAME_FORMAT_ERROR)
|
||||||
private String loginName;
|
private String loginName;
|
||||||
|
|
||||||
|
@ApiModelProperty("用户表Id")
|
||||||
|
@NotBlank(message = UserValidMessage.ID_NOT_BLANK)
|
||||||
|
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.ID_FORMAT_ERROR)
|
||||||
|
private String id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import com.njcn.user.pojo.po.UserSet;
|
|||||||
import com.njcn.user.service.IUserSetService;
|
import com.njcn.user.service.IUserSetService;
|
||||||
import com.njcn.web.utils.RequestUtil;
|
import com.njcn.web.utils.RequestUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -45,8 +46,13 @@ public class UserSetServiceImpl extends ServiceImpl<UserSetMapper, UserSet> impl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserSet addUserSet(UserParam.UserAddParam addUserParam) {
|
public UserSet addUserSet(UserParam.UserAddParam addUserParam) {
|
||||||
|
String userId;
|
||||||
UserSet userSet = new UserSet();
|
UserSet userSet = new UserSet();
|
||||||
String userId = IdUtil.simpleUUID();
|
if (StringUtils.isBlank(addUserParam.getId()) || Objects.isNull(addUserParam.getId())){
|
||||||
|
userId = IdUtil.simpleUUID();
|
||||||
|
} else {
|
||||||
|
userId = addUserParam.getId();
|
||||||
|
}
|
||||||
userSet.setUserId(userId);
|
userSet.setUserId(userId);
|
||||||
String secretKey = PubUtils.randomCode(16);
|
String secretKey = PubUtils.randomCode(16);
|
||||||
userSet.setSecretKey(secretKey);
|
userSet.setSecretKey(secretKey);
|
||||||
|
|||||||
Reference in New Issue
Block a user