新增部分功能

This commit is contained in:
WenG 2020-09-14 18:22:14 +08:00
parent d69f94bf5d
commit b7f285bfa4
2 changed files with 45 additions and 4 deletions

View File

@ -7,6 +7,7 @@ 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.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 java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -30,6 +31,7 @@ public interface IUserService {
* @throws AccessTokenException * @throws AccessTokenException
* @throws SearchException * @throws SearchException
*/ */
@Deprecated
JSONArray listDepartmentUsers(Map<String, Object> params) throws AccessTokenException, SearchException; JSONArray listDepartmentUsers(Map<String, Object> params) throws AccessTokenException, SearchException;
/** /**
@ -40,6 +42,7 @@ public interface IUserService {
* @throws AccessTokenException * @throws AccessTokenException
* @throws SearchException * @throws SearchException
*/ */
@Deprecated
JSONArray listRoleUsers(Map<String, Object> params) throws AccessTokenException, SearchException; JSONArray listRoleUsers(Map<String, Object> params) throws AccessTokenException, SearchException;
/** /**
@ -50,6 +53,7 @@ public interface IUserService {
* @throws AccessTokenException * @throws AccessTokenException
* @throws SearchException * @throws SearchException
*/ */
@Deprecated
JSONArray listGroupUsers(Map<String, Object> params) throws AccessTokenException, SearchException; JSONArray listGroupUsers(Map<String, Object> params) throws AccessTokenException, SearchException;
/** /**
@ -60,6 +64,7 @@ public interface IUserService {
* @throws AccessTokenException * @throws AccessTokenException
* @throws SearchException * @throws SearchException
*/ */
@Deprecated
JSONArray listPositionUsers(Map<String, Object> params) throws AccessTokenException, SearchException; JSONArray listPositionUsers(Map<String, Object> params) throws AccessTokenException, SearchException;
/** /**
@ -70,6 +75,7 @@ public interface IUserService {
* @throws AccessTokenException * @throws AccessTokenException
* @throws SearchException * @throws SearchException
*/ */
@Deprecated
JSONArray listUserByIds(Map<String, Object> params) throws AccessTokenException, SearchException; JSONArray listUserByIds(Map<String, Object> params) throws AccessTokenException, SearchException;
/** /**
@ -80,6 +86,7 @@ public interface IUserService {
* @throws AccessTokenException * @throws AccessTokenException
* @throws SearchException * @throws SearchException
*/ */
@Deprecated
JSONArray listAllUsers(Map<String, Object> params) throws AccessTokenException, SearchException; JSONArray listAllUsers(Map<String, Object> params) throws AccessTokenException, SearchException;
/** /**
@ -90,6 +97,7 @@ public interface IUserService {
* @throws AccessTokenException * @throws AccessTokenException
* @throws SearchException * @throws SearchException
*/ */
@Deprecated
JSONArray listUserDepartmentUser(Map<String, Object> userParams) throws AccessTokenException, SearchException; JSONArray listUserDepartmentUser(Map<String, Object> userParams) throws AccessTokenException, SearchException;
/** /**
@ -100,6 +108,7 @@ public interface IUserService {
* @throws AccessTokenException * @throws AccessTokenException
* @throws SearchException * @throws SearchException
*/ */
@Deprecated
JSONArray listUserDepartmentUserByRole(Map<String, Object> params) throws AccessTokenException, SearchException; JSONArray listUserDepartmentUserByRole(Map<String, Object> params) throws AccessTokenException, SearchException;
/** /**
@ -109,6 +118,7 @@ public interface IUserService {
* @param userParams * @param userParams
* @return * @return
*/ */
@Deprecated
JSONArray listUserDepartmentUserByRole(String token, Map<String, Object> userParams) throws SearchException; JSONArray listUserDepartmentUserByRole(String token, Map<String, Object> userParams) throws SearchException;
/** /**
@ -119,6 +129,7 @@ public interface IUserService {
* @throws AccessTokenException * @throws AccessTokenException
* @throws SearchException * @throws SearchException
*/ */
@Deprecated
JSONArray listUserDepartmentUserByPosition(Map<String, Object> params) throws AccessTokenException, SearchException; JSONArray listUserDepartmentUserByPosition(Map<String, Object> params) throws AccessTokenException, SearchException;
/** /**
@ -129,6 +140,7 @@ public interface IUserService {
* @throws AccessTokenException * @throws AccessTokenException
* @throws SearchException * @throws SearchException
*/ */
@Deprecated
JSONObject getUserDetail(Map<String, Object> params) throws AccessTokenException, SearchException; JSONObject getUserDetail(Map<String, Object> params) throws AccessTokenException, SearchException;
/** /**
@ -140,6 +152,7 @@ public interface IUserService {
* @throws AccessTokenException * @throws AccessTokenException
* @throws SearchException * @throws SearchException
*/ */
@Deprecated
JSONArray listRoleUsers(String accessToken, Map<String, Object> params) throws AccessTokenException, SearchException; JSONArray listRoleUsers(String accessToken, Map<String, Object> params) throws AccessTokenException, SearchException;
/** /**
@ -221,6 +234,16 @@ public interface IUserService {
*/ */
SuccessResultList<List<UserResourceBO>> listPageUserSimple(Map<String, Object> params) throws AccessTokenException, SearchException; SuccessResultList<List<UserResourceBO>> listPageUserSimple(Map<String, Object> params) throws AccessTokenException, SearchException;
/**
* 用户列表通过用户Id列表
*
* @param userIds
* @return
* @throws AccessTokenException
* @throws SearchException
*/
List<UserResourceBO> listUserResourceByIds(List<String> userIds) throws AccessTokenException, SearchException;
/** /**
* 用户动态详情列表通过id列表 * 用户动态详情列表通过id列表
* *
@ -233,6 +256,7 @@ public interface IUserService {
/** /**
* 用户详情 * 用户详情
*
* @param userId * @param userId
* @return * @return
* @throws AccessTokenException * @throws AccessTokenException

View File

@ -19,10 +19,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 java.util.Collections; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* When you feel like quitting. Think about why you started * When you feel like quitting. Think about why you started
@ -198,6 +195,26 @@ public class UserServiceImpl extends AbstractService implements IUserService {
return successResult; return successResult;
} }
@Override
public List<UserResourceBO> listUserResourceByIds(List<String> userIds) throws AccessTokenException, SearchException {
if (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(4);
params.put("userIds", userIdsSB.toString());
params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
String result = restTemplateUtil.doPostForm(String.format(IApiConsts.LIST_USER_BY_ID, apiPathProperties.getUserCenter()), params);
searchResourceResult(result, "获取人员列表失败");
return JSONArray.parseArray(result, UserResourceBO.class);
}
@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.isEmpty()) {