diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/PdfBaseUtil.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/PdfBaseUtil.java index a42c6f4..bcdbf9d 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/PdfBaseUtil.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/PdfBaseUtil.java @@ -33,7 +33,7 @@ public class PdfBaseUtil { * * @return 完整文件路径, */ - public static String getFilePath(String localFilePath) { + public static String getFilePath(String localFilePath,String type) { // 1. 获取当前年月日并创建文件夹 Date now = new Date(); SimpleDateFormat yearFormat = new SimpleDateFormat("yyyy"); @@ -55,13 +55,13 @@ public class PdfBaseUtil { dir.mkdirs(); } // 4. 生成文件名 - String fileName = "document_" + timestamp + ".pdf"; + String fileName =type+ "_" + timestamp + ".pdf"; // 5. 完整文件路径 return Paths.get(folderPath, fileName).toString(); } /** - * 添加带下划线的标题 + * 添加标题 * * @param document PDF文档对象 * @param titleText 标题文本 @@ -373,13 +373,13 @@ public class PdfBaseUtil { */ private void addRepeatedWatermark(PdfContentByte content, float width, float height, String signText) { // 计算文字尺寸 - float fontSize = Convert.toFloat("8"); - float textWidth = baseFont.getWidthPoint(signText, fontSize); + float fontSize = Convert.toFloat("10"); + float textWidth = baseFont.getWidthPoint(signText, fontSize)+50; float textHeight = baseFont.getAscentPoint(signText, fontSize) - baseFont.getDescentPoint(signText, fontSize); // 计算间距 - float stepX = textWidth + 150; + float stepX = textWidth + 70; float stepY = textHeight + 100; // 添加重复水印 diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/resource/Dosage.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/resource/Dosage.java index 1a49748..58fc9a9 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/resource/Dosage.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/resource/Dosage.java @@ -41,7 +41,7 @@ public class Dosage { language=lang; Document document = null; FileOutputStream fos = null; - String filePath = PdfBaseUtil.getFilePath(localFilePath); + String filePath = PdfBaseUtil.getFilePath(localFilePath,"Dosage"); try { String sign = "hxhq"; LoginUser loginUser = SecurityUtils.getLoginUser(); diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/resource/Drug.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/resource/Drug.java index 68dc726..1badc9b 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/resource/Drug.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/resource/Drug.java @@ -40,7 +40,7 @@ public class Drug { language=lang; Document document = null; FileOutputStream fos = null; - String filePath = PdfBaseUtil.getFilePath(localFilePath); + String filePath = PdfBaseUtil.getFilePath(localFilePath,"Drug"); try { String sign = "hxhq" ; LoginUser loginUser = SecurityUtils.getLoginUser(); diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/template/SP001.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/template/SP001.java index 6a29759..399734e 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/template/SP001.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/template/SP001.java @@ -42,7 +42,7 @@ public class SP001 { language = lang; Document document = null; FileOutputStream fos = null; - String filePath = PdfBaseUtil.getFilePath(localFilePath); + String filePath = PdfBaseUtil.getFilePath(localFilePath,"SP001"); try { String sign = "hxhq"; LoginUser loginUser = SecurityUtils.getLoginUser();