| | |
| | | public class SysUserController { |
| | | private static final String ADMIN_CHANGE_MSG = "超级管理员不给予修改"; |
| | | |
| | | |
| | | /** |
| | | * 全文搜索逻辑删除Dto |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 管理后台,给用户重置密码 |
| | | * |
| | | *重置密码后,会将新密码返回到data字段。 |
| | | * @param id |
| | | */ |
| | | @PutMapping(value = "/users/{id}/password") |
| | |
| | | if (checkAdmin(id)) { |
| | | return ResultBody.failed(ADMIN_CHANGE_MSG); |
| | | } |
| | | appUserService.updatePassword(id, null, null); |
| | | return ResultBody.ok().msg("重置成功"); |
| | | return appUserService.updatePassword(id, null, null,true); |
| | | } |
| | | |
| | | /** |
| | |
| | | if (checkAdmin(sysUser.getId())) { |
| | | return ResultBody.failed().msg(ADMIN_CHANGE_MSG); |
| | | } |
| | | appUserService.updatePassword(sysUser.getId(), sysUser.getOldPassword(), sysUser.getNewPassword()); |
| | | return ResultBody.ok().msg("重置成功"); |
| | | appUserService.updatePassword(sysUser.getId(), sysUser.getOldPassword(), sysUser.getNewPassword(),false); |
| | | return ResultBody.ok().data(true).msg("密码重置成功"); |
| | | } |
| | | /** |
| | | * 用户自己修改密码-后端以外 |
| | | */ |
| | | @PutMapping(value = "/users/resetpassword") |
| | | public ResultBody resetClientPassword(@RequestParam Map<String, Object> params) { |
| | | Long id=MapUtils.getLong(params, "id"); |
| | | String oldPassword=MapUtils.getString(params,"oldPassword"); |
| | | String newPassword=MapUtils.getString(params,"newPassword"); |
| | | String refPassword=MapUtils.getString(params,"refPassword"); |
| | | if (id>0&&!oldPassword.isEmpty()&&!newPassword.isEmpty()&&!refPassword.isEmpty()) { |
| | | if (refPassword.equals(newPassword)) { |
| | | return appUserService.updatePassword(id,oldPassword,newPassword,false).data(true).msg("密码修改成功!"); |
| | | } |
| | | else |
| | | { |
| | | return ResultBody.failed("两次新密码输入不一致!").data(false); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return ResultBody.failed("必须参数有误!").data(false); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 用户修改自己的手机号 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | @PutMapping(value="/users/updateusertel") |
| | | public ResultBody updateUserTel(@RequestParam Map<String,Object> params) |
| | | { |
| | | return appUserService.updateUserTel(params); |
| | | } |
| | | /** |
| | | * 删除用户 |
| | | * |
| | |
| | | return ResultBody.failed(ADMIN_CHANGE_MSG); |
| | | } |
| | | appUserService.delUser(id); |
| | | return ResultBody.ok().msg("删除成功"); |
| | | return ResultBody.ok().msg("删除成功").data(true); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 是否超级管理员 |
| | | * 根据map查询 |
| | | */ |
| | | private boolean checkAdmin(long id) { |
| | | return id == 1L; |
| | | } |
| | | @PostMapping("/users/findAll") |
| | | public ResultBody findAll(@RequestParam Map<String,Object> map) { |
| | | public ResultBody findAll( @RequestBody Map<String,Object> map) { |
| | | return appUserService.findAll(map); |
| | | } |
| | | |
| | | /** |
| | | * 根据map查询 总个数 |
| | | * @param map |
| | | * @return |
| | | */ |
| | | @PostMapping("/users/findCountByMap") |
| | | public ResultBody findCountByMap( @RequestBody Map<String,Object> map) { |
| | | return appUserService.findCountByMap(map); |
| | | } |
| | | /** |
| | | * 获取当前用的 组织下的所有人员 |
| | | */ |
| | | @GetMapping("users/getThisUserOrganizationUser") |
| | | public ResultBody getThisUserOrganizationUser(HttpServletRequest request){ |
| | | return appUserService.getThisUserOrganizationUser(request); |
| | | } |
| | | /** |
| | | * 通过手机修改密码 |
| | | */ |
| | | @PutMapping(value = "/users/passwordByPhone") |
| | | public ResultBody passwordByPhone(@RequestBody Map<String,Object> map) { |
| | | return appUserService.passwordByPhone(map); |
| | | } |
| | | /** |
| | | * 通过手机号注册 新用户 |
| | | */ |
| | | @PutMapping(value = "/users/registerByPhone") |
| | | public ResultBody registerByPhone(@RequestBody Map<String,Object> map) { |
| | | return appUserService.registerByPhone(map); |
| | | } |
| | | /** |
| | | * 更换手机号 |
| | | */ |
| | | @PutMapping(value = "/users/updatePhone") |
| | | public ResultBody updatePhone(@RequestBody Map<String,Object> map, @LoginUser SysUser sysUser) { |
| | | return appUserService.updatePhone(map,sysUser); |
| | | } |
| | | |
| | | /** |
| | | * 获取指定用户信息(销售人员和服务人员) |
| | | */ |
| | | @GetMapping("users/getAppointUser") |
| | | public ResultBody getAppointUser(){ |
| | | String type = request.getParameter("type"); |
| | | |
| | | return appUserService.findAppointUsers(Integer.parseInt(type)); |
| | | } |
| | | } |