This commit is contained in:
Guoqs
2024-05-22 10:46:38 +08:00
4 changed files with 239 additions and 5 deletions

View File

@@ -10,6 +10,7 @@ public enum BusinessInformationExchangeEnum {
NOTIFICATION_START_CHARGE_RESULT("notification_start_charge_result", "推送启动充电结果"),
NOTIFICATION_EQUIP_CHARGE_STATUS("notification_equip_charge_status", "推送充电状态"),
NOTIFICATION_STOP_CHARGE_RESULT("notification_stop_charge_result", "推送停止充电结果"),
NOTIFICATION_BMS_INFO("notification_bmsInfo", "过程信息推送"),
CHECK_CHARGE_ORDERS("check_charge_orders", "推送订单对账结果信息"),
;
private String value;

View File

@@ -0,0 +1,148 @@
package com.jsowell.thirdparty.platform.domain;
import com.alibaba.fastjson2.annotation.JSONField;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
/**
* 车辆充放电过程信息
*
* @author Lemon
* @Date 2024/5/21 10:01:02
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class BMSInfo {
/**
* 车辆 VIN 码
*/
@JSONField(name = "vinCode")
private String vinCode;
/**
* 车辆 BMS 编码
*/
@JSONField(name = "BMSCode")
private String bmsCode;
/**
* 车辆 BMS 版本
*/
@JSONField(name = "BMSVer")
private String bmsVer;
/**
* 充电机接口编码
*/
@JSONField(name = "ConnectorID")
private String connectorID;
/**
* 最高允许充电电流
*/
@JSONField(name = "MaxChargeCurrent")
private BigDecimal maxChargeCurrent;
/**
* 单体最高允许电压
*/
@JSONField(name = "MaxChargeCellVoltage")
private BigDecimal maxChargeCellVoltage;
/**
* 最高允许温度
*/
@JSONField(name = "MaxTemp")
private Integer maxTemp;
/**
* 电池额定容量
*/
@JSONField(name = "RatedCapacity")
private Integer ratedCapacity;
/**
* 总电压
*/
@JSONField(name = "TatalVoltage")
private BigDecimal tatalVoltage;
/**
* 总电流
*/
@JSONField(name = "TotalCurrent")
private BigDecimal totalCurrent;
/**
* 荷电状态
*/
@JSONField(name = "Soc")
private Integer soc;
/**
* 单体最高电压
*/
@JSONField(name = "VoltageH")
private BigDecimal voltageH;
/**
* 单体最高电压编号
*/
@JSONField(name = "VoltageHNumIndex")
private Integer voltageHNumIndex;
/**
* 单体最高温度
*/
@JSONField(name = "TemptureH")
private Integer temptureH;
/**
* 单体最高温度编号
*/
@JSONField(name = "TemptureHNumIndex")
private Integer temptureHNumIndex;
/**
* 单体最低温度
*/
@JSONField(name = "TemptureL")
private Integer temptureL;
/**
* 单体最低温度编号
*/
@JSONField(name = "TemptureLNumIndex")
private Integer temptureLNumIndex;
/**
* 充放电侧能量变化
*/
@JSONField(name = "CurrentCapacity")
private BigDecimal currentCapacity;
/**
* 采集时间
*/
@JSONField(name = "FreshTime")
private String freshTime;
/**
* 开始充电时间
*/
@JSONField(name = "StartChargingTime")
private String startChargingTime;
/**
* 充电时长
*/
@JSONField(name = "ChargingSessionMin")
private Integer chargingSessionMin;
}

View File

