2个文件已删除
10个文件已添加
46个文件已修改
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.domain. TBoard; |
| | | import com.ruoyi.system.service.TBoardService; |
| | | import com.ruoyi.system.service. TBoardService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | public class TBoardController { |
| | | |
| | | private final TBoardService boardService; |
| | | private final TokenService tokenService; |
| | | |
| | | @Autowired |
| | | public TBoardController( TBoardService boardService) { |
| | | public TBoardController(TBoardService boardService, TokenService tokenService) { |
| | | this. boardService = boardService; |
| | | this.tokenService = tokenService; |
| | | } |
| | | |
| | | /** |
| | |
| | | @ApiOperation( value = "查询餐桌列表") |
| | | @PostMapping(value = "/list") |
| | | public AjaxResult<List<TBoard>> list() { |
| | | return AjaxResult.success( boardService.list()); |
| | | Long objectId = tokenService.getLoginUser().getObjectId(); |
| | | return AjaxResult.success( boardService.list(Wrappers.lambdaQuery(TBoard.class) |
| | | .eq(TBoard::getShopId,objectId))); |
| | | } |
| | | |
| | | /** |
| | |
| | | @ApiOperation( value = "添加餐桌") |
| | | @PostMapping(value = "/add") |
| | | public AjaxResult<Boolean> add(@RequestBody TBoard dto) { |
| | | dto.setShopId(tokenService.getLoginUser().getObjectId()); |
| | | return AjaxResult.success( boardService.save(dto)); |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.constant.OrderNumConstants; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.system.domain.TDataGenerator; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.dto.OrderMealGeneratorDTO; |
| | | import com.ruoyi.system.dto.OrderSaleGeneratorDTO; |
| | | import com.ruoyi.system.query.TDataGeneratorQuery; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | private final TOrderMealService orderMealService; |
| | | private final TDataGeneratorService dataGeneratorService; |
| | | private final TokenService tokenService; |
| | | private final RedisCache redisCache; |
| | | |
| | | @Autowired |
| | | public TDataGeneratorController(TOrderMealService orderMealService, TDataGeneratorService dataGeneratorService) { |
| | | public TDataGeneratorController(TOrderMealService orderMealService, TDataGeneratorService dataGeneratorService, TokenService tokenService, RedisCache redisCache) { |
| | | this.orderMealService = orderMealService; |
| | | this.dataGeneratorService = dataGeneratorService; |
| | | this.tokenService = tokenService; |
| | | this.redisCache = redisCache; |
| | | } |
| | | |
| | | @ApiOperation( value = "餐饮数据生成") |
| | | @PostMapping(value = "/mealDataGenerator") |
| | | public AjaxResult<String> mealDataGenerator(@RequestBody OrderMealGeneratorDTO dto) { |
| | | dto.setUserId(tokenService.getLoginUser().getUserId()); |
| | | dto.setNickName(tokenService.getLoginUser().getNickName()); |
| | | dataGeneratorService.mealDataGenerator(dto); |
| | | return AjaxResult.success(); |
| | | } |
| | |
| | | @ApiOperation( value = "销售数据生成") |
| | | @PostMapping(value = "/saleDataGenerator") |
| | | public AjaxResult<String> saleDataGenerator(@RequestBody OrderSaleGeneratorDTO dto) { |
| | | dto.setUserId(tokenService.getLoginUser().getUserId()); |
| | | dto.setNickName(tokenService.getLoginUser().getNickName()); |
| | | dataGeneratorService.saleDataGenerator(dto); |
| | | return AjaxResult.success(); |
| | | } |
| | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @ApiOperation( value = "数据生成终止 shopId=店铺id type: 1=餐饮 2=进货") |
| | | @GetMapping(value = "/stopGenerator") |
| | | public AjaxResult<String> dataCoverage(@RequestParam(value = "shopId") Long shopId, |
| | | @RequestParam(value = "type") Integer type) { |
| | | if(type == 1){ |
| | | redisCache.setCacheObject(OrderNumConstants.MEAL+"_"+shopId,shopId); |
| | | }else { |
| | | redisCache.setCacheObject(OrderNumConstants.STOCK+"_"+shopId,shopId); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.query.TDataStatisticsQuery; |
| | | import com.ruoyi.system.service.TOrderMealService; |
| | | import com.ruoyi.system.service.TOrderSaleService; |
| | | import com.ruoyi.system.vo.SalesRankingVO; |
| | | import com.ruoyi.system.vo.SalesVolumeVO; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | | * 营业数据统计 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2024-08-27 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-data-statistics") |
| | | public class TDataStatisticsController { |
| | | |
| | | private final TOrderMealService orderMealService; |
| | | private final TOrderSaleService orderSaleService; |
| | | private final TokenService tokenService; |
| | | |
| | | @Autowired |
| | | public TDataStatisticsController(TOrderMealService orderMealService, TOrderSaleService orderSaleService, TokenService tokenService) { |
| | | this.orderMealService = orderMealService; |
| | | this.orderSaleService = orderSaleService; |
| | | this.tokenService = tokenService; |
| | | } |
| | | |
| | | @ApiOperation( value = "销售额统计") |
| | | @PostMapping(value = "/salesVolume") |
| | | public AjaxResult<SalesVolumeVO> salesVolume(@RequestBody TDataStatisticsQuery query) { |
| | | Integer roleType = tokenService.getLoginUser().getRoleType(); |
| | | Long objectId = tokenService.getLoginUser().getObjectId(); |
| | | query.setShopId(objectId); |
| | | if(Objects.isNull(query.getTimeType())){ |
| | | query.setTimeType(1); |
| | | } |
| | | LocalDateTime startTime = null; |
| | | LocalDateTime endTime = null; |
| | | switch (query.getTimeType()){ |
| | | case 1: |
| | | // 今日 |
| | | startTime = LocalDateTime.MIN; |
| | | endTime = LocalDateTime.MAX; |
| | | break; |
| | | case 2: |
| | | // 昨日 |
| | | startTime = LocalDateTime.now().minusDays(1); |
| | | endTime = LocalDateTime.now().minusDays(1); |
| | | break; |
| | | case 3: |
| | | // 近7天 |
| | | startTime = LocalDateTime.now().minusDays(7); |
| | | endTime = LocalDateTime.now(); |
| | | break; |
| | | case 4: |
| | | // 近30天 |
| | | startTime = LocalDateTime.now().minusDays(30); |
| | | endTime = LocalDateTime.now(); |
| | | break; |
| | | } |
| | | query.setStartTime(startTime); |
| | | query.setEndTime(endTime); |
| | | SalesVolumeVO salesVolumeVO; |
| | | if(roleType == 2){ |
| | | salesVolumeVO = orderMealService.salesVolume(query); |
| | | }else { |
| | | salesVolumeVO = orderSaleService.salesVolume(query); |
| | | } |
| | | return AjaxResult.success(salesVolumeVO); |
| | | } |
| | | |
| | | @ApiOperation( value = "商品分类销售排行") |
| | | @PostMapping(value = "/salesRanking") |
| | | public AjaxResult<List<SalesRankingVO>> salesRanking(@RequestBody TDataStatisticsQuery query) { |
| | | Integer roleType = tokenService.getLoginUser().getRoleType(); |
| | | Long objectId = tokenService.getLoginUser().getObjectId(); |
| | | query.setShopId(objectId); |
| | | if(Objects.isNull(query.getTimeType())){ |
| | | query.setTimeType(1); |
| | | } |
| | | LocalDateTime startTime = null; |
| | | LocalDateTime endTime = null; |
| | | switch (query.getTimeType()){ |
| | | case 1: |
| | | // 今日 |
| | | startTime = LocalDateTime.MIN; |
| | | endTime = LocalDateTime.MAX; |
| | | break; |
| | | case 2: |
| | | // 昨日 |
| | | startTime = LocalDateTime.now().minusDays(1); |
| | | endTime = LocalDateTime.now().minusDays(1); |
| | | break; |
| | | case 3: |
| | | // 近7天 |
| | | startTime = LocalDateTime.now().minusDays(7); |
| | | endTime = LocalDateTime.now(); |
| | | break; |
| | | case 4: |
| | | // 近30天 |
| | | startTime = LocalDateTime.now().minusDays(30); |
| | | endTime = LocalDateTime.now(); |
| | | break; |
| | | } |
| | | query.setStartTime(startTime); |
| | | query.setEndTime(endTime); |
| | | List<SalesRankingVO> salesRankingVOS; |
| | | if(roleType == 2){ |
| | | salesRankingVOS = orderMealService.salesRanking(query); |
| | | }else{ |
| | | salesRankingVOS = orderSaleService.salesRanking(query); |
| | | } |
| | | return AjaxResult.success(salesRankingVOS); |
| | | } |
| | | |
| | | @ApiOperation( value = "下单趋势") |
| | | @PostMapping(value = "/orderingTrends") |
| | | public AjaxResult<List<SalesRankingVO>> orderingTrends(@RequestBody TDataStatisticsQuery query) { |
| | | Integer roleType = tokenService.getLoginUser().getRoleType(); |
| | | Long objectId = tokenService.getLoginUser().getObjectId(); |
| | | query.setShopId(objectId); |
| | | if(Objects.isNull(query.getTimeType())){ |
| | | query.setTimeType(3); |
| | | } |
| | | LocalDateTime startTime = null; |
| | | LocalDateTime endTime = null; |
| | | switch (query.getTimeType()){ |
| | | case 1: |
| | | // 今日 |
| | | startTime = LocalDateTime.MIN; |
| | | endTime = LocalDateTime.MAX; |
| | | break; |
| | | case 2: |
| | | // 昨日 |
| | | startTime = LocalDateTime.now().minusDays(1); |
| | | endTime = LocalDateTime.now().minusDays(1); |
| | | break; |
| | | case 3: |
| | | // 近7天 |
| | | startTime = LocalDateTime.now().minusDays(7); |
| | | endTime = LocalDateTime.now(); |
| | | break; |
| | | case 4: |
| | | // 近30天 |
| | | startTime = LocalDateTime.now().minusDays(30); |
| | | endTime = LocalDateTime.now(); |
| | | break; |
| | | } |
| | | query.setStartTime(startTime); |
| | | query.setEndTime(endTime); |
| | | List<SalesRankingVO> salesRankingVOS; |
| | | if(roleType == 2){ |
| | | salesRankingVOS = orderMealService.salesRanking(query); |
| | | }else{ |
| | | salesRankingVOS = orderSaleService.salesRanking(query); |
| | | } |
| | | return AjaxResult.success(salesRankingVOS); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.domain.TGoods; |
| | | import com.ruoyi.system.query.TGoodsQuery; |
| | | import com.ruoyi.system.service.TGoodsService; |
| | | import com.ruoyi.system.service.TGoodsService; |
| | | import com.ruoyi.system.vo.TGoodsVO; |
| | | import io.swagger.annotations.Api; |
| | |
| | | public class TGoodsController { |
| | | |
| | | private final TGoodsService goodsService; |
| | | private final TokenService tokenService; |
| | | |
| | | @Autowired |
| | | public TGoodsController(TGoodsService goodsService) { |
| | | public TGoodsController(TGoodsService goodsService, TokenService tokenService) { |
| | | this.goodsService = goodsService; |
| | | this.tokenService = tokenService; |
| | | } |
| | | |
| | | /** |
| | |
| | | @ApiOperation( value = "查询商品管理分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public AjaxResult<PageInfo<TGoodsVO>> pageList(@RequestBody TGoodsQuery query) { |
| | | query.setShopId(tokenService.getLoginUser().getObjectId()); |
| | | return AjaxResult.success(goodsService.pageList(query)); |
| | | } |
| | | |
| | |
| | | @ApiOperation( value = "添加商品管理") |
| | | @PostMapping(value = "/add") |
| | | public AjaxResult<Boolean> add(@RequestBody TGoods dto) { |
| | | dto.setShopId(tokenService.getLoginUser().getObjectId()); |
| | | return AjaxResult.success(goodsService.save(dto)); |
| | | } |
| | | |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.domain.TGoodsType; |
| | | import com.ruoyi.system.service.TGoodsTypeService; |
| | | import io.swagger.annotations.Api; |
| | |
| | | public class TGoodsTypeController { |
| | | |
| | | private final TGoodsTypeService goodsTypeService; |
| | | private final TokenService tokenService; |
| | | |
| | | @Autowired |
| | | public TGoodsTypeController(TGoodsTypeService goodsTypeService) { |
| | | public TGoodsTypeController(TGoodsTypeService goodsTypeService, TokenService tokenService) { |
| | | this.goodsTypeService = goodsTypeService; |
| | | this.tokenService = tokenService; |
| | | } |
| | | |
| | | /** |
| | |
| | | @ApiOperation( value = "查询商品分类列表") |
| | | @PostMapping(value = "/list") |
| | | public AjaxResult<List<TGoodsType>> list() { |
| | | return AjaxResult.success(goodsTypeService.list()); |
| | | Long shopId = tokenService.getLoginUser().getObjectId(); |
| | | return AjaxResult.success(goodsTypeService.list(Wrappers.<TGoodsType>lambdaQuery().eq(TGoodsType::getShopId, shopId))); |
| | | } |
| | | |
| | | /** |
| | |
| | | @ApiOperation( value = "添加商品分类") |
| | | @PostMapping(value = "/add") |
| | | public AjaxResult<Boolean> add(@RequestBody TGoodsType dto) { |
| | | dto.setShopId(tokenService.getLoginUser().getObjectId()); |
| | | return AjaxResult.success(goodsTypeService.save(dto)); |
| | | } |
| | | |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | 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.system.domain.TGoodsType; |
| | | 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; |
| | | import com.ruoyi.system.domain.TOrderMeal; |
| | | import com.ruoyi.system.domain.TOrderMealGoods; |
| | | import com.ruoyi.system.dto.AddDishDTO; |
| | | import com.ruoyi.system.dto.CheckoutDTO; |
| | | import com.ruoyi.system.dto.OrderMealGeneratorDTO; |
| | | import com.ruoyi.system.dto.TOrderMealDTO; |
| | | import com.ruoyi.system.service.TGoodsTypeService; |
| | | import com.ruoyi.system.importExcel.TOrderMealExportExcel; |
| | | import com.ruoyi.system.query.SysUserQuery; |
| | | import com.ruoyi.system.query.TOrderMealQuery; |
| | | import com.ruoyi.system.service.TOrderMealGoodsService; |
| | | import com.ruoyi.system.service.TOrderMealService; |
| | | import com.ruoyi.system.vo.AmountSumVO; |
| | | import com.ruoyi.system.vo.SysUserVO; |
| | | import com.ruoyi.system.vo.TOrderMealVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | public class TOrderMealController { |
| | | |
| | | private final TOrderMealService orderMealService; |
| | | private final TOrderMealGoodsService orderMealGoodsService; |
| | | private final TokenService tokenService; |
| | | |
| | | @Autowired |
| | | public TOrderMealController(TOrderMealService orderMealService) { |
| | | public TOrderMealController(TOrderMealService orderMealService, TOrderMealGoodsService orderMealGoodsService, TokenService tokenService) { |
| | | this.orderMealService = orderMealService; |
| | | this.orderMealGoodsService = orderMealGoodsService; |
| | | this.tokenService = tokenService; |
| | | } |
| | | |
| | | /** |
| | | * 查询餐饮列表 |
| | | */ |
| | | // @ApiOperation( value = "查询餐饮列表") |
| | | // @PostMapping(value = "/list") |
| | | // public AjaxResult<List<TOrderMeal>> list() { |
| | | // return AjaxResult.success(orderMealService.list()); |
| | | // } |
| | | @ApiOperation( value = "查询餐饮分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public AjaxResult<PageInfo<TOrderMealVO>> pageList(@RequestBody TOrderMealQuery query) { |
| | | query.setShopId(tokenService.getLoginUser().getObjectId()); |
| | | return AjaxResult.success(orderMealService.pageList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 查询餐饮金额统计 |
| | | */ |
| | | @ApiOperation( value = "查询餐饮金额统计") |
| | | @PostMapping(value = "/amountSum") |
| | | public AjaxResult<AmountSumVO> amountSum(@RequestBody TOrderMealQuery query) { |
| | | query.setShopId(tokenService.getLoginUser().getObjectId()); |
| | | return AjaxResult.success(orderMealService.amountSum(query)); |
| | | } |
| | | |
| | | @ApiOperation( value = "查询餐饮详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public AjaxResult<TOrderMealVO> getDetailById(@RequestParam(value = "id") Long id) { |
| | | TOrderMeal orderMeal = orderMealService.getById(id); |
| | | TOrderMealVO orderMealVO = new TOrderMealVO(); |
| | | BeanUtils.copyProperties(orderMeal, orderMealVO); |
| | | List<TOrderMealGoods> list = orderMealGoodsService.list(Wrappers.lambdaQuery(TOrderMealGoods.class) |
| | | .eq(TOrderMealGoods::getOrderId, orderMeal.getId())); |
| | | orderMealVO.setOrderMealGoods(list); |
| | | return AjaxResult.success(orderMealVO); |
| | | } |
| | | |
| | | @ApiOperation( value = "删除餐饮订单") |
| | | @GetMapping(value = "/deleteById") |
| | | public AjaxResult<Boolean> deleteById(@RequestParam(value = "id") Long id) { |
| | | orderMealGoodsService.remove(Wrappers.lambdaQuery(TOrderMealGoods.class) |
| | | .eq(TOrderMealGoods::getOrderId, id)); |
| | | return AjaxResult.success(orderMealService.removeById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 添加餐饮管理 |
| | |
| | | @ApiOperation( value = "开台-点菜接口") |
| | | @PostMapping(value = "/add") |
| | | public AjaxResult<Integer> add(@RequestBody TOrderMealDTO dto) { |
| | | dto.setShopId(tokenService.getLoginUser().getObjectId()); |
| | | orderMealService.add(dto); |
| | | return AjaxResult.success(dto.getId()); |
| | | } |
| | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | /** |
| | | * 导出餐饮列表 |
| | | */ |
| | | @ApiOperation(value = "导出餐饮列表") |
| | | @PostMapping("/exportOrderMeal") |
| | | public void exportOrderMeal(@RequestBody TOrderMealQuery query) |
| | | { |
| | | List<TOrderMealVO> list = orderMealService.exportOrderMeal(query); |
| | | List<TOrderMealExportExcel> orderMeals = new ArrayList<>(); |
| | | for (TOrderMealVO orderMealVO : list) { |
| | | TOrderMealExportExcel tOrderMealExportExcel = new TOrderMealExportExcel(); |
| | | BeanUtils.copyProperties(orderMealVO, tOrderMealExportExcel); |
| | | tOrderMealExportExcel.setCreateStrTime(DateUtils.localDateTimeToString(orderMealVO.getCreateTime())); |
| | | tOrderMealExportExcel.setGoodsList(orderMealVO.getGoodsList().stream().collect(Collectors.joining("\n"))); |
| | | } |
| | | Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), TOrderMealExportExcel.class, orderMeals); |
| | | HttpServletResponse response = WebUtils.response(); |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | ServletOutputStream outputStream = null; |
| | | try { |
| | | String fileName = URLEncoder.encode("餐饮列表.xls", "utf-8"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + fileName); |
| | | response.setContentType("application/vnd.ms-excel;charset=UTF-8"); |
| | | response.setHeader("Pragma", "no-cache"); |
| | | response.setHeader("Cache-Control", "no-cache"); |
| | | outputStream = response.getOutputStream(); |
| | | workbook.write(outputStream); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | outputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.ExportParams; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.system.dto.TOrderMealDTO; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.WebUtils; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.domain.TOrderMeal; |
| | | import com.ruoyi.system.domain.TOrderMealGoods; |
| | | import com.ruoyi.system.domain.TOrderSale; |
| | | import com.ruoyi.system.domain.TOrderSaleGoods; |
| | | import com.ruoyi.system.dto.TOrderSaleDTO; |
| | | import com.ruoyi.system.service.TOrderMealService; |
| | | import com.ruoyi.system.importExcel.TOrderMealExportExcel; |
| | | import com.ruoyi.system.importExcel.TOrderSaleExportExcel; |
| | | import com.ruoyi.system.query.TOrderMealQuery; |
| | | import com.ruoyi.system.query.TOrderSaleQuery; |
| | | import com.ruoyi.system.service.TOrderSaleGoodsService; |
| | | import com.ruoyi.system.service.TOrderSaleService; |
| | | import com.ruoyi.system.vo.AmountSumVO; |
| | | import com.ruoyi.system.vo.TOrderMealVO; |
| | | import com.ruoyi.system.vo.TOrderSaleVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @RequestMapping("/t-order-sale") |
| | | public class TOrderSaleController { |
| | | private final TOrderSaleService orderSaleService; |
| | | private final TOrderSaleGoodsService orderSaleGoodsService; |
| | | private final TokenService tokenService; |
| | | |
| | | @Autowired |
| | | public TOrderSaleController(TOrderSaleService orderSaleService) { |
| | | public TOrderSaleController(TOrderSaleService orderSaleService, TOrderSaleGoodsService orderSaleGoodsService, TokenService tokenService) { |
| | | this.orderSaleService = orderSaleService; |
| | | this.orderSaleGoodsService = orderSaleGoodsService; |
| | | this.tokenService = tokenService; |
| | | } |
| | | |
| | | /** |
| | | * 查询销售列表 |
| | | */ |
| | | @ApiOperation( value = "查询销售分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public AjaxResult<PageInfo<TOrderSaleVO>> pageList(@RequestBody TOrderSaleQuery query) { |
| | | query.setShopId(tokenService.getLoginUser().getObjectId()); |
| | | return AjaxResult.success(orderSaleService.pageList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 查询销售金额统计 |
| | | */ |
| | | @ApiOperation( value = "查询销售金额统计") |
| | | @PostMapping(value = "/amountSum") |
| | | public AjaxResult<AmountSumVO> amountSum(@RequestBody TOrderMealQuery query) { |
| | | query.setShopId(tokenService.getLoginUser().getObjectId()); |
| | | return AjaxResult.success(orderSaleService.amountSum(query)); |
| | | } |
| | | |
| | | @ApiOperation( value = "查询销售详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public AjaxResult<TOrderSaleVO> getDetailById(@RequestParam(value = "id") Long id) { |
| | | TOrderSale orderSale = orderSaleService.getById(id); |
| | | TOrderSaleVO orderSaleVO = new TOrderSaleVO(); |
| | | BeanUtils.copyProperties(orderSale, orderSaleVO); |
| | | List<TOrderSaleGoods> list = orderSaleGoodsService.list(Wrappers.lambdaQuery(TOrderSaleGoods.class) |
| | | .eq(TOrderSaleGoods::getOrderId, orderSale.getId())); |
| | | orderSaleVO.setOrderSaleGoods(list); |
| | | return AjaxResult.success(orderSaleVO); |
| | | } |
| | | |
| | | @ApiOperation( value = "删除销售订单") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public AjaxResult<Boolean> deleteById(@RequestParam(value = "id") Long id) { |
| | | orderSaleGoodsService.remove(Wrappers.lambdaQuery(TOrderSaleGoods.class) |
| | | .eq(TOrderSaleGoods::getOrderId,id)); |
| | | return AjaxResult.success(orderSaleService.removeById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 销售下单接口 |
| | | */ |
| | | @ApiOperation( value = "销售下单接口") |
| | | @PostMapping(value = "/add") |
| | | public AjaxResult<String> add(@RequestBody TOrderSaleDTO dto) { |
| | | dto.setShopId(tokenService.getLoginUser().getObjectId()); |
| | | orderSaleService.add(dto); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | /** |
| | | * 导出销售列表 |
| | | */ |
| | | @ApiOperation(value = "导出销售列表") |
| | | @PostMapping("/exportOrderSale") |
| | | public void exportOrderSale(@RequestBody TOrderMealQuery query) |
| | | { |
| | | List<TOrderSaleVO> list = orderSaleService.exportOrderSale(query); |
| | | List<TOrderMealExportExcel> orderMeals = new ArrayList<>(); |
| | | for (TOrderSaleVO orderSaleVO : list) { |
| | | TOrderSaleExportExcel orderSaleExportExcel = new TOrderSaleExportExcel(); |
| | | BeanUtils.copyProperties(orderSaleVO, orderSaleExportExcel); |
| | | orderSaleExportExcel.setCreateStrTime(DateUtils.localDateTimeToString(orderSaleVO.getCreateTime())); |
| | | orderSaleExportExcel.setGoodsAmount(orderSaleVO.getOrderSaleGoods().stream().map(TOrderSaleGoods::getSalePrice).reduce(BigDecimal::add).get()); |
| | | orderSaleExportExcel.setGoodsCount(orderSaleVO.getOrderSaleGoods().size()); |
| | | } |
| | | Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), TOrderMealExportExcel.class, orderMeals); |
| | | HttpServletResponse response = WebUtils.response(); |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | ServletOutputStream outputStream = null; |
| | | try { |
| | | String fileName = URLEncoder.encode("销售列表.xls", "utf-8"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + fileName); |
| | | response.setContentType("application/vnd.ms-excel;charset=UTF-8"); |
| | | response.setHeader("Pragma", "no-cache"); |
| | | response.setHeader("Cache-Control", "no-cache"); |
| | | outputStream = response.getOutputStream(); |
| | | workbook.write(outputStream); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | outputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.system.domain.TGoodsType; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.domain.TOrderStock; |
| | | import com.ruoyi.system.domain.TOrderStockGoods; |
| | | import com.ruoyi.system.dto.TOrderStockDTO; |
| | |
| | | public class TOrderStockController { |
| | | private final TOrderStockService orderStockService; |
| | | private final TOrderStockGoodsService orderStockGoodsService; |
| | | private final TokenService tokenService; |
| | | |
| | | @Autowired |
| | | public TOrderStockController(TOrderStockService orderStockService, TOrderStockGoodsService orderStockGoodsService) { |
| | | public TOrderStockController(TOrderStockService orderStockService, TOrderStockGoodsService orderStockGoodsService, TokenService tokenService) { |
| | | this.orderStockService = orderStockService; |
| | | this.orderStockGoodsService = orderStockGoodsService; |
| | | this.tokenService = tokenService; |
| | | } |
| | | |
| | | /** |
| | |
| | | @ApiOperation( value = "查询进货单分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public AjaxResult<PageInfo<TOrderStockVO>> pageList(@RequestBody TOrderStockQuery query) { |
| | | query.setShopId(tokenService.getLoginUser().getObjectId()); |
| | | return AjaxResult.success(orderStockService.pageList(query)); |
| | | } |
| | | |
| | |
| | | @ApiOperation( value = "进货单下单接口") |
| | | @PostMapping(value = "/add") |
| | | public AjaxResult<String> add(@RequestBody TOrderStockDTO dto) { |
| | | dto.setShopId(tokenService.getLoginUser().getObjectId()); |
| | | orderStockService.add(dto); |
| | | return AjaxResult.success(); |
| | | } |
| | |
| | | SysUser user = new SysUser(); |
| | | user.setUserId(dto.getUserId()); |
| | | user.setStatus(String.valueOf(dto.getStatus())); |
| | | user.setRemark(dto.getRemark()); |
| | | user.setUpdateBy(getUsername()); |
| | | return AjaxResult.success(userService.updateUserStatus(user)); |
| | | } |
| | |
| | | import org.springframework.data.annotation.CreatedBy; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | |
| | | /** 创建时间 */ |
| | | @ApiModelProperty(value = "记录创建时间,前端忽略") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date createTime; |
| | | private LocalDateTime createTime; |
| | | |
| | | /** 更新者 */ |
| | | |
| | |
| | | /** 更新时间 */ |
| | | @ApiModelProperty(value = "记录修改时间,前端忽略") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date updateTime; |
| | | private LocalDateTime updateTime; |
| | | |
| | | /** 是否删除 0未删除 1已删除 */ |
| | | @ApiModelProperty(value = "是否删除 0未删除 1已删除") |
| | |
| | | private String roleName; |
| | | |
| | | private String deptName; |
| | | private Long objectId; |
| | | |
| | | public String getRoleName() { |
| | | return roleName; |
| | |
| | | */ |
| | | private String os; |
| | | private String nickName; |
| | | private Integer roleType; |
| | | private Long objectId; |
| | | |
| | | /** |
| | | * 权限列表 |
| | |
| | | this.permissions = permissions; |
| | | } |
| | | |
| | | public Long getObjectId() { |
| | | return objectId; |
| | | } |
| | | |
| | | public void setObjectId(Long objectId) { |
| | | this.objectId = objectId; |
| | | } |
| | | |
| | | public Integer getRoleType() { |
| | | return roleType; |
| | | } |
| | | |
| | | public void setRoleType(Integer roleType) { |
| | | this.roleType = roleType; |
| | | } |
| | | |
| | | public String getNickName() { |
| | | return nickName; |
| | | } |
| | |
| | | AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"))); |
| | | LoginUser loginUser = (LoginUser) authentication.getPrincipal(); |
| | | loginUser.setNickName(user.getNickName()); |
| | | loginUser.setRoleType(user.getRoleType()); |
| | | loginUser.setObjectId(user.getObjectId()); |
| | | recordLoginInfo(loginUser.getUserId()); |
| | | // 生成token |
| | | return loginUser; |
| | |
| | | <groupId>org.apache.tomcat.embed</groupId> |
| | | <artifactId>tomcat-embed-core</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-framework</artifactId> |
| | | <version>3.8.6</version> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | |
| | | @TableField("inventory") |
| | | private Integer inventory; |
| | | |
| | | |
| | | @ApiModelProperty(value = "店铺id") |
| | | @TableField("shopId") |
| | | private Long shopId; |
| | | } |
| | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "店铺id") |
| | | @TableField("shopId") |
| | | private Long shopId; |
| | | |
| | | @ApiModelProperty(value = "分类名称") |
| | | @TableField("typeName") |
| | | private String typeName; |
| | |
| | | @ApiModelProperty(value = "销售价") |
| | | @TableField("goodsSalePrice") |
| | | private BigDecimal goodsSalePrice; |
| | | @ApiModelProperty(value = "成本价") |
| | | @TableField("costPrice") |
| | | private BigDecimal costPrice; |
| | | |
| | | @ApiModelProperty(value = "商品图") |
| | | @TableField("goodsPicture") |
| | |
| | | @ApiModelProperty(value = "订单id") |
| | | @TableField("orderId") |
| | | private Long orderId; |
| | | |
| | | @ApiModelProperty(value = "菜品类型") |
| | | @TableField("typeName") |
| | | private String typeName; |
| | | @ApiModelProperty(value = "类型id") |
| | | @TableField("typeId") |
| | | private Long typeId; |
| | | |
| | | } |
| | |
| | | @TableField("goodsPicture") |
| | | private String goodsPicture; |
| | | |
| | | @ApiModelProperty(value = "菜品类型") |
| | | @TableField("typeName") |
| | | private String typeName; |
| | | @ApiModelProperty(value = "类型id") |
| | | @TableField("typeId") |
| | | private Long typeId; |
| | | |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "订单数分配") |
| | | private List<OrderMealGeneratorCountDTO> orderMealGeneratorCountDTOS; |
| | | @ApiModelProperty(value = "前端忽略") |
| | | private Long userId; |
| | | |
| | | @ApiModelProperty(value = "前端忽略") |
| | | private String nickName; |
| | | } |
| | |
| | | @ApiModelProperty(value = "进货数据设置") |
| | | private List<TStockDataSet> stockDataSets; |
| | | |
| | | @ApiModelProperty(value = "前端忽略") |
| | | private Long userId; |
| | | |
| | | @ApiModelProperty(value = "前端忽略") |
| | | private String nickName; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.importExcel; |
| | | |
| | | import cn.afterturn.easypoi.excel.annotation.Excel; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.ruoyi.system.domain.TOrderMealGoods; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "餐饮订单Excel") |
| | | public class TOrderMealExportExcel implements Serializable { |
| | | @Excel(width = 30,name = "订单编号") |
| | | private String orderNum; |
| | | |
| | | @Excel(width = 30,name = "开台日期") |
| | | private String createStrTime; |
| | | |
| | | @Excel(width = 30,name = "订单金额") |
| | | private BigDecimal orderMoney; |
| | | |
| | | @Excel(width = 30,name = "支付金额") |
| | | private BigDecimal payMoney; |
| | | |
| | | @Excel(width = 30,name = "支付方式",replace = {"现金_1","支付宝_2","微信_3","银行卡_4","其他_5"}) |
| | | private Integer payType; |
| | | |
| | | @Excel(width = 30,name = "桌号") |
| | | private String boardName; |
| | | |
| | | @Excel(width = 30,name = "用餐类型",replace = {"散客_1","宴席_2"}) |
| | | private Integer mealType; |
| | | |
| | | @Excel(width = 30,name = "用餐人数") |
| | | private Integer personCount; |
| | | |
| | | @Excel(width = 30,name = "菜品") |
| | | private String goodsList; |
| | | |
| | | @Excel(width = 30,name = "支付状态",replace = {"待付款_1","已付款_2"}) |
| | | private Integer status; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.importExcel; |
| | | |
| | | import cn.afterturn.easypoi.excel.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @ApiModel(value = "销售订单导出Excel") |
| | | public class TOrderSaleExportExcel implements Serializable { |
| | | |
| | | @Excel(width = 30,name = "订单编号") |
| | | private String orderNum; |
| | | |
| | | @Excel(width = 30,name = "开台日期") |
| | | private String createStrTime; |
| | | |
| | | @Excel(width = 30,name = "订单金额") |
| | | private BigDecimal orderMoney; |
| | | |
| | | @Excel(width = 30,name = "支付金额") |
| | | private BigDecimal payMoney; |
| | | |
| | | @Excel(width = 30,name = "支付方式",replace = {"现金_1","支付宝_2","微信_3","银行卡_4","其他_5"}) |
| | | private Integer payType; |
| | | |
| | | @Excel(width = 30,name = "菜品数量") |
| | | private Integer goodsCount; |
| | | |
| | | @Excel(width = 30,name = "货品总价") |
| | | private BigDecimal goodsAmount; |
| | | |
| | | @Excel(width = 30,name = "支付状态",replace = {"待付款_1","已付款_2"}) |
| | | private Integer status; |
| | | |
| | | } |
| | |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.system.domain.TDataGenerator; |
| | | import com.ruoyi.system.query.TDataGeneratorQuery; |
| | | import com.ruoyi.system.query.TDataStatisticsQuery; |
| | | import com.ruoyi.system.vo.SalesVolumeVO; |
| | | import com.ruoyi.system.vo.TDataGeneratorVO; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.system.domain.TOrderMealGoods; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Mapper |
| | | public interface TOrderMealGoodsMapper extends BaseMapper<TOrderMealGoods> { |
| | | |
| | | /** |
| | | * 获取成本 |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | BigDecimal costTotal(@Param("ids") List<Long> ids); |
| | | } |
| | |
| | | package com.ruoyi.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.system.domain.TOrderMeal; |
| | | import com.ruoyi.system.query.TDataStatisticsQuery; |
| | | import com.ruoyi.system.query.TOrderMealQuery; |
| | | import com.ruoyi.system.vo.AmountSumVO; |
| | | import com.ruoyi.system.vo.SalesVolumeVO; |
| | | import com.ruoyi.system.vo.TOrderMealVO; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TOrderMealMapper extends BaseMapper<TOrderMeal> { |
| | | |
| | | /** |
| | | * 查询餐饮分页列表 |
| | | * @param query |
| | | * @param pageInfo |
| | | * @return |
| | | */ |
| | | List<TOrderMealVO> pageList(@Param("query") TOrderMealQuery query, @Param("pageInfo")PageInfo<TOrderMealVO> pageInfo); |
| | | |
| | | /** |
| | | * 查询餐饮金额统计 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | AmountSumVO amountSum(@Param("query")TOrderMealQuery query); |
| | | |
| | | |
| | | /** |
| | | * 销售额统计 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | SalesVolumeVO salesVolume(@Param("query")TDataStatisticsQuery query); |
| | | |
| | | /** |
| | | * 导出餐饮列表 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | List<TOrderMealVO> exportOrderMeal(@Param("query")TOrderMealQuery query); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.system.domain.TOrderSaleGoods; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TOrderSaleGoodsMapper extends BaseMapper<TOrderSaleGoods> { |
| | | |
| | | /** |
| | | * 获取成本 |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | BigDecimal costTotal(@Param("ids") List<Long> ids); |
| | | } |
| | |
| | | package com.ruoyi.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.system.domain.TOrderSale; |
| | | import com.ruoyi.system.query.TDataStatisticsQuery; |
| | | import com.ruoyi.system.query.TOrderMealQuery; |
| | | import com.ruoyi.system.query.TOrderSaleQuery; |
| | | import com.ruoyi.system.vo.AmountSumVO; |
| | | import com.ruoyi.system.vo.SalesVolumeVO; |
| | | import com.ruoyi.system.vo.TOrderSaleVO; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TOrderSaleMapper extends BaseMapper<TOrderSale> { |
| | | |
| | | /** |
| | | * 查询销售分页列表 |
| | | * @param query |
| | | * @param pageInfo |
| | | * @return |
| | | */ |
| | | List<TOrderSaleVO> pageList(@Param("query") TOrderSaleQuery query, @Param("pageInfo")PageInfo<TOrderSaleVO> pageInfo); |
| | | |
| | | /** |
| | | * 查询销售金额统计 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | AmountSumVO amountSum(@Param("query") TOrderMealQuery query); |
| | | |
| | | /** |
| | | * 查询销售销售量统计 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | SalesVolumeVO salesVolume(@Param("query")TDataStatisticsQuery query); |
| | | |
| | | /** |
| | | * 导出 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | List<TOrderSaleVO> exportOrderSale(@Param("query")TOrderMealQuery query); |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.query; |
| | | |
| | | import com.ruoyi.common.core.domain.model.TimeRangeQueryBody; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "营业数据统计Query") |
| | | public class TDataStatisticsQuery extends TimeRangeQueryBody { |
| | | |
| | | @ApiModelProperty(value = "时间类型 1=今日 2=昨日 3=近7天 4=近30天") |
| | | private Integer timeType; |
| | | |
| | | @ApiModelProperty(value = "店铺id") |
| | | private Long shopId; |
| | | |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "类型id") |
| | | private Long typeId; |
| | | @ApiModelProperty(value = "店铺id") |
| | | private Long shopId; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.query; |
| | | |
| | | import com.ruoyi.common.core.domain.model.TimeRangeQueryBody; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "餐饮订单列表Query") |
| | | public class TOrderMealQuery extends TimeRangeQueryBody { |
| | | |
| | | @ApiModelProperty(value = "用餐类型 1=散客 2=宴席") |
| | | private Integer mealType; |
| | | @ApiModelProperty(value = "支付方式 1=现金 2=支付宝 3=微信 4=银行卡 5=其他") |
| | | private Integer payType; |
| | | @ApiModelProperty(value = "支付状态 1=待支付 2=已支付") |
| | | private Integer status; |
| | | @ApiModelProperty(value = "订单编号") |
| | | private String orderNum; |
| | | @ApiModelProperty(value = "店铺id") |
| | | private Long shopId; |
| | | @ApiModelProperty(value = "时间类型 1=今日 2=昨日 3=近7天 4=近30天") |
| | | private Integer timeType; |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.query; |
| | | |
| | | import com.ruoyi.common.core.domain.model.TimeRangeQueryBody; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "销售订单Query") |
| | | public class TOrderSaleQuery extends TimeRangeQueryBody { |
| | | |
| | | @ApiModelProperty(value = "支付方式 1=现金 2=支付宝 3=微信 4=银行卡 5=其他") |
| | | private Integer payType; |
| | | @ApiModelProperty(value = "支付状态 1=待支付 2=已支付") |
| | | private Integer status; |
| | | @ApiModelProperty(value = "订单编号") |
| | | private String orderNum; |
| | | @ApiModelProperty(value = "店铺id") |
| | | private Long shopId; |
| | | @ApiModelProperty(value = "时间类型 1=今日 2=昨日 3=近7天 4=近30天") |
| | | private Integer timeType; |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "日期类型 1=今天 2=昨天 3=最近7天 4=最近30天") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "店铺id") |
| | | private Long shopId; |
| | | |
| | | } |
| | |
| | | import com.ruoyi.system.dto.OrderMealGeneratorDTO; |
| | | import com.ruoyi.system.dto.OrderSaleGeneratorDTO; |
| | | import com.ruoyi.system.query.TDataGeneratorQuery; |
| | | import com.ruoyi.system.query.TDataStatisticsQuery; |
| | | import com.ruoyi.system.vo.SalesVolumeVO; |
| | | import com.ruoyi.system.vo.TDataGeneratorVO; |
| | | |
| | | /** |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.system.domain.TOrderMealGoods; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TOrderMealGoodsService extends IService<TOrderMealGoods> { |
| | | |
| | | /** |
| | | * 获取商品成本 |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | BigDecimal costTotal(List<Long> ids); |
| | | } |
| | |
| | | package com.ruoyi.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.system.domain.TOrderMeal; |
| | | import com.ruoyi.system.dto.AddDishDTO; |
| | | import com.ruoyi.system.dto.CheckoutDTO; |
| | | import com.ruoyi.system.dto.OrderMealGeneratorDTO; |
| | | import com.ruoyi.system.dto.TOrderMealDTO; |
| | | import com.ruoyi.system.query.TDataStatisticsQuery; |
| | | import com.ruoyi.system.query.TOrderMealQuery; |
| | | import com.ruoyi.system.vo.AmountSumVO; |
| | | import com.ruoyi.system.vo.SalesRankingVO; |
| | | import com.ruoyi.system.vo.SalesVolumeVO; |
| | | import com.ruoyi.system.vo.TOrderMealVO; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | void checkout(CheckoutDTO dto); |
| | | |
| | | /** |
| | | * 查询餐饮分页列表 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | PageInfo<TOrderMealVO> pageList(TOrderMealQuery query); |
| | | |
| | | /** |
| | | * 查询餐饮金额统计 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | AmountSumVO amountSum(TOrderMealQuery query); |
| | | |
| | | /** |
| | | * 销售额统计 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | SalesVolumeVO salesVolume(TDataStatisticsQuery query); |
| | | |
| | | /** |
| | | * 销售分类排行 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | List<SalesRankingVO> salesRanking(TDataStatisticsQuery query); |
| | | |
| | | /** |
| | | * 餐饮列表 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | List<TOrderMealVO> exportOrderMeal(TOrderMealQuery query); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.system.domain.TOrderSaleGoods; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 销售单商品 服务类 |
| | |
| | | * @since 2024-08-14 |
| | | */ |
| | | public interface TOrderSaleGoodsService extends IService<TOrderSaleGoods> { |
| | | |
| | | /** |
| | | * 获取商品成本 |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | BigDecimal costTotal(List<Long> ids); |
| | | } |
| | |
| | | package com.ruoyi.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.system.domain.TOrderSale; |
| | | import com.ruoyi.system.dto.TOrderSaleDTO; |
| | | import com.ruoyi.system.query.TDataStatisticsQuery; |
| | | import com.ruoyi.system.query.TOrderMealQuery; |
| | | import com.ruoyi.system.query.TOrderSaleQuery; |
| | | import com.ruoyi.system.vo.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | void add(TOrderSaleDTO dto); |
| | | |
| | | /** |
| | | * 查询销售分页列表 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | PageInfo<TOrderSaleVO> pageList(TOrderSaleQuery query); |
| | | |
| | | /** |
| | | * 查询销售金额统计 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | AmountSumVO amountSum(TOrderMealQuery query); |
| | | |
| | | /** |
| | | * 查询销售销售量统计 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | SalesVolumeVO salesVolume(TDataStatisticsQuery query); |
| | | |
| | | /** |
| | | * 销售分类排行 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | List<SalesRankingVO> salesRanking(TDataStatisticsQuery query); |
| | | |
| | | /** |
| | | * 导出销售列表 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | List<TOrderSaleVO> exportOrderSale(TOrderMealQuery query); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.constant.OrderNumConstants; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.CodeGenerateUtils; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.domain.*; |
| | | import com.ruoyi.system.dto.*; |
| | | import com.ruoyi.system.dto.OrderMealGeneratorCountDTO; |
| | | import com.ruoyi.system.dto.OrderMealGeneratorDTO; |
| | | import com.ruoyi.system.dto.OrderSaleGeneratorDTO; |
| | | import com.ruoyi.system.mapper.TDataGeneratorMapper; |
| | | import com.ruoyi.system.query.TDataGeneratorQuery; |
| | | import com.ruoyi.system.service.*; |
| | | import com.ruoyi.system.vo.SysUserVO; |
| | | import com.ruoyi.system.vo.TDataGeneratorVO; |
| | | import com.ruoyi.system.vo.TFoundationConfigVO; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | @Autowired |
| | | private TOrderStockGoodsService orderStockGoodsService; |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | @Autowired |
| | | private TStockDataSetService stockDataSetService; |
| | | @Autowired |
| | | private TGoodsTypeService goodsTypeService; |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | | |
| | | @Override |
| | | public void mealDataGenerator(OrderMealGeneratorDTO dto) { |
| | | // 存储数据生成数据 |
| | | TDataGenerator dataGenerator = new TDataGenerator(); |
| | | dataGenerator.setUserId(tokenService.getLoginUser().getUserId()); |
| | | dataGenerator.setUserName(tokenService.getLoginUser().getNickName()); |
| | | dataGenerator.setUserId(dto.getUserId()); |
| | | dataGenerator.setUserName(dto.getNickName()); |
| | | dataGenerator.setShopId(dataGenerator.getShopId()); |
| | | dataGenerator.setStartTime(dto.getStartTime()); |
| | | dataGenerator.setEndTime(dto.getEndTime()); |
| | |
| | | allOrderMeals.addAll(otherOrderMeals); |
| | | allOrderMeals.forEach(e->{ |
| | | e.setIsCover(0); |
| | | e.setShopId(dataGenerator.getShopId()); |
| | | e.setGeneratorId(dataGenerator.getId()); |
| | | }); |
| | | |
| | | // 判断是否进行了终止操作 |
| | | if(redisCache.hasKey(OrderNumConstants.MEAL+"_"+dto.getShopId())){ |
| | | redisCache.deleteObject(OrderNumConstants.MEAL+"_"+dto.getShopId()); |
| | | return; |
| | | } |
| | | |
| | | orderMealService.saveBatch(allOrderMeals); |
| | | |
| | | for (TOrderMeal orderMeal : allOrderMeals) { |
| | | orderMeal.getMealOrderGoods().forEach(e->e.setOrderId(orderMeal.getId())); |
| | | } |
| | | orderMealGoodsService.saveBatch(allOrderMeals.stream().map(TOrderMeal::getMealOrderGoods).flatMap(Collection::stream).collect(Collectors.toList())); |
| | | List<TGoodsType> list = goodsTypeService.list(); |
| | | List<TOrderMealGoods> collect = allOrderMeals.stream().map(TOrderMeal::getMealOrderGoods).flatMap(Collection::stream).collect(Collectors.toList()); |
| | | collect.forEach(e->e.setTypeName(list.stream().filter(m->m.getId().equals(e.getTypeId())).findFirst().get().getTypeName())); |
| | | orderMealGoodsService.saveBatch(collect); |
| | | // 存储 |
| | | long end = System.currentTimeMillis() - start; |
| | | System.err.println("相差时间========="+end); |
| | |
| | | .last("limit 1")); |
| | | // 存储数据生成数据 |
| | | TDataGenerator dataGenerator = new TDataGenerator(); |
| | | dataGenerator.setUserId(tokenService.getLoginUser().getUserId()); |
| | | dataGenerator.setUserName(tokenService.getLoginUser().getNickName()); |
| | | dataGenerator.setUserId(dto.getUserId()); |
| | | dataGenerator.setUserName(dto.getNickName()); |
| | | dataGenerator.setShopId(dataGenerator.getShopId()); |
| | | dataGenerator.setStartTime(dto.getStartTime()); |
| | | dataGenerator.setEndTime(dto.getEndTime()); |
| | |
| | | |
| | | // 添加销售订单数 |
| | | List<TOrderSale> orderSales = dto.getOrderSales(); |
| | | orderSaleService.saveBatch(orderSales); |
| | | for (TOrderSale orderSale : orderSales) { |
| | | orderSale.getOrderSaleGoods().forEach(e->e.setOrderId(orderSale.getId())); |
| | | } |
| | | List<TOrderSaleGoods> orderSaleGoods = orderSales.stream().map(TOrderSale::getOrderSaleGoods).flatMap(Collection::stream).collect(Collectors.toList()); |
| | | orderSaleGoodsService.saveBatch(orderSaleGoods); |
| | | |
| | | // 生成进货数据 |
| | | List<TOrderStock> stockList = new ArrayList<>(); |
| | |
| | | stockList.add(orderStock); |
| | | } |
| | | } |
| | | // 判断是否进行了终止操作 |
| | | if(redisCache.hasKey(OrderNumConstants.STOCK+"_"+dto.getShopId())){ |
| | | redisCache.deleteObject(OrderNumConstants.STOCK+"_"+dto.getShopId()); |
| | | return; |
| | | } |
| | | // 删除上一次的数据生成 |
| | | TOrderStock orderStock = orderStockService.getOne(Wrappers.lambdaQuery(TOrderStock.class) |
| | | .eq(TOrderStock::getShopId, dto.getShopId()) |
| | |
| | | if(Objects.nonNull(orderStock)){ |
| | | orderStockService.removeById(orderStock); |
| | | } |
| | | orderSaleService.saveBatch(orderSales); |
| | | for (TOrderSale orderSale : orderSales) { |
| | | orderSale.getOrderSaleGoods().forEach(e->e.setOrderId(orderSale.getId())); |
| | | } |
| | | List<TGoodsType> list = goodsTypeService.list(); |
| | | orderSaleGoods.forEach(e->e.setTypeName(list.stream().filter(m->m.getId().equals(e.getTypeId())).findFirst().get().getTypeName())); |
| | | orderSaleGoodsService.saveBatch(orderSaleGoods); |
| | | // 添加数据 |
| | | stockList.forEach(e->e.setShopId(dataGenerator.getShopId())); |
| | | orderStockService.saveBatch(stockList); |
| | | for (TOrderStock stock : stockList) { |
| | | stock.getOrderStockGoods().forEach(e->e.setOrderId(stock.getId())); |
| | |
| | | import com.ruoyi.system.service.TOrderMealGoodsService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 餐饮订单商品 服务实现类 |
| | |
| | | @Service |
| | | public class TOrderMealGoodsServiceImpl extends ServiceImpl<TOrderMealGoodsMapper, TOrderMealGoods> implements TOrderMealGoodsService { |
| | | |
| | | @Override |
| | | public BigDecimal costTotal(List<Long> ids) { |
| | | return this.baseMapper.costTotal(ids); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.constant.OrderNumConstants; |
| | | import com.ruoyi.common.enums.BoardEnum; |
| | | import com.ruoyi.common.utils.CodeGenerateUtils; |
| | | import com.ruoyi.system.domain.TBoard; |
| | | import com.ruoyi.system.domain.TOrderMeal; |
| | | import com.ruoyi.system.domain.TOrderMealGoods; |
| | | import com.ruoyi.system.domain.TOrderRemark; |
| | | import com.ruoyi.system.domain.*; |
| | | import com.ruoyi.system.dto.*; |
| | | import com.ruoyi.system.mapper.TOrderMealGoodsMapper; |
| | | import com.ruoyi.system.mapper.TOrderMealMapper; |
| | | import com.ruoyi.system.service.TBoardService; |
| | | import com.ruoyi.system.service.TOrderMealGoodsService; |
| | | import com.ruoyi.system.service.TOrderMealService; |
| | | import com.ruoyi.system.service.TOrderRemarkService; |
| | | import com.ruoyi.system.query.TDataStatisticsQuery; |
| | | import com.ruoyi.system.query.TOrderMealQuery; |
| | | import com.ruoyi.system.service.*; |
| | | import com.ruoyi.system.vo.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.Random; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | private TOrderRemarkService orderRemarkService; |
| | | @Autowired |
| | | private TBoardService boardService; |
| | | @Autowired |
| | | private TGoodsTypeService goodsTypeService; |
| | | @Autowired |
| | | private TGoodsService goodsService; |
| | | |
| | | @Override |
| | | public void add(TOrderMealDTO dto) { |
| | | if(Objects.isNull(dto.getBoardId())){ |
| | | throw new RuntimeException("餐桌不能为空"); |
| | | } |
| | | // 查询菜品分类 |
| | | List<TGoodsType> list1 = goodsTypeService.list(); |
| | | // 查询餐桌 |
| | | TBoard board = boardService.getById(dto.getBoardId()); |
| | | // 如果菜品为空 |
| | |
| | | List<TOrderMealGoods> orderMealGoods = new ArrayList<>(); |
| | | // 查询商品 |
| | | List<Long> goodsIds = dto.getMealOrderGoodsDTOS().stream().map(MealOrderGoodsDTO::getGoodsId).collect(Collectors.toList()); |
| | | List<TOrderMealGoods> list = orderMealGoodsService.list(Wrappers.lambdaQuery(TOrderMealGoods.class) |
| | | .in(TOrderMealGoods::getId, goodsIds)); |
| | | List<TGoods> list = goodsService.list(Wrappers.lambdaQuery(TGoods.class) |
| | | .in(TGoods::getId, goodsIds)); |
| | | dto.getMealOrderGoodsDTOS().forEach(item -> { |
| | | list.stream().filter(item1 -> item1.getId().equals(item.getGoodsId())).findFirst().ifPresent(item1 -> { |
| | | TOrderMealGoods orderMealGood = new TOrderMealGoods(); |
| | |
| | | orderMealGood.setGoodsNum(item1.getGoodsNum()); |
| | | orderMealGood.setGoodsPicture(item1.getGoodsPicture()); |
| | | orderMealGood.setGoodsCount(item.getGoodsCount()); |
| | | orderMealGood.setGoodsSalePrice(item1.getGoodsSalePrice().multiply(new BigDecimal(item.getGoodsCount()))); |
| | | orderMealGood.setGoodsSalePrice(item1.getSalePrice().multiply(new BigDecimal(item.getGoodsCount()))); |
| | | // orderMealGood.setTypeId(item1.getTypeId()); |
| | | orderMealGood.setTypeName(list1.stream().filter(item2 -> item2.getId().equals(item1.getTypeId())).findFirst().get().getTypeName()); |
| | | orderMealGoods.add(orderMealGood); |
| | | }); |
| | | }); |
| | |
| | | @Override |
| | | public void addDish(AddDishDTO dto) { |
| | | List<TOrderMealGoods> orderMealGoods = new ArrayList<>(); |
| | | // 查询菜品分类 |
| | | List<TGoodsType> list1 = goodsTypeService.list(); |
| | | // 查询商品 |
| | | List<Long> goodsIds = dto.getMealOrderGoodsDTOS().stream().map(MealOrderGoodsDTO::getGoodsId).collect(Collectors.toList()); |
| | | List<TOrderMealGoods> list = orderMealGoodsService.list(Wrappers.lambdaQuery(TOrderMealGoods.class) |
| | |
| | | orderMealGood.setGoodsPicture(item1.getGoodsPicture()); |
| | | orderMealGood.setGoodsCount(item.getGoodsCount()); |
| | | orderMealGood.setGoodsSalePrice(item1.getGoodsSalePrice().multiply(new BigDecimal(item.getGoodsCount()))); |
| | | // orderMealGood.setTypeId(item1.getTypeId()); |
| | | orderMealGood.setTypeName(list1.stream().filter(item2 -> item2.getId().equals(item1.getTypeId())).findFirst().get().getTypeName()); |
| | | orderMealGoods.add(orderMealGood); |
| | | }); |
| | | }); |
| | |
| | | boardService.updateById(board); |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<TOrderMealVO> pageList(TOrderMealQuery query) { |
| | | if(Objects.nonNull(query.getTimeType())){ |
| | | LocalDateTime startTime = null; |
| | | LocalDateTime endTime = null; |
| | | switch (query.getTimeType()){ |
| | | case 1: |
| | | // 今日 |
| | | startTime = LocalDateTime.MIN; |
| | | endTime = LocalDateTime.MAX; |
| | | break; |
| | | case 2: |
| | | // 昨日 |
| | | startTime = LocalDateTime.now().minusDays(1); |
| | | endTime = LocalDateTime.now().minusDays(1); |
| | | break; |
| | | case 3: |
| | | // 近7天 |
| | | startTime = LocalDateTime.now().minusDays(7); |
| | | endTime = LocalDateTime.now(); |
| | | break; |
| | | case 4: |
| | | // 近30天 |
| | | startTime = LocalDateTime.now().minusDays(30); |
| | | endTime = LocalDateTime.now(); |
| | | break; |
| | | } |
| | | query.setStartTime(startTime); |
| | | query.setEndTime(endTime); |
| | | } |
| | | PageInfo<TOrderMealVO> pageInfo = new PageInfo<>(query.getPageNum(),query.getPageSize()); |
| | | List<TOrderMealVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | // 查询商品信息 |
| | | for (TOrderMealVO tOrderMealVO : list) { |
| | | List<TOrderMealGoods> list1 = orderMealGoodsService.list(Wrappers.lambdaQuery(TOrderMealGoods.class) |
| | | .eq(TOrderMealGoods::getOrderId, tOrderMealVO.getId())); |
| | | tOrderMealVO.setOrderMealGoods(list1); |
| | | Map<String, List<TOrderMealGoods>> map = list1.stream().collect(Collectors.groupingBy(TOrderMealGoods::getTypeName)); |
| | | List<String> goodsList = new ArrayList<>(); |
| | | map.forEach((k,v)->{ |
| | | goodsList.add(k+":"+v.stream().map(item->item.getGoodsName()+" "+(item.getGoodsSalePrice().multiply(new BigDecimal(item.getGoodsCount())))).collect(Collectors.joining(","))); |
| | | }); |
| | | tOrderMealVO.setGoodsList(goodsList); |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | @Override |
| | | public AmountSumVO amountSum(TOrderMealQuery query) { |
| | | return this.baseMapper.amountSum(query); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public SalesVolumeVO salesVolume(TDataStatisticsQuery query) { |
| | | SalesVolumeVO salesVolumeVO = this.baseMapper.salesVolume(query); |
| | | salesVolumeVO.setSalesVolumeTotal(salesVolumeVO.getWeiXinPay().add(salesVolumeVO.getOtherPay()).add(salesVolumeVO.getCardPay()) |
| | | .add(salesVolumeVO.getMoneyPay()).add(salesVolumeVO.getAliPay())); |
| | | // 查询成本 |
| | | List<TOrderMeal> list = this.list(Wrappers.lambdaQuery(TOrderMeal.class) |
| | | .eq(TOrderMeal::getShopId, query.getShopId())); |
| | | List<Long> ids = list.stream().map(TOrderMeal::getId).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(ids)){ |
| | | BigDecimal costTotal = orderMealGoodsService.costTotal(ids); |
| | | salesVolumeVO.setCostTotal(costTotal); |
| | | salesVolumeVO.setProfitTotal(salesVolumeVO.getSalesVolumeTotal().subtract(costTotal)); |
| | | } |
| | | return salesVolumeVO; |
| | | } |
| | | |
| | | @Override |
| | | public List<SalesRankingVO> salesRanking(TDataStatisticsQuery query) { |
| | | List<TOrderMeal> list = this.list(Wrappers.lambdaQuery(TOrderMeal.class) |
| | | .eq(TOrderMeal::getShopId, query.getShopId()) |
| | | .between(TOrderMeal::getCreateTime, query.getStartTime(), query.getEndTime())); |
| | | List<Long> ids = list.stream().map(TOrderMeal::getId).collect(Collectors.toList()); |
| | | List<SalesRankingVO> salesRankingVOS = new ArrayList<>(); |
| | | if(!CollectionUtils.isEmpty(ids)){ |
| | | List<TOrderMealGoods> list1 = orderMealGoodsService.list(Wrappers.lambdaQuery(TOrderMealGoods.class) |
| | | .in(TOrderMealGoods::getOrderId, ids)); |
| | | Map<String, List<TOrderMealGoods>> listMap = list1.stream().collect(Collectors.groupingBy(TOrderMealGoods::getTypeName)); |
| | | listMap.forEach((k,v)->{ |
| | | SalesRankingVO salesRankingVO = new SalesRankingVO(); |
| | | salesRankingVO.setTypeName(k); |
| | | salesRankingVO.setSalesVolume(v.stream().map(item->item.getGoodsSalePrice().multiply(new BigDecimal(item.getGoodsCount()))).reduce(BigDecimal.ZERO, BigDecimal::add)); |
| | | salesRankingVOS.add(salesRankingVO); |
| | | }); |
| | | } |
| | | return salesRankingVOS; |
| | | } |
| | | |
| | | @Override |
| | | public List<TOrderMealVO> exportOrderMeal(TOrderMealQuery query) { |
| | | if(Objects.nonNull(query.getTimeType())){ |
| | | LocalDateTime startTime = null; |
| | | LocalDateTime endTime = null; |
| | | switch (query.getTimeType()){ |
| | | case 1: |
| | | // 今日 |
| | | startTime = LocalDateTime.MIN; |
| | | endTime = LocalDateTime.MAX; |
| | | break; |
| | | case 2: |
| | | // 昨日 |
| | | startTime = LocalDateTime.now().minusDays(1); |
| | | endTime = LocalDateTime.now().minusDays(1); |
| | | break; |
| | | case 3: |
| | | // 近7天 |
| | | startTime = LocalDateTime.now().minusDays(7); |
| | | endTime = LocalDateTime.now(); |
| | | break; |
| | | case 4: |
| | | // 近30天 |
| | | startTime = LocalDateTime.now().minusDays(30); |
| | | endTime = LocalDateTime.now(); |
| | | break; |
| | | } |
| | | query.setStartTime(startTime); |
| | | query.setEndTime(endTime); |
| | | } |
| | | List<TOrderMealVO> list = this.baseMapper.exportOrderMeal(query); |
| | | List<Long> ids = list.stream().map(TOrderMealVO::getId).collect(Collectors.toList()); |
| | | List<TOrderMealGoods> list1 = orderMealGoodsService.list(Wrappers.lambdaQuery(TOrderMealGoods.class) |
| | | .in(TOrderMealGoods::getOrderId,ids)); |
| | | // 查询商品信息 |
| | | for (TOrderMealVO tOrderMealVO : list) { |
| | | List<TOrderMealGoods> collect = list1.stream().filter(e -> e.getOrderId().equals(tOrderMealVO.getId())).collect(Collectors.toList()); |
| | | tOrderMealVO.setOrderMealGoods(collect); |
| | | Map<String, List<TOrderMealGoods>> map = collect.stream().collect(Collectors.groupingBy(TOrderMealGoods::getTypeName)); |
| | | List<String> goodsList = new ArrayList<>(); |
| | | map.forEach((k,v)->{ |
| | | goodsList.add(k+":"+v.stream().map(item->item.getGoodsName()+" "+(item.getGoodsSalePrice().multiply(new BigDecimal(item.getGoodsCount())))).collect(Collectors.joining(","))); |
| | | }); |
| | | tOrderMealVO.setGoodsList(goodsList); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.system.service.TOrderSaleGoodsService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 销售单商品 服务实现类 |
| | |
| | | */ |
| | | @Service |
| | | public class TOrderSaleGoodsServiceImpl extends ServiceImpl<TOrderSaleGoodsMapper, TOrderSaleGoods> implements TOrderSaleGoodsService { |
| | | |
| | | @Override |
| | | public BigDecimal costTotal(List<Long> ids) { |
| | | return this.baseMapper.costTotal(ids); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.constant.OrderNumConstants; |
| | | import com.ruoyi.common.utils.CodeGenerateUtils; |
| | | import com.ruoyi.system.domain.TOrderSale; |
| | | import com.ruoyi.system.domain.TOrderSaleGoods; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.system.domain.*; |
| | | import com.ruoyi.system.dto.TOrderSaleDTO; |
| | | import com.ruoyi.system.mapper.TOrderSaleMapper; |
| | | import com.ruoyi.system.query.TDataStatisticsQuery; |
| | | import com.ruoyi.system.query.TOrderMealQuery; |
| | | import com.ruoyi.system.query.TOrderSaleQuery; |
| | | import com.ruoyi.system.service.TGoodsTypeService; |
| | | import com.ruoyi.system.service.TOrderSaleGoodsService; |
| | | import com.ruoyi.system.service.TOrderSaleService; |
| | | import com.ruoyi.system.vo.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | @Autowired |
| | | private TOrderSaleGoodsService orderSaleGoodsService; |
| | | |
| | | @Autowired |
| | | private TGoodsTypeService goodsTypeService; |
| | | @Override |
| | | public void add(TOrderSaleDTO dto) { |
| | | // 查询菜品分类 |
| | | List<TGoodsType> list1 = goodsTypeService.list(); |
| | | // 销售单号 |
| | | dto.setOrderNum(OrderNumConstants.SALE + CodeGenerateUtils.generateOrderSn()); |
| | | List<TOrderSaleGoods> orderSaleGoods = dto.getOrderSaleGoods(); |
| | |
| | | orderSaleGoods.forEach(orderSaleGoods1 -> orderSaleGoods1.setOrderId(dto.getId())); |
| | | orderSaleGoodsService.saveBatch(orderSaleGoods); |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<TOrderSaleVO> pageList(TOrderSaleQuery query) { |
| | | if(Objects.nonNull(query.getTimeType())){ |
| | | LocalDateTime startTime = null; |
| | | LocalDateTime endTime = null; |
| | | switch (query.getTimeType()){ |
| | | case 1: |
| | | // 今日 |
| | | startTime = LocalDateTime.MIN; |
| | | endTime = LocalDateTime.MAX; |
| | | break; |
| | | case 2: |
| | | // 昨日 |
| | | startTime = LocalDateTime.now().minusDays(1); |
| | | endTime = LocalDateTime.now().minusDays(1); |
| | | break; |
| | | case 3: |
| | | // 近7天 |
| | | startTime = LocalDateTime.now().minusDays(7); |
| | | endTime = LocalDateTime.now(); |
| | | break; |
| | | case 4: |
| | | // 近30天 |
| | | startTime = LocalDateTime.now().minusDays(30); |
| | | endTime = LocalDateTime.now(); |
| | | break; |
| | | } |
| | | query.setStartTime(startTime); |
| | | query.setEndTime(endTime); |
| | | } |
| | | PageInfo<TOrderSaleVO> pageInfo = new PageInfo<>(query.getPageNum(),query.getPageSize()); |
| | | List<TOrderSaleVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | @Override |
| | | public AmountSumVO amountSum(TOrderMealQuery query) { |
| | | return this.baseMapper.amountSum(query); |
| | | } |
| | | |
| | | @Override |
| | | public SalesVolumeVO salesVolume(TDataStatisticsQuery query) { |
| | | SalesVolumeVO salesVolumeVO = this.baseMapper.salesVolume(query); |
| | | salesVolumeVO.setSalesVolumeTotal(salesVolumeVO.getWeiXinPay().add(salesVolumeVO.getOtherPay()).add(salesVolumeVO.getCardPay()) |
| | | .add(salesVolumeVO.getMoneyPay()).add(salesVolumeVO.getAliPay())); |
| | | // 查询成本 |
| | | List<TOrderSale> list = this.list(Wrappers.lambdaQuery(TOrderSale.class) |
| | | .eq(TOrderSale::getShopId, query.getShopId())); |
| | | List<Long> ids = list.stream().map(TOrderSale::getId).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(ids)){ |
| | | BigDecimal costTotal = orderSaleGoodsService.costTotal(ids); |
| | | salesVolumeVO.setCostTotal(costTotal); |
| | | salesVolumeVO.setProfitTotal(salesVolumeVO.getSalesVolumeTotal().subtract(costTotal)); |
| | | } |
| | | return salesVolumeVO; |
| | | } |
| | | |
| | | @Override |
| | | public List<SalesRankingVO> salesRanking(TDataStatisticsQuery query) { |
| | | List<TOrderSale> list = this.list(Wrappers.lambdaQuery(TOrderSale.class) |
| | | .eq(TOrderSale::getShopId, query.getShopId()) |
| | | .between(TOrderSale::getCreateTime, query.getStartTime(), query.getEndTime())); |
| | | List<Long> ids = list.stream().map(TOrderSale::getId).collect(Collectors.toList()); |
| | | List<SalesRankingVO> salesRankingVOS = new ArrayList<>(); |
| | | if(!CollectionUtils.isEmpty(ids)){ |
| | | List<TOrderSaleGoods> list1 = orderSaleGoodsService.list(Wrappers.lambdaQuery(TOrderSaleGoods.class) |
| | | .in(TOrderSaleGoods::getOrderId, ids)); |
| | | Map<String, List<TOrderSaleGoods>> listMap = list1.stream().collect(Collectors.groupingBy(TOrderSaleGoods::getTypeName)); |
| | | listMap.forEach((k,v)->{ |
| | | SalesRankingVO salesRankingVO = new SalesRankingVO(); |
| | | salesRankingVO.setTypeName(k); |
| | | salesRankingVO.setSalesVolume(v.stream().map(item->item.getGoodsSalePrice().multiply(new BigDecimal(item.getGoodsCount()))).reduce(BigDecimal.ZERO, BigDecimal::add)); |
| | | salesRankingVOS.add(salesRankingVO); |
| | | }); |
| | | } |
| | | return salesRankingVOS; |
| | | } |
| | | |
| | | @Override |
| | | public List<TOrderSaleVO> exportOrderSale(TOrderMealQuery query) { |
| | | if(Objects.nonNull(query.getTimeType())){ |
| | | LocalDateTime startTime = null; |
| | | LocalDateTime endTime = null; |
| | | switch (query.getTimeType()){ |
| | | case 1: |
| | | // 今日 |
| | | startTime = LocalDateTime.MIN; |
| | | endTime = LocalDateTime.MAX; |
| | | break; |
| | | case 2: |
| | | // 昨日 |
| | | startTime = LocalDateTime.now().minusDays(1); |
| | | endTime = LocalDateTime.now().minusDays(1); |
| | | break; |
| | | case 3: |
| | | // 近7天 |
| | | startTime = LocalDateTime.now().minusDays(7); |
| | | endTime = LocalDateTime.now(); |
| | | break; |
| | | case 4: |
| | | // 近30天 |
| | | startTime = LocalDateTime.now().minusDays(30); |
| | | endTime = LocalDateTime.now(); |
| | | break; |
| | | } |
| | | query.setStartTime(startTime); |
| | | query.setEndTime(endTime); |
| | | } |
| | | List<TOrderSaleVO> list = this.baseMapper.exportOrderSale(query); |
| | | List<Long> ids = list.stream().map(TOrderSaleVO::getId).collect(Collectors.toList()); |
| | | List<TOrderSaleGoods> list1 = orderSaleGoodsService.list(Wrappers.lambdaQuery(TOrderSaleGoods.class) |
| | | .in(TOrderSaleGoods::getOrderId,ids)); |
| | | // 查询商品信息 |
| | | for (TOrderSaleVO orderSaleVO : list) { |
| | | List<TOrderSaleGoods> collect = list1.stream().filter(e -> e.getOrderId().equals(orderSaleVO.getId())).collect(Collectors.toList()); |
| | | orderSaleVO.setOrderSaleGoods(collect); |
| | | } |
| | | return list; |
| | | } |
| | | } |
| | |
| | | // 进货单号 |
| | | dto.setStockNum(OrderNumConstants.STOCK + CodeGenerateUtils.generateOrderSn()); |
| | | List<TOrderStockGoods> orderStockGoods = dto.getOrderStockGoods(); |
| | | BigDecimal sum = orderStockGoods.stream().map(TOrderStockGoods::getStockPrice).reduce(BigDecimal::add).get(); |
| | | dto.setStockTotalPrice(sum); |
| | | // BigDecimal sum = orderStockGoods.stream().map(TOrderStockGoods::getStockPrice).reduce(BigDecimal::add).get(); |
| | | // dto.setStockTotalPrice(sum); |
| | | this.save(dto); |
| | | // 添加商品 |
| | | orderStockGoods.forEach(orderSaleGoods1 -> orderSaleGoods1.setOrderId(dto.getId())); |
| | |
| | | @Override |
| | | public void edit(TOrderStockDTO dto) { |
| | | List<TOrderStockGoods> orderStockGoods = dto.getOrderStockGoods(); |
| | | BigDecimal sum = orderStockGoods.stream().map(TOrderStockGoods::getStockPrice).reduce(BigDecimal::add).get(); |
| | | dto.setStockTotalPrice(sum); |
| | | // BigDecimal sum = orderStockGoods.stream().map(TOrderStockGoods::getStockPrice).reduce(BigDecimal::add).get(); |
| | | // dto.setStockTotalPrice(sum); |
| | | this.updateById(dto); |
| | | // 刪除原有商品 |
| | | tOrderStockGoodsService.remove(Wrappers.lambdaQuery(TOrderStockGoods.class) |
New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @ApiModel(value = "订单金额统计VO") |
| | | public class AmountSumVO implements Serializable { |
| | | |
| | | @ApiModelProperty(value = "订单总数") |
| | | private Integer orderCount; |
| | | @ApiModelProperty(value = "销售总额") |
| | | private BigDecimal saleAmount; |
| | | @ApiModelProperty(value = "待付款") |
| | | private BigDecimal obligation; |
| | | @ApiModelProperty(value = "已付款") |
| | | private BigDecimal payAmount; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @ApiModel(value = "商品分类销售排行VO") |
| | | public class SalesRankingVO implements Serializable { |
| | | |
| | | @ApiModelProperty(value = "分类名称") |
| | | private String typeName; |
| | | @ApiModelProperty(value = "金额") |
| | | private BigDecimal salesVolume; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @ApiModel(value = "销售额统计VO") |
| | | public class SalesVolumeVO implements Serializable { |
| | | |
| | | @ApiModelProperty(value = "总销售额") |
| | | private BigDecimal salesVolumeTotal; |
| | | @ApiModelProperty(value = "总成本") |
| | | private BigDecimal costTotal; |
| | | @ApiModelProperty(value = "总盈利") |
| | | private BigDecimal profitTotal; |
| | | |
| | | @ApiModelProperty(value = "现金") |
| | | private BigDecimal moneyPay; |
| | | @ApiModelProperty(value = "支付宝") |
| | | private BigDecimal aliPay; |
| | | @ApiModelProperty(value = "微信") |
| | | private BigDecimal weiXinPay; |
| | | @ApiModelProperty(value = "银行卡") |
| | | private BigDecimal cardPay; |
| | | @ApiModelProperty(value = "其他") |
| | | private BigDecimal otherPay; |
| | | } |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import com.ruoyi.system.domain.TOrderMeal; |
| | | import com.ruoyi.system.domain.TOrderMealGoods; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Data |
| | | @ApiModel(value = "TOrderMealVO对象",description = "餐饮订单VO") |
| | | public class TOrderMealVO extends TOrderMeal { |
| | | |
| | | @ApiModelProperty(value = "桌子名称") |
| | | private String boardName; |
| | | |
| | | @ApiModelProperty(value = "菜品集合") |
| | | private List<TOrderMealGoods> orderMealGoods; |
| | | |
| | | @ApiModelProperty(value = "菜品 列表使用") |
| | | private List<String> goodsList; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import com.ruoyi.system.domain.TOrderSale; |
| | | import com.ruoyi.system.domain.TOrderSaleGoods; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "销售订单VO") |
| | | public class TOrderSaleVO extends TOrderSale { |
| | | |
| | | @ApiModelProperty(value = "菜品集合") |
| | | private List<TOrderSaleGoods> orderSaleGoods; |
| | | |
| | | } |
| | |
| | | and tdg.orderType = #{query.orderType} |
| | | </if> |
| | | <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''"> |
| | | AND DATE_FORMAT(tdg.createTime, '%Y-%m-%d %H:%i:%s') BETWEEN #{query.startTime} |
| | | AND #{query.endTime} |
| | | AND (tdg.createTime BETWEEN #{query.startTime} AND #{query.endTime}) |
| | | </if> |
| | | AND tdg.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} |
| | | </where> |
| | |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="inventory" property="inventory" /> |
| | | <result column="shopId" property="shopId" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, goodsNum, goodsName, typeId, costPrice, salePrice, goodsPicture, createTime, updateTime, disabled, createBy, updateBy, inventory |
| | | id, goodsNum, goodsName, typeId, costPrice, salePrice, goodsPicture, createTime, updateTime, disabled, createBy, updateBy, inventory,shopId |
| | | </sql> |
| | | <select id="pageList" resultType="com.ruoyi.system.vo.TGoodsVO"> |
| | | select |
| | |
| | | t.createBy, |
| | | t.updateBy, |
| | | t.inventory, |
| | | t.shopId, |
| | | tg.typeName |
| | | from t_goods t |
| | | left join t_goods_type tg on t.typeId = tg.id |
| | |
| | | <if test="query.typeId != null"> |
| | | AND t.typeId = #{query.typeId} |
| | | </if> |
| | | <if test="query.shopId != null"> |
| | | AND t.shopId = #{query.shopId} |
| | | </if> |
| | | AND t.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} |
| | | </where> |
| | | ORDER BY t.createTime DESC |
| | |
| | | <result column="disabled" property="disabled" /> |
| | | <result column="createBy" property="createBy" /> |
| | | <result column="updateBy" property="updateBy" /> |
| | | <result column="shopId" property="shopId" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, typeName, createTime, updateTime, disabled, createBy, updateBy |
| | | id, typeName, createTime, updateTime, disabled, createBy, updateBy,shopId |
| | | </sql> |
| | | |
| | | </mapper> |
| | |
| | | <result column="goodsPicture" property="goodsPicture" /> |
| | | <result column="goodsCount" property="goodsCount" /> |
| | | <result column="orderId" property="orderId" /> |
| | | <result column="typeName" property="typeName" /> |
| | | <result column="costPrice" property="costPrice" /> |
| | | <result column="typeId" property="typeId" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, goodsNum, goodsName, goodsSalePrice, goodsPicture, goodsCount, orderId |
| | | id, goodsNum, goodsName, goodsSalePrice, goodsPicture, goodsCount, orderId,typeName,costPrice,typeId |
| | | </sql> |
| | | <select id="costTotal" resultType="java.math.BigDecimal"> |
| | | select sum(costPrice) from t_order_meal_goods |
| | | <where> |
| | | <if test="ids != null and ids.size()>0"> |
| | | AND orderId IN |
| | | <foreach collection="ids" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <result column="status" property="status" /> |
| | | <result column="isCover" property="isCover" /> |
| | | <result column="shopId" property="shopId" /> |
| | | <result column="shopId" property="shopId" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, boardId, mealType, mealPerson, orderMoney, payMoney, payType, createTime, updateTime, disabled, createBy, updateBy, orderNum, status,isCover,shopId |
| | | id, boardId, mealType, mealPerson, orderMoney, payMoney, payType, createTime, updateTime, disabled, |
| | | createBy, updateBy, orderNum, status,isCover,shopId |
| | | </sql> |
| | | <select id="pageList" resultType="com.ruoyi.system.vo.TOrderMealVO"> |
| | | select |
| | | tom.id, tom.boardId, tom.mealType, tom.mealPerson, tom.orderMoney, tom.payMoney, tom.payType, tom.createTime, tom.updateTime, tom.disabled, |
| | | tom.createBy, tom.updateBy, tom.orderNum, tom.status,tom.isCover,tom.shopId,tb.boardName |
| | | from t_order_meal tom |
| | | left join t_board tb on tb.id = tom.boardId |
| | | <where> |
| | | <if test="query.mealType != null"> |
| | | and tom.mealType = #{query.mealType} |
| | | </if> |
| | | <if test="query.payType != null"> |
| | | and tom.payType = #{query.payType} |
| | | </if> |
| | | <if test="query.status != null"> |
| | | and tom.status = #{query.status} |
| | | </if> |
| | | <if test="query.orderNum != null and query.orderNum"> |
| | | and tom.orderNum LIKE concat('%',#{query.status},'%') |
| | | </if> |
| | | <if test="query.shopId != null"> |
| | | and tom.shopId = #{query.shopId} |
| | | </if> |
| | | <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''"> |
| | | AND (tom.createTime BETWEEN #{query.startTime} AND #{query.endTime}) |
| | | </if> |
| | | AND tom.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} |
| | | </where> |
| | | ORDER BY tom.createTime DESC |
| | | </select> |
| | | <select id="amountSum" resultType="com.ruoyi.system.vo.AmountSumVO"> |
| | | select |
| | | COUNT(tom.id) AS orderCount, |
| | | SUM(tom.orderMoney) AS saleAmount, |
| | | SUM(tom.payMoney) AS payAmount, |
| | | SUM(tom.orderMoney - tom.payMoney) AS obligation |
| | | from t_order_meal tom |
| | | left join t_board tb on tb.id = tom.boardId |
| | | <where> |
| | | <if test="query.mealType != null"> |
| | | and tom.mealType = #{query.mealType} |
| | | </if> |
| | | <if test="query.payType != null"> |
| | | and tom.payType = #{query.payType} |
| | | </if> |
| | | <if test="query.status != null"> |
| | | and tom.status = #{query.status} |
| | | </if> |
| | | <if test="query.orderNum != null and query.orderNum"> |
| | | and tom.orderNum LIKE concat('%',#{query.status},'%') |
| | | </if> |
| | | <if test="query.shopId != null"> |
| | | and tom.shopId = #{query.shopId} |
| | | </if> |
| | | <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''"> |
| | | AND (tom.createTime BETWEEN #{query.startTime} AND #{query.endTime}) |
| | | </if> |
| | | AND tom.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} |
| | | </where> |
| | | </select> |
| | | <select id="salesVolume" resultType="com.ruoyi.system.vo.SalesVolumeVO"> |
| | | select |
| | | SUM(CASE WHEN payType = 1 THEN payMoney ELSE 0 END) AS moneyPay, |
| | | SUM(CASE WHEN payType = 2 THEN payMoney ELSE 0 END) AS aliPay, |
| | | SUM(CASE WHEN payType = 3 THEN payMoney ELSE 0 END) AS weiXinPay, |
| | | SUM(CASE WHEN payType = 4 THEN payMoney ELSE 0 END) AS cardPay, |
| | | SUM(CASE WHEN payType = 5 THEN payMoney ELSE 0 END) AS otherPay |
| | | from t_order_meal |
| | | <where> |
| | | <if test="query.shopId != null"> |
| | | and shopId = #{query.shopId} |
| | | </if> |
| | | <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''"> |
| | | AND (createTime BETWEEN #{query.startTime} AND #{query.endTime}) |
| | | </if> |
| | | AND disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} |
| | | </where> |
| | | </select> |
| | | <select id="exportOrderMeal" resultType="com.ruoyi.system.vo.TOrderMealVO"> |
| | | select |
| | | tom.id, tom.boardId, tom.mealType, tom.mealPerson, tom.orderMoney, tom.payMoney, tom.payType, tom.createTime, tom.updateTime, tom.disabled, |
| | | tom.createBy, tom.updateBy, tom.orderNum, tom.status,tom.isCover,tom.shopId,tb.boardName |
| | | from t_order_meal tom |
| | | left join t_board tb on tb.id = tom.boardId |
| | | <where> |
| | | <if test="query.mealType != null"> |
| | | and tom.mealType = #{query.mealType} |
| | | </if> |
| | | <if test="query.payType != null"> |
| | | and tom.payType = #{query.payType} |
| | | </if> |
| | | <if test="query.status != null"> |
| | | and tom.status = #{query.status} |
| | | </if> |
| | | <if test="query.orderNum != null and query.orderNum"> |
| | | and tom.orderNum LIKE concat('%',#{query.status},'%') |
| | | </if> |
| | | <if test="query.shopId != null"> |
| | | and tom.shopId = #{query.shopId} |
| | | </if> |
| | | <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''"> |
| | | AND (tom.createTime BETWEEN #{query.startTime} AND #{query.endTime}) |
| | | </if> |
| | | AND tom.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} |
| | | </where> |
| | | ORDER BY tom.createTime DESC |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <result column="goodsCount" property="goodsCount" /> |
| | | <result column="salePrice" property="salePrice" /> |
| | | <result column="goodsPicture" property="goodsPicture" /> |
| | | <result column="typeName" property="typeName" /> |
| | | <result column="typeId" property="typeId" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, orderId, goodsNum, goodsName, goodsCostPrice, goodsSalePrice, goodsCount, salePrice, goodsPicture |
| | | id, orderId, goodsNum, goodsName, goodsCostPrice, goodsSalePrice, goodsCount, salePrice, goodsPicture,typeName,typeId |
| | | </sql> |
| | | <select id="costTotal" resultType="java.math.BigDecimal"> |
| | | select sum(goodsCostPrice) from t_order_meal_goods |
| | | <where> |
| | | <if test="ids != null and ids.size()>0"> |
| | | AND orderId IN |
| | | <foreach collection="ids" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <sql id="Base_Column_List"> |
| | | id, orderTime, remark, createTime, updateTime, disabled, createBy, updateBy, orderNum, status,orderMoney,payMoney,shopId |
| | | </sql> |
| | | <select id="pageList" resultType="com.ruoyi.system.vo.TOrderSaleVO"> |
| | | select id, orderTime, remark, createTime, updateTime, disabled, createBy, updateBy, orderNum, status,orderMoney,payMoney,shopId |
| | | from t_order_sale |
| | | <where> |
| | | <if test="query.orderNum != null and query.orderNum != ''"> |
| | | AND orderNum LIKE concat('%', #{query.orderNum}, '%') |
| | | </if> |
| | | <if test="query.payType != null"> |
| | | AND payType = #{query.payType} |
| | | </if> |
| | | <if test="query.status != null"> |
| | | AND status = #{query.status} |
| | | </if> |
| | | <if test="query.shopId != null"> |
| | | and shopId = #{query.shopId} |
| | | </if> |
| | | <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''"> |
| | | AND (createTime BETWEEN #{query.startTime} AND #{query.endTime}) |
| | | </if> |
| | | AND disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} |
| | | </where> |
| | | ORDER BY orderTime DESC |
| | | </select> |
| | | <select id="amountSum" resultType="com.ruoyi.system.vo.AmountSumVO"> |
| | | select |
| | | COUNT(id) AS orderCount, |
| | | SUM(orderMoney) AS saleAmount, |
| | | SUM(payMoney) AS payAmount, |
| | | SUM(orderMoney - payMoney) AS obligation |
| | | from t_order_sale |
| | | <where> |
| | | <if test="query.orderNum != null and query.orderNum != ''"> |
| | | AND orderNum LIKE concat('%', #{query.orderNum}, '%') |
| | | </if> |
| | | <if test="query.payType != null"> |
| | | AND payType = #{query.payType} |
| | | </if> |
| | | <if test="query.status != null"> |
| | | AND status = #{query.status} |
| | | </if> |
| | | <if test="query.shopId != null"> |
| | | and shopId = #{query.shopId} |
| | | </if> |
| | | <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''"> |
| | | AND (createTime BETWEEN #{query.startTime} AND #{query.endTime}) |
| | | </if> |
| | | AND disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} |
| | | </where> |
| | | </select> |
| | | <select id="salesVolume" resultType="com.ruoyi.system.vo.SalesVolumeVO"> |
| | | select |
| | | SUM(CASE WHEN payType = 1 THEN payMoney ELSE 0 END) AS moneyPay, |
| | | SUM(CASE WHEN payType = 2 THEN payMoney ELSE 0 END) AS aliPay, |
| | | SUM(CASE WHEN payType = 3 THEN payMoney ELSE 0 END) AS weiXinPay, |
| | | SUM(CASE WHEN payType = 4 THEN payMoney ELSE 0 END) AS cardPay, |
| | | SUM(CASE WHEN payType = 5 THEN payMoney ELSE 0 END) AS otherPay |
| | | from t_order_sale |
| | | <where> |
| | | <if test="query.shopId != null"> |
| | | and shopId = #{query.shopId} |
| | | </if> |
| | | <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''"> |
| | | AND (createTime BETWEEN #{query.startTime} AND #{query.endTime}) |
| | | </if> |
| | | AND disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} |
| | | </where> |
| | | </select> |
| | | <select id="exportOrderSale" resultType="com.ruoyi.system.vo.TOrderSaleVO"> |
| | | select id, orderTime, remark, createTime, updateTime, disabled, createBy, updateBy, orderNum, status,orderMoney,payMoney,shopId |
| | | from t_order_sale |
| | | <where> |
| | | <if test="query.orderNum != null and query.orderNum != ''"> |
| | | AND orderNum LIKE concat('%', #{query.orderNum}, '%') |
| | | </if> |
| | | <if test="query.payType != null"> |
| | | AND payType = #{query.payType} |
| | | </if> |
| | | <if test="query.status != null"> |
| | | AND status = #{query.status} |
| | | </if> |
| | | <if test="query.shopId != null"> |
| | | and shopId = #{query.shopId} |
| | | </if> |
| | | <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''"> |
| | | AND (createTime BETWEEN #{query.startTime} AND #{query.endTime}) |
| | | </if> |
| | | AND disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} |
| | | </where> |
| | | ORDER BY orderTime DESC |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | SELECT <include refid="Base_Column_List"></include> |
| | | FROM t_order_stock |
| | | <where> |
| | | <if test="stockNum != null and stockNum != ''"> |
| | | AND stockNum LIKE concat('%',#{stockNum},'%') |
| | | <if test="query.stockNum != null and query.stockNum != ''"> |
| | | AND stockNum LIKE concat('%',#{query.stockNum},'%') |
| | | </if> |
| | | <if test="query.shopId != null"> |
| | | AND shopId = #{query.shopId} |
| | | </if> |
| | | <if test="query.endTime != null and query.startTime != null"> |
| | | AND (stockTime BETWEEN #{query.startTime} and #{query.endTime}) |