fix(printer): 调整二维码边距和图片旋转逻辑

- 修改二维码距离左边缘的图片宽度比例从 0.075 为 0.05
- 修正图片旋转角度判断逻辑,确保横向处理正确
- 移除下载 URL 中的域名替换操作,使用原始地址直接下载
This commit is contained in:
2025-11-18 16:06:19 +08:00
parent 8e48bd92cc
commit 6e84a5fd43
2 changed files with 3 additions and 3 deletions

View File

@@ -47,7 +47,7 @@ public class PrinterDefaultWatermarkOperator implements IOperator {
public static int OFFSET_Y = 15;
public static Color BG_COLOR = Color.WHITE;
public static int QRCODE_SIZE = 150;
public static double QRCODE_LEFT_MARGIN_RATIO = 0.075; // 二维码距离左边缘的图片宽度比例
public static double QRCODE_LEFT_MARGIN_RATIO = 0.05; // 二维码距离左边缘的图片宽度比例
public static int QRCODE_OFFSET_Y = -35;
public static int SCENIC_FONT_SIZE = 42;

View File

@@ -789,14 +789,14 @@ public class PrinterServiceImpl implements PrinterService {
boolean needRotation = false;
try {
HttpUtil.downloadFile(item.getCropUrl().replace("oss.zhentuai.com", "frametour-assets.oss-cn-shanghai-internal.aliyuncs.com"), originalFile);
HttpUtil.downloadFile(item.getCropUrl(), originalFile);
// 判断图片方向并处理旋转
boolean isLandscape = false;
try {
Integer rotate = JacksonUtil.getInt(item.getCrop(), "rotation");
if (rotate != null) {
isLandscape = rotate % 180 != 0;
isLandscape = rotate % 180 == 0;
}
} catch (Exception ignored) {
}