|
|
@@ -1,13 +1,18 @@
|
|
|
package com.ruoyi.app.tableqrcode;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.ruoyi.common.annotation.Anonymous;
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
import com.ruoyi.system.domain.InfoUser;
|
|
|
+import com.ruoyi.system.domain.PosOrder;
|
|
|
import com.ruoyi.system.domain.PosStore;
|
|
|
import com.ruoyi.system.domain.TableQrcode;
|
|
|
import com.ruoyi.system.service.IInfoUserService;
|
|
|
+import com.ruoyi.system.service.IPosOrderService;
|
|
|
import com.ruoyi.system.service.IPosStoreService;
|
|
|
import com.ruoyi.system.service.ITableQrcodeService;
|
|
|
import com.ruoyi.system.utils.Auth;
|
|
|
@@ -35,6 +40,9 @@ public class TableQrcodeController extends BaseController
|
|
|
@Autowired
|
|
|
private IPosStoreService posStoreService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IPosOrderService posOrderService;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 创建餐桌码
|
|
|
@@ -361,6 +369,63 @@ public class TableQrcodeController extends BaseController
|
|
|
return success("操作成功");
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 查看餐桌关联订单
|
|
|
+ */
|
|
|
+ @Anonymous
|
|
|
+ @Auth
|
|
|
+ @GetMapping("/getTableOrders")
|
|
|
+ public AjaxResult getTableOrders(@RequestHeader String token,
|
|
|
+ @RequestParam Long id,
|
|
|
+ @RequestParam(defaultValue = "1") Integer page,
|
|
|
+ @RequestParam(defaultValue = "10") Integer size,
|
|
|
+ @RequestParam(required = false) String state)
|
|
|
+ {
|
|
|
+ if (!verifyOwnership(token, id))
|
|
|
+ {
|
|
|
+ return error("无权访问");
|
|
|
+ }
|
|
|
+ TableQrcode tableQrcode = tableQrcodeService.selectTableQrcodeById(id);
|
|
|
+ if (tableQrcode == null)
|
|
|
+ {
|
|
|
+ return error("餐桌码不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ IPage<PosOrder> pageParam = new Page<>(page, size);
|
|
|
+ QueryWrapper<PosOrder> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("table_id", id).orderByDesc("cretim");
|
|
|
+ if (state != null && !state.isEmpty())
|
|
|
+ {
|
|
|
+ if (state.equals("z01"))
|
|
|
+ {
|
|
|
+ queryWrapper.apply("((state = 0 AND (collect_payment = 1 OR type = 1)) OR (state = 1))");
|
|
|
+ }
|
|
|
+ else if (state.equals("z234"))
|
|
|
+ {
|
|
|
+ queryWrapper.in("state", 2, 3, 4);
|
|
|
+ }
|
|
|
+ else if (state.equals("z23"))
|
|
|
+ {
|
|
|
+ queryWrapper.in("state", 2, 3);
|
|
|
+ }
|
|
|
+ else if (state.equals("z34"))
|
|
|
+ {
|
|
|
+ queryWrapper.in("state", 3, 4);
|
|
|
+ }
|
|
|
+ else if (state.equals("z678911"))
|
|
|
+ {
|
|
|
+ queryWrapper.in("state", 6, 7, 8, 9, 11);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ queryWrapper.eq("state", state);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ IPage<PosOrder> result = posOrderService.page(pageParam, queryWrapper);
|
|
|
+ return success(result);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取二维码图片
|
|
|
*/
|