huangyao 2021-01-12 12:53:19 +08:00
commit 3c25754381
26 changed files with 843 additions and 499 deletions

View File

@ -46,4 +46,22 @@ public enum SexEnum {
}
return null;
}
/**
*
*
* @author fengshuonan
* @date 2021/1/11 22:34
*/
public static String codeToMessage(String code) {
if (null != code) {
for (SexEnum e : SexEnum.values()) {
if (e.getCode().equals(code)) {
return e.getMessage();
}
}
}
return "未知";
}
}

View File

@ -0,0 +1,28 @@
package cn.stylefeng.roses.kernel.rule.util;
import java.net.InetAddress;
import java.net.UnknownHostException;
/**
* IP
*
* @author fengshuonan
* @date 2021/1/10 14:25
*/
public class IpInfoUtils {
/**
* hostname
*
* @author fengshuonan
* @date 2021/1/10 18:40
*/
public static String getHostName() {
try {
return InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException ignored) {
return "未知";
}
}
}

View File

@ -7,6 +7,7 @@ import cn.stylefeng.roses.kernel.auth.api.pojo.login.basic.SimpleUserInfo;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Set;
@ -73,6 +74,16 @@ public class LoginUser implements Serializable {
*/
private Set<String> buttonCodes;
/**
*
*/
private Date loginTime;
/**
* tokentoken
*/
private String token;
/**
* DictMap
*/

View File

@ -10,10 +10,7 @@ import cn.stylefeng.roses.kernel.rule.util.HttpServletUtil;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.*;
/**
* redis
@ -182,7 +179,17 @@ public class DefaultSessionManager implements SessionManagerApi {
@Override
public List<LoginUser> onlineUserList() {
return new ArrayList<>(loginUserCache.getAllValues());
Map<String, LoginUser> allKeyValues = loginUserCache.getAllKeyValues();
ArrayList<LoginUser> loginUsers = new ArrayList<>();
for (Map.Entry<String, LoginUser> userEntry : allKeyValues.entrySet()) {
String token = userEntry.getKey();
LoginUser loginUser = userEntry.getValue();
loginUser.setToken(token);
loginUsers.add(loginUser);
}
return loginUsers;
}
}

File diff suppressed because one or more lines are too long

View File

@ -1,9 +1,10 @@
package cn.stylefeng.roses.kernel.system;
import cn.stylefeng.roses.kernel.system.pojo.user.OnlineUserResponse;
import cn.stylefeng.roses.kernel.system.pojo.user.SysUserDTO;
import cn.stylefeng.roses.kernel.auth.api.pojo.login.LoginUser;
import cn.stylefeng.roses.kernel.system.pojo.user.SysUserResponse;
import cn.stylefeng.roses.kernel.system.pojo.user.UserLoginInfoDTO;
import cn.stylefeng.roses.kernel.system.pojo.user.request.OnlineUserRequest;
import cn.stylefeng.roses.kernel.system.pojo.user.request.SysUserRequest;
import java.util.Date;
@ -83,7 +84,7 @@ public interface UserServiceApi {
* @author fengshuonan
* @date 2021/1/10 9:56
*/
List<LoginUser> onlineUserList();
List<OnlineUserResponse> onlineUserList(OnlineUserRequest onlineUserRequest);
/**
* ID
@ -104,8 +105,6 @@ public interface UserServiceApi {
*/
List<Long> queryAllUserIdList(SysUserRequest sysUserRequest);
/**
*
*

View File

@ -1,7 +1,10 @@
package cn.stylefeng.roses.kernel.system.pojo.menu.layui;
import cn.stylefeng.roses.kernel.rule.abstracts.AbstractTreeNode;
import lombok.Data;
import java.util.List;
/**
*
*
@ -9,7 +12,7 @@ import lombok.Data;
* @date 2021/1/9 16:59
*/
@Data
public class LayuiMenuAndButtonTreeResponse {
public class LayuiMenuAndButtonTreeResponse implements AbstractTreeNode {
/**
* ID
@ -41,4 +44,23 @@ public class LayuiMenuAndButtonTreeResponse {
*/
private String buttonCode;
/**
*
*/
private List children;
@Override
public String getNodeId() {
return this.id.toString();
}
@Override
public String getNodeParentId() {
return this.pid.toString();
}
@Override
public void setChildrenNodes(List childrenNodes) {
this.children = childrenNodes;
}
}

View File

@ -0,0 +1,57 @@
package cn.stylefeng.roses.kernel.system.pojo.user;
import lombok.Data;
import java.util.Date;
/**
* 线
*
* @author fengshuonan
* @date 2021/1/11 22:30
*/
@Data
public class OnlineUserResponse {
/**
* token
*/
private String token;
/**
*
*/
private Long userId;
/**
*
*/
private String account;
/**
*
*/
private String nickName;
/**
*
*/
private String realName;
/**
*
*/
private String sex;
/**
*
*/
private String roleName;
/**
*
*/
private Date loginTime;
}

View File

@ -0,0 +1,28 @@
package cn.stylefeng.roses.kernel.system.pojo.user.request;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* 线
*
* @author fengshuonan
* @date 2021/1/11 22:30
*/
@Data
public class OnlineUserRequest {
/**
* token
*/
@NotBlank(message = "参数token不能为空")
private String token;
/**
*
*/
private String account;
}

View File

@ -1,6 +1,13 @@
package cn.stylefeng.roses.kernel.system.pojo.ztree;
import cn.stylefeng.roses.kernel.rule.abstracts.AbstractTreeNode;
import cn.stylefeng.roses.kernel.system.constants.SystemConstants;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.util.List;
/**
* jquery ztree
@ -8,11 +15,15 @@ import cn.stylefeng.roses.kernel.system.constants.SystemConstants;
* @author fengshuonan
* @date 2021/1/6 21:47
*/
public class ZTreeNode {
@ToString
@EqualsAndHashCode
public class ZTreeNode implements AbstractTreeNode {
/**
* id
*/
@Getter
@Setter
private Long id;
/**
@ -23,23 +34,38 @@ public class ZTreeNode {
/**
*
*/
@Getter
@Setter
private String name;
/**
*
*/
@Getter
@Setter
private Boolean open;
/**
*
*/
@Getter
@Setter
private Boolean checked;
/**
* single or group
*/
@Getter
@Setter
private String iconSkin;
/**
*
*/
@Getter
@Setter
private List children;
/**
* ztree
*
@ -56,51 +82,27 @@ public class ZTreeNode {
return zTreeNode;
}
public Long getId() {
return id;
@Override
public String getNodeId() {
return id.toString();
}
public void setId(Long id) {
this.id = id;
@Override
public String getNodeParentId() {
return pId.toString();
}
public Long getpId() {
return pId;
@Override
public void setChildrenNodes(List childrenNodes) {
this.children = childrenNodes;
}
public void setpId(Long pId) {
this.pId = pId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Boolean getOpen() {
return open;
}
public void setOpen(Boolean open) {
this.open = open;
}
public Boolean getChecked() {
return checked;
}
public void setChecked(Boolean checked) {
this.checked = checked;
}
public String getIconSkin() {
return iconSkin;
}
public void setIconSkin(String iconSkin) {
this.iconSkin = iconSkin;
public Long getpId() {
return pId;
}
}

View File

@ -136,14 +136,26 @@ public class SysMenuController {
}
/**
* ()
* ()layui使
*
* @author majianguo
* @date 2021/1/9 17:10
*/
@GetResource(name = "获取系统菜单树(包含按钮),用于给角色授权时选择", path = "/sysMenu/menuAndButtonTree")
public List<LayuiMenuAndButtonTreeResponse> menuAndButtonTree(SysRoleRequest sysRoleRequest) {
return sysMenuService.getMenuAndButtonTree(sysRoleRequest);
return sysMenuService.getMenuAndButtonTree(sysRoleRequest, true);
}
/**
* ()antd vue使
*
* @author majianguo
* @date 2021/1/9 17:10
*/
@GetResource(name = "获取系统菜单树(包含按钮),用于给角色授权时选择", path = "/sysMenu/menuAndButtonTreeChildren")
public ResponseData menuAndButtonTreeChildren(SysRoleRequest sysRoleRequest) {
List<LayuiMenuAndButtonTreeResponse> treeResponseList = sysMenuService.getMenuAndButtonTree(sysRoleRequest, false);
return new SuccessResponseData(treeResponseList);
}
/**

View File

@ -176,8 +176,11 @@ public interface SysMenuService extends IService<SysMenu> {
/**
*
*
* @param sysRoleRequest
* @param lateralFlag true-false-
* @author majianguo
* @date 2021/1/9 17:11
*/
List<LayuiMenuAndButtonTreeResponse> getMenuAndButtonTree(SysRoleRequest sysRoleRequest);
List<LayuiMenuAndButtonTreeResponse> getMenuAndButtonTree(SysRoleRequest sysRoleRequest, Boolean lateralFlag);
}

View File

@ -330,7 +330,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
}
@Override
public List<LayuiMenuAndButtonTreeResponse> getMenuAndButtonTree(SysRoleRequest sysRoleRequest) {
public List<LayuiMenuAndButtonTreeResponse> getMenuAndButtonTree(SysRoleRequest sysRoleRequest, Boolean lateralFlag) {
List<LayuiMenuAndButtonTreeResponse> menuTreeNodeList = CollectionUtil.newArrayList();
LambdaQueryWrapper<SysMenu> munuWrapper = new LambdaQueryWrapper<>();
@ -426,7 +426,12 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
menuTreeNodeList.add(menuTree);
}
return menuTreeNodeList;
// 返回结果
if (lateralFlag) {
return menuTreeNodeList;
} else {
return new DefaultTreeBuildFactory<LayuiMenuAndButtonTreeResponse>().doTreeBuild(menuTreeNodeList);
}
}
@Override

View File

@ -139,7 +139,20 @@ public class HrOrganizationController {
*/
@GetResource(name = "获取zTree形式的组织机构树用于角色配置数据范围类型并且数据范围类型是指定组织机构时layui版本", path = "/hrOrganization/zTree")
public List<ZTreeNode> layuiSelectParentMenuTreeList(@Validated(HrOrganizationRequest.orgZTree.class) HrOrganizationRequest hrOrganizationRequest) {
return hrOrganizationService.orgZTree(hrOrganizationRequest);
return hrOrganizationService.orgZTree(hrOrganizationRequest, false);
}
/**
* zTreeantd vue
*
* @author fengshuonan
* @date 2021/1/9 18:37
*/
@GetResource(name = "获取zTree形式的组织机构树用于角色配置数据范围类型并且数据范围类型是指定组织机构时antd vue版本", path = "/hrOrganization/treeWithChildren")
public ResponseData treeWithChildren(@Validated(HrOrganizationRequest.orgZTree.class) HrOrganizationRequest hrOrganizationRequest) {
List<ZTreeNode> zTreeNodes = hrOrganizationService.orgZTree(hrOrganizationRequest, true);
return new SuccessResponseData(zTreeNodes);
}
}

View File

@ -119,10 +119,11 @@ public interface HrOrganizationService extends IService<HrOrganization> {
* ztreelayui
*
* @param hrOrganizationRequest
* @param buildTree true-false-
* @return ztree
* @author fengshuonan
* @date 2021/1/9 18:40
*/
List<ZTreeNode> orgZTree(HrOrganizationRequest hrOrganizationRequest);
List<ZTreeNode> orgZTree(HrOrganizationRequest hrOrganizationRequest, boolean buildTree);
}

View File

@ -308,7 +308,7 @@ public class HrOrganizationServiceImpl extends ServiceImpl<HrOrganizationMapper,
}
@Override
public List<ZTreeNode> orgZTree(HrOrganizationRequest hrOrganizationRequest) {
public List<ZTreeNode> orgZTree(HrOrganizationRequest hrOrganizationRequest, boolean buildTree) {
// 获取角色id
Long roleId = hrOrganizationRequest.getRoleId();
@ -328,7 +328,11 @@ public class HrOrganizationServiceImpl extends ServiceImpl<HrOrganizationMapper,
}
}
return zTreeNodes;
if (buildTree) {
return new DefaultTreeBuildFactory<ZTreeNode>().doTreeBuild(zTreeNodes);
} else {
return zTreeNodes;
}
}
/**

View File

@ -68,14 +68,26 @@ public class ResourceController {
}
/**
*
* layui
*
* @author majianguo
* @date 2021/1/9 15:07
*/
@GetResource(name = "获取资源平级树列表,用于分配接口权限", path = "/resource/getLateralTree")
public List<ResourceTreeNode> getLateralTree(SysRoleRequest sysRoleRequest) {
return sysResourceService.getResourceLateralTree(sysRoleRequest.getRoleId());
return sysResourceService.getResourceTree(sysRoleRequest.getRoleId(), true);
}
/**
* antd vue
*
* @author majianguo
* @date 2021/1/9 15:07
*/
@GetResource(name = "获取资源树列表,用于分配接口权限", path = "/resource/getLateralTreeChildren")
public ResponseData getLateralTreeChildren(SysRoleRequest sysRoleRequest) {
List<ResourceTreeNode> resourceLateralTree = sysResourceService.getResourceTree(sysRoleRequest.getRoleId(), false);
return new SuccessResponseData(resourceLateralTree);
}
/**

View File

@ -1,5 +1,6 @@
package cn.stylefeng.roses.kernel.resource.modular.pojo;
import cn.stylefeng.roses.kernel.rule.abstracts.AbstractTreeNode;
import lombok.Data;
import java.util.List;
@ -11,7 +12,7 @@ import java.util.List;
* @date 2020/3/26 14:29
*/
@Data
public class ResourceTreeNode {
public class ResourceTreeNode implements AbstractTreeNode {
/**
* id
@ -46,4 +47,18 @@ public class ResourceTreeNode {
*/
private List children;
@Override
public String getNodeId() {
return this.code;
}
@Override
public String getNodeParentId() {
return this.parentCode;
}
@Override
public void setChildrenNodes(List childrenNodes) {
this.children = childrenNodes;
}
}

View File

@ -70,8 +70,10 @@ public interface SysResourceService extends IService<SysResource> {
/**
*
*
* @param roleId id
* @param lateralFlag true-false-
* @author majianguo
* @date 2021/1/9 15:08
*/
List<ResourceTreeNode> getResourceLateralTree(Long roleId);
List<ResourceTreeNode> getResourceTree(Long roleId, Boolean lateralFlag);
}

View File

@ -19,10 +19,12 @@ import cn.stylefeng.roses.kernel.resource.modular.pojo.ResourceTreeNode;
import cn.stylefeng.roses.kernel.resource.modular.service.SysResourceService;
import cn.stylefeng.roses.kernel.rule.constants.RuleConstants;
import cn.stylefeng.roses.kernel.rule.enums.YesOrNotEnum;
import cn.stylefeng.roses.kernel.rule.factory.DefaultTreeBuildFactory;
import cn.stylefeng.roses.kernel.system.ResourceServiceApi;
import cn.stylefeng.roses.kernel.system.RoleServiceApi;
import cn.stylefeng.roses.kernel.system.UserServiceApi;
import cn.stylefeng.roses.kernel.system.constants.SystemConstants;
import cn.stylefeng.roses.kernel.system.pojo.organization.layui.LayuiOrganizationTreeNode;
import cn.stylefeng.roses.kernel.system.pojo.resource.request.ResourceRequest;
import cn.stylefeng.roses.kernel.system.pojo.role.response.SysRoleResourceResponse;
import cn.stylefeng.roses.kernel.system.pojo.role.response.SysRoleResponse;
@ -137,7 +139,7 @@ public class SysResourceServiceImpl extends ServiceImpl<SysResourceMapper, SysRe
}
@Override
public List<ResourceTreeNode> getResourceLateralTree(Long roleId) {
public List<ResourceTreeNode> getResourceTree(Long roleId, Boolean lateralFlag) {
// 结果
List<ResourceTreeNode> res = new ArrayList<>();
@ -214,7 +216,11 @@ public class SysResourceServiceImpl extends ServiceImpl<SysResourceMapper, SysRe
}
// 根据map组装资源树
return res;
if (lateralFlag) {
return res;
} else {
return new DefaultTreeBuildFactory<ResourceTreeNode>().doTreeBuild(res);
}
}
@Override

