修复shiro2.0.3组件bug

This commit is contained in:
wuy 2020-04-14 12:18:50 +08:00
parent 4d36d8aefe
commit d27f7f500e
4 changed files with 65 additions and 15 deletions

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.diboot.core.entity.BaseEntity;
import com.diboot.shiro.entity.SysUser;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
/***
* @author Wangyl
@ -15,13 +16,57 @@ public class WxMpMember extends BaseEntity {
private static final long serialVersionUID = -106928701430810778L;
@TableField
private String openid;
@TableField("openid")
private String openId;
@TableField
private Boolean subscribe;
@TableField
private String nickname;
/**
* 绑定用户的认证
* 性别描述信息未知等.
*/
@TableField
private String sexDesc;
/**
* 性别表示12等数字.
*/
@TableField
private Integer sex;
@TableField
private String language;
@TableField
private String city;
@TableField
private String province;
@TableField
private String country;
@TableField
private String headImgUrl;
@TableField
private String unionId;
@TableField
private String remark;
@TableField
private Integer groupId;
/**
* subscribe_scene 返回用户关注的渠道来源.
* ADD_SCENE_SEARCH 公众号搜索ADD_SCENE_ACCOUNT_MIGRATION 公众号迁移ADD_SCENE_PROFILE_CARD 名片分享ADD_SCENE_QR_CODE 扫描二维码ADD_SCENEPROFILE LINK 图文页内名称点击ADD_SCENE_PROFILE_ITEM 图文页右上角菜单ADD_SCENE_PAID 支付后关注ADD_SCENE_OTHERS 其他
*/
@TableField
private String subscribeScene;
@Autowired
private Long sysUserId;
@TableField(exist = false)

View File

@ -1,6 +1,5 @@
package com.diboot.shiro.wx.mp.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.diboot.core.util.V;
import com.diboot.shiro.config.AuthType;
@ -8,8 +7,6 @@ import com.diboot.shiro.entity.SysUser;
import com.diboot.shiro.jwt.BaseJwtAuthenticationToken;
import com.diboot.shiro.service.AuthWayService;
import com.diboot.shiro.service.SysUserService;
import com.diboot.shiro.wx.mp.entity.WxMpMember;
import com.diboot.shiro.wx.mp.service.WxMpMemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -24,9 +21,6 @@ import java.util.List;
@Service
public class WxMpAuthWayServiceImpl implements AuthWayService {
@Autowired
private WxMpMemberService wxMpMemberService;
@Autowired
private SysUserService sysUserService;
@ -46,14 +40,16 @@ public class WxMpAuthWayServiceImpl implements AuthWayService {
@Override
public SysUser getUser() {
LambdaQueryWrapper<WxMpMember> query = Wrappers.<WxMpMember>lambdaQuery()
.eq(WxMpMember::getOpenid, token.getAccount());
List<WxMpMember> wxMpMemberList = wxMpMemberService.getEntityList(query);
if (V.isEmpty(wxMpMemberList)){
//查看绑定的账户
List<SysUser> sysUserList = sysUserService.getEntityList(
Wrappers.<SysUser>lambdaQuery()
.eq(SysUser::getOpenid, token.getAccount())
.eq(SysUser::getUserType, token.getIUserType().getType())
);
if (V.isEmpty(sysUserList)) {
return null;
}
//查看绑定的账户
return sysUserService.getEntity(wxMpMemberList.get(0).getSysUserId());
return sysUserList.get(0);
}
@Override

View File

@ -35,6 +35,9 @@ public class Role extends BaseEntity {
@TableField
private String userType;
@TableField
private Long businessId;
@TableField(exist = false)
private List<Permission> permissionList;

View File

@ -73,6 +73,12 @@ public class SysUser extends BaseEntity {
@TableField
private String comment;
@TableField
private Long wxMpMemberId;
@TableField
private String openid;
@TableField(exist = false)
private List<Role> roleList;