Browse Source

fix:[试验管理]表单导出

master
15881625488@163.com 3 months ago
parent
commit
bf22da7c62
4 changed files with 9 additions and 9 deletions
  1. +6
    -6
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/PdfBaseUtil.java
  2. +1
    -1
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/resource/Dosage.java
  3. +1
    -1
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/resource/Drug.java
  4. +1
    -1
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/template/SP001.java

+ 6
- 6
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/PdfBaseUtil.java View File

@ -33,7 +33,7 @@ public class PdfBaseUtil {
* *
* @return 完整文件路径 * @return 完整文件路径
*/ */
public static String getFilePath(String localFilePath) {
public static String getFilePath(String localFilePath,String type) {
// 1. 获取当前年月日并创建文件夹 // 1. 获取当前年月日并创建文件夹
Date now = new Date(); Date now = new Date();
SimpleDateFormat yearFormat = new SimpleDateFormat("yyyy"); SimpleDateFormat yearFormat = new SimpleDateFormat("yyyy");
@ -55,13 +55,13 @@ public class PdfBaseUtil {
dir.mkdirs(); dir.mkdirs();
} }
// 4. 生成文件名 // 4. 生成文件名
String fileName = "document_" + timestamp + ".pdf";
String fileName =type+ "_" + timestamp + ".pdf";
// 5. 完整文件路径 // 5. 完整文件路径
return Paths.get(folderPath, fileName).toString(); return Paths.get(folderPath, fileName).toString();
} }
/** /**
* 添加带下划线的标题
* 添加标题
* *
* @param document PDF文档对象 * @param document PDF文档对象
* @param titleText 标题文本 * @param titleText 标题文本
@ -373,13 +373,13 @@ public class PdfBaseUtil {
*/ */
private void addRepeatedWatermark(PdfContentByte content, float width, float height, String signText) { 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) - float textHeight = baseFont.getAscentPoint(signText, fontSize) -
baseFont.getDescentPoint(signText, fontSize); baseFont.getDescentPoint(signText, fontSize);
// 计算间距 // 计算间距
float stepX = textWidth + 150;
float stepX = textWidth + 70;
float stepY = textHeight + 100; float stepY = textHeight + 100;
// 添加重复水印 // 添加重复水印

+ 1
- 1
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/resource/Dosage.java View File

@ -41,7 +41,7 @@ public class Dosage {
language=lang; language=lang;
Document document = null; Document document = null;
FileOutputStream fos = null; FileOutputStream fos = null;
String filePath = PdfBaseUtil.getFilePath(localFilePath);
String filePath = PdfBaseUtil.getFilePath(localFilePath,"Dosage");
try { try {
String sign = "hxhq"; String sign = "hxhq";
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();

+ 1
- 1
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/resource/Drug.java View File

@ -40,7 +40,7 @@ public class Drug {
language=lang; language=lang;
Document document = null; Document document = null;
FileOutputStream fos = null; FileOutputStream fos = null;
String filePath = PdfBaseUtil.getFilePath(localFilePath);
String filePath = PdfBaseUtil.getFilePath(localFilePath,"Drug");
try { try {
String sign = "hxhq" ; String sign = "hxhq" ;
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();

+ 1
- 1
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/pdf/template/SP001.java View File

@ -42,7 +42,7 @@ public class SP001 {
language = lang; language = lang;
Document document = null; Document document = null;
FileOutputStream fos = null; FileOutputStream fos = null;
String filePath = PdfBaseUtil.getFilePath(localFilePath);
String filePath = PdfBaseUtil.getFilePath(localFilePath,"SP001");
try { try {
String sign = "hxhq"; String sign = "hxhq";
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();

Loading…
Cancel
Save