From c3fb4258d2cf4d4cf7978525a2c0b254b238540a Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Thu, 16 Apr 2026 17:11:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=93=8D=E4=BD=9C=E5=91=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/czg/service/order/print/PrinterImpl.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cash-service/order-service/src/main/java/com/czg/service/order/print/PrinterImpl.java b/cash-service/order-service/src/main/java/com/czg/service/order/print/PrinterImpl.java index 0b4843e34..34721c0b2 100644 --- a/cash-service/order-service/src/main/java/com/czg/service/order/print/PrinterImpl.java +++ b/cash-service/order-service/src/main/java/com/czg/service/order/print/PrinterImpl.java @@ -113,6 +113,7 @@ public interface PrinterImpl { String line = StrUtil.repeat("-", 32); return getFormatLabel(line, getSignLabelInfo().s); } + default String getDividingLine(Integer num) { int length = num == null ? 32 : num; String line = StrUtil.repeat("-", length); @@ -574,7 +575,7 @@ public interface PrinterImpl { builder.append(getDividingLine()).append(signLabelInfo.br); // 操作员、打印时间 - builder.append(getFormatLabel(StrUtil.format("操作员: {}", record.getOperator()), signLabelInfo.s)).append(signLabelInfo.br); + builder.append(getFormatLabel(StrUtil.format("操作员: {}", StrUtil.isNotBlank(record.getOperator()) ? record.getOperator() : ""), signLabelInfo.s)).append(signLabelInfo.br); builder.append(getFormatLabel(StrUtil.format("打印时间: {}", DateUtil.format(record.getPrintTime(), "yyyy/MM/dd HH:mm:ss")), signLabelInfo.s)).append(signLabelInfo.br); // 结尾空行 + 切纸(和充值单保持一致) @@ -595,7 +596,7 @@ public interface PrinterImpl { // 基础信息:打印时间、操作人、统计时间 builder.append(getFormatLabel(StrUtil.format("打印时间: {}", DateUtil.format(LocalDateTime.now(), "yyyy/MM/dd HH:mm:ss")), signLabelInfo.s)).append(signLabelInfo.br); - builder.append(getFormatLabel(StrUtil.format("操作人: {}", record.getOperator()), signLabelInfo.s)).append(signLabelInfo.br); + builder.append(getFormatLabel(StrUtil.format("操作人: {}", StrUtil.isNotBlank(record.getOperator()) ? record.getOperator() : ""), signLabelInfo.s)).append(signLabelInfo.br); builder.append(getFormatLabel(StrUtil.format("时间: {}", record.getStatisticsTime()), signLabelInfo.s)).append(signLabelInfo.br).append(signLabelInfo.br); // 营业总额 @@ -663,7 +664,7 @@ public interface PrinterImpl { // 基础信息:打印时间、操作人、统计时间 builder.append(getFormatLabel(StrUtil.format("打印时间: {}", DateUtil.format(LocalDateTime.now(), "yyyy/MM/dd HH:mm:ss")), signLabelInfo.s)).append(signLabelInfo.br); - builder.append(getFormatLabel(StrUtil.format("操作人: {}", record.getOperator()), signLabelInfo.s)).append(signLabelInfo.br); + builder.append(getFormatLabel(StrUtil.format("操作人: {}", StrUtil.isNotBlank(record.getOperator()) ? record.getOperator() : ""), signLabelInfo.s)).append(signLabelInfo.br); builder.append(getFormatLabel(StrUtil.format("时间: {}", record.getStatisticsTime()), signLabelInfo.s)).append(signLabelInfo.br).append(signLabelInfo.br); // 总计行:总计商品X件,实收金额X元 @@ -738,7 +739,7 @@ public interface PrinterImpl { builder.append(getFormatLabel(leftRightAlign("已付金额:", record.getRechargeAmount().stripTrailingZeros().toPlainString(), 32), signLabelInfo.s)).append(signLabelInfo.br); builder.append(getFormatLabel(leftRightAlign("支付方式:", record.getPayType(), 32), signLabelInfo.s)).append(signLabelInfo.br); builder.append(getDividingLine()).append(signLabelInfo.br); - builder.append(getFormatLabel(StrUtil.format("操作员: {}", record.getOperator()), signLabelInfo.s)).append(signLabelInfo.br); + builder.append(getFormatLabel(StrUtil.format("操作员: {}", StrUtil.isNotBlank(record.getOperator()) ? record.getOperator() : ""), signLabelInfo.s)).append(signLabelInfo.br); builder.append(getFormatLabel(StrUtil.format("充值编号: {}", record.getRechargeId()), signLabelInfo.s)).append(signLabelInfo.br); // 结尾空行 + 切纸 @@ -784,7 +785,7 @@ public interface PrinterImpl { builder.append(getDividingLine()).append(signLabelInfo.br).append(signLabelInfo.br); // 操作员、打印时间 - builder.append(getFormatLabel(StrUtil.format("操作员: {}", record.getOperator()), signLabelInfo.s)).append(signLabelInfo.br); + builder.append(getFormatLabel(StrUtil.format("操作员: {}", StrUtil.isNotBlank(record.getOperator()) ? record.getOperator() : ""), signLabelInfo.s)).append(signLabelInfo.br); // 打印时间:复用之前的DateUtil格式化,若DTO需补充printTime字段,可按需求添加 builder.append(getFormatLabel(StrUtil.format("打印时间: {}", DateUtil.format(LocalDateTime.now(), "yyyy/MM/dd HH:mm:ss")), signLabelInfo.s)).append(signLabelInfo.br);