mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 03:25:12 +08:00
通知第三方平台重构
This commit is contained in:
25
jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/NotificationDTO.java
vendored
Normal file
25
jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/NotificationDTO.java
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
package com.jsowell.thirdparty.common;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class NotificationDTO {
|
||||
/**
|
||||
* 站点id
|
||||
*/
|
||||
private String stationId;
|
||||
|
||||
/**
|
||||
* 平台类型,非必传
|
||||
* 不传表示所有平台
|
||||
*/
|
||||
private String platformType;
|
||||
|
||||
private String pileConnectorCode;
|
||||
|
||||
private String status;
|
||||
|
||||
private String orderCode;
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.jsowell.thirdparty.common;
|
||||
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.pile.vo.ThirdPartySecretInfoVO;
|
||||
import com.jsowell.thirdparty.platform.ThirdPartyPlatformService;
|
||||
import com.jsowell.thirdparty.platform.factory.ThirdPartyPlatformFactory;
|
||||
@@ -29,7 +30,8 @@ public class NotificationService {
|
||||
* 充电站信息变化推送
|
||||
* notification_stationInfo
|
||||
*/
|
||||
public void notificationStationInfo(String stationId) {
|
||||
public void notificationStationInfo(NotificationDTO dto) {
|
||||
String stationId = dto.getStationId();
|
||||
// 通过stationId 查询该站点需要对接的平台配置
|
||||
List<ThirdPartySecretInfoVO> secretInfoVOS = thirdpartySecretInfoService.queryStationToPlatformList(stationId);
|
||||
if (CollectionUtils.isEmpty(secretInfoVOS)) {
|
||||
@@ -37,6 +39,10 @@ public class NotificationService {
|
||||
}
|
||||
// 调用相应平台的处理方法
|
||||
for (ThirdPartySecretInfoVO secretInfoVO : secretInfoVOS) {
|
||||
if (StringUtils.isNotBlank(dto.getPlatformType()) && !StringUtils.equals(dto.getPlatformType(), secretInfoVO.getPlatformType())) {
|
||||
// 如果dto中的platformType不为空,并且不等于secretInfoVO.getPlatformType(),continue
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
ThirdPartyPlatformService platformService = ThirdPartyPlatformFactory.getInvokeStrategy(secretInfoVO.getPlatformType());
|
||||
// platformService.printServiceName();
|
||||
@@ -51,7 +57,10 @@ public class NotificationService {
|
||||
* 设备状态变化推送
|
||||
* notification_stationStatus
|
||||
*/
|
||||
public void notificationStationStatus(String stationId, String pileConnectorCode, String status) {
|
||||
public void notificationStationStatus(NotificationDTO dto) {
|
||||
String stationId = dto.getStationId();
|
||||
String pileConnectorCode = dto.getPileConnectorCode();
|
||||
String status = dto.getStatus();
|
||||
// 通过stationId 查询该站点需要对接的平台配置
|
||||
List<ThirdPartySecretInfoVO> secretInfoVOS = thirdpartySecretInfoService.queryStationToPlatformList(stationId);
|
||||
if (CollectionUtils.isEmpty(secretInfoVOS)) {
|
||||
@@ -59,6 +68,10 @@ public class NotificationService {
|
||||
}
|
||||
// 调用相应平台的处理方法
|
||||
for (ThirdPartySecretInfoVO secretInfoVO : secretInfoVOS) {
|
||||
if (StringUtils.isNotBlank(dto.getPlatformType()) && !StringUtils.equals(dto.getPlatformType(), secretInfoVO.getPlatformType())) {
|
||||
// 如果dto中的platformType不为空,并且不等于secretInfoVO.getPlatformType(),continue
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
// 根据平台类型获取Service
|
||||
ThirdPartyPlatformService platformService = ThirdPartyPlatformFactory.getInvokeStrategy(secretInfoVO.getPlatformType());
|
||||
@@ -74,7 +87,9 @@ public class NotificationService {
|
||||
* notification_connector_charge_status
|
||||
* notification_equip_charge_status
|
||||
*/
|
||||
public void notificationConnectorChargeStatus(String stationId, String orderCode) {
|
||||
public void notificationConnectorChargeStatus(NotificationDTO dto) {
|
||||
String stationId = dto.getStationId();
|
||||
String orderCode = dto.getOrderCode();
|
||||
// 通过stationId 查询该站点需要对接的平台配置
|
||||
List<ThirdPartySecretInfoVO> secretInfoVOS = thirdpartySecretInfoService.queryStationToPlatformList(stationId);
|
||||
if (CollectionUtils.isEmpty(secretInfoVOS)) {
|
||||
@@ -82,6 +97,10 @@ public class NotificationService {
|
||||
}
|
||||
// 调用相应平台的处理方法
|
||||
for (ThirdPartySecretInfoVO secretInfoVO : secretInfoVOS) {
|
||||
if (StringUtils.isNotBlank(dto.getPlatformType()) && !StringUtils.equals(dto.getPlatformType(), secretInfoVO.getPlatformType())) {
|
||||
// 如果dto中的platformType不为空,并且不等于secretInfoVO.getPlatformType(),continue
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
// 根据平台类型获取Service
|
||||
ThirdPartyPlatformService platformService = ThirdPartyPlatformFactory.getInvokeStrategy(secretInfoVO.getPlatformType());
|
||||
@@ -96,7 +115,9 @@ public class NotificationService {
|
||||
* 充电订单信息推送
|
||||
* notification_orderInfo/notification_charge_order_info
|
||||
*/
|
||||
public void notificationChargeOrderInfo(String stationId, String orderCode) {
|
||||
public void notificationChargeOrderInfo(NotificationDTO dto) {
|
||||
String stationId = dto.getStationId();
|
||||
String orderCode = dto.getOrderCode();
|
||||
// 通过stationId 查询该站点需要对接的平台配置
|
||||
List<ThirdPartySecretInfoVO> secretInfoVOS = thirdpartySecretInfoService.queryStationToPlatformList(stationId);
|
||||
if (CollectionUtils.isEmpty(secretInfoVOS)) {
|
||||
@@ -104,6 +125,10 @@ public class NotificationService {
|
||||
}
|
||||
// 调用相应平台的处理方法
|
||||
for (ThirdPartySecretInfoVO secretInfoVO : secretInfoVOS) {
|
||||
if (StringUtils.isNotBlank(dto.getPlatformType()) && !StringUtils.equals(dto.getPlatformType(), secretInfoVO.getPlatformType())) {
|
||||
// 如果dto中的platformType不为空,并且不等于secretInfoVO.getPlatformType(),continue
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
// 根据平台类型获取Service
|
||||
ThirdPartyPlatformService platformService = ThirdPartyPlatformFactory.getInvokeStrategy(secretInfoVO.getPlatformType());
|
||||
@@ -118,7 +143,8 @@ public class NotificationService {
|
||||
* 站点费率变化推送
|
||||
* notification_stationFee
|
||||
*/
|
||||
public void notificationStationFee(String stationId) {
|
||||
public void notificationStationFee(NotificationDTO dto) {
|
||||
String stationId = dto.getStationId();
|
||||
// 通过stationId 查询该站点需要对接的平台配置
|
||||
List<ThirdPartySecretInfoVO> secretInfoVOS = thirdpartySecretInfoService.queryStationToPlatformList(stationId);
|
||||
if (CollectionUtils.isEmpty(secretInfoVOS)) {
|
||||
@@ -126,6 +152,10 @@ public class NotificationService {
|
||||
}
|
||||
// 调用相应平台的处理方法
|
||||
for (ThirdPartySecretInfoVO secretInfoVO : secretInfoVOS) {
|
||||
if (StringUtils.isNotBlank(dto.getPlatformType()) && !StringUtils.equals(dto.getPlatformType(), secretInfoVO.getPlatformType())) {
|
||||
// 如果dto中的platformType不为空,并且不等于secretInfoVO.getPlatformType(),continue
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
// 根据平台类型获取Service
|
||||
ThirdPartyPlatformService platformService = ThirdPartyPlatformFactory.getInvokeStrategy(secretInfoVO.getPlatformType());
|
||||
|
||||
Reference in New Issue
Block a user