View File

@ -0,0 +1,56 @@
package cn.stylefeng.roses.kernel.system.modular.user.controller;
import cn.stylefeng.roses.kernel.auth.api.SessionManagerApi;
import cn.stylefeng.roses.kernel.resource.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.resource.api.annotation.GetResource;
import cn.stylefeng.roses.kernel.resource.api.annotation.PostResource;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import cn.stylefeng.roses.kernel.system.modular.user.service.SysUserService;
import cn.stylefeng.roses.kernel.system.pojo.user.request.OnlineUserRequest;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
/**
* 线
*
* @author fengshuonan
* @date 2021/1/11 22:52
*/
@RestController
@ApiResource(name = "在线用户管理")
public class OnlineUserController {
@Resource
private SysUserService sysUserService;
@Resource
private SessionManagerApi sessionManagerApi;
/**
* 线
*
* @author fengshuonan
* @date 2021/1/11 22:53
*/
@GetResource(name = "当前在线用户列表", path = "/sysUser/onlineUserList")
public ResponseData onlineUserList(OnlineUserRequest onlineUserRequest) {
return new SuccessResponseData(sysUserService.onlineUserList(onlineUserRequest));
}
/**
* 线
*
* @author fengshuonan
* @date 2021/1/11 22:53
*/
@PostResource(name = "踢掉在线用户", path = "/sysUser/removeSession")
public ResponseData removeSession(@Valid @RequestBody OnlineUserRequest onlineUserRequest) {
sessionManagerApi.removeSession(onlineUserRequest.getToken());
return new SuccessResponseData();
}
}

