苏州市平台新增 推送告警信息接口

This commit is contained in:
Lemon
2024-09-26 17:02:56 +08:00
parent 05d0b319bc
commit e42bd1ebd0
6 changed files with 280 additions and 0 deletions

View File

@@ -25,6 +25,7 @@ import com.jsowell.pile.dto.PushStationInfoDTO;
import com.jsowell.pile.dto.ThirdPartyCommonStartChargeDTO;
import com.jsowell.pile.dto.ThirdPartyCommonStopChargeDTO;
import com.jsowell.pile.dto.lutongyunting.BindCouponDTO;
import com.jsowell.pile.dto.nanrui.PushAlarmInfoDTO;
import com.jsowell.pile.dto.ruanjie.UseCouponDTO;
import com.jsowell.pile.service.*;
import com.jsowell.pile.vo.ThirdPartySecretInfoVO;
@@ -40,6 +41,7 @@ import com.jsowell.thirdparty.platform.service.impl.HaiNanPlatformServiceImpl;
import com.jsowell.thirdparty.platform.service.impl.NingXiaPlatformServiceImpl;
import com.jsowell.thirdparty.platform.service.impl.QingHaiPlatformServiceImpl;
import com.jsowell.thirdparty.platform.util.HttpRequestUtil;
import com.jsowell.thirdparty.platform.util.ThirdPartyPlatformUtils;
import com.jsowell.thirdparty.ruanjie.service.RJService;
import com.jsowell.thirdparty.service.ThirdpartySecretInfoService;
import com.jsowell.thirdparty.xindiantu.service.XDTService;
@@ -525,6 +527,31 @@ public class CommonService {
}
}
/**
* 统一推送告警信息
* @param pileConnectorCode
* @param connectorStatus
*/
public void commonPushAlarmInfo(String pileConnectorCode, String connectorStatus) {
// 查询站点信息
PileStationVO stationVO = pileStationInfoService.getStationInfoByPileConnectorCode(pileConnectorCode);
String stationId = stationVO.getId();
// 查询该站点是否推送第三方平台
List<ThirdPartySecretInfoVO> relationInfoList = thirdpartySecretInfoService.queryStationToPlatformList(stationId);
if (CollectionUtils.isEmpty(relationInfoList)) {
return;
}
for (ThirdPartySecretInfoVO relationVO : relationInfoList) {
NotificationDTO notificationDTO = new NotificationDTO();
notificationDTO.setStatus(connectorStatus);
notificationDTO.setPileConnectorCode(pileConnectorCode);
notificationDTO.setStationId(stationId);
notificationDTO.setPlatformType(relationVO.getPlatformType());
notificationService.notificationAlarmInfo(notificationDTO);
}
}
/**
* 统一推送启动充电结果

View File

@@ -4,6 +4,7 @@ import com.google.common.collect.Lists;
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.dto.nanrui.PushAlarmInfoDTO;
import com.jsowell.pile.vo.ThirdPartySecretInfoVO;
import com.jsowell.thirdparty.platform.service.ThirdPartyPlatformService;
import com.jsowell.thirdparty.platform.factory.ThirdPartyPlatformFactory;
@@ -259,4 +260,41 @@ public class NotificationService {
}
}
}
/**
* 充电设备告警信息推送
* @param dto
*/
public void notificationAlarmInfo(NotificationDTO dto) {
String stationId = dto.getStationId();
String pileConnectorCode = dto.getPileConnectorCode();
String status = dto.getStatus();
String platformType = dto.getPlatformType();
if (StringUtils.isBlank(status) || StringUtils.isBlank(pileConnectorCode)) {
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
}
// 通过stationId 查询该站点需要对接的平台配置
List<ThirdPartySecretInfoVO> secretInfoVOS = thirdpartySecretInfoService.queryStationToPlatformList(stationId);
if (CollectionUtils.isEmpty(secretInfoVOS)) {
return;
}
// 调用相应平台的处理方法
for (ThirdPartySecretInfoVO secretInfoVO : secretInfoVOS) {
if (StringUtils.isNotBlank(platformType) && !StringUtils.equals(platformType, secretInfoVO.getPlatformType())) {
// 如果dto中的platformType不为空并且不等于secretInfoVO.getPlatformType()continue
continue;
}
try {
// 根据平台类型获取Service
ThirdPartyPlatformService platformService = ThirdPartyPlatformFactory.getInvokeStrategy(secretInfoVO.getPlatformType());
PushAlarmInfoDTO pushAlarmInfoDTO = new PushAlarmInfoDTO();
pushAlarmInfoDTO.setPileConnectorCode(pileConnectorCode);
pushAlarmInfoDTO.setConnectorStatus(status);
platformService.notificationAlarmInfo(pushAlarmInfoDTO);
} catch (Exception e) {
logger.error("充电设备告警信息推送error", e);
}
}
}
}