|
|
@@ -1,5 +1,6 @@
|
|
|
package com.ydtech.modules.order.entity.filter;
|
|
|
|
|
|
+import com.ydtech.exception.SystemException;
|
|
|
import com.ydtech.modules.ins.model.vo.CarInfoVo;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
@@ -15,9 +16,15 @@ import java.util.stream.Collectors;
|
|
|
public class CarModelsFilterUtils<T extends CarModelsFilter> {
|
|
|
|
|
|
public T to(List<T> carModelsFilterList, CarInfoVo carInfo) {
|
|
|
+ if (carModelsFilterList.isEmpty()) {
|
|
|
+ throw new SystemException("核心查询车型失败 请联系业务人员处理");
|
|
|
+ }
|
|
|
+
|
|
|
List<T> stadarCarDTOS = new ArrayList<>();
|
|
|
if (!StringUtils.isEmpty(carInfo.getCaryear())) {
|
|
|
- stadarCarDTOS = carModelsFilterList.stream().filter(car -> carInfo.getCaryear().equals(car.getCarYear())).collect(Collectors.toList());
|
|
|
+ stadarCarDTOS = carModelsFilterList.stream()
|
|
|
+ .filter(car -> carInfo.getCaryear().equals(car.getCarYear()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
|
if (!stadarCarDTOS.isEmpty()) {
|
|
|
@@ -26,7 +33,9 @@ public class CarModelsFilterUtils<T extends CarModelsFilter> {
|
|
|
stadarCarDTOS = carModelsFilterList;
|
|
|
}
|
|
|
|
|
|
- carModelsFilterList = carModelsFilterList.stream().filter(car -> carInfo.getPurchasePrice().equals(String.valueOf(car.getPurchasePrice()))).collect(Collectors.toList());
|
|
|
+ carModelsFilterList = carModelsFilterList.stream()
|
|
|
+ .filter(car -> carInfo.getPurchasePrice().equals(String.valueOf(car.getPurchasePrice())))
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
|
if (carModelsFilterList.isEmpty()) {
|
|
|
return stadarCarDTOS.get(0);
|