@@ -207,6 +207,16 @@ public interface ThirdPartyPlatformService extends InitializingBean {
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ 由对方平台实现此接口,我方平台调用的通知接口 ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ //
// =================================================================================== //
/**
* 过程信息推送 notification_bmsInfo
* 当运营商平台有充放电电池数据过程信息时,推送最新的信息通知到市级监控平台
* @param pileConnectorCode
* @return
*/
default String notificationBMSInfo(String pileConnectorCode) {
throw new UnsupportedOperationException("This method is not yet implemented");
}
/**
* 充电站信息变化推送 notification_stationInfo
* 新站需要推送。当站点信息发生变化时,推送新的信息通知到市级平台

View File

@@ -31,10 +31,13 @@ import com.jsowell.pile.vo.base.ConnectorInfoVO;
import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO;
import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO;
import com.jsowell.pile.vo.lianlian.AccumulativeInfoVO;
import com.jsowell.pile.vo.web.OrderListVO;
import com.jsowell.pile.vo.web.PileConnectorInfoVO;
import com.jsowell.pile.vo.web.PileStationVO;
import com.jsowell.thirdparty.lianlian.domain.*;
import com.jsowell.thirdparty.lianlian.vo.AccessTokenVO;
import com.jsowell.thirdparty.platform.common.StationInfo;
import com.jsowell.thirdparty.platform.domain.BMSInfo;
import com.jsowell.thirdparty.platform.domain.StationChargeStatsInfo;
import com.jsowell.thirdparty.platform.factory.ThirdPartyPlatformFactory;
import com.jsowell.thirdparty.platform.service.ThirdPartyPlatformService;
@@ -389,11 +392,8 @@ public class ShenZhenPlatformServiceImpl implements ThirdPartyPlatformService {
*/
@Override
public Map<String, String> queryStationStats(QueryStationInfoDTO dto) {
// 根据 operatorId 查出配置密钥信息
ThirdPartySecretInfoVO secretInfoVO = thirdpartySecretInfoService.queryByOperatorId(dto.getOperatorId());
if (secretInfoVO == null) {
return null;
}
// 查出配置密钥信息
ThirdPartySecretInfoVO secretInfoVO = getShenZhenSecretInfo();
// 根据站点id 查出这段时间的充电量
List<AccumulativeInfoVO> list = orderBasicInfoService.getAccumulativeInfoForLianLian(dto);
if (CollectionUtils.isEmpty(list)) {
@@ -477,6 +477,81 @@ public class ShenZhenPlatformServiceImpl implements ThirdPartyPlatformService {
}
/**
* 过程信息推送 notification_bmsInfo
* 当运营商平台有充放电电池数据过程信息时,推送最新的信息通知到市级监控平台
* @param pileConnectorCode
* @return
*/
@Override
public String notificationBMSInfo(String pileConnectorCode) {
BMSInfo bmsInfo = null;
JSONObject resultJson = new JSONObject();
String pileSn = StringUtils.substring(pileConnectorCode, 0, 14);
// 查询枪口状态
PileConnectorInfoVO info = pileConnectorInfoService.getPileConnectorInfoByConnectorCode(pileConnectorCode);
Integer connectorStatus = info.getStatus();
resultJson.put("ConnectorID", pileConnectorCode);
resultJson.put("Status", connectorStatus);
if (!StringUtils.equals(PileConnectorDataBaseStatusEnum.OCCUPIED_CHARGING.getValue(), String.valueOf(connectorStatus))) {
resultJson.put("BmsInfo", null);
}else {
// 获取正在充电的订单信息
List<OrderListVO> orderListVOS = orderBasicInfoService.selectChargingOrder(pileSn);
if (CollectionUtils.isEmpty(orderListVOS)) {
return null;
}
OrderListVO orderVO = orderListVOS.get(0);
// 获取充电电池信息
List<RealTimeMonitorData> chargingRealTimeData = orderBasicInfoService.getChargingRealTimeData(orderVO.getTransactionCode());
if (CollectionUtils.isEmpty(chargingRealTimeData)) {
return null;
}
RealTimeMonitorData data = chargingRealTimeData.get(0);
bmsInfo = BMSInfo.builder()
.vinCode(orderVO.getVinCode())
.bmsCode("")
.bmsVer("")
.connectorID(orderVO.getPileConnectorCode())
.maxChargeCurrent(new BigDecimal(""))
.maxChargeCellVoltage(new BigDecimal(""))
.maxTemp(0)
.ratedCapacity(0)
.tatalVoltage(new BigDecimal(data.getOutputVoltage()))
.totalCurrent(new BigDecimal(data.getOutputCurrent()))
.soc(Integer.parseInt(data.getSOC()))
.voltageH(new BigDecimal(""))
.voltageHNumIndex(0)
.temptureH(0)
.temptureHNumIndex(0)
.temptureL(0)
.temptureLNumIndex(0)
.currentCapacity(new BigDecimal(""))
.freshTime(DateUtils.getDateTime())
.startChargingTime(orderVO.getChargeStartTime())
.chargingSessionMin(Integer.parseInt(data.getSumChargingTime()) * 60)
.build();
resultJson.put("BmsInfo", bmsInfo);
}
ThirdPartySecretInfoVO shenZhenSecretInfo = getShenZhenSecretInfo();
String operatorId = shenZhenSecretInfo.getTheirOperatorId();
String operatorSecret = shenZhenSecretInfo.getTheirOperatorSecret();
String signSecret = shenZhenSecretInfo.getTheirSigSecret();
String dataSecret = shenZhenSecretInfo.getTheirDataSecret();
String dataSecretIv = shenZhenSecretInfo.getTheirDataSecretIv();
String urlAddress = shenZhenSecretInfo.getTheirUrlPrefix();
String url = urlAddress + BusinessInformationExchangeEnum.NOTIFICATION_BMS_INFO.getValue();
// 调用平台接口
String jsonString = JSON.toJSONString(resultJson);
// 获取令牌
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
return result;
}
/**
* 获取深圳平台相关密钥信息
* @return