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
60ceaa58
Commit
60ceaa58
authored
Apr 21, 2022
by
akexiu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "经纪人名片4.经纪人电子名片有后端返回"
This reverts commit
57478241
.
parent
b6cd133c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
135 deletions
+0
-135
yd-api/src/main/java/com/yd/api/practitioner/service/impl/PractitionerServiceImpl.java
+0
-130
yd-api/src/main/java/com/yd/api/practitioner/vo/businessCard/PractitionerBusinessCardResponseVO.java
+0
-2
yd-api/src/main/resources/pdfconfiguration.properties
+0
-3
No files found.
yd-api/src/main/java/com/yd/api/practitioner/service/impl/PractitionerServiceImpl.java
View file @
60ceaa58
...
@@ -3,8 +3,6 @@ package com.yd.api.practitioner.service.impl;
...
@@ -3,8 +3,6 @@ package com.yd.api.practitioner.service.impl;
import
static
java
.
util
.
stream
.
Collectors
.
toList
;
import
static
java
.
util
.
stream
.
Collectors
.
toList
;
import
java.awt.Image
;
import
java.awt.Image
;
import
java.awt.geom.AffineTransform
;
import
java.awt.image.AffineTransformOp
;
import
java.awt.image.BufferedImage
;
import
java.awt.image.BufferedImage
;
import
java.io.BufferedInputStream
;
import
java.io.BufferedInputStream
;
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayInputStream
;
...
@@ -15,7 +13,6 @@ import java.io.FileNotFoundException;
...
@@ -15,7 +13,6 @@ import java.io.FileNotFoundException;
import
java.io.FileOutputStream
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.io.UnsupportedEncodingException
;
import
java.io.UnsupportedEncodingException
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.net.URLEncoder
;
import
java.net.URLEncoder
;
...
@@ -44,9 +41,6 @@ import javax.script.ScriptException;
...
@@ -44,9 +41,6 @@ import javax.script.ScriptException;
import
org.apache.commons.beanutils.BeanPropertyValueEqualsPredicate
;
import
org.apache.commons.beanutils.BeanPropertyValueEqualsPredicate
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.pdfbox.pdmodel.PDDocument
;
import
org.apache.pdfbox.pdmodel.PDPageTree
;
import
org.apache.pdfbox.rendering.PDFRenderer
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -5184,134 +5178,10 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
...
@@ -5184,134 +5178,10 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
}
else
{
}
else
{
resp
.
setCommonResult
(
new
CommonResult
(
false
,
"没有查到该经纪人"
));
resp
.
setCommonResult
(
new
CommonResult
(
false
,
"没有查到该经纪人"
));
}
}
businessCardE
(
resp
);
return
resp
;
return
resp
;
}
}
/**
/**
* 经纪人电子名片
* @param PractitionerBusinessCardResponseVO
* @return void
* @author Yan Wenyang
*/
public
void
businessCardE
(
PractitionerBusinessCardResponseVO
resp
){
Long
practitionerId
=
resp
.
getPractitionerId
();
String
templatePDF
=
PDFConfiguration
.
getProperty
(
"businessCardE.pdf.template"
);
//模板文件生成临时文件目录
String
tmpPathPDF
=
PDFConfiguration
.
getProperty
(
"businessCardE.pdf.temp.path"
);
//PDF模板输出结果文件
String
templateResultPDF
=
tmpPathPDF
+
practitionerId
+
"-businessCardE.pdf"
;
//JPG模板输出结果文件
String
templateResultJPG
=
tmpPathPDF
+
practitionerId
+
"-businessCardE.jpg"
;
//填充数据
Map
<
String
,
String
>
initDatas
=
new
HashMap
<>();
Map
<
String
,
String
>
initImages
=
new
HashMap
<>();
//下载图片
Map
<
String
,
Object
>
input
=
HttpUtil
.
getInput
(
resp
.
getWxQRImgUrl
());
if
((
boolean
)
input
.
get
(
"success"
))
{
InputStream
inputStream
=
(
InputStream
)
input
.
get
(
"is"
);
String
wxQRImgUrl
=
this
.
getImgStrFilePath
(
tmpPathPDF
,
"sign.png"
,
inputStream
);
initImages
.
put
(
"wxQRImgUrl"
,
wxQRImgUrl
);
}
if
(
resp
.
getCertificateList
()
!=
null
&&
resp
.
getCertificateList
().
size
()
>
0
){
for
(
int
j
=
0
;
j
<
resp
.
getCertificateList
().
size
();
j
++)
{
Certificate
certificate
=
resp
.
getCertificateList
().
get
(
j
);
if
(
certificate
!=
null
){
int
jj
=
j
+
1
;
initDatas
.
put
(
"certName"
+
jj
,
certificate
.
getCertName
()
+
" "
+
certificate
.
getCertNameEn
());
}
}
}
if
(!
Strings
.
isNullOrEmpty
(
resp
.
getPractitionerName
())){
initDatas
.
put
(
"practitionerName"
,
resp
.
getPractitionerName
());
}
if
(!
Strings
.
isNullOrEmpty
(
resp
.
getPractitionerNameEn
())){
initDatas
.
put
(
"practitionerNameEn"
,
resp
.
getPractitionerNameEn
());
}
if
(!
Strings
.
isNullOrEmpty
(
resp
.
getLevelName
())){
initDatas
.
put
(
"levelName"
,
resp
.
getLevelName
());
}
if
(!
Strings
.
isNullOrEmpty
(
resp
.
getLevelNameEn
())){
initDatas
.
put
(
"levelNameEn"
,
resp
.
getLevelNameEn
());
}
if
(!
Strings
.
isNullOrEmpty
(
resp
.
getInsurerName
())){
initDatas
.
put
(
"insurerName"
,
resp
.
getInsurerName
());
}
if
(!
Strings
.
isNullOrEmpty
(
resp
.
getInsurerAbbre
())){
initDatas
.
put
(
"insurerAbbre"
,
resp
.
getInsurerAbbre
());
}
if
(!
Strings
.
isNullOrEmpty
(
resp
.
getInsurerUrl
())){
initDatas
.
put
(
"insurerUrl"
,
resp
.
getInsurerUrl
());
}
if
(!
Strings
.
isNullOrEmpty
(
resp
.
getInsurerAddress
())){
initDatas
.
put
(
"insurerAddress"
,
resp
.
getInsurerAddress
());
}
if
(!
Strings
.
isNullOrEmpty
(
resp
.
getInsurerUser
())){
initDatas
.
put
(
"insurerUser"
,
resp
.
getInsurerUser
());
}
if
(!
Strings
.
isNullOrEmpty
(
resp
.
getMobileNo
())){
initDatas
.
put
(
"mobileNo"
,
"T: "
+
resp
.
getMobileNo
());
}
if
(!
Strings
.
isNullOrEmpty
(
resp
.
getEmail
())){
initDatas
.
put
(
"email"
,
"E: "
+
resp
.
getEmail
());
}
//按模板填充数据生成结果PDF
PDFTemplate
.
generatePDF
(
templatePDF
,
templateResultPDF
,
initDatas
,
initImages
);
try
{
PDDocument
doc
=
null
;
ByteArrayOutputStream
os
=
null
;
InputStream
stream
=
null
;
OutputStream
out
=
null
;
try
{
// pdf路径
stream
=
new
FileInputStream
(
templateResultPDF
);
// 加载解析PDF文件
doc
=
PDDocument
.
load
(
stream
);
PDFRenderer
pdfRenderer
=
new
PDFRenderer
(
doc
);
PDPageTree
pages
=
doc
.
getPages
();
int
pageCount
=
pages
.
getCount
();
for
(
int
i
=
0
;
i
<
pageCount
;
i
++)
{
BufferedImage
bim
=
pdfRenderer
.
renderImageWithDPI
(
i
,
92
);
os
=
new
ByteArrayOutputStream
();
Image
image
=
bim
.
getScaledInstance
(
92
,
58
,
Image
.
SCALE_SMOOTH
);
//设置图像的缩放大小
AffineTransformOp
op
=
new
AffineTransformOp
(
AffineTransform
.
getScaleInstance
(
1
,
1
),
null
);
//设置图像的缩放比例
image
=
op
.
filter
(
bim
,
null
);
ImageIO
.
write
((
BufferedImage
)
image
,
"jpg"
,
os
);
byte
[]
dataList
=
os
.
toByteArray
();
// jpg文件转出路径
File
file
=
new
File
(
templateResultJPG
);
if
(!
file
.
getParentFile
().
exists
())
{
// 不存在则创建父目录及子文件
file
.
getParentFile
().
mkdirs
();
file
.
createNewFile
();
}
out
=
new
FileOutputStream
(
file
);
out
.
write
(
dataList
);
if
(
i
==
0
){
resp
.
setBusinessCardProsUrl
(
putContractFileToOSS
(
"businessCardEPros"
,
templateResultJPG
,
practitionerId
));
}
else
if
(
i
==
1
){
resp
.
setBusinessCardConsUrl
(
putContractFileToOSS
(
"businessCardECons"
,
templateResultJPG
,
practitionerId
));
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
}
finally
{
if
(
doc
!=
null
)
doc
.
close
();
if
(
os
!=
null
)
os
.
close
();
if
(
stream
!=
null
)
stream
.
close
();
if
(
out
!=
null
)
out
.
close
();
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
/**
* 经纪人申请开通邮箱
* 经纪人申请开通邮箱
* @param PractitionerApplyEmailRequestVO
* @param PractitionerApplyEmailRequestVO
* @return CommonResultResponseVO
* @return CommonResultResponseVO
...
...
yd-api/src/main/java/com/yd/api/practitioner/vo/businessCard/PractitionerBusinessCardResponseVO.java
View file @
60ceaa58
...
@@ -26,8 +26,6 @@ public class PractitionerBusinessCardResponseVO {
...
@@ -26,8 +26,6 @@ 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
businessCardConsUrl
;
//电子名片反面Url
private
CommonResult
commonResult
;
private
CommonResult
commonResult
;
}
}
yd-api/src/main/resources/pdfconfiguration.properties
View file @
60ceaa58
...
@@ -27,6 +27,3 @@ commitment.pdf.temp.path=/opt/tomcat8/conf/ydpdf/commitment
...
@@ -27,6 +27,3 @@ commitment.pdf.temp.path=/opt/tomcat8/conf/ydpdf/commitment
unionSales.pdf.template
=
/opt/tomcat8/conf/ydpdf/unionSales/ydLogo.jpg
unionSales.pdf.template
=
/opt/tomcat8/conf/ydpdf/unionSales/ydLogo.jpg
unionSales.pdf.temp.path
=
/opt/tomcat8/conf/ydpdf/unionSales/
unionSales.pdf.temp.path
=
/opt/tomcat8/conf/ydpdf/unionSales/
businessCardE.pdf.template
=
/opt/tomcat8/conf/ydpdf/businessCardE/templateBusinessCardE.pdf
businessCardE.pdf.temp.path
=
/opt/tomcat8/conf/ydpdf/businessCardE
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