From 76699e910ca78a400c0bcdbaa7c175248f9589d0 Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期四, 26 九月 2024 18:28:56 +0800 Subject: [PATCH] 修改接口 --- ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TDataGeneratorServiceImpl.java | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TDataGeneratorServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TDataGeneratorServiceImpl.java index c4cd614..72e12d1 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TDataGeneratorServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TDataGeneratorServiceImpl.java @@ -115,7 +115,7 @@ for (OrderMealGeneratorCountDTO orderMealGeneratorCountDTO : orderMealGeneratorCountDTOS) { TBoard board = boards.stream().filter(e -> e.getId().equals(orderMealGeneratorCountDTO.getBoardId())).findFirst().orElse(null); if(Objects.isNull(board)){ - throw new ServiceException("桌台用餐人数配置不存在"); + throw new ServiceException("该桌台信息不存在"); } Integer orderCount = orderMealGeneratorCountDTO.getOrderCount(); // 查询当前桌的用餐人数 @@ -131,6 +131,9 @@ List<TOrderMealGoods> orderMealGoods = new ArrayList<>(); // 获取当前桌的菜品 List<TFoundationConfigVO> foundationConfigVOS = foundationConfigs.stream().filter(e -> e.getMealCount().equals(random)).collect(Collectors.toList()); + if(CollectionUtils.isEmpty(foundationConfigVOS)){ + throw new ServiceException("桌台"+random+"人餐,人数配置不存在"); + } // 每种菜品分类需要几个菜的生成 foundationConfigVOS.forEach(e -> { int random1 = getRandom(e.getMinCount(), e.getMaxCount()); @@ -529,7 +532,11 @@ // BigDecimal money = orderSaleGoods.stream().filter(e -> collect.contains(e.getOrderId())) // .reduce(BigDecimal.ZERO, (x, y) -> x.add(y.getGoodsCostPrice().multiply(new BigDecimal(y.getGoodsCount()))), BigDecimal::add); if(!CollectionUtils.isEmpty(orderSales)){ - BigDecimal money = orderSales.stream().filter(e -> e.getGeneratorId().equals(tDataGeneratorVO.getId())).map(TOrderSale::getPayMoney).reduce(BigDecimal::add).get(); + List<TOrderSale> collect = orderSales.stream().filter(e -> e.getGeneratorId().equals(tDataGeneratorVO.getId())).collect(Collectors.toList()); + BigDecimal money = BigDecimal.ZERO; + if(!CollectionUtils.isEmpty(collect)){ + money = collect.stream().map(TOrderSale::getPayMoney).reduce(BigDecimal::add).get(); + } tDataGeneratorVO.setTotalRevenue(money); } } -- Gitblit v1.7.1