mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-19 18:45:03 +08:00
新增 浙江省平台推送历史充电订单接口
This commit is contained in:
@@ -298,3 +298,20 @@
|
||||
4、预约充电订单目前不显示实时充电数据
|
||||
|
||||
5、桩主需要能看到桩的实时状态
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1、在 ==站点管理== ——> ==运营管理== 中勾选浙江省平台,点击保存按钮
|
||||
|
||||
<img src="C:\Users\admin\AppData\Roaming\Typora\typora-user-images\image-20240816100744446.png" alt="image-20240816100744446" style="zoom: 33%;" />
|
||||
|
||||
2、在 ==三方平台管理== ——> ==对接第三方平台关系== 页面中找到浙江省平台,点击 ==同步数据==,找到对应站点,点击 ==打开推送菜单== 页面, 点击右侧 ==推送充电站信息变化== 右侧的 ==推送== 按钮
|
||||
|
||||
<img src="C:\Users\admin\AppData\Roaming\Typora\typora-user-images\image-20240816100551217.png" alt="image-20240816100551217" style="zoom: 50%;" />
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -93,6 +93,26 @@ public class ThirdPartyNotificationController extends BaseController {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 历史充电订单信息推送
|
||||
*/
|
||||
@PostMapping("/notificationChargeOrderInfoHistory")
|
||||
public AjaxResult notificationChargeOrderInfoHistory(@RequestBody NotificationDTO dto) {
|
||||
AjaxResult result;
|
||||
try {
|
||||
notificationService.notificationChargeOrderInfoHistory(dto);
|
||||
result = AjaxResult.success();
|
||||
} catch (BusinessException e) {
|
||||
logger.error("历史充电订单信息推送失败", e);
|
||||
result = AjaxResult.error(e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("历史充电订单信息推送失败", e);
|
||||
result = AjaxResult.error();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 站点功率信息推送
|
||||
*/
|
||||
|
||||
@@ -23,7 +23,7 @@ public enum ThirdPlatformTypeEnum {
|
||||
DIAN_XING_PLATFORM("12", "宁波点行停车平台", ""),
|
||||
NING_XIA_PLATFORM("13", "宁夏平台", "MA01H3BQ9"),
|
||||
SHEN_ZHEN_PLATFORM("14", "深圳平台", ""),
|
||||
ZHE_JIANG_PLATFORM("15", "浙江省平台", ""),
|
||||
ZHE_JIANG_PLATFORM("15", "浙江省平台", "002485048"),
|
||||
;
|
||||
|
||||
private String typeCode;
|
||||
|
||||
@@ -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