1.代客下单 挂起订单
This commit is contained in:
parent
e938911e4a
commit
89582d3bc8
|
|
@ -17,4 +17,5 @@ public class PendingDTO {
|
||||||
private Integer vipUserId;
|
private Integer vipUserId;
|
||||||
@NotNull
|
@NotNull
|
||||||
private Boolean isPending;
|
private Boolean isPending;
|
||||||
|
private Integer orderId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import cn.ysk.cashier.mybatis.entity.Activate;
|
||||||
import cn.ysk.cashier.pojo.order.TbCashierCart;
|
import cn.ysk.cashier.pojo.order.TbCashierCart;
|
||||||
import cn.ysk.cashier.vo.CarVO;
|
import cn.ysk.cashier.vo.CarVO;
|
||||||
import cn.ysk.cashier.vo.PendingCountVO;
|
import cn.ysk.cashier.vo.PendingCountVO;
|
||||||
|
import cn.ysk.cashier.vo.TbCashierCartVO;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.apache.ibatis.annotations.Select;
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
@ -20,7 +21,10 @@ public interface TbCashierCartMapper extends BaseMapper<TbCashierCart> {
|
||||||
" from tb_cashier_cart where table_id is not null and shop_id = #{shopId} and status = 'refund' group by shop_Id, master_id order by trade_day desc")
|
" from tb_cashier_cart where table_id is not null and shop_id = #{shopId} and status = 'refund' group by shop_Id, master_id order by trade_day desc")
|
||||||
List<CarVO> selectCar(@Param("shopId") Integer shopId);
|
List<CarVO> selectCar(@Param("shopId") Integer shopId);
|
||||||
|
|
||||||
@Select(" SELECT order_id orderId, pending_at, sum(total_amount) toalAmount, count(id) totalCount from tb_cashier_cart where status = 'refund' and shop_id=#{shopId} " +
|
@Select(" SELECT order_id orderId, pending_at, sum(total_amount) totalAmount, count(id) totalCount, count(total_number) totalNumber from tb_cashier_cart where status = 'refund' and shop_id=#{shopId} " +
|
||||||
" GROUP BY order_id ORDER BY trade_day")
|
" GROUP BY order_id ORDER BY trade_day")
|
||||||
List<PendingCountVO> countPending(@Param("shopId") Integer shopId);
|
List<PendingCountVO> countPending(@Param("shopId") Integer shopId);
|
||||||
|
|
||||||
|
@Select("select a.*, b.spec_snap from tb_cashier_cart as a left join tb_product_sku as b on a.sku_id=b.id where a.shop_id=#{shopId} and a.status='refund';")
|
||||||
|
List<TbCashierCartVO> selectPending(Integer shopId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -822,14 +822,23 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
||||||
@Override
|
@Override
|
||||||
public Object pending(PendingDTO pendingDTO) {
|
public Object pending(PendingDTO pendingDTO) {
|
||||||
LambdaQueryWrapper<TbCashierCart> queryWrapper = new LambdaQueryWrapper<TbCashierCart>()
|
LambdaQueryWrapper<TbCashierCart> queryWrapper = new LambdaQueryWrapper<TbCashierCart>()
|
||||||
.eq(TbCashierCart::getShopId, pendingDTO.getShopId())
|
.eq(TbCashierCart::getShopId, pendingDTO.getShopId());
|
||||||
.eq(TbCashierCart::getTableId, pendingDTO.getTableId())
|
|
||||||
.eq(TbCashierCart::getStatus, "create");
|
if (!pendingDTO.getIsPending()) {
|
||||||
if (pendingDTO.getVipUserId() != null) {
|
if (pendingDTO.getOrderId() == null) {
|
||||||
queryWrapper.eq(TbCashierCart::getUserId, pendingDTO.getVipUserId());
|
throw new BadRequestException("取消挂起订单id不为空");
|
||||||
|
}
|
||||||
|
queryWrapper.eq(TbCashierCart::getOrderId, pendingDTO.getOrderId());
|
||||||
}else {
|
}else {
|
||||||
queryWrapper.eq(TbCashierCart::getMasterId, pendingDTO.getMasterId())
|
queryWrapper.eq(TbCashierCart::getTableId, pendingDTO.getTableId())
|
||||||
.isNull(TbCashierCart::getUserId);
|
.eq(TbCashierCart::getStatus, "create");
|
||||||
|
if (pendingDTO.getVipUserId() != null) {
|
||||||
|
queryWrapper.eq(TbCashierCart::getUserId, pendingDTO.getVipUserId());
|
||||||
|
}else {
|
||||||
|
queryWrapper.eq(TbCashierCart::getMasterId, pendingDTO.getMasterId())
|
||||||
|
.isNull(TbCashierCart::getUserId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
List<TbCashierCart> cashierCarts = cashierCartMapper
|
List<TbCashierCart> cashierCarts = cashierCartMapper
|
||||||
.selectList(queryWrapper);
|
.selectList(queryWrapper);
|
||||||
|
|
@ -875,13 +884,15 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getCar(Integer shopId) {
|
public Object getCar(Integer shopId) {
|
||||||
ArrayList<HashMap<String, Object>> data = new ArrayList<>();
|
ArrayList<Map<String, Object>> data = new ArrayList<>();
|
||||||
|
|
||||||
List<PendingCountVO> pendingCountVOS = cashierCartMapper.countPending(shopId);
|
List<PendingCountVO> pendingCountVOS = cashierCartMapper.countPending(shopId);
|
||||||
List<TbCashierCart> tbCashierCarts = cashierCartMapper.selectList(new LambdaQueryWrapper<TbCashierCart>()
|
List<TbCashierCart> tbCashierCarts = cashierCartMapper.selectList(new LambdaQueryWrapper<TbCashierCart>()
|
||||||
.eq(TbCashierCart::getShopId, shopId)
|
.eq(TbCashierCart::getShopId, shopId)
|
||||||
.eq(TbCashierCart::getStatus, "refund"));
|
.eq(TbCashierCart::getStatus, "refund"));
|
||||||
|
|
||||||
|
cashierCartMapper.selectPending(shopId);
|
||||||
|
|
||||||
HashMap<String, List<TbCashierCart>> cashierMap = new HashMap<>();
|
HashMap<String, List<TbCashierCart>> cashierMap = new HashMap<>();
|
||||||
for (TbCashierCart tbCashierCart : tbCashierCarts) {
|
for (TbCashierCart tbCashierCart : tbCashierCarts) {
|
||||||
List<TbCashierCart> list = cashierMap.computeIfAbsent(tbCashierCart.getOrderId().toString(), k -> new ArrayList<>());
|
List<TbCashierCart> list = cashierMap.computeIfAbsent(tbCashierCart.getOrderId().toString(), k -> new ArrayList<>());
|
||||||
|
|
@ -891,6 +902,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
||||||
pendingCountVOS.forEach(item -> {
|
pendingCountVOS.forEach(item -> {
|
||||||
Map<String, Object> map = BeanUtil.beanToMap(item, false, false);
|
Map<String, Object> map = BeanUtil.beanToMap(item, false, false);
|
||||||
map.put("carList", cashierMap.get(item.getOrderId().toString()));
|
map.put("carList", cashierMap.get(item.getOrderId().toString()));
|
||||||
|
data.add(map);
|
||||||
});
|
});
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,5 +10,6 @@ public class PendingCountVO {
|
||||||
private Long pendingAt;
|
private Long pendingAt;
|
||||||
private BigDecimal totalAmount;
|
private BigDecimal totalAmount;
|
||||||
private Integer totalCount;
|
private Integer totalCount;
|
||||||
|
private Integer totalNumber;
|
||||||
private Integer orderId;
|
private Integer orderId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
package cn.ysk.cashier.vo;
|
||||||
|
|
||||||
|
import cn.ysk.cashier.pojo.order.TbCashierCart;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class TbCashierCartVO extends TbCashierCart {
|
||||||
|
private String specSnap;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue