|
@@ -13,6 +13,10 @@ import cn.iocoder.yudao.module.system.dal.dataobject.social.SocialUserDO;
|
|
import cn.iocoder.yudao.module.system.dal.mysql.social.SocialUserBindMapper;
|
|
import cn.iocoder.yudao.module.system.dal.mysql.social.SocialUserBindMapper;
|
|
import cn.iocoder.yudao.module.system.dal.mysql.social.SocialUserMapper;
|
|
import cn.iocoder.yudao.module.system.dal.mysql.social.SocialUserMapper;
|
|
import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum;
|
|
import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum;
|
|
|
|
+import cn.iocoder.yudao.module.system.util.DingtalkUtil;
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
|
+import com.dingtalk.api.response.OapiV2UserGetResponse;
|
|
import com.xingyuv.jushauth.model.AuthUser;
|
|
import com.xingyuv.jushauth.model.AuthUser;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -46,6 +50,8 @@ public class SocialUserServiceImpl implements SocialUserService {
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
private SocialClientService socialClientService;
|
|
private SocialClientService socialClientService;
|
|
|
|
+ @Resource
|
|
|
|
+ private DingtalkUtil dingtalkUtil;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public List<SocialUserDO> getSocialUserList(Long userId, Integer userType) {
|
|
public List<SocialUserDO> getSocialUserList(Long userId, Integer userType) {
|
|
@@ -112,12 +118,19 @@ public class SocialUserServiceImpl implements SocialUserService {
|
|
// 获得社交用户
|
|
// 获得社交用户
|
|
SocialUserDO socialUser = authSocialUser(socialType, userType, code, state);
|
|
SocialUserDO socialUser = authSocialUser(socialType, userType, code, state);
|
|
Assert.notNull(socialUser, "社交用户不能为空");
|
|
Assert.notNull(socialUser, "社交用户不能为空");
|
|
-
|
|
|
|
- // 获得绑定用户
|
|
|
|
- SocialUserBindDO socialUserBind = socialUserBindMapper.selectByUserTypeAndSocialUserId(userType,
|
|
|
|
- socialUser.getId());
|
|
|
|
- return new SocialUserRespDTO(socialUser.getOpenid(), socialUser.getNickname(), socialUser.getAvatar(),
|
|
|
|
- socialUserBind != null ? socialUserBind.getUserId() : null);
|
|
|
|
|
|
+ JSONObject jsonObject = JSON.parseObject(socialUser.getRawUserInfo());
|
|
|
|
+ String dingId = String.valueOf(jsonObject.get("dingId"));
|
|
|
|
+ try {
|
|
|
|
+ OapiV2UserGetResponse.UserGetResponse userDetail = dingtalkUtil.getUserDetail(dingId);
|
|
|
|
+
|
|
|
|
+ // 获得绑定用户
|
|
|
|
+ SocialUserBindDO socialUserBind = socialUserBindMapper.selectByUserTypeAndSocialUserId(userType,
|
|
|
|
+ socialUser.getId());
|
|
|
|
+ return new SocialUserRespDTO(socialUser.getOpenid(), userDetail.getJobNumber(), socialUser.getAvatar(),
|
|
|
|
+ socialUserBind != null ? socialUserBind.getUserId() : null);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ throw new RuntimeException(e);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|