# ydtApiDemo **Repository Path**: 857556266/ydt-api-demo ## Basic Information - **Project Name**: ydtApiDemo - **Description**: 运达通客户对接demo - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-06-19 - **Last Updated**: 2026-01-14 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 运达通客户对接api ### 运达通 * [SDK初始化]() ``` SdkYdtConfig.appId=""; SdkYdtConfig.appSecret=""; YdtStationListDataResponse _db = new YdtApiTestMain().stationList(1, 20); log.info("{}", JSON.toJSONString(_db)); ``` * [接口实例]() ``` /** * 获取主卡余额 * * @return * @throws Exception */ public YdtMaincardDataResponse.DataDTO maincardDetail() throws Exception { YdtMaincardDataResponse response = YdtClient.openApi(YdtSdkApi.V1_MAINCARD_DETAIL, null, YdtTokenManage.getToken(), YdtMaincardDataResponse.class); log.info("response:{}", JSON.toJSONString(response)); if (response.getCode() == HttpStatus.HTTP_OK) { return response.getData(); } return null; } /** * 创建订单 * * @param order * @throws Exception */ public YdtCreateOrderDataResponse createOrder(SdkYdtOrderRequest order) throws Exception { CommonDataResponse response = YdtClient.openApi(YdtSdkApi.V1_ORDER_CREATE, com.alibaba.fastjson2.JSON.toJSONString(order), YdtTokenManage.getToken(), CommonDataResponse.class); YdtCreateOrderDataResponse responseData = new YdtCreateOrderDataResponse(); if (response.getCode() == HttpStatus.HTTP_OK) { responseData.setCode(HttpStatus.HTTP_OK); String data = com.alibaba.fastjson2.JSON.toJSONString(response.getData()); log.info("data:{}", data); responseData.setData(com.alibaba.fastjson2.JSON.parseObject(data, YdtCreateOrderDataResponse.DataDTO.class)); } else { responseData.setCode(HttpStatus.HTTP_INTERNAL_ERROR); responseData.setCode(response.getCode()); responseData.setMessage(response.getMessage()); } return responseData; } /** * 获取二维吗 * * @param qrcodeParam * @throws Exception */ public void qrcode(SdkYdtOrderQrcodeRequest qrcodeParam) throws Exception { YdtClient.openApi(YdtSdkApi.V1_ORDER_QRCODE, com.alibaba.fastjson2.JSON.toJSONString(qrcodeParam), YdtTokenManage.getToken(), SdkQrcodeOrderResponse.class); } /** * 查询订单 * * @param customerOrderNo 客户订单编号 * @throws Exception */ public void detail(String customerOrderNo) throws Exception { Map data = new HashMap<>(); data.put("customerOrderNo", customerOrderNo); YdtClient.openApi(YdtSdkApi.V1_ORDER_DETAIL, com.alibaba.fastjson2.JSON.toJSONString(data), YdtTokenManage.getToken(), YdtDetailOrderDataResponse.class); } /** * 退单 客单号&订单号 二选一必填 * * @param customerOrderNo 客单号 * @param orderNo 订单号 * @param refundRemark 退款原因 * @throws Exception */ public YdtRefundOrderDataResponse refund(String customerOrderNo, String orderNo, String refundRemark) throws Exception { Map data = new HashMap<>(); data.put("customerOrderNo", customerOrderNo); data.put("orderNo", orderNo); data.put("refundRemark", refundRemark); return YdtClient.openApi(YdtSdkApi.V1_ORDER_REFUND, com.alibaba.fastjson2.JSON.toJSONString(data), YdtTokenManage.getToken(), YdtRefundOrderDataResponse.class); } /** * 获取油站列表 * * @param pageNo * @param pageSize * @throws Exception */ public YdtStationListDataResponse stationList(Integer pageNo, Integer pageSize) throws Exception { Map data = new HashMap<>(); data.put("pageNo", pageNo); data.put("pageSize", pageSize); return YdtClient.openApi(YdtSdkApi.V1_STATION_LIST, com.alibaba.fastjson2.JSON.toJSONString(data), YdtTokenManage.getToken(), YdtStationListDataResponse.class); } /** * 获取单个油站信息 * * @param stationId * @throws Exception */ public YdtStationDetailDataResponse stationDetail(long stationId) throws Exception { Map data = new HashMap<>(); data.put("stationId", stationId); return YdtClient.openApi(YdtSdkApi.V1_STATION_DETAIL, com.alibaba.fastjson2.JSON.toJSONString(data), YdtTokenManage.getToken(), YdtStationDetailDataResponse.class); } ``` * [回调实例]() ``` 油站变更推送通知(回告) YdtStationListDataResponse.DataDTO.RowsDTO ydtStationDataList = YdtNoticeResponseHandel.changeNotice(request); 订单退款推送通知(回告) SdkYdtOrderRefundNoticeRequest noticeRequest = YdtNoticeResponseHandel.refundNotice(request); 创建订单推送通知(回告) SdkYdtOrderCreateNoticeRequest noticeRequest = YdtNoticeResponseHandel.createNotice(request); ```