在各个帧类中添加mq消息发送(部分添加用于测试)

This commit is contained in:
YAS\29473
2025-09-10 16:57:41 +08:00
parent 8e491d41ab
commit 3eb26775fc
8 changed files with 683 additions and 80 deletions

View File

@@ -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);
}
}