/// <summary>
        /// 待核价确认阶段取消改签申请
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public CancelFltModApplyResponseViewModel CancelFltModApplyByWaitAuditStep(
            CancelFltModApplyRequestViewModel request)
        {
            //根据Cid查询客户信息
            CustomerModel customerModel = _getCustomerServiceBll.GetCustomerByCid(request.Cid);

            CancelFltRetModApplyModel query =
                Mapper.Map <CancelFltModApplyRequestViewModel, CancelFltRetModApplyModel>(request);

            query.CorpId   = customerModel.CorpID;
            query.Customer = customerModel;

            int code = 0;

            using (var transaction = this.Context.Database.BeginTransaction())
            {
                try
                {
                    code = _cancelRetModOrderServiceBll.CancelFltModApplyByWaitAuditStep(query);
                    transaction.Commit();
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    throw;
                }
            }

            return(new CancelFltModApplyResponseViewModel()
            {
                Code = code
            });
        }
        public GetCorpPolicyReasonResponseViewModel GetCorpPolicyReasonByCorpId(GetCorpPolicyReasonRequestViewModel request)
        {
            CustomerModel customerModel = _getCustomerServiceBll.GetCustomerByCid(request.Cid);

            if (string.IsNullOrEmpty(customerModel.CorpID))
            {
                return(null);
            }

            List <ChoiceReasonModel> reasonModels =
                _getCustomerCorpPolicyServiceBll.GetCorpReasonByCorpId(customerModel.CorpID)?
                .FindAll(n => n.PolicyType == request.ReasonType);

            if (reasonModels == null || reasonModels.Count == 0)
            {
                return(null);
            }

            List <KeyValueViewModel <string, string> > viewModels = new List <KeyValueViewModel <string, string> >();

            foreach (var choiceReasonModel in reasonModels)
            {
                KeyValueViewModel <string, string> v = new KeyValueViewModel <string, string>()
                {
                    Key = choiceReasonModel.Reason, Value = choiceReasonModel.Reason
                };
                viewModels.Add(v);
            }
            return(new GetCorpPolicyReasonResponseViewModel()
            {
                PolicyReason = viewModels
            });
        }
Esempio n. 3
0
        public GetNotUseTicketNoViewModel GetNotUseNationTicketNoList(GetNotUseTicketNoQueryViewModel request)
        {
            //1.查询机场信息
            SearchCityAportModel aportModel = _getCityForFlightServiceBll.SearchAirport(new List <string>()
            {
                "N"
            });
            //2.根据Cid查询客户信息
            CustomerModel customerModel = _getCustomerServiceBll.GetCustomerByCid(request.Cid);

            //3.查询机票订单

            GetNotUseTicketNoQueryModel query = Mapper.Map <GetNotUseTicketNoQueryViewModel, GetNotUseTicketNoQueryModel>(request);

            query.AportInfo = aportModel;
            query.CorpId    = customerModel.CorpID;
            query.Customer  = customerModel;
            //3.1判断是否是administrator帐号,如果是则获取当前公司下所有订单
            if (customerModel.UserID.ToLower() == "administrator")
            {
                query.Cid = null;
            }


            GetNotUseTicketNoModel     notUseTicketNoModel = _getNotUseTicketNoListServiceBll.GetNotUseNationTicketNoList(query);
            GetNotUseTicketNoViewModel viewModel           = Mapper.Map <GetNotUseTicketNoModel, GetNotUseTicketNoViewModel>(notUseTicketNoModel);

            return(viewModel);
        }
        public GetRetApplyResponseViewModel GetRetApplyView(GetRetApplyRequestViewModel request)
        {
            //1.查询机场信息
            SearchCityAportModel aportModel = _getCityForFlightServiceBll.SearchAirport(new List <string>()
            {
                "N"
            });
            //2.根据Cid查询客户信息
            CustomerModel customerModel = _getCustomerServiceBll.GetCustomerByCid(request.Cid);

            GetRetApplyQueryModel query = Mapper.Map <GetRetApplyRequestViewModel, GetRetApplyQueryModel>(request);

            query.AportInfo = aportModel;
            query.Customer  = customerModel;
            if (customerModel.UserID.ToLower() == "administrator" && !string.IsNullOrEmpty(customerModel.CorpID))
            {
                throw new Exception("administrator帐号无法提交退票申请");
            }
            GetRetApplyModel dataModel = _getFltDomesticRetApplyViewServiceBll.GetRetApply(query);

            GetRetApplyResponseViewModel viewModel =
                Mapper.Map <GetRetApplyModel, GetRetApplyResponseViewModel>(dataModel);

            viewModel.ServiceFee = (dataModel.FlightList[0].ServiceFee ?? 0);

            return(viewModel);
        }
Esempio n. 5
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
            });
        }
Esempio n. 6
0
        /// <summary>
        /// 获取订单详情信息(app)
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public GetTraOrderDetailResponseViewModel GetTraOrderDetailFromAppByOrderId(GetTraOrderDetailRequestViewModel request)
        {
            if (request.OrderId == 0)
            {
                throw new Exception("请传入订单Id");
            }

            //根据Cid查询客户信息
            CustomerModel customerModel = _getCustomerServiceBll.GetCustomerByCid(request.Cid);

            GetTraOrderDetailInfoQueryModel query = new GetTraOrderDetailInfoQueryModel()
            {
                OrderId  = request.OrderId,
                Cid      = request.Cid,
                Customer = customerModel
            };

            if (!string.IsNullOrEmpty(customerModel.CorpID))
            {
                query.CorpCustomerList = _getCustomerServiceBll.GetCustomerByCorpId(customerModel.CorpID);
            }
            //判断当前客户是该订单的审批人
            query.IsFromAduitQuery = _checkAduitOrderServiceBll.CheckAduitCidHasOrderId(request.Cid, request.OrderId);
            GetTraOrderDetailInfoModel model =
                _getTraOrderDetailServiceBll.GetTraOrderDetailFromAppByOrderId(query);

            if (model == null || model.TraOrder == null)
            {
                throw new Exception("查无此订单");
            }

            List <CorpAduitOrderInfoModel> corpAduitOrderInfoModels =
                _getCorpAduitOrderServiceBll.GetAduitOrderInfoByOrderId(model.OrderId);

            if (corpAduitOrderInfoModels != null && corpAduitOrderInfoModels.Count > 0)
            {
                model.TraOrder.AduitOrderId     = corpAduitOrderInfoModels[0].AduitOrderId;
                model.TraOrder.AduitOrderStatus = corpAduitOrderInfoModels[0].Status;
                if (!string.IsNullOrEmpty(corpAduitOrderInfoModels[0].NextAduitName))
                {
                    model.TraOrder.AuditStatus = string.Format("待{0}审批", corpAduitOrderInfoModels[0].NextAduitName);
                    if (corpAduitOrderInfoModels[0].NextAduitCidList.Contains(request.Cid))
                    {
                        model.TraOrder.IsCurrentCustomerAduitOrder = true;
                    }
                }
            }

            GetTraOrderDetailResponseViewModel viewModel = Mapper.Map <GetTraOrderDetailInfoModel, GetTraOrderDetailResponseViewModel>(model);

            return(viewModel);
        }
Esempio n. 7
0
        public CheckCorpAccountPowerResponseViewModel CheckCorpAccountPower(
            CheckCorpAccountPowerRequestViewModel request)
        {
            CustomerModel customer = _getCustomerServiceBll.GetCustomerByCid(request.Cid);

            bool isHasPower = _checkCorpAccountPowerServiceBll.CheckAccountPower(customer, request.Url);


            return(new CheckCorpAccountPowerResponseViewModel()
            {
                IsHasPower = isHasPower
            });
        }
Esempio n. 8
0
        public MatchCorpPolicyAndAduitResponseViewModel Match(MatchCorpPolicyAndAduitRequestViewModel request)
        {
            CustomerModel customerModel = _getCustomerServiceBll.GetCustomerByCid(request.Cid);

            MatchCorpPolicyAndAduitResultModel matchCorpPolicyAndAduitResultModel =
                _mathCorpPolicyAndAduitServiceBll.Match(new MatchCorpPolicyAndAduitModel()
            {
                PassengerCidList     = request.PassengerCidList,
                BookingCid           = request.Cid,
                IsAllowUserInsurance = (customerModel?.Corporation?.IsAllowUserInsurance ?? 0)
            });

            return
                (Mapper.Map <MatchCorpPolicyAndAduitResultModel, MatchCorpPolicyAndAduitResponseViewModel>(
                     matchCorpPolicyAndAduitResultModel));
        }
        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);
        }
Esempio n. 10
0
        public SearchFlightResponseViewModel Search(SearchFlightRequestViewModel request)
        {
            if (request.Cid == 0)
            {
                throw new Exception("请传入客户Id");
            }

            //2.根据Cid查询客户信息
            CustomerModel customerModel = _getCustomerServiceBll.GetCustomerByCid(request.Cid);

            //调用查询该客户的差旅政策服务
            CorpPolicyDetailConfigModel poilConfigModel =
                _getCustomerCorpPolicyServiceBll.GetCorpPolicyById(request.PolicyId ?? 0, customerModel.CorpID, "N");

            SearchFlightQueryModel query = new SearchFlightQueryModel()
            {
                AirlineNo         = request.AirlineNo,
                Aport             = request.Aport,
                TackOffTime       = request.TackOffTime,
                Dport             = request.Dport,
                CorpPolicy        = poilConfigModel,
                CardNoList        = request.CardNoList,
                PassengerNameList = request.PassengerNameList,
                CorpId            = customerModel.CorpID,
                OrderSource       = request.OrderSource,
                IsShareFly        = customerModel.Corporation.IsShareFly,
                IsXYPrice         = customerModel.Corporation.IsXYPrice,
                IsAllSeat         = customerModel.Corporation.IsAllSeat,
                IsHeightSeat      = customerModel.Corporation.IsHeightSeat
            };

            //调用查询航班服务
            List <SearchFlightModel> searchFlightModels = _searchFlightServiceBll.SearchFlight(query);

            SearchFlightResponseViewModel viewModel = new SearchFlightResponseViewModel();

            viewModel.FlightList       = Mapper.Map <List <SearchFlightModel>, List <SearchFlightViewModel> >(searchFlightModels);
            viewModel.AirlineQuery     = searchFlightModels.Select(n => n.AirlineDesc).Distinct().ToList();
            viewModel.AportNameQuery   = searchFlightModels.Select(n => n.AportName).Distinct().ToList();
            viewModel.DportNameQuery   = searchFlightModels.Select(n => n.DportName).Distinct().ToList();
            viewModel.TackOffTimeQuery = searchFlightModels.Select(n => n.TackOffDate).Distinct().ToList();
            viewModel.ClassQuery       = searchFlightModels.SelectMany(n => n.DetailList).Select(n => n.ClassDesc).Distinct().ToList();
            viewModel.PolicyReason     = poilConfigModel?.PolicyReason;
            return(viewModel);
        }
Esempio n. 11
0
        public GetCorpBookingDepartListResponseViewModel GetCorpBookingDepartList(GetCorpBookingDepartListRequestViewModel request)
        {
            CustomerModel customerModel = _getCustomerServiceBll.GetCustomerByCid(request.Cid);

            if (string.IsNullOrEmpty(customerModel?.CorpID))
            {
                throw new Exception("该客户信息异常");
            }

            List <CorpBookingDepartModel> corpBookingDepartModels =
                _getCorpBookingDepartListServiceBll.GetCorpBookingDepartList(request.CustomerCid, customerModel.CorpID);
            GetCorpBookingDepartListResponseViewModel viewModel = new GetCorpBookingDepartListResponseViewModel();

            viewModel.BookingDepartList =
                Mapper.Map <List <CorpBookingDepartModel>, List <CorpBookingDepartViewModel> >(corpBookingDepartModels);
            viewModel.IsAll = _getCorpBookingDepartListServiceBll.IsAll;

            return(viewModel);
        }
Esempio n. 12
0
        public SearchTrainResponseViewModel SearchTrain(SearchTrainRequestViewModel request)
        {
            if (request.Cid == 0)
            {
                throw new Exception("请传入客户Id");
            }

            //2.根据Cid查询客户信息
            CustomerModel customerModel = _getCustomerServiceBll.GetCustomerByCid(request.Cid);

            string notAllowUserTrainCorpId = AppSettingsHelper.GetAppSettings(AppSettingsEnum.NotAllowUserTrain);

            if (!string.IsNullOrEmpty(customerModel.CorpID) && notAllowUserTrainCorpId.Contains(customerModel.CorpID.ToUpper()))
            {
                throw new Exception("当前公司不能使用火车票功能");
            }

            //调用查询该客户的差旅政策服务
            CorpPolicyDetailConfigModel poilConfigModel =
                _getCustomerCorpPolicyServiceBll.GetCorpPolicyById(request.PolicyId ?? 0, customerModel.CorpID, "T");

            TraQueryTrainModel queryTrainModel = new TraQueryTrainModel()
            {
                from_station  = request.FromStation,
                needdistance  = request.NeedDistance,
                purpose_codes = request.PurposeCodes,
                to_station    = request.ToStation,
                train_date    = request.TrainDate,
                CorpPolicy    = poilConfigModel,
                CorpId        = customerModel.CorpID,
                IsTraAllSeat  = customerModel.Corporation == null ? 0 : customerModel.Corporation.IsTraAllSeat
            };

            List <TraTravelInfoModel>    traTravelInfoModels = _searchTrainServiceBll.DoQueryTrain(queryTrainModel);
            SearchTrainResponseViewModel responseViewModel   = new SearchTrainResponseViewModel();

            List <TraTravelInfoViewModel> travelInfo = new List <TraTravelInfoViewModel>();
            List <string> formStation = new List <string>();
            List <string> toStation   = new List <string>();
            List <string> trainType   = new List <string>();

            foreach (var item in traTravelInfoModels)
            {
                #region 循环
                if (!string.IsNullOrEmpty(item.train_type))
                {
                    trainType.Add(item.train_type);
                }
                if (!string.IsNullOrEmpty(item.from_station_name))
                {
                    formStation.Add(item.from_station_name);
                }
                if (!string.IsNullOrEmpty(item.to_station_name))
                {
                    toStation.Add(item.to_station_name);
                }
                TraTravelInfoViewModel travelInfoViewModel = new TraTravelInfoViewModel()
                {
                    AccessByidCard   = item.access_byidcard,
                    ArriveDays       = item.arrive_days,
                    ArriveTime       = item.arrive_time,
                    CanBuyNow        = item.can_buy_now,
                    DetailList       = AutoMapperHelper.DoMapList <TraTravelInfoDetailModel, TraTravelInfoDetailViewModel>(item.DetailList).ToList(),
                    Distance         = item.distance,
                    EndStationName   = item.end_station_name,
                    FromStationCode  = item.from_station_code,
                    FromStationName  = item.from_station_name,
                    Note             = item.note,
                    RunTime          = item.run_time,
                    RunTimeMinute    = item.run_time_minute,
                    SaleDateTime     = item.sale_date_time,
                    StartStationName = item.start_station_name,
                    StartTime        = item.start_time,
                    ToStationCode    = item.to_station_code,
                    ToStationName    = item.to_station_name,
                    TrainCode        = item.train_code,
                    TrainNo          = item.train_no,
                    TrainStartDate   = Convert.ToDateTime(queryTrainModel.train_date).ToString("yyyy-MM-dd"),//item.train_start_date,
                    TrainType        = item.train_type,
                    OnTrainDate      = request.TrainDate
                };
                travelInfo.Add(travelInfoViewModel);
                #endregion
            }

            responseViewModel.TravelInfo   = travelInfo;
            responseViewModel.FormStation  = formStation.Distinct().ToList();
            responseViewModel.ToStation    = toStation.Distinct().ToList();
            responseViewModel.TrainType    = trainType.Distinct().ToList();
            responseViewModel.PolicyReason = poilConfigModel?.PolicyReason;
            return(responseViewModel);
        }
        public QueryFltRetApplyListResponseViewModel QueryFltRetApplyList(QueryFltRetApplyListRequestViewModel request)
        {
            //1.查询机场信息
            SearchCityAportModel aportModel = _getCityForFlightServiceBll.SearchAirport(new List <string>()
            {
                "N"
            });
            //2.根据Cid查询客户信息
            CustomerModel customerModel = _getCustomerServiceBll.GetCustomerByCid(request.Cid);
            QueryFlightRetApplyListDataQueryModel query = Mapper.Map <QueryFltRetApplyListRequestViewModel, QueryFlightRetApplyListDataQueryModel>(request);

            query.AportInfo = aportModel;
            query.CorpId    = customerModel.CorpID;
            query.Customer  = customerModel;
            //判断是否显示全部订单
            if ((request.IsShowAllOrder ?? 0) == 1)
            {
                //判断用户是否有查看全部订单的权限
                if ((customerModel.IsShowAllOrder ?? 0) == 1)
                {
                    query.Cid = null;
                }
            }
            //3.1判断是否是administrator帐号,如果是则获取当前公司下所有订单
            if (customerModel.UserID.ToLower() == "administrator")
            {
                query.Cid = null;
            }
            if (!string.IsNullOrEmpty(customerModel.CorpID))
            {
                query.CorpCustomerList = _getCustomerServiceBll.GetCustomerByCorpId(customerModel.CorpID);
            }
            QueryFlightRetApplyListModel result = _queryFlightRetApplyListServiceBll.QueryFlightRetApplyList(query);

            if (result.ApplyDataList != null && result.ApplyDataList.Count > 0)
            {
                foreach (var order in result.ApplyDataList)
                {
                    List <CorpAduitOrderInfoModel> corpAduitOrderInfoModels =
                        _getCorpAduitOrderServiceBll.GetAduitOrderInfoByOrderId(order.Rmid);

                    if (corpAduitOrderInfoModels != null && corpAduitOrderInfoModels.Count > 0)
                    {
                        order.AduitOrderStatus = corpAduitOrderInfoModels[0].Status;
                        if (!string.IsNullOrEmpty(corpAduitOrderInfoModels[0].NextAduitName))
                        {
                            order.AuditStatus = string.Format("待{0}审批", corpAduitOrderInfoModels[0].NextAduitName);
                        }
                    }
                }
            }
            QueryFltRetApplyListResponseViewModel viewModel  = Mapper.Map <QueryFlightRetApplyListModel, QueryFltRetApplyListResponseViewModel>(result);
            SortedList <string, string>           sortedList = EnumConvert.QueryEnumStr <FltRetApplyStatusEnum>();

            viewModel.QueryOrderStatusList = (from status in sortedList
                                              select new SortedListViewModel()
            {
                Key = status.Key,
                Value = status.Value
            }).ToList();
            return(viewModel);
        }
        public GetAuditOrderListResponseViewModel GetAuditOrderList(GetAuditOrderListRequestViewModel request)
        {
            //1.根据Cid查询客户信息
            CustomerModel customerModel = _getCustomerServiceBll.GetCustomerByCid(request.Cid);

            if (string.IsNullOrEmpty(customerModel.IsCheckPerson) || customerModel.IsCheckPerson.ToUpper() != "T")
            {
                throw new Exception("当前用户无权审批");
            }



            AuditOrderListModel list = null;

            if (request.AuditType == 1)//待审批信息
            {
                #region 待审批信息

                list = _getCorpAduitOrderListServiceBll.GetWaitCorpAduitOrderList(new AuditOrderListQueryModel()
                {
                    AuditCid  = request.Cid,
                    PageSize  = request.PageSize,
                    PageIndex = request.PageIndex,
                    Customer  = customerModel
                });

                #endregion
            }
            else if (request.AuditType == 2)//审批通过
            {
                #region 审批通过
                list = _getCorpAduitOrderListServiceBll.GetPassCorpAduitOrderList(new AuditOrderListQueryModel()
                {
                    AuditCid  = request.Cid,
                    PageSize  = request.PageSize,
                    PageIndex = request.PageIndex,
                    Customer  = customerModel
                });
                #endregion
            }
            else if (request.AuditType == 3)//审批不通过
            {
                #region 审批不通过
                list = _getCorpAduitOrderListServiceBll.GetNoPassCorpAduitOrderList(new AuditOrderListQueryModel()
                {
                    AuditCid  = request.Cid,
                    PageSize  = request.PageSize,
                    PageIndex = request.PageIndex,
                    Customer  = customerModel
                });
                #endregion
            }



            #region 组装审批内容
            if (list != null && list.DataList != null && list.DataList.Count > 0)
            {
                //查询机场信息
                _getFltOrderBll.AportInfo = _getCityForFlightServiceBll.SearchAirport(new List <string>()
                {
                    "N"
                });
                _getFlightRetModApplyBll.AportInfo = _getCityForFlightServiceBll.SearchAirport(new List <string>()
                {
                    "N"
                });
                //调用查询该客户的差旅政策服务
                List <ChoiceReasonModel> reasonModels = _getCustomerCorpPolicyServiceBll.GetCorpReasonByCorpId(customerModel.CorpID);
                _getFlightRetModApplyBll.PolicyReasonList = reasonModels;

                foreach (var data in list.DataList)
                {
                    foreach (var detail in data.DetailList)
                    {
                        if (detail.OrderType == OrderSourceTypeEnum.Flt)
                        {
                            FltOrderInfoModel fltOrderInfoModel = _getFltOrderBll.GetFltOrderById(detail.OrderId);
                            if (fltOrderInfoModel == null)
                            {
                                continue;
                            }
                            detail.ChoiceReason      = fltOrderInfoModel.ChoiceReason;
                            detail.CorpPolicy        = fltOrderInfoModel.CorpPolicy;
                            detail.OrderAmount       = fltOrderInfoModel.Payamount;
                            detail.PassengerNameList = fltOrderInfoModel.PassengerNameList;
                            detail.TackOffTimeList   = fltOrderInfoModel.TackOffTimeList;
                            detail.TravelList        = fltOrderInfoModel.TravelList;
                            detail.OrderIdDes        = fltOrderInfoModel.OrderId.ToString();
                        }
                        else if (detail.OrderType == OrderSourceTypeEnum.FltModApply || detail.OrderType == OrderSourceTypeEnum.FltRetApply)
                        {
                            FltRetModApplyModel fltRetModApplyModel =
                                _getFlightRetModApplyBll.GetRetModApply(detail.OrderId);
                            if (fltRetModApplyModel == null)
                            {
                                continue;
                            }
                            detail.ChoiceReason      = fltRetModApplyModel.ChoiceReason;
                            detail.CorpPolicy        = fltRetModApplyModel.CorpPolicy;
                            detail.OrderAmount       = fltRetModApplyModel.TotalAuditPrice;
                            detail.PassengerNameList = fltRetModApplyModel.PassengerNameList;
                            detail.TackOffTimeList   = fltRetModApplyModel.TackOffTimeList;
                            detail.TravelList        = fltRetModApplyModel.TravelList;
                            detail.OrderIdDes        = fltRetModApplyModel.OrderId.ToString();
                        }
                        else if (detail.OrderType == OrderSourceTypeEnum.Tra)
                        {
                            TraOrderInfoModel traOrderInfoModel =
                                _getTraOrderServiceBll.GetTraOrderByOrderId(detail.OrderId);
                            if (traOrderInfoModel == null)
                            {
                                continue;
                            }
                            detail.ChoiceReason      = traOrderInfoModel.ChoiceReason;
                            detail.CorpPolicy        = traOrderInfoModel.CorpPolicy;
                            detail.OrderAmount       = traOrderInfoModel.Order.TotalMoney;
                            detail.PassengerNameList = traOrderInfoModel.PassengerNameList;
                            detail.TackOffTimeList   = traOrderInfoModel.TackOffTimeList;
                            detail.TravelList        = traOrderInfoModel.TravelList;
                            detail.OrderIdDes        = traOrderInfoModel.Order.OrderId.ToString();
                        }
                    }
                }
            }
            #endregion


            GetAuditOrderListResponseViewModel responseViewModel =
                Mapper.Map <AuditOrderListModel, GetAuditOrderListResponseViewModel>(list);
            return(responseViewModel);
        }
Esempio n. 15
0
        public AuditOrderResponseViewModel RunAudit(AuditOrderRequestViewModel request)
        {
            //1.根据Cid查询客户信息
            CustomerModel customerModel = _getCustomerServiceBll.GetCustomerByCid(request.Cid);

            if (string.IsNullOrEmpty(customerModel.IsCheckPerson) || customerModel.IsCheckPerson.ToUpper() != "T")
            {
                throw new Exception("当前用户无权审批");
            }

            AuditOrderResponseViewModel responseViewModel = new AuditOrderResponseViewModel();
            AuditTypeQueryModel         query             = new AuditTypeQueryModel()
            {
                OrderSourceType = request.OrderSourceType,
                Cid             = request.Cid,
                Id            = request.Id,
                AuditCustomer = customerModel,
                IsAgree       = request.IsAgree,
                AuditStep     = request.AuditStep
            };

            //机票类型审批
            List <OrderSourceTypeEnum> fltOrderSourceTypeList = new List <OrderSourceTypeEnum>()
            {
                OrderSourceTypeEnum.Flt,
                OrderSourceTypeEnum.FltModApply,
                OrderSourceTypeEnum.FltRetApply
            };

            if (fltOrderSourceTypeList.Contains(query.OrderSourceType))
            {
                using (var transaction = this.Context.Database.BeginTransaction())
                {
                    try
                    {
                        //1.进行审批
                        AuditResultModel auditResultModel = _auditFltOrderServiceBll.RunAudit(query);
                        responseViewModel.Code = auditResultModel.Code;
                        if (auditResultModel.OwnCid != 0)
                        {
                            #region 推送app信息

                            /**
                             * 这里推送app消息分为两种:
                             * 1.推送审核结果给订单所属用户
                             * 2.如果存在下一级审核并且当前审核通过,则推送审核给下一级审核人
                             * */
                            //1.推送审核结果给订单所属用户
                            _addSendAppMessageServiceBll.AddAppAuditResultMessage(new SendAppAuditResultMessageModel()
                            {
                                IsAgree     = request.IsAgree,
                                AuditResult = auditResultModel.AuditResult,
                                Cid         = auditResultModel.OwnCid,
                                OrderId     = auditResultModel.Id,
                                OrderType   = auditResultModel.OrderType,
                                SendType    = SendAppMessageTypeEnum.AuditResultNotice
                            });

                            //2.如果存在下一级审核并且当前审核通过,则推送审核给下一级审核人
                            if (auditResultModel.NextAuditCid.HasValue && request.IsAgree)
                            {
                                _addSendAppMessageServiceBll.AddAppWaitAuditMessage(new SendAppAuditResultMessageModel()
                                {
                                    Cid       = auditResultModel.NextAuditCid.Value,
                                    OrderId   = auditResultModel.Id,
                                    OrderType = auditResultModel.OrderType,
                                    SendType  = SendAppMessageTypeEnum.WaitAuditNotice
                                });
                            }
                            #endregion
                        }

                        transaction.Commit();
                    }
                    catch (Exception ex)
                    {
                        transaction.Rollback();
                        throw;
                    }
                }
            }
            else
            {
                throw new Exception("审批类型不正确!");
            }



            return(responseViewModel);
        }
        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);
        }
