修复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.core.entity.BaseEntity;
import com.diboot.shiro.entity.SysUser; import com.diboot.shiro.entity.SysUser;
import lombok.Data; import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
/*** /***
* @author Wangyl * @author Wangyl
@ -15,13 +16,57 @@ public class WxMpMember extends BaseEntity {
private static final long serialVersionUID = -106928701430810778L; private static final long serialVersionUID = -106928701430810778L;
@TableField @TableField("openid")
private String openid; private String openId;
@TableField
private Boolean subscribe;
@TableField
private String nickname;
/** /**
* 绑定用户的认证 * 性别描述信息未知等.
*/ */
@TableField @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; private Long sysUserId;
@TableField(exist = false) @TableField(exist = false)

View File

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

View File

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

View File

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