新增用户方法

This commit is contained in:
wenc000 2020-11-12 17:39:17 +08:00
parent 9aff50313f
commit 4a3e1b1602
3 changed files with 32 additions and 0 deletions

View File

@ -196,4 +196,9 @@ public interface IApiConsts {
*/ */
String SEND_DINGDING_MSG_BY_PHONES = "%s/resource/dingdingmessage/sendbyphones"; String SEND_DINGDING_MSG_BY_PHONES = "%s/resource/dingdingmessage/sendbyphones";
/**
* 资源用户列表
*/
String LIST_USER_RESOURCE_BY_KEYWORDS = "%s/resource/user/listresourcebykeywords/%s";
} }

View File

@ -11,6 +11,7 @@ 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;
import java.io.UnsupportedEncodingException;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -349,4 +350,15 @@ public interface IUserService {
* @throws SearchException * @throws SearchException
*/ */
JSONArray listUserByIds(Map<String, Object> params) throws AccessTokenException, SearchException; JSONArray listUserByIds(Map<String, Object> params) throws AccessTokenException, SearchException;
/**
* 用户资源列表
*
* @param keywords 关键字
* @return
* @throws AccessTokenException
* @throws SearchException
*/
List<UserResourceBO> listResourceByKeywords(String keywords) throws AccessTokenException, SearchException, UnsupportedEncodingException;
} }

View File

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.cm.common.base.AbstractService; import com.cm.common.base.AbstractService;
import com.cm.common.component.OAuthRestTemplateComponent; import com.cm.common.component.OAuthRestTemplateComponent;
import com.cm.common.config.properties.ApiPathProperties; import com.cm.common.config.properties.ApiPathProperties;
import com.cm.common.constants.ISystemConstant;
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.IApiConsts; import com.cm.common.plugin.IApiConsts;
@ -22,6 +23,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.print.attribute.standard.PageRanges; import javax.print.attribute.standard.PageRanges;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.*; import java.util.*;
/** /**
@ -409,4 +412,16 @@ public class UserServiceImpl extends AbstractService implements IUserService {
searchResourceResult(result, "获取人员列表失败"); searchResourceResult(result, "获取人员列表失败");
return JSONArray.parseArray(result); return JSONArray.parseArray(result);
} }
@Override
public List<UserResourceBO> listResourceByKeywords(String keywords) throws AccessTokenException, SearchException {
if(StringUtils.isBlank(keywords)) {
return new ArrayList<>();
}
Map<String, Object> params = getHashMap(2);
params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
String result = restTemplateUtil.doGetFormNormal(String.format(IApiConsts.LIST_USER_RESOURCE_BY_KEYWORDS, apiPathProperties.getUserCenter(), keywords), params);
searchResourceResult(result, "获取人员资源列表失败");
return JSONArray.parseArray(result, UserResourceBO.class);
}
} }