mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-23 16:49:49 +08:00
update dubbo service
This commit is contained in:
@@ -0,0 +1,78 @@
|
|||||||
|
package com.jsowell.service;
|
||||||
|
|
||||||
|
import com.jsowell.common.dto.RealTimeMonitorData;
|
||||||
|
import com.jsowell.common.dto.TransactionRecordsData;
|
||||||
|
import com.jsowell.common.service.YdcService;
|
||||||
|
import com.jsowell.common.vo.BillingTemplateVO;
|
||||||
|
import com.jsowell.common.vo.PileInfoVO;
|
||||||
|
import org.apache.dubbo.config.annotation.DubboService;
|
||||||
|
|
||||||
|
@DubboService
|
||||||
|
public class YdcServiceImpl implements YdcService {
|
||||||
|
@Override
|
||||||
|
public String sayHello(String name) {
|
||||||
|
return "hello " + name + " from ydc-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) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -252,3 +252,18 @@ parking:
|
|||||||
chargeAlgorithm:
|
chargeAlgorithm:
|
||||||
url: http://150.158.199.92:58910/gateway/api/user/battery/algorithm/json
|
url: http://150.158.199.92:58910/gateway/api/user/battery/algorithm/json
|
||||||
clientId: e488bac5f70b496fa2d82065089e5f81
|
clientId: e488bac5f70b496fa2d82065089e5f81
|
||||||
|
|
||||||
|
# dubbo配置
|
||||||
|
dubbo:
|
||||||
|
application:
|
||||||
|
name: ydc-server
|
||||||
|
qosEnable: false
|
||||||
|
registry:
|
||||||
|
address: nacos://192.168.2.2:8848
|
||||||
|
parameters:
|
||||||
|
namespace: e328faaf-8516-42d0-817a-7406232b3581
|
||||||
|
username: nacos
|
||||||
|
password: nacos
|
||||||
|
protocol:
|
||||||
|
name: dubbo
|
||||||
|
port: 20880
|
||||||
|
|||||||
@@ -247,3 +247,18 @@ parking:
|
|||||||
chargeAlgorithm:
|
chargeAlgorithm:
|
||||||
url: http://150.158.199.92:58910/gateway/api/user/battery/algorithm/json
|
url: http://150.158.199.92:58910/gateway/api/user/battery/algorithm/json
|
||||||
clientId: e488bac5f70b496fa2d82065089e5f81
|
clientId: e488bac5f70b496fa2d82065089e5f81
|
||||||
|
|
||||||
|
# dubbo配置
|
||||||
|
dubbo:
|
||||||
|
application:
|
||||||
|
name: ydc-server
|
||||||
|
qosEnable: false
|
||||||
|
registry:
|
||||||
|
address: nacos://192.168.2.2:8848
|
||||||
|
parameters:
|
||||||
|
namespace: e328faaf-8516-42d0-817a-7406232b3581
|
||||||
|
username: nacos
|
||||||
|
password: nacos
|
||||||
|
protocol:
|
||||||
|
name: dubbo
|
||||||
|
port: 20880
|
||||||
|
|||||||
@@ -252,3 +252,18 @@ parking:
|
|||||||
chargeAlgorithm:
|
chargeAlgorithm:
|
||||||
url: http://150.158.199.92:58910/gateway/api/user/battery/algorithm/json
|
url: http://150.158.199.92:58910/gateway/api/user/battery/algorithm/json
|
||||||
clientId: e488bac5f70b496fa2d82065089e5f81
|
clientId: e488bac5f70b496fa2d82065089e5f81
|
||||||
|
|
||||||
|
# dubbo配置
|
||||||
|
dubbo:
|
||||||
|
application:
|
||||||
|
name: ydc-server
|
||||||
|
qosEnable: false
|
||||||
|
registry:
|
||||||
|
address: nacos://192.168.2.2:8848
|
||||||
|
parameters:
|
||||||
|
namespace: e328faaf-8516-42d0-817a-7406232b3581
|
||||||
|
username: nacos
|
||||||
|
password: nacos
|
||||||
|
protocol:
|
||||||
|
name: dubbo
|
||||||
|
port: 20880
|
||||||
|
|||||||
@@ -250,3 +250,18 @@ parking:
|
|||||||
chargeAlgorithm:
|
chargeAlgorithm:
|
||||||
url: http://150.158.199.92:58910/gateway/api/user/battery/algorithm/json
|
url: http://150.158.199.92:58910/gateway/api/user/battery/algorithm/json
|
||||||
clientId: e488bac5f70b496fa2d82065089e5f81
|
clientId: e488bac5f70b496fa2d82065089e5f81
|
||||||
|
|
||||||
|
# dubbo配置
|
||||||
|
dubbo:
|
||||||
|
application:
|
||||||
|
name: ydc-server
|
||||||
|
qosEnable: false
|
||||||
|
registry:
|
||||||
|
address: nacos://192.168.2.2:8848
|
||||||
|
parameters:
|
||||||
|
namespace: e328faaf-8516-42d0-817a-7406232b3581
|
||||||
|
username: nacos
|
||||||
|
password: nacos
|
||||||
|
protocol:
|
||||||
|
name: dubbo
|
||||||
|
port: 20880
|
||||||
|
|||||||
@@ -71,21 +71,6 @@ spring:
|
|||||||
# 热部署开关
|
# 热部署开关
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
||||||
# dubbo配置
|
|
||||||
dubbo:
|
|
||||||
application:
|
|
||||||
name: jsowell-service
|
|
||||||
qosEnable: false
|
|
||||||
registry:
|
|
||||||
address: nacos://192.168.2.2:8848
|
|
||||||
parameters:
|
|
||||||
namespace: e328faaf-8516-42d0-817a-7406232b3581
|
|
||||||
username: nacos
|
|
||||||
password: nacos
|
|
||||||
protocol:
|
|
||||||
name: dubbo
|
|
||||||
port: 20880
|
|
||||||
|
|
||||||
# MyBatis配置
|
# MyBatis配置
|
||||||
mybatis:
|
mybatis:
|
||||||
# 搜索指定包别名
|
# 搜索指定包别名
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ import com.jsowell.common.enums.DelFlagEnum;
|
|||||||
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
|
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
|
||||||
import com.jsowell.common.enums.ykc.*;
|
import com.jsowell.common.enums.ykc.*;
|
||||||
import com.jsowell.common.exception.BusinessException;
|
import com.jsowell.common.exception.BusinessException;
|
||||||
import com.jsowell.common.service.ProtocolService;
|
import com.jsowell.common.service.JcppService;
|
||||||
import com.jsowell.common.util.*;
|
import com.jsowell.common.util.*;
|
||||||
import com.jsowell.common.util.Cp56Time2a.Cp56Time2aUtil;
|
import com.jsowell.common.util.Cp56Time2a.Cp56Time2aUtil;
|
||||||
import com.jsowell.common.util.http.HttpUtils;
|
import com.jsowell.common.util.http.HttpUtils;
|
||||||
@@ -295,11 +295,11 @@ public class SpringBootTestController {
|
|||||||
private QcyunsService qcyunsService;
|
private QcyunsService qcyunsService;
|
||||||
|
|
||||||
@DubboReference
|
@DubboReference
|
||||||
private ProtocolService protocolService;
|
private JcppService jcppService;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDubbo() {
|
public void testDubbo() {
|
||||||
String s = protocolService.sayHello("jsowell-charger-web");
|
String s = jcppService.sayHello("jsowell-charger-web");
|
||||||
System.out.println(s);
|
System.out.println(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -13,6 +13,8 @@ public interface YKCPushCommandService {
|
|||||||
*/
|
*/
|
||||||
void pushStartChargingCommand(StartChargingCommand startChargingCommand);
|
void pushStartChargingCommand(StartChargingCommand startChargingCommand);
|
||||||
|
|
||||||
|
void pushStopChargingCommandForJCPP(StartChargingCommand command);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送停止充电指令
|
* 发送停止充电指令
|
||||||
* @param stopChargingCommand
|
* @param stopChargingCommand
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.jsowell.common.enums.ykc.PileChannelEntity;
|
|||||||
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||||
import com.jsowell.common.exception.BusinessException;
|
import com.jsowell.common.exception.BusinessException;
|
||||||
import com.jsowell.common.protocol.SyncPromise;
|
import com.jsowell.common.protocol.SyncPromise;
|
||||||
|
import com.jsowell.common.service.JcppService;
|
||||||
import com.jsowell.common.util.*;
|
import com.jsowell.common.util.*;
|
||||||
import com.jsowell.common.util.Cp56Time2a.Cp56Time2aUtil;
|
import com.jsowell.common.util.Cp56Time2a.Cp56Time2aUtil;
|
||||||
import com.jsowell.common.util.spring.SpringUtils;
|
import com.jsowell.common.util.spring.SpringUtils;
|
||||||
@@ -22,6 +23,7 @@ import io.netty.channel.ChannelFutureListener;
|
|||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -31,7 +33,6 @@ import java.time.LocalTime;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -56,6 +57,9 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private PileConnectorInfoService pileConnectorInfoService;
|
private PileConnectorInfoService pileConnectorInfoService;
|
||||||
|
|
||||||
|
@DubboReference
|
||||||
|
private JcppService jcppService;
|
||||||
|
|
||||||
// 引入线程池
|
// 引入线程池
|
||||||
private ThreadPoolTaskExecutor executor = SpringUtils.getBean("threadPoolTaskExecutor");
|
private ThreadPoolTaskExecutor executor = SpringUtils.getBean("threadPoolTaskExecutor");
|
||||||
|
|
||||||
@@ -320,6 +324,18 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
|
|||||||
transactionCode, pileSn, BytesUtil.bcd2Str(connectorCodeByteArr), logicCardNum, physicsCardNum, chargeAmount);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送停止充电
|
* 发送停止充电
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user