Esempio n. 17
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);
        }
Esempio n. 18
0
        public QueryFlightModApplyResponseViewModel QueryFlightModApply(QueryFltRetModApplyRequestViewModel request)
        {
            if (!request.Rmid.HasValue)
            {
                throw new Exception("请传入Rmid参数");
            }
            //1.查询机场信息
            SearchCityAportModel aportModel = _getCityForFlightServiceBll.SearchAirport(new List <string>()
            {
                "N"
            });
            //2.根据Cid查询客户信息
            CustomerModel customerModel = _getCustomerServiceBll.GetCustomerByCid(request.Cid);
            //调用查询该客户的差旅政策服务
            List <ChoiceReasonModel> reasonModels =
                _getCustomerCorpPolicyServiceBll.GetCorpReasonByCorpId(customerModel.CorpID)?
                .FindAll(n => n.PolicyType == "N");

            QueryFlightModApplyQueryModel query =
                Mapper.Map <QueryFltRetModApplyRequestViewModel, QueryFlightModApplyQueryModel>(request);

            query.AportInfo = aportModel;
            query.CorpId    = customerModel.CorpID;
            query.Customer  = customerModel;
            if (!string.IsNullOrEmpty(query.CorpId))
            {
                query.CorpCustomerList = _getCustomerServiceBll.GetCustomerByCorpId(query.CorpId);
            }
            query.PolicyReasonList = reasonModels;
            query.IsFromAduitQuery = _checkAduitOrderServiceBll.CheckAduitCidHasOrderId(request.Cid,
                                                                                        request.Rmid ?? 0);

            QueryFlightModApplyDataModel queryFlightModApplyDataModel =
                _queryFlightModApplyServiceBll.QueryModApply(query);

            if (queryFlightModApplyDataModel != null && customerModel.Corporation != null && customerModel.Corporation.AllowShowDataBeginTime.HasValue)
            {
                if (customerModel.Corporation.AllowShowDataBeginTime > queryFlightModApplyDataModel.CreateTime)
                {
                    throw new Exception("查无此改签申请");
                }
            }

            List <CorpAduitOrderInfoModel> corpAduitOrderInfoModels =
                _getCorpAduitOrderServiceBll.GetAduitOrderInfoByOrderId(queryFlightModApplyDataModel.Rmid);

            if (corpAduitOrderInfoModels != null && corpAduitOrderInfoModels.Count > 0)
            {
                queryFlightModApplyDataModel.AduitOrderId     = corpAduitOrderInfoModels[0].AduitOrderId;
                queryFlightModApplyDataModel.AduitOrderStatus = corpAduitOrderInfoModels[0].Status;
                if (!string.IsNullOrEmpty(corpAduitOrderInfoModels[0].NextAduitName))
                {
                    queryFlightModApplyDataModel.AuditStatus = string.Format("待{0}审批", corpAduitOrderInfoModels[0].NextAduitName);
                    if (corpAduitOrderInfoModels[0].NextAduitCidList.Contains(request.Cid))
                    {
                        queryFlightModApplyDataModel.IsCurrentCustomerAduitOrder = true;
                    }
                }
            }

            QueryFlightModApplyResponseViewModel responseViewModel = Mapper
                                                                     .Map <QueryFlightModApplyDataModel, QueryFlightModApplyResponseViewModel>(
                queryFlightModApplyDataModel);


            responseViewModel.PolicyReason = (from n in reasonModels
                                              select new SortedListViewModel()
            {
                Key = n.Id,
                Value = n.Reason
            }).ToList();

            return(responseViewModel);
        }
