diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/ChargeAlgorithmService.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/ChargeAlgorithmService.java index 806680454..aa597e21a 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/ChargeAlgorithmService.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/ChargeAlgorithmService.java @@ -1,5 +1,12 @@ package com.jsowell.thirdparty.platform.service.impl; +import com.jsowell.common.constant.Constants; +import com.jsowell.common.util.StringUtils; +import com.jsowell.pile.domain.OrderBasicInfo; +import com.jsowell.pile.service.OrderBasicInfoService; +import com.jsowell.pile.vo.uniapp.customer.OrderVO; +import com.jsowell.thirdparty.platform.domain.ChargeAlgorithmData; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; /** @@ -10,4 +17,69 @@ import org.springframework.stereotype.Service; */ @Service public class ChargeAlgorithmService { + + @Autowired + private OrderBasicInfoService orderBasicInfoService; + + /** + * 推送充电订单数据 + * @param orderCode + */ + public void pushOrderInfo(String orderCode) { + // 根据订单号查询订单信息 + OrderVO orderVO = orderBasicInfoService.getChargeOrderInfoByOrderCode(orderCode); + + ChargeAlgorithmData data = ChargeAlgorithmData.builder() + .orderCode(orderCode) + .initSoc(Constants.zero) + .currentSoc(Constants.zero) + .alarmCode(Constants.ZERO) + .currentServiceFee(String.valueOf(orderVO.getTotalServiceAmount())) + .currentTotalFee(String.valueOf(orderVO.getOrderAmount())) + .totalCharge(orderVO.getTotalPower()) + .totalChargeTime(Integer.parseInt(orderVO.getChargingTime())) + .remainChargeTime(Constants.zero) + // .maxAllowElectricity() + // .singleMaxAllowVoltage() + // .dcv() + // .dca() + // .bmsDemandVoltage() + // .bmsDemandElectricity() + // .bmsChargeMode() + // .readBeforeCharge() + // .readCurrentCharge() + // .beginTime() + // .maxAllowTemp() + // .chargePower() + // .ratedCapacity() + // .nominalEnergy() + // .ratedVoltage() + // .singleMaxVoltage() + // .singleMinVoltage() + // .singleMaxTemp() + // .ventTemp() + // .environmentTemp() + // .gunTemp() + // .doorStatus() + // .bmsVersion() + // .measuringChargeVoltage() + // .measuringChargeElectricity() + // .maxSingleVoltageGroupNum() + // .maxSingleVoltageNum() + // .maxTempPointNum() + // .minTempPointNum() + // .batteryType() + // .batteryInsulation() + // .maxAllowTotalVoltage() + // .beforeChargeTotalVoltage() + + .build(); + + if (StringUtils.isNotBlank(orderVO.getStartSoc())) { + data.setInitSoc(Integer.parseInt(orderVO.getStartSoc())); + } + if (StringUtils.isNotBlank(orderVO.getEndSoc())) { + data.setCurrentSoc(Integer.parseInt(orderVO.getEndSoc())); + } + } }