public QueryFlightRetApplyModel QueryRetApply(QueryFlightRetApplyQueryModel query) { QueryFlightRetApplyModel queryFlightRetApplyModel = new QueryFlightRetApplyModel(); _getFlightRetModApplyBll.AportInfo = query.AportInfo; _getFlightRetModApplyBll.PolicyReasonList = query.PolicyReasonList; FltRetModApplyModel fltRetModApplyModel = _getFlightRetModApplyBll.GetRetModApply(query.Rmid); if ((query.Customer.IsShowAllOrder ?? 0) == 0) //没有查看全部订单权限 { if (!query.IsFromAduitQuery) //不是来自审批人查询 { if (!string.IsNullOrEmpty(query.Customer?.UserID) && query.Customer.UserID.ToLower() != "administrator" && query.Customer.Cid != fltRetModApplyModel.Cid) { throw new Exception("查无此退票申请"); } } } if (!string.IsNullOrEmpty(query.Customer?.UserID) && query.Customer.UserID.ToLower() == "administrator") { if ((query.CidList != null && !query.CidList.Contains(fltRetModApplyModel.Cid)) || query.CidList == null) { throw new Exception("查无此退票申请"); } } fltRetModApplyModel.ApplyCustomer = query.CorpCustomerList?.Find(n => n.Cid == fltRetModApplyModel.Cid); _getFlightRetModApplyBll.AportInfo = query.AportInfo; queryFlightRetApplyModel = queryFlightRetApplyModel.ConvertFatherToSon(fltRetModApplyModel); if (!string.IsNullOrEmpty(queryFlightRetApplyModel.Remark) && queryFlightRetApplyModel.Remark.Contains("航空公司收")) { int d = queryFlightRetApplyModel.Remark.IndexOf("航空公司收", StringComparison.Ordinal); queryFlightRetApplyModel.Remark = queryFlightRetApplyModel.Remark.Substring(0, d); } FltRefundOrderModel refundOrderModel = _getFlighRefundOrderBll.GetFlighRefundOrderByRmid(query.Rmid); if (refundOrderModel != null) { queryFlightRetApplyModel.RefundOrder = refundOrderModel; queryFlightRetApplyModel.PassengerList.ForEach(n => { n.IsRet = true; }); } List <int> sequenceList = fltRetModApplyModel.DetailList.Select(n => n.Sequence).Distinct().ToList(); List <FltRetFlightModel> fltRetFlightModels = new List <FltRetFlightModel>(); foreach (var sequence in sequenceList) { List <FltRetModFlightApplyModel> fltRetModFlightApplyModels = fltRetModApplyModel.DetailList.FindAll(n => n.Sequence == sequence); FltRetFlightModel fltRetFlightModel = Mapper.Map <FltRetModFlightApplyModel, FltRetFlightModel>(fltRetModFlightApplyModels[0]); fltRetFlightModel.PassengerList = fltRetModFlightApplyModels.Select(n => n.PassengerModel).ToList(); fltRetFlightModels.Add(fltRetFlightModel); } queryFlightRetApplyModel.FltRetFlightList = fltRetFlightModels; return(queryFlightRetApplyModel); }
public QueryFlightRetApplyResponseViewModel QueryFlightRetApply(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"); QueryFlightRetApplyQueryModel query = Mapper.Map <QueryFltRetModApplyRequestViewModel, QueryFlightRetApplyQueryModel>(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); QueryFlightRetApplyModel queryFlightRetApplyModel = _queryFlightRetApplyServiceBll.QueryRetApply(query); if (queryFlightRetApplyModel != null && customerModel.Corporation != null && customerModel.Corporation.AllowShowDataBeginTime.HasValue) { if (customerModel.Corporation.AllowShowDataBeginTime > queryFlightRetApplyModel.CreateTime) { throw new Exception("查无此退票申请"); } } List <CorpAduitOrderInfoModel> corpAduitOrderInfoModels = _getCorpAduitOrderServiceBll.GetAduitOrderInfoByOrderId(queryFlightRetApplyModel.Rmid); if (corpAduitOrderInfoModels != null && corpAduitOrderInfoModels.Count > 0) { queryFlightRetApplyModel.AduitOrderId = corpAduitOrderInfoModels[0].AduitOrderId; queryFlightRetApplyModel.AduitOrderStatus = corpAduitOrderInfoModels[0].Status; if (!string.IsNullOrEmpty(corpAduitOrderInfoModels[0].NextAduitName)) { queryFlightRetApplyModel.AuditStatus = string.Format("待{0}审批", corpAduitOrderInfoModels[0].NextAduitName); if (corpAduitOrderInfoModels[0].NextAduitCidList.Contains(request.Cid)) { queryFlightRetApplyModel.IsCurrentCustomerAduitOrder = true; } } } QueryFlightRetApplyResponseViewModel responseViewModel = Mapper.Map <QueryFlightRetApplyModel, QueryFlightRetApplyResponseViewModel>( queryFlightRetApplyModel); responseViewModel.PolicyReason = (from n in reasonModels select new SortedListViewModel() { Key = n.Id, Value = n.Reason }).ToList(); return(responseViewModel); }