新增接口
This commit is contained in:
parent
b7f285bfa4
commit
540c9ecc28
@ -122,6 +122,10 @@ public interface IApiConsts {
|
|||||||
* 角色zTree
|
* 角色zTree
|
||||||
*/
|
*/
|
||||||
String LIST_ZTREE_ROLE = "%s/resource/role/listztreerole";
|
String LIST_ZTREE_ROLE = "%s/resource/role/listztreerole";
|
||||||
|
/**
|
||||||
|
* 职位zTree
|
||||||
|
*/
|
||||||
|
String LIST_ZTREE_POSITION = "%s/resource/role/listztreeposition";
|
||||||
/**
|
/**
|
||||||
* 获取所有用户列表(通过上级区域ID)
|
* 获取所有用户列表(通过上级区域ID)
|
||||||
*/
|
*/
|
||||||
@ -146,5 +150,37 @@ public interface IApiConsts {
|
|||||||
* 用户动态详情列表(通过id列表)
|
* 用户动态详情列表(通过id列表)
|
||||||
*/
|
*/
|
||||||
String LIST_DYNAMIC_USER_INFO_BY_IDS = "%s/resource/userinfo/listdynamicuserinfobyids";
|
String LIST_DYNAMIC_USER_INFO_BY_IDS = "%s/resource/userinfo/listdynamicuserinfobyids";
|
||||||
|
/**
|
||||||
|
* 用户动态详情(通过id列表)
|
||||||
|
*/
|
||||||
String GET_DYNAMIC_USER_INFO_BY_ID = "%s/resource/userinfo/getdynamicuserinfobyid/%s";
|
String GET_DYNAMIC_USER_INFO_BY_ID = "%s/resource/userinfo/getdynamicuserinfobyid/%s";
|
||||||
|
/**
|
||||||
|
* 获取用户(通过ID)
|
||||||
|
*/
|
||||||
|
String GET_USER_DEPARTMENT_RESOURCE_BY_ID = "%s/resource/user/getuserdepartmentresourcebyid/%s";
|
||||||
|
/**
|
||||||
|
* 获取用户列表(通过ID)
|
||||||
|
*/
|
||||||
|
String LIST_USER_DEPARTMENT_RESOURCE_BY_IDS = "%s/resource/user/listuserdepartmentresourcebyids";
|
||||||
|
/**
|
||||||
|
* 获取用户列表(通过部门ID列表)
|
||||||
|
*/
|
||||||
|
String LIST_USER_DEPARTMENT_RESOURCE_BY_DEPARTMENT_IDS = "%s/resource/user/listuserdepartmentresourcebydepartmentids";
|
||||||
|
/**
|
||||||
|
* 获取所在部门用户列表(通过用户ID和角色ID列表)
|
||||||
|
*/
|
||||||
|
String LIST_USER_DEPARTMENT_RESOURCE_BY_USER_ID_AND_ROLE_IDS = "%s/resource/user/listuserdepartmentresourcebyuseridandroleids/%s";
|
||||||
|
/**
|
||||||
|
* 获取用户列表(通过角色ID列表)
|
||||||
|
*/
|
||||||
|
String LIST_USER_DEPARTMENT_RESOURCE_BY_ROLE_IDS = "%s/resource/user/listuserdepartmentresourcebyroleids";
|
||||||
|
/**
|
||||||
|
* 获取所在部门用户列表(通过用户ID和职位ID列表)
|
||||||
|
*/
|
||||||
|
String LIST_USER_DEPARTMENT_RESOURCE_BY_USER_ID_AND_POSITION_IDS = "%s/resource/user/listuserdepartmentresourcebyuseridandpositionids/%s";
|
||||||
|
/**
|
||||||
|
* 获取所在部门用户列表(通过职位ID列表)
|
||||||
|
*/
|
||||||
|
String LIST_USER_DEPARTMENT_RESOURCE_BY_POSITION_IDS = "%s/resource/user/listuserdepartmentresourcebypositionids";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -28,4 +28,14 @@ public interface IPositionService {
|
|||||||
*/
|
*/
|
||||||
JSONArray listUserPosition(Map<String, Object> params) throws AccessTokenException, SearchException;
|
JSONArray listUserPosition(Map<String, Object> params) throws AccessTokenException, SearchException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 职位树
|
||||||
|
*
|
||||||
|
* @param positionParentId
|
||||||
|
* @return
|
||||||
|
* @throws AccessTokenException
|
||||||
|
* @throws SearchException
|
||||||
|
*/
|
||||||
|
JSONArray listZTreePosition(String positionParentId) throws AccessTokenException, SearchException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,10 +7,12 @@ import com.cm.common.exception.AccessTokenException;
|
|||||||
import com.cm.common.exception.SearchException;
|
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.position.IPositionService;
|
import com.cm.common.plugin.oauth.service.position.IPositionService;
|
||||||
|
import com.cm.common.plugin.oauth.token.ClientTokenManager;
|
||||||
import com.cm.common.plugin.utils.RestTemplateUtil;
|
import com.cm.common.plugin.utils.RestTemplateUtil;
|
||||||
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.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -43,4 +45,19 @@ public class PositionServiceImpl extends AbstractService implements IPositionSer
|
|||||||
return JSONArray.parseArray(result);
|
return JSONArray.parseArray(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONArray listZTreePosition(String positionParentId) throws AccessTokenException, SearchException {
|
||||||
|
Map<String, Object> params = new HashMap<>(1);
|
||||||
|
params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
|
||||||
|
params.put("id", positionParentId);
|
||||||
|
String result = restTemplateUtil.doGetFormNormal(String.format(IApiConsts.LIST_ZTREE_POSITION, apiPathProperties.getUserCenter()), params);
|
||||||
|
if (result == null) {
|
||||||
|
throw new AccessTokenException("认证失败");
|
||||||
|
}
|
||||||
|
if (result.isEmpty()) {
|
||||||
|
throw new SearchException("获取列表失败");
|
||||||
|
}
|
||||||
|
return JSONArray.parseArray(result);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.cm.common.plugin.oauth.service.role;
|
package com.cm.common.plugin.oauth.service.role;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.cm.common.exception.AccessTokenException;
|
||||||
|
import com.cm.common.exception.SearchException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When you feel like quitting. Think about why you started
|
* When you feel like quitting. Think about why you started
|
||||||
@ -13,5 +15,13 @@ import com.alibaba.fastjson.JSONArray;
|
|||||||
* @Version: 1.0
|
* @Version: 1.0
|
||||||
**/
|
**/
|
||||||
public interface IRoleService {
|
public interface IRoleService {
|
||||||
JSONArray listZTreeRole(String roleParentId);
|
/**
|
||||||
|
* 角色树
|
||||||
|
*
|
||||||
|
* @param roleParentId
|
||||||
|
* @return
|
||||||
|
* @throws AccessTokenException
|
||||||
|
* @throws SearchException
|
||||||
|
*/
|
||||||
|
JSONArray listZTreeRole(String roleParentId) throws AccessTokenException, SearchException;
|
||||||
}
|
}
|
||||||
|
@ -29,8 +29,6 @@ import java.util.Map;
|
|||||||
@Service
|
@Service
|
||||||
public class RoleServiceImpl extends AbstractService implements IRoleService {
|
public class RoleServiceImpl extends AbstractService implements IRoleService {
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private OAuth2ClientProperties oAuth2ClientProperties;
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ApiPathProperties apiPathProperties;
|
private ApiPathProperties apiPathProperties;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -5,6 +5,7 @@ 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.plugin.pojo.bos.UserResourceBO;
|
||||||
|
import com.cm.common.plugin.pojo.bos.user.UserDepartmentResourceBO;
|
||||||
import com.cm.common.result.SuccessResult;
|
import com.cm.common.result.SuccessResult;
|
||||||
import com.cm.common.result.SuccessResultList;
|
import com.cm.common.result.SuccessResultList;
|
||||||
import org.aspectj.lang.annotation.DeclareError;
|
import org.aspectj.lang.annotation.DeclareError;
|
||||||
@ -263,4 +264,71 @@ public interface IUserService {
|
|||||||
* @throws SearchException
|
* @throws SearchException
|
||||||
*/
|
*/
|
||||||
JSONObject getDynamicUserInfoByUserId(String userId) throws AccessTokenException, SearchException;
|
JSONObject getDynamicUserInfoByUserId(String userId) throws AccessTokenException, SearchException;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户(通过ID)
|
||||||
|
*
|
||||||
|
* @param userId
|
||||||
|
* @return
|
||||||
|
* @throws SearchException
|
||||||
|
*/
|
||||||
|
UserDepartmentResourceBO getUserDepartmentResourceById(String userId) throws SearchException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户列表(通过ID)
|
||||||
|
*
|
||||||
|
* @param userIds
|
||||||
|
* @return
|
||||||
|
* @throws SearchException
|
||||||
|
*/
|
||||||
|
List<UserDepartmentResourceBO> listUserDepartmentResourceByIds(List<String> userIds) throws SearchException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户列表(通过部门ID列表)
|
||||||
|
*
|
||||||
|
* @param departmentIds
|
||||||
|
* @return
|
||||||
|
* @throws SearchException
|
||||||
|
*/
|
||||||
|
List<UserDepartmentResourceBO> listUserDepartmentResourceByDepartmentIds(List<String> departmentIds) throws SearchException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所在部门用户列表(通过用户ID和角色ID列表)
|
||||||
|
*
|
||||||
|
* @param userId
|
||||||
|
* @param roleIds
|
||||||
|
* @return
|
||||||
|
* @throws SearchException
|
||||||
|
*/
|
||||||
|
List<UserDepartmentResourceBO> listUserDepartmentResourceByUserIdAndRoleIds(String userId, List<String> roleIds) throws SearchException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所在部门用户列表(通过角色ID列表)
|
||||||
|
*
|
||||||
|
* @param roleIds
|
||||||
|
* @return
|
||||||
|
* @throws SearchException
|
||||||
|
*/
|
||||||
|
List<UserDepartmentResourceBO> listUserDepartmentResourceByRoleIds(List<String> roleIds) throws SearchException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所在部门用户列表(通过用户ID和职位ID列表)
|
||||||
|
*
|
||||||
|
* @param userId
|
||||||
|
* @param positionIds
|
||||||
|
* @return
|
||||||
|
* @throws SearchException
|
||||||
|
*/
|
||||||
|
List<UserDepartmentResourceBO> listUserDepartmentResourceByUserIdAndPositionIds(String userId, List<String> positionIds) throws SearchException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所在部门用户列表(通过职位ID列表)
|
||||||
|
*
|
||||||
|
* @param positionIds
|
||||||
|
* @return
|
||||||
|
* @throws SearchException
|
||||||
|
*/
|
||||||
|
List<UserDepartmentResourceBO> listUserDepartmentResourceByPositionIds(List<String> positionIds) throws SearchException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ 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.pojo.bos.UserResourceBO;
|
||||||
|
import com.cm.common.plugin.pojo.bos.user.UserDepartmentResourceBO;
|
||||||
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 com.cm.common.result.SuccessResultList;
|
import com.cm.common.result.SuccessResultList;
|
||||||
@ -19,6 +20,7 @@ import org.apache.poi.util.StringUtil;
|
|||||||
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 javax.print.attribute.standard.PageRanges;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -197,7 +199,7 @@ public class UserServiceImpl extends AbstractService implements IUserService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<UserResourceBO> listUserResourceByIds(List<String> userIds) throws AccessTokenException, SearchException {
|
public List<UserResourceBO> listUserResourceByIds(List<String> userIds) throws AccessTokenException, SearchException {
|
||||||
if (userIds.isEmpty()) {
|
if (userIds == null || userIds.isEmpty()) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
StringBuilder userIdsSB = new StringBuilder();
|
StringBuilder userIdsSB = new StringBuilder();
|
||||||
@ -217,7 +219,7 @@ public class UserServiceImpl extends AbstractService implements IUserService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JSONArray listDynamicUserInfoByIds(List<String> userIds) throws AccessTokenException, SearchException {
|
public JSONArray listDynamicUserInfoByIds(List<String> userIds) throws AccessTokenException, SearchException {
|
||||||
if (userIds.isEmpty()) {
|
if (userIds == null || userIds.isEmpty()) {
|
||||||
return new JSONArray();
|
return new JSONArray();
|
||||||
}
|
}
|
||||||
StringBuilder userIdsSB = new StringBuilder();
|
StringBuilder userIdsSB = new StringBuilder();
|
||||||
@ -246,4 +248,136 @@ public class UserServiceImpl extends AbstractService implements IUserService {
|
|||||||
searchResourceResult(result, "获取动态人员信息失败");
|
searchResourceResult(result, "获取动态人员信息失败");
|
||||||
return JSONObject.parseObject(result);
|
return JSONObject.parseObject(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UserDepartmentResourceBO getUserDepartmentResourceById(String userId) throws 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_USER_DEPARTMENT_RESOURCE_BY_ID, apiPathProperties.getUserCenter(), userId), params);
|
||||||
|
searchResourceResult(result, "获取人员信息失败");
|
||||||
|
return JSONObject.parseObject(result, UserDepartmentResourceBO.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UserDepartmentResourceBO> listUserDepartmentResourceByIds(List<String> userIds) throws SearchException {
|
||||||
|
if (userIds == null || userIds.isEmpty()) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
StringBuilder userIdsSB = new StringBuilder();
|
||||||
|
for (String userId : userIds) {
|
||||||
|
if (userIdsSB.length() > 0) {
|
||||||
|
userIdsSB.append("_");
|
||||||
|
}
|
||||||
|
userIdsSB.append(userId);
|
||||||
|
}
|
||||||
|
Map<String, Object> params = getHashMap(2);
|
||||||
|
params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
|
||||||
|
params.put("userIds", userIdsSB.toString());
|
||||||
|
String result = restTemplateUtil.doPostFormNormal(String.format(IApiConsts.LIST_USER_DEPARTMENT_RESOURCE_BY_IDS, apiPathProperties.getUserCenter()), params);
|
||||||
|
searchResourceResult(result, "获取人员信息失败");
|
||||||
|
return JSONArray.parseArray(result, UserDepartmentResourceBO.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UserDepartmentResourceBO> listUserDepartmentResourceByDepartmentIds(List<String> departmentIds) throws SearchException {
|
||||||
|
if (departmentIds == null || departmentIds.isEmpty()) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
StringBuilder departmentIdsSB = new StringBuilder();
|
||||||
|
for (String departmentId : departmentIds) {
|
||||||
|
if (departmentIdsSB.length() > 0) {
|
||||||
|
departmentIdsSB.append("_");
|
||||||
|
}
|
||||||
|
departmentIdsSB.append(departmentId);
|
||||||
|
}
|
||||||
|
Map<String, Object> params = getHashMap(2);
|
||||||
|
params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
|
||||||
|
params.put("departmentIds", departmentIdsSB.toString());
|
||||||
|
String result = restTemplateUtil.doPostFormNormal(String.format(IApiConsts.LIST_USER_DEPARTMENT_RESOURCE_BY_DEPARTMENT_IDS, apiPathProperties.getUserCenter()), params);
|
||||||
|
searchResourceResult(result, "获取人员信息失败");
|
||||||
|
return JSONArray.parseArray(result, UserDepartmentResourceBO.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UserDepartmentResourceBO> listUserDepartmentResourceByUserIdAndRoleIds(String userId, List<String> roleIds) throws SearchException {
|
||||||
|
if (StringUtils.isBlank(userId) || roleIds == null || roleIds.isEmpty()) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
StringBuilder roleIdsSB = new StringBuilder();
|
||||||
|
for (String roleId : roleIds) {
|
||||||
|
if (roleIdsSB.length() > 0) {
|
||||||
|
roleIdsSB.append("_");
|
||||||
|
}
|
||||||
|
roleIdsSB.append(roleId);
|
||||||
|
}
|
||||||
|
Map<String, Object> params = getHashMap(4);
|
||||||
|
params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
|
||||||
|
params.put("roleIds", roleIdsSB.toString());
|
||||||
|
String result = restTemplateUtil.doPostFormNormal(String.format(IApiConsts.LIST_USER_DEPARTMENT_RESOURCE_BY_USER_ID_AND_ROLE_IDS, apiPathProperties.getUserCenter(), userId), params);
|
||||||
|
searchResourceResult(result, "获取人员信息失败");
|
||||||
|
return JSONArray.parseArray(result, UserDepartmentResourceBO.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UserDepartmentResourceBO> listUserDepartmentResourceByRoleIds(List<String> roleIds) throws SearchException {
|
||||||
|
if (roleIds == null || roleIds.isEmpty()) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
StringBuilder roleIdsSB = new StringBuilder();
|
||||||
|
for (String roleId : roleIds) {
|
||||||
|
if (roleIdsSB.length() > 0) {
|
||||||
|
roleIdsSB.append("_");
|
||||||
|
}
|
||||||
|
roleIdsSB.append(roleId);
|
||||||
|
}
|
||||||
|
Map<String, Object> params = getHashMap(2);
|
||||||
|
params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
|
||||||
|
params.put("roleIds", roleIdsSB.toString());
|
||||||
|
String result = restTemplateUtil.doPostFormNormal(String.format(IApiConsts.LIST_USER_DEPARTMENT_RESOURCE_BY_ROLE_IDS, apiPathProperties.getUserCenter()), params);
|
||||||
|
searchResourceResult(result, "获取人员信息失败");
|
||||||
|
return JSONArray.parseArray(result, UserDepartmentResourceBO.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UserDepartmentResourceBO> listUserDepartmentResourceByUserIdAndPositionIds(String userId, List<String> positionIds) throws SearchException {
|
||||||
|
if (StringUtils.isBlank(userId) || positionIds == null || positionIds.isEmpty()) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
StringBuilder positionIdsSB = new StringBuilder();
|
||||||
|
for (String positionId : positionIds) {
|
||||||
|
if (positionIdsSB.length() > 0) {
|
||||||
|
positionIdsSB.append("_");
|
||||||
|
}
|
||||||
|
positionIdsSB.append(positionId);
|
||||||
|
}
|
||||||
|
Map<String, Object> params = getHashMap(4);
|
||||||
|
params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
|
||||||
|
params.put("positionIds", positionIdsSB.toString());
|
||||||
|
String result = restTemplateUtil.doPostFormNormal(String.format(IApiConsts.LIST_USER_DEPARTMENT_RESOURCE_BY_USER_ID_AND_POSITION_IDS, apiPathProperties.getUserCenter(), userId), params);
|
||||||
|
searchResourceResult(result, "获取人员信息失败");
|
||||||
|
return JSONArray.parseArray(result, UserDepartmentResourceBO.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UserDepartmentResourceBO> listUserDepartmentResourceByPositionIds(List<String> positionIds) throws SearchException {
|
||||||
|
if (positionIds == null || positionIds.isEmpty()) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
StringBuilder positionIdsSB = new StringBuilder();
|
||||||
|
for (String positionId : positionIds) {
|
||||||
|
if (positionIdsSB.length() > 0) {
|
||||||
|
positionIdsSB.append("_");
|
||||||
|
}
|
||||||
|
positionIdsSB.append(positionId);
|
||||||
|
}
|
||||||
|
Map<String, Object> params = getHashMap(4);
|
||||||
|
params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
|
||||||
|
params.put("positionIds", positionIdsSB.toString());
|
||||||
|
String result = restTemplateUtil.doPostFormNormal(String.format(IApiConsts.LIST_USER_DEPARTMENT_RESOURCE_BY_POSITION_IDS, apiPathProperties.getUserCenter()), params);
|
||||||
|
searchResourceResult(result, "获取人员信息失败");
|
||||||
|
return JSONArray.parseArray(result, UserDepartmentResourceBO.class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,69 @@
|
|||||||
|
package com.cm.common.plugin.pojo.bos.department;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When you feel like quitting. Think about why you started
|
||||||
|
* 当你想要放弃的时候,想想当初你为何开始
|
||||||
|
*
|
||||||
|
* @ClassName: DepartmentResourceBO
|
||||||
|
* @Description:
|
||||||
|
* @Author: WangGeng
|
||||||
|
* @Date: 2020/9/16 18:37
|
||||||
|
* @Version: 1.0
|
||||||
|
**/
|
||||||
|
public class DepartmentResourceBO implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -6925619505625197420L;
|
||||||
|
private String userId;
|
||||||
|
private String departmentId;
|
||||||
|
private String departmentName;
|
||||||
|
private String departmentCode;
|
||||||
|
|
||||||
|
public String getUserId() {
|
||||||
|
return userId == null ? "" : userId.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(String userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDepartmentId() {
|
||||||
|
return departmentId == null ? "" : departmentId.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDepartmentId(String departmentId) {
|
||||||
|
this.departmentId = departmentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDepartmentName() {
|
||||||
|
return departmentName == null ? "" : departmentName.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDepartmentName(String departmentName) {
|
||||||
|
this.departmentName = departmentName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDepartmentCode() {
|
||||||
|
return departmentCode == null ? "" : departmentCode.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDepartmentCode(String departmentCode) {
|
||||||
|
this.departmentCode = departmentCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
final StringBuilder sb = new StringBuilder("{");
|
||||||
|
sb.append("\"userId\":\"")
|
||||||
|
.append(userId).append('\"');
|
||||||
|
sb.append(",\"departmentId\":\"")
|
||||||
|
.append(departmentId).append('\"');
|
||||||
|
sb.append(",\"departmentName\":\"")
|
||||||
|
.append(departmentName).append('\"');
|
||||||
|
sb.append(",\"departmentCode\":\"")
|
||||||
|
.append(departmentCode).append('\"');
|
||||||
|
sb.append('}');
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
package com.cm.common.plugin.pojo.bos.user;
|
||||||
|
|
||||||
|
import com.cm.common.plugin.pojo.bos.UserResourceBO;
|
||||||
|
import com.cm.common.plugin.pojo.bos.department.DepartmentResourceBO;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When you feel like quitting. Think about why you started
|
||||||
|
* 当你想要放弃的时候,想想当初你为何开始
|
||||||
|
*
|
||||||
|
* @ClassName: UserDepartmentResourceBO
|
||||||
|
* @Description: 用户部门资源
|
||||||
|
* @Author: WangGeng
|
||||||
|
* @Date: 2020/9/16 18:14
|
||||||
|
* @Version: 1.0
|
||||||
|
**/
|
||||||
|
public class UserDepartmentResourceBO extends UserResourceBO {
|
||||||
|
|
||||||
|
public UserDepartmentResourceBO() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserDepartmentResourceBO(UserResourceBO userResourceBO) {
|
||||||
|
super();
|
||||||
|
super.setUserId(userResourceBO.getUserId());
|
||||||
|
super.setUserUsername(userResourceBO.getUserUsername());
|
||||||
|
super.setUserName(userResourceBO.getUserName());
|
||||||
|
super.setUserPhone(userResourceBO.getUserPhone());
|
||||||
|
super.setUserEmail(userResourceBO.getUserEmail());
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<DepartmentResourceBO> departments;
|
||||||
|
|
||||||
|
public List<DepartmentResourceBO> getDepartments() {
|
||||||
|
if (departments == null) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
return departments;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDepartments(List<DepartmentResourceBO> departments) {
|
||||||
|
this.departments = departments;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user