Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
@@ -4,9 +4,11 @@ import com.czg.account.dto.BkOrderDTO;
|
||||
import com.czg.account.dto.calltable.CallTablePage;
|
||||
import com.czg.account.entity.BkContactList;
|
||||
import com.czg.account.entity.BkOrder;
|
||||
import com.czg.account.entity.BkOrderTable;
|
||||
import com.czg.account.service.BkContactListService;
|
||||
import com.czg.account.service.BkOrderService;
|
||||
import com.czg.account.vo.BkTableVO;
|
||||
import com.czg.account.vo.BookingOrderStatisticsVO;
|
||||
import com.czg.annotation.SaAdminCheckPermission;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
@@ -57,6 +59,18 @@ public class BkContactListController {
|
||||
return CzgResult.success(tables);
|
||||
}
|
||||
|
||||
/**
|
||||
* 预约端-预定单:预约单统计
|
||||
*/
|
||||
// @SaAdminCheckPermission(value = "bk:bkOrder:bookings:statistics", name = "预约端-预约单:预约单统计")
|
||||
@GetMapping("/bkOrder/booking/statistics")
|
||||
public CzgResult<BookingOrderStatisticsVO> bookingOrderStatistics(@RequestParam(required = false) String search,
|
||||
@RequestParam(required = false) LocalDate start,
|
||||
@RequestParam(required = false) LocalDate end,
|
||||
@RequestParam(required = false) String status) {
|
||||
BookingOrderStatisticsVO statistics = bkOrderService.bookingOrderStatistics(StpKit.USER.getShopId(), search, start, end, status);
|
||||
return CzgResult.success(statistics);
|
||||
}
|
||||
|
||||
/**
|
||||
* 预约端-预定单:查询预约单列表
|
||||
@@ -71,6 +85,16 @@ public class BkContactListController {
|
||||
return CzgResult.success(tables);
|
||||
}
|
||||
|
||||
/**
|
||||
* 预约端-预定单:查询预约单选中台桌
|
||||
*/
|
||||
// @SaAdminCheckPermission(value = "bk:bkOrder:bookings/tables", name = "预约端-预约单:查询预约单选中的台桌")
|
||||
@GetMapping("/bkOrder/bookings/tables")
|
||||
public CzgResult<List<BkOrderTable>> bookingTables(Long id) {
|
||||
List<BkOrderTable> tables = bkOrderService.bookingTables(StpKit.USER.getShopId(), id);
|
||||
return CzgResult.success(tables);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 预约端-预约单:预约/修改预约
|
||||
|
||||
@@ -60,7 +60,7 @@ public class ShopAdController {
|
||||
* 小程序广告编辑
|
||||
* @return 是否成功
|
||||
*/
|
||||
@SaAdminCheckPermission(value = "shopAd:list", name = "小程序广告编辑")
|
||||
@SaAdminCheckPermission(value = "shopAd:edit", name = "小程序广告编辑")
|
||||
@PutMapping
|
||||
public CzgResult<Boolean> edit(@RequestBody @Validated(UpdateGroup.class) ShopAdDTO shopAdEditDTO) {
|
||||
ShopAd shopAd = BeanUtil.copyProperties(shopAdEditDTO, ShopAd.class);
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.czg.account.service;
|
||||
|
||||
import com.czg.account.dto.BkOrderDTO;
|
||||
import com.czg.account.entity.BkOrderTable;
|
||||
import com.czg.account.vo.BkTableVO;
|
||||
import com.czg.account.vo.BookingOrderStatisticsVO;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.czg.account.entity.BkOrder;
|
||||
|
||||
@@ -16,6 +18,11 @@ import java.util.List;
|
||||
*/
|
||||
public interface BkOrderService extends IService<BkOrder> {
|
||||
|
||||
/**
|
||||
* 查询预约单统计信息
|
||||
*/
|
||||
BookingOrderStatisticsVO bookingOrderStatistics(Long shopId, String search, LocalDate start, LocalDate end, String status);
|
||||
|
||||
/**
|
||||
* 查询预约单列表
|
||||
* @param shopId 店铺id
|
||||
@@ -27,6 +34,14 @@ public interface BkOrderService extends IService<BkOrder> {
|
||||
*/
|
||||
List<BkOrder> bookings(Long shopId, String search, LocalDate start, LocalDate end, String status);
|
||||
|
||||
/**
|
||||
* 查询预约单的台桌列表
|
||||
* @param shopId 店铺id
|
||||
* @param bkOrderId 预约单id
|
||||
* @return 预约单的台桌列表
|
||||
*/
|
||||
List<BkOrderTable> bookingTables(Long shopId, Long bkOrderId);
|
||||
|
||||
/**
|
||||
* 预约
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.czg.account.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author ww
|
||||
* @description
|
||||
*/
|
||||
@Data
|
||||
public class BookingOrderStatisticsVO {
|
||||
/**
|
||||
* 今日预约
|
||||
*/
|
||||
private Long todayBookingCount;
|
||||
/**
|
||||
* 本月预约
|
||||
*/
|
||||
private Long thisMonthBookingCount;
|
||||
/**
|
||||
* 待到店数
|
||||
*/
|
||||
private Long arrivedCount;
|
||||
/**
|
||||
* 预约到店率
|
||||
*/
|
||||
private BigDecimal arrivalRate;
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.czg.service.account.mapper;
|
||||
|
||||
import com.czg.account.vo.BookingOrderStatisticsVO;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.czg.account.entity.BkOrder;
|
||||
|
||||
@@ -14,6 +15,11 @@ import java.util.List;
|
||||
*/
|
||||
public interface BkOrderMapper extends BaseMapper<BkOrder> {
|
||||
|
||||
/**
|
||||
* 查询预约单统计信息
|
||||
*/
|
||||
BookingOrderStatisticsVO bookingOrderStatistics(Long shopId, String search, LocalDate start, LocalDate end, String status);
|
||||
|
||||
/**
|
||||
* 查询预约单列表
|
||||
*/
|
||||
|
||||
@@ -3,18 +3,19 @@ package com.czg.service.account.service.impl;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.czg.account.dto.BkOrderDTO;
|
||||
import com.czg.account.entity.BkOrder;
|
||||
import com.czg.account.entity.BkOrderTable;
|
||||
import com.czg.account.service.BkOrderService;
|
||||
import com.czg.account.vo.BkTableVO;
|
||||
import com.czg.account.vo.BookingOrderStatisticsVO;
|
||||
import com.czg.exception.CzgException;
|
||||
import com.czg.service.account.mapper.BkOrderMapper;
|
||||
import com.czg.service.account.mapper.BkOrderTableMapper;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.core.update.UpdateWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.czg.account.entity.BkOrder;
|
||||
import com.czg.account.service.BkOrderService;
|
||||
import com.czg.service.account.mapper.BkOrderMapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
@@ -34,6 +35,11 @@ public class BkOrderServiceImpl extends ServiceImpl<BkOrderMapper, BkOrder> impl
|
||||
@Resource
|
||||
private BkOrderTableMapper tableMapper;
|
||||
|
||||
@Override
|
||||
public BookingOrderStatisticsVO bookingOrderStatistics(Long shopId, String search, LocalDate start, LocalDate end, String status) {
|
||||
return mapper.bookingOrderStatistics(shopId, search, start, end, status);
|
||||
}
|
||||
|
||||
/**
|
||||
* 预约端-预约单:列表
|
||||
*/
|
||||
@@ -42,8 +48,14 @@ public class BkOrderServiceImpl extends ServiceImpl<BkOrderMapper, BkOrder> impl
|
||||
return mapper.bookings(shopId, search, start, end, status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BkOrderTable> bookingTables(Long shopId, Long bkOrderId) {
|
||||
return tableMapper.selectListByQuery(QueryWrapper.create().eq(BkOrderTable::getBookOrderId, bkOrderId).eq(BkOrderTable::getShopId, shopId));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void booking(Long shopId, BkOrderDTO bkOrder) {
|
||||
BkOrder bkOrderEntity = BeanUtil.copyProperties(bkOrder, BkOrder.class);
|
||||
bkOrderEntity.setShopId(shopId);
|
||||
|
||||
@@ -32,4 +32,39 @@
|
||||
group by o.id
|
||||
order by o.booking_time desc
|
||||
</select>
|
||||
|
||||
<select id="bookingOrderStatistics" resultType="com.czg.account.vo.BookingOrderStatisticsVO">
|
||||
SELECT
|
||||
COUNT(CASE WHEN DATE(create_time) = CURDATE() THEN 1 END) as todayBookingCount,
|
||||
COUNT(CASE WHEN YEAR(create_time) = YEAR(CURDATE()) AND MONTH(create_time) = MONTH(CURDATE()) THEN 1 END) as thisMonthBookingCount,
|
||||
COUNT(CASE WHEN status = '待到店' THEN 1 END) as arrivedCount,
|
||||
COALESCE(
|
||||
ROUND(
|
||||
COUNT(CASE WHEN status = '已到店' THEN 1 END) * 100.0 /
|
||||
NULLIF(COUNT(CASE WHEN status != '已取消' THEN 1 END), 0),
|
||||
2
|
||||
), 0
|
||||
) as arrivalRate
|
||||
FROM bk_order
|
||||
WHERE shop_id = #{shopId}
|
||||
<if test="search != null and search != ''">
|
||||
AND (o.call_username LIKE CONCAT('%', #{search}, '%')
|
||||
OR o.call_phone LIKE CONCAT('%', #{search}, '%')
|
||||
OR o.booking_username LIKE CONCAT('%', #{search}, '%')
|
||||
OR o.booking_phone LIKE CONCAT('%', #{search}, '%'))
|
||||
</if>
|
||||
<if test="start != null and end != null">
|
||||
AND o.booking_time >= CONCAT(#{start}, ' 00:00:00')
|
||||
AND o.booking_time <= CONCAT(#{end}, ' 23:59:59')
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
<if test="status == '已超时'">
|
||||
AND o.status = '待到店'
|
||||
AND o.booking_time < DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:%s')
|
||||
</if>
|
||||
<if test="status != '已超时'">
|
||||
AND o.status = #{status}
|
||||
</if>
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -26,7 +26,7 @@ public interface KitchenDetailMapper {
|
||||
List<KitchenTableFoodVO> getKitchenTableFoods(Long shopId, Long orderId, String tableCode, Long isNoTable);
|
||||
|
||||
/**
|
||||
* 按台桌查看商品列表
|
||||
* 按商品查看
|
||||
*/
|
||||
List<KitchenFoodVO> getKitchenFood(Long shopId, String productName, Long categoryId);
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
`staff`.`name` AS staffName,
|
||||
sum(detail.num - detail.return_num) AS num,
|
||||
detail.sub_status AS subStatus,
|
||||
detail.order_time AS orderTime,
|
||||
detail.create_time AS orderTime,
|
||||
detail.start_order_time AS startOrderTime,
|
||||
detail.dish_out_time AS dishOutTime,
|
||||
detail.food_serve_time AS foodServeTime
|
||||
@@ -90,7 +90,7 @@
|
||||
detail.sku_name AS skuName,
|
||||
sum(detail.num - detail.return_num) AS num,
|
||||
detail.sub_status AS subStatus,
|
||||
detail.order_time AS orderTime,
|
||||
detail.create_time AS orderTime,
|
||||
detail.start_order_time AS startOrderTime,
|
||||
detail.dish_out_time AS dishOutTime,
|
||||
detail.food_serve_time AS foodServeTime
|
||||
|
||||
Reference in New Issue
Block a user