package net.tooan.ynpay.order.eadd.helper; import net.tooan.ynpay.order.eadd.*; import net.tooan.ynpay.third.jfinal.log.Logger; import javax.xml.ws.BindingProvider; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.util.Collection; import java.util.List; import java.util.Properties; import static net.tooan.ynpay.commons.BusinessException.parseException; /** * Created with IntelliJ IDEA. * User: iris * Date: 13-11-21 * Time: 下午3:49 * To change this template use File | Settings | File Templates. */ public class EaddFacadeAnswer { private static Logger logger = Logger.getLogger(EaddFacade.class); private static EaddFacadeAnswer facade = new EaddFacadeAnswer(); private KYServiceBean serviceBean; private String loginCode; private String password; private EaddFacadeAnswer() { Properties props = new Properties(); try { props.load(EaddFacade.class.getResourceAsStream("/EaddFacade.properties")); } catch (IOException e) { if (logger.isErrorEnabled()) { logger.error(e.getMessage(), e); } } String ifaceAddress = props.getProperty("jws.address"); KYServiceBeanService service = null; try { service = new KYServiceBeanService(new URL(ifaceAddress)); } catch (MalformedURLException e) { if (logger.isErrorEnabled()) { logger.error(e.getMessage(), e); } service = new KYServiceBeanService(EaddFacade.class.getResource("/KY.wsdl")); } serviceBean = service.getKYServiceBeanPort(); if (serviceBean instanceof BindingProvider) { ((BindingProvider) serviceBean).getRequestContext().put("javax.xml.ws.service.endpoint.address", ifaceAddress); } loginCode = props.getProperty("salesUnit.loginCode"); password = props.getProperty("salesUnit.password"); } /** * 查询可售客运站 * find 查询可以获取的客运站列表 * * @return */ public StationQueryList findStationServer() { try { return serviceBean.getStationList(loginCode, password); } catch (Exception_Exception e) { throw parseException(e); } } /** * 查询发车区域 * * @param stationCode * @return */ public static GetAreaListResult findAreaByStation(String stationCode) { return facade.findAreaByStationService(stationCode); } public GetAreaListResult findAreaByStationService(String stationCode) { try { return serviceBean.getAreaList(stationCode, loginCode, password); } catch (Exception_Exception e) { throw parseException(e); } } /** * 通过客运站编码或区域代码查询起点 * * @param stationCode * @param areaCode * @return */ public GetSiteListResult findStartSiteByArea(String stationCode, String areaCode) { return facade.findStartSiteByAreaService(stationCode, areaCode); } public GetSiteListResult findStartSiteByAreaService(String stationCode, String areaCode) { try { return serviceBean.getBeginSiteList(loginCode, password, stationCode, areaCode); } catch (Exception_Exception e) { throw parseException(e); } } /** * 讫点查询接口1 * 通过客运站编码或讫点站编码查讫点 * * @param stationCode * @param endSiteCode * @return */ public GetSiteListResult findEndSiteByCode(String stationCode, String endSiteCode) { return facade.findEndSiteByCodeService(stationCode, endSiteCode); } public GetSiteListResult findEndSiteByCodeService(String stationCode, String endSiteCode) { try { return serviceBean.getSiteListByCode(loginCode, password, stationCode, endSiteCode); } catch (Exception_Exception e) { throw parseException(e); } } /** * 讫点查询接口2 * 通过客运站编码或讫点站首字母区间查找讫点站列表 * * @param stationCode * @param firstChar * @param finishChar * @return */ public GetSiteListResult findEndSiteByFirst(String stationCode, String firstChar, String finishChar) { return facade.findEndSiteByFirstService(stationCode, firstChar, finishChar); } public GetSiteListResult findEndSiteByFirstService(String stationCode, String firstChar, String finishChar) { try { return serviceBean.getSiteListByFirst(loginCode, password, stationCode, firstChar, finishChar); } catch (Exception_Exception e) { throw parseException(e); } } /** * 讫点查询接口3 * *通过客运站编码,或区域编码,起点站编码查询讫点 * * @param stationCode * @param area * @param beginSite * @return */ public GetSiteListResult findEndSiteByArea(String stationCode, String area, String beginSite) { return facade.findEndSiteByAreaService(stationCode, area, beginSite); } public GetSiteListResult findEndSiteByAreaService(String stationCode, String area, String beginSite) { try { return serviceBean.getEndSiteList(loginCode, password, stationCode, area, beginSite); } catch (Exception_Exception e) { throw parseException(e); } } /** * 班次查询接口 * * @param stationCode * @param classCode * @param endSiteCode * @param throughControl * @param Date * @param fastControl * @param forOther1 * @param forOther2 * @param forOther3 * @return */ public List<ClassList> findClassByTerm(String stationCode, String classCode, String endSiteCode, String throughControl, String Date, String fastControl, String forOther1, String forOther2, String forOther3) { return facade.findClassByTermService(stationCode, classCode, endSiteCode, throughControl, Date, fastControl, forOther1, forOther2, forOther3); } public List<ClassList> findClassByTermService(String stationCode, String classCode, String endSiteCode, String throughControl, String Date, String fastControl, String forOther1, String forOther2, String forOther3) { try { return serviceBean.getClassList(loginCode, password, stationCode, classCode, endSiteCode, throughControl, Date, fastControl, forOther1, forOther2, forOther3); } catch (Exception_Exception e) { throw parseException(e); } } /** * 通过取票密码,身份证,电话号码,姓名查询订单 * * * @param stationCode * @param password * @param date * @param guestName * @param guestTel * @param guestIDCard * @return */ public static List<OrderList> findOrderByTerm(String stationCode, String password, String date, String guestName, String guestTel, String guestIDCard) { return facade.findOrderByTermService(stationCode, password, date, guestName, guestTel, guestIDCard); } public List<OrderList> findOrderByTermService(String stationCode, String password, String date, String guestName, String guestTel, String guestIDCard) { try { return serviceBean.getOrderListByTerm(loginCode, password, stationCode, password, date, guestName, guestTel, guestIDCard); } catch (Exception_Exception e) { throw parseException(e); } } public static List<OrderList> findOrderById(String stationCode, String orderIds, String forOther1, String forOther2, String forOther3, String forOther4) { return facade.findOrderByIdService(stationCode, orderIds, forOther1, forOther2, forOther3, forOther4); } public List<OrderList> findOrderByIdService(String stationCode, String orderIds, String forOther1, String forOther2, String forOther3, String forOther4) { try { return serviceBean.getOrderListById(loginCode, password, stationCode, orderIds, forOther1, forOther2, forOther3, forOther4); } catch (Exception_Exception e) { throw parseException(e); } } public static List<TicketOrderResult> booking(String stationCode, String classId, String ticketNum, String ticketPrice, String insurance, String endSiteId, String ticketType, String placeId, String childrenNum, String guestName, String guestTel, String guestIdCardType, String guestIdCard, String cancelTime, String orderRemark, String forOther1, String forOther2, String forOther3, String forOther4) { return facade.bookingService(stationCode, classId, ticketNum, ticketPrice, insurance, endSiteId, ticketType, placeId, childrenNum, guestName, guestTel, guestIdCardType, guestIdCard, cancelTime, orderRemark, forOther1, forOther2, forOther3, forOther4); } public List<TicketOrderResult> bookingService(String stationCode, String classId, String ticketNum, String ticketPrice, String insurance, String endSiteId, String ticketType, String placeId, String childrenNum, String guestName, String guestTel, String guestIdCardType, String guestIdCard, String cancelTime, String orderRemark, String forOther1, String forOther2, String forOther3, String forOther4) { try { return serviceBean.ticketOrder(loginCode, password, stationCode, classId, ticketNum, ticketPrice, insurance, endSiteId, ticketType, placeId, childrenNum, guestName, guestTel, guestIdCardType, guestIdCard, cancelTime, orderRemark, forOther1, forOther2, forOther3, forOther4); } catch (Exception_Exception e) { throw parseException(e); } } public static Collection<OutTicketResult> pay(String stationCode, String orderIds, String payRemark, String foOther1, String forOther2, String forOther3, String forOther4) { return facade.payService(stationCode, orderIds, payRemark, foOther1, forOther2, forOther3, forOther4); } public Collection<OutTicketResult> payService(String stationCode, String orderIds, String payRemark, String foOther1, String forOther2, String forOther3, String forOther4) { try { return serviceBean.netOutTicket(loginCode, password, stationCode, orderIds, payRemark, foOther1, forOther2, forOther3, forOther4); } catch (Exception_Exception e) { throw parseException(e); } } public static Collection<CancelOrderResult> CancelOrder(String stationCode, String orderIds, String cancelRemark, String foOther1, String forOther2, String forOther3, String forOther4) { return facade.CancelOrderService(stationCode, orderIds, cancelRemark, foOther1, forOther2, forOther3, forOther4); } public List<CancelOrderResult> CancelOrderService(String stationCode, String orderIds, String cancelRemark, String foOther1, String forOther2, String forOther3, String forOther4) { try { return serviceBean.cancelOrder(loginCode, password, stationCode, orderIds, cancelRemark, foOther1, forOther2, forOther3, forOther4); } catch (Exception_Exception e) { throw parseException(e); } } public static Collection<CancelOutTicketResult> CancelPayOrder(String stationCode, String orderIds, String guestTel, String guestName, String guestIsCardType, String guestIdCard, String cancelPayRemark) { return facade.CancelPayOrderService(stationCode, orderIds, guestTel, guestName, guestIsCardType, guestIdCard, cancelPayRemark); } public Collection<CancelOutTicketResult> CancelPayOrderService(String stationCode, String orderIds, String guestTel, String guestName, String guestIsCardType, String guestIdCard, String cancelPayRemark) { try { return serviceBean.netCancelOutTicket(loginCode, password, stationCode, orderIds, guestTel, guestName, guestIsCardType, guestIdCard, cancelPayRemark); } catch (Exception_Exception e) { throw parseException(e); } } public static GetTakeTicketResult TakeTicket(String orderId, String ticketNo, String operatorName, String operatorCode) { return facade.TakeTicketService(orderId, ticketNo, operatorName, operatorCode); } public GetTakeTicketResult TakeTicketService(String orderId, String ticketNo, String operatorName, String operatorCode) { try { return serviceBean.takeTicket(loginCode, password, orderId, ticketNo, operatorCode, operatorName); } catch (Exception_Exception e) { throw parseException(e); } } public static GetTakeTicketResult BatchTakeTicket(List<MapEntry> ticketInfo, String operatorName, String operatorCode) { return facade.BatchTakeTicketService(ticketInfo, operatorName, operatorCode); } public GetTakeTicketResult BatchTakeTicketService(List<MapEntry> ticketInfo, String operatorName, String operatorCode) { try { return serviceBean.batchTakeTicket(loginCode, password, ticketInfo, operatorCode, operatorName); } catch (Exception_Exception e) { throw parseException(e); } } public static GetTakeTicketResult PayAndTakeTicket(String stationCode, List<MapEntry> ticketInfo, String operatorName, String operatorCode, String payAndTakeRemark) { return facade.PayAndTakeTicketService(stationCode, ticketInfo, operatorName, operatorCode, payAndTakeRemark); } public GetTakeTicketResult PayAndTakeTicketService(String stationCode, List<MapEntry> ticketInfo, String operatorName, String operatorCode, String payAndTakeRemark) { try { return serviceBean.outTakeTicket(loginCode, password, stationCode, ticketInfo, operatorCode, operatorName, payAndTakeRemark); } catch (Exception_Exception e) { throw parseException(e); } } public static GetTakeTicketResult rePrintTicket(String orderId, String ticketNo, String newTicketNo, String operatorName, String operatorCode, String rePrintRemark) { return facade.rePrintTicketService(orderId, ticketNo, newTicketNo, operatorName, operatorCode, rePrintRemark); } public GetTakeTicketResult rePrintTicketService(String orderId, String ticketNo, String newTicketNo, String operatorName, String operatorCode, String rePrintRemark) { try { return serviceBean.rePrintTicket(loginCode, password, orderId, ticketNo, newTicketNo, operatorCode, operatorName, rePrintRemark); } catch (Exception_Exception e) { throw parseException(e); } } public static InvalidTicketResult invalidTicket(String orderId, String ticketNo, String operatorName, String operatorCode, String invalidRemark) { return facade.invalidTicketService(orderId, ticketNo, operatorName, operatorCode, invalidRemark); } public InvalidTicketResult invalidTicketService(String orderId, String ticketNo, String operatorName, String operatorCode, String invalidRemark) { try { return serviceBean.invalidTicket(loginCode, password, orderId, ticketNo, operatorCode, operatorName, invalidRemark); } catch (Exception_Exception e) { throw parseException(e); } } }