欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

创建多人机票订单数据结构

程序员文章站 2022-05-08 15:32:19
...
public AirplaneCreateOrderResult createOrder(AirplaneCreateOrderBizDTO aCreateOrderBizDTO) {

		AirplaneCreateOrderResult aCreateOrderResult = new AirplaneCreateOrderResult();

		try {
			String hasInsurance = aCreateOrderBizDTO.getHasInsurance();

			String ori = aCreateOrderBizDTO.getOri();
			String des = aCreateOrderBizDTO.getDes();
			String fno = aCreateOrderBizDTO.getFno();
			String date = aCreateOrderBizDTO.getDate();
			String code = aCreateOrderBizDTO.getCode();
			String seat = aCreateOrderBizDTO.getSeat();

			String carrier = aCreateOrderBizDTO.getCarrier();
			String flightNo = aCreateOrderBizDTO.getFlightNo();
			String fromCity = aCreateOrderBizDTO.getFromCity();
			String arriveCity = aCreateOrderBizDTO.getArriveCity();
			String classCode = aCreateOrderBizDTO.getClassCode();
			String yPrice = aCreateOrderBizDTO.getyPrice();
			String classPrice = aCreateOrderBizDTO.getClassPrice();
			String fuelSurTax = aCreateOrderBizDTO.getFuelSurTax();
			String airportTax = aCreateOrderBizDTO.getAirportTax();
			String departureDate = aCreateOrderBizDTO.getDepartureDate();
			String departureTime = aCreateOrderBizDTO.getDepartureTime();
			String arrivalDate = aCreateOrderBizDTO.getArrivalDate();
			String arrivalTime = aCreateOrderBizDTO.getArrivalTime();

			String psgId = aCreateOrderBizDTO.getPsgId();
			String name = aCreateOrderBizDTO.getName();
			String psgType = aCreateOrderBizDTO.getPsgType();
			String cardType = aCreateOrderBizDTO.getCardType();
			String cardNo = aCreateOrderBizDTO.getCardNo();
			String birthDay = aCreateOrderBizDTO.getBirthDay();
			// String carrierPsgId = aCreateOrderBizDTO.getCarrierPsgId();
			String country = aCreateOrderBizDTO.getCountry();
			String mobilePhone = aCreateOrderBizDTO.getMobilePhone();
			String insueSum = aCreateOrderBizDTO.getInsueSum();
			String insueFee = aCreateOrderBizDTO.getInsueFee();

			String insueCnt = aCreateOrderBizDTO.getInsueCnt();
			String insuePrice = aCreateOrderBizDTO.getInsuePrice();
			String insueProductNo = aCreateOrderBizDTO.getInsueProductNo();

			String priceId = aCreateOrderBizDTO.getPriceId();
			String offerpsgType = aCreateOrderBizDTO.getOfferpsgType();
			String fare = aCreateOrderBizDTO.getFare();
			String agentComm = aCreateOrderBizDTO.getAgentComm();
			String offerfuelSurTax = aCreateOrderBizDTO.getOfferfuelSurTax();
			String offerairportTax = aCreateOrderBizDTO.getOfferairportTax();

			String linker = aCreateOrderBizDTO.getLinker();
			// String address = aCreateOrderBizDTO.getAddress();
			String telephone = aCreateOrderBizDTO.getTelephone();
			String isDomc = aCreateOrderBizDTO.getIsDomc();
			String ticketLimitDate = aCreateOrderBizDTO.getTicketLimitDate();
			String ticketLimitTime = aCreateOrderBizDTO.getTicketLimitTime();
			String balanceMoney = aCreateOrderBizDTO.getBalanceMoney();
			// String customerOrderNo = aCreateOrderBizDTO.getCustomerOrderNo();
			// String customerNo = aCreateOrderBizDTO.getCustomerNo();
			// String remark = aCreateOrderBizDTO.getRemark();

			String payType = aCreateOrderBizDTO.getPayType();
			// String linkeraddress = aCreateOrderBizDTO.getLinkeraddress();
			String linkerName = aCreateOrderBizDTO.getLinkerName();
			// String zip = aCreateOrderBizDTO.getZip();
			String telphone = aCreateOrderBizDTO.getTelephone();
			String linkermobilePhone = aCreateOrderBizDTO.getLinkermobilePhone();
			String sendTime = aCreateOrderBizDTO.getSendTime();
			String linkerEmail = aCreateOrderBizDTO.getLinkerEmail();
			String needInvoices = aCreateOrderBizDTO.getNeedInvoices();
			String invoicesSendType = aCreateOrderBizDTO.getInvoicesSendType();
			String sendTktsTypeCode = aCreateOrderBizDTO.getSendTktsTypeCode();
			// String isPrintSerial = aCreateOrderBizDTO.getIsPrintSerial();
			String sendTktDepId = aCreateOrderBizDTO.getSendTktDepId();
			String sendTktDepName = aCreateOrderBizDTO.getSendTktDepName();

			// String insuranceId = aCreateOrderBizDTO.getInsuranceId();
			// String shouldGath = aCreateOrderBizDTO.getShouldGath();
			// String shouldPay = aCreateOrderBizDTO.getShouldPay();
			// String retMoney = aCreateOrderBizDTO.getRetMoney();
			// String gain = aCreateOrderBizDTO.getGain();
			// String insuranceCount = aCreateOrderBizDTO.getInsuranceCount();
			// String insuranceSummary = aCreateOrderBizDTO.getInsuranceSummary();

			String[] spsgIdArray = psgId.split(",");
			String[] nameArray = name.split(",");
			String[] psgTypeArray = psgType.split(",");
			String[] cardTypeArray = cardType.split(",");
			String[] cardNoArray = cardNo.split(",");
			String[] birthDayArray = birthDay.split(",");
			String[] countryArray = country.split(",");
			String[] mobilePhoneArray = mobilePhone.split(",");
			String[] insueSumArray = insueSum.split(",");
			String[] insueFeeArray = insueFee.split(",");
			String[] insueCntArray = insueCnt.split(",");
			String[] insuePriceArray = insuePrice.split(",");
			String[] insueProductNoArray = insueProductNo.split(",");

			String[] priceIdArray = priceId.split(",");
			String[] offerpsgTypeArray = offerpsgType.split(",");
			String[] fareArray = fare.split(",");
			String[] agentCommArray = agentComm.split(",");
			String[] offerfuelSurTaxArray = offerfuelSurTax.split(",");
			String[] offerairportTaxArray = offerairportTax.split(",");

			String requestXml = "<data>";

			requestXml += "<checkCabinReq>";
			requestXml += StringUtil.joinXmlElement("ori", ori);
			requestXml += StringUtil.joinXmlElement("des", des);
			requestXml += StringUtil.joinXmlElement("fno", fno);
			requestXml += StringUtil.joinXmlElement("date", date);
			requestXml += StringUtil.joinXmlElement("code", code);
			requestXml += StringUtil.joinXmlElement("seat", seat);
			requestXml += "</checkCabinReq>";

			// 订单航程列表信息
			requestXml += "<orderReq>";
			requestXml += StringUtil.joinXmlElement("hasInsurance", hasInsurance);
			requestXml += "<orderFlightList>";
			requestXml += "<orderFlight>";
			requestXml += StringUtil.joinXmlElement("carrier", carrier);
			requestXml += StringUtil.joinXmlElement("flightNo", flightNo);
			requestXml += StringUtil.joinXmlElement("fromCity", fromCity);
			requestXml += StringUtil.joinXmlElement("arriveCity", arriveCity);
			requestXml += StringUtil.joinXmlElement("classCode", classCode);
			requestXml += StringUtil.joinXmlElement("yPrice", yPrice);
			requestXml += StringUtil.joinXmlElement("classPrice", classPrice);
			requestXml += StringUtil.joinXmlElement("fuelSurTax", fuelSurTax);
			requestXml += StringUtil.joinXmlElement("airportTax", airportTax);
			requestXml += StringUtil.joinXmlElement("departureDate", departureDate);
			requestXml += StringUtil.joinXmlElement("departureTime", departureTime);
			requestXml += StringUtil.joinXmlElement("arrivalDate", arrivalDate);
			requestXml += StringUtil.joinXmlElement("arrivalTime", arrivalTime);
			requestXml += "</orderFlight>";
			requestXml += "</orderFlightList>";

			// 乘客信息列表
			requestXml += "<passengerList>";

			for (int i = 0; i < spsgIdArray.length; i++) {
				requestXml += "<passengerInfo>";
				requestXml += StringUtil.joinXmlElement("psgId", spsgIdArray[i]);
				requestXml += StringUtil.joinXmlElement("name", nameArray[i]);
				requestXml += StringUtil.joinXmlElement("psgType", psgTypeArray[i]);
				requestXml += StringUtil.joinXmlElement("cardType", cardTypeArray[i]);
				requestXml += StringUtil.joinXmlElement("cardNo", cardNoArray[i]);
				requestXml += StringUtil.joinXmlElement("birthDay", birthDayArray[i]);
				// requestXml += StringUtil.joinXmlElement("carrierPsgId", carrierPsgId);
				requestXml += StringUtil.joinXmlElement("country", countryArray[i]);
				requestXml += StringUtil.joinXmlElement("mobilePhone", mobilePhoneArray[i]);
				requestXml += StringUtil.joinXmlElement("insueSum", insueSumArray[i]);
				requestXml += StringUtil.joinXmlElement("insueFee", insueFeeArray[i]);

				requestXml += StringUtil.joinXmlElement("insueCnt", insueCntArray[i]);
				requestXml += StringUtil.joinXmlElement("insuePrice", insuePriceArray[i]);
				requestXml += StringUtil.joinXmlElement("insueProductNo", insueProductNoArray[i]);
				requestXml += "</passengerInfo>";
			}
			requestXml += "</passengerList>";

			// 报价项列表
			requestXml += "<priceList>";
			for (int i = 0; i < priceIdArray.length; i++) {
				requestXml += "<priceInfo>";
				requestXml += StringUtil.joinXmlElement("priceId", priceIdArray[i]);
				requestXml += StringUtil.joinXmlElement("psgType", offerpsgTypeArray[i]);
				requestXml += StringUtil.joinXmlElement("fare", fareArray[i]);
				requestXml += StringUtil.joinXmlElement("agentComm", agentCommArray[i]);
				requestXml += StringUtil.joinXmlElement("fuelSurTax", offerfuelSurTaxArray[i]);
				requestXml += StringUtil.joinXmlElement("airportTax", offerairportTaxArray[i]);
				requestXml += "</priceInfo>";
			}
			requestXml += "</priceList>";

			// 订单信息
			requestXml += "<orderInfo>";
			for (int i = 0; i < 1; i++) {
				requestXml += StringUtil.joinXmlElement("linker", linker);
				// requestXml += StringUtil.joinXmlElement("address", address);
				requestXml += StringUtil.joinXmlElement("telephone", telephone);
				requestXml += StringUtil.joinXmlElement("isDomc", isDomc);
				requestXml += StringUtil.joinXmlElement("ticketLimitDate", ticketLimitDate);
				requestXml += StringUtil.joinXmlElement("ticketLimitTime", ticketLimitTime);
				requestXml += StringUtil.joinXmlElement("balanceMoney", balanceMoney);
				// requestXml += StringUtil.joinXmlElement("customerOrderNo", customerOrderNo);
				// requestXml += StringUtil.joinXmlElement("customerNo", customerNo);
				// requestXml += StringUtil.joinXmlElement("remark", remark);
			}
			requestXml += "</orderInfo>";

			// 联系人信息
			requestXml += "<linkerInfo>";
			for (int i = 0; i < 1; i++) {
				requestXml += StringUtil.joinXmlElement("payType", payType);
				// requestXml += StringUtil.joinXmlElement("address", linkeraddress);
				requestXml += StringUtil.joinXmlElement("linkerName", linkerName);
				// requestXml += StringUtil.joinXmlElement("zip", zip);
				requestXml += StringUtil.joinXmlElement("telphone", telphone);
				requestXml += StringUtil.joinXmlElement("mobilePhone", linkermobilePhone);
				requestXml += StringUtil.joinXmlElement("sendTime", sendTime);
				requestXml += StringUtil.joinXmlElement("linkerEmail", linkerEmail);
				requestXml += StringUtil.joinXmlElement("needInvoices", needInvoices);
				requestXml += StringUtil.joinXmlElement("invoicesSendType", invoicesSendType);
				requestXml += StringUtil.joinXmlElement("sendTktsTypeCode", sendTktsTypeCode);
				// requestXml += StringUtil.joinXmlElement("isPrintSerial", isPrintSerial);
				requestXml += StringUtil.joinXmlElement("sendTktDepId", sendTktDepId);
				requestXml += StringUtil.joinXmlElement("sendTktDepName", sendTktDepName);
			}
			requestXml += "</linkerInfo>";

			requestXml += "</orderReq>";

			requestXml += "</data>";

			String encryptCode = Md5.md5(requestXml + key);

			Map<String, String> paramasMap = new HashMap<String, String>();
			paramasMap.put("requestXml", requestXml);
			paramasMap.put("encryptCode", encryptCode);

			String xmlResult = HttpUtil.getUrlAsString(createOrderUrl, paramasMap);

			if (StringUtils.isNotEmpty(xmlResult)) {
				AirplaneProxyResult airplaneProxyResult = (AirplaneProxyResult) XmlUtil.xml2Object("data", xmlResult, AirplaneProxyResult.class);
				if (airplaneProxyResult != null && ReturnCodeEnum.SUCCESS.getCode().equals(airplaneProxyResult.getResultCode())) {
					aCreateOrderResult.setResultCode(airplaneProxyResult.getResultCode());
					aCreateOrderResult.setResultMsg(airplaneProxyResult.getResultMsg());

					OrderResult orderResult = airplaneProxyResult.getOrderResult();
					aCreateOrderResult.setSubsOrderNo(orderResult.getSubsOrderNo());
					aCreateOrderResult.setPnr(orderResult.getPnr());
					aCreateOrderResult.setPassengerCount(orderResult.getPassengerCount());
					aCreateOrderResult.setBalanceMoney(orderResult.getBalanceMoney());
					aCreateOrderResult.setStatus(orderResult.getStatus());
					aCreateOrderResult.setTicketLimitDt(orderResult.getTicketLimitDt());
					aCreateOrderResult.setTicketLimitTime(orderResult.getTicketLimitTime());

					orderResult = (OrderResult) XmlUtil.xml2Object("data/orderResult/priceList", xmlResult, OrderResult.class);
					aCreateOrderResult.setPriceList(orderResult.getPriceList());
				}
				log.info("飞机票生成订单, 发送结果 : " + airplaneProxyResult);
			}
		} catch (Exception e) {
			log.error("飞机票生成订单异常", e);
		}

		return aCreateOrderResult;

	}