Merge remote-tracking branch 'refs/remotes/origin/dev' into test
# Conflicts: # eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpCashierCartService.java # eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpShopTableService.java # eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpCashierCartServiceImpl.java # eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpShopTableServiceImpl.java
This commit is contained in:
commit
6c2c12d95d
|
|
@ -98,6 +98,12 @@ public class TbShopTableController {
|
|||
return new ResponseEntity<>(tbShopTableService.generate(generateDTO),HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 台桌状态获取
|
||||
*/
|
||||
@GetMapping("/state")
|
||||
public ResponseEntity<Object> getShopState(@RequestParam Integer shopId, @RequestParam String tableId) {
|
||||
return new ResponseEntity<>(tbShopTableService.getShopState(shopId, tableId),HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package cn.ysk.cashier.mybatis.service;
|
||||
|
||||
import cn.ysk.cashier.enums.OrderStatusEnums;
|
||||
import cn.ysk.cashier.pojo.order.TbCashierCart;
|
||||
import cn.ysk.cashier.pojo.order.TbOrderDetail;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
|
@ -21,5 +22,14 @@ public interface MpCashierCartService extends IService<TbCashierCart> {
|
|||
* @return 购物车信息
|
||||
*/
|
||||
List<TbCashierCart> selectTakeoutCart(String masterId, Integer shopId);
|
||||
|
||||
/**
|
||||
* 统计当前台桌购物车数量
|
||||
* @param shopId 店铺id
|
||||
* @param tableId 台桌id
|
||||
* @param statusEnums 状态,可不传查询所有
|
||||
* @return 购物车数量
|
||||
*/
|
||||
long countByTableId(Integer shopId, String tableId, OrderStatusEnums... statusEnums);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,4 +20,12 @@ public interface MpShopTableService extends IService<TbShopTable> {
|
|||
* @return 台桌信息
|
||||
*/
|
||||
TbShopTable selectByStateAndTableId(TableStateEnum tableStateEnum, String tableId, Integer shopId);
|
||||
|
||||
/**
|
||||
* 查询台桌信息
|
||||
* @param tableId 台桌id
|
||||
* @param shopId 店铺id
|
||||
* @return 台桌信息
|
||||
*/
|
||||
TbShopTable selectByTableId(String tableId, Integer shopId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package cn.ysk.cashier.mybatis.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.ysk.cashier.enums.OrderStatusEnums;
|
||||
import cn.ysk.cashier.enums.OrderUseTypeEnum;
|
||||
import cn.ysk.cashier.mybatis.mapper.TbCashierCartMapper;
|
||||
import cn.ysk.cashier.mybatis.mapper.TbOrderDetailMapper;
|
||||
|
|
@ -12,6 +13,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -31,5 +33,21 @@ public class MpCashierCartServiceImpl extends ServiceImpl<TbCashierCartMapper, T
|
|||
.eq(TbCashierCart::getUseType, OrderUseTypeEnum.TAKEOUT.getValue())
|
||||
.gt(TbCashierCart::getCreatedAt, DateUtil.offsetDay(DateUtil.date(), -1).getTime()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public long countByTableId(Integer shopId, String tableId, OrderStatusEnums... statusEnums) {
|
||||
LambdaQueryWrapper<TbCashierCart> queryWrapper = new LambdaQueryWrapper<TbCashierCart>()
|
||||
.eq(TbCashierCart::getShopId, shopId)
|
||||
.gt(TbCashierCart::getCreatedAt, DateUtil.offsetDay(DateUtil.date(), -1).getTime())
|
||||
.eq(TbCashierCart::getTableId, tableId);
|
||||
if (statusEnums.length > 0) {
|
||||
ArrayList<String> stateList = new ArrayList<>();
|
||||
for (OrderStatusEnums statusEnum : statusEnums) {
|
||||
stateList.add(statusEnum.getValue());
|
||||
}
|
||||
queryWrapper.in(TbCashierCart::getStatus, stateList);
|
||||
}
|
||||
return count(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,4 +30,11 @@ public class MpShopTableServiceImpl extends ServiceImpl<MpShopTableMapper, TbSho
|
|||
.eq(TbShopTable::getStatus, tableStateEnum.getState())
|
||||
.eq(TbShopTable::getQrcode, tableId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbShopTable selectByTableId(String tableId, Integer shopId) {
|
||||
return getOne(new LambdaQueryWrapper<TbShopTable>()
|
||||
.eq(TbShopTable::getShopId, shopId)
|
||||
.eq(TbShopTable::getQrcode, tableId));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -300,8 +300,11 @@ public class SummaryServiceImpl implements SummaryService {
|
|||
public List<TbOrderPayCountVo> summaryCount(ShopSummaryDto summaryDto) {
|
||||
List<TbOrderPayCountVo> list = new ArrayList<>();
|
||||
|
||||
summaryDto.setStartTime(DateUtil.toDate(DateUtil.fromTimeStamp(1704038400L)));
|
||||
summaryDto.setEndTime(new Date());
|
||||
if (summaryDto.getStartTime() == null) {
|
||||
summaryDto.setStartTime(DateUtil.toDate(DateUtil.fromTimeStamp(1704038400L)));
|
||||
summaryDto.setEndTime(new Date());
|
||||
|
||||
}
|
||||
|
||||
TbOrderSalesCountByDayVo tbOrderSalesCountByDayVo = detailRepository.queryTbOrderSalesCountByDaysummaryCount(Integer.valueOf(summaryDto.getShopId()), summaryDto.getCateId(), summaryDto.getProName(), summaryDto.getStartTime(), summaryDto.getEndTime());
|
||||
TbOrderPayCountVo zongShuLiang = new TbOrderPayCountVo("el-icon-goods", "总数量", "0", tbOrderSalesCountByDayVo.getSalesNum() + tbOrderSalesCountByDayVo.getRefNum());
|
||||
|
|
|
|||
|
|
@ -225,7 +225,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||
ArrayList<Map<String, Object>> infoList = new ArrayList<>();
|
||||
for (TbShopTable date : tbShopTableList) {
|
||||
if (StrUtil.isBlank(date.getQrcode())) {
|
||||
date.setStatus("closed");
|
||||
date.setStatus("unbind");
|
||||
} else if (tbCashierCartMapper.selectCount(new LambdaQueryWrapper<TbCashierCart>()
|
||||
.eq(TbCashierCart::getShopId, date.getShopId())
|
||||
.eq(TbCashierCart::getTableId, date.getQrcode())
|
||||
|
|
@ -434,7 +434,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||
@Override
|
||||
public TbCashierCart addCartForUser(AddCartDTO addCartDTO) {
|
||||
addCartDTO.setTableId(OrderUseTypeEnum.TAKEOUT.getValue().equals(addCartDTO.getUseType()) ? null : addCartDTO.getTableId());
|
||||
ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(addCartDTO.getShopId(), addCartDTO.getTableId());
|
||||
ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(addCartDTO.getShopId(), addCartDTO.getTableId(), addCartDTO.getUseType());
|
||||
|
||||
TbProductSku productSku = productMapper.selectSkuByIdAndShopId(addCartDTO.getShopId(), addCartDTO.getSkuId());
|
||||
TbProduct product = productMapper.selectByIdAndShopId(addCartDTO.getShopId(), addCartDTO.getProductId());
|
||||
|
|
@ -443,7 +443,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||
throw new BadRequestException("商品不存在或已下架, id: " + addCartDTO.getSkuId());
|
||||
}
|
||||
|
||||
if (product.getStockNumber() < 1) {
|
||||
if (product.getIsStock() != null && product.getIsStock() == 1 &&product.getStockNumber() < 1) {
|
||||
throw new BadRequestException(product.getName() + "商品库存不足");
|
||||
}
|
||||
|
||||
|
|
@ -2191,4 +2191,16 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||
rabbitMsgUtils.updateCons(jsonObject1);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getShopState(Integer shopId, String tableId) {
|
||||
TbShopTable tbShopTable = mpShopTableService.selectByTableId(tableId, shopId);
|
||||
if (tbShopTable != null) {
|
||||
long cartCount = mpCashierCartService.countByTableId(shopId, tableId);
|
||||
Map<String, Object> map = BeanUtil.beanToMap(tbShopTable, false, false);
|
||||
map.put("cartCount", cartCount);
|
||||
return map;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,4 +139,12 @@ public interface TbShopTableService {
|
|||
Object choseModel(ChoseModelDTO choseModelDTO);
|
||||
|
||||
Object returnOrder(ReturnOrderDTO returnOrderDTO);
|
||||
|
||||
/**
|
||||
* 获取台桌状态
|
||||
* @param shopId 电偶id
|
||||
* @param tableId qrcode
|
||||
* @return
|
||||
*/
|
||||
Object getShopState(Integer shopId, String tableId);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue