From e97a26997263b7ef1782c45745b76dfde7e499c0 Mon Sep 17 00:00:00 2001 From: gdg <764716047@qq.com> Date: 星期五, 12 三月 2021 08:21:48 +0800 Subject: [PATCH] 扣分改 --- src/main/java/com/nanometer/smartlab/controller/UserMngController.java | 54 ++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 48 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/nanometer/smartlab/controller/UserMngController.java b/src/main/java/com/nanometer/smartlab/controller/UserMngController.java index 9656bc2..0408681 100644 --- a/src/main/java/com/nanometer/smartlab/controller/UserMngController.java +++ b/src/main/java/com/nanometer/smartlab/controller/UserMngController.java @@ -73,6 +73,7 @@ private List<Waster> wasterSelectList; private String project; private String company; + private BaseRole role; public List<BaseRole> getRoleList() { return roleList; @@ -102,6 +103,13 @@ public void onNewBtnClick() { this.sysUser = new SysUser(); + if (this.selectedList.size() > 1) { + FacesUtils.warn("不能多选"); + return; + } + if (this.selectedList.size() == 1) { + this.sysUser = this.sysUserService.getSysUser(this.selectedList.get(0).getId()); + } this.action = Constants.ACTION_ADD; } @@ -412,8 +420,14 @@ return; } - // 检查ARP号 - if (this.sysUserService.isSysUserExist(this.sysUser.getArp(), null, null, this.sysUser.getId())) { + // 检查ARP号 //除自己外的arp +// if (this.sysUserService.isSysUserExist(this.sysUser.getArp(), null, null, this.sysUser.getId())) { +// FacesUtils.warn("ARP已存在。"); +// return; +// } + List<SysUser> list = sysUserService.getUserByArp(this.sysUser.getArp()); + assert list.size() < 2; + if (list.size() > 0 && !list.get(0).getId().equals(this.sysUser.getId())) { FacesUtils.warn("ARP已存在。"); return; } @@ -488,6 +502,16 @@ } } + + public void initPage() { + sysUser = sysUserService.getSysUser(getUser().getId()); + role = baseRoleService.getRoleByUserId(sysUser.getId()); + } + public boolean isAccess(String info) { + String permission = role.getBtnPermission(); + return permission.contains(info); + } + public LazyDataModel<SysUser> getDataModel() { if (this.dataModel == null) { this.dataModel = new LazyDataModel<SysUser>() { @@ -495,11 +519,29 @@ public List<SysUser> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, Object> filters) { List<SysUser> list = null; try { - int count = sysUserService.getSysUserTotalCount(arp, name,departmentName,project,company); - this.setRowCount(count); - if (count > 0) { - list = sysUserService.getSysUserList(arp, name,departmentName,project,company, first, pageSize); + //做可见人员过滤 + String userPermission = role.getUserPermission(); + if (userPermission.contains("自己")) { + list = Collections.singletonList(sysUserService.getSysUser(UserMngController.this.sysUser.getId())); + this.setRowCount(1); + + }else if (userPermission.contains("课题组")){ + project = sysUser.getProject(); + int count = sysUserService.getUserCountInProject(arp, name,departmentName,project,company); + this.setRowCount(count); + if (count > 0) { + list = sysUserService.getUserInProject(arp, name,departmentName,project,company, first, pageSize); + } + + }else{ + int count = sysUserService.getSysUserTotalCount(arp, name,departmentName,project,company); + this.setRowCount(count); + if (count > 0) { + list = sysUserService.getSysUserList(arp, name,departmentName,project,company, first, pageSize); + } } + + } catch (Exception e) { logger.error(e); } -- Gitblit v1.9.2