| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.biz.system.SystemUserBiz; |
| | | import com.doumee.core.annotation.excel.ExcelImporter; |
| | | import com.doumee.core.exception.BusinessException; |
| | |
| | | @Autowired |
| | | private SystemDepartmentService systemDepartmentService; |
| | | |
| | | @Autowired |
| | | private SystemDictDataBiz systemDictDataBiz; |
| | | |
| | | @Transactional(rollbackFor = {Exception.class,BusinessException.class}) |
| | | @Override |
| | |
| | | @Transactional(rollbackFor = {Exception.class,BusinessException.class}) |
| | | public void create(CreateSystemUserDTO systemUser) { |
| | | // 验证用户名 |
| | | systemUser.setUsername(systemUser.getMobile()); |
| | | SystemUser queryUserDto = new SystemUser(); |
| | | queryUserDto.setUsername(systemUser.getUsername()); |
| | | queryUserDto.setDeleted(Boolean.FALSE); |
| | | SystemUser user = systemUserService.findOne(queryUserDto); |
| | | if (user != null) { |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "电话【"+systemUser.getUsername()+"】不能重复"); |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "用户名【"+systemUser.getUsername()+"】不能重复"); |
| | | } |
| | | // 验证工号 |
| | | if (StringUtils.isNotBlank(systemUser.getEmpNo())) { |
| | |
| | | // 生成密码盐 |
| | | String salt = RandomStringUtils.randomAlphabetic(6); |
| | | // 生成密码 |
| | | systemUser.setPassword(Utils.Secure.encryptPassword(systemUser.getMobile().substring(5), salt)); |
| | | systemUser.setPassword(Utils.Secure.encryptPassword(systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.INITIAL_PASSWORD).getCode(), salt)); |
| | | systemUser.setSalt(salt); |
| | | |
| | | // 创建用户记录 |