From eaf839fd311f3721b99630ec434ff7549f92b66a Mon Sep 17 00:00:00 2001 From: ly19960718 <1622779752@qq.com> Date: Thu, 10 Jun 2021 16:07:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8E=A5=E5=8F=A3=20?= =?UTF-8?q?=E6=9C=BA=E6=9E=84=E7=94=A8=E6=88=B7=E6=95=B0=E6=8D=AE=E5=B0=81?= =?UTF-8?q?=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../departmentBaseController.java | 101 ++++++++++++++++-- .../resources/static/route/indexlib/save.html | 2 +- .../static/route/indexlib/update.html | 2 +- .../static/route/indextemplate/save.html | 2 +- .../static/route/indextemplate/update.html | 2 +- 5 files changed, 99 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/tenlion/twoduty/controller/api/departmentbase/departmentBaseController.java b/src/main/java/com/tenlion/twoduty/controller/api/departmentbase/departmentBaseController.java index 757c5b0..cb945cd 100644 --- a/src/main/java/com/tenlion/twoduty/controller/api/departmentbase/departmentBaseController.java +++ b/src/main/java/com/tenlion/twoduty/controller/api/departmentbase/departmentBaseController.java @@ -2,24 +2,37 @@ package com.tenlion.twoduty.controller.api.departmentbase; import ink.wgink.common.base.DefaultBaseController; +import ink.wgink.common.component.SecurityComponent; import ink.wgink.interfaces.consts.ISystemConstant; -import ink.wgink.pojo.dtos.department.DepartmentDTO; +import ink.wgink.interfaces.department.IDepartmentBaseService; +import ink.wgink.pojo.ListPage; +import ink.wgink.pojo.dtos.department.DepartmentUserDTO; +import ink.wgink.pojo.dtos.role.RoleDTO; +import ink.wgink.pojo.dtos.user.UserDTO; import ink.wgink.pojo.pos.DepartmentPO; +import ink.wgink.pojo.pos.RolePO; import ink.wgink.pojo.result.ErrorResult; +import ink.wgink.pojo.result.SuccessResultList; import ink.wgink.service.department.service.IDepartmentService; +import ink.wgink.service.department.service.IDepartmentUserService; +import ink.wgink.service.position.service.IPositionService; +import ink.wgink.service.role.service.IRoleService; +import ink.wgink.service.role.service.IRoleUserService; +import ink.wgink.service.user.service.IUserService; import io.swagger.annotations.*; -import org.apache.poi.hssf.record.ArrayRecord; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.ArrayList; import java.util.List; +import java.util.Map; /** * 组织机构数据封装 - * @author xwangs + * @author liuyang * @create 2021-03-29 15:31 * @description */ @@ -29,9 +42,39 @@ import java.util.List; public class departmentBaseController extends DefaultBaseController { @Autowired - private IDepartmentService departmentService; + protected SecurityComponent securityComponent; + @Autowired + private IDepartmentBaseService departmentBaseService; + @Autowired + private IDepartmentUserService departmentUserService; + @Autowired + private IRoleService roleService; + @Autowired + private IRoleUserService roleUserService; + @Autowired + private IUserService userService; + + + /** + * 组织机构默认ID + */ private final static String GENGID = "0"; + /** + * 领导角色ID + */ + private final static String ROLE_BOSS_ID = "1c482ced-c13a-4646-825a-6c14c2e6b305"; + /** + * 市局角色 + */ + private final static String ROLE_1_CODE = "0001"; + /** + * 旗县角色 + */ + private final static String ROLE_2_CODE = "0002"; + + + @@ -40,7 +83,54 @@ public class departmentBaseController extends DefaultBaseController { @GetMapping("list-jur") public List listJur(){ List list = new ArrayList<>(); - list = departmentService.listByParentId(GENGID); + List roles = securityComponent.getCurrentUser().getRoles(); +// for (RolePO role : roles) { +// //市局角色 +// if(ROLE_1_CODE.equals(role.getRoleCode())){ +// list = departmentBaseService.listByParentId(GENGID); +// break; +// } +// //旗县区角色 +// if(ROLE_2_CODE.equals(role.getRoleCode())){ +// for (DepartmentPO department : securityComponent.getCurrentUser().getDepartments()) { +// DepartmentPO po = departmentBaseService.getPO(department.getDepartmentId()); +// if(po != null){ +// list.add(po); +// } +// } +// break; +// } +// } + list = departmentBaseService.listByParentId(GENGID); + return list; + } + + + @ApiOperation(value = "组织机构领导用户列表", notes = "组织机构领导用户列表") + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("list-user-boss/{departmentId}") + public List listUserBoss(@PathVariable("departmentId") String departmentId){ + List list = new ArrayList<>(); + RoleDTO roleDTO = roleService.get(ROLE_BOSS_ID); + if(roleDTO == null){ + return list; + } + List listUsers = roleUserService.listUserId(roleDTO.getRoleId()); + // + List userIds = departmentUserService.listUserId(departmentId, listUsers); + list = userService.listByUserIds(userIds); + return list; + } + + + + @ApiOperation(value = "组织机构用户列表", notes = "组织机构用户列表") + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("list-user/{departmentId}") + public List listUser(@PathVariable("departmentId") String departmentId){ + List list = new ArrayList<>(); + List userIds = departmentUserService.listUserId(departmentId); + list = userService.listByUserIds(userIds); return list; } @@ -51,5 +141,4 @@ public class departmentBaseController extends DefaultBaseController { - } diff --git a/src/main/resources/static/route/indexlib/save.html b/src/main/resources/static/route/indexlib/save.html index 9257e1e..1b57498 100644 --- a/src/main/resources/static/route/indexlib/save.html +++ b/src/main/resources/static/route/indexlib/save.html @@ -64,7 +64,7 @@ -
+
diff --git a/src/main/resources/static/route/indexlib/update.html b/src/main/resources/static/route/indexlib/update.html index d88d6b4..7c58747 100644 --- a/src/main/resources/static/route/indexlib/update.html +++ b/src/main/resources/static/route/indexlib/update.html @@ -64,7 +64,7 @@
-
+
diff --git a/src/main/resources/static/route/indextemplate/save.html b/src/main/resources/static/route/indextemplate/save.html index 31dcaca..30d86cc 100644 --- a/src/main/resources/static/route/indextemplate/save.html +++ b/src/main/resources/static/route/indextemplate/save.html @@ -67,7 +67,7 @@
-
+
diff --git a/src/main/resources/static/route/indextemplate/update.html b/src/main/resources/static/route/indextemplate/update.html index ec2ea3b..849ea74 100644 --- a/src/main/resources/static/route/indextemplate/update.html +++ b/src/main/resources/static/route/indextemplate/update.html @@ -67,7 +67,7 @@
-
+