From 9f1941e82d6aab540b2326aaf4ee29e214e3af30 Mon Sep 17 00:00:00 2001 From: WenG <450292408@qq.com> Date: Sat, 12 Sep 2020 17:16:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=94=A8=E6=88=B7=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/cm/common/plugin/IApiConsts.java | 1 + .../plugin/oauth/service/user/IUserService.java | 9 +++++++++ .../oauth/service/user/impl/UserServiceImpl.java | 15 ++++++++++++++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/IApiConsts.java b/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/IApiConsts.java index 2519c1c..700e02a 100644 --- a/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/IApiConsts.java +++ b/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/IApiConsts.java @@ -146,4 +146,5 @@ public interface IApiConsts { * 用户动态详情列表(通过id列表) */ String LIST_DYNAMIC_USER_INFO_BY_IDS = "%s/resource/userinfo/listdynamicuserinfobyids"; + String GET_DYNAMIC_USER_INFO_BY_ID = "%s/resource/userinfo/getdynamicuserinfobyid/%s"; } diff --git a/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/service/user/IUserService.java b/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/service/user/IUserService.java index 0fedf38..117d5a8 100644 --- a/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/service/user/IUserService.java +++ b/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/service/user/IUserService.java @@ -230,4 +230,13 @@ public interface IUserService { * @throws SearchException */ JSONArray listDynamicUserInfoByIds(List userIds) throws AccessTokenException, SearchException; + + /** + * 用户详情 + * @param userId + * @return + * @throws AccessTokenException + * @throws SearchException + */ + JSONObject getDynamicUserInfoByUserId(String userId) throws AccessTokenException, SearchException; } diff --git a/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/service/user/impl/UserServiceImpl.java b/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/service/user/impl/UserServiceImpl.java index 542c5c1..40d5bbe 100644 --- a/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/service/user/impl/UserServiceImpl.java +++ b/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/service/user/impl/UserServiceImpl.java @@ -14,6 +14,8 @@ import com.cm.common.plugin.pojo.bos.UserResourceBO; import com.cm.common.plugin.utils.RestTemplateUtil; import com.cm.common.result.SuccessResult; import com.cm.common.result.SuccessResultList; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.util.StringUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -212,8 +214,19 @@ public class UserServiceImpl extends AbstractService implements IUserService { params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken()); params.put("userIds", userIdsSB.toString()); String result = restTemplateUtil.doPostFormNormal(String.format(IApiConsts.LIST_DYNAMIC_USER_INFO_BY_IDS, apiPathProperties.getUserCenter()), params); - searchResourceResult(result, "获取动态人员信息失败"); + searchResourceResult(result, "获取动态人员列表信息失败"); return JSONArray.parseArray(result); } + @Override + public JSONObject getDynamicUserInfoByUserId(String userId) throws AccessTokenException, SearchException { + if (StringUtils.isBlank(userId)) { + return null; + } + Map params = getHashMap(2); + params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken()); + String result = restTemplateUtil.doGetFormNormal(String.format(IApiConsts.GET_DYNAMIC_USER_INFO_BY_ID, apiPathProperties.getUserCenter(), userId), params); + searchResourceResult(result, "获取动态人员信息失败"); + return JSONObject.parseObject(result); + } }