| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.common.service.EmailService; |
| | | import com.vincent.rsf.server.system.controller.param.TenantInitParam; |
| | | import com.vincent.rsf.server.system.entity.*; |
| | | import com.vincent.rsf.server.system.enums.StatusType; |
| | |
| | | private UserRoleService userRoleService; |
| | | @Autowired |
| | | private RoleMenuService roleMenuService; |
| | | @Autowired |
| | | private EmailService emailService; |
| | | |
| | | @Override |
| | | @Transactional |
| | |
| | | return false; |
| | | } |
| | | |
| | | if (null != userService.getByUsername(param.getUsername(), null)) { |
| | | throw new CoolException("the username already exist"); |
| | | } |
| | | if (!Cools.isEmpty(param.getEmail())) { |
| | | if (!emailService.isValid(param.getEmail())) { |
| | | throw new CoolException("Please enter a valid email address"); |
| | | } |
| | | if (null != userService.getByEmail(param.getEmail(), null)) { |
| | | throw new CoolException("the email already exist"); |
| | | } |
| | | } |
| | | |
| | | if (0 < this.count(new LambdaQueryWrapper<Tenant>().eq(Tenant::getName, param.getName()))) { |
| | | throw new CoolException("tenant name already exist"); |
| | | } |
| | | if (0 < this.count(new LambdaQueryWrapper<Tenant>().eq(Tenant::getFlag, param.getFlag()))) { |
| | | throw new CoolException("tenant flag already exist"); |
| | | } |
| | | |
| | | if (null != userService.getByUsername(param.getUsername(), null)) { |
| | | throw new CoolException("the username already exist"); |
| | | } |
| | | if (!Cools.isEmpty(param.getEmail())) { |
| | | if (null != userService.getByEmail(param.getEmail(), null)) { |
| | | throw new CoolException("the email already exist"); |
| | | } |
| | | } |
| | | |
| | | Date now = new Date(); |