package com.nokia.vo;

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

@Data
public class YuceUserVo {
    // 用户id
    private Integer userId;
    // 姓名
    private String userName;
    // 省
    private String province;
    // 归属地市
    // private String belongCity;
    // 权限地市
    private Integer city;

    public YuceUserVo(User user) {
        this.userId = user.getUserId();
        this.userName = user.getUserName();
        this.province = user.getProvince().getAreaName();
        // this.belongCity = user.getCity().getCityNameZh();
        for (Role role : user.getRoles()) {
            if ("yuce".equals(role.getSystem())) {
                this.city = role.getCities().get(0).getAreaId();
            }
        }
    }
}
