丢弃站推送结果

This commit is contained in:
ZZ 2021-11-22 18:02:49 +08:00
parent 14865e38eb
commit 343a45b2ee

View File

@ -4,7 +4,9 @@ import com.xhpc.common.api.dto.ChargingStationDto;
import com.xhpc.evcs.domain.AuthSecretToken; import com.xhpc.evcs.domain.AuthSecretToken;
import com.xhpc.evcs.domain.XhpcInternetUser; import com.xhpc.evcs.domain.XhpcInternetUser;
import com.xhpc.evcs.domain.XhpcStationInternetBlacklist; import com.xhpc.evcs.domain.XhpcStationInternetBlacklist;
import com.xhpc.evcs.dto.*; import com.xhpc.evcs.dto.CommonRequest;
import com.xhpc.evcs.dto.ConnectorStatusInfo;
import com.xhpc.evcs.dto.ConnectorStatusInfoReq;
import com.xhpc.evcs.jpa.AuthSecretTokenRepository; import com.xhpc.evcs.jpa.AuthSecretTokenRepository;
import com.xhpc.evcs.jpa.XhpcInternetUserRepository; import com.xhpc.evcs.jpa.XhpcInternetUserRepository;
import com.xhpc.evcs.jpa.XhpcStationInternetBlacklistRepository; import com.xhpc.evcs.jpa.XhpcStationInternetBlacklistRepository;
@ -49,7 +51,7 @@ public class NotificationStationStatusTask extends CoreDispatcher {
Map<String, String> terminalStatusMap = REDIS.getCacheMap(stationTerminalKey); Map<String, String> terminalStatusMap = REDIS.getCacheMap(stationTerminalKey);
Set<ConnectorStatusInfo> connectorStatusInfos = translateStatus(operatorId, terminalStatusMap); Set<ConnectorStatusInfo> connectorStatusInfos = translateStatus(operatorId, terminalStatusMap);
Set<ConnectorStatusInfo> changeStatus = ChangePoleStatus.getChangeStatus(connectorStatusInfos); Set<ConnectorStatusInfo> changeStatus = ChangePoleStatus.getChangeStatus(connectorStatusInfos);
if (!connectorStatusInfos.isEmpty()) { if (!changeStatus.isEmpty()) {
for (XhpcInternetUser xhpcInternetUser : xhpcInternetUserList) { for (XhpcInternetUser xhpcInternetUser : xhpcInternetUserList) {
XhpcStationInternetBlacklist xhpcStationInternetBlacklist = XhpcStationInternetBlacklist xhpcStationInternetBlacklist =
xhpcStationInternetBlacklistRepo.findByChargingStationIdAndInternetUserId(Long.valueOf(stationTerminalKey.split(":")[1]), xhpcStationInternetBlacklistRepo.findByChargingStationIdAndInternetUserId(Long.valueOf(stationTerminalKey.split(":")[1]),
@ -96,20 +98,14 @@ public class NotificationStationStatusTask extends CoreDispatcher {
} }
} }
public EvcsStatus notify(ConnectorStatusInfo connectorStatusInfo, AuthSecretToken authSecretTokenOut) throws IOException { public void notify(ConnectorStatusInfo connectorStatusInfo, AuthSecretToken authSecretTokenOut) throws IOException {
ConnectorStatusInfoReq connectorStatusInfoReq = new ConnectorStatusInfoReq(); ConnectorStatusInfoReq connectorStatusInfoReq = new ConnectorStatusInfoReq();
connectorStatusInfoReq.setConnectorStatusInfo(connectorStatusInfo); connectorStatusInfoReq.setConnectorStatusInfo(connectorStatusInfo);
String data = JSONUtil.toJSONString(connectorStatusInfoReq); String data = JSONUtil.toJSONString(connectorStatusInfoReq);
CommonRequest<ConnectorStatusInfoReq> commonRequest = new CommonRequest<>(); CommonRequest<ConnectorStatusInfoReq> commonRequest = new CommonRequest<>();
commonRequest.setData(data); commonRequest.setData(data);
String responseBody = ok(commonRequest, "/notification_stationStatus", authSecretTokenOut); ok(commonRequest, "/notification_stationStatus", authSecretTokenOut);
EvcsStatus status = DTOJsonHelper.parseResponseData(responseBody, EvcsStatus.class, authSecretTokenOut);
if (status == null || status.getStatus() != 0) {
log.error("op3dp[{}] push station status connector[{}] failed: {}",
authSecretTokenOut.getOperatorId3irdpty(), connectorStatusInfo.getConnectorID(), responseBody);
}
return status;
} }
} }