后厨 页面 按台桌查看 按商品查看

This commit is contained in:
2025-11-26 18:15:32 +08:00
parent 7167163076
commit 8a9d096781
6 changed files with 337 additions and 0 deletions

View File

@@ -0,0 +1,73 @@
package com.czg.controller.kitchen;
import com.czg.annotation.SaAdminCheckPermission;
import com.czg.order.vo.KitchenFoodVO;
import com.czg.order.vo.KitchenTableFoodVO;
import com.czg.order.vo.KitchenTableVO;
import com.czg.resp.CzgResult;
import com.czg.sa.StpKit;
import com.czg.service.order.mapper.KitchenDetailMapper;
import jakarta.annotation.Resource;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 后厨:台桌/菜单
*
* @author tankaikai
* @since 2025-03-07 15:25
*/
@RestController
//@RequestMapping("/admin/kitchen")
@RequestMapping("/notify/kitchen")
public class TableController {
@Resource
private KitchenDetailMapper kitchenDetailMapper;
/**
* 按台桌查看
*/
@GetMapping("getKitchenTable")
@SaAdminCheckPermission(value = "kitchen:table", name = "后厨-按台桌查看")
public CzgResult<List<KitchenTableVO>> getKitchenTable(@RequestParam String tableName, @RequestParam Long areaId) {
Long shopId = StpKit.USER.getShopId();
List<KitchenTableVO> kitchenTables = kitchenDetailMapper.getKitchenTable(shopId, tableName, areaId);
return CzgResult.success(kitchenTables);
}
/**
* 按台桌查看 商品内容
*/
@GetMapping("getKitchenTableFoods")
@SaAdminCheckPermission(value = "kitchen:tableFood", name = "后厨-按台桌查看商品内容")
public CzgResult<List<KitchenTableFoodVO>> getKitchenTableFoods(@RequestParam(required = false) Long orderId,
@RequestParam(required = false) String tableCode,
@RequestParam(required = false) Long isNoTable) {
Long shopId = StpKit.USER.getShopId();
if (isNoTable != null) {
tableCode = null;
}
List<KitchenTableFoodVO> kitchenFood = kitchenDetailMapper.getKitchenTableFoods(shopId, orderId, tableCode, isNoTable);
return CzgResult.success(kitchenFood);
}
/**
* 按商品查看
*/
@GetMapping("getKitchenFood")
@SaAdminCheckPermission(value = "kitchen:table", name = "后厨-按台桌查看")
public CzgResult<List<KitchenFoodVO>> getKitchenFood(@RequestParam String productName) {
Long shopId = StpKit.USER.getShopId();
List<KitchenFoodVO> kitchenFood = kitchenDetailMapper.getKitchenFood(shopId, productName);
return CzgResult.success(kitchenFood);
}
}

View File

@@ -0,0 +1,34 @@
package com.czg.order.vo;
import lombok.Data;
import java.util.List;
/**
* 后厨台桌列表
*
* @author ww
* @description
*/
@Data
public class KitchenFoodVO {
private Long productId;
//是否临时商品 0-否 1-是
private int isTemporary;
private String productName;
private String skuName;
private List<KitchenFoodItemVO> foodItems;
record KitchenFoodItemVO(
//员工名称
Long orderId, String staffName,
String tableName,String areaName,Long orderDetailId,
//下单数 //菜品状态 待起菜 PENDING_PREP 待出菜 READY_TO_SERVE 已出菜 SENT_OUT 已上菜 DELIVERED
Long num, String subStatus,
//下单时间 起菜时间 出菜时间 上菜时间
String orderTime, String startOrderTime, String dishOutTime, String foodServeTime
) {
}
}

View File

@@ -0,0 +1,35 @@
package com.czg.order.vo;
import lombok.Data;
import java.util.List;
/**
* 后厨台桌列表
*
* @author ww
* @description
*/
@Data
public class KitchenTableFoodVO {
private Long productId;
private String productName;
private String skuName;
//是否临时商品 0-否 1-是
private int isTemporary;
private String staffName;
private Long orderDetailId;
private Long num;
//菜品状态 待起菜 PENDING_PREP 待出菜 READY_TO_SERVE 已出菜 SENT_OUT 已上菜 DELIVERED
private String subStatus;
//下单时间
private String orderTime;
//起菜时间
private String startOrderTime;
//出菜时间
private String dishOutTime;
//上菜时间
private String foodServeTime;
}

View File

@@ -0,0 +1,45 @@
package com.czg.order.vo;
import lombok.Data;
/**
* 后厨台桌列表
*
* @author ww
* @description
*/
@Data
public class KitchenTableVO {
/**
* 订单ID
*/
private Long orderId;
/**
* 台桌ID
*/
private Long tableId;
/**
* 台桌编码
*/
private String tableCode;
/**
* 台桌名称
*/
private String tableName;
/**
* 区域ID
*/
private Long areaId;
/**
* 区域名称
*/
private String areaName;
/**
* 待上菜数
*/
private Integer pendingDishCount;
}

View File

@@ -0,0 +1,32 @@
package com.czg.service.order.mapper;
import com.czg.order.vo.KitchenFoodVO;
import com.czg.order.vo.KitchenTableFoodVO;
import com.czg.order.vo.KitchenTableVO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 后厨 台桌列表/商品列表
*
* @author ww
* @description
*/
@Mapper
public interface KitchenDetailMapper {
/**
* 按台桌查看
*/
List<KitchenTableVO> getKitchenTable(Long shopId, String tableName, Long areaId);
/**
* 按台桌查看商品内容
*/
List<KitchenTableFoodVO> getKitchenTableFoods(Long shopId, Long orderId, String tableCode, Long isNoTable);
/**
* 按台桌查看商品列表
*/
List<KitchenFoodVO> getKitchenFood(Long shopId, String productName);
}

