public QueryFlightModApplyDataModel QueryModApply(QueryFlightModApplyQueryModel query)
        {
            QueryFlightModApplyDataModel queryFlightModApplyDataModel = new QueryFlightModApplyDataModel();

            _getFlightRetModApplyBll.AportInfo        = query.AportInfo;
            _getFlightRetModApplyBll.PolicyReasonList = query.PolicyReasonList;
            FltRetModApplyModel fltRetModApplyModel = _getFlightRetModApplyBll.GetRetModApply(query.Rmid);

            if ((query.Customer.IsShowAllOrder ?? 0) == 0) //如果没有查看全部订单的权限
            {
                if (!query.IsFromAduitQuery)               //不是来自审批人查询
                {
                    if (!string.IsNullOrEmpty(query.Customer?.UserID) && query.Customer.UserID.ToLower() != "administrator" &&
                        query.Customer.Cid != fltRetModApplyModel.Cid)
                    {
                        throw new Exception("查无此改签申请");
                    }
                }
            }

            if (!string.IsNullOrEmpty(query.Customer?.UserID) && query.Customer.UserID.ToLower() == "administrator")
            {
                if ((query.CidList != null && !query.CidList.Contains(fltRetModApplyModel.Cid)) || query.CidList == null)
                {
                    throw new Exception("查无此改签申请");
                }
            }

            fltRetModApplyModel.ApplyCustomer = query.CorpCustomerList?.Find(n => n.Cid == fltRetModApplyModel.Cid);

            _getFlightModOrderBll.AportInfo = query.AportInfo;
            FltModOrderModel fltModOrderModel = _getFlightModOrderBll.GetModOrderByRmid(query.Rmid);

            queryFlightModApplyDataModel             = queryFlightModApplyDataModel.ConvertFatherToSon(fltRetModApplyModel);
            queryFlightModApplyDataModel.FltModOrder = fltModOrderModel;



            //如果存在改签订单,并且已经出票,则提取改签面价,和改签票号
            if (fltModOrderModel != null && (fltModOrderModel.ProcessStatus & 8) == 8)
            {
                queryFlightModApplyDataModel.ModPrice = fltModOrderModel.ModPrice;
                queryFlightModApplyDataModel.PassengerList.ForEach(n =>
                {
                    n.ModTicketNoList =
                        fltModOrderModel.FltModTicketNoList.FindAll(x => x.PassengerName == n.Name)
                        .Select(x => x.AirlineNo + x.TicketNo)
                        .ToList();
                    n.IsMod = true;
                });
            }


            return(queryFlightModApplyDataModel);
        }
Ejemplo n.º 2
0
        public List <FltRetModApplyModel> GetRetModApply(List <int> rmid)
        {
            List <FltRetModApplyModel> resultList = new List <FltRetModApplyModel>();

            rmid.ForEach(n =>
            {
                FltRetModApplyModel model = GetRetModApply(n);
                if (model != null)
                {
                    resultList.Add(model);
                }
            });
            return(resultList);
        }
        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);
        }
        public QueryFlightRetApplyModel QueryRetApply(QueryFlightRetApplyQueryModel query)
        {
            QueryFlightRetApplyModel queryFlightRetApplyModel = new QueryFlightRetApplyModel();

            _getFlightRetModApplyBll.AportInfo        = query.AportInfo;
            _getFlightRetModApplyBll.PolicyReasonList = query.PolicyReasonList;

            FltRetModApplyModel fltRetModApplyModel = _getFlightRetModApplyBll.GetRetModApply(query.Rmid);

            if ((query.Customer.IsShowAllOrder ?? 0) == 0) //没有查看全部订单权限
            {
                if (!query.IsFromAduitQuery)               //不是来自审批人查询
                {
                    if (!string.IsNullOrEmpty(query.Customer?.UserID) && query.Customer.UserID.ToLower() != "administrator" &&
                        query.Customer.Cid != fltRetModApplyModel.Cid)
                    {
                        throw new Exception("查无此退票申请");
                    }
                }
            }


            if (!string.IsNullOrEmpty(query.Customer?.UserID) && query.Customer.UserID.ToLower() == "administrator")
            {
                if ((query.CidList != null && !query.CidList.Contains(fltRetModApplyModel.Cid)) || query.CidList == null)
                {
                    throw new Exception("查无此退票申请");
                }
            }

            fltRetModApplyModel.ApplyCustomer = query.CorpCustomerList?.Find(n => n.Cid == fltRetModApplyModel.Cid);

            _getFlightRetModApplyBll.AportInfo = query.AportInfo;
            queryFlightRetApplyModel           = queryFlightRetApplyModel.ConvertFatherToSon(fltRetModApplyModel);
            if (!string.IsNullOrEmpty(queryFlightRetApplyModel.Remark) &&
                queryFlightRetApplyModel.Remark.Contains("航空公司收"))
            {
                int d = queryFlightRetApplyModel.Remark.IndexOf("航空公司收", StringComparison.Ordinal);
                queryFlightRetApplyModel.Remark = queryFlightRetApplyModel.Remark.Substring(0, d);
            }

            FltRefundOrderModel refundOrderModel = _getFlighRefundOrderBll.GetFlighRefundOrderByRmid(query.Rmid);

            if (refundOrderModel != null)
            {
                queryFlightRetApplyModel.RefundOrder = refundOrderModel;
                queryFlightRetApplyModel.PassengerList.ForEach(n =>
                {
                    n.IsRet = true;
                });
            }


            List <int> sequenceList = fltRetModApplyModel.DetailList.Select(n => n.Sequence).Distinct().ToList();
            List <FltRetFlightModel> fltRetFlightModels = new List <FltRetFlightModel>();

            foreach (var sequence in sequenceList)
            {
                List <FltRetModFlightApplyModel> fltRetModFlightApplyModels =
                    fltRetModApplyModel.DetailList.FindAll(n => n.Sequence == sequence);
                FltRetFlightModel fltRetFlightModel =
                    Mapper.Map <FltRetModFlightApplyModel, FltRetFlightModel>(fltRetModFlightApplyModels[0]);
                fltRetFlightModel.PassengerList = fltRetModFlightApplyModels.Select(n => n.PassengerModel).ToList();
                fltRetFlightModels.Add(fltRetFlightModel);
            }

            queryFlightRetApplyModel.FltRetFlightList = fltRetFlightModels;
            return(queryFlightRetApplyModel);
        }
