update 江苏省平台接口

This commit is contained in:
Lemon
2023-10-20 17:20:31 +08:00
parent be44562253
commit 4c6277b36c
6 changed files with 65 additions and 49 deletions

View File

@@ -151,11 +151,11 @@ public class NRServiceImpl implements NRService {
// 拼装南瑞平台所需参数
NRStationInfo nrStationInfo = NRStationInfo.builder()
.stationId("NR" + stationInfoVO.getId())
.operatorID("014406554")
.equipmentOwnerID("014406554")
.operatorID(Constants.OPERATORID_JIANG_SU)
.equipmentOwnerID(Constants.OPERATORID_JIANG_SU)
.stationName(stationInfoVO.getStationName())
.countryCode(stationInfoVO.getCountryCode())
.areaCode(stationInfoVO.getAreaCode())
// .areaCode()
.address(stationInfoVO.getAddress())
.serviceTel(stationInfoVO.getStationTel())
.stationStatus(stationInfoVO.getStationStatus())
@@ -166,7 +166,6 @@ public class NRServiceImpl implements NRService {
.openAllDay(Integer.parseInt(stationInfoVO.getOpenAllDay()))
.busineHours(stationInfoVO.getBusinessHours())
.minElectricityPrice(stationInfoVO.getElectricityPrice().add(stationInfoVO.getServicePrice()))
.loungeFlag(0)
.isAloneApply(0)
.printerFlag(0)
@@ -185,6 +184,12 @@ public class NRServiceImpl implements NRService {
.parkFeeType(1)
.build();
// 站点地址
String areaCode = stationInfoVO.getAreaCode();
// 截取最后一组数据,例如将 320000,320500,320583 截取为 320583
String[] split = StringUtils.split(areaCode, ",");
String s = split[split.length - 1];
nrStationInfo.setAreaCode(s);
// 站点图片
if (CollectionUtils.isNotEmpty(stationInfoVO.getPictureList())) {
nrStationInfo.setPictures(stationInfoVO.getPictureList());
@@ -203,15 +208,15 @@ public class NRServiceImpl implements NRService {
// 推送到平台
String url = urlAddress + "notification_stationInfo";
String jsonStr = JSONObject.toJSONString(nrStationInfo);
JSONObject data = new JSONObject();
data.put("StationInfo", jsonStr);
data.put("StationInfo", nrStationInfo);
String jsonString = JSONObject.toJSONString(data);
String jsonString = data.toString();
System.out.println("jsonString : " + jsonString);
// 获取令牌
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
System.out.println(token);
String result = HttpRequestUtil.nrSendPost(token, jsonString, url, dataSecret
, dataSecretIv, operatorId, signSecret);
@@ -244,9 +249,9 @@ public class NRServiceImpl implements NRService {
for (PileStationInfo pileStationInfo : pageInfo.getList()) {
// 拼装参数
NRStationInfo nrStationInfo = NRStationInfo.builder()
.stationId(String.valueOf(pileStationInfo.getId()))
.operatorID(Constants.OPERATORID_LIANLIAN)
.equipmentOwnerID(Constants.OPERATORID_LIANLIAN)
.stationId("NR" + pileStationInfo.getId())
.operatorID(Constants.OPERATORID_JIANG_SU)
.equipmentOwnerID(Constants.OPERATORID_JIANG_SU)
.stationName(pileStationInfo.getStationName())
.countryCode(pileStationInfo.getCountryCode())
.areaCode(pileStationInfo.getAreaCode())
@@ -352,7 +357,7 @@ public class NRServiceImpl implements NRService {
.connectorId(dto.getPileConnectorCode())
.alertTime(DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD_HH_MM_SS))
.alertCode(120) // 120-预留
.describe(faultReason)
.describe("急停按钮动作故障")
.status(status)
.build();
@@ -361,9 +366,8 @@ public class NRServiceImpl implements NRService {
// 发送请求
String url = urlAddress + "notification_alarmInfo";
String jsonStr = JSONObject.toJSONString(nrAlarmInfos);
JSONObject data = new JSONObject();
data.put("AlarmInfos", jsonStr);
data.put("AlarmInfos", nrAlarmInfos);
String jsonString = JSONObject.toJSONString(data);
System.out.println("jsonString : " + jsonString);
@@ -418,8 +422,8 @@ public class NRServiceImpl implements NRService {
NRConnectorStatusInfo nrConnectorStatusInfo = NRConnectorStatusInfo.builder()
.connectorID(pileConnectorCode)
.status(Integer.parseInt(connectorStatus))
.currentA(Integer.parseInt(realTimeMonitorData.getOutputCurrent()))
.voltageA(Integer.parseInt(realTimeMonitorData.getOutputVoltage()))
.currentA(new BigDecimal(realTimeMonitorData.getOutputCurrent()).intValue())
.voltageA(new BigDecimal(realTimeMonitorData.getOutputVoltage()).intValue())
.soc(BigDecimal.ZERO)
.beginTime(DateUtils.formatDateTime(orderBasicInfo.getChargeStartTime()))
.currentKwh(new BigDecimal(realTimeMonitorData.getChargingDegree()).setScale(3, BigDecimal.ROUND_HALF_UP))