View File

@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.czg.service.order.mapper.KitchenDetailMapper">
<select id="getKitchenFood" resultMap="KitchenFoodVOResultMap">
SELECT detail.product_id AS productId,
detail.is_temporary AS isTemporary,
detail.product_name AS productName,
detail.sku_name AS skuName,
`order`.id AS orderId,
detail.id AS orderDetailId,
COALESCE(`table`.`name`, '无台桌') AS tableName,
CASE WHEN `table`.id IS NULL THEN '吧台' ELSE COALESCE(`area`.`name`, '') END AS areaName,
`staff`.`name` AS staffName,
sum(detail.num - detail.return_num) AS num,
detail.sub_status AS subStatus,
detail.order_time AS orderTime,
detail.start_order_time AS startOrderTime,
detail.dish_out_time AS dishOutTime,
detail.food_serve_time AS foodServeTime
FROM `tb_order_detail` detail
INNER JOIN `tb_order_info` `order` ON detail.order_id = `order`.id AND `order`.`status` = 'unpaid'
LEFT JOIN `tb_shop_staff` `staff` ON staff.id = `order`.staff_id
LEFT JOIN `tb_shop_table` `table` ON `order`.table_code = `table`.table_code
LEFT JOIN `tb_shop_table_area` `area` ON `table`.area_id = `area`.id
WHERE detail.shop_id = #{shopId}
AND detail.`status` = 'wait-pay'
<if test="productName != null and productName != ''">
AND detail.product_name like concat('%',#{productName},'%')
</if>
GROUP BY `order`.id, detail.product_id, detail.sku_id, detail.place_num
</select>
<select id="getKitchenTable" resultType="com.czg.order.vo.KitchenTableVO">
SELECT
`order`.id AS orderId,
`table`.id AS tableId,
CASE WHEN `table`.id IS NULL THEN '' ELSE COALESCE (`order`.table_code, '') END AS tableCode,
COALESCE(`table`.`name`, '无台桌') AS tableName,
`table`.`area_id` AS areaId,
CASE WHEN `table`.id IS NULL THEN '吧台' ELSE COALESCE(`area`.`name`, '') END AS areaName,
count( detail.id ) AS pendingDishCount
FROM
`tb_order_detail` detail
INNER JOIN `tb_order_info` `order` ON detail.order_id = `order`.id AND `order`.`status` = 'unpaid'
LEFT JOIN `tb_shop_table` `table` ON `order`.table_code = `table`.table_code
LEFT JOIN `tb_shop_table_area` `area` ON `table`.area_id = `area`.id
WHERE
detail.shop_id = #{shopId}
AND detail.`status` = 'wait-pay'
<if test="tableName != null and tableName != ''">
AND `table`.`name` like concat('%',#{tableName},'%')
</if>
<if test="areaId != null">
AND `table`.`area_id` = #{areaId}
</if>
GROUP BY detail.order_id,tableName
</select>
<select id="getKitchenTableFoods" resultType="com.czg.order.vo.KitchenTableFoodVO">
SELECT
detail.product_id AS productId,
detail.product_name AS productName,
detail.is_temporary AS isTemporary,
`staff`.`name` AS staffName,
detail.id AS orderDetailId,
detail.sku_name AS skuName,
sum(detail.num - detail.return_num) AS num,
detail.sub_status AS subStatus,
detail.order_time AS orderTime,
detail.start_order_time AS startOrderTime,
detail.dish_out_time AS dishOutTime,
detail.food_serve_time AS foodServeTime
FROM `tb_order_detail` detail
INNER JOIN `tb_order_info` `order` ON detail.order_id = `order`.id AND `order`.`status` = 'unpaid'
LEFT JOIN `tb_shop_table` `table` ON `order`.table_code = `table`.table_code
LEFT JOIN `tb_shop_staff` `staff` ON staff.id = `order`.staff_id
WHERE detail.shop_id = #{shopId}
AND detail.`status` = 'wait-pay'
<if test="orderId != null">
AND detail.order_id = #{orderId}
</if>
<if test="tableCode != null and tableCode != ''">
AND `table`.`table_code` = #{tableCode}
</if>
<if test="isNoTable != null">
AND `table`.`table_code` is null
</if>
GROUP BY `order`.id, detail.product_id, detail.sku_id, detail.place_num
</select>
<resultMap id="KitchenFoodVOResultMap" type="com.czg.order.vo.KitchenFoodVO">
<result property="productId" column="productId"/>
<result property="isTemporary" column="isTemporary"/>
<result property="productName" column="productName"/>
<collection property="foodItems" ofType="com.czg.order.vo.KitchenFoodVO$KitchenFoodItemVO">
<constructor>
<arg column="orderId" javaType="java.lang.Long"/>
<arg column="staffName" javaType="java.lang.String"/>
<arg column="tableName" javaType="java.lang.String"/>
<arg column="areaName" javaType="java.lang.String"/>
<arg column="orderDetailId" javaType="java.lang.Long"/>
<arg column="num" javaType="java.lang.Long"/>
<arg column="subStatus" javaType="java.lang.String"/>
<arg column="orderTime" javaType="java.lang.String"/>
<arg column="startOrderTime" javaType="java.lang.String"/>
<arg column="dishOutTime" javaType="java.lang.String"/>
<arg column="foodServeTime" javaType="java.lang.String"/>
</constructor>
</collection>
</resultMap>
</mapper>