From fb93a08e9fecbf865e0a382fe4c0365add736199 Mon Sep 17 00:00:00 2001 From: wenc000 <450292408@qq.com> Date: Wed, 1 Jan 2020 21:08:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AE=A2=E6=88=B7=E7=AB=AF?= =?UTF-8?q?=E9=83=A8=E9=97=A8=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/cm/common/plugin/IApiConsts.java | 5 +++++ .../apis/department/DepartmentController.java | 11 +++++++++++ .../oauth/service/department/IDepartmentService.java | 10 ++++++++++ .../department/impl/DepartmentServiceImpl.java | 8 ++++++++ 4 files changed, 34 insertions(+) diff --git a/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/IApiConsts.java b/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/IApiConsts.java index 18aea8e..1f289a7 100644 --- a/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/IApiConsts.java +++ b/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/IApiConsts.java @@ -113,4 +113,9 @@ public interface IApiConsts { * 部门人员列表 */ String LIST_DEPARTMENT_USER_BY_USER_DEPARTMENT_ID = "%s/resource/user/listdepartmentuserbyuserdepartmentid"; + + /** + * 部门zTree + */ + String LIST_ZTREE_DEPARTMENT = "%s/resource/department/listztreedepartment"; } diff --git a/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/controller/apis/department/DepartmentController.java b/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/controller/apis/department/DepartmentController.java index 343c402..f878179 100644 --- a/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/controller/apis/department/DepartmentController.java +++ b/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/controller/apis/department/DepartmentController.java @@ -49,6 +49,17 @@ public class DepartmentController extends AbstractController { return departmentService.listDepartments(params); } + @ApiOperation(value = "部门列表(zTree)", notes = "部门列表(zTree)接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "上级部门ID", paramType = "form") + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("listztreedepartment") + public JSONArray listZTreeDepartment() throws AccessTokenException, SearchException { + Map params = requestParams(); + return departmentService.listZTreeDepartment(params); + } + @ApiOperation(value = "部门人员列表", notes = "部门人员列表接口") @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "上级部门ID", paramType = "form") diff --git a/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/service/department/IDepartmentService.java b/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/service/department/IDepartmentService.java index 2980961..594240f 100644 --- a/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/service/department/IDepartmentService.java +++ b/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/service/department/IDepartmentService.java @@ -48,4 +48,14 @@ public interface IDepartmentService { * @throws SearchException */ JSONArray listZTreeDepartmentWithUser(String departmentParentId) throws AccessTokenException, SearchException; + + /** + * 部门ZTree列表 + * + * @param params + * @return + * @throws AccessTokenException + * @throws SearchException + */ + JSONArray listZTreeDepartment(Map params) throws AccessTokenException, SearchException; } diff --git a/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/service/department/impl/DepartmentServiceImpl.java b/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/service/department/impl/DepartmentServiceImpl.java index ae82528..c3d7652 100644 --- a/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/service/department/impl/DepartmentServiceImpl.java +++ b/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/service/department/impl/DepartmentServiceImpl.java @@ -67,4 +67,12 @@ public class DepartmentServiceImpl extends AbstractService implements IDepartmen searchResourceResult(result, "获取部门人员列表失败"); return JSONArray.parseArray(result); } + + @Override + public JSONArray listZTreeDepartment(Map params) throws AccessTokenException, SearchException { + params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken()); + String result = restTemplateUtil.doGetFormNormal(String.format(IApiConsts.LIST_ZTREE_DEPARTMENT, apiPathProperties.getUserCenter()), params); + searchResourceResult(result, "获取部门人员列表失败"); + return JSONArray.parseArray(result); + } }