update 算法应用平台Service

This commit is contained in:
Lemon
2024-12-11 11:23:40 +08:00
parent 05cf609297
commit c321ca9ffc
6 changed files with 225 additions and 24 deletions

View File

@@ -1,5 +1,7 @@
package com.jsowell.netty.handler.yunkuaichong;
import com.jsowell.common.constant.CacheConstants;
import com.jsowell.common.core.domain.ykc.ChargingHandshakeData;
import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
import com.jsowell.common.core.redis.RedisCache;
@@ -11,6 +13,8 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.concurrent.TimeUnit;
/**
* 充电握手
*
@@ -135,8 +139,30 @@ public class ChargingHandshakeHandler extends AbstractYkcHandler {
length = 8;
byte[] BMSSoftwareVersionByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
// 保存数据到redis
// redisCache.setCacheObject();
// 保存数据到redis(缓存3天)
ChargingHandshakeData data = ChargingHandshakeData.builder()
.transactionCode(transactionCode)
.pileSn(pileSn)
.connectorCode(connectorCode)
.bmsCommunicationVersion(bmsCommunicationVersion)
.bmsBatteryType(bmsBatteryType)
.bmsBatteryCapacity(bmsBatteryCapacity)
.bmsBatteryVoltage(bmsBatteryVoltage)
.bmsBatteryFactory(bmsBatteryFactory)
.bmsBatteryNum(bmsBatteryNum)
.bmsProductionDateYear(bmsProductionDateYear)
.bmsProductionDateMonth(bmsProductionDateMonth)
.bmsProductionDateDay(bmsProductionDateDay)
.bmsChargingTimes(bmsChargingTimes)
// .BMSPropertyIdentificationByteArr(BMSPropertyIdentificationByteArr)
// .BMSReservePosition(BMSReservePosition)
.vinCode(vinCode)
// .BMSSoftwareVersionByteArr(BMSSoftwareVersionByteArr)
.build();
String redisKey = CacheConstants.CHARGING_HANDSHAKE_DATA_BY_TRANSACTION_CODE + transactionCode;
redisCache.setCacheObject(redisKey, data, 3, TimeUnit.DAYS);
return null;
}