新增 根据站点id查询地锁信息接口

This commit is contained in:
Lemon
2023-08-05 13:15:02 +08:00
parent daba8e7a98
commit 385c2c9781
4 changed files with 138 additions and 8 deletions

View File

@@ -6,6 +6,7 @@ import com.jsowell.pile.dto.IndexQueryDTO;
import com.jsowell.pile.dto.QueryPileDTO;
import com.jsowell.pile.dto.ReplaceMerchantStationDTO;
import com.jsowell.pile.vo.base.PileInfoVO;
import com.jsowell.pile.vo.uniapp.GroundLockInfoVO;
import com.jsowell.pile.vo.uniapp.PersonalPileInfoVO;
import com.jsowell.pile.vo.uniapp.PileConnectorDetailVO;
import com.jsowell.pile.vo.web.IndexGeneralSituationVO;
@@ -169,4 +170,11 @@ public interface IPileBasicInfoService {
* 批量修改充电桩运营商
*/
void updatePileMerchantBatch(List<Long> pileIdList, String newMerchantId);
/**
* 获取地锁信息
* @param stationId
* @return
*/
List<GroundLockInfoVO> getGroundLockInfo(String stationId);
}

View File

@@ -5,6 +5,7 @@ import com.google.common.collect.Lists;
import com.jsowell.common.constant.CacheConstants;
import com.jsowell.common.constant.Constants;
import com.jsowell.common.core.domain.vo.AuthorizedDeptVO;
import com.jsowell.common.core.domain.ykc.GroundLockData;
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
import com.jsowell.common.core.redis.RedisCache;
@@ -34,16 +35,15 @@ import com.jsowell.pile.service.IPileStationInfoService;
import com.jsowell.pile.service.SimCardService;
import com.jsowell.pile.vo.base.MerchantInfoVO;
import com.jsowell.pile.vo.base.PileInfoVO;
import com.jsowell.pile.vo.uniapp.GroundLockInfoVO;
import com.jsowell.pile.vo.uniapp.PersonalPileInfoVO;
import com.jsowell.pile.vo.uniapp.PileConnectorDetailVO;
import com.jsowell.pile.vo.web.IndexGeneralSituationVO;
import com.jsowell.pile.vo.web.PileDetailVO;
import com.jsowell.pile.vo.web.PileModelInfoVO;
import com.jsowell.pile.vo.web.SimCardVO;
import com.jsowell.pile.vo.web.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cglib.beans.BulkBean;
import org.springframework.stereotype.Service;
import org.springframework.util.StopWatch;
@@ -705,4 +705,53 @@ public class PileBasicInfoServiceImpl implements IPileBasicInfoService {
}
pileBasicInfoMapper.updatePileMerchantBatch(pileIdList, newMerchantId);
}
/**
* 获取地锁信息
* @param stationId
* @return
*/
@Override
public List<GroundLockInfoVO> getGroundLockInfo(String stationId) {
List<GroundLockInfoVO> resultList = new ArrayList<>();
GroundLockInfoVO vo = null;
GroundLockInfoVO.LockInfo lockInfo = null;
List<GroundLockInfoVO.LockInfo> lockInfoList = new ArrayList<>();
// 根据站点id查出该站点下所有桩区分单双枪
List<PileConnectorInfoVO> connectorInfoVOList = pileConnectorInfoService.selectConnectorListByStationId(Long.parseLong(stationId));
// 根据pileSn分组
Map<String, List<PileConnectorInfoVO>> collect = connectorInfoVOList.stream().collect(Collectors.groupingBy(PileConnectorInfoVO::getPileSn));
for (Map.Entry<String, List<PileConnectorInfoVO>> entry : collect.entrySet()) {
vo = new GroundLockInfoVO();
String pileSn = entry.getKey();
List<PileConnectorInfoVO> list = entry.getValue();
for (PileConnectorInfoVO pileConnectorInfoVO : list) {
// 查地锁缓存状态,有缓存说明有地锁信息
String redisKey = CacheConstants.GROUND_LOCK_DATA + pileConnectorInfoVO.getPileConnectorCode();
GroundLockData data = redisCache.getCacheObject(redisKey);
if (Objects.isNull(data)) {
continue;
}
String parkingLockStatus = data.getParkingLockStatus();
if (StringUtils.equals(parkingLockStatus, "FF")) {
// 降锁状态
parkingLockStatus = "降锁";
}else if (StringUtils.equals(parkingLockStatus, "55")) {
// 升锁状态
parkingLockStatus = "升锁";
}
lockInfo = GroundLockInfoVO.LockInfo.builder()
.connectorCode(pileConnectorInfoVO.getPileConnectorCode())
.lockStatus(parkingLockStatus)
.parkingStatus(data.getParkingStatus())
.build();
lockInfoList.add(lockInfo);
}
vo.setPileSn(pileSn);
vo.setLockInfos(lockInfoList);
resultList.add(vo);
}
return resultList;
}
}

View File

@@ -0,0 +1,51 @@
package com.jsowell.pile.vo.uniapp;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* 地锁信息VO
*
* @author Lemon
* @Date 2023/8/5 10:57
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class GroundLockInfoVO {
/**
* 桩编号
*/
private String pileSn;
/**
* 地锁List
*/
private List<LockInfo> lockInfos;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public static class LockInfo {
/**
* 枪口号
*/
private String connectorCode;
/**
* 地锁状态
*/
private String lockStatus;
/**
* 车位状态
*/
private String parkingStatus;
}
}