结算接口查询条件修改
This commit is contained in:
parent
94c52aabce
commit
a39f3e50af
|
@ -18,7 +18,13 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.AbstractMap;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.function.BinaryOperator;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.chint.infrastructure.constant.CommonMessageConstant.SUCCESS;
|
import static com.chint.infrastructure.constant.CommonMessageConstant.SUCCESS;
|
||||||
import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_AIRPLANE;
|
import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_AIRPLANE;
|
||||||
|
@ -61,7 +67,16 @@ public class LocationController {
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (locations != null && !locations.isEmpty()) {
|
//
|
||||||
|
// 在每个分组中,按 locationId 对 Location 进行排序,然后取出每组的第一个元素
|
||||||
|
locations = new ArrayList<>(locations.stream()
|
||||||
|
// 将 Location 对象映射为 locationPath 和 locationPathName 的组合作为 key,Location 对象本身作为 value
|
||||||
|
.collect(Collectors.toMap(location -> new AbstractMap.SimpleEntry<>(location.getLocationPath(),
|
||||||
|
location.getLocationPathName()), Function.identity(),
|
||||||
|
BinaryOperator.minBy(Comparator.comparingLong(Location::getLocationId))))
|
||||||
|
.values()); // 将 Stream 转换为 List
|
||||||
|
|
||||||
|
if (!locations.isEmpty()) {
|
||||||
locationRes = locations
|
locationRes = locations
|
||||||
.stream()
|
.stream()
|
||||||
.map(LocationRes::copyFrom).toList();
|
.map(LocationRes::copyFrom).toList();
|
||||||
|
|
Loading…
Reference in New Issue