mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
新增 内蒙古平台推送充换电站用能统计信息接口
This commit is contained in:
@@ -56,6 +56,30 @@ public class SupStationStatsInfo {
|
||||
@JSONField(name = "StationElectricity")
|
||||
private BigDecimal stationElectricity;
|
||||
|
||||
/**
|
||||
* 累计充电量
|
||||
*/
|
||||
@JSONField(name = "DailyChargeEnergy")
|
||||
private BigDecimal dailyChargeEnergy;
|
||||
|
||||
/**
|
||||
* 累计其他电量
|
||||
*/
|
||||
@JSONField(name = "DailyOtherEnergy")
|
||||
private BigDecimal dailyOtherEnergy;
|
||||
|
||||
/**
|
||||
* 累计换电次数
|
||||
*/
|
||||
@JSONField(name = "DailySwapNum")
|
||||
private Integer dailySwapNum;
|
||||
|
||||
/**
|
||||
* 累计充电次数
|
||||
*/
|
||||
@JSONField(name = "DailyChargeNum")
|
||||
private Integer dailyChargeNum;
|
||||
|
||||
/**
|
||||
* 充换电站累计充电量
|
||||
*/
|
||||
|
||||
@@ -34,6 +34,7 @@ import com.jsowell.pile.service.*;
|
||||
import com.jsowell.pile.thirdparty.CommonParamsDTO;
|
||||
import com.jsowell.pile.thirdparty.EquipmentInfo;
|
||||
import com.jsowell.pile.util.MerchantUtils;
|
||||
import com.jsowell.pile.vo.SupStationStatsVO;
|
||||
import com.jsowell.pile.vo.ThirdPartySecretInfoVO;
|
||||
import com.jsowell.pile.vo.base.ConnectorInfoVO;
|
||||
import com.jsowell.pile.vo.base.MerchantInfoVO;
|
||||
@@ -66,6 +67,7 @@ import java.math.RoundingMode;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -836,7 +838,65 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
*/
|
||||
@Override
|
||||
public String notificationOperationStatsInfo(String stationId) {
|
||||
return ThirdPartyPlatformService.super.notificationOperationStatsInfo(stationId);
|
||||
List<SupStationStatsInfo> resultList = new ArrayList<>();
|
||||
// 根据站点id查询订单记录 (新建Service方法)
|
||||
List<SupStationStatsVO> orderVOS = orderBasicInfoService.queryOrderListByStationId(stationId);
|
||||
// 根据订单信息汇总出站点充电数据
|
||||
BigDecimal stationTotalElectricity = BigDecimal.ZERO; // 充电站累计用电量
|
||||
int stationChargeTime = Constants.zero; // 充电站累计充电次数
|
||||
for (SupStationStatsVO orderVO : orderVOS) {
|
||||
// 充电站累计用电量
|
||||
BigDecimal totalPower = orderVO.getTotalPower();
|
||||
if (totalPower == null || orderVO.getChargingTime() == null) {
|
||||
continue;
|
||||
}
|
||||
stationTotalElectricity = stationTotalElectricity.add(totalPower);
|
||||
// 充电站累计充电时长(分钟)
|
||||
stationChargeTime += orderVO.getChargingTime();
|
||||
}
|
||||
|
||||
// 创建对象
|
||||
String startTime = DateUtils.getYesterdayStr() + " 00:00:00";
|
||||
String endTime = DateUtils.getYesterdayStr() + " 23:59:59";
|
||||
SupStationStatsInfo supStationStatsInfo = SupStationStatsInfo.builder()
|
||||
.stationId(stationId)
|
||||
.operatorId(Constants.OPERATORID_JIANG_SU)
|
||||
.equipmentOwnerId(ThirdPartyPlatformUtils.extractEquipmentOwnerID(orderVOS.get(0).getOrganizationCode()))
|
||||
// .stationClassification(1)
|
||||
.startTime(startTime)
|
||||
.endTime(endTime)
|
||||
.stationElectricity(stationTotalElectricity)
|
||||
.dailyChargeEnergy(stationTotalElectricity)
|
||||
.dailyOtherEnergy(new BigDecimal("0"))
|
||||
.dailySwapNum(0)
|
||||
.dailyChargeNum(orderVOS.size())
|
||||
.stationTotalChargeTime(stationChargeTime)
|
||||
.stationTotalSwapTime(0)
|
||||
.stationTotalWarningNum(0)
|
||||
.build();
|
||||
resultList.add(supStationStatsInfo);
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("StationStatsInfos", resultList);
|
||||
String jsonString = JSON.toJSONString(json);
|
||||
// 发送推送请求
|
||||
ThirdPartySecretInfoVO ningXiaSecretInfo = getNeiMengGuPlatformSecretInfo();
|
||||
|
||||
String operatorId = Constants.OPERATORID_LIANLIAN;
|
||||
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_operation_stats_info";
|
||||
// 获取令牌
|
||||
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
|
||||
if (StringUtils.isBlank(token)) {
|
||||
return null;
|
||||
}
|
||||
// 调用平台接口
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret, thirdPlatformType);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -887,9 +947,9 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService {
|
||||
return null;
|
||||
}
|
||||
// 调用联联平台接口
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("ChargeOrderInfo", orderInfo);
|
||||
String jsonString = JSON.toJSONString(json);
|
||||
// JSONObject json = new JSONObject();
|
||||
// json.put("ChargeOrderInfo", orderInfo);
|
||||
String jsonString = JSON.toJSONString(orderInfo);
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret, thirdPlatformType);
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user