Ejemplo n.º 1
0
        public AddModApplyResponseViewModel AddModApply(AddModApplyRequestViewModel request)
        {
            int rmid = 0;

            AddRetModApplyModel modApplyModel = Mapper.Map <AddModApplyRequestViewModel, AddRetModApplyModel>(request);

            //1.获取改签乘客
            CustomerModel customerModel = _getCustomerServiceBll.GetCustomerByCid(request.Cid);

            modApplyModel.Customer       = customerModel;
            modApplyModel.IsOnlineRefund = request.IsOnline;
            modApplyModel.OrderType      = "M";
            modApplyModel.CorpId         = customerModel.CorpID;

            CorporationModel corporationModel = _getCorpServiceBll.GetCorp(customerModel.CorpID);

            if (corporationModel.IsAmplitudeCorp == "T")
            {
                modApplyModel.OrderStatus = "T";
            }


            using (var transaction = this.Context.Database.BeginTransaction())
            {
                try
                {
                    rmid = _addFltDomesticModApplyServiceBll.AddModApply(modApplyModel);
                    transaction.Commit();
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    throw;
                }
            }
            new TaskFactory().StartNew(() =>
            {
                //2.发送提醒邮件
                OperatorModel operatorModel = _getOperatorServiceBll.GetOperatorByOid(corporationModel.ResponsibleOid);
                string mail            = operatorModel.Email;
                string corporationName = corporationModel.CorpName;

                StringBuilder mailContent = new StringBuilder();
                mailContent.Append("<b>客户改签提醒:<b/>");
                mailContent.Append("<br/>");
                mailContent.Append("[" + corporationName + "] 已经申请了改签,订单编号:" + request.OrderId.ToString() + ",请差旅顾问及时处理!");
                mailContent.Append("<br/>");
                mailContent.Append("<b>下单时间:" + DateTime.Now + ",请及时关注~<b/>");
                if (!string.IsNullOrEmpty(mail))
                {
                    bool flag = EmailHelper.SendEmail("", "客户改签提醒", null, null, mailContent.ToString(), mail);
                }
            });

            return(new AddModApplyResponseViewModel()
            {
                Rmid = rmid
            });
        }
        public ConfirmTraOrderResponseViewModel GetTraComfireOrderView(ConfirmTraOrderRequestViewModel request)
        {
            CustomerModel customerModel = _getCustomerServiceBll.GetCustomerByCid(request.Cid);

            ConfirmTraOrderResponseViewModel v = new ConfirmTraOrderResponseViewModel();

            v.CName    = customerModel.RealName;
            v.EMail    = customerModel.Email;
            v.IsMaster = customerModel.IsMaster;
            v.Mobile   = customerModel.Mobile;
            if (!string.IsNullOrEmpty(customerModel.CorpID))
            {
                CorporationModel corporationModel = _getCorpServiceBll.GetCorp(customerModel.CorpID);
                v.IsPrint = corporationModel.IsPrint ?? 0;

                //服务费
                ServiceFeeInfoModel serviceFeeInfoModel = _getServiceFeeServiceBll.GetServiceFeeByCorpId(customerModel.CorpID, corporationModel.SfcId ?? 0);
                v.ServiceFee = serviceFeeInfoModel.TrainServiceFee;
                v.TrainGrabTicketServiceFee = serviceFeeInfoModel.TrainGrabTicketServiceFee;

                //获取成本中心
                List <CostCenterModel> costCenterModels =
                    _getCostCenterServiceBll.GetCostCenterByNoDelete(customerModel.CorpID);
                v.CostCenterList = Mapper.Map <List <CostCenterModel>, List <CostCenterViewModel> >(costCenterModels);
            }
            else
            {
                ServiceFeeInfoModel serviceFeeInfoModel = _getServiceFeeServiceBll.GetServiceFeeBySfcid(customerModel.SfcId ?? 0);
                v.ServiceFee = serviceFeeInfoModel.TrainServiceFee;
                v.TrainGrabTicketServiceFee = serviceFeeInfoModel.TrainGrabTicketServiceFee;
            }

            #region 项目名称
            List <ProjectNameModel> projectNameModels = _getProjectNameServiceBll.GetProjectNameByNotDelete(request.Cid);
            v.ProjectNameList = Mapper.Map <List <ProjectNameModel>, List <ProjectNameViewModel> >(projectNameModels);
            #endregion

            #region 证件类型
            v.CardTypeList = (from n in EnumConvert.QueryEnum <CardTypeEnum>()
                              select new SortedListViewModel()
            {
                Key = n.Key,
                Value = n.Value
            }).ToList();
            #endregion

            #region 配送方式
            v.SendTicketTypeList = (from sendTicket in EnumConvert.QueryEnum <SendTicketTypeEnum>()
                                    where sendTicket.Key != (int)SendTicketTypeEnum.Air
                                    select new SortedListViewModel()
            {
                Key = sendTicket.Key,
                Value = sendTicket.Value
            }).ToList();
            #endregion

            #region 12306帐号
            List <Tra12306AccountModel> accountModels = _get12306AccountServiceBll.GetTra12306Account();
            v.AccountList = (from n in accountModels
                             select new SortedListViewModel()
            {
                Key = n.PassId,
                Value = n.UserName
            }).ToList();
            #endregion

            #region 支付方式

            v.PayTypeList = new List <SortedListViewModel>
            {
                new SortedListViewModel()
                {
                    Key   = PayTypeEnum.Cas.ToString(),
                    Value = PayTypeEnum.Cas.ToDescription()
                },
                new SortedListViewModel()
                {
                    Key   = PayTypeEnum.Chk.ToString(),
                    Value = PayTypeEnum.Chk.ToDescription()
                }
            };
            if (!string.IsNullOrEmpty(customerModel.CorpID))
            {
                v.PayTypeList.Add(new SortedListViewModel()
                {
                    Key   = PayTypeEnum.Cro.ToString(),
                    Value = PayTypeEnum.Cro.ToDescription()
                });
            }

            #endregion

            List <ContactAddressModel> contactAddressModels =
                _getContactAddressServiceBll.GetContactAddressByCid(request.Cid);
            if (contactAddressModels != null && contactAddressModels.Count > 0)
            {
                v.AddressList = contactAddressModels.Select(n => n.Address).ToList();
            }

            return(v);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 显示创建订单页面
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public ComfireFlightOrderResponseViewModel ComfireOrderViewApplicationService(
            ComfireFlightOrderRequestViewModel request)
        {
            CustomerModel           customerModel     = _getCustomerServiceBll.GetCustomerByCid(request.Cid);
            List <ProjectNameModel> projectNameModels = _getProjectNameServiceBll.GetProjectNameByNotDelete(request.Cid);

            List <InsuranceCompanyModel> insuranceCompanyModels = _getInsuranceCompanyServiceBll.GetInsuranceCompany();

            if (request.OrderSource != "O")
            {
                insuranceCompanyModels = insuranceCompanyModels?.FindAll(n => n.UpOnLine == "T");
            }

            ComfireFlightOrderResponseViewModel v = new ComfireFlightOrderResponseViewModel();

            v.CName    = customerModel.RealName;
            v.EMail    = customerModel.Email;
            v.IsMaster = customerModel.IsMaster;
            v.Mobile   = customerModel.Mobile;
            if (!string.IsNullOrEmpty(customerModel.CorpID))
            {
                CorporationModel corporationModel = _getCorpServiceBll.GetCorp(customerModel.CorpID);
                v.IsPrint = corporationModel.IsPrint ?? 0;
                //获取成本中心
                List <CostCenterModel> costCenterModels =
                    _getCostCenterServiceBll.GetCostCenterByNoDelete(customerModel.CorpID);
                v.CostCenterList = Mapper.Map <List <CostCenterModel>, List <CostCenterViewModel> >(costCenterModels);
            }

            v.ProjectNameList = Mapper.Map <List <ProjectNameModel>, List <ProjectNameViewModel> >(projectNameModels);
            v.InsuranceList   = (from n in insuranceCompanyModels
                                 select new FltInsuranceViewModel()
            {
                ProductId = n.CompanyID,
                ProductName = n.ProductName,
                SalePrice = n.FacePrice
            }).ToList();

            v.CardTypeList = (from n in EnumConvert.QueryEnum <CardTypeEnum>()
                              select new SortedListViewModel()
            {
                Key = n.Key,
                Value = n.Value
            }).ToList();

            v.SendTicketTypeList = (from sendTicket in EnumConvert.QueryEnum <SendTicketTypeEnum>()
                                    where
                                    sendTicket.Key != (int)SendTicketTypeEnum.TraAfter &&
                                    sendTicket.Key != (int)SendTicketTypeEnum.TraBefore
                                    select new SortedListViewModel()
            {
                Key = sendTicket.Key,
                Value = sendTicket.Value
            }).ToList();

            List <ContactAddressModel> contactAddressModels =
                _getContactAddressServiceBll.GetContactAddressByCid(request.Cid);

            if (contactAddressModels != null && contactAddressModels.Count > 0)
            {
                v.AddressList = contactAddressModels.Select(n => n.Address).ToList();
            }

            return(v);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 创建机票订单
        /// </summary>
        /// <param name="orderViewModel"></param>
        /// <returns></returns>
        public AddOrderResponseViewModel AddDomesticOrderApplicationService(AddOrderRequestViewModel orderViewModel)
        {
            string        oidTemp       = orderViewModel.CreateOid;
            int           orderid       = 0;
            AddOrderModel addOrderModel = Mapper.Map <AddOrderRequestViewModel, AddOrderModel>(orderViewModel);

            //0.获取客户信息服务
            addOrderModel.Customer = _getCustomerServiceBll.GetCustomerByCid(orderViewModel.Cid);
            if (!string.IsNullOrEmpty(addOrderModel.Customer.CorpID))
            {
                CorporationModel corporationModel = _getCorpServiceBll.GetCorp(addOrderModel.Customer.CorpID);
                if (!addOrderModel.IsPrint.HasValue)
                {
                    addOrderModel.IsPrint = corporationModel.IsPrint ?? 0;
                }
                if (!string.IsNullOrEmpty(corporationModel.ResponsibleOid) && orderViewModel.OrderSource != "O")
                {
                    addOrderModel.CreateOid = corporationModel.ResponsibleOid;
                }
            }


            //1.获取乘机人的联系人Id对应的乘客信息
            List <int> contactList = addOrderModel.PassengerList.Select(n => n.Contactid ?? 0).ToList();

            addOrderModel.PassengerCustomerList = _getCorpPassengerCustomerServiceBll.GetCorpPassengerCustomer(contactList);

            OperatorModel operatorModel = _getOperatorServiceBll.GetOperatorByOid(addOrderModel.CreateOid);


            //2.创建订单服务
            using (var transaction = this.Context.Database.BeginTransaction())
            {
                try
                {
                    orderid = _addOrderServiceBll.AddDomesticOrder(addOrderModel);

                    #region 送审

                    if (orderid > 0)
                    {
                        SubmitCorpAduitOrderModel submitCorpAduitOrder = new SubmitCorpAduitOrderModel()
                        {
                            OrderInfoList = new List <SubmitCorpAduitOrderDetailModel>()
                            {
                                new SubmitCorpAduitOrderDetailModel()
                                {
                                    OrderId   = orderid,
                                    OrderType = OrderSourceTypeEnum.Flt
                                }
                            },
                            PolicyId        = addOrderModel.CorpPolicyId,
                            AduitConfigId   = addOrderModel.CorpAduitId,
                            Source          = orderViewModel.OrderSource,
                            SubmitCid       = orderViewModel.Cid,
                            SubmitOid       = oidTemp,
                            IsViolatePolicy =
                                (addOrderModel.FlightList.Find(n => !string.IsNullOrEmpty(n.CorpPolicy)) != null
                                    ? true
                                    : false),
                            OrderType = OrderSourceTypeEnum.Flt
                        };
                        _submitCorpAduitOrderServiceBll.Submit(submitCorpAduitOrder);
                    }

                    #endregion

                    transaction.Commit();
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    throw;
                }
            }
            string PNRstr  = "";                                                        //获取后邮件中使用
            string testCid = AppSettingsHelper.GetAppSettings(AppSettingsEnum.TestCid); //生产环境,测试帐号不许定位
            if (testCid != orderViewModel.Cid.ToString())
            {
                //3.调取pnr定位服务
                PNRstr = _getPnrNoServiceBll.GetPnrNo(orderid, operatorModel?.Email);
            }
            //4.发送提醒邮件
            new TaskFactory().StartNew(() =>
            {
                string mail               = operatorModel.Email;
                string corporationName    = addOrderModel.PassengerCustomerList[0].Corporation.CorpName;
                string operatorName       = addOrderModel.Cname;
                string dport              = addOrderModel.FlightList[0].Dport;
                string aport              = addOrderModel.FlightList[0].Aport;
                string aDate              = addOrderModel.FlightList[0].TackoffTime.ToString();
                string bDate              = addOrderModel.FlightList[0].ArrivalsTime.ToString();
                StringBuilder mailContent = new StringBuilder();
                mailContent.Append("<b>订单生成提醒:<b/>");
                mailContent.Append("<br/>");
                mailContent.Append("[" + corporationName + "] 已生成订单:" + orderid + ",请差旅顾问及时处理!");
                mailContent.Append("<br/>");
                mailContent.Append("联系人姓名:" + addOrderModel.Cname + "");
                mailContent.Append("<br/>");
                mailContent.Append("行程:" + dport + " - " + aport + "");
                mailContent.Append("<br/>");
                mailContent.Append("起飞时间:" + aDate + "");
                mailContent.Append("<br/>");
                mailContent.Append("抵达时间:" + bDate + "");
                mailContent.Append("<br/>");
                mailContent.Append("<b>下单时间:" + DateTime.Now + ",请及时关注~<b/>");
                if (!string.IsNullOrEmpty(mail))
                {
                    bool flag = EmailHelper.SendEmail("", "订单生成提醒", null, null, mailContent.ToString(), mail);
                }
            });

            return(new AddOrderResponseViewModel()
            {
                OrderId = orderid
            });
        }
Ejemplo n.º 5
0
        public AddTraOrderResponseViewModel AddTraOrder(AddTraOrderRequestViewModel request)
        {
            //判断是否是生产环境,如果不是则强制request.AddOrderType=1,不走接口
            string oidTemp = request.Order.CreateOid;
            TraAddOrderResultModel addOrderResultModel = new TraAddOrderResultModel();
            TraAddOrderModel       addOrderModel       = Mapper.Map <AddTraOrderRequestViewModel, TraAddOrderModel>(request);

            addOrderModel.Order.Cid         = request.Cid;
            addOrderModel.Order.OrderSource = request.OrderSource;



            //0.获取客户信息服务
            addOrderModel.Customer = _getCustomerServiceBll.GetCustomerByCid(request.Cid);
            if (!string.IsNullOrEmpty(addOrderModel.Customer.CorpID))
            {
                CorporationModel corporationModel = _getCorpServiceBll.GetCorp(addOrderModel.Customer.CorpID);
                if (!addOrderModel.Order.IsPrint.HasValue)
                {
                    addOrderModel.Order.IsPrint = corporationModel.IsPrint ?? 0;
                }
                if (!string.IsNullOrEmpty(corporationModel.ResponsibleOid) && request.OrderSource != "O")
                {
                    addOrderModel.Order.CreateOid = corporationModel.ResponsibleOid;
                    if (addOrderModel.OrderStatus == null)
                    {
                        addOrderModel.OrderStatus = new TraOrderStatusModel();
                    }
                    if ((addOrderModel.OrderStatus.ProccessStatus & 64) != 64)
                    {
                        addOrderModel.OrderStatus.ProccessStatus = addOrderModel.OrderStatus.ProccessStatus + 64;
                    }
                }
            }

            //1.添加火车订单
            using (var transaction = this.Context.Database.BeginTransaction())
            {
                try
                {
                    /***
                     * 1)手动路线:
                     * 添加完订单,直接发起送审
                     * 2)自动路线:
                     * 添加完订单,不发起送审,发起申请占位请求,在确认占位后再发起送审
                     * **/
                    addOrderResultModel = _addTraOrderServiceBll.AddTraOrder(addOrderModel);

                    #region 送审

                    if (addOrderResultModel.OrderId > 0 && request.AddOrderType == 1)//手动路线发起送审
                    {
                        SubmitCorpAduitOrderModel submitCorpAduitOrder = new SubmitCorpAduitOrderModel()
                        {
                            OrderInfoList = new List <SubmitCorpAduitOrderDetailModel>()
                            {
                                new SubmitCorpAduitOrderDetailModel()
                                {
                                    OrderId   = addOrderResultModel.OrderId,
                                    OrderType = OrderSourceTypeEnum.Tra
                                }
                            },
                            PolicyId        = addOrderModel.Order.CorpPolicyId,
                            AduitConfigId   = addOrderModel.Order.CorpAduitId,
                            Source          = request.OrderSource,
                            SubmitCid       = request.Cid,
                            SubmitOid       = oidTemp,
                            IsViolatePolicy =
                                (addOrderModel.OrderDetailList.Find(n => !string.IsNullOrEmpty(n.CorpPolicy)) != null
                                    ? true
                                    : false),
                            OrderType = OrderSourceTypeEnum.Tra
                        };
                        _submitCorpAduitOrderServiceBll.Submit(submitCorpAduitOrder);
                    }

                    #endregion

                    transaction.Commit();
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    throw;
                }
            }

            if (request.AddOrderType == 0)//自动路线发起占位申请
            {
                //2.发起火车占位
                _requestHoldSeatServiceBll.RequestHoldSeat(addOrderResultModel.AddOrderModel);
            }


            return(new AddTraOrderResponseViewModel()
            {
                OrderId = addOrderResultModel.OrderId,
                AddOrderType = request.AddOrderType
            });
        }