diff --git a/jsowell-admin/src/test/java/SpringBootTestController.java b/jsowell-admin/src/test/java/SpringBootTestController.java index 94941d3a3..c871e2a65 100644 --- a/jsowell-admin/src/test/java/SpringBootTestController.java +++ b/jsowell-admin/src/test/java/SpringBootTestController.java @@ -71,6 +71,7 @@ import com.jsowell.service.OrderService; import com.jsowell.service.PileService; import com.jsowell.service.TempService; import com.jsowell.thirdparty.amap.service.AMapService; +import com.jsowell.thirdparty.common.NotificationDTO; import com.jsowell.thirdparty.common.NotificationService; import com.jsowell.thirdparty.huawei.HuaWeiService; import com.jsowell.thirdparty.lianlian.service.LianLianService; @@ -254,7 +255,10 @@ public class SpringBootTestController { @Test public void notificationStationInfoTest() { String stationId = "19"; - notificationService.notificationStationInfo(stationId); + NotificationDTO dto = new NotificationDTO(); + dto.setStationId(stationId); + dto.setPlatformType("1"); + notificationService.notificationStationInfo(dto); } @Test diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/NotificationDTO.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/NotificationDTO.java new file mode 100644 index 000000000..2bea9aa3b --- /dev/null +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/NotificationDTO.java @@ -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; +} diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/NotificationService.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/NotificationService.java index 8dcd40ea1..41b03929e 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/NotificationService.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/NotificationService.java @@ -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 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 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 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 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 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());