You've already forked FrameTour-BE
feat(printer): 支持按数量创建多个打印任务- 根据照片数量生成对应数量的打印任务- 默认至少创建1个打印任务
All checks were successful
ZhenTu-BE/pipeline/head This commit looks good
All checks were successful
ZhenTu-BE/pipeline/head This commit looks good
- 保留原有单任务逻辑并适配多任务场景 - 确保每个任务独立插入数据库 - 维持打印机轮询选择机制
This commit is contained in:
@@ -620,9 +620,15 @@ public class PrinterServiceImpl implements PrinterService {
|
||||
log.error("获取景区配置失败,使用原始照片进行打印。景区ID: {}, 照片ID: {}", item.getScenicId(), item.getId(), e);
|
||||
}
|
||||
|
||||
// 根据数量创建多个打印任务
|
||||
Integer quantity = item.getQuantity();
|
||||
if (quantity == null || quantity <= 0) {
|
||||
quantity = 1; // 默认至少打印1张
|
||||
}
|
||||
|
||||
for (int i = 0; i < quantity; i++) {
|
||||
// 获取打印机名称(支持轮询)
|
||||
String selectedPrinter = getNextPrinter(printer);
|
||||
|
||||
PrintTaskEntity task = new PrintTaskEntity();
|
||||
task.setPrinterId(printer.getId());
|
||||
task.setPrinterName(selectedPrinter);
|
||||
@@ -635,6 +641,7 @@ public class PrinterServiceImpl implements PrinterService {
|
||||
task.setCreateTime(new Date());
|
||||
task.setUpdateTime(new Date());
|
||||
printTaskMapper.insertTask(task);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user