You've already forked FrameTour-BE
refactor(printer): 优化水印配置构建逻辑
- 将 WatermarkConfig 构建过程拆分为条件判断分支 - 针对 IPC 图像源增加特殊处理逻辑 - 统一构建器模式的调用流程 - 提高代码可读性和维护性 - 保持原有功能不变的情况下优化结构
This commit is contained in:
@@ -1087,7 +1087,7 @@ public class PrinterServiceImpl implements PrinterService {
|
||||
String printWatermarkPUrl = scenicConfig.getString("print_watermark_p_url", null);
|
||||
String printWatermarkLUrl = scenicConfig.getString("print_watermark_l_url", null);
|
||||
|
||||
return WatermarkConfig.builder()
|
||||
WatermarkConfig.WatermarkConfigBuilder builder = WatermarkConfig.builder()
|
||||
.watermarkType(watermarkType)
|
||||
.scenicText(scenicText)
|
||||
.dateFormat(dateFormat)
|
||||
@@ -1095,9 +1095,14 @@ public class PrinterServiceImpl implements PrinterService {
|
||||
.storageAdapter(StorageFactory.use())
|
||||
.edgeEnabled(true)
|
||||
.qrcodeFile(qrCodeFile)
|
||||
.scale(scale)
|
||||
.printWatermarkPUrlList(Collections.singletonList(printWatermarkPUrl))
|
||||
.printWatermarkLUrlList(Collections.singletonList(printWatermarkLUrl))
|
||||
.scale(scale);
|
||||
if (context.getSource() == ImageSource.IPC) {
|
||||
return builder
|
||||
.printWatermarkPUrlList(Collections.singletonList(printWatermarkPUrl))
|
||||
.printWatermarkLUrlList(Collections.singletonList(printWatermarkLUrl))
|
||||
.build();
|
||||
}
|
||||
return builder
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user