update 浙江省平台接口

This commit is contained in:
Lemon
2024-08-15 15:31:43 +08:00
parent f9dabe16bb
commit bbed186e1a
6 changed files with 104 additions and 45 deletions

View File

@@ -104,12 +104,12 @@ public class SupConnectorStatusInfo {
* 描述: 最近一次状态变化的时间格式“yyyy-MM-ddHH:mm:ss”
*/
@JSONField(name = "LastChangeTime")
private String lastChangeTime = DateUtils.getDateTime();
private String lastChangeTime;
/**
* 状态更新时间
* 本次状态变化的时间格式“yyyy-MM-dd HH:mm:ss”
*/
@JSONField(name = "UpdateTime")
private String UpdateTime = DateUtils.getDateTime();
private String updateTime;
}

View File

@@ -416,11 +416,10 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService {
// 调用联联平台接口
String url = urlAddress + "supervise_notification_station_info";
String jsonStr = JSON.toJSONString(info);
JSONObject data = new JSONObject();
data.put("StationInfo", jsonStr);
data.put("SupStationInfo", info);
String jsonString = JSON.toJSONString(data);
String jsonString = JSON.toJSONString(info);
// 获取令牌
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
@@ -446,20 +445,20 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService {
}
SupConnectorStatusInfo info = SupConnectorStatusInfo.builder()
.operatorID(Constants.JSOWELL_OPERATORID)
.operatorID(Constants.OPERATORID_JIANG_SU)
.equipmentOwnerID(MerchantUtils.getOperatorID(merchantInfoVO.getOrganizationCode()))
.stationID(connectorInfo.getStationId())
.equipmentID(connectorInfo.getPileSn())
.connectorID(pileConnectorCode)
.equipmentClassification(Constants.ONE)
.status(Integer.parseInt(status))
.statusDesc(PileConnectorDataBaseStatusEnum.getStatusDescription(status))
.parkStatus(Constants.zero)
.lockStatus(Constants.zero)
.updateTime(DateUtils.getDateTime())
.build();
// 调用联联平台接口
String operatorId = secretInfoVO.getTheirOperatorId();
String operatorId = Constants.OPERATORID_JIANG_SU;
String operatorSecret = secretInfoVO.getTheirOperatorSecret();
String signSecret = secretInfoVO.getTheirSigSecret();
String dataSecret = secretInfoVO.getTheirDataSecret();
@@ -547,11 +546,13 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService {
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
// 查询枪口状态
PileConnectorInfoVO info = pileConnectorInfoService.getPileConnectorInfoByConnectorCode(orderInfo.getPileConnectorCode());
BigDecimal current = info.getCurrent() == null ? BigDecimal.ZERO : info.getCurrent();
BigDecimal voltage = info.getVoltage() == null ? BigDecimal.ZERO : info.getVoltage();
String soc = info.getSOC() == null ? Constants.ZERO : info.getSOC();
// 查询相关配置信息
ThirdPartySecretInfoVO zheJiangPlatformSecretInfo = getZheJiangPlatformSecretInfo();
String operatorId = zheJiangPlatformSecretInfo.getTheirOperatorId();
String operatorId = zheJiangPlatformSecretInfo.getOurOperatorId();
String operatorSecret = zheJiangPlatformSecretInfo.getTheirOperatorSecret();
String signSecret = zheJiangPlatformSecretInfo.getTheirSigSecret();
String dataSecret = zheJiangPlatformSecretInfo.getTheirDataSecret();
@@ -569,15 +570,15 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService {
.orderStatus(2)
.pushTimeStamp(dateTime)
.connectorStatus(info.getStatus()) // 3-充电中
.currentA(info.getCurrent().setScale(1, BigDecimal.ROUND_HALF_UP))
.voltageA(info.getVoltage().setScale(1, BigDecimal.ROUND_HALF_UP))
.soc(new BigDecimal(info.getSOC()))
.currentA(current.setScale(1, BigDecimal.ROUND_HALF_UP))
.voltageA(voltage.setScale(1, BigDecimal.ROUND_HALF_UP))
.soc(new BigDecimal(soc))
.startTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderInfo.getChargeStartTime()))
.endTime(dateTime)
.totalPower(info.getChargingDegree())
.eventTime(dateTime)
.chargeVoltage(info.getVoltage().setScale(1, BigDecimal.ROUND_HALF_UP))
.chargeCurrent(info.getCurrent().setScale(1, BigDecimal.ROUND_HALF_UP))
.chargeVoltage(voltage.setScale(1, BigDecimal.ROUND_HALF_UP))
.chargeCurrent(current.setScale(1, BigDecimal.ROUND_HALF_UP))
.build();
// 查询运营商信息
@@ -588,7 +589,7 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService {
supEquipChargeStatusInfo.setEquipmentOwnerID(equipmentOwnerId);
}
String url = urlAddress + BusinessInformationExchangeEnum.NOTIFICATION_EQUIP_CHARGE_STATUS.getValue();
String url = urlAddress + "supervise_notification_equip_charge_status";
// 调用平台接口
String jsonString = JSON.toJSONString(supEquipChargeStatusInfo);
@@ -603,21 +604,19 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService {
* supervise_notification_charge_order_info
*/
@Override
public String notificationChargeOrderInfo(String orderCode) {
public String notificationChargeOrderInfo(String orderCode, ThirdPartySecretInfoVO secretInfoVO) {
// 根据订单号查询出信息
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
if (orderBasicInfo == null) {
return null;
}
ThirdPartySecretInfoVO ningXiaSecretInfo = getZheJiangPlatformSecretInfo();
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 operatorId = Constants.OPERATORID_JIANG_SU;
String operatorSecret = secretInfoVO.getTheirOperatorSecret();
String signSecret = secretInfoVO.getTheirSigSecret();
String dataSecret = secretInfoVO.getTheirDataSecret();
String dataSecretIv = secretInfoVO.getTheirDataSecretIv();
String urlAddress = secretInfoVO.getTheirUrlPrefix();
// 根据订单号查询订单详情
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode);
@@ -635,7 +634,13 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService {
if (MerchantUtils.isXiXiaoMerchant(orderBasicInfo.getMerchantId())) {
equipmentOwnerID = Constants.OPERATORID_XI_XIAO;
} else {
equipmentOwnerID = Constants.OPERATORID_LIANLIAN;
PileMerchantInfoVO pileMerchantInfoVO = pileMerchantInfoService.queryMerchantInfoByStationId(orderInfo.getStationID());
String organizationCode = pileMerchantInfoVO.getOrganizationCode();
if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) {
equipmentOwnerID = ThirdPartyPlatformUtils.extractEquipmentOwnerID(pileMerchantInfoVO.getOrganizationCode());
}else {
equipmentOwnerID = Constants.OPERATORID_JIANG_SU;
}
}
orderInfo.setEquipmentOwnerID(equipmentOwnerID);
@@ -654,7 +659,7 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService {
// 调用联联平台接口
JSONObject json = new JSONObject();
json.put("ChargeOrderInfo", orderInfo);
String jsonString = JSON.toJSONString(json);
String jsonString = JSON.toJSONString(orderInfo);
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
return result;
}
@@ -755,23 +760,25 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService {
List<SupStationPowerInfo> supStationPowerInfoList = new ArrayList<>();
stationIds.forEach(stationId -> {
PileStationVO stationInfo = pileStationInfoService.getStationInfo(stationId);
String dateTimeNow = DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD_HH_MM_SS);
PileMerchantInfoVO pileMerchantInfoVO = pileMerchantInfoService.queryMerchantInfoByStationId(stationId);
String dateTimeNow = DateUtils.getDateTime();
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.setOperatorId(Constants.OPERATORID_JIANG_SU);
String equipmentOwnerID = ThirdPartyPlatformUtils.extractEquipmentOwnerID(pileMerchantInfoVO.getOrganizationCode());
supStationPowerInfo.setEquipmentOwnerID(equipmentOwnerID);
supStationPowerInfo.setStationId(stationId);
supStationPowerInfo.setStationClassification(1);
// supStationPowerInfo.setStationClassification(1);
supStationPowerInfo.setDataTime(dateTimeNow);
for (PileBasicInfo pileBasicInfo : pileList) {
equipmentPowerInfo = new SupStationPowerInfo.EquipmentPowerInfo();
equipmentPowerInfo.setEquipmentID(pileBasicInfo.getSn());
equipmentPowerInfo.setEquipmentClassification(1);
// equipmentPowerInfo.setEquipmentClassification(1);
equipmentPowerInfo.setDataTime(dateTimeNow);
// 根据桩sn查询枪口列表
@@ -793,7 +800,7 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService {
connectorPowerInfo = new SupStationPowerInfo.EquipmentPowerInfo.ConnectorPowerInfo();
connectorPowerInfo.setConnectorID(connectorInfo.getPileConnectorCode());
connectorPowerInfo.setEquipmentClassification(1);
// connectorPowerInfo.setEquipmentClassification(1);
connectorPowerInfo.setDataTime(dateTimeNow);
connectorPowerInfo.setConnectorRealTimePower(instantPower);
@@ -813,14 +820,14 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService {
supStationPowerInfoList.add(supStationPowerInfo);
});
// 发送请求
ThirdPartySecretInfoVO ningXiaSecretInfo = getZheJiangPlatformSecretInfo();
ThirdPartySecretInfoVO zheJiangPlatformSecretInfo = getZheJiangPlatformSecretInfo();
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 operatorId = zheJiangPlatformSecretInfo.getOurOperatorId();
String operatorSecret = zheJiangPlatformSecretInfo.getTheirOperatorSecret();
String signSecret = zheJiangPlatformSecretInfo.getTheirSigSecret();
String dataSecret = zheJiangPlatformSecretInfo.getTheirDataSecret();
String dataSecretIv = zheJiangPlatformSecretInfo.getTheirDataSecretIv();
String urlAddress = zheJiangPlatformSecretInfo.getTheirUrlPrefix();
String url = urlAddress + "supervise_notification_realtime_power_info";
// 获取令牌
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);

View File

@@ -165,7 +165,7 @@ public class HttpRequestUtil {
// log.info("联联平台发送请求 返回数据map:{}", JSON.toJSONString(map));
int ret = (int) map.get("Ret");
int ret = Integer.parseInt(String.valueOf(map.get("Ret")));
String resultMsg = (String) map.get("Msg");
if (ret != 0) {
// 表示请求有异常