订单管理
This commit is contained in:
parent
a07e864ccb
commit
3960eebac2
|
|
@ -82,9 +82,10 @@ public class OrderCartServiceImpl implements IOrderCartService
|
||||||
String filteredOrderDate = orderCartQueryParam.getMenuDateList().stream().filter(orderDate -> orderDate.equals(orderDateStr))
|
String filteredOrderDate = orderCartQueryParam.getMenuDateList().stream().filter(orderDate -> orderDate.equals(orderDateStr))
|
||||||
.findFirst().orElse(null);
|
.findFirst().orElse(null);
|
||||||
CookDishCheckDTO cookDishCheckDTO = new CookDishCheckDTO();
|
CookDishCheckDTO cookDishCheckDTO = new CookDishCheckDTO();
|
||||||
Optional<Long> maxRecipeId = orderCartList.stream()
|
Optional<Long> maxRecipeId = carts.stream()
|
||||||
|
.sorted(Comparator.comparing(OrderCart::getCartId).reversed())
|
||||||
.map(OrderCart::getRecipeId)
|
.map(OrderCart::getRecipeId)
|
||||||
.max(Long::compareTo);
|
.findFirst();
|
||||||
if (maxRecipeId.isPresent()) {
|
if (maxRecipeId.isPresent()) {
|
||||||
cookDishCheckDTO.setRecipeId(maxRecipeId.get());
|
cookDishCheckDTO.setRecipeId(maxRecipeId.get());
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -99,7 +100,7 @@ public class OrderCartServiceImpl implements IOrderCartService
|
||||||
}
|
}
|
||||||
|
|
||||||
for (OrderCart shoppingCart : carts) {
|
for (OrderCart shoppingCart : carts) {
|
||||||
OrderCartVO shoppingCartVO = convertToOrderCartVO(shoppingCart, cookRecipeDishMap);
|
OrderCartVO shoppingCartVO = convertToOrderCartVO(shoppingCart, cookRecipeDishMap, cookDishCheckDTO.getRecipeId());
|
||||||
if(filteredOrderDate == null) {
|
if(filteredOrderDate == null) {
|
||||||
shoppingCartVO.setIsValid(0);
|
shoppingCartVO.setIsValid(0);
|
||||||
}
|
}
|
||||||
|
|
@ -111,7 +112,8 @@ public class OrderCartServiceImpl implements IOrderCartService
|
||||||
}
|
}
|
||||||
|
|
||||||
private OrderCartVO convertToOrderCartVO(OrderCart orderCart,
|
private OrderCartVO convertToOrderCartVO(OrderCart orderCart,
|
||||||
Map<Integer, List<CookH5ReserveRecipeDishesVO>> cookRecipeDishMap) {
|
Map<Integer, List<CookH5ReserveRecipeDishesVO>> cookRecipeDishMap,
|
||||||
|
Long recipeId) {
|
||||||
OrderCartVO orderCartVO = new OrderCartVO();
|
OrderCartVO orderCartVO = new OrderCartVO();
|
||||||
BeanUtils.copyProperties(orderCart, orderCartVO);
|
BeanUtils.copyProperties(orderCart, orderCartVO);
|
||||||
orderCartVO.setIsValid(0);
|
orderCartVO.setIsValid(0);
|
||||||
|
|
@ -122,7 +124,8 @@ public class OrderCartServiceImpl implements IOrderCartService
|
||||||
for (CookH5ReserveRecipeDishesVO cookRecipeDishesVO : cookRecipeDishes) {
|
for (CookH5ReserveRecipeDishesVO cookRecipeDishesVO : cookRecipeDishes) {
|
||||||
if(CollUtil.isNotEmpty(cookRecipeDishesVO.getDishesDetailList())) {
|
if(CollUtil.isNotEmpty(cookRecipeDishesVO.getDishesDetailList())) {
|
||||||
for (CookH5CurrentDishesDetailVO dishesDetailVO : cookRecipeDishesVO.getDishesDetailList()) {
|
for (CookH5CurrentDishesDetailVO dishesDetailVO : cookRecipeDishesVO.getDishesDetailList()) {
|
||||||
if (orderCart.getGoodsId().equals(dishesDetailVO.getDishesId())) {
|
if (orderCart.getGoodsId().equals(dishesDetailVO.getDishesId())
|
||||||
|
&& orderCart.getRecipeId().equals(recipeId)) {
|
||||||
orderCartVO.setIsValid(1);
|
orderCartVO.setIsValid(1);
|
||||||
break outerLoop;
|
break outerLoop;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue