新增用户组、组用户列表资源接口
This commit is contained in:
parent
497e295b8d
commit
98d47e38ed
@ -0,0 +1,33 @@
|
||||
package com.cm.common.plugin.oauth.service.group;
|
||||
|
||||
import com.cm.common.plugin.pojo.bos.UserResourceBO;
|
||||
import com.cm.common.pojo.bos.GroupBO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName: IGroupService
|
||||
* @Description: 用户组
|
||||
* @Author: wanggeng
|
||||
* @Date: 2021/8/11 2:55 下午
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public interface IGroupService {
|
||||
|
||||
/**
|
||||
* 组列表
|
||||
*
|
||||
* @param parentGroupId 上级ID
|
||||
* @return
|
||||
*/
|
||||
List<GroupBO> list(String parentGroupId);
|
||||
|
||||
/**
|
||||
* 组用户列表
|
||||
*
|
||||
* @param groupId
|
||||
* @return
|
||||
*/
|
||||
List<UserResourceBO> listUser(String groupId);
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package com.cm.common.plugin.oauth.service.group.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.cm.common.base.AbstractService;
|
||||
import com.cm.common.config.properties.ApiPathProperties;
|
||||
import com.cm.common.plugin.IApiConsts;
|
||||
import com.cm.common.plugin.oauth.service.group.IGroupService;
|
||||
import com.cm.common.plugin.oauth.token.ClientTokenManager;
|
||||
import com.cm.common.plugin.pojo.bos.UserResourceBO;
|
||||
import com.cm.common.plugin.utils.RestTemplateUtil;
|
||||
import com.cm.common.pojo.bos.GroupBO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName: GroupServiceImpl
|
||||
* @Description: 用户组
|
||||
* @Author: wanggeng
|
||||
* @Date: 2021/8/11 2:55 下午
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Service
|
||||
public class GroupServiceImpl extends AbstractService implements IGroupService {
|
||||
|
||||
@Autowired
|
||||
private RestTemplateUtil restTemplateUtil;
|
||||
@Autowired
|
||||
private ApiPathProperties apiPathProperties;
|
||||
|
||||
|
||||
@Override
|
||||
public List<GroupBO> list(String parentGroupId) {
|
||||
Map<String, Object> params = new HashMap<>(2);
|
||||
params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
|
||||
String result = restTemplateUtil.doGetFormNormal(String.format("%s/resource/group/list/%s", apiPathProperties.getUserCenter(), parentGroupId), params);
|
||||
searchResourceResult(result, "获取组列表失败");
|
||||
return JSONArray.parseArray(result, GroupBO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserResourceBO> listUser(String groupId) {
|
||||
Map<String, Object> params = new HashMap<>(2);
|
||||
params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
|
||||
String result = restTemplateUtil.doGetFormNormal(String.format("%s/resource/group/list-user/%s", apiPathProperties.getUserCenter(), groupId), params);
|
||||
searchResourceResult(result, "获取组列表失败");
|
||||
return JSONArray.parseArray(result, UserResourceBO.class);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user