打印 调整
This commit is contained in:
@@ -102,8 +102,8 @@ public class HandoverRecordController {
|
||||
@OperationLog("收银机-交班/关班")
|
||||
@SaAdminCheckPermission(parentName = "交班记录", value = "handoverRecord:handover", name = "收银机-交班/关班")
|
||||
public CzgResult<Long> handover(@RequestParam Integer isPrint) {
|
||||
Long id = handoverRecordService.handover();
|
||||
handoverRecordService.printHandoverReceipt(id, isPrint);
|
||||
return CzgResult.success(id);
|
||||
HandoverRecord handoverRecord = handoverRecordService.handover();
|
||||
handoverRecordService.printHandoverReceipt(handoverRecord, isPrint);
|
||||
return CzgResult.success(handoverRecord.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
package com.czg.controller.admin;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
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;
|
||||
@@ -48,15 +44,10 @@ public class PrintMachineController {
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(subType)) {
|
||||
queryWrapper.eq(PrintMachine::getSubType, subType);
|
||||
queryWrapper.eq(PrintMachine::getPrintType, subType);
|
||||
}
|
||||
queryWrapper.orderBy(PrintMachine::getSort, true).orderBy(PrintMachine::getId, false);
|
||||
Page<PrintMachine> page = printMachineService.page(PageUtil.buildPage(), queryWrapper);
|
||||
page.getRecords().forEach(item -> {
|
||||
if (StrUtil.isNotBlank(item.getCategoryIds())) {
|
||||
item.setCategoryList(JSONArray.parse(item.getCategoryIds()));
|
||||
}
|
||||
});
|
||||
return CzgResult.success(page);
|
||||
}
|
||||
|
||||
@@ -73,15 +64,10 @@ public class PrintMachineController {
|
||||
}
|
||||
queryWrapper.in(PrintMachine::getConnectionType, "USB", "局域网");
|
||||
if (StrUtil.isNotBlank(subType)) {
|
||||
queryWrapper.eq(PrintMachine::getSubType, subType);
|
||||
queryWrapper.eq(PrintMachine::getPrintType, subType);
|
||||
}
|
||||
queryWrapper.orderBy(PrintMachine::getSort, true).orderBy(PrintMachine::getId, false);
|
||||
Page<PrintMachine> page = printMachineService.page(PageUtil.buildPage(), queryWrapper);
|
||||
page.getRecords().forEach(item -> {
|
||||
if (StrUtil.isNotBlank(item.getCategoryIds())) {
|
||||
item.setCategoryList(JSONArray.parse(item.getCategoryIds()));
|
||||
}
|
||||
});
|
||||
return CzgResult.success(page);
|
||||
}
|
||||
|
||||
@@ -94,9 +80,6 @@ public class PrintMachineController {
|
||||
@GetMapping("/detail")
|
||||
public CzgResult<PrintMachine> detail(@RequestParam Integer id) {
|
||||
PrintMachine printMachine = printMachineService.getOne(new QueryWrapper().eq(PrintMachine::getId, id).eq(PrintMachine::getShopId, StpKit.USER.getShopId()));
|
||||
if (printMachine != null && StrUtil.isNotBlank(printMachine.getCategoryIds())) {
|
||||
printMachine.setCategoryList(JSONArray.parse(printMachine.getCategoryIds()));
|
||||
}
|
||||
return CzgResult.success(printMachine);
|
||||
}
|
||||
|
||||
@@ -107,7 +90,7 @@ public class PrintMachineController {
|
||||
*/
|
||||
@SaAdminCheckPermission(parentName = "打印机管理", value = "printer:add", name = "打印机新增")
|
||||
@PostMapping
|
||||
public CzgResult<Boolean> add(@RequestBody @Validated PrinterAddDTO printerAddDTO) {
|
||||
public CzgResult<Boolean> add(@RequestBody @Validated PrintMachine printerAddDTO) {
|
||||
return CzgResult.success(printMachineService.add(StpKit.USER.getShopId(), printerAddDTO));
|
||||
}
|
||||
|
||||
@@ -117,7 +100,7 @@ public class PrintMachineController {
|
||||
*/
|
||||
@SaAdminCheckPermission(parentName = "打印机管理", value = "printer:edit", name = "打印机编辑")
|
||||
@PutMapping
|
||||
public CzgResult<Boolean> edit(@RequestBody @Validated PrinterEditDTO printerEditDTO) {
|
||||
public CzgResult<Boolean> edit(@RequestBody @Validated PrintMachine printerEditDTO) {
|
||||
return CzgResult.success(printMachineService.edit(StpKit.USER.getShopId(), printerEditDTO));
|
||||
}
|
||||
|
||||
|
||||
@@ -57,29 +57,24 @@ public class PrintMqListener {
|
||||
if (orderId == null) {
|
||||
throw new RuntimeException("订单打印失败,未传递orderId");
|
||||
}
|
||||
//该字段表示 网络打印机是否打印订单 本地传参来的
|
||||
Boolean printOrder = jsonObject.getBoolean("printOrder");
|
||||
redisService.runFunAndCheckKey(() -> {
|
||||
printerHandler.orderHandler(orderId, printOrder != null && !printOrder ? PrinterHandler.PrintTypeEnum.ONE : PrinterHandler.PrintTypeEnum.ONE_AND_ORDER, null);
|
||||
if (printOrder) {
|
||||
printerHandler.orderHandler(orderId, PrinterHandler.PrintTypeEnum.ORDER, null);
|
||||
}
|
||||
//菜品打印 全是后端
|
||||
printerHandler.orderHandler(orderId, PrinterHandler.PrintTypeEnum.ONLY_KITCHEN, null);
|
||||
printerHandler.orderHandler(orderId, PrinterHandler.PrintTypeEnum.ALL_KITCHEN, null);
|
||||
return null;
|
||||
}, RedisCst.getLockKey("orderPrint", orderId));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 交班打印
|
||||
*/
|
||||
@RabbitListener(queues = {"${spring.profiles.active}-" + RabbitConstants.Queue.ORDER_HANDOVER_PRINT_QUEUE})
|
||||
public void handoverPrint(String id) {
|
||||
invokeFun(RabbitConstants.Queue.ORDER_HANDOVER_PRINT_QUEUE, "handoverPrint", "java.order", id, (data) ->
|
||||
printerHandler.handoverHandler(data));
|
||||
}
|
||||
|
||||
/**
|
||||
* 叫号打印
|
||||
*/
|
||||
@RabbitListener(queues = {"${spring.profiles.active}-" + RabbitConstants.Queue.CALL_TABLE_QUEUE})
|
||||
public void callTablePrint(String id) {
|
||||
invokeFun(RabbitConstants.Queue.CALL_TABLE_QUEUE, "callTable", "java.order", id, (data) ->
|
||||
printerHandler.callHandler(data));
|
||||
@RabbitListener(queues = {"${spring.profiles.active}-" + RabbitConstants.Queue.OTHER_PRINT_QUEUE})
|
||||
public void otherPrint(Long shopId, Object o, String printTypeEnum) {
|
||||
PrinterHandler.PrintTypeEnum typeEnum = PrinterHandler.PrintTypeEnum.valueOf(printTypeEnum);
|
||||
printerHandler.otherHandler(shopId, o, typeEnum);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user