处理用户接口

This commit is contained in:
wenc000 2020-08-26 18:31:33 +08:00
parent 8276c9a377
commit 009adb3bb3
3 changed files with 35 additions and 0 deletions

View File

@ -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";
}

View File

@ -220,4 +220,14 @@ public interface IUserService {
* @throws SearchException
*/
SuccessResultList<List<UserResourceBO>> listPageUserSimple(Map<String, Object> params) throws AccessTokenException, SearchException;
/**
* 用户动态详情列表通过id列表
*
* @param userIds
* @return
* @throws AccessTokenException
* @throws SearchException
*/
JSONArray listDynamicUserInfoByIds(List<String> userIds) throws AccessTokenException, SearchException;
}

View File

@ -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<String> 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<String, Object> 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);
}
}