| | |
| | | |
| | | import cn.hutool.core.util.IdUtil; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.oying.modules.rider.domain.RiderInfo; |
| | | import com.oying.modules.rider.service.RiderInfoService; |
| | | import com.oying.modules.security.config.CaptchaConfig; |
| | | import com.oying.modules.security.config.LoginProperties; |
| | | import com.oying.modules.security.config.SecurityProperties; |
| | |
| | | private final WeiXinService weiXinService; |
| | | private final UserService userService; |
| | | private final DictDetailService dictDetailService; |
| | | private final RiderInfoService riderInfoService; |
| | | |
| | | @Log("账号密码登录") |
| | | @ApiOperation("账号密码登录") |
| | |
| | | } |
| | | // 获取用户信息 |
| | | JwtUserDto jwtUser = userDetailsService.loadUserByUsername(authUser.getUsername()); |
| | | // 查询骑手信息 |
| | | RiderInfo riderInfo = riderInfoService.getRiderSourceInfo(jwtUser.getUser().getId()); |
| | | Authentication authentication = new UsernamePasswordAuthenticationToken(jwtUser, null, jwtUser.getAuthorities()); |
| | | SecurityContextHolder.getContext().setAuthentication(authentication); |
| | | // 生成令牌 |
| | |
| | | Map<String, Object> authInfo = new HashMap<String, Object>(2) {{ |
| | | put("token", properties.getTokenStartWith() + token); |
| | | put("user", jwtUser); |
| | | put("rider", riderInfo); |
| | | }}; |
| | | if (loginProperties.isSingleLogin()) { |
| | | // 踢掉之前已经登录的token |