| | |
| | | private List<BaseMeta> codeList; |
| | | private List<BaseRole> roleList; |
| | | private List<Waster> wasterSelectList; |
| | | private String project; |
| | | private String company; |
| | | private BaseRole role; |
| | | |
| | | public List<BaseRole> getRoleList() { |
| | | return roleList; |
| | |
| | | |
| | | 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; |
| | | } |
| | | |
| | |
| | | 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; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | 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>() { |
| | |
| | | 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); |
| | | this.setRowCount(count); |
| | | if (count > 0) { |
| | | list = sysUserService.getSysUserList(arp, name,departmentName, 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); |
| | | } |
| | |
| | | public void setDepartmentName(String departmentName) { |
| | | this.departmentName = departmentName; |
| | | } |
| | | |
| | | public String getProject() { |
| | | return project; |
| | | } |
| | | |
| | | public void setProject(String project) { |
| | | this.project = project; |
| | | } |
| | | |
| | | public String getCompany() { |
| | | return company; |
| | | } |
| | | |
| | | public void setCompany(String company) { |
| | | this.company = company; |
| | | } |
| | | } |