mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 03:25:12 +08:00
update
This commit is contained in:
@@ -66,7 +66,7 @@ public abstract class AbstractHandler implements InitializingBean {
|
||||
* 保存桩最后链接到平台的时间
|
||||
* @param pileSn 桩编号
|
||||
*/
|
||||
protected void saveLastTime(String pileSn, Channel channel) {
|
||||
protected void saveLastTimeAndCheckChannel(String pileSn, Channel channel) {
|
||||
String redisKey = CacheConstants.PILE_LAST_CONNECTION + pileSn;
|
||||
redisCache.setCacheObject(redisKey, DateUtils.getDateTime(), CacheConstants.cache_expire_time_1d);
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public class BMSAbortDuringChargingPhaseHandler extends AbstractHandler{
|
||||
String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
|
||||
|
||||
// 保存时间
|
||||
saveLastTime(pileSn, channel);
|
||||
saveLastTimeAndCheckChannel(pileSn, channel);
|
||||
|
||||
// 枪号
|
||||
startIndex += length;
|
||||
|
||||
@@ -45,7 +45,7 @@ public class BMSDemandAndChargerOutputHandler extends AbstractHandler{
|
||||
String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
|
||||
|
||||
// 保存时间
|
||||
saveLastTime(pileSn, channel);
|
||||
saveLastTimeAndCheckChannel(pileSn, channel);
|
||||
|
||||
// 枪号
|
||||
startIndex += length;
|
||||
|
||||
@@ -45,7 +45,7 @@ public class BMSInformationHandler extends AbstractHandler{
|
||||
String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
|
||||
|
||||
// 保存时间
|
||||
saveLastTime(pileSn, channel);
|
||||
saveLastTimeAndCheckChannel(pileSn, channel);
|
||||
|
||||
// 枪号
|
||||
startIndex += length;
|
||||
|
||||
@@ -45,7 +45,7 @@ public class BillingTemplateRequestHandler extends AbstractHandler{
|
||||
// log.info("桩号:{}", pileSn);
|
||||
|
||||
// 保存时间
|
||||
saveLastTime(pileSn, channel);
|
||||
saveLastTimeAndCheckChannel(pileSn, channel);
|
||||
|
||||
// 根据桩号查询计费模板
|
||||
BillingTemplateVO billingTemplateVO = pileBillingTemplateService.selectBillingTemplateDetailByPileSn(pileSn);
|
||||
|
||||
@@ -36,7 +36,7 @@ public class BillingTemplateResponseHandler extends AbstractHandler{
|
||||
String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
|
||||
|
||||
// 保存时间
|
||||
saveLastTime(pileSn, channel);
|
||||
saveLastTimeAndCheckChannel(pileSn, channel);
|
||||
|
||||
// 设置结果 0x00 失败 0x01 成功
|
||||
byte[] settingResultByteArr = BytesUtil.copyBytes(msgBody, 7, 1);
|
||||
|
||||
@@ -51,7 +51,7 @@ public class BillingTemplateValidateRequestHandler extends AbstractHandler{
|
||||
String pileSn = BytesUtil.binary(pileSnByte, 16);
|
||||
|
||||
// 保存时间
|
||||
saveLastTime(pileSn, channel);
|
||||
saveLastTimeAndCheckChannel(pileSn, channel);
|
||||
|
||||
// 计费模型编码
|
||||
startIndex += length;
|
||||
|
||||
@@ -76,7 +76,7 @@ public class ChargeEndHandler extends AbstractHandler{
|
||||
String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
|
||||
|
||||
// 保存时间
|
||||
saveLastTime(pileSn, channel);
|
||||
saveLastTimeAndCheckChannel(pileSn, channel);
|
||||
|
||||
// 枪号
|
||||
startIndex += length;
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ChargerAbortedDuringChargingPhaseHandler extends AbstractHandler{
|
||||
String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
|
||||
|
||||
// 保存时间
|
||||
saveLastTime(pileSn, channel);
|
||||
saveLastTimeAndCheckChannel(pileSn, channel);
|
||||
|
||||
// 枪号
|
||||
startIndex += length;
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ChargingHandshakeHandler extends AbstractHandler{
|
||||
String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
|
||||
|
||||
// 保存时间
|
||||
saveLastTime(pileSn, channel);
|
||||
saveLastTimeAndCheckChannel(pileSn, channel);
|
||||
|
||||
// 枪号
|
||||
startIndex += length;
|
||||
|
||||
@@ -71,7 +71,7 @@ public class ConfirmStartChargingRequestHandler extends AbstractHandler{
|
||||
String pileSn = BytesUtil.binary(pileSnByteArr, 16);
|
||||
|
||||
// 保存时间
|
||||
saveLastTime(pileSn, channel);
|
||||
saveLastTimeAndCheckChannel(pileSn, channel);
|
||||
|
||||
// 枪号
|
||||
startIndex += length;
|
||||
|
||||
@@ -46,7 +46,7 @@ public class ErrorMessageHandler extends AbstractHandler{
|
||||
String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
|
||||
|
||||
// 保存时间
|
||||
saveLastTime(pileSn, channel);
|
||||
saveLastTimeAndCheckChannel(pileSn, channel);
|
||||
|
||||
// 枪号
|
||||
startIndex += length;
|
||||
|
||||
@@ -44,7 +44,7 @@ public class HeartbeatRequestHandler extends AbstractHandler {
|
||||
String pileSn = BytesUtil.binary(pileSnByte, 16);
|
||||
|
||||
// 保存时间
|
||||
saveLastTime(pileSn, channel);
|
||||
saveLastTimeAndCheckChannel(pileSn, channel);
|
||||
|
||||
// 校验channel
|
||||
// PileChannelEntity.checkChannel(pileSn, channel);
|
||||
|
||||
@@ -124,7 +124,7 @@ public class LoginRequestHandler extends AbstractHandler {
|
||||
// log.info("桩号:{}", pileSn);
|
||||
|
||||
// 保存时间
|
||||
saveLastTime(pileSn, channel);
|
||||
saveLastTimeAndCheckChannel(pileSn, channel);
|
||||
|
||||
// 桩类型 0 表示直流桩, 1 表示交流桩
|
||||
startIndex += length;
|
||||
@@ -194,10 +194,15 @@ public class LoginRequestHandler extends AbstractHandler {
|
||||
|
||||
if (pileInfoVO != null) {
|
||||
flag = Constants.zeroByteArray;
|
||||
// 登录成功,保存桩号和channel的关系
|
||||
// PileChannelEntity.checkChannel(pileSn, channel);
|
||||
// 更改桩和该桩下的枪口状态分别为 在线、空闲 公共方法修改状态
|
||||
pileBasicInfoService.updateStatus(BytesUtil.bcd2Str(ykcDataProtocol.getFrameType()), pileSn, null, null, null);
|
||||
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
// 更改桩和该桩下的枪口状态分别为 在线、空闲 公共方法修改状态
|
||||
pileBasicInfoService.updateStatus(BytesUtil.bcd2Str(ykcDataProtocol.getFrameType()), pileSn, null, null, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
@@ -233,12 +238,17 @@ public class LoginRequestHandler extends AbstractHandler {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 保存报文 TODO 没有登录认证通过还要不要保存报文?
|
||||
String jsonMsg = JSONObject.toJSONString(loginRequestData);
|
||||
pileMsgRecordService.save(pileSn, pileSn, type, jsonMsg, ykcDataProtocol.getHEXString());
|
||||
CompletableFuture.runAsync(() -> {
|
||||
// 保存报文 没有登录认证通过还要不要保存报文?
|
||||
try {
|
||||
String jsonMsg = JSONObject.toJSONString(loginRequestData);
|
||||
pileMsgRecordService.save(pileSn, pileSn, type, jsonMsg, ykcDataProtocol.getHEXString());
|
||||
} catch (Exception e) {
|
||||
log.error("保存报文失败pileSn:{}", pileSn, e);
|
||||
}
|
||||
});
|
||||
|
||||
// 消息体
|
||||
byte[] messageBody = Bytes.concat(pileSnByte, flag);
|
||||
|
||||
@@ -39,7 +39,7 @@ public class OfflineCardDataCleaningResponseHandler extends AbstractHandler{
|
||||
String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
|
||||
|
||||
// 保存时间
|
||||
saveLastTime(pileSn, channel);
|
||||
saveLastTimeAndCheckChannel(pileSn, channel);
|
||||
|
||||
// 第 1 个卡物理卡号
|
||||
startIndex += length;
|
||||
|
||||
@@ -39,7 +39,7 @@ public class OfflineCardDataQueryResponseHandler extends AbstractHandler{
|
||||
String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
|
||||
|
||||
// 保存时间
|
||||
saveLastTime(pileSn, channel);
|
||||
saveLastTimeAndCheckChannel(pileSn, channel);
|
||||
|
||||
// 第1个卡物理卡号
|
||||
startIndex += length;
|
||||
|
||||
@@ -39,7 +39,7 @@ public class OfflineCardDataSynchronizationResponseHandler extends AbstractHandl
|
||||
String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
|
||||
|
||||
// 保存时间
|
||||
saveLastTime(pileSn, channel);
|
||||
saveLastTimeAndCheckChannel(pileSn, channel);
|
||||
|
||||
// 保存结果 0x00 失败 0x01 成功
|
||||
startIndex += length;
|
||||
|
||||
@@ -54,7 +54,7 @@ public class ParameterConfigurationHandler extends AbstractHandler{
|
||||
String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
|
||||
|
||||
// 保存时间
|
||||
saveLastTime(pileSn, channel);
|
||||
saveLastTimeAndCheckChannel(pileSn, channel);
|
||||
|
||||
// 枪号
|
||||
startIndex += length;
|
||||
|
||||
@@ -39,7 +39,7 @@ public class PileWorkingParameterSettingResponseHandler extends AbstractHandler{
|
||||
String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
|
||||
|
||||
// 保存时间
|
||||
saveLastTime(pileSn, channel);
|
||||
saveLastTimeAndCheckChannel(pileSn, channel);
|
||||
|
||||
// 设置结果
|
||||
startIndex += length;
|
||||
|
||||
@@ -39,7 +39,7 @@ public class QueryPileWorkParamsHandler extends AbstractHandler{
|
||||
String pileSn = BytesUtil.binary(pileSnByte, 16);
|
||||
|
||||
// 保存时间
|
||||
saveLastTime(pileSn, channel);
|
||||
saveLastTimeAndCheckChannel(pileSn, channel);
|
||||
|
||||
// 充电桩类型 0x00:直流0x01:交流
|
||||
startIndex += length;
|
||||
|
||||
@@ -39,7 +39,7 @@ public class RemoteAccountBalanceUpdateRequestHandler extends AbstractHandler{
|
||||
String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
|
||||
|
||||
// 保存时间
|
||||
saveLastTime(pileSn, channel);
|
||||
saveLastTimeAndCheckChannel(pileSn, channel);
|
||||
|
||||
// 枪号
|
||||
startIndex += length;
|
||||
|
||||
@@ -39,7 +39,7 @@ public class RemoteIssuedQrCodeResponseHandler extends AbstractHandler{
|
||||
String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
|
||||
|
||||
// 保存时间
|
||||
saveLastTime(pileSn, channel);
|
||||
saveLastTimeAndCheckChannel(pileSn, channel);
|
||||
|
||||
// 下发结果 0x00:成功 0x01:失败
|
||||
startIndex += length;
|
||||
|
||||
@@ -45,7 +45,7 @@ public class RemoteRestartResponseHandler extends AbstractHandler{
|
||||
String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
|
||||
|
||||
// 保存时间
|
||||
saveLastTime(pileSn, channel);
|
||||
saveLastTimeAndCheckChannel(pileSn, channel);
|
||||
|
||||
// 保存报文
|
||||
String jsonMsg = JSONObject.toJSONString(ykcDataProtocol);
|
||||
|
||||
@@ -53,7 +53,7 @@ public class RemoteStartChargingRequestHandler extends AbstractHandler{
|
||||
String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
|
||||
|
||||
// 保存时间
|
||||
saveLastTime(pileSn, channel);
|
||||
saveLastTimeAndCheckChannel(pileSn, channel);
|
||||
|
||||
// 枪号
|
||||
startIndex += length;
|
||||
|
||||
@@ -50,7 +50,7 @@ public class RemoteStopChargingRequestHandler extends AbstractHandler{
|
||||
String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
|
||||
|
||||
// 保存时间
|
||||
saveLastTime(pileSn, channel);
|
||||
saveLastTimeAndCheckChannel(pileSn, channel);
|
||||
|
||||
// 枪号
|
||||
startIndex += length;
|
||||
|
||||
@@ -39,7 +39,7 @@ public class RemoteUpdateResponseHandler extends AbstractHandler{
|
||||
String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
|
||||
|
||||
// 保存时间
|
||||
saveLastTime(pileSn, channel);
|
||||
saveLastTimeAndCheckChannel(pileSn, channel);
|
||||
|
||||
// 升级状态 0x00-成功 0x01-编号错误 0x02-程序与桩型号不符 0x03-下载更新文件超时
|
||||
startIndex += length;
|
||||
|
||||
@@ -39,7 +39,7 @@ public class SettingPileWorkParamsHandler extends AbstractHandler{
|
||||
String pileSn = BytesUtil.binary(pileSnByte, 16);
|
||||
|
||||
// 保存时间
|
||||
saveLastTime(pileSn, channel);
|
||||
saveLastTimeAndCheckChannel(pileSn, channel);
|
||||
|
||||
// 设置状态 0x00-成功 0x01-失败
|
||||
startIndex += length;
|
||||
|
||||
@@ -43,7 +43,7 @@ public class TimeCheckSettingResponseHandler extends AbstractHandler{
|
||||
String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
|
||||
|
||||
// 保存时间
|
||||
saveLastTime(pileSn, channel);
|
||||
saveLastTimeAndCheckChannel(pileSn, channel);
|
||||
|
||||
// 当前时间
|
||||
startIndex += length;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.jsowell.netty.handler;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.jsowell.common.constant.CacheConstants;
|
||||
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
||||
import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
|
||||
@@ -33,7 +32,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -106,7 +104,7 @@ public class UploadRealTimeMonitorHandler extends AbstractHandler {
|
||||
realTimeMonitorData.setPileSn(pileSn);
|
||||
|
||||
// 保存时间
|
||||
saveLastTime(pileSn, channel);
|
||||
saveLastTimeAndCheckChannel(pileSn, channel);
|
||||
|
||||
// 校验channel
|
||||
// PileChannelEntity.checkChannel(pileSn, channel);
|
||||
|
||||
Reference in New Issue
Block a user