package com.nokia.vo;

import com.nokia.pojo.Role;
import com.nokia.pojo.User;
import lombok.Data;

/**
 * 大屏：
 * 用户姓名
 * 归属省
 * 归属地市
 * 权限：省级/地市级
 * 
 * system daping
 */
@Data
public class DapingUserVo {
    // 用户id
    private Integer userId;
    // 用户姓名
    private String userName;
    // 归属省份
    private String province;
    // 归属地市
    // private String belongCity;
    // 权限地市
    private String city;

    public DapingUserVo(User user) {
        this.userId = user.getUserId();
        this.userName = user.getUserName();
        this.province = user.getProvince().getAreaName();
        // this.belongCity = user.getCity().getCityNameZh();
        // 根据权限进行city赋权
        for (Role role : user.getRoles()) {
            if ("daping".equals(role.getSystem())) {
                this.city = role.getCities().get(0).getAreaName();
            }
        }
    }
}
