供应新增后并生成供应商账号

new
Agoni 1 year ago
parent 5a8349b853
commit 4f2e8b774e

@ -99,6 +99,12 @@ public class SupplierCompanyDO extends BaseDO {
* id
*/
private Long correlationUserId;
/**
*
*/
private Long tenantId;
/**
*
*/

@ -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();
}

@ -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<Long> ids);
/**
*
* @param createReqVO
*/
void addUser(UserCreateReqDTO createReqVO);
}

@ -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<Long> 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;
}

@ -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);
}
}

Loading…
Cancel
Save