mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
在各个帧类中添加mq消息发送(部分添加用于测试)
This commit is contained in:
@@ -1,78 +0,0 @@
|
||||
package com.jsowell.service;
|
||||
|
||||
import com.jsowell.common.dto.RealTimeMonitorData;
|
||||
import com.jsowell.common.dto.TransactionRecordsData;
|
||||
import com.jsowell.common.service.WccService;
|
||||
import com.jsowell.common.vo.BillingTemplateVO;
|
||||
import com.jsowell.common.vo.PileInfoVO;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
|
||||
@DubboService
|
||||
public class WccServiceImpl implements WccService {
|
||||
@Override
|
||||
public String sayHello(String name) {
|
||||
return "hello " + name + " from wcc-server";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询充电桩详情
|
||||
*
|
||||
* @param pileCode
|
||||
*/
|
||||
@Override
|
||||
public PileInfoVO getPileDetail(String pileCode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询计费模板
|
||||
*
|
||||
* @param pileCode
|
||||
*/
|
||||
@Override
|
||||
public BillingTemplateVO getBillingTemplate(String pileCode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动充电callback
|
||||
*
|
||||
* @param pileCode
|
||||
* @param result
|
||||
*/
|
||||
@Override
|
||||
public void startChargeCallback(String pileCode, String result) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止充电callback
|
||||
*
|
||||
* @param pileCode
|
||||
* @param result
|
||||
*/
|
||||
@Override
|
||||
public void stopChargeCallback(String pileCode, String result) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 接收交易记录接口
|
||||
*
|
||||
* @param transactionRecordsData
|
||||
*/
|
||||
@Override
|
||||
public void receiveTradeRecord(TransactionRecordsData transactionRecordsData) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 接收实时监测数据接口
|
||||
*
|
||||
* @param realTimeMonitorData
|
||||
*/
|
||||
@Override
|
||||
public void receiveRealTimeData(RealTimeMonitorData realTimeMonitorData) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -240,6 +240,10 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jsowell</groupId>
|
||||
<artifactId>charge-common-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.jsowell.common.config.mq;
|
||||
|
||||
import com.jsowell.common.constant.mq.ThirdPartyRabbitConstants;
|
||||
import org.springframework.amqp.core.Binding;
|
||||
import org.springframework.amqp.core.BindingBuilder;
|
||||
import org.springframework.amqp.core.Queue;
|
||||
import org.springframework.amqp.core.TopicExchange;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class TopicRabbitConfig {
|
||||
|
||||
/**
|
||||
* 定义交换机
|
||||
*/
|
||||
@Bean
|
||||
public TopicExchange wccThirdpartyExchange() {
|
||||
return new TopicExchange(ThirdPartyRabbitConstants.WCC_THIRDPARTY_NAME, true, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 定义队列
|
||||
*/
|
||||
@Bean
|
||||
public Queue realtimeDataPushQueue() {
|
||||
return new Queue(ThirdPartyRabbitConstants.QUEUE_REALTIME_DATA_PUSH, true);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Queue alarmPushQueue() {
|
||||
return new Queue(ThirdPartyRabbitConstants.QUEUE_ALARM_PUSH, true);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Queue chargeResultPushQueue() {
|
||||
return new Queue(ThirdPartyRabbitConstants.QUEUE_CHARGE_RESULT_PUSH, true);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Queue startupChargingFailedPushQueue() {
|
||||
return new Queue(ThirdPartyRabbitConstants.QUEUE_STARTUP_CHARGING_FAILED_PUSH, true);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Queue chargeOrderPushQueue() {
|
||||
return new Queue(ThirdPartyRabbitConstants.QUEUE_CHARGE_ORDER_PUSH, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 队列绑定到交换机
|
||||
*/
|
||||
@Bean
|
||||
public Binding bindRealtimeDataPush(Queue realtimeDataPushQueue, TopicExchange wccThirdpartyExchange) {
|
||||
return BindingBuilder.bind(realtimeDataPushQueue)
|
||||
.to(wccThirdpartyExchange)
|
||||
.with("wcc.realtimeDataPush.#");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Binding bindAlarmPush(Queue alarmPushQueue, TopicExchange wccThirdpartyExchange) {
|
||||
return BindingBuilder.bind(alarmPushQueue)
|
||||
.to(wccThirdpartyExchange)
|
||||
.with("wcc.alarmPush.#");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Binding bindChargeResultPush(Queue chargeResultPushQueue, TopicExchange wccThirdpartyExchange) {
|
||||
return BindingBuilder.bind(chargeResultPushQueue)
|
||||
.to(wccThirdpartyExchange)
|
||||
.with("wcc.chargeResultPush.#");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Binding bindStartupChargingFailedPush(Queue startupChargingFailedPushQueue, TopicExchange wccThirdpartyExchange) {
|
||||
return BindingBuilder.bind(startupChargingFailedPushQueue)
|
||||
.to(wccThirdpartyExchange)
|
||||
.with("wcc.startupChargingFailedPush.#");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Binding bindChargeOrderPush(Queue chargeOrderPushQueue, TopicExchange wccThirdpartyExchange) {
|
||||
return BindingBuilder.bind(chargeOrderPushQueue)
|
||||
.to(wccThirdpartyExchange)
|
||||
.with("wcc.chargeOrderPush.#");
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.jsowell.netty.handler.yunkuaichong;
|
||||
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.constant.mq.ThirdPartyRabbitConstants;
|
||||
import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
|
||||
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
||||
import com.jsowell.common.enums.ykc.ChargingFailedReasonEnum;
|
||||
@@ -14,6 +15,7 @@ import com.jsowell.pile.service.OrderBasicInfoService;
|
||||
import com.jsowell.thirdparty.common.CommonService;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -40,6 +42,9 @@ public class RemoteStartChargingRequestHandler extends AbstractYkcHandler {
|
||||
// 引入第三方平台任务线程池
|
||||
private ThreadPoolTaskExecutor thirdpartyTaskExecutor = SpringUtils.getBean("thirdpartyTaskExecutor");
|
||||
|
||||
@Autowired
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
YKCOperateFactory.register(type, this);
|
||||
@@ -125,6 +130,33 @@ public class RemoteStartChargingRequestHandler extends AbstractYkcHandler {
|
||||
}
|
||||
}
|
||||
}, thirdpartyTaskExecutor);
|
||||
|
||||
// TODO 测试mq
|
||||
// 异步发送mq
|
||||
CompletableFuture.runAsync(() -> {
|
||||
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode);
|
||||
if (orderInfo == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
// 推送启动充电结果
|
||||
Thread.sleep(1000);
|
||||
rabbitTemplate.convertAndSend(ThirdPartyRabbitConstants.WCC_THIRDPARTY_NAME,ThirdPartyRabbitConstants.QUEUE_CHARGE_RESULT_PUSH, orderInfo);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// 启动失败, 推送第三方订单信息
|
||||
if (StringUtils.equals(startResult, Constants.DOUBLE_ZERO)) {
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
//充电订单信息推送,订单信息推送,停止充电结果推送,充电账单推送
|
||||
rabbitTemplate.convertAndSend(ThirdPartyRabbitConstants.WCC_THIRDPARTY_NAME,ThirdPartyRabbitConstants.QUEUE_STARTUP_CHARGING_FAILED_PUSH, orderInfo);
|
||||
} catch (Exception e) {
|
||||
log.error("统一推送第三方平台订单信息error, ", e);
|
||||
}
|
||||
}
|
||||
}, thirdpartyTaskExecutor);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSON;
|
||||
import com.google.common.primitives.Bytes;
|
||||
import com.jsowell.common.constant.CacheConstants;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.constant.mq.ThirdPartyRabbitConstants;
|
||||
import com.jsowell.common.core.domain.ykc.TransactionRecordsData;
|
||||
import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
|
||||
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
||||
@@ -27,6 +28,7 @@ import com.jsowell.thirdparty.common.CommonService;
|
||||
import com.jsowell.thirdparty.platform.service.impl.ChargeAlgorithmService;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -84,6 +86,10 @@ public class TransactionRecordsRequestHandler extends AbstractYkcHandler {
|
||||
@Autowired
|
||||
private PersonalChargingRecordService personalChargingRecordService;
|
||||
|
||||
@Autowired
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// // BigDecimal totalElectricity = new BigDecimal("23.73");
|
||||
@@ -695,6 +701,27 @@ public class TransactionRecordsRequestHandler extends AbstractYkcHandler {
|
||||
}
|
||||
}, thirdpartyTaskExecutor);
|
||||
|
||||
|
||||
// TODO 测试mq
|
||||
// 异步推送充电订单算法平台
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
String result = chargeAlgorithmService.pushOrderInfo(finalOrderBasicInfo.getOrderCode());
|
||||
log.info("异步推送充电订单算法平台 result:{}", result);
|
||||
} catch (Exception e) {
|
||||
log.error("异步推送充电订单算法平台 error, ", e);
|
||||
}
|
||||
}, thirdpartyTaskExecutor);
|
||||
|
||||
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
rabbitTemplate.convertAndSend(ThirdPartyRabbitConstants.WCC_THIRDPARTY_NAME,ThirdPartyRabbitConstants.QUEUE_CHARGE_ORDER_PUSH, finalOrderBasicInfo);
|
||||
} catch (Exception e) {
|
||||
log.error("推送第三方平台订单信息error, ", e);
|
||||
}
|
||||
}, thirdpartyTaskExecutor);
|
||||
|
||||
} else {
|
||||
// 平台没有查到订单
|
||||
orderBasicInfoService.saveAbnormalOrder(data);
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.jsowell.netty.handler.yunkuaichong;
|
||||
|
||||
import com.jsowell.common.constant.CacheConstants;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.constant.mq.ThirdPartyRabbitConstants;
|
||||
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
||||
import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
|
||||
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
||||
@@ -21,6 +22,7 @@ import com.jsowell.pile.service.PileBasicInfoService;
|
||||
import com.jsowell.thirdparty.common.CommonService;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -66,6 +68,9 @@ public class UploadRealTimeMonitorHandler extends AbstractYkcHandler {
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Autowired
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
|
||||
@Override
|
||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||
@@ -377,6 +382,26 @@ public class UploadRealTimeMonitorHandler extends AbstractYkcHandler {
|
||||
}, thirdpartyTaskExecutor);
|
||||
}
|
||||
|
||||
// TODO 测试mq
|
||||
// 向mq中发送实时数据消息,给第三方服务消费
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
rabbitTemplate.convertAndSend(ThirdPartyRabbitConstants.WCC_THIRDPARTY_NAME,ThirdPartyRabbitConstants.QUEUE_REALTIME_DATA_PUSH, realTimeMonitorData);
|
||||
} catch (Exception e){
|
||||
log.error("向mq中发送实时数据消息供第三方服务消费 error, ", e);
|
||||
}
|
||||
if (StringUtils.equals(connectorStatus,Constants.ONE)){
|
||||
// 故障
|
||||
// 异步推送第三方平台告警信息
|
||||
try {
|
||||
rabbitTemplate.convertAndSend(ThirdPartyRabbitConstants.WCC_THIRDPARTY_NAME,ThirdPartyRabbitConstants.QUEUE_ALARM_PUSH, realTimeMonitorData.getPutGunType());
|
||||
} catch (Exception e) {
|
||||
log.error("统一推送第三方平台告警信息 error, ", e);
|
||||
}
|
||||
}
|
||||
}, executor);
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -371,6 +371,8 @@ public class UploadRealTimeMonitorStrategy implements AbstractYkcStrategy {
|
||||
}, executor);
|
||||
}
|
||||
|
||||
// TODO 测试
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,504 @@
|
||||
package com.jsowell.pile.rpc;
|
||||
|
||||
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
||||
import com.jsowell.common.dto.JCTRealTimeMonitorData;
|
||||
import com.jsowell.common.dto.thirdparty.JCTQueryOrderDTO;
|
||||
import com.jsowell.common.dto.thirdparty.JCTQueryStartChargeDTO;
|
||||
import com.jsowell.common.dto.thirdparty.JCTQueryStationInfoDTO;
|
||||
import com.jsowell.common.dto.thirdparty.JCTStartChargingCommand;
|
||||
import com.jsowell.common.service.WccService;
|
||||
import com.jsowell.common.vo.thirdParty.*;
|
||||
import com.jsowell.pile.domain.*;
|
||||
import com.jsowell.pile.domain.ykcCommond.StartChargingCommand;
|
||||
import com.jsowell.pile.dto.QueryOrderDTO;
|
||||
import com.jsowell.pile.dto.QueryStartChargeDTO;
|
||||
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
||||
import com.jsowell.pile.service.*;
|
||||
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.uniapp.customer.BillingPriceVO;
|
||||
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.service.ThirdpartySecretInfoService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@DubboService(group = "thirdparty" , version = "1.0.0")
|
||||
@Slf4j
|
||||
public class WccServiceImpl implements WccService {
|
||||
|
||||
@Autowired
|
||||
private PileBasicInfoService pileBasicInfoService;
|
||||
|
||||
@Autowired
|
||||
private ThirdpartySecretInfoService thirdpartySecretInfoService;
|
||||
|
||||
@Autowired
|
||||
private OrderBasicInfoService orderBasicInfoService;
|
||||
|
||||
@Autowired
|
||||
private PileStationInfoService pileStationInfoService;
|
||||
|
||||
@Autowired
|
||||
private PileMerchantInfoService pileMerchantInfoService;
|
||||
|
||||
@Autowired
|
||||
private PileConnectorInfoService pileConnectorInfoService;
|
||||
|
||||
@Autowired
|
||||
private YKCPushCommandService ykCPushCommandService;
|
||||
|
||||
@Autowired
|
||||
private PileBillingTemplateService pileBillingTemplateService;
|
||||
|
||||
@Autowired
|
||||
private PileRemoteService pileRemoteService;
|
||||
|
||||
@Autowired
|
||||
private PileModelInfoService pileModelInfoService;
|
||||
|
||||
/**
|
||||
* 测试接口
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String sayHello(String name) {
|
||||
return "hello " + name + " from wcc-server";
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 查询充电桩详情
|
||||
// *
|
||||
// * @param pileCode
|
||||
// */
|
||||
// @Override
|
||||
// public PileInfoVO getPileDetail(String pileCode) {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 查询计费模板
|
||||
// *
|
||||
// * @param pileCode
|
||||
// */
|
||||
// @Override
|
||||
// public BillingTemplateVO getBillingTemplate(String pileCode) {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 启动充电callback
|
||||
// *
|
||||
// * @param pileCode
|
||||
// * @param result
|
||||
// */
|
||||
// @Override
|
||||
// public void startChargeCallback(String pileCode, String result) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 停止充电callback
|
||||
// *
|
||||
// * @param pileCode
|
||||
// * @param result
|
||||
// */
|
||||
// @Override
|
||||
// public void stopChargeCallback(String pileCode, String result) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 接收交易记录接口
|
||||
// *
|
||||
// * @param transactionRecordsData
|
||||
// */
|
||||
// @Override
|
||||
// public void receiveTradeRecord(TransactionRecordsData transactionRecordsData) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 接收实时监测数据接口
|
||||
// *
|
||||
// * @param realTimeMonitorData
|
||||
// */
|
||||
// @Override
|
||||
// public void receiveRealTimeData(JCTRealTimeMonitorData realTimeMonitorData) {
|
||||
//
|
||||
// }
|
||||
|
||||
/**
|
||||
* 查询充电桩基本信息
|
||||
* @param pileSn
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public JCTPileBasicInfo selectPileBasicInfoBySN(String pileSn) {
|
||||
PileBasicInfo pileBasicInfo = pileBasicInfoService.selectPileBasicInfoBySN(pileSn);
|
||||
if (pileBasicInfo == null) {
|
||||
return null;
|
||||
}
|
||||
JCTPileBasicInfo build = JCTPileBasicInfo.builder()
|
||||
.sn(pileBasicInfo.getSn())
|
||||
.name(pileBasicInfo.getName())
|
||||
.businessType(pileBasicInfo.getBusinessType())
|
||||
.secretKey(pileBasicInfo.getSecretKey())
|
||||
.softwareProtocol(pileBasicInfo.getSoftwareProtocol())
|
||||
.productionDate(pileBasicInfo.getProductionDate())
|
||||
.licenceId(pileBasicInfo.getLicenceId())
|
||||
.modelId(pileBasicInfo.getModelId())
|
||||
.simId(pileBasicInfo.getSimId())
|
||||
.iccId(pileBasicInfo.getIccId())
|
||||
.merchantId(pileBasicInfo.getMerchantId())
|
||||
.stationId(pileBasicInfo.getStationId())
|
||||
.faultReason(pileBasicInfo.getFaultReason())
|
||||
.createTime(pileBasicInfo.getCreateTime())
|
||||
.build();
|
||||
|
||||
return build;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询第三方平台配置信息列表
|
||||
* @param stationId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<JCTThirdPartySecretInfoVO> queryStationToPlatformList(String stationId) {
|
||||
List<ThirdPartySecretInfoVO> thirdPartySecretInfoVOS = thirdpartySecretInfoService.queryStationToPlatformList(stationId);
|
||||
if (thirdPartySecretInfoVOS == null || thirdPartySecretInfoVOS.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
for (ThirdPartySecretInfoVO thirdPartySecretInfoVO : thirdPartySecretInfoVOS) {
|
||||
JCTThirdPartySecretInfoVO build = JCTThirdPartySecretInfoVO.builder()
|
||||
.ourOperatorId(thirdPartySecretInfoVO.getOurOperatorId())
|
||||
.ourOperatorSecret(thirdPartySecretInfoVO.getOurOperatorSecret())
|
||||
.ourDataSecret(thirdPartySecretInfoVO.getOurDataSecret())
|
||||
.ourDataSecretIv(thirdPartySecretInfoVO.getOurDataSecretIv())
|
||||
.ourSigSecret(thirdPartySecretInfoVO.getOurSigSecret())
|
||||
.ourPrivateSecret(thirdPartySecretInfoVO.getOurPrivateSecret())
|
||||
.ourPublicSecret(thirdPartySecretInfoVO.getOurPublicSecret())
|
||||
.platformName(thirdPartySecretInfoVO.getPlatformName())
|
||||
.platformType(thirdPartySecretInfoVO.getPlatformType())
|
||||
.theirOperatorId(thirdPartySecretInfoVO.getTheirOperatorId())
|
||||
.theirOperatorSecret(thirdPartySecretInfoVO.getTheirOperatorSecret())
|
||||
.theirDataSecret(thirdPartySecretInfoVO.getTheirDataSecret())
|
||||
.theirDataSecretIv(thirdPartySecretInfoVO.getTheirDataSecretIv())
|
||||
.theirSigSecret(thirdPartySecretInfoVO.getTheirSigSecret())
|
||||
.theirUrlPrefix(thirdPartySecretInfoVO.getTheirUrlPrefix())
|
||||
.theirPublicSecret(thirdPartySecretInfoVO.getTheirPublicSecret())
|
||||
.theirPrivateSecret(thirdPartySecretInfoVO.getTheirPrivateSecret())
|
||||
.build();
|
||||
return Collections.singletonList(build);
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据交易流水号查询订单信息
|
||||
* @param transactionCode
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public JCTOrderBasicInfo getOrderInfoByTransactionCode(String transactionCode) {
|
||||
OrderBasicInfo orderInfoByTransactionCode = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode);
|
||||
if (orderInfoByTransactionCode == null) {
|
||||
return null;
|
||||
}
|
||||
JCTOrderBasicInfo jctOrderBasicInfo = new JCTOrderBasicInfo();
|
||||
BeanUtils.copyProperties(orderInfoByTransactionCode, jctOrderBasicInfo);
|
||||
return jctOrderBasicInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据充电桩枪口号查询充电站信息
|
||||
*
|
||||
* @param pileConnectorCode
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public JCTPileStationVO getStationInfoByPileConnectorCode(String pileConnectorCode) {
|
||||
PileStationVO stationInfoByPileConnectorCode = pileStationInfoService.getStationInfoByPileConnectorCode(pileConnectorCode);
|
||||
if (stationInfoByPileConnectorCode == null) {
|
||||
return null;
|
||||
}
|
||||
JCTPileStationVO jctPileStationVO = new JCTPileStationVO();
|
||||
BeanUtils.copyProperties(stationInfoByPileConnectorCode, jctPileStationVO);
|
||||
return jctPileStationVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JCTThirdPartySecretInfoVO queryByOperatorId(String operatorId) {
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByOperatorId(operatorId);
|
||||
if (thirdPartySecretInfoVO == null) {
|
||||
return null;
|
||||
}
|
||||
JCTThirdPartySecretInfoVO jctThirdPartySecretInfoVO = new JCTThirdPartySecretInfoVO();
|
||||
BeanUtils.copyProperties(thirdPartySecretInfoVO, jctThirdPartySecretInfoVO);
|
||||
return jctThirdPartySecretInfoVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JCTPileStationInfo selectPileStationInfoById(Long id) {
|
||||
PileStationInfo pileStationInfo = pileStationInfoService.selectPileStationInfoById(id);
|
||||
if (pileStationInfo == null) {
|
||||
return null;
|
||||
}
|
||||
JCTPileStationInfo jctPileStationInfo = new JCTPileStationInfo();
|
||||
BeanUtils.copyProperties(pileStationInfo, jctPileStationInfo);
|
||||
return jctPileStationInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JCTMerchantInfoVO getMerchantInfoVO(String merchantId) {
|
||||
MerchantInfoVO merchantInfoVO = pileMerchantInfoService.getMerchantInfoVO(merchantId);
|
||||
if (merchantInfoVO == null) {
|
||||
return null;
|
||||
}
|
||||
JCTMerchantInfoVO jctMerchantInfoVO = new JCTMerchantInfoVO();
|
||||
BeanUtils.copyProperties(merchantInfoVO, jctMerchantInfoVO);
|
||||
return jctMerchantInfoVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JCTThirdPartyStationInfoVO> selectStationInfosByThirdParty(JCTQueryStationInfoDTO queryStationInfoDTO) {
|
||||
if (queryStationInfoDTO == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
QueryStationInfoDTO dto = new QueryStationInfoDTO();
|
||||
BeanUtils.copyProperties(queryStationInfoDTO, dto);
|
||||
List<ThirdPartyStationInfoVO> thirdPartyStationInfoVOS = pileStationInfoService.selectStationInfosByThirdParty(dto);
|
||||
if (thirdPartyStationInfoVOS == null || thirdPartyStationInfoVOS.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<JCTThirdPartyStationInfoVO> jctThirdPartyStationInfoVOS = new ArrayList<>();
|
||||
for (ThirdPartyStationInfoVO thirdPartyStationInfoVO : thirdPartyStationInfoVOS) {
|
||||
JCTThirdPartyStationInfoVO jctThirdPartyStationInfoVO = new JCTThirdPartyStationInfoVO();
|
||||
BeanUtils.copyProperties(thirdPartyStationInfoVO, jctThirdPartyStationInfoVO);
|
||||
jctThirdPartyStationInfoVOS.add(jctThirdPartyStationInfoVO);
|
||||
}
|
||||
return jctThirdPartyStationInfoVOS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JCTThirdPartySecretInfoVO queryByThirdPlatformType(String thirdPlatformType) {
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByThirdPlatformType(thirdPlatformType);
|
||||
if (thirdPartySecretInfoVO == null) {
|
||||
return null;
|
||||
}
|
||||
JCTThirdPartySecretInfoVO jctThirdPartySecretInfoVO = new JCTThirdPartySecretInfoVO();
|
||||
BeanUtils.copyProperties(thirdPartySecretInfoVO, jctThirdPartySecretInfoVO);
|
||||
return jctThirdPartySecretInfoVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JCTAccumulativeInfoVO> getAccumulativeInfoForLianLian(JCTQueryStationInfoDTO queryStationInfoDTO) {
|
||||
if (queryStationInfoDTO == null){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
QueryStationInfoDTO dto = new QueryStationInfoDTO();
|
||||
BeanUtils.copyProperties(queryStationInfoDTO, dto);
|
||||
List<AccumulativeInfoVO> accumulativeInfoForLianLian = orderBasicInfoService.getAccumulativeInfoForLianLian(dto);
|
||||
if (accumulativeInfoForLianLian == null || accumulativeInfoForLianLian.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<JCTAccumulativeInfoVO> jctAccumulativeInfoVOS = new ArrayList<>();
|
||||
for (AccumulativeInfoVO accumulativeInfoVO : accumulativeInfoForLianLian) {
|
||||
JCTAccumulativeInfoVO jctAccumulativeInfoVO = new JCTAccumulativeInfoVO();
|
||||
BeanUtils.copyProperties(accumulativeInfoVO, jctAccumulativeInfoVO);
|
||||
jctAccumulativeInfoVOS.add(jctAccumulativeInfoVO);
|
||||
}
|
||||
return jctAccumulativeInfoVOS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JCTConnectorInfoVO> getConnectorListForLianLian(Long stationId) {
|
||||
List<ConnectorInfoVO> connectorListForLianLian = pileConnectorInfoService.getConnectorListForLianLian(stationId);
|
||||
if (connectorListForLianLian == null || connectorListForLianLian.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<JCTConnectorInfoVO> jctConnectorInfoVOS = new ArrayList<>();
|
||||
for (ConnectorInfoVO connectorInfoVO : connectorListForLianLian) {
|
||||
JCTConnectorInfoVO jctConnectorInfoVO = new JCTConnectorInfoVO();
|
||||
BeanUtils.copyProperties(connectorInfoVO, jctConnectorInfoVO);
|
||||
jctConnectorInfoVOS.add(jctConnectorInfoVO);
|
||||
}
|
||||
return jctConnectorInfoVOS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JCTOrderBasicInfo queryChargingByPileConnectorCode(String pileConnectorCode) {
|
||||
OrderBasicInfo orderBasicInfo = orderBasicInfoService.queryChargingByPileConnectorCode(pileConnectorCode);
|
||||
if (orderBasicInfo == null) {
|
||||
return null;
|
||||
}
|
||||
JCTOrderBasicInfo jctOrderBasicInfo = new JCTOrderBasicInfo();
|
||||
BeanUtils.copyProperties(orderBasicInfo, jctOrderBasicInfo);
|
||||
return jctOrderBasicInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JCTRealTimeMonitorData> getChargingRealTimeData(String transactionCode) {
|
||||
if (transactionCode == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<RealTimeMonitorData> chargingRealTimeData = orderBasicInfoService.getChargingRealTimeData(transactionCode);
|
||||
if (chargingRealTimeData == null || chargingRealTimeData.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<JCTRealTimeMonitorData> jctRealTimeMonitorDatas = new ArrayList<>();
|
||||
for (RealTimeMonitorData realTimeMonitorData : chargingRealTimeData) {
|
||||
JCTRealTimeMonitorData jctRealTimeMonitorData = new JCTRealTimeMonitorData();
|
||||
BeanUtils.copyProperties(realTimeMonitorData, jctRealTimeMonitorData);
|
||||
jctRealTimeMonitorDatas.add(jctRealTimeMonitorData);
|
||||
}
|
||||
return jctRealTimeMonitorDatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JCTOrderBasicInfo getOrderInfoByOrderCode(String orderCode) {
|
||||
OrderBasicInfo orderInfoByOrderCode = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||||
if (orderInfoByOrderCode == null) {
|
||||
return null;
|
||||
}
|
||||
JCTOrderBasicInfo jctOrderBasicInfo = new JCTOrderBasicInfo();
|
||||
BeanUtils.copyProperties(orderInfoByOrderCode, jctOrderBasicInfo);
|
||||
return jctOrderBasicInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JCTOrderDetail getOrderDetailByOrderCode(String orderCode) {
|
||||
OrderDetail orderDetailByOrderCode = orderBasicInfoService.getOrderDetailByOrderCode(orderCode);
|
||||
if (orderDetailByOrderCode == null) {
|
||||
return null;
|
||||
}
|
||||
JCTOrderDetail jctOrderDetail = new JCTOrderDetail();
|
||||
BeanUtils.copyProperties(orderDetailByOrderCode, jctOrderDetail);
|
||||
return jctOrderDetail;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JCTPileConnectorInfoVO getPileConnectorInfoByConnectorCode(String pileConnectorCode) {
|
||||
PileConnectorInfoVO info = pileConnectorInfoService.getPileConnectorInfoByConnectorCode(pileConnectorCode);
|
||||
if (info == null) {
|
||||
return null;
|
||||
}
|
||||
JCTPileConnectorInfoVO jctPileConnectorInfoVO = new JCTPileConnectorInfoVO();
|
||||
BeanUtils.copyProperties(info, jctPileConnectorInfoVO);
|
||||
return jctPileConnectorInfoVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> generateOrderForThirdParty(JCTQueryStartChargeDTO dto) {
|
||||
if (dto == null){
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
QueryStartChargeDTO queryStartChargeDTO = new QueryStartChargeDTO();
|
||||
BeanUtils.copyProperties(dto, queryStartChargeDTO);
|
||||
return orderBasicInfoService.generateOrderForThirdParty(queryStartChargeDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pushStartChargingCommand(JCTStartChargingCommand command) {
|
||||
if (command == null){
|
||||
return;
|
||||
}
|
||||
StartChargingCommand startChargingCommand = new StartChargingCommand();
|
||||
BeanUtils.copyProperties(command, startChargingCommand);
|
||||
try {
|
||||
ykCPushCommandService.pushStartChargingCommand(startChargingCommand);
|
||||
}catch (Exception e){
|
||||
log.error("第三方服务发送启动充电失败", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JCTBillingPriceVO> queryBillingPrice(String s) {
|
||||
List<BillingPriceVO> billingPriceVOS = pileBillingTemplateService.queryBillingPrice(s);
|
||||
if (billingPriceVOS == null || billingPriceVOS.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<JCTBillingPriceVO> jctBillingPriceVOS = new ArrayList<>();
|
||||
for (BillingPriceVO billingPriceVO : billingPriceVOS) {
|
||||
JCTBillingPriceVO jctBillingPriceVO = new JCTBillingPriceVO();
|
||||
BeanUtils.copyProperties(billingPriceVO, jctBillingPriceVO);
|
||||
jctBillingPriceVOS.add(jctBillingPriceVO);
|
||||
}
|
||||
return jctBillingPriceVOS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remoteStopCharging(String pileSn , String connectorCode , String transactionCode) {
|
||||
try {
|
||||
pileRemoteService.remoteStopCharging(pileSn, connectorCode, transactionCode);
|
||||
}catch (Exception e){
|
||||
log.error("第三方服务远程停止充电失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JCTPileBasicInfo> getPileListByStationId(String pileSn) {
|
||||
List<PileBasicInfo> pileListByStationId = pileBasicInfoService.getPileListByStationId(pileSn);
|
||||
if (pileListByStationId == null || pileListByStationId.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<JCTPileBasicInfo> jctPileBasicInfos = new ArrayList<>();
|
||||
for (PileBasicInfo pileBasicInfo : pileListByStationId) {
|
||||
JCTPileBasicInfo jctPileBasicInfo = new JCTPileBasicInfo();
|
||||
BeanUtils.copyProperties(pileBasicInfo, jctPileBasicInfo);
|
||||
jctPileBasicInfos.add(jctPileBasicInfo);
|
||||
}
|
||||
return jctPileBasicInfos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JCTPileModelInfoVO getPileModelInfoByPileSn(String pileSn) {
|
||||
PileModelInfoVO pileModelInfoByPileSn = pileModelInfoService.getPileModelInfoByPileSn(pileSn);
|
||||
if (pileModelInfoByPileSn == null) {
|
||||
return null;
|
||||
}
|
||||
JCTPileModelInfoVO jctPileModelInfoVO = new JCTPileModelInfoVO();
|
||||
BeanUtils.copyProperties(pileModelInfoByPileSn, jctPileModelInfoVO);
|
||||
return jctPileModelInfoVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JCTPileConnectorInfo> selectPileConnectorInfoList(String sn) {
|
||||
List<PileConnectorInfo> selectPileConnectorInfoList = pileConnectorInfoService.selectPileConnectorInfoList(sn);
|
||||
if (selectPileConnectorInfoList == null || selectPileConnectorInfoList.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<JCTPileConnectorInfo> jctPileConnectorInfos = new ArrayList<>();
|
||||
for (PileConnectorInfo pileConnectorInfo : selectPileConnectorInfoList) {
|
||||
JCTPileConnectorInfo jctPileConnectorInfo = new JCTPileConnectorInfo();
|
||||
BeanUtils.copyProperties(pileConnectorInfo, jctPileConnectorInfo);
|
||||
jctPileConnectorInfos.add(jctPileConnectorInfo);
|
||||
}
|
||||
return jctPileConnectorInfos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> tempGetOrderCodes(JCTQueryOrderDTO dto) {
|
||||
if (dto == null){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
QueryOrderDTO queryOrderDTO = new QueryOrderDTO();
|
||||
BeanUtils.copyProperties(dto, queryOrderDTO);
|
||||
return orderBasicInfoService.tempGetOrderCodes(queryOrderDTO);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user