mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-22 03:55:17 +08:00
新增 浙江省平台推送历史充电订单接口
This commit is contained in:
@@ -273,9 +273,9 @@ public class CommonService {
|
||||
if (StringUtils.equals(connectorStatus, "03")) {
|
||||
// 充电中
|
||||
lianLianService.pushPileChargeStatusChange(orderInfo.getOrderCode());
|
||||
// 推送充电状态
|
||||
lianLianService.pushChargeStatus(orderInfo.getOrderCode());
|
||||
}
|
||||
// 推送充电状态
|
||||
lianLianService.pushChargeStatus(orderInfo.getOrderCode());
|
||||
}
|
||||
if (StringUtils.equals(ThirdPlatformTypeEnum.NING_BO_PLATFORM.getTypeCode(), thirdPartyType)) {
|
||||
// 中电联
|
||||
@@ -422,12 +422,6 @@ public class CommonService {
|
||||
return;
|
||||
}
|
||||
|
||||
// 查询订单信息
|
||||
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode);
|
||||
if (Objects.isNull(orderInfo)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 推送
|
||||
for (ThirdPartySecretInfoVO thirdPartySecretInfoVO : thirdPartySecretInfoVOS) {
|
||||
NotificationDTO dto = new NotificationDTO();
|
||||
@@ -435,11 +429,17 @@ public class CommonService {
|
||||
dto.setPileConnectorCode(pileConnectorCode);
|
||||
dto.setStatus(changedStatus);
|
||||
dto.setPlatformType(thirdPartySecretInfoVO.getPlatformType());
|
||||
dto.setOrderCode(orderInfo.getOrderCode());
|
||||
|
||||
notificationService.notificationConnectorChargeStatus(dto);
|
||||
|
||||
notificationService.notificationStationStatus(dto);
|
||||
|
||||
// 查询订单信息
|
||||
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode);
|
||||
if (Objects.isNull(orderInfo)) {
|
||||
return;
|
||||
}
|
||||
dto.setOrderCode(orderInfo.getOrderCode());
|
||||
notificationService.notificationConnectorChargeStatus(dto);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -224,4 +224,36 @@ public class NotificationService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 历史充电订单信息推送
|
||||
* notification_orderInfo/notification_charge_order_info
|
||||
*/
|
||||
public void notificationChargeOrderInfoHistory(NotificationDTO dto) {
|
||||
String stationId = dto.getStationId();
|
||||
String orderCode = dto.getOrderCode();
|
||||
String platformType = dto.getPlatformType();
|
||||
if (StringUtils.isBlank(stationId) || StringUtils.isBlank(orderCode)) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
||||
}
|
||||
// 通过stationId 查询该站点需要对接的平台配置
|
||||
List<ThirdPartySecretInfoVO> secretInfoVOS = thirdpartySecretInfoService.queryStationToPlatformList(stationId);
|
||||
if (CollectionUtils.isEmpty(secretInfoVOS)) {
|
||||
return;
|
||||
}
|
||||
// 调用相应平台的处理方法
|
||||
for (ThirdPartySecretInfoVO secretInfoVO : secretInfoVOS) {
|
||||
if (StringUtils.isNotBlank(platformType) && !StringUtils.equals(platformType, secretInfoVO.getPlatformType())) {
|
||||
// 如果dto中的platformType不为空,并且不等于secretInfoVO.getPlatformType(),continue
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
// 根据平台类型获取Service
|
||||
ThirdPartyPlatformService platformService = ThirdPartyPlatformFactory.getInvokeStrategy(secretInfoVO.getPlatformType());
|
||||
platformService.notificationChargeOrderInfoHistory(orderCode);
|
||||
} catch (Exception e) {
|
||||
logger.error("历史充电订单信息推送error", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user