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
            });
        }
        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);
        }
Exemple #3
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);
        }