分组后取每组时间最大的一条数据
try {
list = stockFlowDao.searchStockFlowMaxInTime(partsIds);
if (list.size() > 0 && list.get(0) != null){
Map<Long, List<StockFlowMaxInTimeVo>> longListMap = list.stream().collect(Collectors.groupingBy(StockFlowMaxInTimeVo::getStockId));
list=new ArrayList<>();
Set<Long> longs = longListMap.keySet();
for (Long aLong : longs) {
Optional<StockFlowMaxInTimeVo> inTimeVoOptional = longListMap.get(aLong).stream().max(Comparator.comparing(StockFlowMaxInTimeVo::getInTime));
list.add(inTimeVoOptional.get());
}
}
} catch (Exception e) {
e.printStackTrace();
}


try {
list = stockFlowDao.searchStockFlowMaxInTime(partsIds);
if (list.size() > 0 && list.get(0) != null){
Map<Long, List<StockFlowMaxInTimeVo>> longListMap = list.stream().collect(Collectors.groupingBy(StockFlowMaxInTimeVo::getStockId));
list=new ArrayList<>();
Set<Long> longs = longListMap.keySet();
for (Long aLong : longs) {
Optional<StockFlowMaxInTimeVo> inTimeVoOptional = longListMap.get(aLong).stream().max(Comparator.comparing(StockFlowMaxInTimeVo::getInTime));
list.add(inTimeVoOptional.get());
}
}
} catch (Exception e) {
e.printStackTrace();
}

