use of lab.ticket.model.PassengerData in project 12306-hunter by xautlx.
the class HttpClientService method confirmSingleForQueueOrder.
public String confirmSingleForQueueOrder(TicketData ticketData, SingleTrainOrderVO singleTrainOrderVO, String randCode, boolean justCheck) {
String title = "[登录用户:" + singleTrainOrderVO.getLoginUser() + "] ";
HttpClient httpClient = buildHttpClient();
TrainQueryInfo trainQueryInfo = singleTrainOrderVO.getTrainQueryInfo();
try {
String url = null;
if (justCheck) {
url = POST_URL_CHECKORDERINFO + randCode;
} else {
url = POST_URL_CONFIRMSINGLEFORQUEUE;
}
List<PassengerData> validPassengerDatas = ticketData.getValidPassengerDatas();
List<NameValuePair> parameters = new ArrayList<NameValuePair>();
for (int i = 0; i < validPassengerDatas.size(); i++) {
parameters.add(new BasicNameValuePair("checkbox" + i, Integer.toString(i)));
}
parameters.add(new BasicNameValuePair("checkbox9", "Y"));
parameters.add(new BasicNameValuePair("checkbox9", "Y"));
parameters.add(new BasicNameValuePair("checkbox9", "Y"));
parameters.add(new BasicNameValuePair("checkbox9", "Y"));
parameters.add(new BasicNameValuePair("checkbox9", "Y"));
parameters.add(new BasicNameValuePair(SUBMIT_LEFTTICKETSTR, singleTrainOrderVO.getSubmitOrderRequestLeftTicketStr()));
for (int i = 0; i < validPassengerDatas.size(); i++) {
parameters.add(new BasicNameValuePair(SUBMIT_OLDPASSENGERS, validPassengerDatas.get(i).getShortText()));
}
for (int i = 0; i < (5 - validPassengerDatas.size()); i++) {
parameters.add(new BasicNameValuePair(SUBMIT_OLDPASSENGERS, ""));
}
parameters.add(new BasicNameValuePair(SUBMIT_BED_LEVEL_ORDER_NUM, "000000000000000000000000000000"));
parameters.add(new BasicNameValuePair(SUBMIT_CANCEL_FLAG, "1"));
parameters.add(new BasicNameValuePair(SUBMIT_END_TIME, trainQueryInfo.getEndTime()));
parameters.add(new BasicNameValuePair(SUBMIT_FROM_STATION_NAME, trainQueryInfo.getFromStation()));
parameters.add(new BasicNameValuePair(SUBMIT_FROM_STATION_TELECODE, trainQueryInfo.getFromStationCode()));
parameters.add(new BasicNameValuePair(SUBMIT_ID_MODE, "Y"));
parameters.add(new BasicNameValuePair(SUBMIT_RESERVE_FLAG, "A"));
parameters.add(new BasicNameValuePair(SUBMIT_TO_SEAT_TYPE_CODE, ""));
parameters.add(new BasicNameValuePair(SUBMIT_START_TIME, trainQueryInfo.getStartTime()));
parameters.add(new BasicNameValuePair(SUBMIT_STATION_TRAIN_CODE, trainQueryInfo.getTrainNo()));
parameters.add(new BasicNameValuePair(SUBMIT_TICKET_TYPE_ORDER_NUM, ""));
parameters.add(new BasicNameValuePair(SUBMIT_TO_STATION_NAME, trainQueryInfo.getToStation()));
parameters.add(new BasicNameValuePair(SUBMIT_TO_STATION_TELECODE, trainQueryInfo.getToStationCode()));
parameters.add(new BasicNameValuePair(QUERY_TRAIN_DATE, singleTrainOrderVO.getTrainDate()));
parameters.add(new BasicNameValuePair(QUERY_TRAIN_NO, trainQueryInfo.getTrainno4()));
parameters.add(new BasicNameValuePair(SUBMIT_TOKEN, singleTrainOrderVO.getSubmitOrderRequestToken()));
for (int i = 0; i < validPassengerDatas.size(); i++) {
parameters.add(new BasicNameValuePair(SUBMIT_PASSENGERTICKETS, validPassengerDatas.get(i).getLongText(singleTrainOrderVO.getSeatType())));
parameters.add(new BasicNameValuePair("passenger_" + (i + 1) + "_cardno", validPassengerDatas.get(i).getCardNo()));
parameters.add(new BasicNameValuePair("passenger_" + (i + 1) + "_cardtype", validPassengerDatas.get(i).getCardType().getValue()));
parameters.add(new BasicNameValuePair("passenger_" + (i + 1) + "_mobileno", validPassengerDatas.get(i).getMobile()));
parameters.add(new BasicNameValuePair("passenger_" + (i + 1) + "_name", validPassengerDatas.get(i).getName()));
parameters.add(new BasicNameValuePair("passenger_" + (i + 1) + "_seat", singleTrainOrderVO.getSeatType().getValue()));
parameters.add(new BasicNameValuePair("passenger_" + (i + 1) + "_ticket", validPassengerDatas.get(i).getTicketType().getValue()));
}
parameters.add(new BasicNameValuePair(SUBMIT_RANDCODE, randCode));
// 检查订单
if (justCheck) {
parameters.add(new BasicNameValuePair(SUBMIT_TFLAG, "dc"));
}
parameters.add(new BasicNameValuePair(SUBMIT_TEXTFIELD, "中文或拼音首字母"));
TicketMainFrame.appendMessage(title + "提交订单, 车次:" + singleTrainOrderVO.getTrainNo() + ",席别:" + singleTrainOrderVO.getSeatType() + ",日期:" + singleTrainOrderVO.getTrainDate());
String responseBody = postHttpRequestAsString(httpClient, url, parameters, singleTrainOrderVO.getCookieData());
return responseBody;
} finally {
httpClient.getConnectionManager().shutdown();
}
}
use of lab.ticket.model.PassengerData in project 12306-hunter by xautlx.
the class PassengerPanel method bindUItoModel.
/**
* 绑定UI数据到模型对象
* @return
*/
public PassengerData bindUItoModel() {
logger.debug("Binding UI data for passenger: {}", textCardNo.getText());
PassengerData passengerData = new PassengerData();
if (chckbxSelect.isSelected()) {
passengerData.setSelected(true);
} else {
passengerData.setSelected(false);
}
passengerData.setCardNo(textCardNo.getText());
passengerData.setCardType((CardType) comboCardType.getSelectedItem());
passengerData.setName(textName.getText());
passengerData.setMobile(textMobile.getText());
passengerData.setTicketType((TicketType) comboTicketType.getSelectedItem());
return passengerData;
}
Aggregations