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

            //3.查询机票订单
            QueryFlightOrderListDataQueryModel query = Mapper.Map <QueryFltOrderListRequestViewModel, QueryFlightOrderListDataQueryModel>(request);

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

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

                    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);
                        }
                    }
                }
            }



            QueryFltOrderListResponseViewModel viewModel = Mapper.Map <QueryFlightOrderListModel, QueryFltOrderListResponseViewModel>(result);

            SortedList <int, string> fltOrderStatusSortedList = EnumConvert.QueryEnum <FltOrderListOrderStatusEnum>();

            viewModel.QueryOrderStatusList = (from status in fltOrderStatusSortedList
                                              select new SortedListViewModel()
            {
                Key = status.Key,
                Value = status.Value
            }).ToList();

            return(viewModel);
        }
Beispiel #2
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);
        }
Beispiel #3
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);
        }