diff --git a/jsowell-admin/src/main/resources/application-pre.yml b/jsowell-admin/src/main/resources/application-pre.yml index 38f9d3d9c..36ee01732 100644 --- a/jsowell-admin/src/main/resources/application-pre.yml +++ b/jsowell-admin/src/main/resources/application-pre.yml @@ -247,3 +247,8 @@ parking: parkId: 61578 # 机构ID(分配) orgId: BTTEST01 + +# 充电算法平台配置 +chargeAlgorithm: + url: http://150.158.199.92:58910/gateway/api/user/battery/algorithm/json + clientId: e488bac5f70b496fa2d82065089e5f81 \ No newline at end of file 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 59fe2f367..c6f25ebd8 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 @@ -20,6 +20,7 @@ import com.jsowell.thirdparty.platform.domain.ChargeAlgorithmData; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @@ -36,6 +37,12 @@ import java.util.stream.Collectors; @Service public class ChargeAlgorithmService { + @Value("${chargeAlgorithm.url}") + private String url; + + @Value("${chargeAlgorithm.clientId}") + private String clientId; + @Autowired private OrderBasicInfoService orderBasicInfoService; @@ -121,8 +128,8 @@ public class ChargeAlgorithmService { .bmsVersion("V1.1") // BMS版本 .batteryType(chargingHandshakeData.getBmsBatteryType()) // 电池类型 .maxAllowTemp(parameterConfigData.getBmsMaxTemperature()) - .ratedCapacity(parameterConfigData.getBmsSumEnergy()) // 电池额定容量 - .nominalEnergy(parameterConfigData.getBmsSumEnergy()) + .ratedCapacity(new BigDecimal(parameterConfigData.getBmsSumEnergy()).toBigInteger().toString()) // 电池额定容量 + .nominalEnergy(new BigDecimal(parameterConfigData.getBmsSumEnergy()).toBigInteger().toString()) .ratedVoltage(chargingHandshakeData.getBmsBatteryVoltage()) // 电池额定总电压 .bmsChargeMode(Integer.parseInt(bmsDemandAndChargerOutputData.getBmsChargingModel())) // BMS充电模式 @@ -158,8 +165,6 @@ public class ChargeAlgorithmService { log.info("发送请求前封装数据 data:{}", JSON.toJSONString(jsonObject)); - String url = "http://150.158.199.92:58910/gateway/api/user/battery/algorithm/json"; - String clientId = "e488bac5f70b496fa2d82065089e5f81"; // 发送请求 String response = HttpRequest.post(url).header("clientId", clientId).body(JSON.toJSONString(jsonObject)).execute().body(); @@ -208,11 +213,11 @@ public class ChargeAlgorithmService { // 获取0x13数据 detailInfo.setReadCurrentCharge(transactionRecordsData.getAmmeterTotalEnd()); detailInfo.setCurrentSoc(new BigDecimal(realTimeData_0x23.getSoc()).intValue()); - detailInfo.setReportTime(realTimeData_0x23.getDateTime()); - detailInfo.setMaxAllowElectricity(parameterConfigData.getBmsMaxCurrent()); + detailInfo.setReportTime(realTimeData_0x23.getDateTime().replaceAll("[^0-9]", "")); + detailInfo.setMaxAllowElectricity(new BigDecimal(parameterConfigData.getBmsMaxCurrent()).toBigInteger().toString()); detailInfo.setSingleMaxAllowVoltage(parameterConfigData.getBmsMaxVoltage()); detailInfo.setDcv(realTimeData_0x23.getPileVoltageOutput()); - detailInfo.setDca(realTimeData_0x23.getPileCurrentOutput()); + detailInfo.setDca(new BigDecimal(realTimeData_0x23.getPileCurrentOutput()).toBigInteger().toString()); detailInfo.setBmsDemandVoltage(realTimeData_0x23.getBmsVoltageDemand()); detailInfo.setBmsDemandElectricity(realTimeData_0x23.getBmsCurrentDemand()); detailInfo.setChargePower(realTimeData_0x23.getOutputPower()); @@ -220,11 +225,11 @@ public class ChargeAlgorithmService { detailInfo.setSingleMinVoltage(parameterConfigData.getPileMinOutputVoltage()); detailInfo.setMeasuringChargeVoltage(realTimeData_0x23.getBmsChargingVoltage()); - detailInfo.setMeasuringChargeElectricity(realTimeData_0x23.getBmsChargingCurrent()); + detailInfo.setMeasuringChargeElectricity(new BigDecimal(realTimeData_0x23.getBmsChargingCurrent()).toBigInteger().toString()); detailInfo.setMaxSingleVoltageGroupNum(new BigDecimal(realTimeData_0x23.getBmsMaxVoltageAndGroup()).intValue()); detailInfo.setMaxAllowTotalVoltage(parameterConfigData.getBmsMaxChargingVoltage()); - detailInfo.setBeforeChargeTotalVoltage(parameterConfigData.getBmsRealTimeVoltage()); + detailInfo.setBeforeChargeTotalVoltage(new BigDecimal(parameterConfigData.getBmsRealTimeVoltage()).toBigInteger().toString()); detailInfo.setVentTemp("0"); detailInfo.setEnvironmentTemp("0");