public CancelFltOrderResponseViewModel CancelOnlineCorpOrder(CancelFltOrderRequestViewModel request)
        {
            List <CorpAduitOrderInfoModel> aduitOrderInfoModels =
                _getCorpAduitOrderServiceBll.GetAduitOrderInfoByOrderId(request.OrderId);

            if (aduitOrderInfoModels != null && aduitOrderInfoModels.Count > 0)
            {
                if (aduitOrderInfoModels[0].Status != (int)CorpAduitOrderStatusEnum.F &&
                    aduitOrderInfoModels[0].Status != (int)CorpAduitOrderStatusEnum.J)
                {
                    throw new Exception("当前订单处于审批中,不能取消");
                }
            }

            int code = 0;

            using (var transaction = this.Context.Database.BeginTransaction())
            {
                try
                {
                    code = _cancelFltOrderServiceBll.CancelOnlineCorpOrder(request.OrderId, request.Cid, "线上客户取消订单");
                    transaction.Commit();
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    throw;
                }
            }

            return(new CancelFltOrderResponseViewModel()
            {
                Code = code
            });
        }
Example #2
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);
        }
        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);
        }
Example #4
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);
        }
Example #5
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);
        }