From 009adb3bb3228ae0fec3caab8e559bcec6bb630c Mon Sep 17 00:00:00 2001 From: wenc000 <450292408@qq.com> Date: Wed, 26 Aug 2020 18:31:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E7=94=A8=E6=88=B7=E6=8E=A5?= =?UTF-8?q?=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 | 4 ++++ .../oauth/service/user/IUserService.java | 10 +++++++++ .../service/user/impl/UserServiceImpl.java | 21 +++++++++++++++++++ 3 files changed, 35 insertions(+) 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 8f6b05d..2519c1c 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 @@ -142,4 +142,8 @@ public interface IApiConsts { * 用户列表(简单格式) */ String LIST_PAGE_USER_SIMPLE = "%s/resource/user/listpageusersimple"; + /** + * 用户动态详情列表(通过id列表) + */ + String LIST_DYNAMIC_USER_INFO_BY_IDS = "%s/resource/userinfo/listdynamicuserinfobyids"; } 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 3cf26f6..0fedf38 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 @@ -220,4 +220,14 @@ public interface IUserService { * @throws SearchException */ SuccessResultList> listPageUserSimple(Map params) throws AccessTokenException, SearchException; + + /** + * 用户动态详情列表(通过id列表) + * + * @param userIds + * @return + * @throws AccessTokenException + * @throws SearchException + */ + JSONArray listDynamicUserInfoByIds(List userIds) 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 c2b8abe..542c5c1 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 @@ -17,6 +17,7 @@ import com.cm.common.result.SuccessResultList; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -195,4 +196,24 @@ public class UserServiceImpl extends AbstractService implements IUserService { return successResult; } + @Override + public JSONArray listDynamicUserInfoByIds(List userIds) throws AccessTokenException, SearchException { + if (userIds.isEmpty()) { + return new JSONArray(); + } + StringBuilder userIdsSB = new StringBuilder(); + for (String userId : userIds) { + if (userIdsSB.length() > 0) { + userIdsSB.append("_"); + } + userIdsSB.append(userId); + } + Map params = getHashMap(10); + 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, "获取动态人员信息失败"); + return JSONArray.parseArray(result); + } + }