From 53686f2b9339e450594af086bd1c1a27d9a75eab Mon Sep 17 00:00:00 2001 From: Lemon Date: Wed, 13 Sep 2023 14:15:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E6=89=AB=E4=BA=8C?= =?UTF-8?q?=E7=BB=B4=E7=A0=81=E6=97=B6=E5=88=A4=E6=96=AD=E6=A1=A9=E3=80=81?= =?UTF-8?q?=E6=9E=AA=E5=8F=A3=E7=8A=B6=E6=80=81=E5=B9=B6=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=AF=B9=E5=BA=94=E7=9A=84=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/jsowell/service/PileService.java | 7 +++++++ .../jsowell/pile/service/IPileConnectorInfoService.java | 2 ++ .../pile/service/impl/PileConnectorInfoServiceImpl.java | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/jsowell-admin/src/main/java/com/jsowell/service/PileService.java b/jsowell-admin/src/main/java/com/jsowell/service/PileService.java index 16eff3827..fb30d89f8 100644 --- a/jsowell-admin/src/main/java/com/jsowell/service/PileService.java +++ b/jsowell-admin/src/main/java/com/jsowell/service/PileService.java @@ -190,6 +190,13 @@ public class PileService { return null; } + // 判断桩是否在线 + boolean onLineStatus = pileConnectorInfoService.checkPileOffLine(pileInfoVO.getPileSn()); + if (!onLineStatus) { + // 离线 + throw new BusinessException(ReturnCodeEnum.CODE_PILE_CONNECTOR_STATUS_ERROR); + } + // 查询站点信息 PileStationVO stationInfo = pileStationInfoService.getStationInfo(pileInfoVO.getStationId()); if (stationInfo == null || StringUtils.equals(stationInfo.getOpenFlag(), Constants.ZERO)) { diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/IPileConnectorInfoService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/IPileConnectorInfoService.java index 58b4e09c6..5a83fa83d 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/IPileConnectorInfoService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/IPileConnectorInfoService.java @@ -131,4 +131,6 @@ public interface IPileConnectorInfoService { * @param pileConnectorInfo */ int updateConnectorParkNo(UpdateConnectorParkNoDTO dto); + + boolean checkPileOffLine(String pileSn); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java index ccea571d5..5833838f5 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java @@ -663,7 +663,7 @@ public class PileConnectorInfoServiceImpl implements IPileConnectorInfoService { * @param pileSn 桩编号 * @return true离线 */ - private boolean checkPileOffLine(String pileSn) { + public boolean checkPileOffLine(String pileSn) { // 获取桩最后连接时间,最后连接到平台的时间在1分钟之前,判定为离线 String lastConnectionTime = redisCache.getCacheObject(CacheConstants.PILE_LAST_CONNECTION + pileSn); if (StringUtils.isBlank(lastConnectionTime)) {