From 89dc6a11d1849fb57203443c5bac56dc2d44b0c1 Mon Sep 17 00:00:00 2001 From: zhouhefeng Date: Thu, 11 Dec 2025 11:18:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=8E=B7=E5=8F=96=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E7=99=BB=E5=BD=95=E7=94=A8=E6=88=B7=E6=89=80=E5=9C=A8?= =?UTF-8?q?=E5=8D=95=E4=BD=8D=E5=85=9A=E5=A7=94=E4=B9=A6=E8=AE=B0=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=20=E4=BF=AE=E6=94=B9=E4=B8=BA=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=BD=93=E5=89=8D=E7=99=BB=E5=BD=95=E7=94=A8=E6=88=B7=E6=89=80?= =?UTF-8?q?=E5=9C=A8=E5=8D=95=E4=BD=8D=E5=85=9A=E5=A7=94=E4=B9=A6=E8=AE=B0?= =?UTF-8?q?=EF=BC=8C=E8=8B=A5=E6=98=AF=E6=9C=BA=E5=85=B3=E5=B0=B1=E6=89=BE?= =?UTF-8?q?=E5=87=BA=E6=9C=BA=E5=85=B3=E5=88=86=E4=B8=8B=E7=9A=84=E5=85=9A?= =?UTF-8?q?=E5=A7=94=E4=B9=A6=E8=AE=B0=E3=80=82=E5=9B=A0=E4=B8=BA=E6=9C=BA?= =?UTF-8?q?=E5=85=B3=E5=8F=AA=E6=9C=89=E4=B8=80=E4=B8=AA=E5=85=9A=E5=A7=94?= =?UTF-8?q?=E4=B9=A6=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FlowUnitPartySecretaryHandler.java | 26 ++++++++++++++----- .../views/platform/sys/unit/index.html | 1 - 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/budwk/app/flow/handler/FlowUnitPartySecretaryHandler.java b/src/main/java/com/budwk/app/flow/handler/FlowUnitPartySecretaryHandler.java index 940f8082..7ec0994c 100644 --- a/src/main/java/com/budwk/app/flow/handler/FlowUnitPartySecretaryHandler.java +++ b/src/main/java/com/budwk/app/flow/handler/FlowUnitPartySecretaryHandler.java @@ -6,8 +6,10 @@ import com.budwk.app.flow.engine.core.Execution; import com.budwk.app.flow.engine.core.ServiceContext; import com.budwk.app.flow.engine.model.TaskModel; import com.budwk.app.sys.models.Sys_role; +import com.budwk.app.sys.models.Sys_unit; import com.budwk.app.sys.models.Sys_user_role; import com.budwk.app.sys.services.SysRoleService; +import com.budwk.app.sys.views.View_user; import com.budwk.app.web.commons.auth.utils.SecurityUtil; import org.nutz.dao.Cnd; import org.nutz.dao.Dao; @@ -31,11 +33,23 @@ public class FlowUnitPartySecretaryHandler implements AssignmentHandler { SysRoleService sysRoleService = ServiceContext.find(SysRoleService.class); Sys_role role = sysRoleService.getByCode(RoleConstant.UNIT_PARTY_SECRETARY); - List roles = ServiceContext.find(Dao.class).query( - Sys_user_role.class, - Cnd.where(Sys_user_role::getRoleId, "=", role.getId()) - .and(Sys_user_role::getUnitId, "=", unitId) - ); + View_user user = ServiceContext.find(Dao.class).fetch(View_user.class, Cnd.where(View_user::getId, "=", SecurityUtil.getUserId())); + List roles; + if(user.getUnionName().contains("机关")){ + List unitList = ServiceContext.find(Dao.class).query(Sys_unit.class, Cnd.where(Sys_unit::getUnionId, "=", user.getUnionId())); + List unitIds = unitList.stream().map(Sys_unit::getId).toList(); + roles = ServiceContext.find(Dao.class).query( + Sys_user_role.class, + Cnd.where(Sys_user_role::getRoleId, "=", role.getId()) + .and(Sys_user_role::getUnitId, "in", unitIds) + ); + }else{ + roles = ServiceContext.find(Dao.class).query( + Sys_user_role.class, + Cnd.where(Sys_user_role::getRoleId, "=", role.getId()) + .and(Sys_user_role::getUnitId, "=", unitId) + ); + } if (Lang.isEmpty(roles)) { throw new RuntimeException("当前登录用户所在单位未设置单位党委书记,请联系校工会进行设置。"); @@ -45,7 +59,7 @@ public class FlowUnitPartySecretaryHandler implements AssignmentHandler { @Override public String getMessage() { - return "获取当前登录用户所在单位党委书记"; + return "获取当前登录用户所在单位党委书记,若是机关就找出机关分下的党委书记。因为机关只有一个党委书记"; } @Override diff --git a/src/main/resources/views/platform/sys/unit/index.html b/src/main/resources/views/platform/sys/unit/index.html index 23db11ed..b1bc6e4b 100644 --- a/src/main/resources/views/platform/sys/unit/index.html +++ b/src/main/resources/views/platform/sys/unit/index.html @@ -17,7 +17,6 @@ layout("/layouts/platform.html"){ label: 'name' }" node-key="id" - default-expand-all @node-click="treeNodeClick" :filter-node-method="filterNode" highlight-current