View File

@ -8,9 +8,9 @@ import cn.stylefeng.roses.kernel.resource.api.annotation.PostResource;
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import cn.stylefeng.roses.kernel.system.pojo.user.request.SysUserRequest;
import cn.stylefeng.roses.kernel.system.modular.user.service.SysUserRoleService;
import cn.stylefeng.roses.kernel.system.modular.user.service.SysUserService;
import cn.stylefeng.roses.kernel.system.pojo.user.request.SysUserRequest;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@ -240,15 +240,4 @@ public class SysUserController {
return new SuccessResponseData(sysUserService.detail(sysUserRequest));
}
/**
* 线
*
* @author fengshuonan
* @date 2021/1/1 19:01
*/
@GetResource(name = "当前在线用户列表", path = "/sysUser/onlineUserList", requiredPermission = false)
public ResponseData onlineUserList() {
return new SuccessResponseData(sysUserService.onlineUserList());
}
}

View File

@ -0,0 +1,41 @@
package cn.stylefeng.roses.kernel.system.modular.user.factory;
import cn.stylefeng.roses.kernel.auth.api.pojo.login.LoginUser;
import cn.stylefeng.roses.kernel.rule.enums.SexEnum;
import cn.stylefeng.roses.kernel.system.pojo.user.OnlineUserResponse;
/**
* 线
*
* @author fengshuonan
* @date 2021/1/11 22:31
*/
public class OnlineUserCreateFactory {
/**
* 线
*
* @author fengshuonan
* @date 2021/1/11 22:31
*/
public static OnlineUserResponse createOnlineUser(LoginUser loginUser) {
OnlineUserResponse onlineUserResponse = new OnlineUserResponse();
onlineUserResponse.setUserId(loginUser.getUserId());
onlineUserResponse.setAccount(loginUser.getAccount());
onlineUserResponse.setSex(SexEnum.codeToMessage(loginUser.getSimpleUserInfo().getSex()));
onlineUserResponse.setRealName(loginUser.getSimpleUserInfo().getRealName());
onlineUserResponse.setNickName(loginUser.getSimpleUserInfo().getNickName());
if (loginUser.getSimpleRoleInfoList() != null && loginUser.getSimpleRoleInfoList().size() > 0) {
onlineUserResponse.setRoleName(loginUser.getSimpleRoleInfoList().get(0).getRoleName());
}
onlineUserResponse.setLoginTime(loginUser.getLoginTime());
onlineUserResponse.setToken(loginUser.getToken());
return onlineUserResponse;
}
}

