From 4f2e8b774ed9b8a056827f1bc2861c690ddd61f8 Mon Sep 17 00:00:00 2001 From: Agoni <791536664@qq.com> Date: Thu, 17 Aug 2023 23:43:06 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BE=9B=E5=BA=94=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=90=8E=E5=B9=B6=E7=94=9F=E6=88=90=E4=BE=9B=E5=BA=94=E5=95=86?= =?UTF-8?q?=E8=B4=A6=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../suppliercompany/SupplierCompanyDO.java | 6 +++ .../SupplierCompanyServiceImpl.java | 13 ++++- .../module/system/api/user/AdminUserApi.java | 7 +++ .../system/api/user/dto/UserCreateReqDTO.java | 48 +++++++++++++++++++ .../system/api/user/AdminUserApiImpl.java | 9 ++++ 5 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/user/dto/UserCreateReqDTO.java diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/suppliercompany/SupplierCompanyDO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/suppliercompany/SupplierCompanyDO.java index 80723f63..4d492e22 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/suppliercompany/SupplierCompanyDO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/suppliercompany/SupplierCompanyDO.java @@ -99,6 +99,12 @@ public class SupplierCompanyDO extends BaseDO { * 关联账号id */ private Long correlationUserId; + + /** + * 多租户编号 + */ + private Long tenantId; + /** * 附件 */ diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/suppliercompany/SupplierCompanyServiceImpl.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/suppliercompany/SupplierCompanyServiceImpl.java index 04dbf733..f79d4b50 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/suppliercompany/SupplierCompanyServiceImpl.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/suppliercompany/SupplierCompanyServiceImpl.java @@ -1,6 +1,8 @@ package cn.iocoder.yudao.module.bs.service.suppliercompany; import cn.iocoder.yudao.framework.common.util.date.DateUtils; +import cn.iocoder.yudao.module.system.api.user.AdminUserApi; +import cn.iocoder.yudao.module.system.api.user.dto.UserCreateReqDTO; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -32,6 +34,9 @@ public class SupplierCompanyServiceImpl implements SupplierCompanyService { @Resource private SupplierCompanyMapper supplierCompanyMapper; + @Resource + private AdminUserApi adminUserApi; + @Override public Long createSupplierCompany(SupplierCompanyCreateReqVO createReqVO) { @@ -40,7 +45,13 @@ public class SupplierCompanyServiceImpl implements SupplierCompanyService { String companyNumber = numberCreate(); supplierCompany.setCompanyNumber(companyNumber); supplierCompanyMapper.insert(supplierCompany); - + UserCreateReqDTO userCreateReqDTO=new UserCreateReqDTO(); + userCreateReqDTO.setPassword("123456Aa@"); + userCreateReqDTO.setUsername(supplierCompany.getPhone()); + userCreateReqDTO.setNickname(supplierCompany.getBankName()); + userCreateReqDTO.setMobile(supplierCompany.getPhone()); +// userCreateReqDTO.setTenantId(supplierCompany.getCompanyNumber()); + adminUserApi.addUser(userCreateReqDTO); // 返回 return supplierCompany.getId(); } diff --git a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/user/AdminUserApi.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/user/AdminUserApi.java index 35e11f02..cb8cdc52 100644 --- a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/user/AdminUserApi.java +++ b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/user/AdminUserApi.java @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.system.api.user; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; +import cn.iocoder.yudao.module.system.api.user.dto.UserCreateReqDTO; import java.util.Collection; import java.util.List; @@ -66,4 +67,10 @@ public interface AdminUserApi { */ void validateUserList(Collection ids); + /** + * 建好供应商信息后新建账号 + * @param createReqVO + */ + void addUser(UserCreateReqDTO createReqVO); + } diff --git a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/user/dto/UserCreateReqDTO.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/user/dto/UserCreateReqDTO.java new file mode 100644 index 00000000..b3d8b697 --- /dev/null +++ b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/user/dto/UserCreateReqDTO.java @@ -0,0 +1,48 @@ +package cn.iocoder.yudao.module.system.api.user.dto; + +import cn.iocoder.yudao.framework.common.validation.Mobile; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.Email; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Pattern; +import javax.validation.constraints.Size; +import java.util.Set; + + +@Data +public class UserCreateReqDTO { + + @NotBlank(message = "用户账号不能为空") + @Pattern(regexp = "^[a-zA-Z0-9]{4,30}$", message = "用户账号由 数字、字母 组成") + @Size(min = 4, max = 30, message = "用户账号长度为 4-30 个字符") + private String username; + + @Size(max = 30, message = "用户昵称长度不能超过30个字符") + private String nickname; + + private String remark; + + private Long deptId; + + private Set postIds; + + @Email(message = "邮箱格式不正确") + @Size(max = 50, message = "邮箱长度不能超过 50 个字符") + private String email; + + @Mobile + private String mobile; + + private Integer sex; + + private String avatar; + + private String password; + + /** + * 多租户编号 + */ +// private Long tenantId; +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/user/AdminUserApiImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/user/AdminUserApiImpl.java index 2271420c..59584e60 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/user/AdminUserApiImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/user/AdminUserApiImpl.java @@ -1,9 +1,12 @@ package cn.iocoder.yudao.module.system.api.user; import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; +import cn.iocoder.yudao.module.system.api.user.dto.UserCreateReqDTO; +import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserCreateReqVO; import cn.iocoder.yudao.module.system.convert.user.UserConvert; import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; import cn.iocoder.yudao.module.system.service.user.AdminUserService; +import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -50,4 +53,10 @@ public class AdminUserApiImpl implements AdminUserApi { userService.validateUserList(ids); } + @Override + public void addUser(UserCreateReqDTO createReqVO) { + UserCreateReqVO reqVO = new UserCreateReqVO(); + BeanUtils.copyProperties(createReqVO, reqVO); + userService.createUser(reqVO); + } } From 99c538754fee788db52aa5fecb1d0900eb60dcb8 Mon Sep 17 00:00:00 2001 From: Agoni <791536664@qq.com> Date: Thu, 17 Aug 2023 23:44:53 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BE=9B=E5=BA=94=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=90=8E=E5=B9=B6=E7=94=9F=E6=88=90=E4=BE=9B=E5=BA=94=E5=95=86?= =?UTF-8?q?=E8=B4=A6=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iocoder/yudao/module/system/api/user/AdminUserApiImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/user/AdminUserApiImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/user/AdminUserApiImpl.java index 59584e60..656b572f 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/user/AdminUserApiImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/user/AdminUserApiImpl.java @@ -55,6 +55,7 @@ public class AdminUserApiImpl implements AdminUserApi { @Override public void addUser(UserCreateReqDTO createReqVO) { + UserCreateReqVO reqVO = new UserCreateReqVO(); BeanUtils.copyProperties(createReqVO, reqVO); userService.createUser(reqVO);