From b2ffc170321de5ba1596e644ae076825ae948b8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=9C=E5=AD=A6=E6=88=90?= <1274337408@qq.com> Date: Mon, 12 Oct 2026 17:31:16 +0800 Subject: [PATCH] =?UTF-8?q?=E7=88=B1=E5=BF=83=E5=B8=AE=E6=89=B6-=E8=81=8C?= =?UTF-8?q?=E5=B7=A5=E6=85=B0=E9=97=AE-=E5=88=86=E5=B7=A5=E4=BC=9A?= =?UTF-8?q?=E5=AE=A1=E6=A0=B8=EF=BC=88=E6=89=8B=E6=9C=BA=E7=AB=AF=EF=BC=89?= =?UTF-8?q?=EF=BC=9A=201.superadmin=EF=BC=88=E5=B7=A5=E5=8F=B7=EF=BC=89?= =?UTF-8?q?=EF=BC=9A=E6=9F=A5=E7=9C=8B=E5=B9=B6=E5=AE=A1=E6=A0=B8=E5=85=A8?= =?UTF-8?q?=E9=83=A8=E5=88=86=E5=B7=A5=E4=BC=9A=E6=95=B0=E6=8D=AE=EF=BC=9B?= =?UTF-8?q?=202.gh01=EF=BC=88=E5=88=86=E5=B7=A5=E4=BC=9A=E4=B8=BB=E5=B8=AD?= =?UTF-8?q?=E8=A7=92=E8=89=B2=EF=BC=89=E3=80=81sp01=EF=BC=88=E8=81=8C?= =?UTF-8?q?=E5=B7=A5=E6=85=B0=E9=97=AE=E5=AE=A1=E6=89=B9=E5=91=98=EF=BC=89?= =?UTF-8?q?=EF=BC=9A=E5=8F=AA=E8=83=BD=E6=9F=A5=E7=9C=8B=E5=B9=B6=E5=AE=A1?= =?UTF-8?q?=E6=A0=B8=E8=87=AA=E5=B7=B1=E5=88=86=E5=B7=A5=E4=BC=9A=E7=9A=84?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=EF=BC=9B=203.sysadmin=EF=BC=88=E8=A7=92?= =?UTF-8?q?=E8=89=B2=EF=BC=89=EF=BC=9A=E4=B8=8D=E5=86=8D=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E6=8B=A5=E6=9C=89=E5=88=86=E5=B7=A5=E4=BC=9A=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E6=9D=83=E9=99=90=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../condolence/CondolenceAuditControll.java | 35 ++++++++++++------- .../condolence/CondolenceUcrCon.java | 33 +++++++++++++++-- .../views/mobile/condolence/audit_list.html | 3 +- 3 files changed, 55 insertions(+), 16 deletions(-) diff --git a/src/main/java/io/v/nutz/mobile/condolence/CondolenceAuditControll.java b/src/main/java/io/v/nutz/mobile/condolence/CondolenceAuditControll.java index 45d50e5..adbf5ad 100644 --- a/src/main/java/io/v/nutz/mobile/condolence/CondolenceAuditControll.java +++ b/src/main/java/io/v/nutz/mobile/condolence/CondolenceAuditControll.java @@ -65,20 +65,28 @@ public class CondolenceAuditControll { Cnd cnd = Cnd.NEW(); - if (!ShiroUtil.hasAnyRoles("sysadmin")) { + if (!"superadmin".equals(ShiroUtil.getPrincipalProperty("loginname"))) { SqlExpressionGroup group = new SqlExpressionGroup(); - if (ShiroUtil.hasAnyRoles("A06")) { - group.or(Cnd.exps("con.state_id", isAudit ? ">" : "=", 2020).or("con.state_id", isAudit ? ">" : "=", 2000)); -// cnd.and("con.state_id", isAudit ? ">" : "=", 2020); + boolean hasAuditRole = false; + if (ShiroUtil.hasAnyRoles("gh01,sp01")) { + group.or(Cnd.exps("con.state_id", isAudit ? ">" : "=", 2000) + .and("sqr.unionid", "=", Vi.getUnionId())); + hasAuditRole = true; } - if (ShiroUtil.hasAnyRoles("H04")) { - group.and("con.state_id", isAudit ? ">" : "=", 2000); - group.and("be.unionid", "=", Vi.getUnionId()); + if (ShiroUtil.hasAnyRoles("A06,sysadmin")) { + group.or(Cnd.exps("con.state_id", isAudit ? ">" : "=", 2020)); + hasAuditRole = true; } - if (ShiroUtil.hasAnyRoles("xghkj")) { - group.and("con.state_id", isAudit ? ">" : "=", 2012); + if (ShiroUtil.hasAnyRoles("xghkj,sysadmin")) { + group.or(Cnd.exps("con.state_id", isAudit ? ">" : "=", 2012)); + hasAuditRole = true; + } + if (hasAuditRole) { + cnd.and(group); + } else { + // 非慰问审核角色不允许查看手机端慰问审核数据。 + cnd.and("1", "=", 0); } - cnd.and(group); } else { cnd.and("con.state_id", "in", isAudit ? "1990,2010,2014,2030,2040" : "2000,2012,2020"); } @@ -108,11 +116,12 @@ public class CondolenceAuditControll { @At("/auditHtml") @Ok("re") public String auditHtml(Integer state_id) { - if (state_id == 2000 && ShiroUtil.hasAnyRoles("H04,A06,sysadmin")) { + boolean superadmin = "superadmin".equals(ShiroUtil.getPrincipalProperty("loginname")); + if (state_id == 2000 && (superadmin || ShiroUtil.hasAnyRoles("gh01,sp01"))) { return "beetl:/mobile/condolence/union_Audit.html"; - } else if (state_id == 2012 && ShiroUtil.hasAnyRoles("gh03,xghkj,sysadmin")) { + } else if (state_id == 2012 && (superadmin || ShiroUtil.hasAnyRoles("gh03,xghkj,sysadmin"))) { return "beetl:/mobile/condolence/fr_Audit.html"; - } else if (state_id == 2020 && ShiroUtil.hasAnyRoles("A06,sysadmin")) { + } else if (state_id == 2020 && (superadmin || ShiroUtil.hasAnyRoles("A06,sysadmin"))) { return "beetl:/mobile/condolence/school_Audit.html"; } return "beetl:/mobile/condolence/apply_info.html"; diff --git a/src/main/java/io/v/nutz/zgfw/controller/condolence/CondolenceUcrCon.java b/src/main/java/io/v/nutz/zgfw/controller/condolence/CondolenceUcrCon.java index 6223424..0a37313 100644 --- a/src/main/java/io/v/nutz/zgfw/controller/condolence/CondolenceUcrCon.java +++ b/src/main/java/io/v/nutz/zgfw/controller/condolence/CondolenceUcrCon.java @@ -1,5 +1,6 @@ package io.v.nutz.zgfw.controller.condolence; +import cn.wizzer.framework.base.Result; import io.v.nutz.annontation.ViReturn; import io.v.nutz.base.utils.DateUtil; import io.v.nutz.base.utils.MsgApi; @@ -90,7 +91,12 @@ public class CondolenceUcrCon { cnd.and("con.state_id", isAudit ? ">" : "=", 2000); if (!"superadmin".equals(ShiroUtil.getPrincipalProperty("loginname"))) { - cnd.and("sqr.unionid", "=", vi.getUnionId()); + if (ShiroUtil.hasAnyRoles("gh01,sp01")) { + cnd.and("sqr.unionid", "=", vi.getUnionId()); + } else { + // 非分工会主席、职工慰问审批员角色(包括sysadmin)不允许查看分工会审核数据。 + cnd.and("1", "=", 0); + } } Vi.cndPlus(cnd, "YEAR(con.apply_time)", "=", year); @@ -125,6 +131,10 @@ public class CondolenceUcrCon { @ViReturn @RequiresPermissions("fw.condolence.ucr") public Object doEdit(String id) { + Condolence condolence = condolenceService.fetch(id); + if (!hasReviewPermission(condolence)) { + return Result.error("您没有分工会审核权限!"); + } condolenceService.update(Chain.make("state_id", 2000), Cnd.where("id", "=", id)); return null; } @@ -133,11 +143,14 @@ public class CondolenceUcrCon { @ViReturn @RequiresPermissions("fw.condolence.ucr") public Object doReview(String id, Integer pass, Review review) { + Condolence condolence = condolenceService.fetch(id); + if (!hasReviewPermission(condolence)) { + return Result.error("您没有分工会审核权限!"); + } review.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString()); review.setUsername(ShiroUtil.getPrincipalProperty("username").toString()); review.setTime(DateUtil.getDate()); review = reviewService.insert(review); - Condolence condolence = condolenceService.fetch(id); condolence.setUnion_chairman_review(review.getId()); if (pass == 1) { condolence.setState_id("2010"); @@ -167,5 +180,21 @@ public class CondolenceUcrCon { return null; } + /** + * 校验分工会审核权限:superadmin可审核全部,分工会主席和职工慰问审批员只能审核本分工会数据。 + */ + private boolean hasReviewPermission(Condolence condolence) { + if ("superadmin".equals(ShiroUtil.getPrincipalProperty("loginname"))) { + return true; + } + if (condolence == null || !ShiroUtil.hasAnyRoles("gh01,sp01")) { + return false; + } + Sql sql = Sqls.fetchString(Sqls.create("select unionid from `user` where id = @id") + .setParam("id", condolence.getManager()).toString()); + condolenceService.dao().execute(sql); + return vi.getUnionId().equals(sql.getString()); + } + } diff --git a/src/main/resources/views/mobile/condolence/audit_list.html b/src/main/resources/views/mobile/condolence/audit_list.html index 60fd942..c848e36 100644 --- a/src/main/resources/views/mobile/condolence/audit_list.html +++ b/src/main/resources/views/mobile/condolence/audit_list.html @@ -106,7 +106,8 @@ layout("/mobile/platform.html"){ }, async flushUnits() { //this.$set(this.pageForm, "unitId", "") - if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}" === 'true') { + if ("${@shiro.getPrincipalProperty('loginname')}" === 'superadmin' || + "${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}" === 'true') { await mCommon.getUnitList(this.pageForm.unionId) } else { await mCommon.getUnitList("${@shiro.getPrincipalProperty('unit').getUnionid()}")