mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 19:15:35 +08:00
update 华为Service
This commit is contained in:
@@ -261,10 +261,14 @@ public class HuaweiServiceV2 {
|
||||
for (HWStationStatusInfo.ConnectorStatusInfo connectorStatusInfo : connectorStatusInfos) {
|
||||
String connectorId = connectorStatusInfo.getConnectorId();
|
||||
String status = connectorStatusInfo.getStatus();
|
||||
String pileSn = StringUtils.substring(connectorId, 0, 14);
|
||||
// 修改对应枪口状态
|
||||
pileConnectorInfoService.updateConnectorStatus(connectorId, status);
|
||||
// 将对应枪口的订单存入map
|
||||
resultMap.put(connectorId, status);
|
||||
if (!StringUtils.equals(Constants.ZERO, status)) {
|
||||
setPileAlive(pileSn);
|
||||
}
|
||||
}
|
||||
}
|
||||
return resultMap;
|
||||
@@ -281,6 +285,10 @@ public class HuaweiServiceV2 {
|
||||
public Map<String, String> receiveNotificationStationStatus(ConnectorStatusInfo connectorStatusInfo) {
|
||||
String pileConnectorCode = connectorStatusInfo.getConnectorID();
|
||||
Integer status = connectorStatusInfo.getStatus();
|
||||
String pileSn = StringUtils.substring(pileConnectorCode, 0, 14);
|
||||
if (status != 0) {
|
||||
setPileAlive(pileSn);
|
||||
}
|
||||
ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(connectorStatusInfo.getOperatorId());
|
||||
if (configInfo == null) {
|
||||
return null;
|
||||
@@ -325,6 +333,9 @@ public class HuaweiServiceV2 {
|
||||
|
||||
// 转换成 StationStatus 对象
|
||||
QueryEquipAuthVO queryEquipAuthVO = JSON.parseObject(result, QueryEquipAuthVO.class);
|
||||
String connectorID = queryEquipAuthVO.getConnectorID();
|
||||
String pileSn = StringUtils.substring(connectorID, 0, 14);
|
||||
setPileAlive(pileSn);
|
||||
return queryEquipAuthVO;
|
||||
}
|
||||
|
||||
@@ -553,6 +564,9 @@ public class HuaweiServiceV2 {
|
||||
Integer startChargeSeqStat = dto.getStartChargeSeqStat(); // 充电订单状态
|
||||
Integer failReason = dto.getFailReason();
|
||||
String startTime = dto.getStartTime();
|
||||
String connectorID = dto.getConnectorID();
|
||||
String pileSn = StringUtils.substring(connectorID, 0, 14);
|
||||
setPileAlive(pileSn);
|
||||
// 根据订单号查询订单信息
|
||||
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(startChargeSeq);
|
||||
// 判断订单状态
|
||||
@@ -602,10 +616,26 @@ public class HuaweiServiceV2 {
|
||||
}
|
||||
// 转换成 QueryChargeStatusVO 对象
|
||||
QueryChargeStatusVO vo = JSON.parseObject(result, QueryChargeStatusVO.class);
|
||||
Integer connectorStatus = vo.getConnectorStatus();
|
||||
String connectorID = vo.getConnectorID();
|
||||
String pileSn = StringUtils.substring(connectorID, 0, 14);
|
||||
if (connectorStatus != 0) {
|
||||
setPileAlive(pileSn);
|
||||
}
|
||||
return vo;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置桩上次连接时间
|
||||
* @param pileSn
|
||||
*/
|
||||
private void setPileAlive(String pileSn) {
|
||||
// 设置桩上次连接时间
|
||||
String redisKey = CacheConstants.PILE_LAST_CONNECTION + pileSn;
|
||||
redisCache.setCacheObject(redisKey, DateUtils.getDateTime(), CacheConstants.cache_expire_time_1d);
|
||||
}
|
||||
|
||||
/**
|
||||
* 接收华为所推送的设备充电状态
|
||||
* @param dto
|
||||
@@ -614,6 +644,12 @@ public class HuaweiServiceV2 {
|
||||
String startChargeSeq = dto.getStartChargeSeq(); // 订单号
|
||||
String startTime = dto.getStartTime();
|
||||
String endTime = dto.getEndTime();
|
||||
String connectorID = dto.getConnectorID();
|
||||
Integer connectorStatus = dto.getConnectorStatus();
|
||||
String pileSn = StringUtils.substring(connectorID, 0, 14);
|
||||
if (connectorStatus != 0) {
|
||||
setPileAlive(pileSn);
|
||||
}
|
||||
// 计算时间间隔
|
||||
String poorDays = DateUtils.getDatePoor(DateUtils.parseDate(endTime), DateUtils.parseDate(startTime));
|
||||
// 通过订单号查询交易流水号
|
||||
@@ -632,7 +668,7 @@ public class HuaweiServiceV2 {
|
||||
.transactionCode(orderBasicInfo.getTransactionCode())
|
||||
.pileSn(orderBasicInfo.getPileSn())
|
||||
.connectorCode(orderBasicInfo.getConnectorCode())
|
||||
.connectorStatus(String.valueOf(dto.getConnectorStatus()))
|
||||
.connectorStatus(String.valueOf(connectorStatus))
|
||||
.pileConnectorCode(orderBasicInfo.getPileConnectorCode())
|
||||
.outputVoltage(String.valueOf(dto.getVoltageA()))
|
||||
.outputCurrent(String.valueOf(dto.getCurrentA()))
|
||||
@@ -682,6 +718,9 @@ public class HuaweiServiceV2 {
|
||||
}
|
||||
// 转换成 QueryStartChargeVO 对象
|
||||
QueryStartChargeVO vo = JSON.parseObject(result, QueryStartChargeVO.class);
|
||||
String connectorID = vo.getConnectorID();
|
||||
String pileSn = StringUtils.substring(connectorID, 0, 14);
|
||||
setPileAlive(pileSn);
|
||||
return vo;
|
||||
}
|
||||
|
||||
@@ -695,6 +734,9 @@ public class HuaweiServiceV2 {
|
||||
Integer startChargeSeqStat = vo.getStartChargeSeqStat();
|
||||
Integer succStat = vo.getSuccStat();
|
||||
Integer failReasonCode = vo.getFailReason();
|
||||
String connectorID = vo.getConnectorID();
|
||||
String pileSn = StringUtils.substring(connectorID, 0, 14);
|
||||
setPileAlive(pileSn);
|
||||
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(startChargeSeq);
|
||||
if (orderBasicInfo == null) {
|
||||
return null;
|
||||
@@ -728,6 +770,8 @@ public class HuaweiServiceV2 {
|
||||
String startChargeSeq = dto.getStartChargeSeq();
|
||||
List<QueryChargeStatusVO.ChargeDetail> chargeDetails = dto.getChargeDetails();
|
||||
String pileConnectorCode = dto.getConnectorID();
|
||||
String pileSn = StringUtils.substring(pileConnectorCode, 0, 14);
|
||||
setPileAlive(pileSn);
|
||||
|
||||
// 将源数据存缓存
|
||||
String redisKey = CacheConstants.HUA_WEI_ORDER_INFO_BY_ORDER_CODE + startChargeSeq;
|
||||
|
||||
Reference in New Issue
Block a user