fix 83128 在会员企业端--项目详情页面-下载会员批复文件,无法打开
This commit is contained in:
+9
-23
@@ -20,6 +20,7 @@ import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -37,11 +38,11 @@ public class ApprovalDocumentNumberService extends ServiceImpl<ApprovalDocumentN
|
||||
ApprovalDocumentNumberMapper approvalMapper;
|
||||
@Resource
|
||||
private MemberInfoMapper memberInfoMapper;
|
||||
////pdf模板文件路径
|
||||
//@Value("${template.path.pdf}")
|
||||
//private String templatePath;
|
||||
//@Value("${template.path.font}")
|
||||
//private String fontPath;
|
||||
//pdf模板文件路径
|
||||
@Value("${template.path.pdf}")
|
||||
private String templatePath;
|
||||
@Value("${template.path.font}")
|
||||
private String fontPath;
|
||||
|
||||
/**
|
||||
* 这一年是否已经存在批准文号
|
||||
@@ -66,24 +67,9 @@ public class ApprovalDocumentNumberService extends ServiceImpl<ApprovalDocumentN
|
||||
if (approval == null){
|
||||
throw new JeroBootException(year+"年批复文号为空");
|
||||
}
|
||||
ClassLoader classLoader = ApprovalDocumentNumberService.class.getClassLoader();
|
||||
String fontPath = classLoader.getResource("template/simfang.ttf").getPath();
|
||||
if (fontPath.startsWith("/")){
|
||||
fontPath = fontPath.substring(1);
|
||||
}
|
||||
String templatePath = classLoader.getResource("template/approvalTemplate.pdf").getPath();
|
||||
if (templatePath.startsWith("/")){
|
||||
templatePath = templatePath.substring(1);
|
||||
}
|
||||
/* 使用中文字体 */
|
||||
BaseFont baseFont = null;
|
||||
try {
|
||||
baseFont = BaseFont.createFont(fontPath, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
|
||||
//模板路径
|
||||
if (templatePath == null) {
|
||||
log.error("会员批复文件pdf模板为空");
|
||||
return;
|
||||
}
|
||||
/* 使用中文字体 */
|
||||
BaseFont baseFont = BaseFont.createFont(fontPath, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
|
||||
PdfReader pdfReader = new PdfReader(templatePath);
|
||||
|
||||
pdfStamper = new PdfStamper(pdfReader, bos);
|
||||
@@ -101,7 +87,7 @@ public class ApprovalDocumentNumberService extends ServiceImpl<ApprovalDocumentN
|
||||
pdfStamper.close();
|
||||
pdfReader.close();
|
||||
} catch (DocumentException | IOException e) {
|
||||
e.printStackTrace();
|
||||
log.error("error",e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -352,4 +352,13 @@ kuaidi:
|
||||
key: glrUQsMV4692
|
||||
customer: 580BE140491CA19C3FED37DB5845413E
|
||||
|
||||
needPassword: false
|
||||
needPassword: false
|
||||
|
||||
#模板路径
|
||||
template:
|
||||
path :
|
||||
font: D:\\hzwl\\income_payments\\income_payments_managerment\\template\\simfang.ttf
|
||||
#批复文件pdf
|
||||
pdf: D:\\hzwl\\income_payments\\income_payments_managerment\\template\\approvalTemplate.pdf
|
||||
#入会申请表word
|
||||
applicationWord: E:\\biao_zhun_suo\\template\\applicationWord.docx
|
||||
Reference in New Issue
Block a user