台桌列表返回订单id

打印订单接口
This commit is contained in:
张松
2025-03-06 16:23:38 +08:00
parent ce303ca0b5
commit f3866b0f15
11 changed files with 198 additions and 25 deletions

View File

@@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil;
import com.czg.account.dto.print.PrinterAddDTO;
import com.czg.account.dto.print.PrinterDelDTO;
import com.czg.account.dto.print.PrinterEditDTO;
import com.czg.account.dto.print.PrinterOrderDTO;
import com.czg.account.entity.PrintMachine;
import com.czg.account.service.PrintMachineService;
import com.czg.annotation.SaAdminCheckPermission;
@@ -90,4 +91,14 @@ public class PrintMachineController {
return CzgResult.success(printMachineService.remove(new QueryWrapper().eq(PrintMachine::getShopId, StpKit.USER.getShopId()).eq(PrintMachine::getId, printerDelDTO.getId())));
}
/**
* 打印订单
* @return 是否成功
*/
@SaAdminCheckPermission(value = "printer:order", name = "打印机打印订单")
@PostMapping("/order")
public CzgResult<Boolean> printOrder(@RequestBody @Validated PrinterOrderDTO printerOrderDTO) {
return CzgResult.success(printMachineService.printOrder(StpKit.USER.getShopId(), printerOrderDTO));
}
}

View File

@@ -1,19 +1,18 @@
package com.czg.controller.admin;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import com.czg.account.dto.table.ShopTableAddDTO;
import com.czg.account.dto.table.ShopTableBindDTO;
import com.czg.account.dto.table.ShopTableClearDTO;
import com.czg.account.dto.table.ShopTableDTO;
import com.czg.account.entity.ShopTable;
import com.czg.account.service.ShopTableService;
import com.czg.account.vo.ShopTableVO;
import com.czg.annotation.SaAdminCheckPermission;
import com.czg.exception.ApiNotPrintException;
import com.czg.resp.CzgResult;
import com.czg.sa.StpKit;
import com.czg.utils.PageUtil;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryMethods;
import com.mybatisflex.core.query.QueryWrapper;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
@@ -56,24 +55,8 @@ public class ShopTableController {
*/
@SaAdminCheckPermission("shopTable:list")
@GetMapping
public CzgResult<Page<ShopTable>> list(Integer areaId, String tableCode, String status, String name) {
QueryWrapper queryWrapper = new QueryWrapper().eq(ShopTable::getShopId, StpKit.USER.getShopId());
if (areaId != null) {
queryWrapper.eq(ShopTable::getAreaId, areaId);
}
if (StrUtil.isNotBlank(tableCode)) {
queryWrapper.like(ShopTable::getTableCode, tableCode);
}
if (StrUtil.isNotBlank(status)) {
queryWrapper.eq(ShopTable::getStatus, status);
}
if (StrUtil.isNotBlank(name)) {
queryWrapper.like(ShopTable::getName, name);
}
return CzgResult.success(shopTableService.page(PageUtil.buildPage(), queryWrapper));
public CzgResult<Page<ShopTableVO>> list(Integer areaId, String tableCode, String status, String name) {
return CzgResult.success(shopTableService.pageInfo(StpKit.USER.getShopId(), areaId, tableCode, status, name));
}
/**
@@ -104,8 +87,18 @@ public class ShopTableController {
@SaAdminCheckPermission("shopTable:edit")
@PutMapping
public CzgResult<Boolean> edit(@RequestBody @Validated ShopTableDTO shopTableDTO) {
ShopTable shopTable = BeanUtil.copyProperties(shopTableDTO, ShopTable.class);
return CzgResult.success(shopTableService.update(shopTable, new QueryWrapper().eq(ShopTable::getShopId, StpKit.USER.getShopId()).eq(ShopTable::getId, shopTableDTO.getId())));
return CzgResult.success(shopTableService.updateInfo(StpKit.USER.getLoginIdAsLong(), shopTableDTO));
}
/**
* 台桌清台
* 权限标识: shopTable:clear
* @return 是否成功
*/
@SaAdminCheckPermission("shopTable:clear")
@PutMapping("/clear")
public CzgResult<Boolean> clear(@RequestBody @Validated ShopTableClearDTO shopTableClearDTO) {
return CzgResult.success(shopTableService.clear(StpKit.USER.getLoginIdAsLong(), shopTableClearDTO));
}
/**
@@ -143,4 +136,5 @@ public class ShopTableController {
public CzgResult<Boolean> bind(@RequestBody @Validated ShopTableBindDTO shopTableBindDTO) {
return CzgResult.success(shopTableService.bind(StpKit.USER.getShopId(), shopTableBindDTO));
}
}