mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-13 11:49:49 +08:00
update 算法应用Service
This commit is contained in:
@@ -158,7 +158,7 @@ public class CacheConstants {
|
|||||||
/**
|
/**
|
||||||
* 0x17参数配置缓存
|
* 0x17参数配置缓存
|
||||||
*/
|
*/
|
||||||
public static final String PARAMETER_CONFIGURATION_BY_TRANSACTIONCODE = "ParameterConfigurationByTransactionCode:";
|
public static final String PARAMETER_CONFIGURATION_BY_TRANSACTION_CODE = "parameter_configuration_by_transaction_code:";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 充电桩最后连接时间
|
* 充电桩最后连接时间
|
||||||
@@ -170,6 +170,11 @@ public class CacheConstants {
|
|||||||
*/
|
*/
|
||||||
public static final String SELECT_PILE_CONNECTOR_INFO_LIST = "select_pile_connector_info_list:";
|
public static final String SELECT_PILE_CONNECTOR_INFO_LIST = "select_pile_connector_info_list:";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0x3b交易记录缓存key
|
||||||
|
*/
|
||||||
|
public static final String TRANSACTION_RECORD_BY_TRANSACTION_CODE = "transaction_record_by_transaction_code:";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 充电桩状态前缀
|
* 充电桩状态前缀
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -51,12 +51,14 @@ public class ChargingHandshakeHandler extends AbstractYkcHandler {
|
|||||||
startIndex += length;
|
startIndex += length;
|
||||||
length = 1;
|
length = 1;
|
||||||
byte[] pileConnectorNumByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
byte[] pileConnectorNumByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||||
|
String connectorCode = BytesUtil.bcd2Str(pileConnectorNumByteArr);
|
||||||
|
|
||||||
// BMS 通信协议版本号 当前版本为 V1.1, 表示为: byte3, byte2—0001H;byte1—01H
|
// BMS 通信协议版本号 当前版本为 V1.1, 表示为: byte3, byte2—0001H;byte1—01H
|
||||||
startIndex += length;
|
startIndex += length;
|
||||||
length = 3;
|
length = 3;
|
||||||
byte[] BMSCommunicationProtocolVersionByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
byte[] BMSCommunicationProtocolVersionByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||||
|
|
||||||
|
|
||||||
// BMS 电池类型 01H:铅酸电池;02H:氢 电池;03H:磷酸铁锂电池;04H:锰 酸锂电池;05H:钴酸锂电池 ;06H: 三元材料电池;07H:聚合物锂离子 电池;08H:钛酸锂电池;FFH:其他
|
// BMS 电池类型 01H:铅酸电池;02H:氢 电池;03H:磷酸铁锂电池;04H:锰 酸锂电池;05H:钴酸锂电池 ;06H: 三元材料电池;07H:聚合物锂离子 电池;08H:钛酸锂电池;FFH:其他
|
||||||
startIndex += length;
|
startIndex += length;
|
||||||
length = 1;
|
length = 1;
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ 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;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@@ -146,7 +145,7 @@ public class ParameterConfigurationHandler extends AbstractYkcHandler {
|
|||||||
.pileMinOutputCurrent(pileMinOutputCurrent)
|
.pileMinOutputCurrent(pileMinOutputCurrent)
|
||||||
|
|
||||||
.build();
|
.build();
|
||||||
String redisKey = CacheConstants.PARAMETER_CONFIGURATION_BY_TRANSACTIONCODE + transactionCode;
|
String redisKey = CacheConstants.PARAMETER_CONFIGURATION_BY_TRANSACTION_CODE + transactionCode;
|
||||||
redisCache.setCacheObject(redisKey, data, 7, TimeUnit.DAYS);
|
redisCache.setCacheObject(redisKey, data, 7, TimeUnit.DAYS);
|
||||||
|
|
||||||
// 查询该订单下信息,将起始soc传入
|
// 查询该订单下信息,将起始soc传入
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import org.springframework.stereotype.Component;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 交易记录确认
|
* 交易记录确认
|
||||||
@@ -562,6 +563,10 @@ public class TransactionRecordsRequestHandler extends AbstractYkcHandler {
|
|||||||
.logicCard(logicCard)
|
.logicCard(logicCard)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
// 保存交易记录到redis (缓存时间1天)
|
||||||
|
String recordRedisKey = CacheConstants.TRANSACTION_RECORD_BY_TRANSACTION_CODE + transactionCode;
|
||||||
|
redisCache.setCacheObject(recordRedisKey, data, 1, TimeUnit.DAYS);
|
||||||
|
|
||||||
// 保存报文
|
// 保存报文
|
||||||
String jsonMsg = JSON.toJSONString(data);
|
String jsonMsg = JSON.toJSONString(data);
|
||||||
pileMsgRecordService.save(pileSn, pileSn + connectorCode, type, jsonMsg, ykcDataProtocol.getHEXString());
|
pileMsgRecordService.save(pileSn, pileSn + connectorCode, type, jsonMsg, ykcDataProtocol.getHEXString());
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ package com.jsowell.thirdparty.platform.service.impl;
|
|||||||
|
|
||||||
import com.jsowell.common.constant.CacheConstants;
|
import com.jsowell.common.constant.CacheConstants;
|
||||||
import com.jsowell.common.constant.Constants;
|
import com.jsowell.common.constant.Constants;
|
||||||
|
import com.jsowell.common.core.domain.ykc.TransactionRecordsData;
|
||||||
import com.jsowell.common.core.redis.RedisCache;
|
import com.jsowell.common.core.redis.RedisCache;
|
||||||
import com.jsowell.common.util.StringUtils;
|
import com.jsowell.common.util.StringUtils;
|
||||||
import com.jsowell.pile.domain.OrderBasicInfo;
|
|
||||||
import com.jsowell.pile.service.OrderBasicInfoService;
|
import com.jsowell.pile.service.OrderBasicInfoService;
|
||||||
import com.jsowell.pile.thirdparty.ParameterConfigData;
|
import com.jsowell.pile.thirdparty.ParameterConfigData;
|
||||||
import com.jsowell.pile.vo.uniapp.customer.OrderVO;
|
import com.jsowell.pile.vo.uniapp.customer.OrderVO;
|
||||||
@@ -37,12 +37,16 @@ public class ChargeAlgorithmService {
|
|||||||
if (orderVO == null) {
|
if (orderVO == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
String transactionCode = orderVO.getTransactionCode();
|
||||||
// 获取0x17缓存中的信息
|
// 获取0x17缓存中的信息
|
||||||
String redisKey = CacheConstants.PARAMETER_CONFIGURATION_BY_TRANSACTIONCODE + orderVO.getTransactionCode();
|
String redisKey = CacheConstants.PARAMETER_CONFIGURATION_BY_TRANSACTION_CODE + transactionCode;
|
||||||
ParameterConfigData parameterConfigData = redisCache.getCacheObject(redisKey);
|
ParameterConfigData parameterConfigData = redisCache.getCacheObject(redisKey);
|
||||||
if (parameterConfigData == null) {
|
if (parameterConfigData == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// 获取0x3b缓存信息
|
||||||
|
String transactionDataKey = CacheConstants.TRANSACTION_RECORD_BY_TRANSACTION_CODE + transactionCode;
|
||||||
|
TransactionRecordsData transactionRecordsData = redisCache.getCacheObject(transactionDataKey);
|
||||||
|
|
||||||
ChargeAlgorithmData data = ChargeAlgorithmData.builder()
|
ChargeAlgorithmData data = ChargeAlgorithmData.builder()
|
||||||
.orderCode(orderCode)
|
.orderCode(orderCode)
|
||||||
@@ -61,13 +65,13 @@ public class ChargeAlgorithmService {
|
|||||||
// .bmsDemandVoltage(parameterConfigData.get)
|
// .bmsDemandVoltage(parameterConfigData.get)
|
||||||
// .bmsDemandElectricity()
|
// .bmsDemandElectricity()
|
||||||
// .bmsChargeMode()
|
// .bmsChargeMode()
|
||||||
// .readBeforeCharge()
|
.readBeforeCharge(transactionRecordsData.getAmmeterTotalStart())
|
||||||
// .readCurrentCharge()
|
.readCurrentCharge(transactionRecordsData.getAmmeterTotalEnd())
|
||||||
.beginTime(orderVO.getStartTime())
|
.beginTime(orderVO.getStartTime())
|
||||||
.maxAllowTemp(parameterConfigData.getBmsMaxTemperature())
|
.maxAllowTemp(parameterConfigData.getBmsMaxTemperature())
|
||||||
// .chargePower()
|
// .chargePower()
|
||||||
// .ratedCapacity()
|
// .ratedCapacity()
|
||||||
// .nominalEnergy()
|
.nominalEnergy(parameterConfigData.getBmsSumEnergy())
|
||||||
// .ratedVoltage()
|
// .ratedVoltage()
|
||||||
.singleMaxVoltage(parameterConfigData.getPileMaxOutputVoltage())
|
.singleMaxVoltage(parameterConfigData.getPileMaxOutputVoltage())
|
||||||
.singleMinVoltage(parameterConfigData.getPileMinOutputVoltage())
|
.singleMinVoltage(parameterConfigData.getPileMinOutputVoltage())
|
||||||
|
|||||||
Reference in New Issue
Block a user