订单管理

This commit is contained in:
gaowdong 2025-06-04 10:29:41 +08:00
parent a07e864ccb
commit 3960eebac2
1 changed files with 8 additions and 5 deletions

View File

@ -82,9 +82,10 @@ public class OrderCartServiceImpl implements IOrderCartService
String filteredOrderDate = orderCartQueryParam.getMenuDateList().stream().filter(orderDate -> orderDate.equals(orderDateStr))
.findFirst().orElse(null);
CookDishCheckDTO cookDishCheckDTO = new CookDishCheckDTO();
Optional<Long> maxRecipeId = orderCartList.stream()
Optional<Long> maxRecipeId = carts.stream()
.sorted(Comparator.comparing(OrderCart::getCartId).reversed())
.map(OrderCart::getRecipeId)
.max(Long::compareTo);
.findFirst();
if (maxRecipeId.isPresent()) {
cookDishCheckDTO.setRecipeId(maxRecipeId.get());
} else {
@ -99,7 +100,7 @@ public class OrderCartServiceImpl implements IOrderCartService
}
for (OrderCart shoppingCart : carts) {
OrderCartVO shoppingCartVO = convertToOrderCartVO(shoppingCart, cookRecipeDishMap);
OrderCartVO shoppingCartVO = convertToOrderCartVO(shoppingCart, cookRecipeDishMap, cookDishCheckDTO.getRecipeId());
if(filteredOrderDate == null) {
shoppingCartVO.setIsValid(0);
}
@ -111,7 +112,8 @@ public class OrderCartServiceImpl implements IOrderCartService
}
private OrderCartVO convertToOrderCartVO(OrderCart orderCart,
Map<Integer, List<CookH5ReserveRecipeDishesVO>> cookRecipeDishMap) {
Map<Integer, List<CookH5ReserveRecipeDishesVO>> cookRecipeDishMap,
Long recipeId) {
OrderCartVO orderCartVO = new OrderCartVO();
BeanUtils.copyProperties(orderCart, orderCartVO);
orderCartVO.setIsValid(0);
@ -122,7 +124,8 @@ public class OrderCartServiceImpl implements IOrderCartService
for (CookH5ReserveRecipeDishesVO cookRecipeDishesVO : cookRecipeDishes) {
if(CollUtil.isNotEmpty(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);
break outerLoop;
}