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..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 @@ -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,11 @@ 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); + } }