From 855e29d9eb652a4deb8b22574a4f3fa58c568564 Mon Sep 17 00:00:00 2001 From: lihongyu <504404568@qq.com> Date: Sun, 28 Aug 2022 14:51:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E9=98=85=E8=A7=88=E6=9D=83?= =?UTF-8?q?=E9=99=90=E5=8F=96=E4=BA=A4=E9=9B=86=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../publish/dao/PublishListHistory.java | 2 - .../PALRepositoryQueryAPIManager.java | 70 +++++++++++++++++-- 2 files changed, 64 insertions(+), 8 deletions(-) diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/manage/publish/dao/PublishListHistory.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/manage/publish/dao/PublishListHistory.java index f17310a2..a31b3265 100755 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/manage/publish/dao/PublishListHistory.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/manage/publish/dao/PublishListHistory.java @@ -452,7 +452,6 @@ public final class PublishListHistory extends DaoObject * @return */ public String getLastPublishTaskIdByModelId(String repositoryId) { - System.out.println("repositoryId==============="+repositoryId); //String sql = "SELECT pl.TASKID FROM APP_ACT_COE_PAL_PUBLISH p, APP_ACT_COE_PAL_PUBLISH_LIST pl WHERE pl.pid = p.id AND pl.palrepositoryid = ? ORDER BY publishdate DESC"; String sql="SELECT TASKID FROM (SELECT TASKID FROM BO_ACT_COE_PUBLISH_N WHERE PUBLISHFILEID=? ORDER BY CREATEDATE DESC) WHERE ROWNUM=1"; String taskId = DBSql.getObject(sql, new RowMapper() { @@ -462,7 +461,6 @@ public final class PublishListHistory extends DaoObject } }, new Object[] { repositoryId }); - System.out.println("taskID====================="+taskId); return taskId; } diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/PALRepositoryQueryAPIManager.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/PALRepositoryQueryAPIManager.java index f24c5c1d..d882a2b9 100755 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/PALRepositoryQueryAPIManager.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/PALRepositoryQueryAPIManager.java @@ -3530,8 +3530,53 @@ public class PALRepositoryQueryAPIManager { return true; } } - // 判断组织权限 String orgPerm = bo.getString("ORGPERM"); + String postPerm = bo.getString("POSTPERM"); + String levelPerm = bo.getString("LEVELPERM"); + + // 根据发布流程选择的发布范围,获取所选组织、岗位、职级的交集进行权限控制 + + // 都不为空时 + if (UtilString.isNotEmpty(orgPerm) && UtilString.isNotEmpty(postPerm) && UtilString.isNotEmpty(levelPerm)) { + if (getOrgPerm(orgPerm, uc) && getPostPerm(postPerm, uc) && getLevelPerm(levelPerm, uc)) { + return true; + } + // 职级为空时 + } else if (UtilString.isNotEmpty(orgPerm) && UtilString.isNotEmpty(postPerm) && UtilString.isEmpty(levelPerm)) { + if (getOrgPerm(orgPerm, uc) && getPostPerm(postPerm, uc)) { + return true; + } + // 岗位为空时 + } else if (UtilString.isNotEmpty(orgPerm) && UtilString.isNotEmpty(levelPerm) && UtilString.isEmpty(postPerm)) { + if (getOrgPerm(orgPerm, uc) && getLevelPerm(levelPerm, uc)) { + return true; + } + // 组织为空时 + } else if (UtilString.isNotEmpty(postPerm) && UtilString.isNotEmpty(levelPerm) && UtilString.isEmpty(orgPerm)) { + if (getPostPerm(postPerm, uc) && getLevelPerm(levelPerm, uc)) { + return true; + } + // 组织、岗位为空时 + } else if (UtilString.isNotEmpty(levelPerm) && UtilString.isEmpty(postPerm) && UtilString.isEmpty(orgPerm)) { + if (getLevelPerm(levelPerm, uc)) { + return true; + } + // 组织、职级为空时 + } else if (UtilString.isNotEmpty(postPerm) && UtilString.isEmpty(levelPerm) && UtilString.isEmpty(orgPerm)) { + if (getPostPerm(postPerm, uc)) { + return true; + } + // 岗位、职级为空时 + } else if (UtilString.isNotEmpty(orgPerm) && UtilString.isEmpty(levelPerm) && UtilString.isEmpty(postPerm)) { + if (getOrgPerm(orgPerm, uc)) { + return true; + } + } + return false; + } + + //组织权限 + private boolean getOrgPerm(String orgPerm,UserContext uc) { if (UtilString.isNotEmpty(orgPerm)) { // 兼职 Set deptIdSet = new HashSet<>(); @@ -3556,8 +3601,10 @@ public class PALRepositoryQueryAPIManager { } } } - // 判断岗位权限 - String postPerm = bo.getString("POSTPERM"); + return false; + } + //岗位权限 + private boolean getPostPerm(String postPerm,UserContext uc) { if (UtilString.isNotEmpty(postPerm)) { String positionNo = uc.getUserModel().getPositionNo(); String [] positionIds = postPerm.split(","); @@ -3569,10 +3616,21 @@ public class PALRepositoryQueryAPIManager { return true; } } - // 判断职级权限 - String levelPerm = bo.getString("LEVELPERM"); + return false; + + } + //职级权限 + private boolean getLevelPerm(String levelPerm,UserContext uc) { if (UtilString.isNotEmpty(levelPerm)) { - // todo 待完善 + String userLevelPerm = uc.getUserModel().getExt2(); + String[] levelPermspArray = levelPerm.split(","); + Set levelPermspSet = new HashSet<>(); + for (int i = 0; i < levelPermspArray.length; i++) { + levelPermspSet.add(levelPermspArray[i]); + } + if(levelPermspSet.contains(userLevelPerm)) { + return true; + } } return false; }