|
|
|
@ -4,6 +4,7 @@ import cn.hutool.http.HttpUtil;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.dsideal.ZhuQue.Interceptor.IsLoginInterface;
|
|
|
|
|
import com.dsideal.ZhuQue.Util.CommonUtil;
|
|
|
|
|
import com.dsideal.ZhuQue.Util.SignUtils;
|
|
|
|
|
import com.dsideal.ZhuQue.Ylt.Model.YltModel;
|
|
|
|
|
import com.jfinal.aop.Before;
|
|
|
|
|
import com.jfinal.core.Controller;
|
|
|
|
@ -43,15 +44,14 @@ public class YltController extends Controller {
|
|
|
|
|
@Before({POST.class})
|
|
|
|
|
@IsLoginInterface({})
|
|
|
|
|
// 非指定闸机场地
|
|
|
|
|
// http://10.10.21.20:8888/ZhuQue/Ylt/SyncChargePilePay?order_id=1
|
|
|
|
|
// http://10.10.21.20:8888/ZhuQue/Ylt/SyncChargePilePay?order_no=2020092315154430479
|
|
|
|
|
// 科拓闸机场地
|
|
|
|
|
// http://10.10.21.20:8888/ZhuQue/Ylt/SyncChargePilePay?order_id=248933
|
|
|
|
|
// http://10.10.21.20:8888/ZhuQue/Ylt/SyncChargePilePay?order_no=2022012911045715187
|
|
|
|
|
public void SyncChargePilePay(String order_no) {
|
|
|
|
|
//根据订单号获取到第三方方面提供的车场信息
|
|
|
|
|
Record thirdPartyStation = ym.getThirdPartyStation(order_no);
|
|
|
|
|
if (thirdPartyStation == null) {
|
|
|
|
|
Record record = new Record();
|
|
|
|
|
renderJson(CommonUtil.getRet(record, false, "检查到不是需要免费的道闸所在车场,无需发送减免消息!!"));
|
|
|
|
|
renderJson(CommonUtil.getRet(false, "检查到不是需要免费的道闸所在车场,无需发送减免消息!!"));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//请求地址
|
|
|
|
@ -59,7 +59,7 @@ public class YltController extends Controller {
|
|
|
|
|
//与科拓对接,对方平台分配的我司平台ID
|
|
|
|
|
String appId = thirdPartyStation.getStr("third_party_appId");
|
|
|
|
|
//与科拓对接,对方平台分配的我司平台秘钥
|
|
|
|
|
String key = thirdPartyStation.getStr("third_party_key");
|
|
|
|
|
String appSecret = thirdPartyStation.getStr("third_party_key");
|
|
|
|
|
//闸机提供商
|
|
|
|
|
String name = thirdPartyStation.getStr("third_party_name");
|
|
|
|
|
//闸机所在车场ID
|
|
|
|
@ -73,7 +73,7 @@ public class YltController extends Controller {
|
|
|
|
|
String charge_end_time = dingDanRecord.getStr("charge_end_time");//充电结束时间
|
|
|
|
|
int stationId = dingDanRecord.getInt("station_id");//电站ID
|
|
|
|
|
//获取车场名称
|
|
|
|
|
String stationName = ym.getStationById(String.valueOf(stationId)).getStr("station_name");
|
|
|
|
|
String stationName = ym.getStationById(stationId).getStr("station_name");
|
|
|
|
|
//设备号
|
|
|
|
|
int deviceId = dingDanRecord.getInt("equipment_id");//充电桩ID
|
|
|
|
|
//充电桩名称
|
|
|
|
@ -96,7 +96,6 @@ public class YltController extends Controller {
|
|
|
|
|
if ("科拓".equals(name)) {
|
|
|
|
|
JSONObject jo = new JSONObject();
|
|
|
|
|
jo.put("appId", appId);
|
|
|
|
|
jo.put("key", key);
|
|
|
|
|
jo.put("parkId", parkId);
|
|
|
|
|
jo.put("serviceCode", "syncChargePilePay");
|
|
|
|
|
// 获取当前时间戳
|
|
|
|
@ -119,12 +118,11 @@ public class YltController extends Controller {
|
|
|
|
|
jo.put("freeType", freeType);//减免类型
|
|
|
|
|
jo.put("freeMoney", freeMoney);//减免金额
|
|
|
|
|
jo.put("freeTime", freeTime);//减免时长
|
|
|
|
|
jo.put("key", SignUtils.paramsSign(jo, appSecret));
|
|
|
|
|
// 发送 POST 请求并获取响应
|
|
|
|
|
String result = HttpUtil.createPost(url)
|
|
|
|
|
.body(jo.toString()) // 将 JSON 对象转换为字符串作为请求正文
|
|
|
|
|
//.header("accept-language","zh-CN")
|
|
|
|
|
//.header("User-Agent","Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36")
|
|
|
|
|
//.header("version","1.0.0")
|
|
|
|
|
.header("version", "1.0.0")
|
|
|
|
|
.header("Content-Type", "application/json") // 设置请求头,指明内容类型为 JSON
|
|
|
|
|
.execute().body(); // 发送请求并获取响应体
|
|
|
|
|
|
|
|
|
|