From ecb099f12a9bf2a746611aeb08d1d1822072e7ce Mon Sep 17 00:00:00 2001 From: xuyang <748613696@qq.com> Date: Thu, 27 Jul 2023 14:08:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=94=A8=E6=88=B7=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E6=89=8B=E5=8A=A8=E5=A1=AB=E5=86=99=E7=94=A8=E6=88=B7?= =?UTF-8?q?id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/njcn/user/pojo/param/UserParam.java | 5 +++++ .../com/njcn/user/service/impl/UserSetServiceImpl.java | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/pqs-user/user-api/src/main/java/com/njcn/user/pojo/param/UserParam.java b/pqs-user/user-api/src/main/java/com/njcn/user/pojo/param/UserParam.java index 4a7f22454..1fea2ec95 100644 --- a/pqs-user/user-api/src/main/java/com/njcn/user/pojo/param/UserParam.java +++ b/pqs-user/user-api/src/main/java/com/njcn/user/pojo/param/UserParam.java @@ -98,6 +98,11 @@ public class UserParam { @NotBlank(message = UserValidMessage.LOGIN_NAME_NOT_BLANK) @Pattern(regexp = PatternRegex.LOGIN_NAME_REGEX, message = UserValidMessage.LOGIN_NAME_FORMAT_ERROR) private String loginName; + + @ApiModelProperty("用户表Id") + @NotBlank(message = UserValidMessage.ID_NOT_BLANK) + @Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.ID_FORMAT_ERROR) + private String id; } diff --git a/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/UserSetServiceImpl.java b/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/UserSetServiceImpl.java index 6728bca4f..eb3ebb5a7 100644 --- a/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/UserSetServiceImpl.java +++ b/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/UserSetServiceImpl.java @@ -21,6 +21,7 @@ import com.njcn.user.pojo.po.UserSet; import com.njcn.user.service.IUserSetService; import com.njcn.web.utils.RequestUtil; import lombok.RequiredArgsConstructor; +import org.apache.commons.lang.StringUtils; import org.springframework.stereotype.Service; import java.util.Objects; @@ -45,8 +46,13 @@ public class UserSetServiceImpl extends ServiceImpl impl @Override public UserSet addUserSet(UserParam.UserAddParam addUserParam) { + String userId; 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); String secretKey = PubUtils.randomCode(16); userSet.setSecretKey(secretKey);