新增 浙江省平台推送历史充电订单接口

This commit is contained in:
Lemon
2024-08-19 14:29:37 +08:00
parent 723be8d54b
commit 381fed9d29
6 changed files with 129 additions and 14 deletions

View File

@@ -657,8 +657,54 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService {
return null;
}
// 调用联联平台接口
JSONObject json = new JSONObject();
json.put("ChargeOrderInfo", orderInfo);
String jsonString = JSON.toJSONString(orderInfo);
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
return result;
}
/**
* 推送历史充电订单信息
* @param orderCode
* @return
*/
@Override
public String notificationChargeOrderInfoHistory(String orderCode) {
// 根据订单号查询出信息
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
ThirdPartySecretInfoVO zheJiangPlatformSecretInfo = getZheJiangPlatformSecretInfo();
String operatorId = zheJiangPlatformSecretInfo.getOurOperatorId();
String operatorSecret = zheJiangPlatformSecretInfo.getTheirOperatorSecret();
String signSecret = zheJiangPlatformSecretInfo.getTheirSigSecret();
String dataSecret = zheJiangPlatformSecretInfo.getTheirDataSecret();
String dataSecretIv = zheJiangPlatformSecretInfo.getTheirDataSecretIv();
String urlAddress = zheJiangPlatformSecretInfo.getTheirUrlPrefix();
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode);
String url = urlAddress + "supervise_notification_charge_order_info_history";
// 拼装成平台所需格式对象
ChargeOrderInfo orderInfo = transformChargeOrderInfo(orderBasicInfo, orderDetail);
orderInfo.setOperatorID(operatorId);
PileMerchantInfoVO pileMerchantInfoVO = pileMerchantInfoService.queryMerchantInfoByStationId(orderInfo.getStationID());
String equipmentOwnerID = ThirdPartyPlatformUtils.extractEquipmentOwnerID(pileMerchantInfoVO.getOrganizationCode());
orderInfo.setEquipmentOwnerID(equipmentOwnerID);
List<BillingPriceVO> billingList = pileBillingTemplateService.queryBillingPrice(orderBasicInfo.getStationId());
// 先将list按照 尖、峰、平、谷 时段排序
// List<BillingPriceVO> collect = billingList.stream().sorted(Comparator.comparing(BillingPriceVO::getTimeType)).collect(Collectors.toList());
// 再循环该list拼装对应的充电价格、费率
List<SupChargeDetails> chargeDetails = transformSupChargeDetails(orderDetail, billingList);
orderInfo.setChargeDetails(chargeDetails);
// 获取令牌
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
if (StringUtils.isBlank(token)) {
return null;
}
// 调用联联平台接口
String jsonString = JSON.toJSONString(orderInfo);
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
return result;