fix(printer): 修复支付价格比较逻辑和数据返回问题

- 将支付价格比较方式从 equals 修改为 compareTo 方法以确保精度正确性
- 调整 orderId 返回逻辑的位置,确保在所有情况下都能正确返回
This commit is contained in:
2025-11-15 15:53:47 +08:00
parent 515f68a6f4
commit 11face7935

View File

@@ -692,7 +692,7 @@ public class PrinterServiceImpl implements PrinterService {
throw new BaseException("订单添加失败");
}
Map<String, Object> data = new HashMap<>();
if (order.getPayPrice().equals(BigDecimal.ZERO)) {
if (order.getPayPrice().compareTo(BigDecimal.ZERO) == 0) {
orderBiz.paidOrder(order.getId());
data.put("needPay", false);
} else {
@@ -708,8 +708,8 @@ public class PrinterServiceImpl implements PrinterService {
} catch (Exception e) {
throw new BaseException(e);
}
data.put("orderId", orderId);
}
data.put("orderId", orderId);
return data;
}