| | |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.ExportParams; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.WebUtils; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | |
| | | @PostMapping(value = "/amountSum") |
| | | public AjaxResult<AmountSumVO> amountSum(@RequestBody TOrderMealQuery query) { |
| | | query.setShopId(tokenService.getLoginUser().getObjectId()); |
| | | return AjaxResult.success(orderMealService.amountSum(query)); |
| | | AmountSumVO amountSumVO = orderMealService.amountSum(query); |
| | | if(amountSumVO.getObligation().compareTo(BigDecimal.ZERO) < 0){ |
| | | amountSumVO.setObligation(BigDecimal.ZERO); |
| | | } |
| | | return AjaxResult.success(amountSumVO); |
| | | } |
| | | |
| | | @ApiOperation( value = "查询餐饮详情") |
| | |
| | | TBoard board = boardService.getById(orderMeal.getBoardId()); |
| | | orderMealVO.setMaxPerson(board.getMaxPerson()); |
| | | orderMealVO.setMinPerson(board.getMinPerson()); |
| | | orderMealVO.setBoardName(board.getBoardName()); |
| | | return AjaxResult.success(orderMealVO); |
| | | } |
| | | |
| | | @Log(title = "餐饮-修改餐饮信息", businessType = BusinessType.UPDATE) |
| | | @ApiOperation( value = "修改") |
| | | @PostMapping(value = "/update") |
| | | public AjaxResult<String> update(@RequestBody TOrderMealDTO dto) { |
| | | // 删除所有菜品 |
| | | orderMealGoodsService.remove(Wrappers.lambdaQuery(TOrderMealGoods.class) |
| | | .eq(TOrderMealGoods::getOrderId, dto.getId())); |
| | | orderMealService.updateById(dto); |
| | | for (TOrderMealGoods mealOrderGood : dto.getMealOrderGoods()) { |
| | | // 设置商品类型和类型id |
| | | TGoodsType goodsType = goodsTypeService.getById(mealOrderGood.getTypeId()); |
| | | mealOrderGood.setId(null); |
| | | mealOrderGood.setOrderId(dto.getId()); |
| | | mealOrderGood.setTypeId(goodsType.getId()); |
| | | mealOrderGood.setTypeName(goodsType.getTypeName()); |
| | | if(!CollectionUtils.isEmpty(dto.getMealOrderGoods())){ |
| | | orderMealGoodsService.remove(Wrappers.lambdaQuery(TOrderMealGoods.class) |
| | | .eq(TOrderMealGoods::getOrderId, dto.getId())); |
| | | for (TOrderMealGoods mealOrderGood : dto.getMealOrderGoods()) { |
| | | // 设置商品类型和类型id |
| | | TGoodsType goodsType = goodsTypeService.getById(mealOrderGood.getTypeId()); |
| | | mealOrderGood.setId(null); |
| | | mealOrderGood.setOrderId(dto.getId()); |
| | | mealOrderGood.setTypeId(goodsType.getId()); |
| | | mealOrderGood.setTypeName(goodsType.getTypeName()); |
| | | } |
| | | orderMealGoodsService.saveBatch(dto.getMealOrderGoods()); |
| | | } |
| | | orderMealGoodsService.saveBatch(dto.getMealOrderGoods()); |
| | | return AjaxResult.success(); |
| | | } |
| | | @Log(title = "餐饮-列表详情结账", businessType = BusinessType.UPDATE) |
| | | @ApiOperation( value = "列表详情结账") |
| | | @PostMapping(value = "/detailUpdate") |
| | | public AjaxResult<String> detailUpdate(@RequestBody TOrderMealDTO dto) { |
| | | // 删除所有菜品 |
| | | orderMealGoodsService.remove(Wrappers.lambdaQuery(TOrderMealGoods.class) |
| | | .eq(TOrderMealGoods::getOrderId, dto.getId())); |
| | | orderMealService.updateById(dto); |
| | | // 查询餐桌 |
| | | List<TOrderMealGoods> mealOrderGoods = dto.getMealOrderGoods(); |
| | | if (!CollectionUtils.isEmpty(mealOrderGoods)) { |
| | | // 删除所有菜品 |
| | | orderMealGoodsService.remove(Wrappers.lambdaQuery(TOrderMealGoods.class) |
| | | .eq(TOrderMealGoods::getOrderId, dto.getId())); |
| | | for (TOrderMealGoods mealOrderGood : mealOrderGoods) { |
| | | // 设置商品类型和类型id |
| | | mealOrderGood.setId(null); |
| | |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @Log(title = "餐饮订单-删除餐饮订单", businessType = BusinessType.DELETE) |
| | | @ApiOperation( value = "删除餐饮订单") |
| | | @GetMapping(value = "/deleteById") |
| | | public AjaxResult<Boolean> deleteById(@RequestParam(value = "id") Long id) { |
| | | orderMealGoodsService.remove(Wrappers.lambdaQuery(TOrderMealGoods.class) |
| | | .eq(TOrderMealGoods::getOrderId, id)); |
| | | // orderMealGoodsService.remove(Wrappers.lambdaQuery(TOrderMealGoods.class) |
| | | // .eq(TOrderMealGoods::getOrderId, id)); |
| | | return AjaxResult.success(orderMealService.removeById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 添加餐饮管理 |
| | | */ |
| | | @Log(title = "餐饮-开台", businessType = BusinessType.UPDATE) |
| | | @ApiOperation( value = "开台") |
| | | @PostMapping(value = "/startMeal") |
| | | public AjaxResult<Integer> startMeal(@RequestBody TOrderMeal dto) { |
| | |
| | | /** |
| | | * 添加餐饮管理 |
| | | */ |
| | | @Log(title = "餐饮-点菜", businessType = BusinessType.UPDATE) |
| | | @ApiOperation( value = "点菜接口") |
| | | @PostMapping(value = "/add") |
| | | public AjaxResult<Integer> add(@RequestBody TOrderMealDTO dto) { |
| | |
| | | // return AjaxResult.success(); |
| | | // } |
| | | |
| | | @Log(title = "餐饮-结账", businessType = BusinessType.UPDATE) |
| | | @ApiOperation( value = "结账接口") |
| | | @PostMapping(value = "/checkout") |
| | | public AjaxResult<String> checkout(@Validated @RequestBody CheckoutDTO dto) { |
| | |
| | | /** |
| | | * 导出餐饮列表 |
| | | */ |
| | | @Log(title = "餐饮-导出餐饮列表", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "导出餐饮列表") |
| | | @PostMapping("/exportOrderMeal") |
| | | public void exportOrderMeal(@RequestBody TOrderMealQuery query) |