mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
update 推送逻辑
This commit is contained in:
@@ -392,6 +392,9 @@ public class CommonService {
|
|||||||
|
|
||||||
// 查询订单信息
|
// 查询订单信息
|
||||||
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode);
|
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode);
|
||||||
|
if (Objects.isNull(orderInfo)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 推送
|
// 推送
|
||||||
for (ThirdPartySecretInfoVO thirdPartySecretInfoVO : thirdPartySecretInfoVOS) {
|
for (ThirdPartySecretInfoVO thirdPartySecretInfoVO : thirdPartySecretInfoVOS) {
|
||||||
@@ -400,9 +403,7 @@ public class CommonService {
|
|||||||
dto.setPileConnectorCode(pileConnectorCode);
|
dto.setPileConnectorCode(pileConnectorCode);
|
||||||
dto.setStatus(changedStatus);
|
dto.setStatus(changedStatus);
|
||||||
dto.setPlatformType(thirdPartySecretInfoVO.getPlatformType());
|
dto.setPlatformType(thirdPartySecretInfoVO.getPlatformType());
|
||||||
if (Objects.nonNull(orderInfo)) {
|
dto.setOrderCode(orderInfo.getOrderCode());
|
||||||
dto.setOrderCode(orderInfo.getOrderCode());
|
|
||||||
}
|
|
||||||
notificationService.notificationConnectorChargeStatus(dto);
|
notificationService.notificationConnectorChargeStatus(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -483,6 +484,23 @@ public class CommonService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void commonPushOrderInfoV2(OrderBasicInfo orderBasicInfo) {
|
||||||
|
String stationId = orderBasicInfo.getStationId();
|
||||||
|
// 查询该站点是否推送第三方平台
|
||||||
|
List<ThirdPartySecretInfoVO> relationInfoList = thirdpartySecretInfoService.queryStationToPlatformList(stationId);
|
||||||
|
// ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(relation);
|
||||||
|
if (CollectionUtils.isEmpty(relationInfoList)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (ThirdPartySecretInfoVO relationVO : relationInfoList) {
|
||||||
|
NotificationDTO dto = new NotificationDTO();
|
||||||
|
dto.setStationId(stationId);
|
||||||
|
dto.setPlatformType(relationVO.getPlatformType());
|
||||||
|
dto.setOrderCode(orderBasicInfo.getOrderCode());
|
||||||
|
notificationService.notificationChargeOrderInfo(dto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 统一推送启动充电结果
|
* 统一推送启动充电结果
|
||||||
|
|||||||
@@ -33,10 +33,12 @@ public class NotificationService {
|
|||||||
* notification_stationInfo
|
* notification_stationInfo
|
||||||
*/
|
*/
|
||||||
public void notificationStationInfo(NotificationDTO dto) {
|
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);
|
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
||||||
}
|
}
|
||||||
String stationId = dto.getStationId();
|
|
||||||
// 通过stationId 查询该站点需要对接的平台配置
|
// 通过stationId 查询该站点需要对接的平台配置
|
||||||
List<ThirdPartySecretInfoVO> secretInfoVOS = thirdpartySecretInfoService.queryStationToPlatformList(stationId);
|
List<ThirdPartySecretInfoVO> secretInfoVOS = thirdpartySecretInfoService.queryStationToPlatformList(stationId);
|
||||||
if (CollectionUtils.isEmpty(secretInfoVOS)) {
|
if (CollectionUtils.isEmpty(secretInfoVOS)) {
|
||||||
@@ -44,13 +46,12 @@ public class NotificationService {
|
|||||||
}
|
}
|
||||||
// 调用相应平台的处理方法
|
// 调用相应平台的处理方法
|
||||||
for (ThirdPartySecretInfoVO secretInfoVO : secretInfoVOS) {
|
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
|
// 如果dto中的platformType不为空,并且不等于secretInfoVO.getPlatformType(),continue
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
ThirdPartyPlatformService platformService = ThirdPartyPlatformFactory.getInvokeStrategy(secretInfoVO.getPlatformType());
|
ThirdPartyPlatformService platformService = ThirdPartyPlatformFactory.getInvokeStrategy(secretInfoVO.getPlatformType());
|
||||||
// platformService.printServiceName();
|
|
||||||
platformService.notificationStationInfo(stationId);
|
platformService.notificationStationInfo(stationId);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("充电站信息变化推送error", e);
|
logger.error("充电站信息变化推送error", e);
|
||||||
@@ -63,12 +64,14 @@ public class NotificationService {
|
|||||||
* notification_stationStatus
|
* notification_stationStatus
|
||||||
*/
|
*/
|
||||||
public void notificationStationStatus(NotificationDTO dto) {
|
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 stationId = dto.getStationId();
|
||||||
String pileConnectorCode = dto.getPileConnectorCode();
|
String pileConnectorCode = dto.getPileConnectorCode();
|
||||||
String status = dto.getStatus();
|
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 查询该站点需要对接的平台配置
|
// 通过stationId 查询该站点需要对接的平台配置
|
||||||
List<ThirdPartySecretInfoVO> secretInfoVOS = thirdpartySecretInfoService.queryStationToPlatformList(stationId);
|
List<ThirdPartySecretInfoVO> secretInfoVOS = thirdpartySecretInfoService.queryStationToPlatformList(stationId);
|
||||||
if (CollectionUtils.isEmpty(secretInfoVOS)) {
|
if (CollectionUtils.isEmpty(secretInfoVOS)) {
|
||||||
@@ -76,7 +79,7 @@ public class NotificationService {
|
|||||||
}
|
}
|
||||||
// 调用相应平台的处理方法
|
// 调用相应平台的处理方法
|
||||||
for (ThirdPartySecretInfoVO secretInfoVO : secretInfoVOS) {
|
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
|
// 如果dto中的platformType不为空,并且不等于secretInfoVO.getPlatformType(),continue
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -96,11 +99,12 @@ public class NotificationService {
|
|||||||
* notification_equip_charge_status
|
* notification_equip_charge_status
|
||||||
*/
|
*/
|
||||||
public void notificationConnectorChargeStatus(NotificationDTO dto) {
|
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 stationId = dto.getStationId();
|
||||||
String orderCode = dto.getOrderCode();
|
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 查询该站点需要对接的平台配置
|
// 通过stationId 查询该站点需要对接的平台配置
|
||||||
List<ThirdPartySecretInfoVO> secretInfoVOS = thirdpartySecretInfoService.queryStationToPlatformList(stationId);
|
List<ThirdPartySecretInfoVO> secretInfoVOS = thirdpartySecretInfoService.queryStationToPlatformList(stationId);
|
||||||
if (CollectionUtils.isEmpty(secretInfoVOS)) {
|
if (CollectionUtils.isEmpty(secretInfoVOS)) {
|
||||||
@@ -108,7 +112,7 @@ public class NotificationService {
|
|||||||
}
|
}
|
||||||
// 调用相应平台的处理方法
|
// 调用相应平台的处理方法
|
||||||
for (ThirdPartySecretInfoVO secretInfoVO : secretInfoVOS) {
|
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
|
// 如果dto中的platformType不为空,并且不等于secretInfoVO.getPlatformType(),continue
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -127,11 +131,12 @@ public class NotificationService {
|
|||||||
* notification_orderInfo/notification_charge_order_info
|
* notification_orderInfo/notification_charge_order_info
|
||||||
*/
|
*/
|
||||||
public void notificationChargeOrderInfo(NotificationDTO dto) {
|
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 stationId = dto.getStationId();
|
||||||
String orderCode = dto.getOrderCode();
|
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 查询该站点需要对接的平台配置
|
// 通过stationId 查询该站点需要对接的平台配置
|
||||||
List<ThirdPartySecretInfoVO> secretInfoVOS = thirdpartySecretInfoService.queryStationToPlatformList(stationId);
|
List<ThirdPartySecretInfoVO> secretInfoVOS = thirdpartySecretInfoService.queryStationToPlatformList(stationId);
|
||||||
if (CollectionUtils.isEmpty(secretInfoVOS)) {
|
if (CollectionUtils.isEmpty(secretInfoVOS)) {
|
||||||
@@ -139,7 +144,7 @@ public class NotificationService {
|
|||||||
}
|
}
|
||||||
// 调用相应平台的处理方法
|
// 调用相应平台的处理方法
|
||||||
for (ThirdPartySecretInfoVO secretInfoVO : secretInfoVOS) {
|
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
|
// 如果dto中的platformType不为空,并且不等于secretInfoVO.getPlatformType(),continue
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -148,7 +153,7 @@ public class NotificationService {
|
|||||||
ThirdPartyPlatformService platformService = ThirdPartyPlatformFactory.getInvokeStrategy(secretInfoVO.getPlatformType());
|
ThirdPartyPlatformService platformService = ThirdPartyPlatformFactory.getInvokeStrategy(secretInfoVO.getPlatformType());
|
||||||
platformService.notificationChargeOrderInfo(orderCode, secretInfoVO);
|
platformService.notificationChargeOrderInfo(orderCode, secretInfoVO);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("设备充电中状态变化推送error", e);
|
logger.error("充电订单信息推送error", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -158,10 +163,12 @@ public class NotificationService {
|
|||||||
* notification_stationFee
|
* notification_stationFee
|
||||||
*/
|
*/
|
||||||
public void notificationStationFee(NotificationDTO dto) {
|
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);
|
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
||||||
}
|
}
|
||||||
String stationId = dto.getStationId();
|
|
||||||
// 通过stationId 查询该站点需要对接的平台配置
|
// 通过stationId 查询该站点需要对接的平台配置
|
||||||
List<ThirdPartySecretInfoVO> secretInfoVOS = thirdpartySecretInfoService.queryStationToPlatformList(stationId);
|
List<ThirdPartySecretInfoVO> secretInfoVOS = thirdpartySecretInfoService.queryStationToPlatformList(stationId);
|
||||||
if (CollectionUtils.isEmpty(secretInfoVOS)) {
|
if (CollectionUtils.isEmpty(secretInfoVOS)) {
|
||||||
@@ -169,7 +176,7 @@ public class NotificationService {
|
|||||||
}
|
}
|
||||||
// 调用相应平台的处理方法
|
// 调用相应平台的处理方法
|
||||||
for (ThirdPartySecretInfoVO secretInfoVO : secretInfoVOS) {
|
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
|
// 如果dto中的platformType不为空,并且不等于secretInfoVO.getPlatformType(),continue
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -178,7 +185,7 @@ public class NotificationService {
|
|||||||
ThirdPartyPlatformService platformService = ThirdPartyPlatformFactory.getInvokeStrategy(secretInfoVO.getPlatformType());
|
ThirdPartyPlatformService platformService = ThirdPartyPlatformFactory.getInvokeStrategy(secretInfoVO.getPlatformType());
|
||||||
platformService.notificationStationFee(stationId, secretInfoVO);
|
platformService.notificationStationFee(stationId, secretInfoVO);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("设备充电中状态变化推送error", e);
|
logger.error("站点费率变化推送error", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user