add 联联平台推送充电订单信息 接口

This commit is contained in:
Lemon
2023-05-20 15:26:28 +08:00
parent 28783dbc65
commit d325f641b0
3 changed files with 45 additions and 1 deletions

View File

@@ -114,4 +114,11 @@ public interface LianLianService {
* @return
*/
String pushStopChargeResult(String orderCode);
/**
* 推送充电订单信息
* @param orderCode
* @return
*/
String pushChargeOrderInfo(String orderCode);
}

View File

@@ -877,6 +877,39 @@ public class LianLianServiceImpl implements LianLianService {
return result;
}
/**
* 推送充电订单信息
* @param orderCode
* @return
*/
@Override
public String pushChargeOrderInfo(String orderCode) {
String url = TEST_URL + "notification_charge_order_info";
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode);
JSONObject json = new JSONObject();
json.put("StartChargeSeq", orderCode);
json.put("ConnectorID", orderBasicInfo.getPileConnectorCode());
json.put("StartTime", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderBasicInfo.getChargeStartTime()));
json.put("EndTime", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderBasicInfo.getChargeEndTime()));
json.put("TotalPower", orderDetail.getTotalUsedElectricity().setScale(2, BigDecimal.ROUND_HALF_UP));
json.put("TotalElecMoney", orderDetail.getTotalElectricityAmount().setScale(2, BigDecimal.ROUND_HALF_UP));
json.put("TotalSeviceMoney", orderDetail.getTotalServiceAmount().setScale(2, BigDecimal.ROUND_HALF_UP));
json.put("TotalMoney", orderDetail.getTotalOrderAmount().setScale(2, BigDecimal.ROUND_HALF_UP));
json.put("StopReason", 2); // 2BMS 停止充电
String jsonString = JSONObject.toJSONString(json);
String token = getToken(OPERATOR_ID, OPERATOR_SECRET);
if (token == null) {
return null;
}
// 发送请求
String result = HttpRequestUtil.sendPost(token, jsonString, url, DATA_SECRET, DATA_SECRETIV, OPERATOR_ID, SIG_SECRET);
return result;
}
// private ChargeDetail setChargeDetail(OrderBasicInfo orderBasicInfo, OrderDetail orderDetail) {
// ChargeDetail detail = new ChargeDetail();
//
@@ -891,6 +924,7 @@ public class LianLianServiceImpl implements LianLianService {
// TODO 推送充电订单信息 notification_charge_order_info
// TODO 推送订单对账结果信息 check_charge_orders
/**