diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/domain/ChargeAlgorithmData.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/domain/ChargeAlgorithmData.java index 080ba57cf..6b4ef6778 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/domain/ChargeAlgorithmData.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/domain/ChargeAlgorithmData.java @@ -1,5 +1,6 @@ package com.jsowell.thirdparty.platform.domain; +import com.alibaba.fastjson2.annotation.JSONField; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -114,6 +115,7 @@ public class ChargeAlgorithmData { */ private String vin; + @JSONField(name = "data") private List chargingDetailInfo; @Data 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 ace3038e3..46d281730 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 @@ -2,6 +2,7 @@ package com.jsowell.thirdparty.platform.service.impl; import cn.hutool.http.HttpRequest; import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONObject; import com.jsowell.common.constant.CacheConstants; import com.jsowell.common.constant.Constants; import com.jsowell.common.core.domain.ykc.*; @@ -132,13 +133,15 @@ public class ChargeAlgorithmService { data.setChargingDetailInfo(chargingDetailInfos); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("dataJason", data); - log.info("发送请求前封装数据 data:{}", JSON.toJSONString(data)); + 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(data)).execute().body(); + String response = HttpRequest.post(url).header("clientId", clientId).body(JSON.toJSONString(jsonObject)).execute().body(); log.info("发送请求收到回复 response:{}", response); return response; @@ -155,7 +158,7 @@ public class ChargeAlgorithmService { Map> collect_0x25 = new LinkedHashMap<>(); Map> collect_0x13 = new LinkedHashMap<>(); - if (bmsChargeInfoList != null && chargingRealTimeDataList != null) { + if (bmsChargeInfoList != null) { // 按照dateTime分组(将key设置为 yyyy-MM-dd HH:mm:00 格式) collect_0x25 = bmsChargeInfoList.stream() .map(x -> { @@ -164,6 +167,9 @@ public class ChargeAlgorithmService { }) .collect(Collectors.groupingBy(BMSChargeInfoData::getDateTime)); + + } + if (chargingRealTimeDataList != null) { collect_0x13 = chargingRealTimeDataList.stream() .map(x -> { x.setDateTime(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:00", DateUtils.parseDate(x.getDateTime()))); @@ -200,6 +206,9 @@ public class ChargeAlgorithmService { detailInfo.setMaxAllowTotalVoltage(parameterConfigData.getBmsMaxChargingVoltage()); detailInfo.setBeforeChargeTotalVoltage(parameterConfigData.getBmsRealTimeVoltage()); + detailInfo.setVentTemp("0"); + detailInfo.setEnvironmentTemp("0"); + // 获取该时间的0x25数据 List bmsChargeInfoDataList = collect_0x25.get(dateStr); @@ -222,6 +231,8 @@ public class ChargeAlgorithmService { RealTimeMonitorData realTimeData_0x13 = RealTimeDataList.get(0); detailInfo.setGunTemp(realTimeData_0x13.getGunLineTemperature()); + }else { + detailInfo.setGunTemp("0"); } resultList.add(detailInfo);