wujianwei
2026-03-27 0a69362d963973cf3ac6a1a49a15091b075209d8
admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
@@ -4,6 +4,8 @@
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.Sm4Utils;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -55,6 +57,8 @@
    @Autowired
    private ISysPostService postService;
    @Autowired
    RedisCache redisCache;
    /**
     * 获取用户列表
     */
@@ -140,6 +144,13 @@
        {
            return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
        }
        if (user.getIsDriver() == 0  && !userService.checkDriverUnique(user)){
            return error("新增用户'" + user.getUserName() + "'失败,驾驶员已绑定其他账户");
        }else{
            user.setDriverId(null);
        }
        user.setCreateBy(getUsername());
        user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
        return toAjax(userService.insertUser(user));
@@ -169,6 +180,11 @@
        {
            return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
        }
        if (user.getIsDriver() == 0  && !userService.checkDriverUnique(user)){
            return error("新增用户'" + user.getUserName() + "'失败,驾驶员已绑定其他账户");
        }
        user.setUpdateBy(getUsername());
        return toAjax(userService.updateUser(user));
    }
@@ -233,6 +249,15 @@
        return ajax;
    }
  @PreAuthorize("@ss.hasPermi('system:user:edit')")
    @GetMapping("/unLockUser/{userName}")
    public AjaxResult unLockUser(@PathVariable("userName") String userName)
    {
        redisCache.deleteObject(CacheConstants.PWD_ERR_CNT_KEY + userName);
        return AjaxResult.success();
    }
    /**
     * 用户授权角色
     */