From d27f7f500e3335e91c9d714a776b459ede825e7e Mon Sep 17 00:00:00 2001 From: wuy <1311695042@qq.com> Date: Tue, 14 Apr 2020 12:18:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dshiro2.0.3=E7=BB=84=E4=BB=B6b?= =?UTF-8?q?ug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../diboot/shiro/wx/mp/entity/WxMpMember.java | 51 +++++++++++++++++-- .../service/impl/WxMpAuthWayServiceImpl.java | 20 +++----- .../java/com/diboot/shiro/entity/Role.java | 3 ++ .../java/com/diboot/shiro/entity/SysUser.java | 6 +++ 4 files changed, 65 insertions(+), 15 deletions(-) diff --git a/diboot-shiro-wx-mp/src/main/java/com/diboot/shiro/wx/mp/entity/WxMpMember.java b/diboot-shiro-wx-mp/src/main/java/com/diboot/shiro/wx/mp/entity/WxMpMember.java index 33f7708..5e14f55 100755 --- a/diboot-shiro-wx-mp/src/main/java/com/diboot/shiro/wx/mp/entity/WxMpMember.java +++ b/diboot-shiro-wx-mp/src/main/java/com/diboot/shiro/wx/mp/entity/WxMpMember.java @@ -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; + /** + * 性别表示:1,2等数字. + */ + @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) diff --git a/diboot-shiro-wx-mp/src/main/java/com/diboot/shiro/wx/mp/service/impl/WxMpAuthWayServiceImpl.java b/diboot-shiro-wx-mp/src/main/java/com/diboot/shiro/wx/mp/service/impl/WxMpAuthWayServiceImpl.java index bdebb2e..fe46f4f 100755 --- a/diboot-shiro-wx-mp/src/main/java/com/diboot/shiro/wx/mp/service/impl/WxMpAuthWayServiceImpl.java +++ b/diboot-shiro-wx-mp/src/main/java/com/diboot/shiro/wx/mp/service/impl/WxMpAuthWayServiceImpl.java @@ -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 query = Wrappers.lambdaQuery() - .eq(WxMpMember::getOpenid, token.getAccount()); - List wxMpMemberList = wxMpMemberService.getEntityList(query); - if (V.isEmpty(wxMpMemberList)){ + //查看绑定的账户 + List sysUserList = sysUserService.getEntityList( + Wrappers.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 diff --git a/diboot-shiro/src/main/java/com/diboot/shiro/entity/Role.java b/diboot-shiro/src/main/java/com/diboot/shiro/entity/Role.java index b99be39..12b0517 100644 --- a/diboot-shiro/src/main/java/com/diboot/shiro/entity/Role.java +++ b/diboot-shiro/src/main/java/com/diboot/shiro/entity/Role.java @@ -35,6 +35,9 @@ public class Role extends BaseEntity { @TableField private String userType; + @TableField + private Long businessId; + @TableField(exist = false) private List permissionList; diff --git a/diboot-shiro/src/main/java/com/diboot/shiro/entity/SysUser.java b/diboot-shiro/src/main/java/com/diboot/shiro/entity/SysUser.java index ab8fb48..c0e9de5 100644 --- a/diboot-shiro/src/main/java/com/diboot/shiro/entity/SysUser.java +++ b/diboot-shiro/src/main/java/com/diboot/shiro/entity/SysUser.java @@ -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 roleList;