新增通过区域获取用户接口
This commit is contained in:
parent
ee47e1ae00
commit
3613fc1a3d
@ -122,4 +122,20 @@ public interface IApiConsts {
|
|||||||
* 角色zTree
|
* 角色zTree
|
||||||
*/
|
*/
|
||||||
String LIST_ZTREE_ROLE = "%s/resource/role/listztreerole";
|
String LIST_ZTREE_ROLE = "%s/resource/role/listztreerole";
|
||||||
|
/**
|
||||||
|
* 获取所有用户列表(通过上级区域ID)
|
||||||
|
*/
|
||||||
|
String LIST_USER_ALL_BY_AREA_ID = "%s/resource/user/listuserallbyareaid";
|
||||||
|
/**
|
||||||
|
* 获取所有用户ID列表(通过上级区域ID)
|
||||||
|
*/
|
||||||
|
String LIST_USER_ID_ALL_BY_AREA_ID = "%s/resource/user/listuseridallbyareaid";
|
||||||
|
/**
|
||||||
|
* 获取用户列表(通过上级区域ID)
|
||||||
|
*/
|
||||||
|
String LIST_USER_BY_AREA_ID = "%s/resource/user/listuserbyareaid";
|
||||||
|
/**
|
||||||
|
* 获取用户ID列表(通过上级区域ID)
|
||||||
|
*/
|
||||||
|
String LIST_USER_ID_BY_AREA_ID = "%s/resource/user/listuseridbyareaid";
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,10 @@ import com.alibaba.fastjson.JSONArray;
|
|||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.cm.common.exception.AccessTokenException;
|
import com.cm.common.exception.AccessTokenException;
|
||||||
import com.cm.common.exception.SearchException;
|
import com.cm.common.exception.SearchException;
|
||||||
|
import com.cm.common.plugin.pojo.bos.UserResourceBO;
|
||||||
import com.cm.common.result.SuccessResult;
|
import com.cm.common.result.SuccessResult;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -167,4 +169,45 @@ public interface IUserService {
|
|||||||
* @throws SearchException
|
* @throws SearchException
|
||||||
*/
|
*/
|
||||||
JSONArray listDepartmentUserByUserDepartmentId(JSONObject params) throws AccessTokenException, SearchException;
|
JSONArray listDepartmentUserByUserDepartmentId(JSONObject params) throws AccessTokenException, SearchException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有用户列表(通过上级区域ID)
|
||||||
|
*
|
||||||
|
* @param params,1级区域到5级区域,area1, area2, area3, area4, area5
|
||||||
|
* @return
|
||||||
|
* @throws AccessTokenException
|
||||||
|
* @throws SearchException
|
||||||
|
*/
|
||||||
|
List<UserResourceBO> listUserAllByAreaId(Map<String, Object> params) throws AccessTokenException, SearchException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有用户ID列表(通过上级区域ID)
|
||||||
|
*
|
||||||
|
* @param params,1级区域到5级区域,area1, area2, area3, area4, area5
|
||||||
|
* @return
|
||||||
|
* @throws AccessTokenException
|
||||||
|
* @throws SearchException
|
||||||
|
*/
|
||||||
|
List<String> listUserIdAllByAreaId(Map<String, Object> params) throws AccessTokenException, SearchException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户列表(通过上级区域ID)
|
||||||
|
*
|
||||||
|
* @param params,1级区域到5级区域,area1, area2, area3, area4, area5
|
||||||
|
* @return
|
||||||
|
* @throws AccessTokenException
|
||||||
|
* @throws SearchException
|
||||||
|
*/
|
||||||
|
List<UserResourceBO> listUserByAreaId(Map<String, Object> params) throws AccessTokenException, SearchException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户列表(通过上级区域ID)
|
||||||
|
*
|
||||||
|
* @param params 1级区域到5级区域,area1, area2, area3, area4, area5
|
||||||
|
* @return
|
||||||
|
* @throws AccessTokenException
|
||||||
|
* @throws SearchException
|
||||||
|
*/
|
||||||
|
List<String> listUserIdByAreaId(Map<String, Object> params) throws AccessTokenException, SearchException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,12 +10,14 @@ import com.cm.common.exception.SearchException;
|
|||||||
import com.cm.common.plugin.IApiConsts;
|
import com.cm.common.plugin.IApiConsts;
|
||||||
import com.cm.common.plugin.oauth.service.user.IUserService;
|
import com.cm.common.plugin.oauth.service.user.IUserService;
|
||||||
import com.cm.common.plugin.oauth.token.ClientTokenManager;
|
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.plugin.utils.RestTemplateUtil;
|
||||||
import com.cm.common.result.SuccessResult;
|
import com.cm.common.result.SuccessResult;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -147,4 +149,36 @@ public class UserServiceImpl extends AbstractService implements IUserService {
|
|||||||
return JSONArray.parseArray(result);
|
return JSONArray.parseArray(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UserResourceBO> listUserAllByAreaId(Map<String, Object> params) throws AccessTokenException, SearchException {
|
||||||
|
params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
|
||||||
|
String result = restTemplateUtil.doGetFormNormal(String.format(IApiConsts.LIST_USER_ALL_BY_AREA_ID, apiPathProperties.getUserCenter()), params);
|
||||||
|
searchResourceResult(result, "获取所有用户列表失败");
|
||||||
|
return JSONArray.parseArray(result, UserResourceBO.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> listUserIdAllByAreaId(Map<String, Object> params) throws AccessTokenException, SearchException {
|
||||||
|
params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
|
||||||
|
String result = restTemplateUtil.doGetFormNormal(String.format(IApiConsts.LIST_USER_ID_ALL_BY_AREA_ID, apiPathProperties.getUserCenter()), params);
|
||||||
|
searchResourceResult(result, "获取所有用户ID列表失败");
|
||||||
|
return JSONArray.parseArray(result, String.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UserResourceBO> listUserByAreaId(Map<String, Object> params) throws AccessTokenException, SearchException {
|
||||||
|
params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
|
||||||
|
String result = restTemplateUtil.doGetFormNormal(String.format(IApiConsts.LIST_USER_BY_AREA_ID, apiPathProperties.getUserCenter()), params);
|
||||||
|
searchResourceResult(result, "获取用户列表失败");
|
||||||
|
return JSONArray.parseArray(result, UserResourceBO.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> listUserIdByAreaId(Map<String, Object> params) throws AccessTokenException, SearchException {
|
||||||
|
params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
|
||||||
|
String result = restTemplateUtil.doGetFormNormal(String.format(IApiConsts.LIST_USER_ID_BY_AREA_ID, apiPathProperties.getUserCenter()), params);
|
||||||
|
searchResourceResult(result, "获取用户ID列表失败");
|
||||||
|
return JSONArray.parseArray(result, String.class);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,76 @@
|
|||||||
|
package com.cm.common.plugin.pojo.bos;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When you feel like quitting. Think about why you started
|
||||||
|
* 当你想要放弃的时候,想想当初你为何开始
|
||||||
|
*
|
||||||
|
* @ClassName: UserDTO
|
||||||
|
* @Description: 用户
|
||||||
|
* @Author: WangGeng
|
||||||
|
* @Date: 2020/7/27 16:41
|
||||||
|
* @Version: 1.0
|
||||||
|
**/
|
||||||
|
public class UserResourceBO implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -2467274836208617520L;
|
||||||
|
private String userId;
|
||||||
|
private String userUsername;
|
||||||
|
private String userName;
|
||||||
|
private String userPhone;
|
||||||
|
private String userEmail;
|
||||||
|
|
||||||
|
public void setUserId(String userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserUsername() {
|
||||||
|
return userUsername == null ? "" : userUsername.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserUsername(String userUsername) {
|
||||||
|
this.userUsername = userUsername;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserName() {
|
||||||
|
return userName == null ? "" : userName.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserName(String userName) {
|
||||||
|
this.userName = userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserPhone() {
|
||||||
|
return userPhone == null ? "" : userPhone.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserPhone(String userPhone) {
|
||||||
|
this.userPhone = userPhone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserEmail() {
|
||||||
|
return userEmail == null ? "" : userEmail.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserEmail(String userEmail) {
|
||||||
|
this.userEmail = userEmail;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
final StringBuilder sb = new StringBuilder("{");
|
||||||
|
sb.append("\"userId\":\"")
|
||||||
|
.append(userId).append('\"');
|
||||||
|
sb.append(",\"userUsername\":\"")
|
||||||
|
.append(userUsername).append('\"');
|
||||||
|
sb.append(",\"userName\":\"")
|
||||||
|
.append(userName).append('\"');
|
||||||
|
sb.append(",\"userPhone\":\"")
|
||||||
|
.append(userPhone).append('\"');
|
||||||
|
sb.append(",\"userEmail\":\"")
|
||||||
|
.append(userEmail).append('\"');
|
||||||
|
sb.append('}');
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user