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