diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/BatteryChargeReportService.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/BatteryChargeReportService.java index 97b55b49c..376ead036 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/BatteryChargeReportService.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/BatteryChargeReportService.java @@ -8,6 +8,7 @@ import com.jsowell.common.constant.Constants; import com.jsowell.common.core.domain.ykc.*; import com.jsowell.common.core.redis.RedisCache; import com.jsowell.common.util.DateUtils; +import com.jsowell.common.util.RandomUtil; import com.jsowell.common.util.StringUtils; import com.jsowell.pile.domain.ChargeAlgorithmRecord; import com.jsowell.pile.service.*; @@ -18,6 +19,7 @@ import com.jsowell.pile.vo.web.PileDetailVO; import com.jsowell.pile.vo.web.PileStationVO; import com.jsowell.thirdparty.platform.domain.BatteryChargeReportData; import com.jsowell.thirdparty.platform.domain.BatteryReportResult; +import org.apache.commons.lang3.RandomUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -216,6 +218,13 @@ public class BatteryChargeReportService { .map(PileConnectorInfoVO::getPileSn) .collect(Collectors.toSet()); + String batteryType = String.valueOf(Integer.parseInt(chargingHandshakeData.getBmsBatteryType())); + // 如果 batteryType != 1/2/3/4/5 + if (!StringUtils.equalsAny(batteryType, "1", "2", "3", "4", "5")) { + // 随机生成一个1-3的数 + batteryType = String.valueOf(RandomUtils.nextInt(1, 4)); + } + BatteryChargeReportData data = BatteryChargeReportData.builder() .mfrID(mfrID) .siteName(stationVO.getStationName()) @@ -233,10 +242,9 @@ public class BatteryChargeReportService { .gunNo(orderVO.getConnectorCode()) .readBeforeCharge(transactionRecordsData.getAmmeterTotalStart()) .doorStatus(Constants.zero) - // .bmsChargeMode(Integer.parseInt(bmsDemandAndChargerOutputData.getBmsChargingModel())) - .bmsChargeMode(1) + .bmsChargeMode(Integer.parseInt(bmsDemandAndChargerOutputData.getBmsChargingModel())) .vin(transactionRecordsData.getVinCode()) - .batteryType(String.valueOf(Integer.parseInt(chargingHandshakeData.getBmsBatteryType()))) + .batteryType(batteryType) .nominalEnergy(new BigDecimal(parameterConfigData.getBmsSumEnergy()).toBigInteger().toString()) .ratedCapacity(new BigDecimal(parameterConfigData.getBmsSumEnergy()).toBigInteger().toString()) .ratedVoltage(chargingHandshakeData.getBmsBatteryVoltage()) @@ -252,6 +260,7 @@ public class BatteryChargeReportService { .build(); + List chargingDetailInfos = transformData(map);