update 推送逻辑

This commit is contained in:
Guoqs
2024-05-10 17:15:47 +08:00
parent 6cecaf50e2
commit 63a65b4e72
2 changed files with 49 additions and 24 deletions

View File

@@ -33,10 +33,12 @@ public class NotificationService {
* notification_stationInfo
*/
public void notificationStationInfo(NotificationDTO dto) {
if (StringUtils.isBlank(dto.getStationId())) {
String stationId = dto.getStationId();
String platformType = dto.getPlatformType();
if (StringUtils.isBlank(stationId)) {
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
}
String stationId = dto.getStationId();
// 通过stationId 查询该站点需要对接的平台配置
List<ThirdPartySecretInfoVO> secretInfoVOS = thirdpartySecretInfoService.queryStationToPlatformList(stationId);
if (CollectionUtils.isEmpty(secretInfoVOS)) {
@@ -44,13 +46,12 @@ public class NotificationService {
}
// 调用相应平台的处理方法
for (ThirdPartySecretInfoVO secretInfoVO : secretInfoVOS) {
if (StringUtils.isNotBlank(dto.getPlatformType()) && !StringUtils.equals(dto.getPlatformType(), secretInfoVO.getPlatformType())) {
if (StringUtils.isNotBlank(platformType) && !StringUtils.equals(platformType, secretInfoVO.getPlatformType())) {
// 如果dto中的platformType不为空并且不等于secretInfoVO.getPlatformType()continue
continue;
}
try {
ThirdPartyPlatformService platformService = ThirdPartyPlatformFactory.getInvokeStrategy(secretInfoVO.getPlatformType());
// platformService.printServiceName();
platformService.notificationStationInfo(stationId);
} catch (Exception e) {
logger.error("充电站信息变化推送error", e);
@@ -63,12 +64,14 @@ public class NotificationService {
* notification_stationStatus
*/
public void notificationStationStatus(NotificationDTO dto) {
if (StringUtils.isBlank(dto.getStationId()) || StringUtils.isBlank(dto.getPileConnectorCode()) || StringUtils.isBlank(dto.getStatus())) {
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
}
String stationId = dto.getStationId();
String pileConnectorCode = dto.getPileConnectorCode();
String status = dto.getStatus();
String platformType = dto.getPlatformType();
if (StringUtils.isBlank(stationId) || StringUtils.isBlank(pileConnectorCode) || StringUtils.isBlank(status)) {
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
}
// 通过stationId 查询该站点需要对接的平台配置
List<ThirdPartySecretInfoVO> secretInfoVOS = thirdpartySecretInfoService.queryStationToPlatformList(stationId);
if (CollectionUtils.isEmpty(secretInfoVOS)) {
@@ -76,7 +79,7 @@ public class NotificationService {
}
// 调用相应平台的处理方法
for (ThirdPartySecretInfoVO secretInfoVO : secretInfoVOS) {
if (StringUtils.isNotBlank(dto.getPlatformType()) && !StringUtils.equals(dto.getPlatformType(), secretInfoVO.getPlatformType())) {
if (StringUtils.isNotBlank(platformType) && !StringUtils.equals(platformType, secretInfoVO.getPlatformType())) {
// 如果dto中的platformType不为空并且不等于secretInfoVO.getPlatformType()continue
continue;
}
@@ -96,11 +99,12 @@ public class NotificationService {
* notification_equip_charge_status
*/
public void notificationConnectorChargeStatus(NotificationDTO dto) {
if (StringUtils.isBlank(dto.getStationId()) || StringUtils.isBlank(dto.getOrderCode())) {
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
}
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)) {
@@ -108,7 +112,7 @@ public class NotificationService {
}
// 调用相应平台的处理方法
for (ThirdPartySecretInfoVO secretInfoVO : secretInfoVOS) {
if (StringUtils.isNotBlank(dto.getPlatformType()) && !StringUtils.equals(dto.getPlatformType(), secretInfoVO.getPlatformType())) {
if (StringUtils.isNotBlank(platformType) && !StringUtils.equals(platformType, secretInfoVO.getPlatformType())) {
// 如果dto中的platformType不为空并且不等于secretInfoVO.getPlatformType()continue
continue;
}
@@ -127,11 +131,12 @@ public class NotificationService {
* notification_orderInfo/notification_charge_order_info
*/
public void notificationChargeOrderInfo(NotificationDTO dto) {
if (StringUtils.isBlank(dto.getStationId()) || StringUtils.isBlank(dto.getOrderCode())) {
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
}
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)) {
@@ -139,7 +144,7 @@ public class NotificationService {
}
// 调用相应平台的处理方法
for (ThirdPartySecretInfoVO secretInfoVO : secretInfoVOS) {
if (StringUtils.isNotBlank(dto.getPlatformType()) && !StringUtils.equals(dto.getPlatformType(), secretInfoVO.getPlatformType())) {
if (StringUtils.isNotBlank(platformType) && !StringUtils.equals(platformType, secretInfoVO.getPlatformType())) {
// 如果dto中的platformType不为空并且不等于secretInfoVO.getPlatformType()continue
continue;
}
@@ -148,7 +153,7 @@ public class NotificationService {
ThirdPartyPlatformService platformService = ThirdPartyPlatformFactory.getInvokeStrategy(secretInfoVO.getPlatformType());
platformService.notificationChargeOrderInfo(orderCode, secretInfoVO);
} catch (Exception e) {
logger.error("设备充电中状态变化推送error", e);
logger.error("充电订单信息推送error", e);
}
}
}
@@ -158,10 +163,12 @@ public class NotificationService {
* notification_stationFee
*/
public void notificationStationFee(NotificationDTO dto) {
if (StringUtils.isBlank(dto.getStationId())) {
String stationId = dto.getStationId();
String platformType = dto.getPlatformType();
if (StringUtils.isBlank(stationId)) {
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
}
String stationId = dto.getStationId();
// 通过stationId 查询该站点需要对接的平台配置
List<ThirdPartySecretInfoVO> secretInfoVOS = thirdpartySecretInfoService.queryStationToPlatformList(stationId);
if (CollectionUtils.isEmpty(secretInfoVOS)) {
@@ -169,7 +176,7 @@ public class NotificationService {
}
// 调用相应平台的处理方法
for (ThirdPartySecretInfoVO secretInfoVO : secretInfoVOS) {
if (StringUtils.isNotBlank(dto.getPlatformType()) && !StringUtils.equals(dto.getPlatformType(), secretInfoVO.getPlatformType())) {
if (StringUtils.isNotBlank(platformType) && !StringUtils.equals(platformType, secretInfoVO.getPlatformType())) {
// 如果dto中的platformType不为空并且不等于secretInfoVO.getPlatformType()continue
continue;
}
@@ -178,7 +185,7 @@ public class NotificationService {
ThirdPartyPlatformService platformService = ThirdPartyPlatformFactory.getInvokeStrategy(secretInfoVO.getPlatformType());
platformService.notificationStationFee(stationId, secretInfoVO);
} catch (Exception e) {
logger.error("设备充电中状态变化推送error", e);
logger.error("站点费率变化推送error", e);
}
}
}