mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-23 04:25:21 +08:00
新增(运维平台)中建国际低碳科技有限公司第三方接口
This commit is contained in:
@@ -1,32 +1,27 @@
|
||||
package com.jsowell.thirdparty.common;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
|
||||
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.service.thirdparty.ThirdPartyPlatformApi;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.common.util.spring.SpringUtils;
|
||||
import com.jsowell.pile.dto.nanrui.PushAlarmInfoDTO;
|
||||
import com.jsowell.pile.vo.ThirdPartySecretInfoVO;
|
||||
import com.jsowell.thirdparty.dubbo.factory.DynamicThirdPartyPlatformFactory;
|
||||
import com.jsowell.thirdparty.platform.service.ThirdPartyPlatformService;
|
||||
import com.jsowell.thirdparty.platform.factory.ThirdPartyPlatformFactory;
|
||||
import com.jsowell.thirdparty.service.ThirdpartySecretInfoService;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
/**
|
||||
* 主动通知Service - 异步改造版
|
||||
* 主动通知Service
|
||||
* 说明:创建此接口目的是为了简化开发
|
||||
* 在需要通知第三方平台的地方,异步调用此类中对应的方法
|
||||
* 通知方法中应该根据对接平台,自动找到响应的平台处理逻辑
|
||||
*/
|
||||
@Service
|
||||
public class NotificationService {
|
||||
@@ -35,43 +30,9 @@ public class NotificationService {
|
||||
@Autowired
|
||||
private ThirdpartySecretInfoService thirdpartySecretInfoService;
|
||||
|
||||
// 引入线程池
|
||||
private ThreadPoolTaskExecutor executor = SpringUtils.getBean("threadPoolTaskExecutor");
|
||||
|
||||
|
||||
// 判断是否使用old还是new平台
|
||||
private boolean isRemotePlatform(String platformType) {
|
||||
for (ThirdPlatformTypeEnum item : ThirdPlatformTypeEnum.values()) {
|
||||
if (StringUtils.equals(item.getTypeCode(), platformType)) {
|
||||
return true; // true: 使用old平台
|
||||
}
|
||||
}
|
||||
return false; // false: 使用new平台
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据平台类型获取对应的服务实例
|
||||
*/
|
||||
private Object getPlatformService(String platformType) {
|
||||
if (isRemotePlatform(platformType)) {
|
||||
return ThirdPartyPlatformFactory.getInvokeStrategy(platformType);
|
||||
} else {
|
||||
return DynamicThirdPartyPlatformFactory.getPlatformService(platformType);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* VO对象转换
|
||||
*/
|
||||
private com.jsowell.common.service.thirdparty.vo.ThirdPartySecretInfoVO getConversion(ThirdPartySecretInfoVO secretInfoVO) {
|
||||
com.jsowell.common.service.thirdparty.vo.ThirdPartySecretInfoVO conversion =
|
||||
new com.jsowell.common.service.thirdparty.vo.ThirdPartySecretInfoVO();
|
||||
BeanUtils.copyProperties(secretInfoVO, conversion);
|
||||
return conversion;
|
||||
}
|
||||
|
||||
/**
|
||||
* 充电站信息变化推送
|
||||
* notification_stationInfo
|
||||
*/
|
||||
public String notificationStationInfo(NotificationDTO dto) {
|
||||
String stationId = dto.getStationId();
|
||||
@@ -80,58 +41,33 @@ public class NotificationService {
|
||||
if (StringUtils.isBlank(stationId)) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
||||
}
|
||||
|
||||
// 通过stationId 查询该站点需要对接的平台配置
|
||||
List<ThirdPartySecretInfoVO> secretInfoVOS = thirdpartySecretInfoService.queryStationToPlatformList(stationId);
|
||||
if (CollectionUtils.isEmpty(secretInfoVOS)) {
|
||||
return "该站点未绑定任何平台";
|
||||
return null;
|
||||
}
|
||||
|
||||
// 调用相应平台的处理方法
|
||||
StringBuilder result = new StringBuilder();
|
||||
List<CompletableFuture<Void>> futures = new ArrayList<>();
|
||||
|
||||
for (ThirdPartySecretInfoVO secretInfoVO : secretInfoVOS) {
|
||||
String currentPlatformType = secretInfoVO.getPlatformType();
|
||||
if (StringUtils.isNotBlank(platformType) && !platformType.equals(currentPlatformType)) {
|
||||
if (StringUtils.isNotBlank(platformType) && !StringUtils.equals(platformType, secretInfoVO.getPlatformType())) {
|
||||
// 如果dto中的platformType不为空,并且不等于secretInfoVO.getPlatformType(),continue
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
Object service = getPlatformService(currentPlatformType);
|
||||
|
||||
if (service instanceof ThirdPartyPlatformService) {
|
||||
String pushResult = ((ThirdPartyPlatformService) service).notificationStationInfo(stationId);
|
||||
result.append("old平台[").append(secretInfoVO.getPlatformName())
|
||||
.append("]推送结果:").append(pushResult).append("\n");
|
||||
} else if (service instanceof ThirdPartyPlatformApi) {
|
||||
// 后续新平台异步处理
|
||||
ThirdPartyPlatformApi apiService = (ThirdPartyPlatformApi) service;
|
||||
CompletableFuture<Void> future = CompletableFuture.supplyAsync(() -> {
|
||||
try {
|
||||
return apiService.notificationStationInfo(stationId);
|
||||
} catch (Exception e) {
|
||||
return "推送失败:" + e.getMessage();
|
||||
}
|
||||
}, executor).thenAccept(pushResult -> {
|
||||
synchronized (result) {
|
||||
result.append("new平台[").append(secretInfoVO.getPlatformName())
|
||||
.append("]推送结果:").append(pushResult).append("\n");
|
||||
}
|
||||
});
|
||||
futures.add(future);
|
||||
}
|
||||
ThirdPartyPlatformService platformService = ThirdPartyPlatformFactory.getInvokeStrategy(secretInfoVO.getPlatformType());
|
||||
String postResult = platformService.notificationStationInfo(stationId);
|
||||
result.append(postResult).append("\n");
|
||||
} catch (Exception e) {
|
||||
result.append("平台[").append(secretInfoVO.getPlatformName())
|
||||
.append("]处理异常:").append(e.getMessage()).append("\n");
|
||||
logger.error("平台类型:{}, 平台名称:{}, 站点id:{}, 充电站信息变化推送error:{}",
|
||||
secretInfoVO.getPlatformType(), secretInfoVO.getPlatformName(), stationId, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// 等待所有异步任务完成
|
||||
CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join();
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备状态变化推送
|
||||
* notification_stationStatus
|
||||
*/
|
||||
public void notificationStationStatus(NotificationDTO dto) {
|
||||
String stationId = dto.getStationId();
|
||||
@@ -142,35 +78,21 @@ public class NotificationService {
|
||||
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)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 调用相应平台的处理方法
|
||||
for (ThirdPartySecretInfoVO secretInfoVO : secretInfoVOS) {
|
||||
if (StringUtils.isNotBlank(platformType) && !StringUtils.equals(platformType, secretInfoVO.getPlatformType())) {
|
||||
// 如果dto中的platformType不为空,并且不等于secretInfoVO.getPlatformType(),continue
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
Object service = getPlatformService(secretInfoVO.getPlatformType());
|
||||
com.jsowell.common.service.thirdparty.vo.ThirdPartySecretInfoVO conversionVO = getConversion(secretInfoVO);
|
||||
|
||||
if (service instanceof ThirdPartyPlatformService) {
|
||||
((ThirdPartyPlatformService) service).notificationStationStatus(
|
||||
stationId, pileConnectorCode, status, secretInfoVO);
|
||||
} else if (service instanceof ThirdPartyPlatformApi) {
|
||||
// 后续新平台异步处理
|
||||
ThirdPartyPlatformApi apiService = (ThirdPartyPlatformApi) service;
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
apiService.notificationStationStatus(stationId, pileConnectorCode, status, conversionVO);
|
||||
} catch (Exception e) {
|
||||
logger.error("new平台[{}]设备状态推送失败", secretInfoVO.getPlatformName(), e);
|
||||
}
|
||||
}, executor);
|
||||
}
|
||||
// 根据平台类型获取Service
|
||||
ThirdPartyPlatformService platformService = ThirdPartyPlatformFactory.getInvokeStrategy(secretInfoVO.getPlatformType());
|
||||
platformService.notificationStationStatus(stationId, pileConnectorCode, status, secretInfoVO);
|
||||
} catch (Exception e) {
|
||||
logger.error("平台类型:{}, 平台名称:{}, 站点id:{}, 枪口编号:{}, 设备状态变化推送error:{}",
|
||||
secretInfoVO.getPlatformType(), secretInfoVO.getPlatformName(), stationId, pileConnectorCode, e.getMessage());
|
||||
@@ -180,178 +102,153 @@ public class NotificationService {
|
||||
|
||||
/**
|
||||
* 设备充电中状态变化推送
|
||||
* notification_connector_charge_status
|
||||
* notification_equip_charge_status
|
||||
*/
|
||||
public void notificationConnectorChargeStatus(NotificationDTO dto) {
|
||||
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)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 调用相应平台的处理方法
|
||||
for (ThirdPartySecretInfoVO secretInfoVO : secretInfoVOS) {
|
||||
if (StringUtils.isNotBlank(platformType) && !StringUtils.equals(platformType, secretInfoVO.getPlatformType())) {
|
||||
// 如果dto中的platformType不为空,并且不等于secretInfoVO.getPlatformType(),continue
|
||||
continue;
|
||||
}
|
||||
|
||||
// 根据平台类型获取Service
|
||||
ThirdPartyPlatformService platformService = ThirdPartyPlatformFactory.getInvokeStrategy(secretInfoVO.getPlatformType());
|
||||
try {
|
||||
Object service = getPlatformService(secretInfoVO.getPlatformType());
|
||||
com.jsowell.common.service.thirdparty.vo.ThirdPartySecretInfoVO conversionVO = getConversion(secretInfoVO);
|
||||
|
||||
if (service instanceof ThirdPartyPlatformService) {
|
||||
((ThirdPartyPlatformService) service).notificationConnectorChargeStatus(orderCode, secretInfoVO);
|
||||
((ThirdPartyPlatformService) service).notificationEquipChargeStatus(orderCode);
|
||||
} else if (service instanceof ThirdPartyPlatformApi) {
|
||||
// 后续新平台异步处理
|
||||
ThirdPartyPlatformApi apiService = (ThirdPartyPlatformApi) service;
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
apiService.notificationConnectorChargeStatus(orderCode, conversionVO);
|
||||
} catch (Exception e) {
|
||||
logger.error("new平台[{}]充电中状态推送失败", secretInfoVO.getPlatformName(), e);
|
||||
}
|
||||
}, executor);
|
||||
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
apiService.notificationEquipChargeStatus(orderCode);
|
||||
} catch (Exception e) {
|
||||
logger.error("new平台[{}]设备充电状态推送失败", secretInfoVO.getPlatformName(), e);
|
||||
}
|
||||
}, executor);
|
||||
}
|
||||
platformService.notificationConnectorChargeStatus(orderCode, secretInfoVO);
|
||||
} catch (Exception e) {
|
||||
logger.error("平台类型:{}, 平台名称:{}, 站点id:{}, 订单编号:{}, 设备充电中状态变化推送error:{}",
|
||||
secretInfoVO.getPlatformType(), secretInfoVO.getPlatformName(), stationId, orderCode, e.getMessage());
|
||||
}
|
||||
finally {
|
||||
try {
|
||||
platformService.notificationEquipChargeStatus(orderCode);
|
||||
}catch (Exception e){
|
||||
logger.error("notification_equip_charge_status error", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 充电订单信息推送
|
||||
* notification_orderInfo/notification_charge_order_info
|
||||
*/
|
||||
public void notificationChargeOrderInfo(NotificationDTO dto) {
|
||||
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)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 调用相应平台的处理方法
|
||||
for (ThirdPartySecretInfoVO secretInfoVO : secretInfoVOS) {
|
||||
if (StringUtils.isNotBlank(platformType) && !StringUtils.equals(platformType, secretInfoVO.getPlatformType())) {
|
||||
// 如果dto中的platformType不为空,并且不等于secretInfoVO.getPlatformType(),continue
|
||||
continue;
|
||||
}
|
||||
|
||||
Object service = null;
|
||||
// 根据平台类型获取Service
|
||||
ThirdPartyPlatformService platformService =null;
|
||||
try {
|
||||
service = getPlatformService(secretInfoVO.getPlatformType());
|
||||
} catch (Exception e) {
|
||||
// 根据平台类型获取Service
|
||||
platformService = ThirdPartyPlatformFactory.getInvokeStrategy(secretInfoVO.getPlatformType());
|
||||
}catch (Exception e){
|
||||
logger.error("获取平台服务失败", e);
|
||||
continue;
|
||||
}
|
||||
|
||||
com.jsowell.common.service.thirdparty.vo.ThirdPartySecretInfoVO conversionVO = getConversion(secretInfoVO);
|
||||
|
||||
//充电订单信息推送
|
||||
try {
|
||||
if (service instanceof ThirdPartyPlatformService) {
|
||||
((ThirdPartyPlatformService) service).notificationChargeOrderInfo(orderCode, secretInfoVO);
|
||||
((ThirdPartyPlatformService) service).notificationChargeOrderInfo(orderCode);
|
||||
((ThirdPartyPlatformService) service).notificationStopChargeResult(orderCode);
|
||||
((ThirdPartyPlatformService) service).notificationPayOrderInfo(orderCode);
|
||||
} else if (service instanceof ThirdPartyPlatformApi) {
|
||||
// 后续新平台异步处理
|
||||
ThirdPartyPlatformApi apiService = (ThirdPartyPlatformApi) service;
|
||||
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
apiService.notificationChargeOrderInfo(orderCode, conversionVO);
|
||||
} catch (Exception e) {
|
||||
logger.error("new平台[{}]充电订单信息推送失败", secretInfoVO.getPlatformName(), e);
|
||||
}
|
||||
}, executor);
|
||||
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
apiService.notificationChargeOrderInfo(orderCode);
|
||||
} catch (Exception e) {
|
||||
logger.error("new平台[{}]订单信息推送失败", secretInfoVO.getPlatformName(), e);
|
||||
}
|
||||
}, executor);
|
||||
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
apiService.notificationStopChargeResult(orderCode);
|
||||
} catch (Exception e) {
|
||||
logger.error("new平台[{}]停止充电结果推送失败", secretInfoVO.getPlatformName(), e);
|
||||
}
|
||||
}, executor);
|
||||
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
apiService.notificationPayOrderInfo(orderCode);
|
||||
} catch (Exception e) {
|
||||
logger.error("new平台[{}]充电账单推送失败", secretInfoVO.getPlatformName(), e);
|
||||
}
|
||||
}, executor);
|
||||
if(platformService != null){
|
||||
platformService.notificationChargeOrderInfo(orderCode, secretInfoVO);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("充电订单信息推送异常", e);
|
||||
logger.error("充电订单信息推送error", e);
|
||||
}
|
||||
//订单信息推送
|
||||
try {
|
||||
if (platformService != null) {
|
||||
platformService.notificationChargeOrderInfo(orderCode);
|
||||
}
|
||||
}catch (Exception e){
|
||||
logger.error("订单信息推送error", e);
|
||||
}
|
||||
//停止充电结果推送
|
||||
try {
|
||||
if (platformService != null) {
|
||||
platformService.notificationStopChargeResult(orderCode);
|
||||
}
|
||||
}catch (Exception e){
|
||||
logger.error("停止充电结果推送error", e);
|
||||
}
|
||||
//推送充换电站用能统计信息
|
||||
/* try {
|
||||
if (platformService != null) {
|
||||
platformService.notificationOperationStatsInfo(stationId);
|
||||
}
|
||||
}catch (Exception e){
|
||||
logger.error("推送充换电站用能统计信息error", e);
|
||||
}*/
|
||||
//推送充电账单信息
|
||||
try {
|
||||
if (platformService != null) {
|
||||
platformService.notificationPayOrderInfo(orderCode);
|
||||
}
|
||||
}catch (Exception e){
|
||||
logger.error("推送充电账单信息error", e);
|
||||
}
|
||||
//推送充电历史订单信息
|
||||
/* try {
|
||||
// 根据平台类型获取Service
|
||||
if (platformService != null) {
|
||||
platformService.notificationChargeOrderInfoHistory(orderCode);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("历史充电订单信息推送error", e);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始充电结果推送
|
||||
*/
|
||||
|
||||
|
||||
|
||||
public void commonPushStartChargeResult(NotificationDTO dto) {
|
||||
logger.info("开始调用commonPushStartChargeResult接口");
|
||||
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)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 调用相应平台的处理方法
|
||||
for (ThirdPartySecretInfoVO secretInfoVO : secretInfoVOS) {
|
||||
if (StringUtils.isNotBlank(platformType) && !StringUtils.equals(platformType, secretInfoVO.getPlatformType())) {
|
||||
// 如果dto中的platformType不为空,并且不等于secretInfoVO.getPlatformType(),continue
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
Object service = getPlatformService(secretInfoVO.getPlatformType());
|
||||
|
||||
if (service instanceof ThirdPartyPlatformService) {
|
||||
((ThirdPartyPlatformService) service).notificationStartChargeResult(orderCode);
|
||||
} else if (service instanceof ThirdPartyPlatformApi) {
|
||||
// 后续新平台异步处理
|
||||
ThirdPartyPlatformApi apiService = (ThirdPartyPlatformApi) service;
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
apiService.notificationStartChargeResult(orderCode);
|
||||
} catch (Exception e) {
|
||||
logger.error("new平台[{}]开始充电结果推送失败", secretInfoVO.getPlatformName(), e);
|
||||
}
|
||||
}, executor);
|
||||
}
|
||||
// 根据平台类型获取Service
|
||||
ThirdPartyPlatformService platformService = ThirdPartyPlatformFactory.getInvokeStrategy(secretInfoVO.getPlatformType());
|
||||
platformService.notificationStartChargeResult(orderCode);
|
||||
} catch (Exception e) {
|
||||
logger.error("充电订单信息推送error", e);
|
||||
}
|
||||
@@ -360,38 +257,26 @@ public class NotificationService {
|
||||
|
||||
/**
|
||||
* 站点功率信息推送
|
||||
* notification_orderInfo/notification_charge_order_info
|
||||
*/
|
||||
public void notificationStationPowerInfo(NotificationDTO dto) {
|
||||
String stationId = dto.getStationId();
|
||||
String platformType = dto.getPlatformType();
|
||||
|
||||
// 通过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 {
|
||||
Object service = getPlatformService(secretInfoVO.getPlatformType());
|
||||
List<String> stationIds = Lists.newArrayList(stationId);
|
||||
|
||||
if (service instanceof ThirdPartyPlatformService) {
|
||||
((ThirdPartyPlatformService) service).notificationPowerInfo(stationIds);
|
||||
} else if (service instanceof ThirdPartyPlatformApi) {
|
||||
// 后续新平台异步处理
|
||||
ThirdPartyPlatformApi apiService = (ThirdPartyPlatformApi) service;
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
apiService.notificationPowerInfo(stationIds);
|
||||
} catch (Exception e) {
|
||||
logger.error("new平台[{}]站点功率信息推送失败", secretInfoVO.getPlatformName(), e);
|
||||
}
|
||||
}, executor);
|
||||
}
|
||||
// 根据平台类型获取Service
|
||||
ThirdPartyPlatformService platformService = ThirdPartyPlatformFactory.getInvokeStrategy(secretInfoVO.getPlatformType());
|
||||
platformService.notificationPowerInfo(Lists.newArrayList(stationId));
|
||||
} catch (Exception e) {
|
||||
logger.error("站点功率信息推送error", e);
|
||||
}
|
||||
@@ -400,6 +285,7 @@ public class NotificationService {
|
||||
|
||||
/**
|
||||
* 站点费率变化推送
|
||||
* notification_stationFee
|
||||
*/
|
||||
public void notificationStationFee(NotificationDTO dto) {
|
||||
String stationId = dto.getStationId();
|
||||
@@ -408,34 +294,21 @@ public class NotificationService {
|
||||
if (StringUtils.isBlank(stationId)) {
|
||||
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 {
|
||||
Object service = getPlatformService(secretInfoVO.getPlatformType());
|
||||
com.jsowell.common.service.thirdparty.vo.ThirdPartySecretInfoVO conversionVO = getConversion(secretInfoVO);
|
||||
|
||||
if (service instanceof ThirdPartyPlatformService) {
|
||||
((ThirdPartyPlatformService) service).notificationStationFee(stationId, secretInfoVO);
|
||||
} else if (service instanceof ThirdPartyPlatformApi) {
|
||||
// 后续新平台异步处理
|
||||
ThirdPartyPlatformApi apiService = (ThirdPartyPlatformApi) service;
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
apiService.notificationStationFee(stationId, conversionVO);
|
||||
} catch (Exception e) {
|
||||
logger.error("new平台[{}]站点费率推送失败", secretInfoVO.getPlatformName(), e);
|
||||
}
|
||||
}, executor);
|
||||
}
|
||||
// 根据平台类型获取Service
|
||||
ThirdPartyPlatformService platformService = ThirdPartyPlatformFactory.getInvokeStrategy(secretInfoVO.getPlatformType());
|
||||
platformService.notificationStationFee(stationId, secretInfoVO);
|
||||
} catch (Exception e) {
|
||||
logger.error("站点费率变化推送error", e);
|
||||
}
|
||||
@@ -444,105 +317,74 @@ public class NotificationService {
|
||||
|
||||
/**
|
||||
* 历史充电订单信息推送
|
||||
* notification_orderInfo/notification_charge_order_info
|
||||
*/
|
||||
public void notificationChargeOrderInfoHistory(NotificationDTO dto) {
|
||||
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)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 调用相应平台的处理方法
|
||||
for (ThirdPartySecretInfoVO secretInfoVO : secretInfoVOS) {
|
||||
if (StringUtils.isNotBlank(platformType) && !StringUtils.equals(platformType, secretInfoVO.getPlatformType())) {
|
||||
// 如果dto中的platformType不为空,并且不等于secretInfoVO.getPlatformType(),continue
|
||||
continue;
|
||||
}
|
||||
// 根据平台类型获取Service
|
||||
ThirdPartyPlatformService platformService = ThirdPartyPlatformFactory.getInvokeStrategy(secretInfoVO.getPlatformType());
|
||||
try {
|
||||
platformService.notificationChargeOrderInfo(orderCode);
|
||||
} catch (Exception e) {
|
||||
logger.error("历史充电订单信息推送 error", e);
|
||||
}
|
||||
|
||||
try {
|
||||
Object service = getPlatformService(secretInfoVO.getPlatformType());
|
||||
|
||||
if (service instanceof ThirdPartyPlatformService) {
|
||||
((ThirdPartyPlatformService) service).notificationChargeOrderInfo(orderCode);
|
||||
((ThirdPartyPlatformService) service).notificationChargeOrderInfoHistory(orderCode);
|
||||
} else if (service instanceof ThirdPartyPlatformApi) {
|
||||
// 后续新平台异步处理
|
||||
ThirdPartyPlatformApi apiService = (ThirdPartyPlatformApi) service;
|
||||
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
apiService.notificationChargeOrderInfo(orderCode);
|
||||
} catch (Exception e) {
|
||||
logger.error("new平台[{}]历史订单信息推送失败", secretInfoVO.getPlatformName(), e);
|
||||
}
|
||||
}, executor);
|
||||
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
apiService.notificationChargeOrderInfoHistory(orderCode);
|
||||
} catch (Exception e) {
|
||||
logger.error("new平台[{}]历史充电订单推送失败", secretInfoVO.getPlatformName(), e);
|
||||
}
|
||||
}, executor);
|
||||
}
|
||||
platformService.notificationChargeOrderInfoHistory(orderCode);
|
||||
} catch (Exception e) {
|
||||
logger.error("历史充电订单信息推送 error", e);
|
||||
logger.error("历史充电订单信息推送error", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 充电设备告警信息推送
|
||||
* notification_alarmInfo
|
||||
* @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 {
|
||||
Object service = getPlatformService(secretInfoVO.getPlatformType());
|
||||
// 根据平台类型获取Service
|
||||
ThirdPartyPlatformService platformService = ThirdPartyPlatformFactory.getInvokeStrategy(secretInfoVO.getPlatformType());
|
||||
PushAlarmInfoDTO pushAlarmInfoDTO = new PushAlarmInfoDTO();
|
||||
pushAlarmInfoDTO.setPileConnectorCode(pileConnectorCode);
|
||||
pushAlarmInfoDTO.setConnectorStatus(status);
|
||||
|
||||
com.jsowell.common.service.thirdparty.dto.PushAlarmInfoDTO dtoConvert =
|
||||
new com.jsowell.common.service.thirdparty.dto.PushAlarmInfoDTO();
|
||||
BeanUtils.copyProperties(pushAlarmInfoDTO, dtoConvert);
|
||||
|
||||
if (service instanceof ThirdPartyPlatformService) {
|
||||
|
||||
((ThirdPartyPlatformService) service).notificationAlarmInfo(pushAlarmInfoDTO);
|
||||
} else if (service instanceof ThirdPartyPlatformApi) {
|
||||
// 后续新平台异步处理
|
||||
ThirdPartyPlatformApi apiService = (ThirdPartyPlatformApi) service;
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
apiService.notificationAlarmInfo(dtoConvert);
|
||||
} catch (Exception e) {
|
||||
logger.error("new平台[{}]设备告警信息推送失败", secretInfoVO.getPlatformName(), e);
|
||||
}
|
||||
}, executor);
|
||||
}
|
||||
platformService.notificationAlarmInfo(pushAlarmInfoDTO);
|
||||
} catch (Exception e) {
|
||||
logger.error("充电设备告警信息推送error", e);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.jsowell.thirdparty.platform.service.impl;
|
||||
|
||||
import cn.hutool.core.util.PageUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
@@ -10,11 +9,9 @@ import com.google.common.collect.Maps;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
||||
import com.jsowell.common.core.redis.RedisCache;
|
||||
import com.jsowell.common.enums.lianlian.StationPaymentEnum;
|
||||
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
|
||||
import com.jsowell.common.enums.ykc.BillingTimeTypeEnum;
|
||||
import com.jsowell.common.enums.ykc.OrderStatusEnum;
|
||||
import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum;
|
||||
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.util.*;
|
||||
@@ -33,7 +30,6 @@ import com.jsowell.pile.vo.ThirdPartySecretInfoVO;
|
||||
import com.jsowell.pile.vo.base.ConnectorInfoVO;
|
||||
import com.jsowell.pile.vo.base.MerchantInfoVO;
|
||||
import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO;
|
||||
import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO;
|
||||
import com.jsowell.pile.vo.uniapp.customer.BillingPriceVO;
|
||||
import com.jsowell.pile.vo.web.PileConnectorInfoVO;
|
||||
import com.jsowell.pile.vo.web.PileMerchantInfoVO;
|
||||
@@ -45,7 +41,6 @@ import com.jsowell.thirdparty.platform.domain.*;
|
||||
import com.jsowell.thirdparty.platform.factory.ThirdPartyPlatformFactory;
|
||||
import com.jsowell.thirdparty.platform.service.ThirdPartyPlatformService;
|
||||
import com.jsowell.thirdparty.platform.util.Cryptos;
|
||||
import com.jsowell.thirdparty.platform.util.GBSignUtils;
|
||||
import com.jsowell.thirdparty.platform.util.HttpRequestUtil;
|
||||
import com.jsowell.thirdparty.platform.util.ThirdPartyPlatformUtils;
|
||||
import com.jsowell.thirdparty.service.ThirdpartySecretInfoService;
|
||||
@@ -59,7 +54,6 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Function;
|
||||
|
||||
@@ -11,7 +11,6 @@ import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
||||
import com.jsowell.common.enums.thirdparty.BusinessInformationExchangeEnum;
|
||||
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
|
||||
import com.jsowell.common.enums.ykc.OrderStatusEnum;
|
||||
import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum;
|
||||
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.util.*;
|
||||
@@ -26,12 +25,10 @@ import com.jsowell.pile.thirdparty.ConnectorInfo;
|
||||
import com.jsowell.pile.thirdparty.EquipmentInfo;
|
||||
import com.jsowell.pile.vo.ThirdPartySecretInfoVO;
|
||||
import com.jsowell.pile.vo.base.ConnectorInfoVO;
|
||||
import com.jsowell.pile.vo.base.MerchantInfoVO;
|
||||
import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO;
|
||||
import com.jsowell.pile.vo.lianlian.AccumulativeInfoVO;
|
||||
import com.jsowell.pile.vo.web.PileConnectorInfoVO;
|
||||
import com.jsowell.pile.vo.web.PileModelInfoVO;
|
||||
import com.jsowell.pile.vo.web.PileStationVO;
|
||||
import com.jsowell.thirdparty.lianlian.domain.*;
|
||||
import com.jsowell.thirdparty.lianlian.vo.AccessTokenVO;
|
||||
import com.jsowell.thirdparty.lianlian.vo.LianLianResultVO;
|
||||
|
||||
@@ -23,7 +23,6 @@ import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum;
|
||||
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.util.*;
|
||||
import com.jsowell.common.util.bean.BeanUtils;
|
||||
import com.jsowell.pile.domain.*;
|
||||
import com.jsowell.pile.domain.ykcCommond.StartChargingCommand;
|
||||
import com.jsowell.pile.dto.*;
|
||||
@@ -41,7 +40,6 @@ import com.jsowell.pile.vo.lianlian.PushStationFeeVO;
|
||||
import com.jsowell.pile.vo.lianlian.StationElectStatsInfos;
|
||||
import com.jsowell.pile.vo.uniapp.customer.BillingPriceVO;
|
||||
import com.jsowell.pile.vo.web.PileConnectorInfoVO;
|
||||
import com.jsowell.pile.vo.web.PileStationVO;
|
||||
import com.jsowell.thirdparty.lianlian.domain.*;
|
||||
import com.jsowell.thirdparty.lianlian.vo.*;
|
||||
import com.jsowell.thirdparty.platform.common.ChargeDetail;
|
||||
|
||||
@@ -24,7 +24,6 @@ import com.jsowell.pile.vo.base.MerchantInfoVO;
|
||||
import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO;
|
||||
import com.jsowell.pile.vo.lianlian.AccumulativeInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.customer.BillingPriceVO;
|
||||
import com.jsowell.pile.vo.web.OrderListVO;
|
||||
import com.jsowell.pile.vo.web.PileConnectorInfoVO;
|
||||
import com.jsowell.pile.vo.web.PileModelInfoVO;
|
||||
import com.jsowell.pile.vo.zdl.EquipBusinessPolicyVO;
|
||||
@@ -156,11 +155,11 @@ public class YunWeiPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
/* *//**
|
||||
* 推送站点信息
|
||||
* @param stationId 充电站id
|
||||
* @return
|
||||
*/
|
||||
*//*
|
||||
@Override
|
||||
public String notificationStationInfo(String stationId) {
|
||||
List<SupStationInfo> stationInfos = new ArrayList<>();
|
||||
@@ -231,7 +230,7 @@ public class YunWeiPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
|
||||
return result;
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 查询站点信息
|
||||
@@ -250,7 +249,7 @@ public class YunWeiPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
return null;
|
||||
}
|
||||
// ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorId());
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getNingBoSecretInfoVO();
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getYunWeiSecretInfoVO();
|
||||
PageInfo<ThirdPartyStationInfoVO> pageInfo = new PageInfo<>(stationInfos);
|
||||
List<SupStationInfo> resultList = new ArrayList<>();
|
||||
for (ThirdPartyStationInfoVO pileStationInfo : pageInfo.getList()) {
|
||||
@@ -313,7 +312,7 @@ public class YunWeiPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
*/
|
||||
@Override
|
||||
public Map<String, String> queryStationStats(QueryStationInfoDTO dto) {
|
||||
ThirdPartySecretInfoVO ningBoSecretInfoVO = getNingBoSecretInfoVO();
|
||||
ThirdPartySecretInfoVO ningBoSecretInfoVO = getYunWeiSecretInfoVO();
|
||||
// 根据站点id 查出这段时间的充电量
|
||||
List<AccumulativeInfoVO> list = orderBasicInfoService.getAccumulativeInfoForLianLian(dto);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
@@ -399,7 +398,7 @@ public class YunWeiPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
List<String> stationIds = dto.getStationIds();
|
||||
List<StationStatusInfo> StationStatusInfos = new ArrayList<>();
|
||||
List<Object> ConnectorStatusInfos = new ArrayList<>();
|
||||
ThirdPartySecretInfoVO ningBoSecretInfoVO = getNingBoSecretInfoVO();
|
||||
ThirdPartySecretInfoVO ningBoSecretInfoVO = getYunWeiSecretInfoVO();
|
||||
|
||||
ConnectorStatusInfo connectorStatusInfo;
|
||||
for (String stationId : stationIds) {
|
||||
@@ -473,7 +472,7 @@ public class YunWeiPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
@Override
|
||||
public String notificationStationStatus(String stationId, String pileConnectorCode, String status, ThirdPartySecretInfoVO secretInfoVO) {
|
||||
|
||||
ThirdPartySecretInfoVO ningBoSecretInfoVO = getNingBoSecretInfoVO();
|
||||
ThirdPartySecretInfoVO ningBoSecretInfoVO = getYunWeiSecretInfoVO();
|
||||
String operatorId = Constants.OPERATORID_JIANG_SU;
|
||||
String operatorSecret = ningBoSecretInfoVO.getTheirOperatorSecret();
|
||||
String signSecret = ningBoSecretInfoVO.getTheirSigSecret();
|
||||
@@ -496,7 +495,7 @@ public class YunWeiPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
/* *//**
|
||||
* 推送订单数据 notificationChargeOrderInfo
|
||||
* @param orderCode 订单编号
|
||||
* @return
|
||||
@@ -504,7 +503,7 @@ public class YunWeiPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
* @throws InvalidKeySpecException
|
||||
* @throws NoSuchProviderException
|
||||
* @throws CryptoException
|
||||
*/
|
||||
*//*
|
||||
@Override
|
||||
public String notificationChargeOrderInfo(String orderCode, ThirdPartySecretInfoVO thirdPartySecretInfoVO) {
|
||||
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||||
@@ -543,7 +542,7 @@ public class YunWeiPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
|
||||
return result;
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
/**
|
||||
@@ -553,7 +552,7 @@ public class YunWeiPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
*/
|
||||
@Override
|
||||
public Map<String, String> queryEquipAuth(QueryEquipmentDTO dto) {
|
||||
ThirdPartySecretInfoVO ningBoSecretInfoVO = getNingBoSecretInfoVO();
|
||||
ThirdPartySecretInfoVO ningBoSecretInfoVO = getYunWeiSecretInfoVO();
|
||||
EquipmentAuthVO vo = new EquipmentAuthVO();
|
||||
|
||||
String equipAuthSeq = dto.getEquipAuthSeq(); // MA1X78KH5202311071202015732
|
||||
@@ -601,7 +600,7 @@ public class YunWeiPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
// 平台已存在订单
|
||||
return null;
|
||||
}
|
||||
ThirdPartySecretInfoVO ningBoSecretInfoVO = getNingBoSecretInfoVO();
|
||||
ThirdPartySecretInfoVO ningBoSecretInfoVO = getYunWeiSecretInfoVO();
|
||||
// 生成订单
|
||||
Map<String, Object> map = orderBasicInfoService.generateOrderForThirdParty(dto);
|
||||
String orderCode = (String) map.get("orderCode");
|
||||
@@ -640,7 +639,7 @@ public class YunWeiPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
public Map<String, String> queryEquipBusinessPolicy(QueryStartChargeDTO dto) {
|
||||
List<EquipBusinessPolicyVO.PolicyInfo> policyInfoList = new ArrayList<>();
|
||||
String pileConnectorCode = dto.getConnectorID();
|
||||
ThirdPartySecretInfoVO ningBoSecretInfoVO = getNingBoSecretInfoVO();
|
||||
ThirdPartySecretInfoVO ningBoSecretInfoVO = getYunWeiSecretInfoVO();
|
||||
|
||||
// 截取桩号
|
||||
// String pileSn = StringUtils.substring(pileConnectorCode, 0, 14);
|
||||
@@ -694,7 +693,7 @@ public class YunWeiPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
if (orderInfo == null) {
|
||||
return null;
|
||||
}
|
||||
ThirdPartySecretInfoVO ningBoSecretInfoVO = getNingBoSecretInfoVO();
|
||||
ThirdPartySecretInfoVO ningBoSecretInfoVO = getYunWeiSecretInfoVO();
|
||||
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderInfo.getOrderCode());
|
||||
// 通过订单号查询实时数据
|
||||
List<RealTimeMonitorData> realTimeData = orderBasicInfoService.getChargingRealTimeData(orderInfo.getTransactionCode());
|
||||
@@ -756,7 +755,7 @@ public class YunWeiPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
QueryStopChargeVO vo = new QueryStopChargeVO();
|
||||
String orderCode = dto.getStartChargeSeq();
|
||||
|
||||
ThirdPartySecretInfoVO ningBoSecretInfoVO = getNingBoSecretInfoVO();
|
||||
ThirdPartySecretInfoVO ningBoSecretInfoVO = getYunWeiSecretInfoVO();
|
||||
// 根据订单号查询订单信息
|
||||
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||||
if (orderInfo == null) {
|
||||
@@ -775,11 +774,11 @@ public class YunWeiPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
return ThirdPartyPlatformUtils.generateResultMap(vo, ningBoSecretInfoVO);
|
||||
}
|
||||
|
||||
/**
|
||||
/* *//**
|
||||
* 推送启动充电结果 notification_start_charge_result
|
||||
* @param orderCode 订单编号
|
||||
* @return
|
||||
*/
|
||||
*//*
|
||||
@Override
|
||||
public String notificationStartChargeResult(String orderCode) {
|
||||
// 根据订单号查询订单信息
|
||||
@@ -810,13 +809,13 @@ public class YunWeiPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
|
||||
return result;
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
/* *//**
|
||||
* 推送停止充电结果 notification_stop_charge_result
|
||||
* @param orderCode 订单编号
|
||||
* @return
|
||||
*/
|
||||
*//*
|
||||
@Override
|
||||
public String notificationStopChargeResult(String orderCode) {
|
||||
// 根据订单号查询订单信息
|
||||
@@ -848,9 +847,9 @@ public class YunWeiPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
|
||||
return result;
|
||||
}
|
||||
}*/
|
||||
|
||||
@Override
|
||||
/* @Override
|
||||
public String notificationEquipChargeStatus(String orderCode) {
|
||||
// 根据订单号查询订单信息
|
||||
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||||
@@ -898,7 +897,7 @@ public class YunWeiPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* 获取桩列表信息
|
||||
*
|
||||
@@ -970,8 +969,8 @@ public class YunWeiPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String pushOrderInfo(QueryOrderDTO dto) {
|
||||
/* @Override
|
||||
public String pushOrderInfo(QueryOrder2DTO dto) {
|
||||
ThirdPartySecretInfoVO ningBoSecretInfoVO = getNingBoSecretInfoVO();
|
||||
|
||||
// 根据站点id, 开始时间,结束时间查询出所有的订单信息
|
||||
@@ -990,15 +989,15 @@ public class YunWeiPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
}
|
||||
}
|
||||
return "Success";
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 获取宁波平台密钥信息
|
||||
* @return
|
||||
*/
|
||||
private ThirdPartySecretInfoVO getNingBoSecretInfoVO() {
|
||||
private ThirdPartySecretInfoVO getYunWeiSecretInfoVO() {
|
||||
// 通过第三方平台类型查询相关配置信息
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByThirdPlatformType(ThirdPlatformTypeEnum.NING_BO_PLATFORM.getTypeCode());
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByThirdPlatformType(thirdPlatformType);
|
||||
if (thirdPartySecretInfoVO == null) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_SELECT_INFO_IS_NULL);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ import com.jsowell.pile.vo.base.MerchantInfoVO;
|
||||
import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO;
|
||||
import com.jsowell.pile.vo.lianlian.AccumulativeInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.customer.BillingPriceVO;
|
||||
import com.jsowell.pile.vo.web.OrderListVO;
|
||||
import com.jsowell.pile.vo.web.PileConnectorInfoVO;
|
||||
import com.jsowell.pile.vo.web.PileModelInfoVO;
|
||||
import com.jsowell.pile.vo.zdl.EquipBusinessPolicyVO;
|
||||
|
||||
Reference in New Issue
Block a user