| | |
| | | package com.gkhy.framework.web.service; |
| | | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.gkhy.common.core.domain.entity.SysDept; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import com.gkhy.common.utils.MessageUtils; |
| | | import com.gkhy.common.utils.StringUtils; |
| | | import com.gkhy.system.service.ISysUserService; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 用户验证处理 |
| | |
| | | } |
| | | |
| | | passwordService.validate(user); |
| | | |
| | | List<SysDept> depts = user.getDepts(); |
| | | if (ObjectUtil.isNotEmpty(depts)){ |
| | | user.setDeptIds(depts.stream().map(SysDept::getDeptId).toArray(Long[]::new)); |
| | | } |
| | | return createLoginUser(user); |
| | | } |
| | | |
| | | public UserDetails createLoginUser(SysUser user) |
| | | { |
| | | if (ObjectUtil.isNotEmpty(user.getDeptIds())){ |
| | | |
| | | return new LoginUser(user.getUserId(), user.getDeptId(), user, permissionService.getMenuPermission(user), user.getDeptIds()); |
| | | } |
| | | |
| | | return new LoginUser(user.getUserId(), user.getDeptId(), user, permissionService.getMenuPermission(user)); |
| | | } |
| | | } |