|
@@ -5,6 +5,9 @@ import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+
|
|
|
+import com.ruoyi.common.constant.CacheConstants;
|
|
|
+import com.ruoyi.common.core.redis.RedisCache;
|
|
|
import org.apache.commons.lang3.ArrayUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
@@ -50,6 +53,8 @@ public class SysUserController extends BaseController
|
|
|
|
|
|
@Autowired
|
|
|
private ISysPostService postService;
|
|
|
+ @Autowired
|
|
|
+ private RedisCache redisCache;
|
|
|
|
|
|
/**
|
|
|
* 获取用户列表
|
|
@@ -215,7 +220,7 @@ public class SysUserController extends BaseController
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('system:user:edit')")
|
|
|
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
|
|
- @PutMapping
|
|
|
+ @PostMapping("/put")
|
|
|
public AjaxResult edit(@Validated @RequestBody SysUser user)
|
|
|
{
|
|
|
userService.checkUserAllowed(user);
|
|
@@ -243,7 +248,7 @@ public class SysUserController extends BaseController
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('system:user:remove')")
|
|
|
@Log(title = "用户管理", businessType = BusinessType.DELETE)
|
|
|
- @DeleteMapping("/{userIds}")
|
|
|
+ @GetMapping("/delete/{userIds}")
|
|
|
public AjaxResult remove(@PathVariable Long[] userIds)
|
|
|
{
|
|
|
if (ArrayUtils.contains(userIds, getUserId()))
|
|
@@ -258,7 +263,7 @@ public class SysUserController extends BaseController
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('system:user:resetPwd')")
|
|
|
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
|
|
- @PutMapping("/resetPwd")
|
|
|
+ @PostMapping("/resetPwd")
|
|
|
public AjaxResult resetPwd(@RequestBody SysUser user)
|
|
|
{
|
|
|
userService.checkUserAllowed(user);
|
|
@@ -271,6 +276,47 @@ public class SysUserController extends BaseController
|
|
|
return toAjax(userService.resetPwd(user));
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 重置密码app
|
|
|
+ */
|
|
|
+ @PostMapping("/resetPwdAPP")
|
|
|
+ public AjaxResult resetPwdAPP(@RequestBody SysUser user)
|
|
|
+ {
|
|
|
+ String verifyKey = CacheConstants.SMS_CODE_KEY + user.getPhonenumber();
|
|
|
+
|
|
|
+ String codeApp = redisCache.getCacheObject(verifyKey);
|
|
|
+ if (StringUtils.isBlank(codeApp)){
|
|
|
+ return AjaxResult.error("短信验证码已过期");
|
|
|
+ }
|
|
|
+ String code = user.getCode();
|
|
|
+ if (!codeApp.equals(code)){
|
|
|
+ return AjaxResult.error("验证码不正确");
|
|
|
+ }
|
|
|
+ if ("1".equals(checkStrongPwd(user.getPassword()))) {
|
|
|
+ return AjaxResult.error("密码必须包含数字、大小写字母、特殊符号且大于8位");
|
|
|
+ }
|
|
|
+ user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
|
|
+ return toAjax(userService.resetPwd(user));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改用户手机号
|
|
|
+ */
|
|
|
+ @PostMapping("/updatePhone")
|
|
|
+ public AjaxResult updatePhone(@RequestBody SysUser user)
|
|
|
+ {
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(user.getPhonenumber())
|
|
|
+ && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
|
|
+ {
|
|
|
+ return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
|
|
+ }
|
|
|
+ user.setUpdateBy(getUsername());
|
|
|
+ return toAjax(userService.updateUser(user));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 状态修改
|
|
|
*/
|