diff --git a/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/service/user/impl/UserServiceImpl.java b/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/service/user/impl/UserServiceImpl.java index ff149db..d201cef 100644 --- a/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/service/user/impl/UserServiceImpl.java +++ b/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/service/user/impl/UserServiceImpl.java @@ -46,49 +46,56 @@ public class UserServiceImpl extends AbstractService implements IUserService { @Override public JSONArray listDepartmentUsers(Map params) throws AccessTokenException, SearchException { - String result = restTemplateUtil.doPostForm(String.format(IApiConsts.LIST_DEPARTMENT_USER, apiPathProperties.getUserCenter(), params.get("departmentId").toString()), params); + 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 params) throws AccessTokenException, SearchException { - String result = restTemplateUtil.doPostForm(String.format(IApiConsts.LIST_ROLE_USER, apiPathProperties.getUserCenter(), params.get("roleId").toString()), params); + 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 params) throws AccessTokenException, SearchException { - String result = restTemplateUtil.doPostForm(String.format(IApiConsts.LIST_GROUP_USER, apiPathProperties.getUserCenter(), params.get("groupId").toString()), params); + 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 params) throws AccessTokenException, SearchException { - String result = restTemplateUtil.doPostForm(String.format(IApiConsts.LIST_POSITION_USER, apiPathProperties.getUserCenter(), params.get("positionId").toString()), params); + 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 params) throws AccessTokenException, SearchException { - String result = restTemplateUtil.doPostForm(String.format(IApiConsts.LIST_ALL_USER, apiPathProperties.getUserCenter()), params); + 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 params) throws AccessTokenException, SearchException { - String result = restTemplateUtil.doPostForm(String.format(IApiConsts.LIST_USER_DEPARTMENT_USER, apiPathProperties.getUserCenter(), params.get("userId").toString()), params); + 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 params) throws AccessTokenException, SearchException { - String result = restTemplateUtil.doPostForm(String.format(IApiConsts.LIST_USER_DEPARTMENT_USER_BY_ROLE, apiPathProperties.getUserCenter(), params.get("userId").toString(), params.get("roleId").toString()), params); + 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); } @@ -102,14 +109,16 @@ public class UserServiceImpl extends AbstractService implements IUserService { @Override public JSONArray listUserDepartmentUserByPosition(Map params) throws AccessTokenException, SearchException { - String result = restTemplateUtil.doPostForm(String.format(IApiConsts.LIST_USER_DEPARTMENT_USER_BY_POSITION, apiPathProperties.getUserCenter(), params.get("userId").toString(), params.get("positionId").toString()), params); + 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 params) throws AccessTokenException, SearchException { - String result = restTemplateUtil.doPostForm(String.format(IApiConsts.GET_USER_DETAIL, apiPathProperties.getUserCenter(), params.get("userId").toString()), params); + 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); } @@ -131,7 +140,8 @@ public class UserServiceImpl extends AbstractService implements IUserService { @Override public SuccessResult updateUserPassword(Map params) throws AccessTokenException, SearchException { - String result = restTemplateUtil.doPostForm(String.format(IApiConsts.UPDATE_USER_PASSWORD, apiPathProperties.getUserCenter()), params); + params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken()); + String result = restTemplateUtil.doPostFormNormal(String.format(IApiConsts.UPDATE_USER_PASSWORD, apiPathProperties.getUserCenter()), params); updateResourceResult(result, "密码修改失败"); return new SuccessResult(); }