package com.cm.common.plugin.oauth.service.user.impl;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.cm.common.base.AbstractService;
import com.cm.common.component.OAuthRestTemplateComponent;
import com.cm.common.config.properties.ApiPathProperties;
import com.cm.common.exception.AccessTokenException;
import com.cm.common.exception.SearchException;
import com.cm.common.plugin.IApiConsts;
import com.cm.common.plugin.oauth.service.user.IUserService;
import com.cm.common.plugin.oauth.token.ClientTokenManager;
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.pojo.ListPage;
import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultList;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * When you feel like quitting. Think about why you started
 * 当你想要放弃的时候，想想当初你为何开始
 *
 * @ClassName: UserServiceImpl
 * @Description: 用户
 * @Author: WangGeng
 * @Date: 2019-07-29 21:23
 * @Version: 1.0
 **/
@Service
public class UserServiceImpl extends AbstractService implements IUserService {

    @Autowired
    private RestTemplateUtil restTemplateUtil;
    @Autowired
    private ApiPathProperties apiPathProperties;
    @Autowired
    private OAuthRestTemplateComponent oAuthRestTemplateComponent;

    @Override
    public JSONArray listDepartmentUsers(Map<String, Object> params) throws AccessTokenException, SearchException {
        params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
        String result = restTemplateUtil.doPostFormNormal(String.format(IApiConsts.LIST_DEPARTMENT_USER, apiPathProperties.getUserCenter(), params.get("departmentId").toString()), params);
        searchResourceResult(result, "获取人员列表失败");
        return JSONArray.parseArray(result);
    }

    @Override
    public JSONArray listRoleUsers(Map<String, Object> params) throws AccessTokenException, SearchException {
        params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
        String result = restTemplateUtil.doPostFormNormal(String.format(IApiConsts.LIST_ROLE_USER, apiPathProperties.getUserCenter(), params.get("roleId").toString()), params);
        searchResourceResult(result, "获取人员列表失败");
        return JSONArray.parseArray(result);
    }

    @Override
    public JSONArray listGroupUsers(Map<String, Object> params) throws AccessTokenException, SearchException {
        params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
        String result = restTemplateUtil.doPostFormNormal(String.format(IApiConsts.LIST_GROUP_USER, apiPathProperties.getUserCenter(), params.get("groupId").toString()), params);
        searchResourceResult(result, "获取人员列表失败");
        return JSONArray.parseArray(result);
    }

    @Override
    public JSONArray listPositionUsers(Map<String, Object> params) throws AccessTokenException, SearchException {
        params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
        String result = restTemplateUtil.doPostFormNormal(String.format(IApiConsts.LIST_POSITION_USER, apiPathProperties.getUserCenter(), params.get("positionId").toString()), params);
        searchResourceResult(result, "获取人员列表失败");
        return JSONArray.parseArray(result);
    }

    @Override
    public JSONArray listAllUsers(Map<String, Object> params) throws AccessTokenException, SearchException {
        params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
        String result = restTemplateUtil.doPostFormNormal(String.format(IApiConsts.LIST_ALL_USER, apiPathProperties.getUserCenter()), params);
        searchResourceResult(result, "获取全部人员列表失败");
        return JSONArray.parseArray(result);
    }

    @Override
    public JSONArray listUserDepartmentUser(Map<String, Object> params) throws AccessTokenException, SearchException {
        params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
        String result = restTemplateUtil.doPostFormNormal(String.format(IApiConsts.LIST_USER_DEPARTMENT_USER, apiPathProperties.getUserCenter(), params.get("userId").toString()), params);
        searchResourceResult(result, "获取人员列表失败");
        return JSONArray.parseArray(result);
    }

    @Override
    public JSONArray listUserDepartmentUserByRole(Map<String, Object> params) throws AccessTokenException, SearchException {
        params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
        String result = restTemplateUtil.doPostFormNormal(String.format(IApiConsts.LIST_USER_DEPARTMENT_USER_BY_ROLE, apiPathProperties.getUserCenter(), params.get("userId").toString(), params.get("roleId").toString()), params);
        searchResourceResult(result, "获取人员列表失败");
        return JSONArray.parseArray(result);
    }

