update 算法应用Service

This commit is contained in:
Lemon
2024-11-29 10:04:52 +08:00
parent 8f650843e3
commit d4fa00bb88
4 changed files with 144 additions and 8 deletions

View File

@@ -1,9 +1,12 @@
package com.jsowell.thirdparty.platform.service.impl;
import com.jsowell.common.constant.CacheConstants;
import com.jsowell.common.constant.Constants;
import com.jsowell.common.core.redis.RedisCache;
import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.domain.OrderBasicInfo;
import com.jsowell.pile.service.OrderBasicInfoService;
import com.jsowell.pile.thirdparty.ParameterConfigData;
import com.jsowell.pile.vo.uniapp.customer.OrderVO;
import com.jsowell.thirdparty.platform.domain.ChargeAlgorithmData;
import org.springframework.beans.factory.annotation.Autowired;
@@ -21,6 +24,9 @@ public class ChargeAlgorithmService {
@Autowired
private OrderBasicInfoService orderBasicInfoService;
@Autowired
private RedisCache redisCache;
/**
* 推送充电订单数据
* @param orderCode
@@ -28,6 +34,15 @@ public class ChargeAlgorithmService {
public void pushOrderInfo(String orderCode) {
// 根据订单号查询订单信息
OrderVO orderVO = orderBasicInfoService.getChargeOrderInfoByOrderCode(orderCode);
if (orderVO == null) {
return;
}
// 获取0x17缓存中的信息
String redisKey = CacheConstants.PARAMETER_CONFIGURATION_BY_TRANSACTIONCODE + orderVO.getTransactionCode();
ParameterConfigData parameterConfigData = redisCache.getCacheObject(redisKey);
if (parameterConfigData == null) {
return;
}
ChargeAlgorithmData data = ChargeAlgorithmData.builder()
.orderCode(orderCode)
@@ -39,23 +54,23 @@ public class ChargeAlgorithmService {
.totalCharge(orderVO.getTotalPower())
.totalChargeTime(Integer.parseInt(orderVO.getChargingTime()))
.remainChargeTime(Constants.zero)
// .maxAllowElectricity()
// .singleMaxAllowVoltage()
.maxAllowElectricity(parameterConfigData.getBmsMaxCurrent())
.singleMaxAllowVoltage(parameterConfigData.getBmsMaxVoltage())
// .dcv()
// .dca()
// .bmsDemandVoltage()
// .bmsDemandVoltage(parameterConfigData.get)
// .bmsDemandElectricity()
// .bmsChargeMode()
// .readBeforeCharge()
// .readCurrentCharge()
// .beginTime()
// .maxAllowTemp()
.beginTime(orderVO.getStartTime())
.maxAllowTemp(parameterConfigData.getBmsMaxTemperature())
// .chargePower()
// .ratedCapacity()
// .nominalEnergy()
// .ratedVoltage()
// .singleMaxVoltage()
// .singleMinVoltage()
.singleMaxVoltage(parameterConfigData.getPileMaxOutputVoltage())
.singleMinVoltage(parameterConfigData.getPileMinOutputVoltage())
// .singleMaxTemp()
// .ventTemp()
// .environmentTemp()
@@ -70,7 +85,7 @@ public class ChargeAlgorithmService {
// .minTempPointNum()
// .batteryType()
// .batteryInsulation()
// .maxAllowTotalVoltage()
.maxAllowTotalVoltage(parameterConfigData.getBmsMaxChargingVoltage())
// .beforeChargeTotalVoltage()
.build();