|
@@ -26,6 +26,7 @@ import javax.validation.constraints.NotNull;
|
|
|
import java.util.Collections;
|
|
|
import java.util.List;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
import static cn.newfeifan.mall.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
|
import static cn.newfeifan.mall.framework.common.util.collection.CollectionUtils.convertSet;
|
|
@@ -110,7 +111,7 @@ public class SocialUserServiceImpl implements SocialUserService {
|
|
|
SocialUserDO socialUser = socialUserMapper.selectById(socialUserBind.getSocialUserId());
|
|
|
Assert.notNull(socialUser, "社交用户不能为空");
|
|
|
return new SocialUserRespDTO(socialUser.getOpenid(), socialUser.getNickname(), socialUser.getAvatar(),
|
|
|
- socialUserBind.getUserId());
|
|
|
+ socialUserBind.getUserId(),null);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -123,7 +124,7 @@ public class SocialUserServiceImpl implements SocialUserService {
|
|
|
SocialUserBindDO socialUserBind = socialUserBindMapper.selectByUserTypeAndSocialUserId(userType,
|
|
|
socialUser.getId());
|
|
|
return new SocialUserRespDTO(socialUser.getOpenid(), socialUser.getNickname(), socialUser.getAvatar(),
|
|
|
- socialUserBind != null ? socialUserBind.getUserId() : null);
|
|
|
+ socialUserBind != null ? socialUserBind.getUserId() : null,null);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -132,11 +133,12 @@ public class SocialUserServiceImpl implements SocialUserService {
|
|
|
SocialUserDO socialUser = authSocialUser(socialType, userType, code, state, isFirst, isRegister);
|
|
|
Assert.notNull(socialUser, "社交用户不能为空");
|
|
|
|
|
|
-
|
|
|
- SocialUserBindDO socialUserBind = socialUserBindMapper.selectByUserTypeAndSocialUserId(userType,
|
|
|
+
|
|
|
+ List<SocialUserBindDO> socialUserBindDOS = socialUserBindMapper.selectsByUserTypeAndSocialUserId(userType,
|
|
|
socialUser.getId());
|
|
|
+ List<Long> userIds = socialUserBindDOS.stream().map(SocialUserBindDO::getUserId).collect(Collectors.toList());
|
|
|
return new SocialUserRespDTO(socialUser.getOpenid(), socialUser.getNickname(), socialUser.getAvatar(),
|
|
|
- socialUserBind != null ? socialUserBind.getUserId() : null);
|
|
|
+ null,userIds);
|
|
|
}
|
|
|
|
|
|
public SocialUserDO authSocialUser(Integer socialType, Integer userType, String code, String state) {
|
|
@@ -233,4 +235,10 @@ public class SocialUserServiceImpl implements SocialUserService {
|
|
|
return socialUserMapper.getOpenIdByUserId(userId);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Boolean wxIsBindByUserId(String openId, Long userId) {
|
|
|
+ SocialUserDO socialUserDO = socialUserMapper.selectOne(SocialUserDO::getOpenid, openId);
|
|
|
+ return socialUserBindMapper.selectOne(SocialUserBindDO::getSocialUserId,socialUserDO.getId(),SocialUserBindDO::getUserId,userId) != null;
|
|
|
+ }
|
|
|
+
|
|
|
}
|