| | |
| | | @Autowired |
| | | private TFoundationConfigService foundationConfigService; |
| | | @Autowired |
| | | private TFoundationPersonService foundationPersonService; |
| | | @Autowired |
| | | private TGoodsService goodsService; |
| | | @Autowired |
| | | private TOrderMealService orderMealService; |
| | |
| | | dataGenerator.setOtherPay(dto.getOtherProportion()); |
| | | this.save(dataGenerator); |
| | | long start = System.currentTimeMillis(); |
| | | // 查询所有的人数用餐标准 |
| | | List<TFoundationConfigVO> foundationConfigs = foundationConfigService.getList(dto.getShopId()); |
| | | TShop shop = shopService.getById(dto.getShopId()); |
| | | List<TFoundationConfigVO> foundationConfigs = foundationConfigService.getList(shop.getMealType()); |
| | | if(CollectionUtils.isEmpty(foundationConfigs)){ |
| | | throw new ServiceException("请先添加该店铺用餐标准"); |
| | | throw new ServiceException("请先添加中餐或火锅用餐标准"); |
| | | } |
| | | // 查询所有桌子 |
| | | List<TBoard> boards = boardService.list(Wrappers.lambdaQuery(TBoard.class) |
| | |
| | | orderMeal.setMealType(1); |
| | | orderMeal.setMealPerson(random); |
| | | orderMeal.setMealTime(orderMealGeneratorCountDTO.getTime()); |
| | | orderMeal.setOrderNum(OrderNumConstants.MEAL + CodeGenerateUtils.generateVolumeSn()); |
| | | String num = OrderNumConstants.MEAL + CodeGenerateUtils.generateVolumeSn(); |
| | | // long count1 = orderMealService.count(Wrappers.lambdaQuery(TOrderMeal.class) |
| | | // .eq(TOrderMeal::getOrderNum, num)); |
| | | // if(count1>0){ |
| | | // num = CodeGenerateUtils.generateVolumeSn(); |
| | | // } |
| | | orderMeal.setOrderNum(num); |
| | | orderMeal.setStatus(2); |
| | | List<TOrderMealGoods> orderMealGoods = new ArrayList<>(); |
| | | // 获取当前桌的菜品 |
| | |
| | | if (good.getGoodsNum().equals(typeGood.getGoodsNum())) { |
| | | count+=1; |
| | | good.setGoodsCount(good.getGoodsCount() + 1); |
| | | good.setGoodsSalePrice(good.getGoodsSalePrice().add(typeGood.getSalePrice())); |
| | | // good.setGoodsSalePrice(good.getGoodsSalePrice().add(typeGood.getSalePrice())); |
| | | break; // 找到后直接跳出循环 |
| | | } |
| | | } |
| | |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public void deleteByShopId(Long shopId) { |
| | | this.baseMapper.deleteByShopId(shopId); |
| | | } |
| | | |
| | | private int getRandomPayType(Integer size,BigDecimal count) { |
| | | BigDecimal bigDecimal = new BigDecimal(size).multiply(count.divide(new BigDecimal(100))).setScale(0, BigDecimal.ROUND_FLOOR); |
| | | return Integer.parseInt(bigDecimal.toString()); |