新增用户动态信息接口

This commit is contained in:
WenG 2020-09-12 17:16:30 +08:00
parent 792fac1593
commit 9f1941e82d
3 changed files with 24 additions and 1 deletions

View File

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

View File

@ -230,4 +230,13 @@ public interface IUserService {
* @throws SearchException
*/
JSONArray listDynamicUserInfoByIds(List<String> userIds) throws AccessTokenException, SearchException;
/**
* 用户详情
* @param userId
* @return
* @throws AccessTokenException
* @throws SearchException
*/
JSONObject getDynamicUserInfoByUserId(String userId) throws AccessTokenException, SearchException;
}

View File

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