Exemplo n.º 1
0
        public ResponseBaseViewModel <GetAuditOrderListResponseViewModel> GetList([FromBody] GetAuditOrderListRequestViewModel request)
        {
            if (request == null)
            {
                request = new GetAuditOrderListRequestViewModel();
            }
            request.Cid = this.GetCid();
            GetAuditOrderListResponseViewModel responseViewModel         = _getAuditOrderListApplication.GetAuditOrderList(request);
            ResponseBaseViewModel <GetAuditOrderListResponseViewModel> v = new ResponseBaseViewModel <GetAuditOrderListResponseViewModel>
            {
                Flag = new ResponseCodeViewModel()
                {
                    Code = 0, MojoryToken = this.GetToken()
                },
                Data = responseViewModel
            };

            return(v);
        }
        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);
        }