mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-25 09:39:46 +08:00
Merge branch 'dev' of http://192.168.2.46:8099/jsowell/jsowell-charger-web into dev
This commit is contained in:
@@ -2,6 +2,7 @@ package com.jsowell.common.enums.ykc;
|
|||||||
|
|
||||||
import com.jsowell.common.util.StringUtils;
|
import com.jsowell.common.util.StringUtils;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -16,35 +17,35 @@ public class PileChannelEntity {
|
|||||||
/**
|
/**
|
||||||
* 管理一个全局map,保存连接进服务端的通道数量
|
* 管理一个全局map,保存连接进服务端的通道数量
|
||||||
*/
|
*/
|
||||||
private static final ConcurrentHashMap<String, Channel> manager = new ConcurrentHashMap<>();
|
private static final ConcurrentHashMap<String, ChannelHandlerContext> manager = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验channel是否保存
|
* 校验channel是否保存
|
||||||
*/
|
*/
|
||||||
public static void checkChannel(String pileSn, Channel channel) {
|
public static void checkChannel(String pileSn, ChannelHandlerContext ctx) {
|
||||||
if (!manager.containsKey(pileSn)) {
|
if (!manager.containsKey(pileSn)) {
|
||||||
// 如果manager中不存在pileSn的连接,则保存
|
// 如果manager中不存在pileSn的连接,则保存
|
||||||
log.info("checkChannel-manager中不存在pileSn:{}的连接,保存新的channel:{}", pileSn, channel.id().asLongText());
|
log.info("checkChannel-manager中不存在pileSn:{}的连接,保存新的channel:{}", pileSn, ctx.channel().id().asLongText());
|
||||||
manager.put(pileSn, channel);
|
manager.put(pileSn, ctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果manager中存在pileSn的连接,取出来对比
|
// 如果manager中存在pileSn的连接,取出来对比
|
||||||
Channel sourceChannel = manager.get(pileSn);
|
Channel sourceChannel = manager.get(pileSn).channel();
|
||||||
if (sourceChannel == null) {
|
if (sourceChannel == null) {
|
||||||
// 为空就put
|
// 为空就put
|
||||||
log.info("checkChannel-manager中pileSn:{}的连接为空,保存新的channel:{}", pileSn, channel.id().asLongText());
|
log.info("checkChannel-manager中pileSn:{}的连接为空,保存新的channel:{}", pileSn, ctx.channel().id().asLongText());
|
||||||
manager.put(pileSn, channel);
|
manager.put(pileSn, ctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 两个做对比
|
// 两个做对比
|
||||||
String sourceChannelId = sourceChannel.id().asLongText();
|
String sourceChannelId = sourceChannel.id().asLongText();
|
||||||
String channelId = channel.id().asLongText();
|
String channelId = ctx.channel().id().asLongText();
|
||||||
if (!StringUtils.equals(sourceChannelId, channelId)) {
|
if (!StringUtils.equals(sourceChannelId, channelId)) {
|
||||||
// 不一致则更新
|
// 不一致则更新
|
||||||
log.info("checkChannel-manager中pileSn:{}的连接不一致, 老channelId:{}, 保存新的channel:{}", pileSn, sourceChannelId, channelId);
|
log.info("checkChannel-manager中pileSn:{}的连接不一致, 老channelId:{}, 保存新的channel:{}", pileSn, sourceChannelId, channelId);
|
||||||
manager.put(pileSn, channel);
|
manager.put(pileSn, ctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,7 +54,7 @@ public class PileChannelEntity {
|
|||||||
* @param pileSn
|
* @param pileSn
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static Channel getChannelByPileSn(String pileSn) {
|
public static ChannelHandlerContext getChannelByPileSn(String pileSn) {
|
||||||
return manager.get(pileSn);
|
return manager.get(pileSn);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,8 +64,8 @@ public class PileChannelEntity {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static String getPileSnByChannelId(String channelId) {
|
public static String getPileSnByChannelId(String channelId) {
|
||||||
for (HashMap.Entry<String, Channel> entry : manager.entrySet()) {
|
for (HashMap.Entry<String, ChannelHandlerContext> entry : manager.entrySet()) {
|
||||||
if (entry.getValue().id().asLongText().equals(channelId)) {
|
if (entry.getValue().channel().id().asLongText().equals(channelId)) {
|
||||||
return entry.getKey();
|
return entry.getKey();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -75,9 +76,9 @@ public class PileChannelEntity {
|
|||||||
* 打印
|
* 打印
|
||||||
*/
|
*/
|
||||||
public static void output() {
|
public static void output() {
|
||||||
for (HashMap.Entry<String, Channel> entry : manager.entrySet()) {
|
for (HashMap.Entry<String, ChannelHandlerContext> entry : manager.entrySet()) {
|
||||||
System.out.println("pileSn:" + entry.getKey() +
|
System.out.println("pileSn:" + entry.getKey() +
|
||||||
",ChannelId:" + entry.getValue().id().asLongText());
|
",ChannelId:" + entry.getValue().channel().id().asLongText());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.jsowell.common.util.BytesUtil;
|
|||||||
import com.jsowell.common.util.CRC16Util;
|
import com.jsowell.common.util.CRC16Util;
|
||||||
import com.jsowell.common.util.DateUtils;
|
import com.jsowell.common.util.DateUtils;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
@@ -25,7 +26,7 @@ public abstract class AbstractHandler implements InitializingBean {
|
|||||||
* 执行逻辑
|
* 执行逻辑
|
||||||
* 有应答
|
* 有应答
|
||||||
*/
|
*/
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext ctx) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,23 +67,23 @@ public abstract class AbstractHandler implements InitializingBean {
|
|||||||
* 保存桩最后链接到平台的时间
|
* 保存桩最后链接到平台的时间
|
||||||
* @param pileSn 桩编号
|
* @param pileSn 桩编号
|
||||||
*/
|
*/
|
||||||
protected void saveLastTimeAndCheckChannel(String pileSn, Channel channel) {
|
protected void saveLastTimeAndCheckChannel(String pileSn, ChannelHandlerContext ctx) {
|
||||||
String redisKey = CacheConstants.PILE_LAST_CONNECTION + pileSn;
|
String redisKey = CacheConstants.PILE_LAST_CONNECTION + pileSn;
|
||||||
redisCache.setCacheObject(redisKey, DateUtils.getDateTime(), CacheConstants.cache_expire_time_1d);
|
redisCache.setCacheObject(redisKey, DateUtils.getDateTime(), CacheConstants.cache_expire_time_1d);
|
||||||
|
|
||||||
// 保存桩号和channel的关系
|
// 保存桩号和channel的关系
|
||||||
PileChannelEntity.checkChannel(pileSn, channel);
|
PileChannelEntity.checkChannel(pileSn, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 阻止重复帧
|
* 阻止重复帧
|
||||||
* @return true 重复
|
* @return true 重复
|
||||||
*/
|
*/
|
||||||
protected boolean verifyTheDuplicateRequest(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
protected boolean verifyTheDuplicateRequest(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext ctx) {
|
||||||
// 获取序列号域
|
// 获取序列号域
|
||||||
int serialNumber = BytesUtil.bytesToIntLittle(ykcDataProtocol.getSerialNumber());
|
int serialNumber = BytesUtil.bytesToIntLittle(ykcDataProtocol.getSerialNumber());
|
||||||
// 获取channelId
|
// 获取channelId
|
||||||
String channelId = channel.id().asShortText();
|
String channelId = ctx.channel().id().asShortText();
|
||||||
String redisKey = "Request_" + channelId + "_" + serialNumber;
|
String redisKey = "Request_" + channelId + "_" + serialNumber;
|
||||||
Boolean result = redisCache.setnx(redisKey, ykcDataProtocol.getHEXString(), 30);
|
Boolean result = redisCache.setnx(redisKey, ykcDataProtocol.getHEXString(), 30);
|
||||||
// result返回false说明没有设置成功,就是说已经有相同请求了,所以返回true重复
|
// result返回false说明没有设置成功,就是说已经有相同请求了,所以返回true重复
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.jsowell.common.util.BytesUtil;
|
|||||||
import com.jsowell.common.util.CRC16Util;
|
import com.jsowell.common.util.CRC16Util;
|
||||||
import com.jsowell.common.util.DateUtils;
|
import com.jsowell.common.util.DateUtils;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
@@ -29,6 +30,10 @@ public abstract class AbstractHandler implements InitializingBean {
|
|||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行逻辑
|
* 执行逻辑
|
||||||
* 不需要应答
|
* 不需要应答
|
||||||
@@ -72,23 +77,23 @@ public abstract class AbstractHandler implements InitializingBean {
|
|||||||
* 保存桩最后链接到平台的时间
|
* 保存桩最后链接到平台的时间
|
||||||
* @param pileSn 桩编号
|
* @param pileSn 桩编号
|
||||||
*/
|
*/
|
||||||
protected void saveLastTimeAndCheckChannel(String pileSn, Channel channel) {
|
protected void saveLastTimeAndCheckChannel(String pileSn, ChannelHandlerContext ctx) {
|
||||||
String redisKey = CacheConstants.PILE_LAST_CONNECTION + pileSn;
|
String redisKey = CacheConstants.PILE_LAST_CONNECTION + pileSn;
|
||||||
redisCache.setCacheObject(redisKey, DateUtils.getDateTime(), CacheConstants.cache_expire_time_1d);
|
redisCache.setCacheObject(redisKey, DateUtils.getDateTime(), CacheConstants.cache_expire_time_1d);
|
||||||
|
|
||||||
// 保存桩号和channel的关系
|
// 保存桩号和channel的关系
|
||||||
PileChannelEntity.checkChannel(pileSn, channel);
|
PileChannelEntity.checkChannel(pileSn, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 阻止重复帧
|
* 阻止重复帧
|
||||||
* @return true 重复
|
* @return true 重复
|
||||||
*/
|
*/
|
||||||
protected boolean verifyTheDuplicateRequest(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
protected boolean verifyTheDuplicateRequest(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext ctx) {
|
||||||
// 获取序列号域
|
// 获取序列号域
|
||||||
int serialNumber = BytesUtil.bytesToIntLittle(ykcDataProtocol.getSerialNumber());
|
int serialNumber = BytesUtil.bytesToIntLittle(ykcDataProtocol.getSerialNumber());
|
||||||
// 获取channelId
|
// 获取channelId
|
||||||
String channelId = channel.id().asShortText();
|
String channelId = ctx.channel().id().asShortText();
|
||||||
String redisKey = "Request_" + channelId + "_" + serialNumber;
|
String redisKey = "Request_" + channelId + "_" + serialNumber;
|
||||||
Boolean result = redisCache.setnx(redisKey, ykcDataProtocol.getHEXString(), 30);
|
Boolean result = redisCache.setnx(redisKey, ykcDataProtocol.getHEXString(), 30);
|
||||||
// result返回false说明没有设置成功,就是说已经有相同请求了,所以返回true重复
|
// result返回false说明没有设置成功,就是说已经有相同请求了,所以返回true重复
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.jsowell.common.util.BytesUtil;
|
|||||||
import com.jsowell.common.util.YKCUtils;
|
import com.jsowell.common.util.YKCUtils;
|
||||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -27,7 +28,7 @@ public class BMSAbortDuringChargingPhaseHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[===充电阶段 BMS 中止===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===充电阶段 BMS 中止===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 获取消息体
|
// 获取消息体
|
||||||
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.jsowell.common.util.BytesUtil;
|
|||||||
import com.jsowell.common.util.YKCUtils;
|
import com.jsowell.common.util.YKCUtils;
|
||||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -27,7 +28,7 @@ public class BMSDemandAndChargerOutputHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[===充电过程 BMS 需求与充电机输出===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===充电过程 BMS 需求与充电机输出===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 获取消息体
|
// 获取消息体
|
||||||
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.jsowell.common.util.BytesUtil;
|
|||||||
import com.jsowell.common.util.YKCUtils;
|
import com.jsowell.common.util.YKCUtils;
|
||||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -27,7 +28,7 @@ public class BMSInformationHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[===充电过程 BMS 信息===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===充电过程 BMS 信息===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 获取消息体
|
// 获取消息体
|
||||||
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.jsowell.pile.service.PileBillingTemplateService;
|
|||||||
import com.jsowell.pile.service.YKCPushCommandService;
|
import com.jsowell.pile.service.YKCPushCommandService;
|
||||||
import com.jsowell.pile.vo.web.BillingTemplateVO;
|
import com.jsowell.pile.vo.web.BillingTemplateVO;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -37,7 +38,7 @@ public class BillingTemplateRequestHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext ctx) {
|
||||||
// log.info("[===执行计费模板请求逻辑===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===执行计费模板请求逻辑===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 获取消息体(此请求消息体只有桩编码)
|
// 获取消息体(此请求消息体只有桩编码)
|
||||||
byte[] pileSnByte = ykcDataProtocol.getMsgBody();
|
byte[] pileSnByte = ykcDataProtocol.getMsgBody();
|
||||||
@@ -45,7 +46,7 @@ public class BillingTemplateRequestHandler extends AbstractHandler{
|
|||||||
// log.info("桩号:{}", pileSn);
|
// log.info("桩号:{}", pileSn);
|
||||||
|
|
||||||
// 保存时间
|
// 保存时间
|
||||||
saveLastTimeAndCheckChannel(pileSn, channel);
|
saveLastTimeAndCheckChannel(pileSn, ctx);
|
||||||
|
|
||||||
// 根据桩号查询计费模板
|
// 根据桩号查询计费模板
|
||||||
BillingTemplateVO billingTemplateVO = pileBillingTemplateService.selectBillingTemplateDetailByPileSn(pileSn);
|
BillingTemplateVO billingTemplateVO = pileBillingTemplateService.selectBillingTemplateDetailByPileSn(pileSn);
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.jsowell.common.util.BytesUtil;
|
|||||||
import com.jsowell.common.util.YKCUtils;
|
import com.jsowell.common.util.YKCUtils;
|
||||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -26,7 +27,7 @@ public class BillingTemplateResponseHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext ctx) {
|
||||||
// log.info("[===执行计费模型设置应答逻辑===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===执行计费模型设置应答逻辑===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 消息体
|
// 消息体
|
||||||
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
||||||
@@ -36,7 +37,7 @@ public class BillingTemplateResponseHandler extends AbstractHandler{
|
|||||||
String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
|
String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
|
||||||
|
|
||||||
// 保存时间
|
// 保存时间
|
||||||
saveLastTimeAndCheckChannel(pileSn, channel);
|
saveLastTimeAndCheckChannel(pileSn, ctx);
|
||||||
|
|
||||||
// 设置结果 0x00 失败 0x01 成功
|
// 设置结果 0x00 失败 0x01 成功
|
||||||
byte[] settingResultByteArr = BytesUtil.copyBytes(msgBody, 7, 1);
|
byte[] settingResultByteArr = BytesUtil.copyBytes(msgBody, 7, 1);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
|||||||
import com.jsowell.common.util.YKCUtils;
|
import com.jsowell.common.util.YKCUtils;
|
||||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -27,7 +28,7 @@ public class BillingTemplateSettingHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext ctx) {
|
||||||
// log.info("[===执行计费模型设置逻辑===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===执行计费模型设置逻辑===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 下发
|
// 下发
|
||||||
// 桩编号
|
// 桩编号
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.jsowell.netty.factory.YKCOperateFactory;
|
|||||||
import com.jsowell.pile.service.PileBillingTemplateService;
|
import com.jsowell.pile.service.PileBillingTemplateService;
|
||||||
import com.jsowell.pile.service.YKCPushCommandService;
|
import com.jsowell.pile.service.YKCPushCommandService;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -38,7 +39,7 @@ public class BillingTemplateValidateRequestHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[===执行计费模板验证请求逻辑===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===执行计费模板验证请求逻辑===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 获取消息体
|
// 获取消息体
|
||||||
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.jsowell.netty.factory.YKCOperateFactory;
|
|||||||
import com.jsowell.pile.domain.OrderBasicInfo;
|
import com.jsowell.pile.domain.OrderBasicInfo;
|
||||||
import com.jsowell.pile.service.OrderBasicInfoService;
|
import com.jsowell.pile.service.OrderBasicInfoService;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -37,7 +38,7 @@ public class ChargeEndHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[===执行充电结束逻辑===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===执行充电结束逻辑===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 消息体
|
// 消息体
|
||||||
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.jsowell.common.util.BytesUtil;
|
|||||||
import com.jsowell.common.util.YKCUtils;
|
import com.jsowell.common.util.YKCUtils;
|
||||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -27,7 +28,7 @@ public class ChargerAbortedDuringChargingPhaseHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[===充电阶段充电机中止===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===充电阶段充电机中止===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 获取消息体
|
// 获取消息体
|
||||||
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.jsowell.common.util.BytesUtil;
|
|||||||
import com.jsowell.common.util.YKCUtils;
|
import com.jsowell.common.util.YKCUtils;
|
||||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -27,7 +28,7 @@ public class ChargingHandshakeHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[===执行充电握手逻辑===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===执行充电握手逻辑===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 消息体
|
// 消息体
|
||||||
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import com.jsowell.pile.service.OrderBasicInfoService;
|
|||||||
import com.jsowell.pile.service.PileAuthCardService;
|
import com.jsowell.pile.service.PileAuthCardService;
|
||||||
import com.jsowell.pile.service.PileMsgRecordService;
|
import com.jsowell.pile.service.PileMsgRecordService;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -58,7 +59,7 @@ public class ConfirmStartChargingRequestHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[===充电桩主动申请启动充电===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===充电桩主动申请启动充电===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 获取消息体
|
// 获取消息体
|
||||||
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.jsowell.common.util.BytesUtil;
|
|||||||
import com.jsowell.common.util.YKCUtils;
|
import com.jsowell.common.util.YKCUtils;
|
||||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -27,7 +28,7 @@ public class ErrorMessageHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[===错误报文===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===错误报文===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 获取消息体
|
// 获取消息体
|
||||||
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import com.jsowell.netty.factory.YKCOperateFactory;
|
|||||||
import com.jsowell.pile.domain.OrderPileOccupy;
|
import com.jsowell.pile.domain.OrderPileOccupy;
|
||||||
import com.jsowell.pile.service.OrderPileOccupyService;
|
import com.jsowell.pile.service.OrderPileOccupyService;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -51,7 +52,7 @@ public class GroundLockDataUploadHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[===地锁数据上送===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===地锁数据上送===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 消息体
|
// 消息体
|
||||||
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.jsowell.common.util.YKCUtils;
|
|||||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||||
import com.jsowell.pile.service.PileBasicInfoService;
|
import com.jsowell.pile.service.PileBasicInfoService;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -31,7 +32,7 @@ public class HeartbeatRequestHandler extends AbstractHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[===充电桩心跳包===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===充电桩心跳包===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 获取消息体
|
// 获取消息体
|
||||||
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import com.jsowell.pile.service.PileBasicInfoService;
|
|||||||
import com.jsowell.pile.service.PileMsgRecordService;
|
import com.jsowell.pile.service.PileMsgRecordService;
|
||||||
import com.jsowell.pile.service.YKCPushCommandService;
|
import com.jsowell.pile.service.YKCPushCommandService;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -105,7 +106,7 @@ public class LoginRequestHandler extends AbstractHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext ctx) {
|
||||||
// 获取消息体
|
// 获取消息体
|
||||||
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
||||||
|
|
||||||
@@ -117,7 +118,7 @@ public class LoginRequestHandler extends AbstractHandler {
|
|||||||
String pileSn = BytesUtil.binary(pileSnByte, 16);
|
String pileSn = BytesUtil.binary(pileSnByte, 16);
|
||||||
|
|
||||||
// 保存时间
|
// 保存时间
|
||||||
saveLastTimeAndCheckChannel(pileSn, channel);
|
saveLastTimeAndCheckChannel(pileSn, ctx);
|
||||||
|
|
||||||
// 桩类型 0 表示直流桩, 1 表示交流桩
|
// 桩类型 0 表示直流桩, 1 表示交流桩
|
||||||
startIndex += length;
|
startIndex += length;
|
||||||
@@ -163,7 +164,7 @@ public class LoginRequestHandler extends AbstractHandler {
|
|||||||
String business = BytesUtil.bcd2Str(businessTypeByteArr);
|
String business = BytesUtil.bcd2Str(businessTypeByteArr);
|
||||||
|
|
||||||
// *********************** 字段解析完成,下面进行逻辑处理 *********************** //
|
// *********************** 字段解析完成,下面进行逻辑处理 *********************** //
|
||||||
if (verifyTheDuplicateRequest(ykcDataProtocol, channel)) {
|
if (verifyTheDuplicateRequest(ykcDataProtocol, ctx)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
|||||||
import com.jsowell.common.util.YKCUtils;
|
import com.jsowell.common.util.YKCUtils;
|
||||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -27,7 +28,7 @@ public class OfflineCardDataCleaningHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[===离线卡数据清除===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===离线卡数据清除===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 下发
|
// 下发
|
||||||
// 桩编号
|
// 桩编号
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.jsowell.common.util.BytesUtil;
|
|||||||
import com.jsowell.common.util.YKCUtils;
|
import com.jsowell.common.util.YKCUtils;
|
||||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -26,7 +27,7 @@ public class OfflineCardDataCleaningResponseHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[===离线卡数据清除应答===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===离线卡数据清除应答===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 消息体
|
// 消息体
|
||||||
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
|||||||
import com.jsowell.common.util.YKCUtils;
|
import com.jsowell.common.util.YKCUtils;
|
||||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -28,7 +29,7 @@ public class OfflineCardDataQueryHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[===离线卡数据查询===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===离线卡数据查询===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 下发
|
// 下发
|
||||||
// 桩编码
|
// 桩编码
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.jsowell.common.util.BytesUtil;
|
|||||||
import com.jsowell.common.util.YKCUtils;
|
import com.jsowell.common.util.YKCUtils;
|
||||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -26,7 +27,7 @@ public class OfflineCardDataQueryResponseHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[===离线卡数据查询应答===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===离线卡数据查询应答===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 消息体
|
// 消息体
|
||||||
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
|||||||
import com.jsowell.common.util.YKCUtils;
|
import com.jsowell.common.util.YKCUtils;
|
||||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -28,7 +29,7 @@ public class OfflineCardDataSynchronizationHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[===离线卡数据同步===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===离线卡数据同步===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 下发
|
// 下发
|
||||||
// 桩编号
|
// 桩编号
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.jsowell.common.util.BytesUtil;
|
|||||||
import com.jsowell.common.util.YKCUtils;
|
import com.jsowell.common.util.YKCUtils;
|
||||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -26,7 +27,7 @@ public class OfflineCardDataSynchronizationResponseHandler extends AbstractHandl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[===离线卡数据同步应答===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===离线卡数据同步应答===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
//消息体
|
//消息体
|
||||||
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.jsowell.netty.factory.YKCOperateFactory;
|
|||||||
import com.jsowell.pile.domain.OrderBasicInfo;
|
import com.jsowell.pile.domain.OrderBasicInfo;
|
||||||
import com.jsowell.pile.service.OrderBasicInfoService;
|
import com.jsowell.pile.service.OrderBasicInfoService;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -35,7 +36,7 @@ public class ParameterConfigurationHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[===参数配置===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===参数配置===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 获取消息体
|
// 获取消息体
|
||||||
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
|||||||
import com.jsowell.common.util.YKCUtils;
|
import com.jsowell.common.util.YKCUtils;
|
||||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -28,7 +29,7 @@ public class PileWorkingParameterSettingHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[===充电桩工作参数设置===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===充电桩工作参数设置===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 下发
|
// 下发
|
||||||
// 桩编号
|
// 桩编号
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.jsowell.common.util.BytesUtil;
|
|||||||
import com.jsowell.common.util.YKCUtils;
|
import com.jsowell.common.util.YKCUtils;
|
||||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -26,7 +27,7 @@ public class PileWorkingParameterSettingResponseHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[===充电桩工作参数设置应答===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===充电桩工作参数设置应答===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 消息体
|
// 消息体
|
||||||
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.jsowell.common.util.BytesUtil;
|
|||||||
import com.jsowell.common.util.YKCUtils;
|
import com.jsowell.common.util.YKCUtils;
|
||||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -26,7 +27,7 @@ public class QueryPileWorkParamsHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[====充电桩査询工作参数回复====] param:{}", JSON.toJSONString(ykcDataProtocol));
|
// log.info("[====充电桩査询工作参数回复====] param:{}", JSON.toJSONString(ykcDataProtocol));
|
||||||
// 获取消息体
|
// 获取消息体
|
||||||
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.jsowell.common.util.YKCUtils;
|
|||||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||||
import com.jsowell.pile.service.impl.YKCPushCommandServiceImpl;
|
import com.jsowell.pile.service.impl.YKCPushCommandServiceImpl;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -32,7 +33,7 @@ public class ReadRealTimeMonitorDataHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[===读取实时监测数据===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===读取实时监测数据===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 下发
|
// 下发
|
||||||
// 桩编号
|
// 桩编号
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.jsowell.common.util.BytesUtil;
|
|||||||
import com.jsowell.common.util.YKCUtils;
|
import com.jsowell.common.util.YKCUtils;
|
||||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -26,7 +27,7 @@ public class RemoteAccountBalanceUpdateRequestHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[===余额更新应答===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===余额更新应答===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 消息体
|
// 消息体
|
||||||
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
|||||||
import com.jsowell.common.util.YKCUtils;
|
import com.jsowell.common.util.YKCUtils;
|
||||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -27,7 +28,7 @@ public class RemoteControlGroundLockHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[===遥控地锁升锁与降锁命令===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===遥控地锁升锁与降锁命令===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 下发
|
// 下发
|
||||||
// 桩编码
|
// 桩编码
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.jsowell.common.util.YKCUtils;
|
|||||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||||
import com.jsowell.pile.service.OrderPileOccupyService;
|
import com.jsowell.pile.service.OrderPileOccupyService;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -34,7 +35,7 @@ public class RemoteControlGroundLockResponseHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[===充电桩返回遥控地锁升锁与降锁数据(上行)===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===充电桩返回遥控地锁升锁与降锁数据(上行)===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 消息体
|
// 消息体
|
||||||
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.jsowell.common.util.BytesUtil;
|
|||||||
import com.jsowell.common.util.YKCUtils;
|
import com.jsowell.common.util.YKCUtils;
|
||||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -33,7 +34,7 @@ public class RemoteIssuedQrCodeHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[===后台远程下发二维码前缀指令===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===后台远程下发二维码前缀指令===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 下发
|
// 下发
|
||||||
// 桩编码
|
// 桩编码
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.jsowell.common.util.BytesUtil;
|
|||||||
import com.jsowell.common.util.YKCUtils;
|
import com.jsowell.common.util.YKCUtils;
|
||||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -26,7 +27,7 @@ public class RemoteIssuedQrCodeResponseHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[===桩应答远程下发二维码前缀指令===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===桩应答远程下发二维码前缀指令===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 消息体
|
// 消息体
|
||||||
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
|||||||
import com.jsowell.common.util.YKCUtils;
|
import com.jsowell.common.util.YKCUtils;
|
||||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -28,7 +29,7 @@ public class RemoteRestartHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[===远程重启===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===远程重启===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 下发
|
// 下发
|
||||||
// 桩编号
|
// 桩编号
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.jsowell.common.util.YKCUtils;
|
|||||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||||
import com.jsowell.pile.service.PileMsgRecordService;
|
import com.jsowell.pile.service.PileMsgRecordService;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -32,7 +33,7 @@ public class RemoteRestartResponseHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[===远程重启应答===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===远程重启应答===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 消息体
|
// 消息体
|
||||||
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import com.jsowell.pile.domain.OrderBasicInfo;
|
|||||||
import com.jsowell.pile.service.OrderBasicInfoService;
|
import com.jsowell.pile.service.OrderBasicInfoService;
|
||||||
import com.jsowell.thirdparty.common.CommonService;
|
import com.jsowell.thirdparty.common.CommonService;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -41,7 +42,7 @@ public class RemoteStartChargingRequestHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[===远程启动充电命令回复===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===远程启动充电命令回复===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 消息体
|
// 消息体
|
||||||
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.jsowell.netty.factory.YKCOperateFactory;
|
|||||||
import com.jsowell.pile.domain.OrderBasicInfo;
|
import com.jsowell.pile.domain.OrderBasicInfo;
|
||||||
import com.jsowell.pile.service.OrderBasicInfoService;
|
import com.jsowell.pile.service.OrderBasicInfoService;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -37,7 +38,7 @@ public class RemoteStopChargingRequestHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[===远程停机命令回复===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===远程停机命令回复===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 获取消息体
|
// 获取消息体
|
||||||
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
|||||||
import com.jsowell.common.util.YKCUtils;
|
import com.jsowell.common.util.YKCUtils;
|
||||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -28,7 +29,7 @@ public class RemoteUpdateHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[===远程更新===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===远程更新===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 下发
|
// 下发
|
||||||
// 桩编号
|
// 桩编号
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.jsowell.common.util.BytesUtil;
|
|||||||
import com.jsowell.common.util.YKCUtils;
|
import com.jsowell.common.util.YKCUtils;
|
||||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -26,7 +27,7 @@ public class RemoteUpdateResponseHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[====远程更新应答====] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[====远程更新应答====] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 消息体
|
// 消息体
|
||||||
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.jsowell.common.util.BytesUtil;
|
|||||||
import com.jsowell.common.util.YKCUtils;
|
import com.jsowell.common.util.YKCUtils;
|
||||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -24,7 +25,7 @@ public class ReservationChargingResponseHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[====远程更新应答====] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[====远程更新应答====] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 消息体
|
// 消息体
|
||||||
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.jsowell.netty.factory.YKCOperateFactory;
|
|||||||
import com.jsowell.pile.dto.ReservationChargingStartupResult;
|
import com.jsowell.pile.dto.ReservationChargingStartupResult;
|
||||||
import com.jsowell.pile.service.PileBasicInfoService;
|
import com.jsowell.pile.service.PileBasicInfoService;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -33,7 +34,7 @@ public class ReservationChargingStartupResultHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
log.info("[===预约充电启动结果上送===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
log.info("[===预约充电启动结果上送===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 消息体
|
// 消息体
|
||||||
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.jsowell.common.util.BytesUtil;
|
|||||||
import com.jsowell.common.util.YKCUtils;
|
import com.jsowell.common.util.YKCUtils;
|
||||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -26,7 +27,7 @@ public class SettingPileWorkParamsHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[====平台设置工作参数回复====] param:{}", JSON.toJSONString(ykcDataProtocol));
|
// log.info("[====平台设置工作参数回复====] param:{}", JSON.toJSONString(ykcDataProtocol));
|
||||||
// 获取消息体
|
// 获取消息体
|
||||||
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
|
|||||||
import com.jsowell.common.util.YKCUtils;
|
import com.jsowell.common.util.YKCUtils;
|
||||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -27,7 +28,7 @@ public class TimeCheckSettingHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[===对时设置===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===对时设置===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 下发
|
// 下发
|
||||||
// 桩编号
|
// 桩编号
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.jsowell.common.util.DateUtils;
|
|||||||
import com.jsowell.common.util.YKCUtils;
|
import com.jsowell.common.util.YKCUtils;
|
||||||
import com.jsowell.netty.factory.YKCOperateFactory;
|
import com.jsowell.netty.factory.YKCOperateFactory;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -30,7 +31,7 @@ public class TimeCheckSettingResponseHandler extends AbstractHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[===对时设置应答===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===对时设置应答===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 消息体
|
// 消息体
|
||||||
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
||||||
@@ -50,7 +51,7 @@ public class TimeCheckSettingResponseHandler extends AbstractHandler{
|
|||||||
length = 7;
|
length = 7;
|
||||||
byte[] currentTimeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
byte[] currentTimeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||||
Date date = Cp56Time2aUtil.byte2Hdate(currentTimeByteArr);
|
Date date = Cp56Time2aUtil.byte2Hdate(currentTimeByteArr);
|
||||||
log.info("对时设置应答, pileSn:{}, channelId:{}, 充电桩当前时间:{}", pileSn, channel.id().asShortText(), DateUtils.formatDateTime(date));
|
log.info("对时设置应答, pileSn:{}, channelId:{}, 充电桩当前时间:{}", pileSn, channel.channel().id().asShortText(), DateUtils.formatDateTime(date));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import com.jsowell.pile.service.programlogic.AbstractProgramLogic;
|
|||||||
import com.jsowell.pile.service.programlogic.ProgramLogicFactory;
|
import com.jsowell.pile.service.programlogic.ProgramLogicFactory;
|
||||||
import com.jsowell.thirdparty.common.CommonService;
|
import com.jsowell.thirdparty.common.CommonService;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -321,7 +322,7 @@ public class TransactionRecordsRequestHandler extends AbstractHandler {
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[===交易记录===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===交易记录===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
// 获取消息体
|
// 获取消息体
|
||||||
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
byte[] msgBody = ykcDataProtocol.getMsgBody();
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import com.jsowell.pile.service.PileBasicInfoService;
|
|||||||
import com.jsowell.pile.service.OrderBasicInfoService;
|
import com.jsowell.pile.service.OrderBasicInfoService;
|
||||||
import com.jsowell.thirdparty.common.CommonService;
|
import com.jsowell.thirdparty.common.CommonService;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -59,7 +60,7 @@ public class UploadRealTimeMonitorHandler extends AbstractHandler {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext channel) {
|
||||||
// log.info("[===获取桩上传的实时监测数据===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
// log.info("[===获取桩上传的实时监测数据===] param:{}, channel:{}", JSON.toJSONString(ykcDataProtocol), channel.toString());
|
||||||
RealTimeMonitorData realTimeMonitorData = new RealTimeMonitorData();
|
RealTimeMonitorData realTimeMonitorData = new RealTimeMonitorData();
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package rpc;
|
package com.jsowell.netty.rpc;
|
||||||
|
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.ChannelPipeline;
|
import io.netty.channel.ChannelPipeline;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package rpc;
|
package com.jsowell.netty.rpc;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package rpc;
|
package com.jsowell.netty.rpc;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package rpc;
|
package com.jsowell.netty.rpc;
|
||||||
|
|
||||||
import com.jsowell.common.util.bean.SerializationUtil;
|
import com.jsowell.common.util.bean.SerializationUtil;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package rpc;
|
package com.jsowell.netty.rpc;
|
||||||
|
|
||||||
import com.jsowell.common.util.bean.SerializationUtil;
|
import com.jsowell.common.util.bean.SerializationUtil;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package rpc;
|
package com.jsowell.netty.rpc;
|
||||||
|
|
||||||
import io.netty.bootstrap.Bootstrap;
|
import io.netty.bootstrap.Bootstrap;
|
||||||
import io.netty.channel.*;
|
import io.netty.channel.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package rpc;
|
package com.jsowell.netty.rpc;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package rpc;
|
package com.jsowell.netty.rpc;
|
||||||
|
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.DefaultEventLoopGroup;
|
import io.netty.channel.DefaultEventLoopGroup;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package rpc;
|
package com.jsowell.netty.rpc;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package rpc;
|
package com.jsowell.netty.rpc;
|
||||||
|
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.SimpleChannelInboundHandler;
|
import io.netty.channel.SimpleChannelInboundHandler;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package rpc;
|
package com.jsowell.netty.rpc;
|
||||||
|
|
||||||
import io.netty.bootstrap.ServerBootstrap;
|
import io.netty.bootstrap.ServerBootstrap;
|
||||||
import io.netty.channel.*;
|
import io.netty.channel.*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package rpc;
|
package com.jsowell.netty.rpc;
|
||||||
|
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package rpc;
|
package com.jsowell.netty.rpc;
|
||||||
|
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
import io.netty.channel.ChannelPipeline;
|
import io.netty.channel.ChannelPipeline;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package rpc;
|
package com.jsowell.netty.rpc;
|
||||||
|
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package rpc;
|
package com.jsowell.netty.rpc;
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package rpc;
|
package com.jsowell.netty.rpc;
|
||||||
|
|
||||||
public class TestRpcServer {
|
public class TestRpcServer {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
@@ -92,7 +92,7 @@ public class ElectricBicyclesServerHandler extends ChannelInboundHandlerAdapter
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 处理数据
|
// 处理数据
|
||||||
byte[] response = ykcService.process(msg, channel);
|
byte[] response = ykcService.process(msg, ctx);
|
||||||
if (Objects.nonNull(response)) {
|
if (Objects.nonNull(response)) {
|
||||||
// 响应客户端
|
// 响应客户端
|
||||||
ByteBuf buffer = ctx.alloc().buffer().writeBytes(response);
|
ByteBuf buffer = ctx.alloc().buffer().writeBytes(response);
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ public class NettyServerHandler extends SimpleChannelInboundHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 处理数据
|
// 处理数据
|
||||||
byte[] response = ykcService.process(msg, channel);
|
byte[] response = ykcService.process(msg, ctx);
|
||||||
if (Objects.nonNull(response)) {
|
if (Objects.nonNull(response)) {
|
||||||
// 响应客户端
|
// 响应客户端
|
||||||
ByteBuf buffer = ctx.alloc().buffer().writeBytes(response);
|
ByteBuf buffer = ctx.alloc().buffer().writeBytes(response);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.jsowell.netty.service.electricbicycles;
|
package com.jsowell.netty.service.electricbicycles;
|
||||||
|
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelId;
|
import io.netty.channel.ChannelId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -12,10 +13,10 @@ public interface YKCBusinessService {
|
|||||||
* 处理桩发来的请求
|
* 处理桩发来的请求
|
||||||
* 不需要应答的返回null
|
* 不需要应答的返回null
|
||||||
* @param msg 请求报文
|
* @param msg 请求报文
|
||||||
* @param channel 通道信息
|
* @param ctx 通道信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
byte[] process(byte[] msg, Channel channel);
|
byte[] process(byte[] msg, ChannelHandlerContext ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 桩退出
|
* 桩退出
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import com.jsowell.pile.service.PileConnectorInfoService;
|
|||||||
import com.jsowell.pile.service.PileMsgRecordService;
|
import com.jsowell.pile.service.PileMsgRecordService;
|
||||||
import com.jsowell.pile.service.YKCPushCommandService;
|
import com.jsowell.pile.service.YKCPushCommandService;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelId;
|
import io.netty.channel.ChannelId;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -36,7 +37,7 @@ public class YKCBusinessServiceImpl2 implements YKCBusinessService {
|
|||||||
private YKCPushCommandService ykcPushCommandService;
|
private YKCPushCommandService ykcPushCommandService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] process(byte[] msg, Channel channel) {
|
public byte[] process(byte[] msg, ChannelHandlerContext ctx) {
|
||||||
if (!YKCUtils.checkMsg(msg)) {
|
if (!YKCUtils.checkMsg(msg)) {
|
||||||
// 校验不通过,丢弃消息
|
// 校验不通过,丢弃消息
|
||||||
return null;
|
return null;
|
||||||
@@ -46,7 +47,7 @@ public class YKCBusinessServiceImpl2 implements YKCBusinessService {
|
|||||||
String frameType = YKCUtils.frameType2Str(ykcDataProtocol.getFrameType());
|
String frameType = YKCUtils.frameType2Str(ykcDataProtocol.getFrameType());
|
||||||
// 获取业务处理handler
|
// 获取业务处理handler
|
||||||
AbstractHandler invokeStrategy = YKCOperateFactory.getInvokeStrategy(frameType);
|
AbstractHandler invokeStrategy = YKCOperateFactory.getInvokeStrategy(frameType);
|
||||||
return invokeStrategy.supplyProcess(ykcDataProtocol, channel);
|
return invokeStrategy.supplyProcess(ykcDataProtocol, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -56,7 +57,7 @@ public class YKCBusinessServiceImpl2 implements YKCBusinessService {
|
|||||||
if (StringUtils.isBlank(pileSn)) {
|
if (StringUtils.isBlank(pileSn)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
log.info("充电桩退出:{}, channelId:{}", pileSn, PileChannelEntity.getChannelByPileSn(pileSn).id());
|
log.info("充电桩退出:{}, channelId:{}", pileSn, PileChannelEntity.getChannelByPileSn(pileSn).channel().id());
|
||||||
|
|
||||||
// 充电桩断开连接,所有枪口都设置为【离线】
|
// 充电桩断开连接,所有枪口都设置为【离线】
|
||||||
pileConnectorInfoService.updateConnectorStatusByPileSn(pileSn, PileConnectorDataBaseStatusEnum.OFF_NETWORK.getValue());
|
pileConnectorInfoService.updateConnectorStatusByPileSn(pileSn, PileConnectorDataBaseStatusEnum.OFF_NETWORK.getValue());
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.jsowell.netty.service.yunkuaichong;
|
package com.jsowell.netty.service.yunkuaichong;
|
||||||
|
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelId;
|
import io.netty.channel.ChannelId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -12,10 +13,10 @@ public interface YKCBusinessService {
|
|||||||
* 处理桩发来的请求
|
* 处理桩发来的请求
|
||||||
* 不需要应答的返回null
|
* 不需要应答的返回null
|
||||||
* @param msg 请求报文
|
* @param msg 请求报文
|
||||||
* @param channel 通道信息
|
* @param ctx 通道信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
byte[] process(byte[] msg, Channel channel);
|
byte[] process(byte[] msg, ChannelHandlerContext ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 桩退出
|
* 桩退出
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import com.jsowell.pile.service.PileMsgRecordService;
|
|||||||
import com.jsowell.pile.service.OrderBasicInfoService;
|
import com.jsowell.pile.service.OrderBasicInfoService;
|
||||||
import com.jsowell.pile.service.YKCPushCommandService;
|
import com.jsowell.pile.service.YKCPushCommandService;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelId;
|
import io.netty.channel.ChannelId;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -36,7 +37,7 @@ public class YKCBusinessServiceImpl implements YKCBusinessService {
|
|||||||
private YKCPushCommandService ykcPushCommandService;
|
private YKCPushCommandService ykcPushCommandService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] process(byte[] msg, Channel channel) {
|
public byte[] process(byte[] msg, ChannelHandlerContext ctx) {
|
||||||
if (!YKCUtils.checkMsg(msg)) {
|
if (!YKCUtils.checkMsg(msg)) {
|
||||||
// 校验不通过,丢弃消息
|
// 校验不通过,丢弃消息
|
||||||
return null;
|
return null;
|
||||||
@@ -46,7 +47,7 @@ public class YKCBusinessServiceImpl implements YKCBusinessService {
|
|||||||
String frameType = YKCUtils.frameType2Str(ykcDataProtocol.getFrameType());
|
String frameType = YKCUtils.frameType2Str(ykcDataProtocol.getFrameType());
|
||||||
// 获取业务处理handler
|
// 获取业务处理handler
|
||||||
AbstractHandler invokeStrategy = YKCOperateFactory.getInvokeStrategy(frameType);
|
AbstractHandler invokeStrategy = YKCOperateFactory.getInvokeStrategy(frameType);
|
||||||
return invokeStrategy.supplyProcess(ykcDataProtocol, channel);
|
return invokeStrategy.supplyProcess(ykcDataProtocol, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -56,7 +57,7 @@ public class YKCBusinessServiceImpl implements YKCBusinessService {
|
|||||||
if (StringUtils.isBlank(pileSn)) {
|
if (StringUtils.isBlank(pileSn)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
log.info("充电桩退出:{}, channelId:{}", pileSn, PileChannelEntity.getChannelByPileSn(pileSn).id());
|
log.info("充电桩退出:{}, channelId:{}", pileSn, PileChannelEntity.getChannelByPileSn(pileSn).channel().id());
|
||||||
|
|
||||||
// 充电桩断开连接,所有枪口都设置为【离线】
|
// 充电桩断开连接,所有枪口都设置为【离线】
|
||||||
pileConnectorInfoService.updateConnectorStatusByPileSn(pileSn, PileConnectorDataBaseStatusEnum.OFF_NETWORK.getValue());
|
pileConnectorInfoService.updateConnectorStatusByPileSn(pileSn, PileConnectorDataBaseStatusEnum.OFF_NETWORK.getValue());
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import io.netty.buffer.ByteBuf;
|
|||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelFuture;
|
import io.netty.channel.ChannelFuture;
|
||||||
import io.netty.channel.ChannelFutureListener;
|
import io.netty.channel.ChannelFutureListener;
|
||||||
|
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.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -71,9 +72,9 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
|
|||||||
*/
|
*/
|
||||||
public boolean push(byte[] msg, String pileSn, Enum<YKCFrameTypeCode> frameTypeCode) {
|
public boolean push(byte[] msg, String pileSn, Enum<YKCFrameTypeCode> frameTypeCode) {
|
||||||
// 通过桩编号获取channel
|
// 通过桩编号获取channel
|
||||||
Channel channel = PileChannelEntity.getChannelByPileSn(pileSn);
|
ChannelHandlerContext ctx = PileChannelEntity.getChannelByPileSn(pileSn);
|
||||||
String value = ((YKCFrameTypeCode) frameTypeCode).getValue();
|
String value = ((YKCFrameTypeCode) frameTypeCode).getValue();
|
||||||
if (Objects.isNull(channel)) {
|
if (Objects.isNull(ctx)) {
|
||||||
log.error("push命令[{}]失败, 桩号:{}无法获取到长连接, 请检查充电桩连接状态!", value, pileSn);
|
log.error("push命令[{}]失败, 桩号:{}无法获取到长连接, 请检查充电桩连接状态!", value, pileSn);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -106,18 +107,18 @@ public class YKCPushCommandServiceImpl implements YKCPushCommandService {
|
|||||||
|
|
||||||
// 返回完整的报文 string类型
|
// 返回完整的报文 string类型
|
||||||
String wholeMsg = BytesUtil.binary(writeMsg, 16);
|
String wholeMsg = BytesUtil.binary(writeMsg, 16);
|
||||||
ByteBuf byteBuf = channel.alloc().buffer().writeBytes(writeMsg);
|
ByteBuf byteBuf = ctx.channel().alloc().buffer().writeBytes(writeMsg);
|
||||||
ChannelFuture channelFuture = channel.writeAndFlush(byteBuf);
|
ChannelFuture channelFuture = ctx.channel().writeAndFlush(byteBuf);
|
||||||
channelFuture.addListener((ChannelFutureListener) channelFutureListener -> {
|
channelFuture.addListener((ChannelFutureListener) channelFutureListener -> {
|
||||||
// 检查操作的状态
|
// 检查操作的状态
|
||||||
if (channelFutureListener.isSuccess()) {
|
if (channelFutureListener.isSuccess()) {
|
||||||
log.info("【push结果===>成功】, pileSn:{}, remoteAddress:{}, channelId:{}, 帧类型:{}, 报文:{}",
|
log.info("【push结果===>成功】, pileSn:{}, remoteAddress:{}, channelId:{}, 帧类型:{}, 报文:{}",
|
||||||
pileSn, channel.remoteAddress(), channel.id(), value, wholeMsg);
|
pileSn, ctx.channel().remoteAddress(), ctx.channel().id(), value, wholeMsg);
|
||||||
} else {
|
} else {
|
||||||
// 如果发生错误,则访问描述原因的Throwable
|
// 如果发生错误,则访问描述原因的Throwable
|
||||||
Throwable cause = channelFutureListener.cause();
|
Throwable cause = channelFutureListener.cause();
|
||||||
log.info("【push结果===>失败】, pileSn:{}, remoteAddress:{}, channelId:{}, 帧类型:{}, 报文:{}",
|
log.info("【push结果===>失败】, pileSn:{}, remoteAddress:{}, channelId:{}, 帧类型:{}, 报文:{}",
|
||||||
pileSn, channel.remoteAddress(), channel.id(), value, wholeMsg);
|
pileSn, ctx.channel().remoteAddress(), ctx.channel().id(), value, wholeMsg);
|
||||||
log.error("push发送命令失败, pileSn:{}", pileSn, cause);
|
log.error("push发送命令失败, pileSn:{}", pileSn, cause);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user