update 华为Service

This commit is contained in:
Lemon
2024-04-01 16:17:00 +08:00
parent 7064f4e4b2
commit 60d54f8fea
12 changed files with 338 additions and 163 deletions

View File

@@ -2,6 +2,7 @@ package com.jsowell.thirdparty.common;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.google.common.collect.Lists;
import com.jsowell.common.constant.CacheConstants;
import com.jsowell.common.constant.Constants;
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
@@ -508,47 +509,16 @@ public class CommonService {
*/
public String commonQueryStartCharge(ThirdPartyCommonStartChargeDTO dto) {
String thirdPartyType = dto.getThirdPartyType();
List<String> stationIds = dto.getStationIds();
String pileConnectorCode = dto.getPileConnectorCode();
BigDecimal chargeAmount = dto.getChargeAmount();
String payMode = dto.getPayMode();
// List<String> stationIds = dto.getStationIds();
// String pileConnectorCode = dto.getPileConnectorCode();
// BigDecimal chargeAmount = dto.getChargeAmount();
// String payMode = dto.getPayMode();
// 判断平台类型
if (StringUtils.equals(ThirdPlatformTypeEnum.HUA_WEI.getTypeCode(), thirdPartyType)) {
// 华为平台
String label = ThirdPlatformTypeEnum.getTypeLabelByTypeCode(thirdPartyType);
// query_station_status 查询站点枪口详情
Map<String, String> map = huaweiServiceV2.queryStationStatus(stationIds);
String status = map.get(pileConnectorCode);
// 判断枪口状态
if (!StringUtils.equals(PileConnectorDataBaseStatusEnum.OCCUPIED_NOT_CHARGED.getValue(), status)) {
log.error(label + "判断枪口状态 error, 枪口状态为:{}", status);
}
// query_equip_auth 请求设备认证
QueryEquipAuthVO vo = huaweiServiceV2.queryEquipAuth(pileConnectorCode);
Integer succStat = vo.getSuccStat();
if (succStat != Constants.zero) {
log.error(label + "请求设备认证 error, {}", vo.getFailReason());
}
// query_start_charge 请求启动充电
HWQueryStartChargeDTO chargeDTO = new HWQueryStartChargeDTO();
chargeDTO.setConnectorID(pileConnectorCode);
chargeDTO.setMoneyLimit(chargeAmount);
chargeDTO.setPayMode(payMode);
QueryStartChargeVO startChargeVO = huaweiServiceV2.queryStartCharge(chargeDTO);
if (startChargeVO.getSuccStat() != Constants.zero) {
log.error(label + "请求启动充电 error, {}", startChargeVO.getFailReason());
}
String startChargeSeq = startChargeVO.getStartChargeSeq(); // 充电订单号
// 延时2s查询充电状态
Threads.sleep(2000);
// query_equip_charge_status 查询设备充电状态
QueryChargeStatusVO chargeStatusVO = huaweiServiceV2.queryChargeStatus(startChargeSeq);
if (chargeStatusVO.getConnectorStatus() == 3) {
// 充电中, 返回充电订单号
return chargeStatusVO.getStartChargeSeq();
}
String result = huaweiServiceV2.startChargeFlow(dto);
log.info("华为统一请求启动充电 result:{}", result);
}
return null;
@@ -595,4 +565,13 @@ public class CommonService {
return connectorStatus;
}
}
public void commonQueryStationStatus(String stationId, String thirdPartyType) {
if (StringUtils.equals(ThirdPlatformTypeEnum.HUA_WEI.getTypeCode(), thirdPartyType)) {
// 华为平台
Map<String, String> map = huaweiServiceV2.queryStationStatus(Lists.newArrayList(stationId));
// key: pileConnectorCode,
// value: status
}
}
}