Esempio n. 19
0
        public QueryFltOrderResponseViewModel QueryOrder(QueryFltOrderRequestViewModel request)
        {
            if (!request.OrderId.HasValue)
            {
                throw new Exception("请传入订单Id");
            }
            //1.查询机场信息
            SearchCityAportModel aportModel = _getCityForFlightServiceBll.SearchAirport(new List <string>()
            {
                "N"
            });
            //2.根据Cid查询客户信息
            CustomerModel customerModel = _getCustomerServiceBll.GetCustomerByCid(request.Cid);
            //3.获取保险产品信息
            List <InsuranceCompanyModel> insuranceCompanyModels = _getInsuranceCompanyServiceBll.GetInsuranceCompany();
            //4.获取项目名称
            List <ProjectNameModel>    projectNameModels = _getProjectNameServiceBll.GetProjectName(request.Cid);
            QueryFlightOrderQueryModel query             = Mapper.Map <QueryFltOrderRequestViewModel, QueryFlightOrderQueryModel>(request);

            query.AportInfo        = aportModel;
            query.Customer         = customerModel;
            query.CorpId           = customerModel.CorpID;
            query.InsuranceCompany = insuranceCompanyModels;
            query.ProjectName      = projectNameModels;
            if (!string.IsNullOrEmpty(customerModel.CorpID))
            {
                query.CorpCustomerList = _getCustomerServiceBll.GetCustomerByCorpId(customerModel.CorpID);
            }


            //判断当前客户是该订单的审批人
            query.IsFromAduitQuery = _checkAduitOrderServiceBll.CheckAduitCidHasOrderId(request.Cid,
                                                                                        request.OrderId.Value);

            QueryFlightOrderDataModel dataModel = _queryFlightOrderServiceBll.QueryFlightOrder(query);

            if (dataModel != null && customerModel.Corporation != null && customerModel.Corporation.AllowShowDataBeginTime.HasValue)
            {
                if (customerModel.Corporation.AllowShowDataBeginTime > dataModel.OrderDate)
                {
                    throw new Exception("查无此订单");
                }
            }

            if (dataModel != null && dataModel.IsOnlineShow != 1)
            {
                List <CorpAduitOrderInfoModel> corpAduitOrderInfoModels =
                    _getCorpAduitOrderServiceBll.GetAduitOrderInfoByOrderId(dataModel.OrderId);

                if (corpAduitOrderInfoModels != null && corpAduitOrderInfoModels.Count > 0)
                {
                    dataModel.AduitOrderId     = corpAduitOrderInfoModels[0].AduitOrderId;
                    dataModel.AduitOrderStatus = corpAduitOrderInfoModels[0].Status;
                    if (!string.IsNullOrEmpty(corpAduitOrderInfoModels[0].NextAduitName))
                    {
                        dataModel.AuditStatus = string.Format("待{0}审批", corpAduitOrderInfoModels[0].NextAduitName);
                        if (corpAduitOrderInfoModels[0].NextAduitCidList.Contains(request.Cid))
                        {
                            dataModel.IsCurrentCustomerAduitOrder = true;
                        }
                    }
                }
                else
                {
                    if ((dataModel.ProcessStatus & 8) != 8 && dataModel.OrderStatus != "C")
                    {
                        dataModel.IsShowCancelButton = true; //没有审批的,并且还没有出票的,显示取消按钮
                    }
                }
            }

            QueryFltOrderResponseViewModel viewModel = Mapper.Map <QueryFlightOrderDataModel, QueryFltOrderResponseViewModel>(dataModel);

            return(viewModel);
        }
