main^2
黄海 11 months ago
parent 287716a4ac
commit c177bee63f

@ -0,0 +1,37 @@
package com.charge.Test;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONObject;
import com.charge.util.SignUtils;
public class TestJingYueShangMaoChengZhaJi {
public static void main(String[] args) {
//净月商贸城
String url = "http://118.31.14.83:8501/vehicle/api/dowCoupon";
String appid = "1";//应用编号
String parkNo = "1";//站点编号
String appSecret = "ak1622a92d";//密钥
String charge_plate_no = "吉A888888";
int freeTime = 120;
JSONObject jo = new JSONObject();
jo.put("parkNo", parkNo);
jo.put("plate", charge_plate_no);//车牌号
jo.put("plate_color", 5);//车牌颜色,绿色
jo.put("coupon_type", 1);//1固定时长券
jo.put("couponName", "充电减免");
jo.put("coupon_value", freeTime);//卷面值 分钟 | 分
jo.put("appid", appid);//应用编号
jo.put("ts", System.currentTimeMillis());//时间戳
jo.put("sign", SignUtils.paramsSign(jo, appSecret));//签名
System.out.println(System.currentTimeMillis());
// 发送 POST 请求并获取响应
String result = HttpUtil.createPost(url)
.body(jo.toString()) // 将 JSON 对象转换为字符串作为请求正文
.header("version", "1.0.0")
.header("Content-Type", "application/json") // 设置请求头,指明内容类型为 JSON
.execute().body(); // 发送请求并获取响应体
System.out.println(result);
}
}
Loading…
Cancel
Save