public ResponseBaseViewModel <QueryFltRetApplyListResponseViewModel> QueryFlightRetApplyList(QueryFltRetApplyListRequestViewModel request) { request.Cid = this.GetCid(); QueryFltRetApplyListResponseViewModel responseViewModel = _queryFlightRetApplyListApplication.QueryFltRetApplyList(request); ResponseBaseViewModel <QueryFltRetApplyListResponseViewModel> v = new ResponseBaseViewModel <QueryFltRetApplyListResponseViewModel> { Flag = new ResponseCodeViewModel() { Code = 0, MojoryToken = this.GetToken() }, Data = responseViewModel }; return(v); }
public HttpResponseMessage ExportFlightOrderList([FromUri] QueryFltRetApplyListRequestViewModel request) { request.Cid = this.GetCid(); //导出 request.IsExport = 1; QueryFltRetApplyListResponseViewModel responseViewModel = _queryFlightRetApplyListApplication.QueryFltRetApplyList(request); var file = ExcelStream(responseViewModel.ApplyDataList); HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK); result.Content = new StreamContent(file); //a text file is actually an octet-stream (pdf, etc) //result.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream"); result.Content.Headers.ContentType = new MediaTypeHeaderValue("application/vnd.ms-excel"); //we used attachment to force download result.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment"); result.Content.Headers.ContentDisposition.FileName = "国内机票退票订单.xls"; return(result); }
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); }