From 01adcf3e2472ffcbf2ec3cf0f88f7f29b78588e5 Mon Sep 17 00:00:00 2001 From: wenc000 <450292408@qq.com> Date: Mon, 10 Feb 2020 00:14:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9EAPP=E7=9A=84=E4=BA=BA?= =?UTF-8?q?=E5=91=98=E9=80=89=E6=8B=A9=E5=92=8C=E6=A0=91=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../department/DepartmentAppController.java | 49 +++ .../app/apis/user/UserAppController.java | 49 +++ .../{ => apis}/file/FileAppController.java | 2 +- .../routes/tree/TreeAppRouteController.java | 37 +++ .../templates/tree/app/tree-user.html | 196 ++++++++++++ .../resources/templates/tree/app/tree-v2.html | 286 ++++++++++++++++++ 6 files changed, 618 insertions(+), 1 deletion(-) create mode 100644 cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/controller/app/apis/department/DepartmentAppController.java create mode 100644 cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/controller/app/apis/user/UserAppController.java rename cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/app/{ => apis}/file/FileAppController.java (98%) create mode 100644 cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/app/routes/tree/TreeAppRouteController.java create mode 100644 cloud-common-plugin/src/main/resources/templates/tree/app/tree-user.html create mode 100644 cloud-common-plugin/src/main/resources/templates/tree/app/tree-v2.html diff --git a/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/controller/app/apis/department/DepartmentAppController.java b/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/controller/app/apis/department/DepartmentAppController.java new file mode 100644 index 0000000..505e4e8 --- /dev/null +++ b/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/controller/app/apis/department/DepartmentAppController.java @@ -0,0 +1,49 @@ +package com.cm.common.plugin.oauth.controller.app.apis.department; + +import com.alibaba.fastjson.JSONArray; +import com.cm.common.base.AbstractController; +import com.cm.common.constants.ISystemConstant; +import com.cm.common.plugin.oauth.service.department.IDepartmentService; +import com.cm.common.result.ErrorResult; +import io.swagger.annotations.*; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +/** + * When you feel like quitting. Think about why you started + * 当你想要放弃的时候,想想当初你为何开始 + * + * @ClassName: DepartmentAppController + * @Description: 组织部门管理 + * @Author: WangGeng + * @Date: 2020/2/9 12:05 下午 + * @Version: 1.0 + **/ +@Api(tags = ISystemConstant.API_TAGS_APP_PREFIX + "组织部门管理") +@RestController +@RequestMapping(ISystemConstant.APP_PREFIX + "/department") +public class DepartmentAppController extends AbstractController { + + @Autowired + private IDepartmentService departmentService; + + @ApiOperation(value = "部门人员列表", notes = "部门人员列表接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "上级部门ID", paramType = "form") + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("listztreedepartmentwithuser") + public JSONArray listZTreeDepartmentWithUser(@RequestParam(required = false) String id) { + String departmentParentId = "0"; + if (!StringUtils.isBlank(id)) { + departmentParentId = id; + } + return departmentService.listZTreeDepartmentWithUser(departmentParentId); + } + + +} diff --git a/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/controller/app/apis/user/UserAppController.java b/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/controller/app/apis/user/UserAppController.java new file mode 100644 index 0000000..40363bf --- /dev/null +++ b/cloud-common-plugin-oauth/src/main/java/com/cm/common/plugin/oauth/controller/app/apis/user/UserAppController.java @@ -0,0 +1,49 @@ +package com.cm.common.plugin.oauth.controller.app.apis.user; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.cm.common.base.AbstractController; +import com.cm.common.constants.ISystemConstant; +import com.cm.common.exception.ParamsException; +import com.cm.common.plugin.oauth.service.user.IUserService; +import com.cm.common.result.ErrorResult; +import io.swagger.annotations.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * When you feel like quitting. Think about why you started + * 当你想要放弃的时候,想想当初你为何开始 + * + * @ClassName: UserAppController + * @Description: 用户管理 + * @Author: WangGeng + * @Date: 2020/2/9 12:07 下午 + * @Version: 1.0 + **/ +@Api(tags = ISystemConstant.API_TAGS_APP_PREFIX + "用户管理") +@RestController +@RequestMapping(ISystemConstant.APP_PREFIX + "/user") +public class UserAppController extends AbstractController { + + @Autowired + private IUserService userService; + + @ApiOperation(value = "通过用户和部门ID列表获取部门用户列表", notes = "通过用户和部门ID列表获取部门用户列表接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "selectedUsers", value = "用户和部门ID列表", paramType = "body") + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @PostMapping("listdepartmentuserbyuserdepartmentid") + public JSONArray listDepartmentUserByUserDepartmentId(@RequestBody JSONObject params) { + JSONArray selectedUsers = params.getJSONArray("selectedUsers"); + if (selectedUsers == null || selectedUsers.isEmpty()) { + throw new ParamsException("参数列表不能为空"); + } + return userService.listDepartmentUserByUserDepartmentId(params); + } + +} diff --git a/cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/app/file/FileAppController.java b/cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/app/apis/file/FileAppController.java similarity index 98% rename from cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/app/file/FileAppController.java rename to cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/app/apis/file/FileAppController.java index cacfe50..b77bdde 100644 --- a/cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/app/file/FileAppController.java +++ b/cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/app/apis/file/FileAppController.java @@ -1,4 +1,4 @@ -package com.cm.common.plugin.controller.app.file; +package com.cm.common.plugin.controller.app.apis.file; import com.cm.common.base.AbstractController; import com.cm.common.constants.ISystemConstant; diff --git a/cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/app/routes/tree/TreeAppRouteController.java b/cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/app/routes/tree/TreeAppRouteController.java new file mode 100644 index 0000000..3b032b3 --- /dev/null +++ b/cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/app/routes/tree/TreeAppRouteController.java @@ -0,0 +1,37 @@ +package com.cm.common.plugin.controller.app.routes.tree; + +import com.cm.common.constants.ISystemConstant; +import io.swagger.annotations.Api; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.ModelAndView; + +/** + * When you feel like quitting. Think about why you started + * 当你想要放弃的时候,想想当初你为何开始 + * + * @ClassName: TreeAppRouteController + * @Description: APP树结构 + * @Author: WangGeng + * @Date: 2020/2/9 11:58 上午 + * @Version: 1.0 + **/ +@Api(tags = ISystemConstant.API_TAGS_APP_ROUTE_PREFIX + "动态表单页面接口") +@Controller +@RequestMapping(ISystemConstant.APP_ROUTE_PREFIX + "/tree") +public class TreeAppRouteController { + + @GetMapping("treerelease/v2") + public ModelAndView treeV2() { + ModelAndView mv = new ModelAndView("tree/app/tree-v2"); + return mv; + } + + @GetMapping("treeuserrelease") + public ModelAndView treeUser() { + ModelAndView mv = new ModelAndView("tree/app/tree-user"); + return mv; + } + +} diff --git a/cloud-common-plugin/src/main/resources/templates/tree/app/tree-user.html b/cloud-common-plugin/src/main/resources/templates/tree/app/tree-user.html new file mode 100644 index 0000000..d529d12 --- /dev/null +++ b/cloud-common-plugin/src/main/resources/templates/tree/app/tree-user.html @@ -0,0 +1,196 @@ + + +
+