fix:优化小票打印逻辑

This commit is contained in:
2025-03-14 16:31:53 +08:00
parent 438d52da0c
commit ba18bf9558
4 changed files with 53 additions and 24 deletions

View File

@@ -28,7 +28,8 @@ public class TemplateController {
@RequestParam Integer height,
@PathVariable String templateName,
@RequestParam(defaultValue = "E:\\images") String saveDir) {
this.templateService.generateReceiptImage(JSONObject.parseObject(jsonData), templateName, width, height, saveDir);
StringBuilder fileDir = new StringBuilder(saveDir);
this.templateService.generateReceiptImage(JSONObject.parseObject(jsonData), templateName, width, height, fileDir);
return Result.ok("模板生成成功");
}
@@ -44,7 +45,8 @@ public class TemplateController {
"<h2><span th:text='${name}'> </span></h2>\n" +
"</body>\n" +
"</html>";
this.templateService.generateReceiptImage(JSONObject.parseObject(jsonData), html, width, height, saveDir);
StringBuilder fileDir = new StringBuilder(saveDir);
this.templateService.generateReceiptImage(JSONObject.parseObject(jsonData), html, width, height, fileDir);
return Result.ok("模板生成成功");
}