diff --git a/src/main/java/io/v/nutz/levelcheck/service/LevelCheckService.java b/src/main/java/io/v/nutz/levelcheck/service/LevelCheckService.java index ab41512..86261b6 100644 --- a/src/main/java/io/v/nutz/levelcheck/service/LevelCheckService.java +++ b/src/main/java/io/v/nutz/levelcheck/service/LevelCheckService.java @@ -50,6 +50,7 @@ public class LevelCheckService { "薪酬单位代码", "职工号", "姓名", "扣工会会费", "年月", "所在单位" ); private static final String UNIT_HEADER = "所在单位"; + private static final String THIRD_UNIT_MANAGER_UNION_CODE = "28"; private static final ZoneId TASK_ZONE_ID = ZoneId.of("Asia/Shanghai"); @Inject @@ -745,11 +746,12 @@ public class LevelCheckService { String unionId = Strings.trim(config.getConfigValue()); Sys_union configuredUnion = dao.fetch(Sys_union.class, unionId); if (configuredUnion != null - && "机关党委工会".equals(Strings.trim(configuredUnion.getUnionname()))) { + && THIRD_UNIT_MANAGER_UNION_CODE.equals(Strings.trim(configuredUnion.getUnioncode()))) { return unionId; } } - Sys_union union = dao.fetch(Sys_union.class, Cnd.where("unionname", "=", "机关党委工会")); + Sys_union union = dao.fetch(Sys_union.class, + Cnd.where("unioncode", "=", THIRD_UNIT_MANAGER_UNION_CODE)); return union == null ? "" : union.getId(); } diff --git a/src/main/java/io/v/nutz/web/controllers/platform/sys/SysUnionMangeCon.java b/src/main/java/io/v/nutz/web/controllers/platform/sys/SysUnionMangeCon.java index afe8995..8fabf65 100644 --- a/src/main/java/io/v/nutz/web/controllers/platform/sys/SysUnionMangeCon.java +++ b/src/main/java/io/v/nutz/web/controllers/platform/sys/SysUnionMangeCon.java @@ -50,6 +50,7 @@ import java.util.stream.Collectors; @Ok("json") public class SysUnionMangeCon { private static final Log log = Logs.get(); + private static final String THIRD_UNIT_MANAGER_UNION_CODE = "28"; @Inject private SysUnionService sysUnionService; @@ -452,7 +453,7 @@ public class SysUnionMangeCon { throw new SecurityException("仅校工会管理员可设置三级管理员"); } Sys_union union = sysUnionService.fetch(unionId); - if (union == null || !"机关党委工会".equals(Strings.trim(union.getUnionname()))) { + if (union == null || !THIRD_UNIT_MANAGER_UNION_CODE.equals(Strings.trim(union.getUnioncode()))) { throw new IllegalArgumentException("仅机关党委工会的成员单位可设置三级管理员"); } Sys_unit unit = sysUnitService.fetch(unitId); diff --git a/src/main/resources/db/init_3_level_check.sql b/src/main/resources/db/init_3_level_check.sql index 804139f..172c357 100644 --- a/src/main/resources/db/init_3_level_check.sql +++ b/src/main/resources/db/init_3_level_check.sql @@ -10,6 +10,7 @@ SET @sysadmin_role_id = (SELECT id FROM sys_role WHERE code = 'sysadmin' LIMIT 1 SET @level_check_root_menu_id = 'a63f7fd56f594b29b2b5616d0d7f0101'; SET @level_check_school_menu_id = 'a63f7fd56f594b29b2b5616d0d7f0102'; SET @level_check_unit_menu_id = 'a63f7fd56f594b29b2b5616d0d7f0103'; +SET @third_admin_union_id = (SELECT id FROM sys_union WHERE unioncode = '28' ORDER BY id LIMIT 1); INSERT INTO sys_role (id, name, code, aliasName, disabled, note, createdBy, createdAt, updatedBy, updatedAt, delFlag) @@ -64,9 +65,13 @@ WHERE NOT EXISTS ( INSERT INTO sys_config (configKey, configValue, note, createdBy, createdAt, updatedBy, updatedAt, delFlag) -SELECT 'LevelCheckThirdAdminUnionId', IFNULL(( - SELECT id FROM sys_union WHERE unionname = '机关党委工会' ORDER BY id LIMIT 1 - ), ''), '允许设置三级管理员的特殊工会ID', '', 0, '', 0, 0 +SELECT 'LevelCheckThirdAdminUnionId', IFNULL(@third_admin_union_id, ''), + '允许设置三级管理员的特殊工会ID', '', 0, '', 0, 0 WHERE NOT EXISTS ( SELECT 1 FROM sys_config WHERE configKey = 'LevelCheckThirdAdminUnionId' ); + +UPDATE sys_config +SET configValue = IFNULL(@third_admin_union_id, configValue), + note = '允许设置三级管理员的特殊工会ID' +WHERE configKey = 'LevelCheckThirdAdminUnionId'; diff --git a/src/main/resources/views/platform/sys/union/unionMange.html b/src/main/resources/views/platform/sys/union/unionMange.html index 28f8970..1128f8e 100644 --- a/src/main/resources/views/platform/sys/union/unionMange.html +++ b/src/main/resources/views/platform/sys/union/unionMange.html @@ -806,7 +806,7 @@ layout("/layouts/platform.html"){ computed: { isSpecialUnion() { return this.sysadmin && this.node && this.node.data - && this.node.data.unionname === '机关党委工会' + && String(this.node.data.unioncode) === '28' } }, methods: {