update 校验channel

This commit is contained in:
2023-11-24 11:30:53 +08:00
parent 6de417c059
commit f2fac36715
30 changed files with 39 additions and 38 deletions

View File

@@ -1529,7 +1529,7 @@ public class SpringBootTestController {
String pileSn = BytesUtil.binary(pileSnByteArr, 16); String pileSn = BytesUtil.binary(pileSnByteArr, 16);
// 保存时间 // 保存时间
// saveLastTime(pileSn); // saveLastTime(pileSn, channel);
// 枪号 // 枪号
startIndex += length; startIndex += length;

View File

@@ -5,6 +5,7 @@ import com.jsowell.common.constant.CacheConstants;
import com.jsowell.common.core.domain.ykc.YKCDataProtocol; import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode; import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
import com.jsowell.common.core.redis.RedisCache; import com.jsowell.common.core.redis.RedisCache;
import com.jsowell.common.enums.ykc.PileChannelEntity;
import com.jsowell.common.util.BytesUtil; 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;
@@ -65,9 +66,12 @@ public abstract class AbstractHandler implements InitializingBean {
* 保存桩最后链接到平台的时间 * 保存桩最后链接到平台的时间
* @param pileSn 桩编号 * @param pileSn 桩编号
*/ */
protected void saveLastTime(String pileSn) { protected void saveLastTime(String pileSn, Channel channel) {
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的关系
PileChannelEntity.checkChannel(pileSn, channel);
} }
} }

View File

