查询站点地锁列表接口添加过滤条件

This commit is contained in:
Lemon
2023-08-14 11:07:04 +08:00
parent 2f1116d016
commit 4edaef6661

View File

@@ -43,6 +43,7 @@ import java.math.RoundingMode;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* 设备管理Service业务层处理
@@ -710,6 +711,22 @@ public class PileBasicInfoServiceImpl implements IPileBasicInfoService {
pileBasicInfoMapper.updatePileMerchantBatch(pileIdList, newMerchantId);
}
public static void main(String[] args) {
List<String> list = new ArrayList<>();
list.add("0");
list.add("1");
list.add("4");
list.add("3");
list.add("2");
list.add(null);
list.add("");
list = list.stream().filter(StringUtils::isNotBlank).collect(Collectors.toList());
list.sort(Comparator.comparing(Integer::new));
System.out.println(list);
}
/**
* 获取地锁信息
* @param stationId
@@ -722,8 +739,15 @@ public class PileBasicInfoServiceImpl implements IPileBasicInfoService {
List<GroundLockInfoVO.LockInfo> lockInfoList;
// 根据站点id查出该站点下所有桩区分单双枪
List<PileConnectorInfoVO> connectorInfoVOList = pileConnectorInfoService.selectConnectorListByStationId(Long.parseLong(stationId));
// 根据pileSn分组
Map<String, List<PileConnectorInfoVO>> collect = connectorInfoVOList.stream().collect(Collectors.groupingBy(PileConnectorInfoVO::getPileSn));
// 过滤掉别名为空的数据
connectorInfoVOList = connectorInfoVOList.stream()
.filter(x -> StringUtils.isNotBlank(x.getName()))
.collect(Collectors.toList());
// 然后根据别名排序
connectorInfoVOList.sort(Comparator.comparing(x -> new Integer(x.getName())));
// 再根据pileSn分组
Map<String, List<PileConnectorInfoVO>> collect = connectorInfoVOList.stream()
.collect(Collectors.groupingBy(PileConnectorInfoVO::getPileSn));
// 根据桩别名分组
// Map<String, List<PileConnectorInfoVO>> collect = connectorInfoVOList.stream().collect(Collectors.groupingBy(PileConnectorInfoVO::getName));