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)) {