You've already forked FrameTour-BE
fix(printer): 调整二维码边距和图片旋转逻辑
- 修改二维码距离左边缘的图片宽度比例从 0.075 为 0.05 - 修正图片旋转角度判断逻辑,确保横向处理正确 - 移除下载 URL 中的域名替换操作,使用原始地址直接下载
This commit is contained in:
@@ -47,7 +47,7 @@ public class PrinterDefaultWatermarkOperator implements IOperator {
|
|||||||
public static int OFFSET_Y = 15;
|
public static int OFFSET_Y = 15;
|
||||||
public static Color BG_COLOR = Color.WHITE;
|
public static Color BG_COLOR = Color.WHITE;
|
||||||
public static int QRCODE_SIZE = 150;
|
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 QRCODE_OFFSET_Y = -35;
|
||||||
|
|
||||||
public static int SCENIC_FONT_SIZE = 42;
|
public static int SCENIC_FONT_SIZE = 42;
|
||||||
|
|||||||
@@ -789,14 +789,14 @@ public class PrinterServiceImpl implements PrinterService {
|
|||||||
boolean needRotation = false;
|
boolean needRotation = false;
|
||||||
|
|
||||||
try {
|
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;
|
boolean isLandscape = false;
|
||||||
try {
|
try {
|
||||||
Integer rotate = JacksonUtil.getInt(item.getCrop(), "rotation");
|
Integer rotate = JacksonUtil.getInt(item.getCrop(), "rotation");
|
||||||
if (rotate != null) {
|
if (rotate != null) {
|
||||||
isLandscape = rotate % 180 != 0;
|
isLandscape = rotate % 180 == 0;
|
||||||
}
|
}
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user