From 6b908076f80a2c2933058caf5311ae2dc9048409 Mon Sep 17 00:00:00 2001
From: liyong <18434998025@163.com>
Date: 星期二, 28 四月 2026 15:20:52 +0800
Subject: [PATCH] feat(approve): 更新审批流程配置节点查询逻辑
---
src/main/java/com/ruoyi/project/system/controller/SysProfileController.java | 55 ++++++++++++++++++++++---------------------------------
1 files changed, 22 insertions(+), 33 deletions(-)
diff --git a/src/main/java/com/ruoyi/project/system/controller/SysProfileController.java b/src/main/java/com/ruoyi/project/system/controller/SysProfileController.java
index 584f913..62f6db5 100644
--- a/src/main/java/com/ruoyi/project/system/controller/SysProfileController.java
+++ b/src/main/java/com/ruoyi/project/system/controller/SysProfileController.java
@@ -1,15 +1,5 @@
package com.ruoyi.project.system.controller;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.multipart.MultipartFile;
-import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUploadUtils;
@@ -23,6 +13,11 @@
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.project.system.domain.SysUser;
import com.ruoyi.project.system.service.ISysUserService;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.Map;
/**
* 涓汉淇℃伅 涓氬姟澶勭悊
@@ -31,12 +26,10 @@
*/
@RestController
@RequestMapping("/system/user/profile")
+@AllArgsConstructor
public class SysProfileController extends BaseController
{
- @Autowired
private ISysUserService userService;
-
- @Autowired
private TokenService tokenService;
/**
@@ -61,29 +54,22 @@
public AjaxResult updateProfile(@RequestBody SysUser user)
{
LoginUser loginUser = getLoginUser();
- SysUser sysUser = loginUser.getUser();
- user.setUserName(sysUser.getUserName());
- if (StringUtils.isNotEmpty(user.getPhonenumber())
- && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
+ SysUser currentUser = loginUser.getUser();
+ currentUser.setNickName(user.getNickName());
+ currentUser.setEmail(user.getEmail());
+ currentUser.setPhonenumber(user.getPhonenumber());
+ currentUser.setSex(user.getSex());
+ if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(currentUser))
{
- return error("淇敼鐢ㄦ埛'" + user.getUserName() + "'澶辫触锛屾墜鏈哄彿鐮佸凡瀛樺湪");
+ return error("淇敼鐢ㄦ埛'" + loginUser.getUsername() + "'澶辫触锛屾墜鏈哄彿鐮佸凡瀛樺湪");
}
- if (StringUtils.isNotEmpty(user.getEmail())
- && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
+ if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(currentUser))
{
- return error("淇敼鐢ㄦ埛'" + user.getUserName() + "'澶辫触锛岄偖绠辫处鍙峰凡瀛樺湪");
+ return error("淇敼鐢ㄦ埛'" + loginUser.getUsername() + "'澶辫触锛岄偖绠辫处鍙峰凡瀛樺湪");
}
- user.setUserId(sysUser.getUserId());
- user.setPassword(null);
- user.setAvatar(null);
- user.setDeptId(null);
- if (userService.updateUserProfile(user) > 0)
+ if (userService.updateUserProfile(currentUser) > 0)
{
// 鏇存柊缂撳瓨鐢ㄦ埛淇℃伅
- sysUser.setNickName(user.getNickName());
- sysUser.setPhonenumber(user.getPhonenumber());
- sysUser.setEmail(user.getEmail());
- sysUser.setSex(user.getSex());
tokenService.setLoginUser(loginUser);
return success();
}
@@ -95,8 +81,10 @@
*/
@Log(title = "涓汉淇℃伅", businessType = BusinessType.UPDATE)
@PutMapping("/updatePwd")
- public AjaxResult updatePwd(String oldPassword, String newPassword)
+ public AjaxResult updatePwd(@RequestBody Map<String, String> params)
{
+ String oldPassword = params.get("oldPassword");
+ String newPassword = params.get("newPassword");
LoginUser loginUser = getLoginUser();
String userName = loginUser.getUsername();
String password = loginUser.getPassword();
@@ -108,10 +96,11 @@
{
return error("鏂板瘑鐮佷笉鑳戒笌鏃у瘑鐮佺浉鍚�");
}
- if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0)
+ newPassword = SecurityUtils.encryptPassword(newPassword);
+ if (userService.resetUserPwd(userName, newPassword) > 0)
{
// 鏇存柊缂撳瓨鐢ㄦ埛瀵嗙爜
- loginUser.getUser().setPassword(SecurityUtils.encryptPassword(newPassword));
+ loginUser.getUser().setPassword(newPassword);
tokenService.setLoginUser(loginUser);
return success();
}
--
Gitblit v1.9.3