    @Override
    public JSONArray listUserDepartmentUserByRole(String token, Map<String, Object> params) throws SearchException {
        String result = restTemplateUtil.doGetFormForApp(token, String.format(IApiConsts.APP_LIST_USER_DEPARTMENT_USER_BY_ROLE, apiPathProperties.getUserCenter(), params.get("userId").toString(), params.get("roleId").toString()), params);
        searchResourceResult(result, "获取人员列表失败");
        return JSONArray.parseArray(result);
    }

    @Override
    public JSONArray listUserDepartmentUserByPosition(Map<String, Object> params) throws AccessTokenException, SearchException {
        params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
        String result = restTemplateUtil.doPostFormNormal(String.format(IApiConsts.LIST_USER_DEPARTMENT_USER_BY_POSITION, apiPathProperties.getUserCenter(), params.get("userId").toString(), params.get("positionId").toString()), params);
        searchResourceResult(result, "获取人员列表失败");
        return JSONArray.parseArray(result);
    }

    @Override
    public JSONObject getUserDetail(Map<String, Object> params) throws AccessTokenException, SearchException {
        params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
        String result = restTemplateUtil.doPostFormNormal(String.format(IApiConsts.GET_USER_DETAIL, apiPathProperties.getUserCenter(), params.get("userId").toString()), params);
        searchResourceResult(result, "获取人员列表失败");
        return JSONObject.parseObject(result);
    }

    @Override
    public JSONArray listRoleUsers(String accessToken, Map<String, Object> params) throws AccessTokenException, SearchException {
        String result = oAuthRestTemplateComponent.doPostFormForOAuth2Client(accessToken, String.format(IApiConsts.LIST_ROLE_USER, apiPathProperties.getUserCenter(), params.get("roleId").toString()), params);
        searchResourceResult(result, "获取人员列表失败");
        return JSONArray.parseArray(result);
    }

    @Override
    public JSONObject getPasswordStatus() throws AccessTokenException, SearchException {
        Map<String, Object> params = getHashMap(0);
        String result = restTemplateUtil.doGetForm(String.format(IApiConsts.GET_PASSWORD_STATUS, apiPathProperties.getUserCenter()), params);
        searchResourceResult(result, "获取密码状态失败");
        return JSONObject.parseObject(result);
    }

    @Override
    public SuccessResult updateUserPassword(Map<String, Object> params) throws AccessTokenException, SearchException {
        params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
        String result = restTemplateUtil.doPostFormNormal(String.format(IApiConsts.UPDATE_USER_PASSWORD, apiPathProperties.getUserCenter(), securityComponent.getCurrentUser().getUserId()), params);
        updateResourceResult(result, "密码修改失败");
        return new SuccessResult();
    }

    @Override
    public JSONArray listDepartmentUserByUserDepartmentId(JSONObject jsonObject) throws AccessTokenException, SearchException {
        Map<String, Object> params = new HashMap<>(1);
        params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
        params.put("jsonObjectParams", jsonObject.toJSONString());
        String result = restTemplateUtil.doPostFormNormal(String.format(IApiConsts.LIST_DEPARTMENT_USER_BY_USER_DEPARTMENT_ID, apiPathProperties.getUserCenter()), params);
        searchResourceResult(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);
    }

    @Override
    public SuccessResultList<List<UserResourceBO>> listPageUserSimple(Map<String, Object> params) throws AccessTokenException, SearchException {
        params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
        String result = restTemplateUtil.doGetFormNormal(String.format(IApiConsts.LIST_PAGE_USER_SIMPLE, apiPathProperties.getUserCenter()), params);
        searchResourceResult(result, "获取用户列表（简单格式）失败");
        JSONObject resultObj = JSONObject.parseObject(result);
        SuccessResultList<List<UserResourceBO>> successResult = new SuccessResultList<>();
        successResult.setPage(resultObj.getInteger("page"));
        successResult.setTotal(resultObj.getLong("total"));
        successResult.setRows(resultObj.getJSONArray("rows").toJavaList(UserResourceBO.class));
        return successResult;
    }

