From 101192fd84bb38911ea7bc84c21cfe2b9ba378c7 Mon Sep 17 00:00:00 2001 From: ZQN <364596817@qq.com> Date: 星期二, 25 六月 2024 14:25:30 +0800 Subject: [PATCH] 审批修改 --- project-admin/src/main/java/com/project/admin/controller/system/SysProfileController.java | 38 +++++++++++++++++++++++++++++++++++--- 1 files changed, 35 insertions(+), 3 deletions(-) diff --git a/project-admin/src/main/java/com/project/admin/controller/system/SysProfileController.java b/project-admin/src/main/java/com/project/admin/controller/system/SysProfileController.java index f36229a..b8559d2 100644 --- a/project-admin/src/main/java/com/project/admin/controller/system/SysProfileController.java +++ b/project-admin/src/main/java/com/project/admin/controller/system/SysProfileController.java @@ -48,7 +48,7 @@ @GetMapping public AjaxResult profile() { - SysUser user = SecurityUtils.getLoginUser().getUser(); + SysUser user = userService.selectUserById(SecurityUtils.getLoginUser().getUserId()); if ("02".equals(user.getUserType())){ SysCompany company = companyService.getById(userService.getById(user.getUserId()).getDeptId()); SysDept sysDept = new SysDept(); @@ -56,8 +56,10 @@ user.setDept(sysDept); } else { SysDept sysDept = deptService.selectDeptById(userService.getById(user.getUserId()).getDeptId()); - sysDept.setDeptName(deptService.getDeptAllName(sysDept.getDeptId())); - user.setDept(sysDept); + if (sysDept!=null){ + sysDept.setDeptName(deptService.getDeptAllName(sysDept.getDeptId())); + user.setDept(sysDept); + } } // 瑙掕壊闆嗗悎 @@ -101,6 +103,7 @@ return error("淇敼涓汉淇℃伅寮傚父锛岃鑱旂郴绠$悊鍛�"); } + /** * 閲嶇疆瀵嗙爜 */ @@ -130,6 +133,35 @@ } /** + * 鏇存崲鎵嬫満鍙� + */ + @Log(title = "鏇存崲鎵嬫満鍙�", businessType = BusinessType.UPDATE) + @PostMapping("/updatePhone/{phone}") + public AjaxResult updatePhone(@PathVariable String phone) + { + if (StringUtils.isEmpty(phone)){ + return error("璇峰~鍐欐墜鏈哄彿"); + } + LoginUser loginUser = SecurityUtils.getLoginUser(); + SysUser user = loginUser.getUser(); + user.setPhonenumber(phone); + if (StringUtils.isNotEmpty(user.getPhonenumber()) + && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) + { + return error("淇敼鐢ㄦ埛'" + user.getUserName() + "'澶辫触锛屾墜鏈哄彿鐮佸凡瀛樺湪"); + } + if (userService.resetPhone(user.getUserId(), phone) > 0) + { + // 鏇存柊缂撳瓨 + loginUser.getUser().setUserName(phone); + loginUser.getUser().setPhonenumber(phone); + tokenService.setLoginUser(loginUser); + return success(); + } + return error("淇敼瀵嗙爜寮傚父锛岃鑱旂郴绠$悊鍛�"); + } + + /** * 澶村儚涓婁紶 */ @Log(title = "鐢ㄦ埛澶村儚", businessType = BusinessType.UPDATE) -- Gitblit v1.9.1