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); + } }