    @Override
    public List<UserResourceBO> listUserResourceByIds(List<String> userIds) throws AccessTokenException, 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(4);
        params.put("userIds", userIdsSB.toString());
        params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
        String result = restTemplateUtil.doPostFormNormal(String.format(IApiConsts.LIST_USER_BY_ID, apiPathProperties.getUserCenter()), params);
        searchResourceResult(result, "获取人员列表失败");
        return JSONArray.parseArray(result, UserResourceBO.class);
    }

    @Override
    public List<UserResourceBO> listUserResourceByUsernames(List<String> usernames) throws AccessTokenException, SearchException {
        if (usernames == null || usernames.isEmpty()) {
            return new ArrayList<>();
        }
        StringBuilder usernamesSB = new StringBuilder();
        for (String username : usernames) {
            if (usernamesSB.length() > 0) {
                usernamesSB.append("_");
            }
            usernamesSB.append(username);
        }
        Map<String, Object> params = getHashMap(4);
        params.put("usernames", usernamesSB.toString());
        params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
        String result = restTemplateUtil.doPostFormNormal(String.format(IApiConsts.LIST_USER_BY_USERNAME, apiPathProperties.getUserCenter()), params);
        searchResourceResult(result, "获取人员列表失败");
        return JSONArray.parseArray(result, UserResourceBO.class);
    }

    @Override
    public JSONArray listDynamicUserInfoByIds(List<String> userIds) throws AccessTokenException, SearchException {
        if (userIds == null || userIds.isEmpty()) {
            return new JSONArray();
        }
        StringBuilder userIdsSB = new StringBuilder();
        for (String userId : userIds) {
            if (userIdsSB.length() > 0) {
                userIdsSB.append("_");
            }
            userIdsSB.append(userId);
        }
        Map<String, Object> params = getHashMap(10);
        params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
        params.put("userIds", userIdsSB.toString());
        String result = restTemplateUtil.doPostFormNormal(String.format(IApiConsts.LIST_DYNAMIC_USER_INFO_BY_IDS, apiPathProperties.getUserCenter()), params);
        searchResourceResult(result, "获取动态人员列表信息失败");
        return JSONArray.parseArray(result);
    }

    @Override
    public JSONObject getDynamicUserInfoByUserId(String userId) throws AccessTokenException, 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_DYNAMIC_USER_INFO_BY_ID, apiPathProperties.getUserCenter(), userId), params);
        searchResourceResult(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);
    }

    @Override
    public JSONArray listSelectDepartmentUser(String departmentId) throws SearchException {
        Map<String, Object> params = getHashMap(2);
        params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
        String result = restTemplateUtil.doGetFormNormal(String.format(IApiConsts.LIST_SELECT_DEPARTMENT_USER, apiPathProperties.getUserCenter(), departmentId), params);
        searchResourceResult(result, "获取组织部门人员列表失败");
        return JSONArray.parseArray(result);
    }

    @Override
    public JSONObject listPageSelectDepartmentUserByDepartmentId(String departmentId, ListPage page) throws SearchException {
        page.getParams().put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
        String result = restTemplateUtil.doGetFormNormal(String.format(IApiConsts.LIST_PAGE_SELECT_DEPARTMENT_USER, apiPathProperties.getUserCenter(), departmentId), page.getParams());
        searchResourceResult(result, "获取组织部门人员分页列表失败");
        return JSONObject.parseObject(result);
    }

    @Override
    public JSONArray listUserByIds(Map<String, Object> params) throws AccessTokenException, SearchException {
        params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
        String result = restTemplateUtil.doPostFormNormal(String.format(IApiConsts.LIST_USER_BY_ID, apiPathProperties.getUserCenter()), params);
        searchResourceResult(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);
    }
}
