|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import cn.emay.sdk.core.dto.sms.response.SmsResponse; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
|---|
|  |  |  | import com.doumee.biz.system.SystemDictDataBiz; | 
|---|
|  |  |  | import com.doumee.biz.system.SystemUserBiz; | 
|---|
|  |  |  | import com.doumee.core.constants.ResponseStatus; | 
|---|
|  |  |  | import com.doumee.core.exception.BusinessException; | 
|---|
|  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SmsEmailMapper smsEmailMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SystemDictDataBiz systemDictDataBiz; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private CompanyService companyService; | 
|---|
|  |  |  | @Value("${debug_model}") | 
|---|
|  |  |  | 
|---|
|  |  |  | SystemUser queryUserDto = new SystemUser(); | 
|---|
|  |  |  | queryUserDto.setUsername(systemUser.getUsername()); | 
|---|
|  |  |  | queryUserDto.setDeleted(Boolean.FALSE); | 
|---|
|  |  |  | queryUserDto.setType(Constants.ZERO); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //        queryUserDto.setType(Constants.ZERO); | 
|---|
|  |  |  | SystemUser user = systemUserService.findOne(queryUserDto); | 
|---|
|  |  |  | if (user != null) { | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "登录账号已存在"); | 
|---|
|  |  |  | 
|---|
|  |  |  | if (StringUtils.isNotBlank(systemUser.getMobile())) { | 
|---|
|  |  |  | queryUserDto = new SystemUser(); | 
|---|
|  |  |  | queryUserDto.setDeleted(Boolean.FALSE); | 
|---|
|  |  |  | queryUserDto.setEmpNo(systemUser.getMobile()); | 
|---|
|  |  |  | queryUserDto.setMobile(systemUser.getMobile()); | 
|---|
|  |  |  | user = systemUserService.findOne(queryUserDto); | 
|---|
|  |  |  | if (user != null) { | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "手机号已存在"); | 
|---|
|  |  |  | 
|---|
|  |  |  | // 生成密码盐 | 
|---|
|  |  |  | String salt = RandomStringUtils.randomAlphabetic(6); | 
|---|
|  |  |  | // 生成密码 | 
|---|
|  |  |  | systemUser.setPassword(Utils.Secure.encryptPassword(systemUser.getPassword(), salt)); | 
|---|
|  |  |  | //        systemUser.setPassword(Utils.Secure.encryptPassword(systemUser.getPassword(), salt)); | 
|---|
|  |  |  | systemUser.setPassword(Utils.Secure.encryptPassword(systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.DEFAULT_PASSWORD).getCode(), salt)); | 
|---|
|  |  |  | systemUser.setSalt(salt); | 
|---|
|  |  |  | LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); | 
|---|
|  |  |  | systemUser.setType(loginUserInfo.getType()); | 
|---|