mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-22 03:55:17 +08:00
86 lines
3.0 KiB
Java
86 lines
3.0 KiB
Java
|
|
package com.jsowell.thirdparty.common;
|
|||
|
|
|
|||
|
|
import com.jsowell.pile.vo.ThirdPartySecretInfoVO;
|
|||
|
|
import com.jsowell.thirdparty.platform.ThirdPartyPlatformService;
|
|||
|
|
import com.jsowell.thirdparty.platform.factory.ThirdPartyPlatformFactory;
|
|||
|
|
import com.jsowell.thirdparty.service.ThirdpartySecretInfoService;
|
|||
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|||
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|||
|
|
import org.springframework.stereotype.Service;
|
|||
|
|
|
|||
|
|
import java.util.List;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 主动通知Service
|
|||
|
|
* 说明:创建此接口目的是为了简化开发
|
|||
|
|
* 在需要通知第三方平台的地方,异步调用此类中对应的方法
|
|||
|
|
* 通知方法中应该根据对接平台,自动找到响应的平台处理逻辑
|
|||
|
|
*/
|
|||
|
|
@Service
|
|||
|
|
public class NotificationService {
|
|||
|
|
|
|||
|
|
@Autowired
|
|||
|
|
private ThirdpartySecretInfoService thirdpartySecretInfoService;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 充电站信息变化推送
|
|||
|
|
* notification_stationInfo
|
|||
|
|
*/
|
|||
|
|
public void notificationStationInfo(String stationId) {
|
|||
|
|
// 通过stationId 查询该站点需要对接的平台配置
|
|||
|
|
List<ThirdPartySecretInfoVO> secretInfoVOS = thirdpartySecretInfoService.queryStationToPlatformList(stationId);
|
|||
|
|
if (CollectionUtils.isEmpty(secretInfoVOS)) {
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
// 调用相应平台的处理方法
|
|||
|
|
for (ThirdPartySecretInfoVO secretInfoVO : secretInfoVOS) {
|
|||
|
|
ThirdPartyPlatformService platformService = ThirdPartyPlatformFactory.getInvokeStrategy(secretInfoVO.getPlatformType());
|
|||
|
|
// platformService.printServiceName();
|
|||
|
|
platformService.notificationStationInfo(stationId);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 设备状态变化推送
|
|||
|
|
* notification_stationStatus
|
|||
|
|
*/
|
|||
|
|
public void notificationStationStatus(String stationId, String pileConnectorCode, String status) {
|
|||
|
|
// 通过stationId 查询该站点需要对接的平台配置
|
|||
|
|
List<ThirdPartySecretInfoVO> secretInfoVOS = thirdpartySecretInfoService.queryStationToPlatformList(stationId);
|
|||
|
|
if (CollectionUtils.isEmpty(secretInfoVOS)) {
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
// 调用相应平台的处理方法
|
|||
|
|
for (ThirdPartySecretInfoVO secretInfoVO : secretInfoVOS) {
|
|||
|
|
// 根据平台类型获取Service
|
|||
|
|
ThirdPartyPlatformService platformService = ThirdPartyPlatformFactory.getInvokeStrategy(secretInfoVO.getPlatformType());
|
|||
|
|
platformService.notificationStationStatus(stationId, pileConnectorCode, status, secretInfoVO);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 设备充电中状态变化推送
|
|||
|
|
* notification_connector_charge_status
|
|||
|
|
* notification_equip_charge_status
|
|||
|
|
*/
|
|||
|
|
public void notificationConnectorChargeStatus() {
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 订单信息推送
|
|||
|
|
* notification_orderInfo/notification_charge_order_info
|
|||
|
|
*/
|
|||
|
|
public void notificationOrderInfo() {
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 站点费率变化推送
|
|||
|
|
* notification_stationFee
|
|||
|
|
*/
|
|||
|
|
public void notificationStationFee() {
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|