From 0bc2775e4fd776086c508fd7640bc3d61835cf73 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期一, 27 四月 2026 15:57:54 +0800
Subject: [PATCH] feat(ai): 添加审批待办助手功能
---
src/main/java/com/ruoyi/project/system/controller/SysProfileController.java | 31 ++++++++++++++-----------------
1 files changed, 14 insertions(+), 17 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 31cea2f..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,14 +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.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUploadUtils;
@@ -22,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;
/**
* 涓汉淇℃伅 涓氬姟澶勭悊
@@ -30,12 +26,10 @@
*/
@RestController
@RequestMapping("/system/user/profile")
+@AllArgsConstructor
public class SysProfileController extends BaseController
{
- @Autowired
private ISysUserService userService;
-
- @Autowired
private TokenService tokenService;
/**
@@ -67,11 +61,11 @@
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()) && !userService.checkEmailUnique(currentUser))
{
- return error("淇敼鐢ㄦ埛'" + user.getUserName() + "'澶辫触锛岄偖绠辫处鍙峰凡瀛樺湪");
+ return error("淇敼鐢ㄦ埛'" + loginUser.getUsername() + "'澶辫触锛岄偖绠辫处鍙峰凡瀛樺湪");
}
if (userService.updateUserProfile(currentUser) > 0)
{
@@ -87,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();
@@ -100,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