| | |
| | | |
| | | // 校验是否已存在 |
| | | checkUserInfo(u.getUsername(), u.getMobile(), u.getEmail()); |
| | | |
| | | u.setDescription(u.getPassword()); |
| | | String encryptPass = new BCryptPasswordEncoder().encode(u.getPassword()); |
| | | u.setPassword(encryptPass); |
| | | if (StrUtil.isNotBlank(u.getDepartmentId())) { |
| | |
| | | if (!old.getMobile().equals(u.getMobile()) && userService.findByMobile(u.getMobile()) != null) { |
| | | return ResultUtil.error("该手机号已绑定其他账户"); |
| | | } |
| | | if (!old.getEmail().equals(u.getEmail()) && userService.findByEmail(u.getEmail()) != null) { |
| | | return ResultUtil.error("该邮箱已绑定其他账户"); |
| | | } |
| | | // if (!old.getEmail().equals(u.getEmail()) && userService.findByEmail(u.getEmail()) != null) { |
| | | // return ResultUtil.error("该邮箱已绑定其他账户"); |
| | | // } |
| | | |
| | | if (StrUtil.isNotBlank(u.getDepartmentId())) { |
| | | Department d = departmentService.get(u.getDepartmentId()); |
| | |
| | | throw new XbootException("该手机号已被注册"); |
| | | } |
| | | } |
| | | |
| | | @RequestMapping(value = "/findByType2", method = RequestMethod.GET) |
| | | @ApiOperation(value = "获取全部用户数据") |
| | | public Result<List<User>> findByType2(int type) { |
| | | |
| | | List<User> list = userService.findByType2(type); |
| | | // 清除持久上下文环境 避免后面语句导致持久化 |
| | | List<User> list1 = new ArrayList<User>(); |
| | | entityManager.clear(); |
| | | for (User u : list) { |
| | | u.setPassword(null); |
| | | if (u.getType()==0){ |
| | | list1.add(u); |
| | | } |
| | | } |
| | | return new ResultUtil<List<User>>().setData(list1); |
| | | } |
| | | } |