Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yd-backend
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
AutogeneralShanghai
yd-backend
Commits
a6791f4f
Commit
a6791f4f
authored
Apr 20, 2022
by
wenyang
Committed by
akexiu
Apr 21, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
经纪人名片4.经纪人电子名片由后端返回,支持PDF/png
parent
353d21dd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
24 deletions
+24
-24
yd-api/src/main/java/com/yd/api/practitioner/service/impl/PractitionerServiceImpl.java
+21
-22
yd-api/src/main/java/com/yd/api/practitioner/vo/businessCard/PractitionerBusinessCardResponseVO.java
+3
-2
No files found.
yd-api/src/main/java/com/yd/api/practitioner/service/impl/PractitionerServiceImpl.java
View file @
a6791f4f
...
@@ -5195,7 +5195,7 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
...
@@ -5195,7 +5195,7 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
//PDF模板输出结果文件
//PDF模板输出结果文件
String
templateResultPDF
=
tmpPathPDF
+
practitionerId
+
"-businessCardE.pdf"
;
String
templateResultPDF
=
tmpPathPDF
+
practitionerId
+
"-businessCardE.pdf"
;
//JPG模板输出结果文件
//JPG模板输出结果文件
String
templateResult
JPG
=
tmpPathPDF
+
practitionerId
+
"-businessCardE.jp
g"
;
String
templateResult
PNG
=
tmpPathPDF
+
practitionerId
+
"-businessCardE.pn
g"
;
//填充数据
//填充数据
Map
<
String
,
String
>
initDatas
=
new
HashMap
<>();
Map
<
String
,
String
>
initDatas
=
new
HashMap
<>();
Map
<
String
,
String
>
initImages
=
new
HashMap
<>();
Map
<
String
,
String
>
initImages
=
new
HashMap
<>();
...
@@ -5251,6 +5251,7 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
...
@@ -5251,6 +5251,7 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
//按模板填充数据生成结果PDF
//按模板填充数据生成结果PDF
PDFTemplate
.
generatePDF
(
templatePDF
,
templateResultPDF
,
initDatas
,
initImages
);
PDFTemplate
.
generatePDF
(
templatePDF
,
templateResultPDF
,
initDatas
,
initImages
);
try
{
try
{
resp
.
setBusinessCardPdfUrl
(
putContractFileToOSS
(
"businessCardEPDF"
,
templateResultPDF
,
practitionerId
));
PDDocument
doc
=
null
;
PDDocument
doc
=
null
;
ByteArrayOutputStream
os
=
null
;
ByteArrayOutputStream
os
=
null
;
InputStream
stream
=
null
;
InputStream
stream
=
null
;
...
@@ -5264,29 +5265,27 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
...
@@ -5264,29 +5265,27 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
PDPageTree
pages
=
doc
.
getPages
();
PDPageTree
pages
=
doc
.
getPages
();
int
pageCount
=
pages
.
getCount
();
int
pageCount
=
pages
.
getCount
();
for
(
int
i
=
0
;
i
<
pageCount
;
i
++)
{
for
(
int
i
=
0
;
i
<
pageCount
;
i
++)
{
BufferedImage
bim
=
pdfRenderer
.
renderImageWithDPI
(
i
,
92
);
BufferedImage
bim
=
pdfRenderer
.
renderImageWithDPI
(
i
,
70
);
os
=
new
ByteArrayOutputStream
();
ImageIO
.
write
(
bim
,
"png"
,
new
File
(
templateResultPNG
));
// os = new ByteArrayOutputStream();
Image
image
=
bim
.
getScaledInstance
(
92
,
58
,
Image
.
SCALE_SMOOTH
);
//设置图像的缩放大小
// Image image = bim.getScaledInstance(70,45,Image.SCALE_SMOOTH); //设置图像的缩放大小
AffineTransformOp
op
=
new
AffineTransformOp
(
AffineTransform
.
getScaleInstance
(
1
,
1
),
null
);
//设置图像的缩放比例
// AffineTransformOp op = new AffineTransformOp(AffineTransform.getScaleInstance(1,1),null); //设置图像的缩放比例
image
=
op
.
filter
(
bim
,
null
);
// image = op.filter(bim,null);
// ImageIO.write((BufferedImage)image, "png", os);
ImageIO
.
write
((
BufferedImage
)
image
,
"jpg"
,
os
);
// byte[] dataList = os.toByteArray();
byte
[]
dataList
=
os
.
toByteArray
();
// // png文件转出路径
// jpg文件转出路径
// File file = new File(templateResultPNG);
File
file
=
new
File
(
templateResultJPG
);
// if (!file.getParentFile().exists()) {
if
(!
file
.
getParentFile
().
exists
())
{
// // 不存在则创建父目录及子文件
// 不存在则创建父目录及子文件
// file.getParentFile().mkdirs();
file
.
getParentFile
().
mkdirs
();
// file.createNewFile();
file
.
createNewFile
();
// }
}
// out = new FileOutputStream(file);
out
=
new
FileOutputStream
(
file
);
// out.write(dataList);
out
.
write
(
dataList
);
if
(
i
==
0
){
if
(
i
==
0
){
resp
.
setBusinessCardPros
Url
(
putContractFileToOSS
(
"businessCardEPros"
,
templateResultJP
G
,
practitionerId
));
resp
.
setBusinessCardPros
Img
(
putContractFileToOSS
(
"businessCardEPros"
,
templateResultPN
G
,
practitionerId
));
}
else
if
(
i
==
1
){
}
else
if
(
i
==
1
){
resp
.
setBusinessCardCons
Url
(
putContractFileToOSS
(
"businessCardECons"
,
templateResultJP
G
,
practitionerId
));
resp
.
setBusinessCardCons
Img
(
putContractFileToOSS
(
"businessCardECons"
,
templateResultPN
G
,
practitionerId
));
}
}
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
yd-api/src/main/java/com/yd/api/practitioner/vo/businessCard/PractitionerBusinessCardResponseVO.java
View file @
a6791f4f
...
@@ -26,8 +26,9 @@ public class PractitionerBusinessCardResponseVO {
...
@@ -26,8 +26,9 @@ public class PractitionerBusinessCardResponseVO {
private
String
mobileNo
;
//手机号
private
String
mobileNo
;
//手机号
private
String
email
;
//电子邮件
private
String
email
;
//电子邮件
private
Integer
emailIsActive
;
//经纪人邮箱是否开通(0=No, 1=Yes)
private
Integer
emailIsActive
;
//经纪人邮箱是否开通(0=No, 1=Yes)
private
String
businessCardProsUrl
;
//电子名片正面Url
private
String
businessCardPdfUrl
;
//电子名片PDF
private
String
businessCardConsUrl
;
//电子名片反面Url
private
String
businessCardProsImg
;
//电子名片正面Url
private
String
businessCardConsImg
;
//电子名片反面Url
private
CommonResult
commonResult
;
private
CommonResult
commonResult
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment