/// <summary>
 /// 获取一下终端用户User信息,包含完整的租户信息
 /// </summary>
 /// <param name="userCode"></param>
 /// <returns></returns>
 public EMUser GetUserFullInfo(string userCode)
 {
     UserService service = new UserService();
     EMUser user = service.GetUserFullInfo(userCode);
     return user;
 }
Beispiel #2
0
        public UserInfoViewModel AutoLogin(string userCode)
        {
            UserInfoViewModel viewModel = new UserInfoViewModel();
            try
            {
                IUserService service = new UserService();
                EMUser user = service.GetUserFullInfo(userCode);
                if (user != null)
                {
                    viewModel = ConvertToViewModel(user);

                    //租户类型
                    IEMTenantService tenantService = new EMTenantService();
                    EMTenant tenant = tenantService.Select(user.TenantCode);
                    viewModel.TenantType = (int)tenant.TenantType;
                    viewModel.TenantLogoImgURl = tenant.LogoUrl;
                    if (tenant.TenantType != EnumTenantType.PlatProvider)
                    {
                        EMTenant superTenant = tenantService.Select(tenant.SuperTenantID);
                        viewModel.SuperContactNumber = superTenant.PhoneNumber;
                        viewModel.SuperTenantName = superTenant.TenantName;
                        viewModel.TenantLogoImgURl = superTenant.LogoUrl;
                    }

                    //获取地图类型
                    PositioningWCFService mapTypeService = new PositioningWCFService();
                    List<MapTypeViewModel> listMapType = mapTypeService.GetMapType();
                    viewModel.MapTypes = listMapType;

                    //令牌环
                    Ticket ticket = new Ticket() { UserCode = user.UserCode, UserName = user.UserName, Password = user.PassWord };
                    string token = EncryptUtil.Encrypt<Ticket>(ticket);
                    viewModel.Token = token;
                }
                else
                {
                    viewModel.Msg = "未找到记录,UserCode:+" + userCode;
                } return viewModel;
            }
            catch (Exception ex)
            {
                viewModel.Msg = "发生未处理错误,请联系系统管理员";
                Logger.Error(ex.Message);
                return viewModel;
            }
        }