| | |
| | | List<Long> ids = list.stream().filter(e -> !e.getStatus().equals(1)).map(TBoard::getId).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(ids)){ |
| | | List<TOrderMeal> orderMeals = orderMealService.list(Wrappers.lambdaQuery(TOrderMeal.class) |
| | | .in(TOrderMeal::getBoardId, ids)); |
| | | .in(TOrderMeal::getBoardId, ids) |
| | | .isNotNull(TOrderMeal::getMealTime) |
| | | .orderByDesc(TOrderMeal::getMealTime)); |
| | | for (TBoard board : list) { |
| | | List<TOrderMeal> collect = orderMeals.stream().filter(e -> board.getId().equals(e.getBoardId())).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(collect)){ |
| | |
| | | |
| | | |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.query.TDataStatisticsQuery; |
| | | import com.ruoyi.system.service.TOrderMealService; |
| | |
| | | endTime = LocalDateTime.now(); |
| | | break; |
| | | } |
| | | query.setStartTime(startTime); |
| | | query.setEndTime(endTime); |
| | | query.setStartTime(DateUtils.localDateTimeToDate(startTime)); |
| | | query.setEndTime(DateUtils.localDateTimeToDate(endTime)); |
| | | SalesVolumeVO salesVolumeVO; |
| | | if(roleType == 2){ |
| | | salesVolumeVO = orderMealService.salesVolume(query); |
| | |
| | | endTime = LocalDateTime.now(); |
| | | break; |
| | | } |
| | | query.setStartTime(startTime); |
| | | query.setEndTime(endTime); |
| | | query.setStartTime(DateUtils.localDateTimeToDate(startTime)); |
| | | query.setEndTime(DateUtils.localDateTimeToDate(endTime)); |
| | | List<SalesRankingVO> salesRankingVOS; |
| | | if(roleType == 2){ |
| | | salesRankingVOS = orderMealService.salesRanking(query); |
| | |
| | | endTime = LocalDateTime.now(); |
| | | break; |
| | | } |
| | | query.setStartTime(startTime); |
| | | query.setEndTime(endTime); |
| | | query.setStartTime(DateUtils.localDateTimeToDate(startTime)); |
| | | query.setEndTime(DateUtils.localDateTimeToDate(endTime)); |
| | | List<OrderTrendsVO> orderTrendsVOS; |
| | | if(roleType == 2){ |
| | | orderTrendsVOS = orderMealService.orderingTrends(query); |
| | |
| | | endTime = LocalDateTime.now(); |
| | | break; |
| | | } |
| | | query.setStartTime(startTime); |
| | | query.setEndTime(endTime); |
| | | query.setStartTime(DateUtils.localDateTimeToDate(startTime)); |
| | | query.setEndTime(DateUtils.localDateTimeToDate(endTime)); |
| | | return AjaxResult.success(orderMealService.personnelStatistics(query)); |
| | | } |
| | | |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | |
| | | @ApiOperation( value = "删除商品管理") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public AjaxResult<Boolean> deleteById(@RequestParam("id") Long id) { |
| | | TGoods goods = goodsService.getById(id); |
| | | long count = goodsService.count(Wrappers.lambdaQuery(TGoods.class) |
| | | .eq(TGoods::getTypeId, goods.getTypeId()) |
| | | .ne(TGoods::getId,id)); |
| | | if(count == 0){ |
| | | return AjaxResult.error("当前菜品所属分类下至少保留一种菜品"); |
| | | } |
| | | return AjaxResult.success(goodsService.removeById(id)); |
| | | } |
| | | |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | |
| | | @PostMapping(value = "/list") |
| | | public AjaxResult<List<TGoodsType>> list() { |
| | | Long shopId = tokenService.getLoginUser().getObjectId(); |
| | | return AjaxResult.success(goodsTypeService.list(Wrappers.<TGoodsType>lambdaQuery().eq(TGoodsType::getShopId, shopId))); |
| | | Integer roleType = tokenService.getLoginUser().getRoleType(); |
| | | LambdaQueryWrapper<TGoodsType> wrapper = new LambdaQueryWrapper<>(); |
| | | if(roleType != 1){ |
| | | wrapper.eq(TGoodsType::getShopId, shopId); |
| | | } |
| | | return AjaxResult.success(goodsTypeService.list(wrapper)); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.WebUtils; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.domain.TGoodsType; |
| | | 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.TOrderMealDTO; |
| | | import com.ruoyi.system.export.TOrderMealExportExcel; |
| | | import com.ruoyi.system.query.TOrderMealQuery; |
| | | import com.ruoyi.system.service.TGoodsTypeService; |
| | | import com.ruoyi.system.service.TOrderMealGoodsService; |
| | | import com.ruoyi.system.service.TOrderMealService; |
| | | import com.ruoyi.system.vo.AmountSumVO; |
| | |
| | | |
| | | private final TOrderMealService orderMealService; |
| | | private final TOrderMealGoodsService orderMealGoodsService; |
| | | private final TGoodsTypeService goodsTypeService; |
| | | private final TokenService tokenService; |
| | | |
| | | @Autowired |
| | | public TOrderMealController(TOrderMealService orderMealService, TOrderMealGoodsService orderMealGoodsService, TokenService tokenService) { |
| | | public TOrderMealController(TOrderMealService orderMealService, TOrderMealGoodsService orderMealGoodsService, TGoodsTypeService goodsTypeService, TokenService tokenService) { |
| | | this.orderMealService = orderMealService; |
| | | this.orderMealGoodsService = orderMealGoodsService; |
| | | this.goodsTypeService = goodsTypeService; |
| | | this.tokenService = tokenService; |
| | | } |
| | | |
| | |
| | | return AjaxResult.success(orderMealVO); |
| | | } |
| | | |
| | | @ApiOperation( value = "修改") |
| | | @PostMapping(value = "/update") |
| | | public AjaxResult<String> update(@RequestBody TOrderMealDTO dto) { |
| | | // 删除所有菜品 |
| | | orderMealGoodsService.remove(Wrappers.lambdaQuery(TOrderMealGoods.class) |
| | | .eq(TOrderMealGoods::getOrderId, dto.getId())); |
| | | orderMealService.updateById(dto); |
| | | for (TOrderMealGoods mealOrderGood : dto.getMealOrderGoods()) { |
| | | // 设置商品类型和类型id |
| | | TGoodsType goodsType = goodsTypeService.getById(mealOrderGood.getTypeId()); |
| | | mealOrderGood.setId(null); |
| | | mealOrderGood.setOrderId(dto.getId()); |
| | | mealOrderGood.setTypeId(goodsType.getId()); |
| | | mealOrderGood.setTypeName(goodsType.getTypeName()); |
| | | } |
| | | orderMealGoodsService.saveBatch(dto.getMealOrderGoods()); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @ApiOperation( value = "删除餐饮订单") |
| | | @GetMapping(value = "/deleteById") |
| | | public AjaxResult<Boolean> deleteById(@RequestParam(value = "id") Long id) { |
| | |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.domain.TOrderSale; |
| | | import com.ruoyi.system.domain.TOrderSaleGoods; |
| | | import com.ruoyi.system.dto.CheckoutDTO; |
| | | import com.ruoyi.system.dto.TOrderSaleDTO; |
| | | import com.ruoyi.system.export.TOrderMealExportExcel; |
| | | import com.ruoyi.system.export.TOrderSaleExportExcel; |
| | |
| | | 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.*; |
| | | |
| | | import javax.servlet.ServletOutputStream; |
| | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @ApiOperation( value = "结账接口") |
| | | @PostMapping(value = "/checkout") |
| | | public AjaxResult<String> checkout(@Validated @RequestBody CheckoutDTO dto) { |
| | | orderSaleService.checkout(dto); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | /** |
| | | * 导出销售列表 |
| | | */ |
| | |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.domain.TBoard; |
| | | import com.ruoyi.system.domain.TShop; |
| | | import com.ruoyi.system.dto.TShopDTO; |
| | | import com.ruoyi.system.query.TShopQuery; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import com.ruoyi.system.service.TBoardService; |
| | | import com.ruoyi.system.service.TShopService; |
| | | import com.ruoyi.system.vo.TShopVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | |
| | | |
| | | private final TShopService shopService; |
| | | private final ISysUserService userService; |
| | | private final TBoardService boardService; |
| | | private final TokenService tokenService; |
| | | |
| | | @Autowired |
| | | public TShopController(TShopService shopService, ISysUserService userService, TokenService tokenService) { |
| | | public TShopController(TShopService shopService, ISysUserService userService, TBoardService boardService, TokenService tokenService) { |
| | | this.shopService = shopService; |
| | | this.userService = userService; |
| | | this.boardService = boardService; |
| | | this.tokenService = tokenService; |
| | | } |
| | | |
| | |
| | | */ |
| | | @ApiOperation( value = "查看店铺信息详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public AjaxResult<TShop> getDetailById(@RequestParam("id") Long id) { |
| | | return AjaxResult.success(shopService.getById(id)); |
| | | public AjaxResult<TShopVO> getDetailById(@RequestParam("id") Long id) { |
| | | TShop shop = shopService.getById(id); |
| | | TShopVO shopVO = new TShopVO(); |
| | | BeanUtils.copyProperties(shop,shopVO); |
| | | List<TBoard> list = boardService.list(Wrappers.lambdaQuery(TBoard.class) |
| | | .eq(TBoard::getShopId, id)); |
| | | shopVO.setBoards(list); |
| | | return AjaxResult.success(shopVO); |
| | | } |
| | | |
| | | /** |
| | |
| | | public class TimeRangeQueryBody extends BasePage { |
| | | |
| | | @ApiModelProperty("开始时间 格式 yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | private LocalDateTime startTime; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date startTime; |
| | | |
| | | @ApiModelProperty("结束时间 格式 yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | private LocalDateTime endTime; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date endTime; |
| | | |
| | | public String getStartTime() { |
| | | if (Objects.nonNull(startTime)) { |
| | |
| | | return null; |
| | | } |
| | | |
| | | public void setStartTime(LocalDateTime startTime) { |
| | | public void setStartTime(Date startTime) { |
| | | this.startTime = startTime; |
| | | } |
| | | |
| | |
| | | return null; |
| | | } |
| | | |
| | | public void setEndTime(LocalDateTime endTime) { |
| | | public void setEndTime(Date endTime) { |
| | | this.endTime = endTime; |
| | | } |
| | | |
| | |
| | | return LocalDate.parse(time, DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | } |
| | | |
| | | /** |
| | | * LocalDateTime转Date |
| | | * |
| | | * @param dateTime 日期 |
| | | * @return Date |
| | | */ |
| | | public static Date localDateTimeToDate(LocalDateTime dateTime) { |
| | | ZoneId zoneId = ZoneId.systemDefault(); |
| | | ZonedDateTime zdt = dateTime.atZone(zoneId); |
| | | return Date.from(zdt.toInstant()); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.system.domain.TBoard; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @author xiaochen |
| | | * @since 2024-08-14 |
| | | */ |
| | | @Mapper |
| | | public interface TBoardMapper extends BaseMapper<TBoard> { |
| | | |
| | | } |
| | |
| | | * @param query |
| | | * @return |
| | | */ |
| | | Map<String, BigDecimal> getDataGeneratorMealDetail(@Param("query")TDataGeneratorMealQuery query); |
| | | Map<String, Double> getDataGeneratorMealDetail(@Param("query")TDataGeneratorMealQuery query); |
| | | |
| | | /** |
| | | * 导出餐饮数据生成详情 |
| | |
| | | * @param query |
| | | * @return |
| | | */ |
| | | Map<String, BigDecimal> getDataGeneratorMealDetail(@Param("query")TDataGeneratorSaleQuery query); |
| | | Map<String, Double> getDataGeneratorSaleDetail(@Param("query")TDataGeneratorSaleQuery query); |
| | | |
| | | /** |
| | | * 销售生成数据详情导出 |
| | |
| | | * @param query |
| | | * @return |
| | | */ |
| | | Map<String, BigDecimal> getDataGeneratorMealDetail(TDataGeneratorMealQuery query); |
| | | Map<String, Double> getDataGeneratorMealDetail(TDataGeneratorMealQuery query); |
| | | |
| | | /** |
| | | * 餐饮生成数据详情导出 |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.system.domain.TOrderSale; |
| | | import com.ruoyi.system.dto.CheckoutDTO; |
| | | import com.ruoyi.system.dto.TOrderSaleDTO; |
| | | import com.ruoyi.system.query.TDataGeneratorSaleQuery; |
| | | import com.ruoyi.system.query.TDataStatisticsQuery; |
| | |
| | | * @param query |
| | | * @return |
| | | */ |
| | | Map<String, BigDecimal> getDataGeneratorMealDetail(TDataGeneratorSaleQuery query); |
| | | Map<String, Double> getDataGeneratorSaleDetail(TDataGeneratorSaleQuery query); |
| | | |
| | | /** |
| | | * 销售生成数据详情导出 |
| | |
| | | * @return |
| | | */ |
| | | List<TOrderSaleVO> saleGeneratorExport(TDataGeneratorSaleQuery query); |
| | | |
| | | /** |
| | | * 结账接口 |
| | | * @param dto |
| | | */ |
| | | void checkout(CheckoutDTO dto); |
| | | } |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | |
| | | @Autowired |
| | | private TGoodsTypeService goodsTypeService; |
| | | @Autowired |
| | | private TShopService shopService; |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | | |
| | | @Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRED) |
| | |
| | | TDataGenerator dataGenerator = new TDataGenerator(); |
| | | dataGenerator.setUserId(dto.getUserId()); |
| | | dataGenerator.setUserName(dto.getNickName()); |
| | | dataGenerator.setShopId(dataGenerator.getShopId()); |
| | | dataGenerator.setShopId(dto.getShopId()); |
| | | dataGenerator.setStartTime(dto.getStartTime()); |
| | | dataGenerator.setEndTime(dto.getEndTime()); |
| | | dataGenerator.setMinMoney(dto.getMinMoney()); |
| | |
| | | orderMeal.setOrderNum(OrderNumConstants.MEAL + CodeGenerateUtils.generateVolumeSn()); |
| | | orderMeal.setStatus(2); |
| | | List<TOrderMealGoods> orderMealGoods = new ArrayList<>(); |
| | | // 获取当前桌的菜品 |
| | | List<TFoundationConfigVO> foundationConfigVOS = foundationConfigs.stream().filter(e -> e.getMealCount().equals(random)).collect(Collectors.toList()); |
| | | // 每种菜品分类需要几个菜的生成 |
| | | foundationConfigVOS.forEach(e -> { |
| | | int random1 = getRandom(e.getMinCount(), e.getMaxCount()); |
| | | List<TGoods> typeGoods = goods.stream().filter(m -> e.getTypeId().equals(m.getTypeId())).collect(Collectors.toList()); |
| | |
| | | tOrderMealGoods.setGoodsPicture(typeGood.getGoodsPicture()); |
| | | tOrderMealGoods.setGoodsSalePrice(typeGood.getSalePrice()); |
| | | tOrderMealGoods.setGoodsCount(1); |
| | | tOrderMealGoods.setTypeId(typeGood.getTypeId()); |
| | | orderMealGoods.add(tOrderMealGoods); |
| | | } |
| | | } |
| | |
| | | PageInfo<TDataGeneratorVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TDataGeneratorVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | List<Long> ids = list.stream().map(TDataGeneratorVO::getId).collect(Collectors.toList()); |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return new PageInfo<>(); |
| | | } |
| | | if(query.getOrderType() == 1){ |
| | | List<TOrderMeal> orderMeals = orderMealService.list(Wrappers.lambdaQuery(TOrderMeal.class) |
| | | .in(TOrderMeal::getGeneratorId, ids)); |
| | |
| | | TDataGenerator dataGenerator = this.getById(query.getGeneratorId()); |
| | | TDataGeneratorMealDetailVO data = new TDataGeneratorMealDetailVO(); |
| | | BeanUtils.copyProperties(dataGenerator,data); |
| | | // 查询店铺 |
| | | TShop shop = shopService.getById(dataGenerator.getShopId()); |
| | | if(Objects.nonNull(shop)){ |
| | | data.setShopName(shop.getShopName()); |
| | | } |
| | | // 查询订单 |
| | | PageInfo<TOrderMealVO> pageInfo = orderMealService.pageListGenerator(query); |
| | | data.setOrderMealList(pageInfo); |
| | | // 统计支付金额 |
| | | Map<String, BigDecimal> map = orderMealService.getDataGeneratorMealDetail(query); |
| | | BigDecimal money = map.get("moneyPay"); |
| | | BigDecimal card = map.get("cardPay"); |
| | | BigDecimal weiXin = map.get("weiXinPay"); |
| | | BigDecimal ali = map.get("aliPay"); |
| | | BigDecimal other = map.get("otherPay"); |
| | | Map<String, Double> map = orderMealService.getDataGeneratorMealDetail(query); |
| | | BigDecimal money = new BigDecimal(map.get("moneyPay")).setScale(2,BigDecimal.ROUND_HALF_UP); |
| | | BigDecimal card = new BigDecimal(map.get("cardPay")).setScale(2,BigDecimal.ROUND_HALF_UP); |
| | | BigDecimal weiXin = new BigDecimal(map.get("weiXinPay")).setScale(2,BigDecimal.ROUND_HALF_UP); |
| | | BigDecimal ali = new BigDecimal(map.get("aliPay")).setScale(2,BigDecimal.ROUND_HALF_UP); |
| | | BigDecimal other = new BigDecimal(map.get("otherPay")).setScale(2,BigDecimal.ROUND_HALF_UP); |
| | | data.setMoneyPayAmount(money); |
| | | data.setCardPayAmount(card); |
| | | data.setWeiXinPayAmount(weiXin); |
| | |
| | | PageInfo<TOrderSaleVO> pageInfo = orderSaleService.pageList(orderSaleQuery); |
| | | data.setOrderMealList(pageInfo); |
| | | // 统计支付金额 |
| | | Map<String, BigDecimal> map = orderSaleService.getDataGeneratorMealDetail(query); |
| | | BigDecimal money = map.get("moneyPay"); |
| | | BigDecimal card = map.get("cardPay"); |
| | | BigDecimal weiXin = map.get("weiXinPay"); |
| | | BigDecimal ali = map.get("aliPay"); |
| | | BigDecimal other = map.get("otherPay"); |
| | | Map<String, Double> map = orderSaleService.getDataGeneratorSaleDetail(query); |
| | | BigDecimal money = new BigDecimal(map.get("moneyPay")).setScale(2,BigDecimal.ROUND_HALF_UP); |
| | | BigDecimal card = new BigDecimal(map.get("cardPay")).setScale(2,BigDecimal.ROUND_HALF_UP); |
| | | BigDecimal weiXin = new BigDecimal(map.get("weiXinPay")).setScale(2,BigDecimal.ROUND_HALF_UP); |
| | | BigDecimal ali = new BigDecimal(map.get("aliPay")).setScale(2,BigDecimal.ROUND_HALF_UP); |
| | | BigDecimal other = new BigDecimal(map.get("otherPay")).setScale(2,BigDecimal.ROUND_HALF_UP); |
| | | data.setMoneyPayAmount(money); |
| | | data.setCardPayAmount(card); |
| | | data.setWeiXinPayAmount(weiXin); |
| | |
| | | } |
| | | |
| | | private int getRandomPayType(Integer size,BigDecimal count) { |
| | | BigDecimal bigDecimal = new BigDecimal(size).multiply(count.divide(new BigDecimal(100))).setScale(0, RoundingMode.HALF_UP); |
| | | BigDecimal bigDecimal = new BigDecimal(size).multiply(count.divide(new BigDecimal(100))).setScale(0, BigDecimal.ROUND_FLOOR); |
| | | return Integer.parseInt(bigDecimal.toString()); |
| | | } |
| | | |
| | |
| | | import com.ruoyi.system.vo.TFoundationPersonVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | public List<TFoundationPersonVO> getList() { |
| | | List<TFoundationPersonVO> list = this.baseMapper.getList(); |
| | | List<Long> ids = list.stream().map(TFoundationPersonVO::getId).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(ids)){ |
| | | List<TFoundationConfig> list1 = foundationConfigService.list(Wrappers.lambdaQuery(TFoundationConfig.class) |
| | | .in(TFoundationConfig::getPersonId, ids)); |
| | | list.forEach(item -> { |
| | | item.setFoundationConfigs(list1.stream().filter(item1 -> item1.getPersonId().equals(item.getId())).collect(Collectors.toList())); |
| | | List<TFoundationConfig> collect = list1.stream().filter(item1 -> item1.getPersonId().equals(item.getId())).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(collect)){ |
| | | item.setMinDish(collect.stream().sorted(Comparator.comparingInt(TFoundationConfig::getMinCount)).findFirst().get().getMinCount()); |
| | | item.setMaxDish(collect.stream().sorted(Comparator.comparingInt(TFoundationConfig::getMaxCount).reversed()).findFirst().get().getMaxCount()); |
| | | item.setFoundationConfigs(collect); |
| | | } |
| | | }); |
| | | } |
| | | return list; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.constant.OrderNumConstants; |
| | | import com.ruoyi.common.enums.BoardEnum; |
| | | import com.ruoyi.common.utils.CodeGenerateUtils; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.system.domain.*; |
| | | import com.ruoyi.system.dto.*; |
| | | import com.ruoyi.system.mapper.TOrderMealGoodsMapper; |
| | |
| | | orderMeal.setMealPerson(dto.getMealPerson()); |
| | | orderMeal.setMealTime(dto.getMealTime()); |
| | | orderMeal.setOrderMoney(dto.getOrderMoney()); |
| | | this.updateById(orderMeal); |
| | | |
| | | // 查询菜品分类 |
| | | List<TGoodsType> list1 = goodsTypeService.list(); |
| | |
| | | orderMealGood.setGoodsPicture(item1.getGoodsPicture()); |
| | | orderMealGood.setGoodsCount(item.getGoodsCount()); |
| | | orderMealGood.setGoodsSalePrice(item1.getSalePrice().multiply(new BigDecimal(item.getGoodsCount()))); |
| | | orderMealGood.setCostPrice(item1.getCostPrice().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); |
| | | }); |
| | | }); |
| | | BigDecimal orderMoney = BigDecimal.ZERO; |
| | | // 添加菜品 |
| | | orderMealGoods.forEach(item -> { |
| | | item.setOrderId(dto.getId()); |
| | | }); |
| | | for (TOrderMealGoods orderMealGood : orderMealGoods) { |
| | | orderMealGood.setOrderId(dto.getId()); |
| | | orderMoney = orderMoney.add(orderMealGood.getGoodsSalePrice()); |
| | | } |
| | | orderMealGoodsService.saveBatch(orderMealGoods); |
| | | orderMeal.setOrderMoney(orderMoney); |
| | | this.updateById(orderMeal); |
| | | // 添加备注 |
| | | // TOrderRemark tOrderRemark = new TOrderRemark(); |
| | | // tOrderRemark.setOrderId(dto.getId()); |
| | |
| | | endTime = LocalDateTime.now(); |
| | | break; |
| | | } |
| | | query.setStartTime(startTime); |
| | | query.setEndTime(endTime); |
| | | query.setStartTime(DateUtils.localDateTimeToDate(startTime)); |
| | | query.setEndTime(DateUtils.localDateTimeToDate(endTime)); |
| | | } |
| | | PageInfo<TOrderMealVO> pageInfo = new PageInfo<>(query.getPageNum(),query.getPageSize()); |
| | | List<TOrderMealVO> list = this.baseMapper.pageList(query,pageInfo); |
| | |
| | | endTime = LocalDateTime.now(); |
| | | break; |
| | | } |
| | | query.setStartTime(startTime); |
| | | query.setEndTime(endTime); |
| | | query.setStartTime(DateUtils.localDateTimeToDate(startTime)); |
| | | query.setEndTime(DateUtils.localDateTimeToDate(endTime)); |
| | | } |
| | | List<TOrderMealVO> list = this.baseMapper.exportOrderMeal(query); |
| | | List<Long> ids = list.stream().map(TOrderMealVO::getId).collect(Collectors.toList()); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, BigDecimal> getDataGeneratorMealDetail(TDataGeneratorMealQuery query) { |
| | | public Map<String, Double> getDataGeneratorMealDetail(TDataGeneratorMealQuery query) { |
| | | return this.baseMapper.getDataGeneratorMealDetail(query); |
| | | } |
| | | |
| | |
| | | board.setStatus(BoardEnum.WAITING_ORDER.getCode()); |
| | | boardService.updateById(board); |
| | | dto.setMealTime(LocalDate.now()); |
| | | dto.setOrderNum(OrderNumConstants.MEAL + CodeGenerateUtils.generateVolumeSn()); |
| | | this.save(dto); |
| | | } |
| | | |
| | |
| | | import com.ruoyi.common.utils.CodeGenerateUtils; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.system.domain.*; |
| | | import com.ruoyi.system.dto.CheckoutDTO; |
| | | import com.ruoyi.system.dto.TOrderSaleDTO; |
| | | import com.ruoyi.system.mapper.TOrderSaleMapper; |
| | | import com.ruoyi.system.query.TDataGeneratorSaleQuery; |
| | |
| | | endTime = LocalDateTime.now(); |
| | | break; |
| | | } |
| | | query.setStartTime(startTime); |
| | | query.setEndTime(endTime); |
| | | query.setStartTime(DateUtils.localDateTimeToDate(startTime)); |
| | | query.setEndTime(DateUtils.localDateTimeToDate(endTime)); |
| | | } |
| | | PageInfo<TOrderSaleVO> pageInfo = new PageInfo<>(query.getPageNum(),query.getPageSize()); |
| | | List<TOrderSaleVO> list = this.baseMapper.pageList(query,pageInfo); |
| | |
| | | endTime = LocalDateTime.now(); |
| | | break; |
| | | } |
| | | query.setStartTime(startTime); |
| | | query.setEndTime(endTime); |
| | | query.setStartTime(DateUtils.localDateTimeToDate(startTime)); |
| | | query.setEndTime(DateUtils.localDateTimeToDate(endTime)); |
| | | } |
| | | List<TOrderSaleVO> list = this.baseMapper.exportOrderSale(query); |
| | | List<Long> ids = list.stream().map(TOrderSaleVO::getId).collect(Collectors.toList()); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, BigDecimal> getDataGeneratorMealDetail(TDataGeneratorSaleQuery query) { |
| | | return this.baseMapper.getDataGeneratorMealDetail(query); |
| | | public Map<String, Double> getDataGeneratorSaleDetail(TDataGeneratorSaleQuery query) { |
| | | return this.baseMapper.getDataGeneratorSaleDetail(query); |
| | | } |
| | | |
| | | @Override |
| | |
| | | endTime = LocalDateTime.now(); |
| | | break; |
| | | } |
| | | query.setStartTime(startTime); |
| | | query.setEndTime(endTime); |
| | | query.setStartTime(DateUtils.localDateTimeToDate(startTime)); |
| | | query.setEndTime(DateUtils.localDateTimeToDate(endTime)); |
| | | } |
| | | List<TOrderSaleVO> list = this.baseMapper.saleGeneratorExport(query); |
| | | List<Long> ids = list.stream().map(TOrderSaleVO::getId).collect(Collectors.toList()); |
| | |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public void checkout(CheckoutDTO dto) { |
| | | TOrderSale orderSale = this.getById(dto.getOrderId()); |
| | | orderSale.setPayType(dto.getPayType()); |
| | | orderSale.setPayMoney(dto.getPayMoney()); |
| | | orderSale.setStatus(2); |
| | | this.updateById(orderSale); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.constant.OrderNumConstants; |
| | | import com.ruoyi.common.utils.CodeGenerateUtils; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.system.domain.TOrderSaleGoods; |
| | | import com.ruoyi.system.domain.TOrderStock; |
| | | import com.ruoyi.system.domain.TOrderStockGoods; |
| | |
| | | endTime = LocalDateTime.now(); |
| | | break; |
| | | } |
| | | query.setStartTime(startTime); |
| | | query.setEndTime(endTime); |
| | | query.setStartTime(DateUtils.localDateTimeToDate(startTime)); |
| | | query.setEndTime(DateUtils.localDateTimeToDate(endTime)); |
| | | } |
| | | PageInfo<TOrderStockVO> pageInfo = new PageInfo<>(query.getPageNum(),query.getPageSize()); |
| | | List<TOrderStockVO> list = this.baseMapper.pageList(query,pageInfo); |
| | |
| | | endTime = LocalDateTime.now(); |
| | | break; |
| | | } |
| | | query.setStartTime(startTime); |
| | | query.setEndTime(endTime); |
| | | query.setStartTime(DateUtils.localDateTimeToDate(startTime)); |
| | | query.setEndTime(DateUtils.localDateTimeToDate(endTime)); |
| | | } |
| | | List<TOrderStockVO> list = this.baseMapper.stockGeneratorExport(query); |
| | | // 查询商品 |
| | |
| | | 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.system.domain.TBoard; |
| | | import com.ruoyi.system.domain.TShop; |
| | | import com.ruoyi.system.mapper.TBoardMapper; |
| | | import com.ruoyi.system.mapper.TShopMapper; |
| | | import com.ruoyi.system.query.TShopQuery; |
| | | import com.ruoyi.system.service.TShopService; |
| | | import com.ruoyi.system.vo.TGoodsVO; |
| | | import com.ruoyi.system.vo.TShopVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | |
| | | @Service |
| | | public class TShopServiceImpl extends ServiceImpl<TShopMapper, TShop> implements TShopService { |
| | | |
| | | @Autowired |
| | | private TBoardMapper boardMapper; |
| | | |
| | | @Override |
| | | public PageInfo<TShopVO> pageList(TShopQuery query) { |
| | | PageInfo<TShopVO> pageInfo = new PageInfo<>(query.getPageNum(),query.getPageSize()); |
| | | List<TShopVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | for (TShopVO tShopVO : list) { |
| | | tShopVO.setBoards(boardMapper.selectList(Wrappers.lambdaQuery(TBoard.class) |
| | | .eq(TBoard::getShopId,tShopVO.getId()))); |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | |
| | | @ApiModel(value = "餐饮数据生成详情VO") |
| | | public class TDataGeneratorMealDetailVO extends TDataGenerator { |
| | | |
| | | @ApiModelProperty(value = "店铺名称") |
| | | private String shopName; |
| | | @ApiModelProperty(value = "现金支付金额") |
| | | private BigDecimal moneyPayAmount; |
| | | @ApiModelProperty(value = "微信支付金额") |
| | |
| | | @ApiModelProperty(value = "菜品设置") |
| | | private List<TFoundationConfig> foundationConfigs; |
| | | |
| | | @ApiModelProperty(value = "最大菜品") |
| | | private Integer maxDish; |
| | | |
| | | @ApiModelProperty(value = "最小菜品") |
| | | private Integer minDish; |
| | | |
| | | } |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import com.ruoyi.system.domain.TBoard; |
| | | import com.ruoyi.system.domain.TShop; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "店铺返回VO") |
| | | public class TShopVO extends TShop { |
| | | |
| | | @ApiModelProperty(value = "桌子列表") |
| | | private List<TBoard> boards; |
| | | |
| | | } |
| | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, boardId, mealType, mealPerson, orderMoney, payMoney, payType, createTime, updateTime, disabled, |
| | | createBy, updateBy, orderNum, status,isCover,shopId,generatorId,remark |
| | | createBy, updateBy, orderNum, status,isCover,shopId,generatorId,remark,mealTime |
| | | </sql> |
| | | <select id="pageList" resultType="com.ruoyi.system.vo.TOrderMealVO"> |
| | | select |
| | |
| | | </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 |
| | | IFNULL(SUM(CASE WHEN payType = 1 THEN payMoney ELSE 0 END),0) AS moneyPay, |
| | | IFNULL(SUM(CASE WHEN payType = 2 THEN payMoney ELSE 0 END),0) AS aliPay, |
| | | IFNULL(SUM(CASE WHEN payType = 3 THEN payMoney ELSE 0 END),0) AS weiXinPay, |
| | | IFNULL(SUM(CASE WHEN payType = 4 THEN payMoney ELSE 0 END),0) AS cardPay, |
| | | IFNULL(SUM(CASE WHEN payType = 5 THEN payMoney ELSE 0 END),0) AS otherPay |
| | | from t_order_meal |
| | | <where> |
| | | <if test="query.shopId != null"> |
| | |
| | | </select> |
| | | <select id="getDataGeneratorMealDetail" resultType="java.util.Map"> |
| | | 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 |
| | | IFNULL(SUM(CASE WHEN payType = 1 THEN payMoney ELSE 0 END),0) AS moneyPay, |
| | | IFNULL(SUM(CASE WHEN payType = 2 THEN payMoney ELSE 0 END),0) AS aliPay, |
| | | IFNULL(SUM(CASE WHEN payType = 3 THEN payMoney ELSE 0 END),0) AS weiXinPay, |
| | | IFNULL(SUM(CASE WHEN payType = 4 THEN payMoney ELSE 0 END),0) AS cardPay, |
| | | IFNULL(SUM(CASE WHEN payType = 5 THEN payMoney ELSE 0 END),0) AS otherPay |
| | | from t_order_meal |
| | | <where> |
| | | <if test="query.dataId != null"> |
| | | and generatorId = #{query.dataId} |
| | | <if test="query.generatorId != null"> |
| | | and generatorId = #{query.generatorId} |
| | | </if> |
| | | <if test="query.payType != null"> |
| | | and payType = #{query.payType} |
| | |
| | | </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 |
| | | IFNULL(SUM(CASE WHEN payType = 1 THEN payMoney ELSE 0 END),0) AS moneyPay, |
| | | IFNULL(SUM(CASE WHEN payType = 2 THEN payMoney ELSE 0 END),0) AS aliPay, |
| | | IFNULL(SUM(CASE WHEN payType = 3 THEN payMoney ELSE 0 END),0) AS weiXinPay, |
| | | IFNULL(SUM(CASE WHEN payType = 4 THEN payMoney ELSE 0 END),0) AS cardPay, |
| | | IFNULL(SUM(CASE WHEN payType = 5 THEN payMoney ELSE 0 END),0) AS otherPay |
| | | from t_order_sale |
| | | <where> |
| | | <if test="query.shopId != null"> |
| | |
| | | </select> |
| | | <select id="getDataGeneratorMealDetail" resultType="java.util.Map"> |
| | | 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 |
| | | IFNULL(SUM(CASE WHEN payType = 1 THEN payMoney ELSE 0 END),0) AS moneyPay, |
| | | IFNULL(SUM(CASE WHEN payType = 2 THEN payMoney ELSE 0 END),0) AS aliPay, |
| | | IFNULL(SUM(CASE WHEN payType = 3 THEN payMoney ELSE 0 END),0) AS weiXinPay, |
| | | IFNULL(SUM(CASE WHEN payType = 4 THEN payMoney ELSE 0 END),0) AS cardPay, |
| | | IFNULL(SUM(CASE WHEN payType = 5 THEN payMoney ELSE 0 END),0) AS otherPay |
| | | from t_order_sale |
| | | <where> |
| | | <if test="query.generatorId != null"> |