Beispiel #1
0
        public async Task <ResponseBaseViewModel <GetCustomerInfoResponseViewModel> > GetCustomerInfo(
            [FromBody] GetCustomerInfoRequestViewModel request)
        {
            if (request == null)
            {
                request = new GetCustomerInfoRequestViewModel();
            }
            request.Cid = this.GetCid();
            GetCustomerInfoResponseViewModel viewModel = new GetCustomerInfoResponseViewModel();

            await new TaskFactory().StartNew(() =>
            {
                viewModel = _getCustomerInfoApplication.GetCustomerInfoByCid(request);
            });

            ResponseBaseViewModel <GetCustomerInfoResponseViewModel> v = new ResponseBaseViewModel
                                                                         <GetCustomerInfoResponseViewModel>
            {
                Flag = new ResponseCodeViewModel()
                {
                    Code = 0, MojoryToken = this.GetToken()
                },
                Data = viewModel
            };

            return(v);
        }
        public GetCustomerInfoResponseViewModel GetCustomerInfoByCid(GetCustomerInfoRequestViewModel request)
        {
            CustomerModel customerModel = _getCustomerServiceBll.GetCustomerByCid(request.Cid);

            GetCustomerInfoResponseViewModel viewMode =
                Mapper.Map <CustomerModel, GetCustomerInfoResponseViewModel>(customerModel);

            if (customerModel.Corporation != null)
            {
                viewMode.CorpName             = customerModel.Corporation?.CorpName;
                viewMode.IsCorpSystemCustomer = customerModel.Corporation?.IsAmplitudeCorp;
                viewMode.IsAllowUserInsurance = customerModel.Corporation.IsAllowUserInsurance;
                //赋值公司个性化信息
                viewMode.IsHeightSeat   = customerModel.Corporation.IsHeightSeat;
                viewMode.IsShareFly     = customerModel.Corporation.IsShareFly;
                viewMode.IsXYPrice      = customerModel.Corporation.IsXYPrice;
                viewMode.IsAllSeat      = customerModel.Corporation.IsAllSeat;
                viewMode.IsTravelReason = customerModel.Corporation.IsTravelReason;
                viewMode.IsNoteVerify   = customerModel.Corporation.IsNoteVerify;
                viewMode.IsTraAllSeat   = customerModel.Corporation.IsTraAllSeat;
            }
            GetContactInfoModel contactInfoModel = _getContactServiceBll.GetCorpContactByCid(viewMode.Cid);

            viewMode.ContactId = contactInfoModel?.ContactId;
            if (contactInfoModel?.IdentificationList != null)
            {
                viewMode.IdentificationList = Mapper
                                              .Map <List <IdentificationModel>, List <IdentificationViewModel> >(contactInfoModel.IdentificationList);
            }

            //读取默认的证件信息
            if (contactInfoModel != null && (contactInfoModel.DefaultIdentificationId ?? 0) > 0 && viewMode.IdentificationList != null)
            {
                foreach (
                    var identificationViewModel in
                    viewMode.IdentificationList.Where(
                        identificationViewModel =>
                        identificationViewModel.Iid == (contactInfoModel.DefaultIdentificationId ?? 0)))
                {
                    identificationViewModel.IsDefault = 1;
                }
            }

            return(viewMode);
        }