mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 19:15:35 +08:00
新增 宁夏平台推送充换电站用能统计信息 接口
This commit is contained in:
135
jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/domain/SupStationPowerInfo.java
vendored
Normal file
135
jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/domain/SupStationPowerInfo.java
vendored
Normal file
@@ -0,0 +1,135 @@
|
||||
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;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 充换电站功率信息
|
||||
*
|
||||
* @author Lemon
|
||||
* @Date 2024/6/20 10:21:20
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class SupStationPowerInfo {
|
||||
|
||||
/**
|
||||
* 平台运营商ID
|
||||
*/
|
||||
@JSONField(name = "OperatorID")
|
||||
private String operatorId;
|
||||
|
||||
/**
|
||||
* 充换电服务运营商 ID
|
||||
*/
|
||||
@JSONField(name = "EquipmentOwnerID")
|
||||
private String equipmentOwnerID;
|
||||
|
||||
@JSONField(name = "StationID")
|
||||
private String stationId;
|
||||
|
||||
/**
|
||||
* 站点分类
|
||||
* 1:充电站
|
||||
* 2:换电站
|
||||
* 3:充换电一体站
|
||||
*/
|
||||
@JSONField(name = "StationClassification")
|
||||
private Integer stationClassification;
|
||||
|
||||
/**
|
||||
* 统计时间
|
||||
*/
|
||||
@JSONField(name = "DataTime")
|
||||
private String dataTime;
|
||||
|
||||
/**
|
||||
* 充换电站实时功率
|
||||
* 单位 kW
|
||||
*/
|
||||
@JSONField(name = "StationRealTimePower")
|
||||
private BigDecimal stationRealTimePower;
|
||||
|
||||
/**
|
||||
* 充电设备功率信息列表
|
||||
*/
|
||||
@JSONField(name = "EquipmentPowerInfos")
|
||||
private List<EquipmentPowerInfo> equipmentPowerInfos;
|
||||
|
||||
|
||||
@Data
|
||||
public static class EquipmentPowerInfo{
|
||||
|
||||
/**
|
||||
* 充电设备编码
|
||||
*/
|
||||
@JSONField(name = "EquipmentID")
|
||||
private String equipmentID;
|
||||
|
||||
/**
|
||||
* 设备分类
|
||||
* 1:车辆充电设备
|
||||
* 2:换电站内的电池箱充电设备
|
||||
*/
|
||||
@JSONField(name = "EquipmentClassification")
|
||||
private Integer equipmentClassification;
|
||||
|
||||
/**
|
||||
* 统计时间
|
||||
*/
|
||||
@JSONField(name = "DataTime")
|
||||
private String dataTime;
|
||||
|
||||
/**
|
||||
* 充电设备实时功率
|
||||
*/
|
||||
@JSONField(name = "EquipRealTimePower")
|
||||
private BigDecimal equipRealTimePower;
|
||||
|
||||
/**
|
||||
* 充电设备接口功率信息列表
|
||||
*/
|
||||
@JSONField(name = "ConnectorPowerInfos")
|
||||
private List<ConnectorPowerInfo> connectorPowerInfos;
|
||||
|
||||
|
||||
@Data
|
||||
public static class ConnectorPowerInfo{
|
||||
|
||||
/**
|
||||
* 充电设备接口编码
|
||||
*/
|
||||
@JSONField(name = "ConnectorID")
|
||||
private String connectorID;
|
||||
|
||||
/**
|
||||
* 设备分类
|
||||
* 1:车辆充电设备
|
||||
* 2:换电站内的电池箱充电设备
|
||||
*/
|
||||
@JSONField(name = "EquipmentClassification")
|
||||
private Integer equipmentClassification;
|
||||
|
||||
/**
|
||||
* 统计时间
|
||||
*/
|
||||
@JSONField(name = "DataTime")
|
||||
private String dataTime;
|
||||
|
||||
/**
|
||||
* 充电设备接口实时功率
|
||||
*/
|
||||
@JSONField(name = "ConnectorRealTimePower")
|
||||
private BigDecimal connectorRealTimePower;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -36,6 +36,7 @@ import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.BillingPriceVO;
|
||||
import com.jsowell.pile.vo.uniapp.OrderVO;
|
||||
import com.jsowell.pile.vo.web.PileConnectorInfoVO;
|
||||
import com.jsowell.pile.vo.web.PileStationVO;
|
||||
import com.jsowell.thirdparty.lianlian.domain.ConnectorChargeStatusInfo;
|
||||
import com.jsowell.thirdparty.lianlian.domain.ConnectorStatusInfo;
|
||||
import com.jsowell.thirdparty.lianlian.domain.StationStatusInfo;
|
||||
@@ -544,7 +545,7 @@ public class NinaXiaPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
// 推送地址
|
||||
String url = urlAddress + "notification_orderInfo";
|
||||
|
||||
// 拼装成内蒙古平台所需格式对象
|
||||
// 拼装成宁夏平台所需格式对象
|
||||
ChargeOrderInfo orderInfo = transformChargeOrderInfo(orderBasicInfo, orderDetail);
|
||||
orderInfo.setOperatorID(operatorId);
|
||||
String equipmentOwnerID;
|
||||
@@ -783,6 +784,103 @@ public class NinaXiaPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送充电站实时功率
|
||||
* @param stationIds
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String notificationPowerInfo(List<String> stationIds) {
|
||||
List<SupStationPowerInfo> supStationPowerInfoList = new ArrayList<>();
|
||||
stationIds.forEach(stationId -> {
|
||||
PileStationVO stationInfo = pileStationInfoService.getStationInfo(stationId);
|
||||
String dateTimeNow = DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD_HH_MM_SS);
|
||||
SupStationPowerInfo supStationPowerInfo = new SupStationPowerInfo();
|
||||
// 根据站点id查询桩列表
|
||||
List<PileBasicInfo> pileList = pileBasicInfoService.getPileListByStationId(stationId);
|
||||
SupStationPowerInfo.
|
||||
EquipmentPowerInfo equipmentPowerInfo = null;
|
||||
List<SupStationPowerInfo.
|
||||
EquipmentPowerInfo> equipmentPowerInfoList = new ArrayList<>();
|
||||
BigDecimal stationInstantPower = BigDecimal.ZERO;
|
||||
supStationPowerInfo.setOperatorId(Constants.OPERATORID_LIANLIAN);
|
||||
supStationPowerInfo.setEquipmentOwnerID(stationInfo.getMerchantId());
|
||||
supStationPowerInfo.setStationId(stationId);
|
||||
supStationPowerInfo.setStationClassification(1);
|
||||
supStationPowerInfo.setDataTime(dateTimeNow);
|
||||
|
||||
for (PileBasicInfo pileBasicInfo : pileList) {
|
||||
equipmentPowerInfo = new SupStationPowerInfo.EquipmentPowerInfo();
|
||||
equipmentPowerInfo.setEquipmentID(pileBasicInfo.getSn());
|
||||
equipmentPowerInfo.setEquipmentClassification(1);
|
||||
equipmentPowerInfo.setDataTime(dateTimeNow);
|
||||
|
||||
// 根据桩sn查询枪口列表
|
||||
List<PileConnectorInfo> pileConnectorInfos = pileConnectorInfoService.selectPileConnectorInfoList(pileBasicInfo.getSn());
|
||||
// 如果枪口状态为充电中,则查询枪口功率等信息
|
||||
SupStationPowerInfo.
|
||||
EquipmentPowerInfo.
|
||||
ConnectorPowerInfo connectorPowerInfo = null;
|
||||
List<SupStationPowerInfo.
|
||||
EquipmentPowerInfo.
|
||||
ConnectorPowerInfo> connectorPowerInfoList = new ArrayList<>();
|
||||
// 初始化桩功率
|
||||
BigDecimal pileInstantPower = BigDecimal.ZERO;
|
||||
for (PileConnectorInfo pileConnectorInfo : pileConnectorInfos) {
|
||||
if (StringUtils.equals(PileConnectorDataBaseStatusEnum.OCCUPIED_CHARGING.getValue(), pileConnectorInfo.getStatus())) {
|
||||
// 查询充电枪口状态
|
||||
PileConnectorInfoVO connectorInfo = pileConnectorInfoService.getPileConnectorInfoByConnectorCode(pileConnectorInfo.getPileConnectorCode());
|
||||
if (Objects.isNull(connectorInfo)) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_CONNECTOR_INFO_NULL_ERROR);
|
||||
}
|
||||
BigDecimal instantPower = connectorInfo.getInstantPower();
|
||||
pileInstantPower = pileInstantPower.add(instantPower);
|
||||
|
||||
connectorPowerInfo = new SupStationPowerInfo.EquipmentPowerInfo.ConnectorPowerInfo();
|
||||
connectorPowerInfo.setConnectorID(connectorInfo.getPileConnectorCode());
|
||||
connectorPowerInfo.setEquipmentClassification(1);
|
||||
connectorPowerInfo.setDataTime(dateTimeNow);
|
||||
connectorPowerInfo.setConnectorRealTimePower(instantPower);
|
||||
|
||||
connectorPowerInfoList.add(connectorPowerInfo);
|
||||
}
|
||||
// 计算桩的功率(枪口功率之和)
|
||||
equipmentPowerInfo.setEquipRealTimePower(pileInstantPower);
|
||||
// 汇总站点功率
|
||||
stationInstantPower = stationInstantPower.add(pileInstantPower);
|
||||
|
||||
equipmentPowerInfo.setConnectorPowerInfos(connectorPowerInfoList);
|
||||
equipmentPowerInfoList.add(equipmentPowerInfo);
|
||||
}
|
||||
}
|
||||
supStationPowerInfo.setStationRealTimePower(stationInstantPower);
|
||||
supStationPowerInfo.setEquipmentPowerInfos(equipmentPowerInfoList);
|
||||
supStationPowerInfoList.add(supStationPowerInfo);
|
||||
});
|
||||
// 发送请求
|
||||
ThirdPartySecretInfoVO ningXiaSecretInfo = getNingXiaPlatformSecretInfo();
|
||||
|
||||
String operatorId = ningXiaSecretInfo.getOurOperatorId();
|
||||
String operatorSecret = ningXiaSecretInfo.getTheirOperatorSecret();
|
||||
String signSecret = ningXiaSecretInfo.getTheirSigSecret();
|
||||
String dataSecret = ningXiaSecretInfo.getTheirDataSecret();
|
||||
String dataSecretIv = ningXiaSecretInfo.getTheirDataSecretIv();
|
||||
String urlAddress = ningXiaSecretInfo.getTheirUrlPrefix();
|
||||
String url = urlAddress + "supervise_notification_realtime_power_info";
|
||||
// 获取令牌
|
||||
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
|
||||
if (StringUtils.isBlank(token)) {
|
||||
return null;
|
||||
}
|
||||
// 调用平台接口
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("SupStationPowerInfos", supStationPowerInfoList);
|
||||
String jsonString = JSON.toJSONString(json);
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送充电站历史充电订单信息 supervise_notification_charge_order_info_history
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user