@@ -46,7 +46,7 @@ public class BMSAbortDuringChargingPhaseHandler extends AbstractHandler{
String pileSn = BytesUtil.bcd2Str(pileSnByteArr); String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
// 保存时间 // 保存时间
saveLastTime(pileSn); saveLastTime(pileSn, channel);
// 枪号 // 枪号
startIndex += length; startIndex += length;

View File

@@ -45,7 +45,7 @@ public class BMSDemandAndChargerOutputHandler extends AbstractHandler{
String pileSn = BytesUtil.bcd2Str(pileSnByteArr); String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
// 保存时间 // 保存时间
saveLastTime(pileSn); saveLastTime(pileSn, channel);
// 枪号 // 枪号
startIndex += length; startIndex += length;

View File

@@ -45,7 +45,7 @@ public class BMSInformationHandler extends AbstractHandler{
String pileSn = BytesUtil.bcd2Str(pileSnByteArr); String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
// 保存时间 // 保存时间
saveLastTime(pileSn); saveLastTime(pileSn, channel);
// 枪号 // 枪号
startIndex += length; startIndex += length;

View File

@@ -45,7 +45,7 @@ public class BillingTemplateRequestHandler extends AbstractHandler{
// log.info("桩号:{}", pileSn); // log.info("桩号:{}", pileSn);
// 保存时间 // 保存时间
saveLastTime(pileSn); saveLastTime(pileSn, channel);
// 根据桩号查询计费模板 // 根据桩号查询计费模板
BillingTemplateVO billingTemplateVO = pileBillingTemplateService.selectBillingTemplateDetailByPileSn(pileSn); BillingTemplateVO billingTemplateVO = pileBillingTemplateService.selectBillingTemplateDetailByPileSn(pileSn);

View File

@@ -36,7 +36,7 @@ public class BillingTemplateResponseHandler extends AbstractHandler{
String pileSn = BytesUtil.bcd2Str(pileSnByteArr); String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
// 保存时间 // 保存时间
saveLastTime(pileSn); saveLastTime(pileSn, channel);
// 设置结果 0x00 失败 0x01 成功 // 设置结果 0x00 失败 0x01 成功
byte[] settingResultByteArr = BytesUtil.copyBytes(msgBody, 7, 1); byte[] settingResultByteArr = BytesUtil.copyBytes(msgBody, 7, 1);

View File

@@ -51,7 +51,7 @@ public class BillingTemplateValidateRequestHandler extends AbstractHandler{
String pileSn = BytesUtil.binary(pileSnByte, 16); String pileSn = BytesUtil.binary(pileSnByte, 16);
// 保存时间 // 保存时间
saveLastTime(pileSn); saveLastTime(pileSn, channel);
// 计费模型编码 // 计费模型编码
startIndex += length; startIndex += length;

View File

@@ -76,7 +76,7 @@ public class ChargeEndHandler extends AbstractHandler{
String pileSn = BytesUtil.bcd2Str(pileSnByteArr); String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
// 保存时间 // 保存时间
saveLastTime(pileSn); saveLastTime(pileSn, channel);
// 枪号 // 枪号
startIndex += length; startIndex += length;

View File

@@ -45,7 +45,7 @@ public class ChargerAbortedDuringChargingPhaseHandler extends AbstractHandler{
String pileSn = BytesUtil.bcd2Str(pileSnByteArr); String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
// 保存时间 // 保存时间
saveLastTime(pileSn); saveLastTime(pileSn, channel);
// 枪号 // 枪号
startIndex += length; startIndex += length;

View File

@@ -45,7 +45,7 @@ public class ChargingHandshakeHandler extends AbstractHandler{
String pileSn = BytesUtil.bcd2Str(pileSnByteArr); String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
// 保存时间 // 保存时间
saveLastTime(pileSn); saveLastTime(pileSn, channel);
// 枪号 // 枪号
startIndex += length; startIndex += length;

View File

@@ -71,7 +71,7 @@ public class ConfirmStartChargingRequestHandler extends AbstractHandler{
String pileSn = BytesUtil.binary(pileSnByteArr, 16); String pileSn = BytesUtil.binary(pileSnByteArr, 16);
// 保存时间 // 保存时间
saveLastTime(pileSn); saveLastTime(pileSn, channel);
// 枪号 // 枪号
startIndex += length; startIndex += length;

View File

@@ -46,7 +46,7 @@ public class ErrorMessageHandler extends AbstractHandler{
String pileSn = BytesUtil.bcd2Str(pileSnByteArr); String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
// 保存时间 // 保存时间
saveLastTime(pileSn); saveLastTime(pileSn, channel);
// 枪号 // 枪号
startIndex += length; startIndex += length;

View File

@@ -4,7 +4,6 @@ import com.google.common.primitives.Bytes;
import com.jsowell.common.constant.Constants; import com.jsowell.common.constant.Constants;
import com.jsowell.common.core.domain.ykc.YKCDataProtocol; import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode; import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
import com.jsowell.common.enums.ykc.PileChannelEntity;
import com.jsowell.common.util.BytesUtil; 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;
@@ -45,10 +44,10 @@ public class HeartbeatRequestHandler extends AbstractHandler {
String pileSn = BytesUtil.binary(pileSnByte, 16); String pileSn = BytesUtil.binary(pileSnByte, 16);
// 保存时间 // 保存时间
saveLastTime(pileSn); saveLastTime(pileSn, channel);
// 校验channel // 校验channel
PileChannelEntity.checkChannel(pileSn, channel); // PileChannelEntity.checkChannel(pileSn, channel);
// 枪号 // 枪号
startIndex += length; startIndex += length;

View File

@@ -8,16 +8,15 @@ import com.jsowell.common.core.domain.ykc.LoginRequestData;
import com.jsowell.common.core.domain.ykc.YKCDataProtocol; import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode; import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
import com.jsowell.common.core.redis.RedisCache; import com.jsowell.common.core.redis.RedisCache;
import com.jsowell.common.enums.ykc.PileChannelEntity;
import com.jsowell.common.util.BytesUtil; import com.jsowell.common.util.BytesUtil;
import com.jsowell.common.util.StringUtils; import com.jsowell.common.util.StringUtils;
import com.jsowell.common.util.YKCUtils; import com.jsowell.common.util.YKCUtils;
import com.jsowell.netty.factory.YKCOperateFactory;
import com.jsowell.pile.domain.ykcCommond.IssueQRCodeCommand; import com.jsowell.pile.domain.ykcCommond.IssueQRCodeCommand;
import com.jsowell.pile.domain.ykcCommond.ProofreadTimeCommand; import com.jsowell.pile.domain.ykcCommond.ProofreadTimeCommand;
import com.jsowell.netty.factory.YKCOperateFactory;
import com.jsowell.pile.service.YKCPushCommandService;
import com.jsowell.pile.service.IPileBasicInfoService; import com.jsowell.pile.service.IPileBasicInfoService;
import com.jsowell.pile.service.IPileMsgRecordService; import com.jsowell.pile.service.IPileMsgRecordService;
import com.jsowell.pile.service.YKCPushCommandService;
import com.jsowell.pile.vo.base.PileInfoVO; import com.jsowell.pile.vo.base.PileInfoVO;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@@ -125,7 +124,7 @@ public class LoginRequestHandler extends AbstractHandler {
// log.info("桩号:{}", pileSn); // log.info("桩号:{}", pileSn);
// 保存时间 // 保存时间
saveLastTime(pileSn); saveLastTime(pileSn, channel);
// 桩类型 0 表示直流桩, 1 表示交流桩 // 桩类型 0 表示直流桩, 1 表示交流桩
startIndex += length; startIndex += length;
@@ -196,7 +195,7 @@ public class LoginRequestHandler extends AbstractHandler {
if (pileInfoVO != null) { if (pileInfoVO != null) {
flag = Constants.zeroByteArray; flag = Constants.zeroByteArray;
// 登录成功保存桩号和channel的关系 // 登录成功保存桩号和channel的关系
PileChannelEntity.checkChannel(pileSn, channel); // PileChannelEntity.checkChannel(pileSn, channel);
// 更改桩和该桩下的枪口状态分别为 在线、空闲 公共方法修改状态 // 更改桩和该桩下的枪口状态分别为 在线、空闲 公共方法修改状态
pileBasicInfoService.updateStatus(BytesUtil.bcd2Str(ykcDataProtocol.getFrameType()), pileSn, null, null, null); pileBasicInfoService.updateStatus(BytesUtil.bcd2Str(ykcDataProtocol.getFrameType()), pileSn, null, null, null);

View File

@@ -39,7 +39,7 @@ public class OfflineCardDataCleaningResponseHandler extends AbstractHandler{
String pileSn = BytesUtil.bcd2Str(pileSnByteArr); String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
// 保存时间 // 保存时间
saveLastTime(pileSn); saveLastTime(pileSn, channel);
// 第 1 个卡物理卡号 // 第 1 个卡物理卡号
startIndex += length; startIndex += length;

View File

@@ -39,7 +39,7 @@ public class OfflineCardDataQueryResponseHandler extends AbstractHandler{
String pileSn = BytesUtil.bcd2Str(pileSnByteArr); String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
// 保存时间 // 保存时间
saveLastTime(pileSn); saveLastTime(pileSn, channel);
// 第1个卡物理卡号 // 第1个卡物理卡号
startIndex += length; startIndex += length;

View File

@@ -39,7 +39,7 @@ public class OfflineCardDataSynchronizationResponseHandler extends AbstractHandl
String pileSn = BytesUtil.bcd2Str(pileSnByteArr); String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
// 保存时间 // 保存时间
saveLastTime(pileSn); saveLastTime(pileSn, channel);
// 保存结果 0x00 失败 0x01 成功 // 保存结果 0x00 失败 0x01 成功
startIndex += length; startIndex += length;

View File

@@ -54,7 +54,7 @@ public class ParameterConfigurationHandler extends AbstractHandler{
String pileSn = BytesUtil.bcd2Str(pileSnByteArr); String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
// 保存时间 // 保存时间
saveLastTime(pileSn); saveLastTime(pileSn, channel);
// 枪号 // 枪号
startIndex += length; startIndex += length;

View File

@@ -39,7 +39,7 @@ public class PileWorkingParameterSettingResponseHandler extends AbstractHandler{
String pileSn = BytesUtil.bcd2Str(pileSnByteArr); String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
// 保存时间 // 保存时间
saveLastTime(pileSn); saveLastTime(pileSn, channel);
// 设置结果 // 设置结果
startIndex += length; startIndex += length;

View File

@@ -39,7 +39,7 @@ public class QueryPileWorkParamsHandler extends AbstractHandler{
String pileSn = BytesUtil.binary(pileSnByte, 16); String pileSn = BytesUtil.binary(pileSnByte, 16);
// 保存时间 // 保存时间
saveLastTime(pileSn); saveLastTime(pileSn, channel);
// 充电桩类型 0x00:直流0x01:交流 // 充电桩类型 0x00:直流0x01:交流
startIndex += length; startIndex += length;

View File

@@ -39,7 +39,7 @@ public class RemoteAccountBalanceUpdateRequestHandler extends AbstractHandler{
String pileSn = BytesUtil.bcd2Str(pileSnByteArr); String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
// 保存时间 // 保存时间
saveLastTime(pileSn); saveLastTime(pileSn, channel);
// 枪号 // 枪号
startIndex += length; startIndex += length;

View File

@@ -39,7 +39,7 @@ public class RemoteIssuedQrCodeResponseHandler extends AbstractHandler{
String pileSn = BytesUtil.bcd2Str(pileSnByteArr); String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
// 保存时间 // 保存时间
saveLastTime(pileSn); saveLastTime(pileSn, channel);
// 下发结果 0x00成功 0x01失败 // 下发结果 0x00成功 0x01失败
startIndex += length; startIndex += length;

View File

@@ -45,7 +45,7 @@ public class RemoteRestartResponseHandler extends AbstractHandler{
String pileSn = BytesUtil.bcd2Str(pileSnByteArr); String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
// 保存时间 // 保存时间
saveLastTime(pileSn); saveLastTime(pileSn, channel);
// 保存报文 // 保存报文
String jsonMsg = JSONObject.toJSONString(ykcDataProtocol); String jsonMsg = JSONObject.toJSONString(ykcDataProtocol);

View File

@@ -53,7 +53,7 @@ public class RemoteStartChargingRequestHandler extends AbstractHandler{
String pileSn = BytesUtil.bcd2Str(pileSnByteArr); String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
// 保存时间 // 保存时间
saveLastTime(pileSn); saveLastTime(pileSn, channel);
// 枪号 // 枪号
startIndex += length; startIndex += length;

View File

@@ -50,7 +50,7 @@ public class RemoteStopChargingRequestHandler extends AbstractHandler{
String pileSn = BytesUtil.bcd2Str(pileSnByteArr); String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
// 保存时间 // 保存时间
saveLastTime(pileSn); saveLastTime(pileSn, channel);
// 枪号 // 枪号
startIndex += length; startIndex += length;

View File

@@ -39,7 +39,7 @@ public class RemoteUpdateResponseHandler extends AbstractHandler{
String pileSn = BytesUtil.bcd2Str(pileSnByteArr); String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
// 保存时间 // 保存时间
saveLastTime(pileSn); saveLastTime(pileSn, channel);
// 升级状态 0x00-成功 0x01-编号错误 0x02-程序与桩型号不符 0x03-下载更新文件超时 // 升级状态 0x00-成功 0x01-编号错误 0x02-程序与桩型号不符 0x03-下载更新文件超时
startIndex += length; startIndex += length;

View File

@@ -39,7 +39,7 @@ public class SettingPileWorkParamsHandler extends AbstractHandler{
String pileSn = BytesUtil.binary(pileSnByte, 16); String pileSn = BytesUtil.binary(pileSnByte, 16);
// 保存时间 // 保存时间
saveLastTime(pileSn); saveLastTime(pileSn, channel);
// 设置状态 0x00-成功 0x01-失败 // 设置状态 0x00-成功 0x01-失败
startIndex += length; startIndex += length;

View File

@@ -40,7 +40,7 @@ public class TimeCheckSettingResponseHandler extends AbstractHandler{
String pileSn = BytesUtil.bcd2Str(pileSnByteArr); String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
// 保存时间 // 保存时间
saveLastTime(pileSn); saveLastTime(pileSn, channel);
// 当前时间 // 当前时间
startIndex += length; startIndex += length;

View File

@@ -9,7 +9,6 @@ import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
import com.jsowell.common.core.redis.RedisCache; import com.jsowell.common.core.redis.RedisCache;
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum; import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
import com.jsowell.common.enums.ykc.OrderStatusEnum; import com.jsowell.common.enums.ykc.OrderStatusEnum;
import com.jsowell.common.enums.ykc.PileChannelEntity;
import com.jsowell.common.enums.ykc.StartModeEnum; import com.jsowell.common.enums.ykc.StartModeEnum;
import com.jsowell.common.enums.ykc.YKCPileFaultReasonEnum; import com.jsowell.common.enums.ykc.YKCPileFaultReasonEnum;
import com.jsowell.common.util.BytesUtil; import com.jsowell.common.util.BytesUtil;
@@ -107,10 +106,10 @@ public class UploadRealTimeMonitorHandler extends AbstractHandler {
realTimeMonitorData.setPileSn(pileSn); realTimeMonitorData.setPileSn(pileSn);
// 保存时间 // 保存时间
saveLastTime(pileSn); saveLastTime(pileSn, channel);
// 校验channel // 校验channel
PileChannelEntity.checkChannel(pileSn, channel); // PileChannelEntity.checkChannel(pileSn, channel);
// 枪号 // 枪号
startIndex += length; startIndex += length;