稳定版本
parent
7f37b816a8
commit
d3da757767
|
@ -76,8 +76,7 @@ public class SysLoginService {
|
||||||
throw new ServiceException("很遗憾,访问IP已被列入系统黑名单");
|
throw new ServiceException("很遗憾,访问IP已被列入系统黑名单");
|
||||||
}
|
}
|
||||||
// 查询用户信息
|
// 查询用户信息
|
||||||
Result<SysUser> userResult = remoteSaasService.getUserInfo(firmCode, username, SecurityConstants.INNER);
|
Result<LoginUser> userResult = remoteUserService.getUserInfo(firmCode, username, SecurityConstants.INNER);
|
||||||
|
|
||||||
if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData())) {
|
if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData())) {
|
||||||
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "登录用户不存在");
|
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "登录用户不存在");
|
||||||
throw new ServiceException("登录用户:" + username + " 不存在");
|
throw new ServiceException("登录用户:" + username + " 不存在");
|
||||||
|
@ -87,7 +86,8 @@ public class SysLoginService {
|
||||||
throw new ServiceException(userResult.getMsg());
|
throw new ServiceException(userResult.getMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
SysUser user = userResult.getData();
|
LoginUser loginUser = userResult.getData();
|
||||||
|
SysUser user = loginUser.getSysUser();
|
||||||
if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) {
|
if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) {
|
||||||
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "对不起,您的账号已被删除");
|
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "对不起,您的账号已被删除");
|
||||||
throw new ServiceException("对不起,您的账号:" + username + " 已被删除");
|
throw new ServiceException("对不起,您的账号:" + username + " 已被删除");
|
||||||
|
@ -99,15 +99,7 @@ public class SysLoginService {
|
||||||
passwordService.validate(user, password);
|
passwordService.validate(user, password);
|
||||||
recordLogService.recordLogininfor(username, Constants.LOGIN_SUCCESS, "登录成功");
|
recordLogService.recordLogininfor(username, Constants.LOGIN_SUCCESS, "登录成功");
|
||||||
|
|
||||||
// 角色集合
|
return loginUser;
|
||||||
Set<String> roles = remoteUserService.getRolePermission(user);
|
|
||||||
// 权限集合
|
|
||||||
Set<String> permissions = remoteUserService.getMenuPermission(user);
|
|
||||||
LoginUser sysUserVo = new LoginUser();
|
|
||||||
sysUserVo.setSysUser(user);
|
|
||||||
sysUserVo.setRoles(roles);
|
|
||||||
sysUserVo.setPermissions(permissions);
|
|
||||||
return sysUserVo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void logout (String loginName) {
|
public void logout (String loginName) {
|
||||||
|
|
|
@ -22,7 +22,7 @@ public interface RemoteSaasService {
|
||||||
* 通过用户名查询用户信息
|
* 通过用户名查询用户信息
|
||||||
*
|
*
|
||||||
* @param firmCode
|
* @param firmCode
|
||||||
* @param username 用户名
|
* @param userName 用户名
|
||||||
* @param source 请求来源
|
* @param source 请求来源
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -3,11 +3,9 @@ package com.muyu.common.system.remote;
|
||||||
import com.muyu.common.core.constant.SecurityConstants;
|
import com.muyu.common.core.constant.SecurityConstants;
|
||||||
import com.muyu.common.core.constant.ServiceNameConstants;
|
import com.muyu.common.core.constant.ServiceNameConstants;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.core.web.page.TableDataInfo;
|
|
||||||
import com.muyu.common.system.domain.*;
|
import com.muyu.common.system.domain.*;
|
||||||
import com.muyu.common.system.remote.factory.RemoteUserFallbackFactory;
|
import com.muyu.common.system.remote.factory.RemoteUserFallbackFactory;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -38,6 +36,18 @@ public interface RemoteUserService {
|
||||||
@PostMapping("/ent/list")
|
@PostMapping("/ent/list")
|
||||||
public Result<List<SysEnt>> list (@RequestBody SysEnt sysEnt);
|
public Result<List<SysEnt>> list (@RequestBody SysEnt sysEnt);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过用户名查询用户信息
|
||||||
|
*
|
||||||
|
* @param firmCode
|
||||||
|
* @param userName 用户名
|
||||||
|
* @param source 请求来源
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@GetMapping("/user/info")
|
||||||
|
public Result<LoginUser> getUserInfo (@RequestParam("firmCode") String firmCode, @RequestParam("userName") String userName, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取角色数据权限
|
* 获取角色数据权限
|
||||||
*
|
*
|
||||||
|
|
|
@ -41,6 +41,11 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
|
||||||
return Result.error("获取企业列表失败:" + throwable.getMessage());
|
return Result.error("获取企业列表失败:" + throwable.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<LoginUser> getUserInfo(String firmCode, String userName, String source) {
|
||||||
|
return Result.error("获取用户信息失败:" + throwable.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<String> getRolePermission(SysUser user) {
|
public Set<String> getRolePermission(SysUser user) {
|
||||||
return Set.of();
|
return Set.of();
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class SysUserController extends BaseController {
|
||||||
* @param user 条件
|
* @param user 条件
|
||||||
* @return 集合
|
* @return 集合
|
||||||
*/
|
*/
|
||||||
@PostMapping("/list")
|
@GetMapping("/list")
|
||||||
public Result<TableDataInfo<SysUser>> list(SysUser user){
|
public Result<TableDataInfo<SysUser>> list(SysUser user){
|
||||||
startPage();
|
startPage();
|
||||||
return getDataTable(userService.selectUserList(user));
|
return getDataTable(userService.selectUserList(user));
|
||||||
|
|
|
@ -12,6 +12,7 @@ import com.muyu.common.system.domain.SysUserRole;
|
||||||
import com.muyu.common.system.remote.RemoteUserService;
|
import com.muyu.common.system.remote.RemoteUserService;
|
||||||
import com.muyu.system.saas.mapper.SysUserPostMapper;
|
import com.muyu.system.saas.mapper.SysUserPostMapper;
|
||||||
import com.muyu.system.saas.mapper.SysUserRoleMapper;
|
import com.muyu.system.saas.mapper.SysUserRoleMapper;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
@ -106,9 +107,28 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser>
|
||||||
@Override
|
@Override
|
||||||
public List<SysUser> selectUserList(SysUser user) {
|
public List<SysUser> selectUserList(SysUser user) {
|
||||||
LambdaQueryWrapper<SysUser> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<SysUser> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.like(
|
queryWrapper
|
||||||
StringUtils.isNotEmpty(user.getUserName()),
|
.like(
|
||||||
SysUser::getUserName, user.getUserName());
|
StringUtils.isNotEmpty(user.getUserName()),
|
||||||
|
SysUser::getUserName, user.getUserName())
|
||||||
|
.eq(
|
||||||
|
StringUtils.isNotEmpty(user.getStatus()),
|
||||||
|
SysUser::getStatus, user.getStatus())
|
||||||
|
.eq(
|
||||||
|
StringUtils.isNotEmpty(user.getFirmCode()),
|
||||||
|
SysUser::getFirmCode, user.getFirmCode())
|
||||||
|
.eq(
|
||||||
|
ObjectUtils.isNotEmpty(user.getDeptId()),
|
||||||
|
SysUser::getDeptId, user.getDeptId())
|
||||||
|
.like(
|
||||||
|
StringUtils.isNotEmpty(user.getNickName()),
|
||||||
|
SysUser::getNickName, user.getNickName())
|
||||||
|
.like(
|
||||||
|
StringUtils.isNotEmpty(user.getEmail()),
|
||||||
|
SysUser::getEmail, user.getEmail())
|
||||||
|
.like(
|
||||||
|
StringUtils.isNotEmpty(user.getPhonenumber()),
|
||||||
|
SysUser::getPhonenumber, user.getPhonenumber());
|
||||||
return this.list(queryWrapper);
|
return this.list(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,10 +31,12 @@ import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户信息
|
* sys用户控制器
|
||||||
*
|
*
|
||||||
* @author muyu
|
* @author 胡杨
|
||||||
|
* @date 2024/09/25
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/user")
|
@RequestMapping("/user")
|
||||||
|
@ -69,6 +71,9 @@ public class SysUserController extends BaseController {
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公司集合
|
||||||
|
*/
|
||||||
@GetMapping("/companyList")
|
@GetMapping("/companyList")
|
||||||
public Result<List<SysUser>> companyList () {
|
public Result<List<SysUser>> companyList () {
|
||||||
List<SysUser> list = userService.selectCompanyList();
|
List<SysUser> list = userService.selectCompanyList();
|
||||||
|
@ -106,8 +111,8 @@ public class SysUserController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@InnerAuth
|
@InnerAuth
|
||||||
@GetMapping("/info")
|
@GetMapping("/info")
|
||||||
public Result<LoginUser> info (@RequestParam("firmCode") String firmCode,@RequestParam("username") String username) {
|
public Result<LoginUser> info (@RequestParam("firmCode") String firmCode,@RequestParam("userName") String userName) {
|
||||||
SysUser sysUser = userService.selectUserByUserName(firmCode,username);
|
SysUser sysUser = userService.selectUserByUserName(firmCode, userName);
|
||||||
if (StringUtils.isNull(sysUser)) {
|
if (StringUtils.isNull(sysUser)) {
|
||||||
return Result.error("用户名或密码错误");
|
return Result.error("用户名或密码错误");
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,10 @@ import com.muyu.system.domain.SysConfig;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 系统配置服务
|
||||||
|
*
|
||||||
* @author DongZl
|
* @author DongZl
|
||||||
* @description: 配置plus业务层
|
* @date 2024/09/25
|
||||||
* @Date 2023-11-13 上午 10:06
|
|
||||||
*/
|
*/
|
||||||
public interface SysConfigService extends IService<SysConfig> {
|
public interface SysConfigService extends IService<SysConfig> {
|
||||||
List<SysConfig> pageQuery (SysConfig config);
|
List<SysConfig> pageQuery (SysConfig config);
|
||||||
|
|
Loading…
Reference in New Issue