package com.cm.common.pojo.bos;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName: UserInfoBO
 * @Description: 用户
 * @Author: WangGeng
 * @Date: 2019/3/24 11:03 PM
 * @Version: 1.0
 **/
public class UserInfoBO {

    private String userId;
    private String userUsername;
    private String userName;
    private String userPhone;
    private String userAvatar;
    private String userEmail;
    private String dataAuthority;
    private List<String> dataAuthorityUserIds;
    private List<String> baseDepartmentIds;
    private List<DepartmentBO> departments;
    private List<RoleBO> roles;
    private List<GroupBO> groups;
    private List<PositionBO> positions;
    private String roleIdAndNamesValue;
    private String groupIdAndNamesValue;
    private String departmentIdAndNamesValue;
    private String positionIdAndNamesValue;

    public String getUserId() {
        return userId == null ? "" : userId.trim();
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getUserUsername() {
        return userUsername == null ? "" : userUsername.trim();
    }

    public void setUserUsername(String userUsername) {
        this.userUsername = userUsername;
    }

    public String getUserName() {
        return userName == null ? "" : userName.trim();
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getUserPhone() {
        return userPhone == null ? "" : userPhone.trim();
    }

    public void setUserPhone(String userPhone) {
        this.userPhone = userPhone;
    }

    public String getUserAvatar() {
        return userAvatar == null ? "" : userAvatar;
    }

    public void setUserAvatar(String userAvatar) {
        this.userAvatar = userAvatar;
    }

    public String getUserEmail() {
        return userEmail == null ? "" : userEmail;
    }

    public void setUserEmail(String userEmail) {
        this.userEmail = userEmail;
    }

    public String getDataAuthority() {
        return dataAuthority == null ? "" : dataAuthority.trim();
    }

    public void setDataAuthority(String dataAuthority) {
        this.dataAuthority = dataAuthority;
    }

    public List<String> getDataAuthorityUserIds() {
        return dataAuthorityUserIds == null ? new ArrayList<>(0) : dataAuthorityUserIds;
    }

    public void setDataAuthorityUserIds(List<String> dataAuthorityUserIds) {
        this.dataAuthorityUserIds = dataAuthorityUserIds;
    }

    public List<String> getBaseDepartmentIds() {
        return baseDepartmentIds == null ? new ArrayList<>(0) : baseDepartmentIds;
    }

    public void setBaseDepartmentIds(List<String> baseDepartmentIds) {
        this.baseDepartmentIds = baseDepartmentIds;
    }

    public List<DepartmentBO> getDepartments() {
        return departments == null ? new ArrayList<>(0) : departments;
    }

    public void setDepartments(List<DepartmentBO> departments) {
        this.departments = departments;
        if (departments == null || departments.isEmpty()) {
            return;
        }
        StringBuilder idSB = new StringBuilder();
        StringBuilder nameSB = new StringBuilder();
        departments.forEach(departmentBO -> {
            if (idSB.length() > 0) {
                idSB.append(",");
                nameSB.append(",");
            }
            idSB.append(departmentBO.getDepartmentId());
            nameSB.append(departmentBO.getDepartmentName());
        });
        this.departmentIdAndNamesValue = idSB.append("|").append(nameSB).toString();
    }

    public List<RoleBO> getRoles() {
        return roles == null ? new ArrayList<>(0) : roles;
    }

    public void setRoles(List<RoleBO> roles) {
        this.roles = roles;
        if (roles == null || roles.isEmpty()) {
            return;
        }
        StringBuilder idSB = new StringBuilder();
        StringBuilder nameSB = new StringBuilder();
        roles.forEach(roleBO -> {
            if (idSB.length() > 0) {
                idSB.append(",");
                nameSB.append(",");
            }
            idSB.append(roleBO.getRoleId());
            nameSB.append(roleBO.getRoleName());
        });
        this.roleIdAndNamesValue = idSB.append("|").append(nameSB).toString();
    }

    public List<GroupBO> getGroups() {
        return groups == null ? new ArrayList<>(0) : groups;
    }

    public void setGroups(List<GroupBO> groups) {
        this.groups = groups;
        if (groups == null || groups.isEmpty()) {
            return;
        }
        StringBuilder idSB = new StringBuilder();
        StringBuilder nameSB = new StringBuilder();
        groups.forEach(groupBO -> {
            if (idSB.length() > 0) {
                idSB.append(",");
                nameSB.append(",");
            }
            idSB.append(groupBO.getGroupId());
            nameSB.append(groupBO.getGroupName());
        });
        this.groupIdAndNamesValue = idSB.append("|").append(nameSB).toString();
    }

    public List<PositionBO> getPositions() {
        return positions == null ? new ArrayList<>(0) : positions;
    }

    public void setPositions(List<PositionBO> positions) {
        this.positions = positions;
        if (positions == null || positions.isEmpty()) {
            return;
        }
        StringBuilder idSB = new StringBuilder();
        StringBuilder nameSB = new StringBuilder();
        positions.forEach(positionBO -> {
            if (idSB.length() > 0) {
                idSB.append(",");
                nameSB.append(",");
            }
            idSB.append(positionBO.getPositionId());
            nameSB.append(positionBO.getPositionName());
        });
        this.positionIdAndNamesValue = idSB.append("|").append(nameSB).toString();
    }

    public String getRoleIdAndNamesValue() {
        return roleIdAndNamesValue == null ? "" : roleIdAndNamesValue.trim();
    }

    public String getGroupIdAndNamesValue() {
        return groupIdAndNamesValue == null ? "" : groupIdAndNamesValue.trim();
    }

    public String getDepartmentIdAndNamesValue() {
        return departmentIdAndNamesValue == null ? "" : departmentIdAndNamesValue.trim();
    }

    public String getPositionIdAndNamesValue() {
        return positionIdAndNamesValue == null ? "" : positionIdAndNamesValue.trim();
    }

    @Override
    public String toString() {
        return "UserInfoBO{" +
                "userId='" + userId + '\'' +
                ", userUsername='" + userUsername + '\'' +
                ", userName='" + userName + '\'' +
                ", userPhone='" + userPhone + '\'' +
                ", userAvatar='" + userAvatar + '\'' +
                ", userEmail='" + userEmail + '\'' +
                ", dataAuthority='" + dataAuthority + '\'' +
                ", dataAuthorityUserIds=" + dataAuthorityUserIds +
                ", baseDepartmentIds=" + baseDepartmentIds +
                ", departments=" + departments +
                ", roles=" + roles +
                ", groups=" + groups +
                ", positions=" + positions +
                ", roleIdAndNamesValue='" + roleIdAndNamesValue + '\'' +
                ", groupIdAndNamesValue='" + groupIdAndNamesValue + '\'' +
                ", departmentIdAndNamesValue='" + departmentIdAndNamesValue + '\'' +
                ", positionIdAndNamesValue='" + positionIdAndNamesValue + '\'' +
                '}';
    }
}
