首页 加油卡充值 加油卡充值示例代码 查询加油卡订单详情[Java]

查询加油卡订单详情示例代码[Java]

作者:xiezhongpian 阅读数:1763 上传时间:2017-05-09

查询加油卡订单详情

package api.jisuapi.fuelcardrecharge;

import api.util.HttpUtil;
import net.sf.json.JSONObject;

public class Orderdetail {

	public static final String APPKEY = "your_appkey_here";// 你的appkey
	public static final String URL = "https://api.jisuapi.com/fuelcardrecharge/orderdetail";
	public static final String orderno = "221601241155888";// 订单号
	public static final String outorderno = "";// 商家订单号,和订单号任选其一

	public static void Get() {
		String result = null;
		String url = URL + "?appkey=" + APPKEY + "&orderno=" + orderno + "&outorderno=" + outorderno;

		try {
			result = HttpUtil.sendGet(url, "utf-8");
			JSONObject json = JSONObject.fromObject(result);
			if (json.getInt("status") != 0) {
				System.out.println(json.getString("msg"));
			} else {
				JSONObject resultarr = (JSONObject) json.opt("result");
				String orderno = resultarr.getString("orderno");
				String outorderno = resultarr.getString("outorderno");
				String account = resultarr.getString("account");
				String num = resultarr.getString("num");
				String status = resultarr.getString("status");
				String rechargestatus = resultarr.getString("rechargestatus");
				String amount = resultarr.getString("amount");
				String totalfee = resultarr.getString("totalfee");
				String addtime = resultarr.getString("addtime");
				String type = resultarr.getString("type");
				System.out.println(type + " " + orderno + " " + outorderno + " " + account + " " + num + " " + status
						+ " " + rechargestatus + " " + amount + " " + totalfee + " " + addtime);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}