Esempio n. 20
0
        public AddGrabTicketResponseViewModel AddGrabTicket(AddGrabTicketRequestViewModel request)
        {
            AddTraGrabTicketModel addTraGrabTicketModel =
                Mapper.Map <AddGrabTicketRequestViewModel, AddTraGrabTicketModel>(request);

            if (addTraGrabTicketModel.SeatType.Contains("无座"))
            {
                throw new Exception("座位类型中不能包含无座");
            }
            addTraGrabTicketModel.CreateOid = request.Oid;
            //0.获取客户信息
            addTraGrabTicketModel.Customer = _getCustomerServiceBll.GetCustomerByCid(request.Cid);

            //1.添加抢票信息
            int grabId = 0;

            using (var transaction = this.Context.Database.BeginTransaction())
            {
                try
                {
                    ICustomerDomainFactory customerDomainFactory = new CustomerDomainFactory();
                    ICustomerDomain        customerDomain        = customerDomainFactory.CreatePassengerInfoDomainObj();

                    _addTraGrabTicketServiceBll.AddContactEvent += customerDomain.AddContactEventListener;
                    grabId = _addTraGrabTicketServiceBll.AddTraGrabTicket(addTraGrabTicketModel);
                    _addTraGrabTicketServiceBll.AddContactEvent -= customerDomain.AddContactEventListener;

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

            //2.访问抢票接口

            GrabTicketResponseModel responseModel = _requestGrabTicketServiceBll.RequestGrabTicketInterface(addTraGrabTicketModel);
            bool isSuccess = false;
            //3.根据结果更新抢票状态
            UpdateTraGrabTicketStatusModel updateTraGrabTicketStatusModel = new UpdateTraGrabTicketStatusModel()
            {
                GrabId = grabId
            };

            if (responseModel.success)
            {
                updateTraGrabTicketStatusModel.GrabStatus = TrainGrabStatusEnum.P;
                isSuccess = true;
            }
            else
            {
                updateTraGrabTicketStatusModel.GrabStatus         = TrainGrabStatusEnum.D;
                updateTraGrabTicketStatusModel.SubmitFailedReason = responseModel.msg;
            }


            _updateTraGrabTicketStatusServiceBll.UpdateTraGrabTicketStatusByAfterSubmit(
                updateTraGrabTicketStatusModel);


            return(new AddGrabTicketResponseViewModel()
            {
                IsSuccess = isSuccess, Message = responseModel.msg
            });
        }
Esempio n. 21
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
            });
        }
Esempio n. 22
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
            });
        }