/// <summary> /// 查询接口 /// </summary> /// <param name="requestData"></param> /// <returns></returns> public string QueryOrder(string request) { var requestBody = _ctripGateway.CheckQueryOrder(request); var data = requestBody.Data; var response = _ticketGateway.QueryOrder(new OrderQuery { OrderId = data.vendorOrderId }); if (response.Head.Code == "000000") { var info = response.Body.OrderInfo.EticketInfo.FirstOrDefault(); var responseBody = new QueryOrderBodyResponse { otaOrderId = data.otaOrderId, vendorOrderId = data.vendorOrderId, count = info.EticketQuantity, amount = info.MarketPrice * info.EticketQuantity, useCount = 0, cancelCount = 0 }; if (info.OrderStatus == (int)TicketOrderStatus.Success) { responseBody.orderStatus = "1"; } else if (info.OrderStatus == (int)TicketOrderStatus.Canncel) { responseBody.orderStatus = "3"; responseBody.cancelCount = info.EticketQuantity; } else if (info.OrderStatus == (int)TicketOrderStatus.Consume) { responseBody.orderStatus = "5"; if (info.UseQuantity != info.EticketQuantity) { responseBody.orderStatus = "6"; } responseBody.useCount = info.UseQuantity; } return(_ctripGateway.QueryOrder(responseBody)); } else if (response.Head.Code == "115002") { return(_ctripGateway.ErrorResult(ResultCode.QueryOrderNumberNotExist, response.Head.Describe)); } return(_ctripGateway.ErrorResult(ResultCode.SystemError, response.Head.Describe)); }
/// <summary> /// 查询接口 /// </summary> /// <param name="requestData"></param> /// <returns></returns> public object QueryOrder(string request) { var requestBody = _ctripGateway.CheckQueryOrder(request); if (requestBody == null) { return(_ctripGateway.ErrorResult(ResultCode.JsonParsingFailure, "报文解析失败")); } var data = requestBody.Data; var response = _ticketGateway.QueryOrder(new OrderQuery { OrderId = data.SupplierOrderId, OtaOrderId = data.OtaOrderId }); if (response.Head.Code == "000000") { var info = response.Body.OrderInfo.EticketInfo.FirstOrDefault(); var responseBody = new QueryOrderBodyResponse { SupplierOrderId = data.SupplierOrderId, OtaOrderId = data.OtaOrderId, items = new List <QueryOrderitemRespose>() }; foreach (var row in response.Body.OrderInfo.EticketInfo) { var item = new QueryOrderitemRespose { cancelQuantity = 0, useQuantity = row.UseQuantity, itemId = row.OtaOrderDetailId, quantity = row.EticketQuantity, useStartDate = row.UseStartDate, useEndDate = row.UseEndDate }; if (row.OrderStatus == (int)TicketOrderStatus.Success) { item.orderStatus = 2; } else if (row.OrderStatus == (int)TicketOrderStatus.Canncel) { item.cancelQuantity = row.EticketQuantity; item.orderStatus = 5; } else if (row.OrderStatus == (int)TicketOrderStatus.Consume) { item.orderStatus = 8; if (info.UseQuantity != info.EticketQuantity) { item.orderStatus = 7; } } responseBody.items.Add(item); } return(_ctripGateway.QueryOrder(responseBody)); } else if (response.Head.Code == "115002") { return(_ctripGateway.ErrorResult(ResultCode.QueryOrderNumberNotExist, response.Head.Describe)); } return(_ctripGateway.ErrorResult(ResultCode.SystemError, response.Head.Describe)); }