update dubbo service

This commit is contained in:
Guoqs
2025-06-17 16:51:50 +08:00
parent dd0ba9a262
commit a949040e78
10 changed files with 162 additions and 51 deletions

View File

@@ -1,30 +0,0 @@
package com.jsowell.dubbo;
import com.jsowell.common.service.ProtocolService;
import org.apache.dubbo.config.annotation.DubboReference;
import java.math.BigDecimal;
public class JCPPService {
@DubboReference
ProtocolService protocolService;
/**
* 调用jcpp的下发计费模板
*/
/**
* 调用jcpp的启动充电
*/
public void startCharge(String pileCode, String gunCode, BigDecimal limitYuan, String orderNo) {
protocolService.startCharge(pileCode, gunCode, limitYuan, orderNo);
}
/**
* 调用jcpp的停止充电
*/
public void stopCharge(String pileCode, String gunCode, String orderNo) {
// protocolService.stopCharge(pileCode, gunCode, orderNo);
}
}

View File

@@ -13,6 +13,8 @@ public interface YKCPushCommandService {
*/
void pushStartChargingCommand(StartChargingCommand startChargingCommand);
void pushStopChargingCommandForJCPP(StartChargingCommand command);
/**
* 发送停止充电指令
* @param stopChargingCommand

View File

@@ -8,6 +8,7 @@ import com.jsowell.common.enums.ykc.PileChannelEntity;
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.protocol.SyncPromise;
import com.jsowell.common.service.JcppService;
import com.jsowell.common.util.*;
import com.jsowell.common.util.Cp56Time2a.Cp56Time2aUtil;
import com.jsowell.common.util.spring.SpringUtils;
@@ -22,6 +23,7 @@ import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandlerContext;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service;
@@ -31,7 +33,6 @@ import java.time.LocalTime;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
/**
@@ -56,6 +57,9 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
@Autowired
private PileConnectorInfoService pileConnectorInfoService;
@DubboReference
private JcppService jcppService;
// 引入线程池
private ThreadPoolTaskExecutor executor = SpringUtils.getBean("threadPoolTaskExecutor");
@@ -320,6 +324,18 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
transactionCode, pileSn, BytesUtil.bcd2Str(connectorCodeByteArr), logicCardNum, physicsCardNum, chargeAmount);
}
/**
* 连接到jcpp服务的启动充电方法
*/
@Override
public void pushStopChargingCommandForJCPP(StartChargingCommand command) {
String pileCode = command.getPileSn();
String gunCode = command.getConnectorCode();
BigDecimal limitYuan = command.getChargeAmount();
String orderNo = command.getTransactionCode();
jcppService.startCharge(pileCode, gunCode, limitYuan, orderNo);
}
/**
* 发送停止充电
*