gdg
2021-02-25 ced11a778b9bf4deee59445a41e3ede298d8c963
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;
@@ -412,8 +413,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 +495,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 +512,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);
                    }