订单列表不返回餐位费信息

This commit is contained in:
2024-10-09 15:24:22 +08:00
parent 18a2157788
commit 117838304a

View File

@@ -4,6 +4,7 @@ package com.chaozhanggui.system.cashierservice.controller;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.chaozhanggui.system.cashierservice.constant.TableConstant;
import com.chaozhanggui.system.cashierservice.entity.TbCashierCart;
import com.chaozhanggui.system.cashierservice.entity.dto.ChoseCountDTO;
import com.chaozhanggui.system.cashierservice.entity.dto.ChoseEatModelDTO;
@@ -18,6 +19,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -119,12 +121,16 @@ public class ProductController {
public Result choseEatModel(@Validated @RequestBody ChoseEatModelDTO choseEatModelDTO) {
List<TbCashierCart> cashierCartList = cartService.choseEatModel(choseEatModelDTO);
BigDecimal amount = BigDecimal.ZERO;
ArrayList<TbCashierCart> cashierCarts = new ArrayList<>();
for (TbCashierCart item : cashierCartList) {
if (!TableConstant.CART_SEAT_ID.equals(item.getProductId())) {
cashierCarts.add(item);
}
amount = amount.add(item.getTotalAmount());
}
HashMap<String, Object> data = new HashMap<>();
data.put("amount", amount);
data.put("info", cashierCartList);
data.put("info", cashierCarts);
return Result.success(CodeEnum.SUCCESS, data);
}