Merge remote-tracking branch 'origin/dev' into dev-zzx

This commit is contained in:
YAS\29473
2025-07-11 17:02:02 +08:00
14 changed files with 269 additions and 10 deletions

View File

@@ -113,6 +113,25 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jsowell</groupId>
<artifactId>charge-common-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo</artifactId>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-registry-nacos</artifactId>
</dependency>
</dependencies>
<build>
@@ -158,4 +177,4 @@
<finalName>${project.artifactId}</finalName>
</build>
</project>
</project>

View File

@@ -1,5 +1,6 @@
package com.jsowell;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
@@ -11,6 +12,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
*/
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
@EnableDubbo
public class JsowellApplication {
public static void main(String[] args) {

View File

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

View File

@@ -251,4 +251,21 @@ parking:
# 充电算法平台配置
chargeAlgorithm:
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: 79HMu!6nlOiLm^Q[
protocol:
name: dubbo
port: 20880
consumer:
check: false # 关键配置:启动时不检查提供者

View File

@@ -246,4 +246,21 @@ parking:
# 充电算法平台配置
chargeAlgorithm:
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://47.103.124.69:8848
parameters:
namespace: 1c0429d3-2842-45a9-b3f3-11605c3fd06e
username: nacos
password: 2KaGqRo34BHgHJap
protocol:
name: dubbo
port: 20880
consumer:
check: false # 关键配置:启动时不检查提供者

View File

@@ -252,3 +252,20 @@ parking:
chargeAlgorithm:
url: http://150.158.199.92:58910/gateway/api/user/battery/algorithm/json
clientId: e488bac5f70b496fa2d82065089e5f81
# dubbo配置
dubbo:
application:
name: ydc-server
qosEnable: false
registry:
address: nacos://106.14.94.149:8848
parameters:
namespace: 200784c9-7e8f-4b2b-a44f-1eb52e675491
username: nacos
password: 3rtJPEb0KaUs5NAm
protocol:
name: dubbo
port: 20880
consumer:
check: false # 关键配置:启动时不检查提供者

View File

@@ -250,3 +250,20 @@ parking:
chargeAlgorithm:
url: http://150.158.199.92:58910/gateway/api/user/battery/algorithm/json
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: 79HMu!6nlOiLm^Q[
protocol:
name: dubbo
port: 20880
consumer:
check: false # 关键配置:启动时不检查提供者

View File

@@ -41,6 +41,7 @@ import com.jsowell.common.enums.DelFlagEnum;
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
import com.jsowell.common.enums.ykc.*;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.service.JcppService;
import com.jsowell.common.util.*;
import com.jsowell.common.util.Cp56Time2a.Cp56Time2aUtil;
import com.jsowell.common.util.http.HttpUtils;
@@ -94,6 +95,7 @@ import com.jsowell.wxpay.response.WechatPayRefundRequest;
import com.jsowell.wxpay.service.WxAppletRemoteService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.dubbo.config.annotation.DubboReference;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
@@ -292,6 +294,15 @@ public class SpringBootTestController {
@Autowired
private QcyunsService qcyunsService;
@DubboReference
private JcppService jcppService;
@Test
public void testDubbo() {
String s = jcppService.sayHello("jsowell-charger-web");
System.out.println(s);
}
@Test
public void testCommonVerificationCode() {
String phoneNumber = "18612341234";

View File

@@ -156,6 +156,15 @@
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo</artifactId>
</dependency>
<dependency>
<groupId>com.jsowell</groupId>
<artifactId>charge-common-api</artifactId>
</dependency>
</dependencies>
<properties>
@@ -182,4 +191,4 @@
</build>
</project>
</project>

View File

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

View File

@@ -853,6 +853,7 @@ public class PileBillingTemplateServiceImpl implements PileBillingTemplateServic
}
BillingTemplateVO billingTemplateVO = pileBillingTemplateMapper.selectBillingTemplateByPileSn(pileSn);
if (billingTemplateVO != null) {
billingTemplateVO.setPileSn(pileSn);
redisCache.setCacheObject(redisKey, JSON.toJSONString(billingTemplateVO), CacheConstants.cache_expire_time_1d);
}
return billingTemplateVO;

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);
}
/**
* 发送停止充电
*

View File

@@ -19,6 +19,7 @@ import java.util.Map;
@AllArgsConstructor
@Builder
public class BillingTemplateVO {
private String pileSn;
// 站点id
private String stationId;

62
pom.xml
View File

@@ -3,14 +3,14 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.jsowell</groupId>
<artifactId>jsowell-charger-web</artifactId>
<version>1.0.0</version>
<name>jsowell</name>
<description>万车充运营管理平台</description>
<properties>
<jsowell.version>1.0.0</jsowell.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -23,7 +23,8 @@
<kaptcha.version>2.3.2</kaptcha.version>
<mybatis-spring-boot.version>2.2.2</mybatis-spring-boot.version>
<pagehelper.boot.version>1.4.3</pagehelper.boot.version>
<fastjson.version>2.0.11</fastjson.version>
<!--<fastjson.version>2.0.11</fastjson.version>-->
<fastjson.version>2.0.23</fastjson.version>
<oshi.version>6.2.2</oshi.version>
<commons.io.version>2.11.0</commons.io.version>
<commons.fileupload.version>1.4</commons.fileupload.version>
@@ -42,8 +43,11 @@
<alipai.easysdk.version>2.2.3</alipai.easysdk.version>
<tencent.sdk.version>3.1.87</tencent.sdk.version>
<protostuff.version>1.8.0</protostuff.version>
<!--<dubbo.version>2.7.15</dubbo.version>-->
<dubbo.version>3.3.0</dubbo.version>
<nacos-client.version>2.0.3</nacos-client.version>
</properties>
<!-- 依赖声明 -->
<dependencyManagement>
<dependencies>
@@ -336,6 +340,54 @@
<version>${protostuff.version}</version>
</dependency>
<dependency>
<groupId>com.jsowell</groupId>
<artifactId>charge-common-api</artifactId>
<version>1.0.0</version>
</dependency>
<!--dubbo集成springboot依赖-->
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-dependencies-bom</artifactId>
<version>${dubbo.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
<version>${dubbo.version}</version>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-registry-nacos</artifactId>
<version>${dubbo.version}</version>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo</artifactId>
<version>${dubbo.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.alibaba.nacos</groupId>
<artifactId>nacos-client</artifactId>
<version>${nacos-client.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
@@ -395,4 +447,4 @@
</pluginRepository>
</pluginRepositories>
</project>
</project>