Ejemplo n.º 5
0
        public FltRetModApplyModel GetRetModApply(int rmid)
        {
            FltRetModApplyEntity fltRetModApply = _fltRetModApplyDal.Find <FltRetModApplyEntity>(rmid);
            List <FltRetModFlightApplyEntity> fltRetModFlightApplyEntities =
                _fltRetModFlightApplyDal.Query <FltRetModFlightApplyEntity>(n => n.Rmid == rmid).ToList();
            List <FltRetModApplyLogEntity> fltRetModApplyLogEntities =
                _fltRetModApplyLogDal.Query <FltRetModApplyLogEntity>(n => n.Rmid == rmid).ToList();



            FltRetModApplyModel fltRetModApplyModel =
                Mapper.Map <FltRetModApplyEntity, FltRetModApplyModel>(fltRetModApply);

            fltRetModApplyModel.DetailList =
                Mapper.Map <List <FltRetModFlightApplyEntity>, List <FltRetModFlightApplyModel> >(
                    fltRetModFlightApplyEntities);
            fltRetModApplyModel.LogList = Mapper.Map <List <FltRetModApplyLogEntity>, List <FltRetModApplyLogModel> >(
                fltRetModApplyLogEntities);
            List <SearchCityModel>    cityModels    = AportInfo?.CountryList.SelectMany(n => n.CityList).ToList();
            List <SearchAirportModel> airportModels = cityModels?.SelectMany(n => n.AirportList).ToList();

            #region 乘机人信息
            List <int> pidList = fltRetModApplyModel.DetailList.Select(n => n.Pid).ToList();
            List <FltPassengerEntity> passengerEntities =
                _fltPassengerDal.Query <FltPassengerEntity>(n => pidList.Any(x => x == n.PId)).ToList();

            #endregion

            //4.获取仓等信息
            List <FltClassNameModel> classNameModels = _getClassNameBll.GetFlightClassName();

            fltRetModApplyModel.DetailList.ForEach(n =>
            {
                FltFlightEntity orderFlightEntity =
                    _fltFlightDal.Query <FltFlightEntity>(x => x.OrderId == fltRetModApplyModel.OrderId && x.Sequence == n.Sequence)
                    .FirstOrDefault();
                if (orderFlightEntity != null)
                {
                    if (!n.TackoffTime.HasValue)
                    {
                        n.TackoffTime = orderFlightEntity.TackoffTime;
                    }
                    if (string.IsNullOrEmpty(n.FlightNo))
                    {
                        n.FlightNo = orderFlightEntity.FlightNo;
                    }
                }

                string dport = n.Dport.ToLower();
                if (fltRetModApplyModel.OrderType == "R" && orderFlightEntity != null)
                {
                    dport = orderFlightEntity.Dport.ToLower();
                }

                SearchAirportModel airportModel = airportModels.Find(x => x.AirportCode.ToLower() == dport);
                if (airportModel != null)
                {
                    n.DportName = airportModel.AirportName;
                    SearchCityModel cityModel = cityModels.Find(x => x.CityCode.ToLower() == airportModel.CityCode.ToLower());
                    n.DportCity = cityModel.CityName;
                }

                string aport = n.Aport.ToLower();
                if (fltRetModApplyModel.OrderType == "R" && orderFlightEntity != null)
                {
                    aport = orderFlightEntity.Aport.ToLower();
                }

                SearchAirportModel airportModel2 = airportModels.Find(x => x.AirportCode.ToLower() == aport);
                if (airportModel2 != null)
                {
                    n.AportName = airportModel2.AirportName;
                    SearchCityModel cityModel2 = cityModels.Find(x => x.CityCode.ToLower() == airportModel2.CityCode.ToLower());
                    n.AportCity = cityModel2.CityName;
                }
                FltPassengerModel passengerModel =
                    Mapper.Map <FltPassengerEntity, FltPassengerModel>(passengerEntities.Find(x => x.PId == n.Pid));

                n.PassengerModel = passengerModel;

                if (fltRetModApplyModel.OrderType == "R")
                {
                    n.PassengerModel.RefundTicketNo = n.TicketNo;
                }

                if (n.ChoiceReasonId.HasValue)
                {
                    n.ChoiceReason = PolicyReasonList?.Find(x => x.Id == n.ChoiceReasonId.Value)?.Reason;
                }

                FltClassNameModel classNameModel =
                    classNameModels.Find(
                        x =>
                        !string.IsNullOrEmpty(x.MClass) && !string.IsNullOrEmpty(n.Class) &&
                        x.MClass.ToLower() == n.Class.ToLower() &&
                        !string.IsNullOrEmpty(x.AirlineCode) && !string.IsNullOrEmpty(n.FlightNo) &&
                        x.AirlineCode.ToLower() == n.FlightNo.Substring(0, 2).ToLower());

                if (classNameModel != null)
                {
                    n.ClassName = classNameModel.ClassName;
                }
            });


            return(fltRetModApplyModel);
        }