Commit d387b71c authored by 唐峰's avatar 唐峰

用户信息查询,增加微信头像和昵称信息

parent d1b66469
......@@ -42,10 +42,14 @@ public class UserBean {
private String openId;
private String appId;
private String unionId;
//昵称
private String nickName;
//头像
private String photo;
}
@Data
public static class UserAttachedInfo{
public static class UserAttachedInfo {
private Gender gender;
......@@ -63,7 +67,7 @@ public class UserBean {
}
public static UserBean from(User user, List<WechatUserInfo> wechatUserInfoList,UserInfoEntity userInfoEntity) {
public static UserBean from(User user, List<WechatUserInfo> wechatUserInfoList, UserInfoEntity userInfoEntity) {
UserBean userBean = new UserBean();
userBean.setUserId(user.getId());
userBean.setPhoneNo(user.getPhoneNo());
......@@ -74,8 +78,10 @@ public class UserBean {
userBean.setCreatedAt(user.getCreatedAt());
if (CollectionUtils.isNotEmpty(wechatUserInfoList)) {
List<Wechat> wcList = Lists.newArrayList();
wechatUserInfoList.stream().forEach(wechatUserInfo->{
wechatUserInfoList.stream().forEach(wechatUserInfo -> {
Wechat build = Wechat.builder()
.nickName(wechatUserInfo.getNickName())
.photo(wechatUserInfo.getHeadImgUrl())
.openId(wechatUserInfo.getOpenId())
.unionId(wechatUserInfo.getUnionId())
.appId(wechatUserInfo.getAppId()).build();
......@@ -86,13 +92,13 @@ public class UserBean {
}
if (userInfoEntity != null) {
UserAttachedInfo info = new UserAttachedInfo();
BeanUtils.copyProperties(userInfoEntity,info);
BeanUtils.copyProperties(userInfoEntity, info);
userBean.setUserAttachedInfo(info);
}
return userBean;
}
public static List<UserBean> from(List<User> userList, List<WechatUserInfo> wechatUserInfoList,List<UserInfoEntity> userInfoEntityList) {
public static List<UserBean> from(List<User> userList, List<WechatUserInfo> wechatUserInfoList, List<UserInfoEntity> userInfoEntityList) {
Map<Long, UserInfoEntity> userIdEntityMap = Maps.newHashMap();
if (CollectionUtils.isNotEmpty(userInfoEntityList)) {
......@@ -115,7 +121,7 @@ public class UserBean {
UserInfoEntity userInfoEntity = userIdEntityMap.get(user.getId());
if (userInfoEntity != null) {
UserAttachedInfo info = new UserAttachedInfo();
BeanUtils.copyProperties(userInfoEntity,info);
BeanUtils.copyProperties(userInfoEntity, info);
userBean.setUserAttachedInfo(info);
}
......@@ -126,6 +132,8 @@ public class UserBean {
if (optionalWechatUserInfo.isPresent()) {
WechatUserInfo wechatUserInfo = optionalWechatUserInfo.get();
userBean.setWechatList(Collections.singletonList(Wechat.builder()
.nickName(wechatUserInfo.getNickName())
.photo(wechatUserInfo.getHeadImgUrl())
.openId(wechatUserInfo.getOpenId())
.unionId(wechatUserInfo.getUnionId())
.appId(wechatUserInfo.getAppId()).build()));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment