|
|
|
@ -79,71 +79,79 @@ public class YltController extends Controller {
|
|
|
|
|
String name = thirdPartyStation.getStr("third_party_name");
|
|
|
|
|
//闸机所在车场ID
|
|
|
|
|
int parkId = thirdPartyStation.getInt("third_party_station_id");
|
|
|
|
|
//最小充电费用
|
|
|
|
|
int mini_receivable_total_fee = thirdPartyStation.getInt("mini_receivable_total_fee");
|
|
|
|
|
//最小充电度数
|
|
|
|
|
int mini_charge_ah = thirdPartyStation.getInt("mini_charge_ah");
|
|
|
|
|
|
|
|
|
|
log.info("发现闸机提供商:" + name + ",parkId=" + parkId);
|
|
|
|
|
|
|
|
|
|
//订单信息
|
|
|
|
|
Record dingDanRecord = ym.getOrderByNo(order_no);
|
|
|
|
|
String charge_begin_time = dingDanRecord.getStr("charge_begin_time");//充电开始时间
|
|
|
|
|
String charge_end_time = dingDanRecord.getStr("charge_end_time");//充电结束时间
|
|
|
|
|
int stationId = dingDanRecord.getInt("station_id");//电站ID
|
|
|
|
|
Record ddRecord = ym.getOrderByNo(order_no);
|
|
|
|
|
String charge_begin_time = ddRecord.getStr("charge_begin_time");//充电开始时间
|
|
|
|
|
String charge_end_time = ddRecord.getStr("charge_end_time");//充电结束时间
|
|
|
|
|
int stationId = ddRecord.getInt("station_id");//电站ID
|
|
|
|
|
//获取车场名称
|
|
|
|
|
String stationName = ym.getStationById(stationId).getStr("station_name");
|
|
|
|
|
//设备号
|
|
|
|
|
int deviceId = dingDanRecord.getInt("equipment_id");//充电桩ID
|
|
|
|
|
int deviceId = ddRecord.getInt("equipment_id");//充电桩ID
|
|
|
|
|
//充电桩名称
|
|
|
|
|
String deviceName = ym.getEquipmentById(deviceId).getStr("equipment_name");
|
|
|
|
|
//车位号
|
|
|
|
|
String spaceNo = dingDanRecord.getInt("connector_id").toString();
|
|
|
|
|
String spaceNo = ddRecord.getInt("connector_id").toString();
|
|
|
|
|
//充电量
|
|
|
|
|
String power = dingDanRecord.getDouble("charge_ah").toString();
|
|
|
|
|
Double power = ddRecord.getDouble("charge_ah");
|
|
|
|
|
//电费
|
|
|
|
|
int elecMoney = (int) (dingDanRecord.getDouble("receivable_electric_fee") * 100);
|
|
|
|
|
int elecMoney = (int) (ddRecord.getDouble("receivable_electric_fee") * 100);
|
|
|
|
|
//服务费
|
|
|
|
|
int seviceMoney = (int) (dingDanRecord.getDouble("receivable_service_fee") * 100);
|
|
|
|
|
int seviceMoney = (int) (ddRecord.getDouble("receivable_service_fee") * 100);
|
|
|
|
|
//总费用
|
|
|
|
|
int totalMoney = (int) (dingDanRecord.getDouble("receivable_total_fee") * 100);
|
|
|
|
|
int totalMoney = (int) (ddRecord.getDouble("receivable_total_fee") * 100);
|
|
|
|
|
//本地车场配置减免规则,根据充电时长换算
|
|
|
|
|
int freeType = 1;
|
|
|
|
|
int freeMoney = 0;//免费0元
|
|
|
|
|
int freeTime = 2 * 60 * 60;//2小时
|
|
|
|
|
//
|
|
|
|
|
if ("科拓".equals(name)) {
|
|
|
|
|
JSONObject jo = new JSONObject();
|
|
|
|
|
jo.put("appId", appId);
|
|
|
|
|
jo.put("parkId", parkId);
|
|
|
|
|
jo.put("serviceCode", "syncChargePilePay");
|
|
|
|
|
// 获取当前时间戳
|
|
|
|
|
long timestamp = System.currentTimeMillis();
|
|
|
|
|
jo.put("ts", timestamp);//每次请求附带当前时间戳(格林威治时间1970年01月01日00时00分00秒起至现在的总毫秒数)超过10S请求失效
|
|
|
|
|
jo.put("reqId", UUID.randomUUID().toString().toUpperCase());//每次请求的唯一标识,如果是异步接口,异步响应消息的reqId会与原请求的reqId一致。每次请求必须唯一!!!
|
|
|
|
|
jo.put("orderNo", order_no);//订单号
|
|
|
|
|
jo.put("plateNo", charge_plate_no);//车牌号
|
|
|
|
|
jo.put("startTime", charge_begin_time);//开始时间
|
|
|
|
|
jo.put("endTime", charge_end_time);//结束时间
|
|
|
|
|
jo.put("stationId", stationId);//电站ID
|
|
|
|
|
jo.put("stationName", stationName);//电站名称
|
|
|
|
|
jo.put("deviceId", deviceId);//充电桩ID
|
|
|
|
|
jo.put("deviceName", deviceName);//充电桩名称
|
|
|
|
|
jo.put("spaceNo", spaceNo);//位置ID
|
|
|
|
|
jo.put("power", power);//充电量
|
|
|
|
|
jo.put("elecMoney", elecMoney);//电费
|
|
|
|
|
jo.put("seviceMoney", seviceMoney);//服务费
|
|
|
|
|
jo.put("totalMoney", totalMoney);//总费用
|
|
|
|
|
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("version", "1.0.0")
|
|
|
|
|
.header("Content-Type", "application/json") // 设置请求头,指明内容类型为 JSON
|
|
|
|
|
.execute().body(); // 发送请求并获取响应体
|
|
|
|
|
//必须保证满足最低收费规则
|
|
|
|
|
if(totalMoney>=mini_receivable_total_fee && power>=mini_charge_ah){
|
|
|
|
|
// 科拓闸机
|
|
|
|
|
if ("科拓".equals(name)) {
|
|
|
|
|
JSONObject jo = new JSONObject();
|
|
|
|
|
jo.put("appId", appId);
|
|
|
|
|
jo.put("parkId", parkId);
|
|
|
|
|
jo.put("serviceCode", "syncChargePilePay");
|
|
|
|
|
// 获取当前时间戳
|
|
|
|
|
long timestamp = System.currentTimeMillis();
|
|
|
|
|
jo.put("ts", timestamp);//每次请求附带当前时间戳(格林威治时间1970年01月01日00时00分00秒起至现在的总毫秒数)超过10S请求失效
|
|
|
|
|
jo.put("reqId", UUID.randomUUID().toString().toUpperCase());//每次请求的唯一标识,如果是异步接口,异步响应消息的reqId会与原请求的reqId一致。每次请求必须唯一!!!
|
|
|
|
|
jo.put("orderNo", order_no);//订单号
|
|
|
|
|
jo.put("plateNo", charge_plate_no);//车牌号
|
|
|
|
|
jo.put("startTime", charge_begin_time);//开始时间
|
|
|
|
|
jo.put("endTime", charge_end_time);//结束时间
|
|
|
|
|
jo.put("stationId", stationId);//电站ID
|
|
|
|
|
jo.put("stationName", stationName);//电站名称
|
|
|
|
|
jo.put("deviceId", deviceId);//充电桩ID
|
|
|
|
|
jo.put("deviceName", deviceName);//充电桩名称
|
|
|
|
|
jo.put("spaceNo", spaceNo);//位置ID
|
|
|
|
|
jo.put("power", power);//充电量
|
|
|
|
|
jo.put("elecMoney", elecMoney);//电费
|
|
|
|
|
jo.put("seviceMoney", seviceMoney);//服务费
|
|
|
|
|
jo.put("totalMoney", totalMoney);//总费用
|
|
|
|
|
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("version", "1.0.0")
|
|
|
|
|
.header("Content-Type", "application/json") // 设置请求头,指明内容类型为 JSON
|
|
|
|
|
.execute().body(); // 发送请求并获取响应体
|
|
|
|
|
|
|
|
|
|
// 打印结果
|
|
|
|
|
System.out.println(result);
|
|
|
|
|
renderJson(CommonUtil.getRet(true, "已经向科拓闸机平台发送了减免消息!"));
|
|
|
|
|
return;
|
|
|
|
|
// 打印结果
|
|
|
|
|
System.out.println(result);
|
|
|
|
|
renderJson(CommonUtil.getRet(true, "已经向科拓闸机平台发送了减免消息!"));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
renderJson(CommonUtil.getRet(false, "发现了一个未知的闸机厂商,请联系开发人员!"));
|
|
|
|
|
}
|
|
|
|
|