1550076451 il y a 2 ans
Parent
commit
428d273d72

+ 22 - 1
zxkf-api/src/main/java/api/controller/system/UserController.java

@@ -2,6 +2,7 @@ package api.controller.system;
2 2
 
3 3
 import api.entity.database.system.UserExtension;
4 4
 import api.entity.view.call.CallLogView;
5
+import api.entity.view.system.UserView;
5 6
 import api.service.system.IUserExtensionService;
6 7
 import api.util.annotation.Anonymous;
7 8
 import com.alibaba.fastjson2.JSON;
@@ -23,6 +24,7 @@ import api.util.enums.BusinessType;
23 24
 import api.util.helper.*;
24 25
 import io.swagger.annotations.Api;
25 26
 import io.swagger.annotations.ApiOperation;
27
+import lombok.var;
26 28
 import org.springframework.beans.factory.annotation.Autowired;
27 29
 import org.springframework.data.redis.core.StringRedisTemplate;
28 30
 import org.springframework.web.bind.annotation.*;
@@ -187,7 +189,26 @@ public class UserController extends BaseController {
187 189
         }
188 190
         return Error("修改失败!");
189 191
     }
190
-
192
+    /**
193
+     * 重置密码
194
+     */
195
+    @ApiOperation("重置密码")
196
+    @Log(title = "重置密码", businessType = BusinessType.OTHER)
197
+    @PutMapping("/UpdatePwd")
198
+    public AjaxResult UpdatePwd(String oldPwd ,String Pwd) {
199
+        UserView currentUser=CurrentUser();
200
+        if (!currentUser.getPassword().equals(SecretHelper.MD5(oldPwd)))
201
+        {
202
+            return Error("旧密码不正确");
203
+        }
204
+        var  entity=userService.getEntity(currentUser.getUserId());
205
+        String password = SecretHelper.MD5(Pwd);
206
+        entity.setPassword(password);
207
+        if (userService.update(entity)) {
208
+            return Success("修改成功!");
209
+        }
210
+        return Error("修改失败!");
211
+    }
191 212
     /**
192 213
      * 修改状态
193 214
      *