Compare commits
4
Commits
3a23146903
...
e9e6a4d4be
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e9e6a4d4be | ||
|
|
726ae57b96 | ||
|
|
56fe0c2933 | ||
|
|
1b98a1a24f |
@@ -34,6 +34,7 @@ RoleConstant {
|
||||
SCHOOL_OUTLAY_ADMIN("校工会经费管理员"),
|
||||
|
||||
BRANCH_UNION_ADMIN("分工会管理员"),
|
||||
BRANCH_UNION_CADRE("基层干部"),
|
||||
BRANCH_UNION_CHAIRMAN("分工会主席"),
|
||||
BRANCH_UNION_VICE_CHAIRMAN("分工会副主席"),
|
||||
BRANCH_UNION_OPERATOR("分工会操作员"),
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
package com.budwk.app.sys.controller;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
@@ -12,6 +16,7 @@ import com.budwk.app.base.exception.BaseException;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.CommonDownloadUtil;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.flow.constant.FlowConst;
|
||||
import com.budwk.app.flow.engine.FlowEngine;
|
||||
@@ -27,6 +32,7 @@ import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
@@ -44,6 +50,7 @@ import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
@@ -357,26 +364,29 @@ public class SysUnionController {
|
||||
unionCadre.setIsJoin(true);
|
||||
dao.insert(unionCadre);
|
||||
|
||||
// 去走工作流
|
||||
boolean isAdmin = AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name());
|
||||
Dict args = Dict.create();
|
||||
args.set("submit", isAdmin ? "admin" : "branch");
|
||||
args.set(FlowConst.SUBMIT_TYPE, ProcessSubmitTypeEnum.APPLY.getCode());
|
||||
args.set(FlowConst.FORM_DATA, unionCadre);
|
||||
|
||||
ProcessInstance instance = flowEngine.startProcessInstanceByKey("JCGHWY", unionCadre.getId(), SecurityUtil.getUserId(), args);
|
||||
// 自动完成第一个申请任务
|
||||
List<ProcessTask> doingTaskList = flowEngine.processTaskService().getDoingTaskList(instance.getId(), null);
|
||||
for (ProcessTask task : doingTaskList) {
|
||||
flowEngine.executeProcessTask(task.getId(), SecurityUtil.getUserId(), args);
|
||||
}
|
||||
|
||||
if (isAdmin) {
|
||||
// 如果是管理员,直接加角色
|
||||
sysRoleService.clear("sys_user_role", Cnd.where("roleId", "=", role.getId()).and("userId", "=", userId).and("unionId", "=", unionId));
|
||||
sysRoleService.insert("sys_user_role", Chain.make("roleId", role.getId()).add("userId", userId).add("unionId", unionId));
|
||||
Sys_role cadreRole = sysRoleService.getByCode(RoleConstant.BRANCH_UNION_CADRE);
|
||||
sysRoleService.clear("sys_user_role", Cnd.where("roleId", "=", cadreRole.getId()).and("userId", "=", userId).and("unionId", "=", unionId));
|
||||
sysRoleService.insert("sys_user_role", Chain.make("roleId", cadreRole.getId()).add("userId", userId).add("unionId", unionId));
|
||||
sysRoleService.clearCache();
|
||||
sysUserService.clearCache();
|
||||
} else {
|
||||
// 分工会管理员添加干部时提交校工会审核。
|
||||
Dict args = Dict.create();
|
||||
args.set("submit", "branch");
|
||||
args.set(FlowConst.SUBMIT_TYPE, ProcessSubmitTypeEnum.APPLY.getCode());
|
||||
args.set(FlowConst.FORM_DATA, unionCadre);
|
||||
|
||||
ProcessInstance instance = flowEngine.startProcessInstanceByKey("JCGHWY", unionCadre.getId(), SecurityUtil.getUserId(), args);
|
||||
// 自动完成第一个申请任务
|
||||
List<ProcessTask> doingTaskList = flowEngine.processTaskService().getDoingTaskList(instance.getId(), null);
|
||||
for (ProcessTask task : doingTaskList) {
|
||||
flowEngine.executeProcessTask(task.getId(), SecurityUtil.getUserId(), args);
|
||||
}
|
||||
}
|
||||
|
||||
return Result.success();
|
||||
@@ -385,11 +395,19 @@ public class SysUnionController {
|
||||
@At
|
||||
@ApiOperation("删除分工会人员角色")
|
||||
@SaCheckPermission("sys.manager.union.branchOfficer")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Result deleteBranchUnionUserRole(String userId, String roleCode, String unionId) {
|
||||
Sys_role role = sysRoleService.fetch(Cnd.where("code", "=", roleCode));
|
||||
if (Lang.isEmpty(role)) {
|
||||
throw new BaseException("无法找到{}对应编码的角色", roleCode);
|
||||
}
|
||||
Cnd unionCadreCnd = Cnd.where("userId", "=", userId)
|
||||
.and("unionId", "=", unionId).and("roleCode", "=", roleCode);
|
||||
List<Sys_union_cadre> unionCadres = dao.query(Sys_union_cadre.class, unionCadreCnd);
|
||||
// 删除干部申请时同步删除流程,避免审核列表残留空白待办。
|
||||
for (Sys_union_cadre unionCadre : unionCadres) {
|
||||
flowEngine.processInstanceService().deleteProcessInstanceByBusinessKey(unionCadre.getId());
|
||||
}
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("roleId", "=", role.getId());
|
||||
if (StrUtil.isNotBlank(userId)) {
|
||||
@@ -401,8 +419,20 @@ public class SysUnionController {
|
||||
|
||||
sysRoleService.clear("sys_user_role", cnd);
|
||||
|
||||
dao.clear(Sys_union_cadre.class, Cnd.where("userId", "=", userId)
|
||||
.and("unionId", "=", unionId).and("roleCode", "=", roleCode));
|
||||
dao.clear(Sys_union_cadre.class, unionCadreCnd);
|
||||
|
||||
List<String> branchUnionRoleCodes = sysDictService.getSubListByCode("BRANCH_UNION_ROLES")
|
||||
.stream().map(Sys_dict::getCode).toList();
|
||||
List<String> branchUnionRoleIds = CollUtil.isEmpty(branchUnionRoleCodes) ? List.of() :
|
||||
sysRoleService.query(Cnd.where("code", "in", branchUnionRoleCodes))
|
||||
.stream().map(Sys_role::getId).toList();
|
||||
int branchUnionRoleCount = CollUtil.isEmpty(branchUnionRoleIds) ? 0 : dao.count(Sys_user_role.class,
|
||||
Cnd.where("userId", "=", userId).and("unionId", "=", unionId).and("roleId", "in", branchUnionRoleIds));
|
||||
if (branchUnionRoleCount == 0) {
|
||||
Sys_role cadreRole = sysRoleService.getByCode(RoleConstant.BRANCH_UNION_CADRE);
|
||||
sysRoleService.clear("sys_user_role", Cnd.where("roleId", "=", cadreRole.getId())
|
||||
.and("userId", "=", userId).and("unionId", "=", unionId));
|
||||
}
|
||||
|
||||
sysRoleService.clearCache();
|
||||
sysUserService.clearCache();
|
||||
@@ -470,6 +500,57 @@ public class SysUnionController {
|
||||
return Result.success(pagination.getList());
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@ApiOperation("导出基层干部")
|
||||
@SaCheckPermission("sys.manager.union")
|
||||
public void exportCadre(HttpServletResponse response) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.loginname AS loginName,
|
||||
u.username AS userName,
|
||||
IFNULL(MAX(branchUnion.`name`), '') AS unionName,
|
||||
u.mobile,
|
||||
GROUP_CONCAT(DISTINCT role.`name` ORDER BY role.sort ASC SEPARATOR '、') AS roleName
|
||||
FROM
|
||||
sys_role role
|
||||
INNER JOIN sys_user_role ur ON role.id = ur.roleId
|
||||
INNER JOIN sys_user u ON u.id = ur.userId
|
||||
LEFT JOIN vw_user currentUser ON currentUser.id = u.id
|
||||
LEFT JOIN sys_union branchUnion ON branchUnion.id = COALESCE(NULLIF(currentUser.unionId, ''), NULLIF(ur.unionId, ''))
|
||||
INNER JOIN sys_dict roleDict ON roleDict.`code` = role.`code`
|
||||
INNER JOIN sys_dict roleParent ON roleParent.id = roleDict.parentId
|
||||
AND roleParent.`code` = 'BRANCH_UNION_ROLES'
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name())) {
|
||||
cnd.and("COALESCE(NULLIF(currentUser.unionId, ''), NULLIF(ur.unionId, ''))", "=", SecurityUtil.getUnionId());
|
||||
}
|
||||
cnd.groupBy("ur.userId");
|
||||
cnd.asc("MIN(branchUnion.unionCode)");
|
||||
cnd.asc("u.loginname");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = sysUnionService.listMap(sql);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
list.get(i).put("no", i + 1);
|
||||
}
|
||||
|
||||
List<ExcelExportEntity> exportEntities = new ArrayList<>();
|
||||
exportEntities.add(new ExcelExportEntity("序号", "no", 10));
|
||||
exportEntities.add(new ExcelExportEntity("工号", "loginName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("姓名", "userName", 20));
|
||||
exportEntities.add(new ExcelExportEntity("所属工会", "unionName", 30));
|
||||
exportEntities.add(new ExcelExportEntity("联系方式", "mobile", 20));
|
||||
exportEntities.add(new ExcelExportEntity("职务", "roleName", 30));
|
||||
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setSheetName("基层干部");
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, list);
|
||||
CommonDownloadUtil.download("基层干部.xlsx", workbook, response);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 基层干部审核相关
|
||||
@@ -510,6 +591,7 @@ public class SysUnionController {
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("t.taskName", "=", "2978a74a-75c1-4f95-99f9-9c08c480f1b5");
|
||||
cnd.and("info.id", "is not", null);
|
||||
if (pageForm.getAudit()) {
|
||||
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(),
|
||||
ProcessTaskStateEnum.WITHDRAW.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.budwk.app.sys.interceptor;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.flow.constant.FlowConst;
|
||||
import com.budwk.app.flow.engine.FlowInterceptor;
|
||||
import com.budwk.app.flow.engine.core.Execution;
|
||||
@@ -44,6 +45,13 @@ public class SysUnionSchoolAuditInterceptor implements FlowInterceptor {
|
||||
sysRoleService.insert("sys_user_role", Chain.make("roleId", role.getId())
|
||||
.add("userId", unionBean.getUserId()).add("unionId", unionBean.getUnionId()));
|
||||
|
||||
// 分工会干部统一增加基层干部角色,便于按干部身份集中管理。
|
||||
Sys_role cadreRole = sysRoleService.getByCode(RoleConstant.BRANCH_UNION_CADRE);
|
||||
sysRoleService.clear("sys_user_role", Cnd.where("roleId", "=", cadreRole.getId())
|
||||
.and("userId", "=", unionBean.getUserId()).and("unionId", "=", unionBean.getUnionId()));
|
||||
sysRoleService.insert("sys_user_role", Chain.make("roleId", cadreRole.getId())
|
||||
.add("userId", unionBean.getUserId()).add("unionId", unionBean.getUnionId()));
|
||||
|
||||
// 清除缓存
|
||||
sysRoleService.clearCache();
|
||||
sysUserService.clearCache();
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
-- 初始化“基层干部”角色,并修复误从角色管理页直接添加的历史分工会干部角色。
|
||||
-- 修复对象仅限:BRANCH_UNION_ROLES 的直接子角色、unionId 为空、且其他业务作用域均为空的 sys_user_role 记录。
|
||||
-- 人员当前所属分工会以 vw_user.unionId 为准;已有非空 unionId 的角色和已有干部档案均不改写。
|
||||
-- 历史修复不补建审核流程。
|
||||
|
||||
SET @now := CAST(UNIX_TIMESTAMP(NOW()) * 1000 AS UNSIGNED);
|
||||
|
||||
START TRANSACTION;
|
||||
|
||||
-- 一、初始化“基层干部”角色。
|
||||
INSERT INTO `sys_role`
|
||||
(`id`, `name`, `code`, `aliasName`, `disabled`, `unitid`, `note`, `sort`, `createdBy`, `createdAt`, `updatedBy`, `updatedAt`, `delFlag`)
|
||||
SELECT
|
||||
'c1d5a6e7b8f94032a1b2c3d4e5f60718', '基层干部', 'BRANCH_UNION_CADRE', 'BranchUnionCadre',
|
||||
0, NULL, '分工会干部统一身份角色', 50, '', @now, '', @now, 0
|
||||
FROM DUAL
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM `sys_role`
|
||||
WHERE `code` = 'BRANCH_UNION_CADRE'
|
||||
);
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS `tmp_role_manager_branch_cadre`;
|
||||
|
||||
-- 二、识别角色管理页直接添加的分工会干部角色。
|
||||
-- 角色管理页只写 roleId、userId,因此这里以 unionId 和其他业务作用域均为空作为历史数据识别条件。
|
||||
CREATE TEMPORARY TABLE `tmp_role_manager_branch_cadre` AS
|
||||
SELECT DISTINCT
|
||||
assigned_role.`roleId`,
|
||||
assigned_role.`userId`,
|
||||
business_role.`code` AS `roleCode`,
|
||||
user_info.`unionId`,
|
||||
branch_union.`name` AS `unionName`,
|
||||
user_info.`username`,
|
||||
user_info.`loginname`,
|
||||
user_info.`mobile`
|
||||
FROM `sys_user_role` assigned_role
|
||||
INNER JOIN `sys_role` business_role
|
||||
ON business_role.`id` = assigned_role.`roleId`
|
||||
INNER JOIN `sys_dict` branch_role_parent
|
||||
ON branch_role_parent.`code` = 'BRANCH_UNION_ROLES'
|
||||
INNER JOIN `sys_dict` branch_role_item
|
||||
ON branch_role_item.`parentId` = branch_role_parent.`id`
|
||||
AND branch_role_item.`code` = business_role.`code`
|
||||
INNER JOIN `vw_user` user_info
|
||||
ON user_info.`id` = assigned_role.`userId`
|
||||
INNER JOIN `sys_union` branch_union
|
||||
ON branch_union.`id` = user_info.`unionId`
|
||||
WHERE (assigned_role.`unionId` IS NULL OR assigned_role.`unionId` = '')
|
||||
AND (assigned_role.`unitId` IS NULL OR assigned_role.`unitId` = '')
|
||||
AND (assigned_role.`unionGroupId` IS NULL OR assigned_role.`unionGroupId` = '')
|
||||
AND (assigned_role.`tcDelegationId` IS NULL OR assigned_role.`tcDelegationId` = '')
|
||||
AND (assigned_role.`tcSessionId` IS NULL OR assigned_role.`tcSessionId` = '')
|
||||
AND (assigned_role.`wcDelegationId` IS NULL OR assigned_role.`wcDelegationId` = '')
|
||||
AND (assigned_role.`wcSessionId` IS NULL OR assigned_role.`wcSessionId` = '')
|
||||
AND (assigned_role.`clubId` IS NULL OR assigned_role.`clubId` = '')
|
||||
AND (assigned_role.`underTakeId` IS NULL OR assigned_role.`underTakeId` = '');
|
||||
|
||||
-- 将误从角色管理页添加的角色补成当前所属分工会的作用域角色。
|
||||
INSERT INTO `sys_user_role` (`roleId`, `userId`, `unionId`)
|
||||
SELECT
|
||||
repair.`roleId`, repair.`userId`, repair.`unionId`
|
||||
FROM `tmp_role_manager_branch_cadre` repair
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM `sys_user_role` existing_role
|
||||
WHERE existing_role.`roleId` = repair.`roleId`
|
||||
AND existing_role.`userId` = repair.`userId`
|
||||
AND existing_role.`unionId` = repair.`unionId`
|
||||
);
|
||||
|
||||
-- 确认分工会作用域角色存在后,删除同人员、同角色的原空作用域记录。
|
||||
DELETE global_role
|
||||
FROM `sys_user_role` global_role
|
||||
INNER JOIN `tmp_role_manager_branch_cadre` repair
|
||||
ON repair.`roleId` = global_role.`roleId`
|
||||
AND repair.`userId` = global_role.`userId`
|
||||
INNER JOIN `sys_user_role` scoped_role
|
||||
ON scoped_role.`roleId` = repair.`roleId`
|
||||
AND scoped_role.`userId` = repair.`userId`
|
||||
AND scoped_role.`unionId` = repair.`unionId`
|
||||
WHERE (global_role.`unionId` IS NULL OR global_role.`unionId` = '')
|
||||
AND (global_role.`unitId` IS NULL OR global_role.`unitId` = '')
|
||||
AND (global_role.`unionGroupId` IS NULL OR global_role.`unionGroupId` = '')
|
||||
AND (global_role.`tcDelegationId` IS NULL OR global_role.`tcDelegationId` = '')
|
||||
AND (global_role.`tcSessionId` IS NULL OR global_role.`tcSessionId` = '')
|
||||
AND (global_role.`wcDelegationId` IS NULL OR global_role.`wcDelegationId` = '')
|
||||
AND (global_role.`wcSessionId` IS NULL OR global_role.`wcSessionId` = '')
|
||||
AND (global_role.`clubId` IS NULL OR global_role.`clubId` = '')
|
||||
AND (global_role.`underTakeId` IS NULL OR global_role.`underTakeId` = '');
|
||||
|
||||
-- 角色管理页不会创建干部档案,为本次识别出的历史数据补建有效干部档案。
|
||||
INSERT INTO `sys_union_cadre`
|
||||
(`id`, `unionId`, `unionName`, `userId`, `userName`, `loginName`, `mobile`, `roleCode`, `applyDate`, `isJoin`,
|
||||
`createdBy`, `createdAt`, `updatedBy`, `updatedAt`, `delFlag`)
|
||||
SELECT
|
||||
LOWER(REPLACE(UUID(), '-', '')),
|
||||
repair.`unionId`,
|
||||
repair.`unionName`,
|
||||
repair.`userId`,
|
||||
repair.`username`,
|
||||
repair.`loginname`,
|
||||
repair.`mobile`,
|
||||
repair.`roleCode`,
|
||||
NOW(),
|
||||
1,
|
||||
'', @now, '', @now, 0
|
||||
FROM `tmp_role_manager_branch_cadre` repair
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM `sys_union_cadre` existing_cadre
|
||||
WHERE existing_cadre.`userId` = repair.`userId`
|
||||
AND existing_cadre.`unionId` = repair.`unionId`
|
||||
AND existing_cadre.`roleCode` = repair.`roleCode`
|
||||
AND (existing_cadre.`isJoin` = 1 OR existing_cadre.`isJoin` IS NULL)
|
||||
);
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS `tmp_valid_branch_cadre`;
|
||||
|
||||
-- 三、汇总当前分工会范围内已经生效的干部角色,用于初始化“基层干部”角色。
|
||||
CREATE TEMPORARY TABLE `tmp_valid_branch_cadre` AS
|
||||
SELECT DISTINCT
|
||||
assigned_role.`userId`,
|
||||
assigned_role.`unionId`
|
||||
FROM `sys_user_role` assigned_role
|
||||
INNER JOIN `sys_role` business_role
|
||||
ON business_role.`id` = assigned_role.`roleId`
|
||||
INNER JOIN `sys_dict` branch_role_parent
|
||||
ON branch_role_parent.`code` = 'BRANCH_UNION_ROLES'
|
||||
INNER JOIN `sys_dict` branch_role_item
|
||||
ON branch_role_item.`parentId` = branch_role_parent.`id`
|
||||
AND branch_role_item.`code` = business_role.`code`
|
||||
INNER JOIN `vw_user` user_info
|
||||
ON user_info.`id` = assigned_role.`userId`
|
||||
INNER JOIN `sys_union` branch_union
|
||||
ON branch_union.`id` = assigned_role.`unionId`
|
||||
WHERE assigned_role.`userId` IS NOT NULL
|
||||
AND assigned_role.`unionId` IS NOT NULL
|
||||
AND assigned_role.`unionId` <> ''
|
||||
AND assigned_role.`unionId` = user_info.`unionId`
|
||||
AND (assigned_role.`unitId` IS NULL OR assigned_role.`unitId` = '')
|
||||
AND (assigned_role.`unionGroupId` IS NULL OR assigned_role.`unionGroupId` = '')
|
||||
AND (assigned_role.`tcDelegationId` IS NULL OR assigned_role.`tcDelegationId` = '')
|
||||
AND (assigned_role.`tcSessionId` IS NULL OR assigned_role.`tcSessionId` = '')
|
||||
AND (assigned_role.`wcDelegationId` IS NULL OR assigned_role.`wcDelegationId` = '')
|
||||
AND (assigned_role.`wcSessionId` IS NULL OR assigned_role.`wcSessionId` = '')
|
||||
AND (assigned_role.`clubId` IS NULL OR assigned_role.`clubId` = '')
|
||||
AND (assigned_role.`underTakeId` IS NULL OR assigned_role.`underTakeId` = '');
|
||||
|
||||
-- 给现有有效分工会干部及本次修复的干部补充同分工会范围的“基层干部”角色。
|
||||
INSERT INTO `sys_user_role` (`roleId`, `userId`, `unionId`)
|
||||
SELECT
|
||||
cadre_role.`id`, valid_cadre.`userId`, valid_cadre.`unionId`
|
||||
FROM `tmp_valid_branch_cadre` valid_cadre
|
||||
INNER JOIN `sys_role` cadre_role
|
||||
ON cadre_role.`code` = 'BRANCH_UNION_CADRE'
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM `sys_user_role` existing_cadre_role
|
||||
WHERE existing_cadre_role.`roleId` = cadre_role.`id`
|
||||
AND existing_cadre_role.`userId` = valid_cadre.`userId`
|
||||
AND existing_cadre_role.`unionId` = valid_cadre.`unionId`
|
||||
);
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS `tmp_valid_branch_cadre`;
|
||||
DROP TEMPORARY TABLE IF EXISTS `tmp_role_manager_branch_cadre`;
|
||||
|
||||
COMMIT;
|
||||
@@ -6,7 +6,8 @@ const branchUnionManage = {
|
||||
<el-input placeholder="请输入分工会名称" clearable size="small" style="width: 300px" v-model="pageForm.searchKeyword"></el-input>
|
||||
|
||||
<el-button type="primary" class="ml5" size="small" icon="el-icon-search" @click="doSearch"></el-button>
|
||||
<el-button @click="openAudit" icon="el-icon-s-check" type="primary" style="margin-left: auto" size="small">基层干部审核</el-button>
|
||||
<el-button @click="exportCadre" icon="el-icon-download" type="primary" style="margin-left: auto" size="small">导出基层干部</el-button>
|
||||
<el-button @click="openAudit" icon="el-icon-s-check" type="primary" size="small">基层干部审核</el-button>
|
||||
<el-button @click="openAdd" icon="ti-plus" type="primary" size="small" v-if="$auth.hasPermission('sys.manager.union.add')">新建分工会</el-button>
|
||||
</el-row>
|
||||
</el-card>
|
||||
@@ -79,6 +80,10 @@ const branchUnionManage = {
|
||||
openAudit() {
|
||||
this.$emit('union-cadre')
|
||||
},
|
||||
// 导出基层干部
|
||||
exportCadre() {
|
||||
this.$downLoad("/platform/sys/union/exportCadre")
|
||||
},
|
||||
openAdd() {
|
||||
this.dialogFormVisible = true
|
||||
this.$nextTick(() => {
|
||||
|
||||
@@ -49,6 +49,7 @@ const branchUnionUserManage = {
|
||||
</el-form-item>
|
||||
<el-form-item prop="userId" label="人员">
|
||||
<user-select
|
||||
:key="union_id"
|
||||
v-model="formData.userId"
|
||||
style="width: 100%"
|
||||
api="/platform/sys/union/listUnion"
|
||||
@@ -86,6 +87,7 @@ const branchUnionUserManage = {
|
||||
},
|
||||
watch: {
|
||||
union_id(val) {
|
||||
this.$set(this.formData, "userId", "")
|
||||
this.doSearch()
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user