View File

@ -13,10 +13,7 @@ import cn.stylefeng.roses.kernel.system.pojo.role.response.SysRoleResponse;
import cn.stylefeng.roses.kernel.system.pojo.user.SysUserOrgResponse;
import cn.stylefeng.roses.kernel.system.pojo.user.UserLoginInfoDTO;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
/**
*
@ -34,7 +31,7 @@ public class UserLoginInfoFactory {
* @param dataScopeResponse
* @param userOrgInfo
* @param resourceUrlsListByCodes url
* @param roleButtonCodes
* @param roleButtonCodes
* @author fengshuonan
* @date 2020/12/26 17:53
*/
@ -102,6 +99,9 @@ public class UserLoginInfoFactory {
// 填充用户拥有的按钮编码
loginUser.setButtonCodes(roleButtonCodes);
// 设置用户的登录时间
loginUser.setLoginTime(new Date());
// 响应dto
userLoginInfoDTO.setLoginUser(loginUser);
return userLoginInfoDTO;

View File

@ -22,13 +22,13 @@
left join sys_user_org suorg on suser.user_id = suorg.user_id
<where>
<if test="sysUserRequest.realName != null and sysUserRequest.realName != ''">
and sys_user.real_name like concat('%',#{sysUserRequest.realName},'%')
and suser.real_name like concat('%',#{sysUserRequest.realName},'%')
</if>
<if test="sysUserRequest.account != null and sysUserRequest.account != ''">
and sys_user.account like concat('%',#{sysUserRequest.account},'%')
and suser.account like concat('%',#{sysUserRequest.account},'%')
</if>
<if test="sysUserRequest.statusFlag != null and sysUserRequest.statusFlag != ''">
and sys_user.status_flag like concat('%',#{sysUserRequest.statusFlag},'%')
and suser.status_flag like concat('%',#{sysUserRequest.statusFlag},'%')
</if>
<if test="sysUserRequest.orgId != null and sysUserRequest.orgId != ''">
and suorg.org_id = #{sysUserRequest.orgId}

View File

@ -2,6 +2,7 @@ package cn.stylefeng.roses.kernel.system.modular.user.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.stylefeng.roses.kernel.auth.api.SessionManagerApi;
import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
import cn.stylefeng.roses.kernel.auth.api.expander.AuthConfigExpander;
@ -25,11 +26,10 @@ import cn.stylefeng.roses.kernel.system.exception.enums.SysUserExceptionEnum;
import cn.stylefeng.roses.kernel.system.modular.user.entity.SysUser;
import cn.stylefeng.roses.kernel.system.modular.user.entity.SysUserDataScope;
import cn.stylefeng.roses.kernel.system.modular.user.entity.SysUserRole;
import cn.stylefeng.roses.kernel.system.modular.user.factory.OnlineUserCreateFactory;
import cn.stylefeng.roses.kernel.system.modular.user.factory.SysUserCreateFactory;
import cn.stylefeng.roses.kernel.system.modular.user.factory.UserLoginInfoFactory;
import cn.stylefeng.roses.kernel.system.modular.user.mapper.SysUserMapper;
import cn.stylefeng.roses.kernel.system.pojo.user.SysUserDTO;
import cn.stylefeng.roses.kernel.system.pojo.user.request.SysUserRequest;
import cn.stylefeng.roses.kernel.system.modular.user.pojo.response.SysUserResponse;
import cn.stylefeng.roses.kernel.system.modular.user.service.SysUserDataScopeService;
import cn.stylefeng.roses.kernel.system.modular.user.service.SysUserOrgService;
@ -37,8 +37,12 @@ import cn.stylefeng.roses.kernel.system.modular.user.service.SysUserRoleService;
import cn.stylefeng.roses.kernel.system.modular.user.service.SysUserService;
import cn.stylefeng.roses.kernel.system.pojo.organization.DataScopeResponse;
import cn.stylefeng.roses.kernel.system.pojo.role.response.SysRoleResponse;
import cn.stylefeng.roses.kernel.system.pojo.user.OnlineUserResponse;
import cn.stylefeng.roses.kernel.system.pojo.user.SysUserDTO;
import cn.stylefeng.roses.kernel.system.pojo.user.SysUserOrgResponse;
import cn.stylefeng.roses.kernel.system.pojo.user.UserLoginInfoDTO;
import cn.stylefeng.roses.kernel.system.pojo.user.request.OnlineUserRequest;
import cn.stylefeng.roses.kernel.system.pojo.user.request.SysUserRequest;
import cn.stylefeng.roses.kernel.system.util.DataScopeUtil;
import com.alibaba.excel.support.ExcelTypeEnum;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -473,8 +477,18 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
}
@Override
public List<LoginUser> onlineUserList() {
return sessionManagerApi.onlineUserList();
public List<OnlineUserResponse> onlineUserList(OnlineUserRequest onlineUserRequest) {
List<LoginUser> loginUsers = sessionManagerApi.onlineUserList();
// 对象转化
List<OnlineUserResponse> result = loginUsers.stream().map(OnlineUserCreateFactory::createOnlineUser).collect(Collectors.toList());
// 如果带了条件则根据account筛选结果
if (StrUtil.isNotBlank(onlineUserRequest.getAccount())) {
return result.stream().filter(i -> i.getAccount().equals(onlineUserRequest.getAccount())).collect(Collectors.toList());
} else {
return result;
}
}
@Override