Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
Y
yn-health-science
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
徐俊
yn-health-science
Commits
bf1699a7
Commit
bf1699a7
authored
Feb 27, 2025
by
徐俊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xujun
parent
11eff3d6
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
12 deletions
+39
-12
pom.xml
science-admin/pom.xml
+1
-1
ComProjectMembersDTO.java
...a/com/yiboshi/science/param/dto/ComProjectMembersDTO.java
+3
-0
ProjectInfoToPDF.java
...main/java/com/yiboshi/science/utils/ProjectInfoToPDF.java
+33
-9
application.yml
science-admin/src/main/resources/application.yml
+1
-1
ComProjectMembersDAO.xml
...-admin/src/main/resources/mapper/ComProjectMembersDAO.xml
+1
-1
No files found.
science-admin/pom.xml
View file @
bf1699a7
...
...
@@ -303,7 +303,7 @@
<resources>
<resource>
<directory>
src/main/resources
</directory>
<filtering>
fals
e
</filtering>
<filtering>
tru
e
</filtering>
</resource>
<resource>
<directory>
src/main/resources
</directory>
...
...
science-admin/src/main/java/com/yiboshi/science/param/dto/ComProjectMembersDTO.java
View file @
bf1699a7
...
...
@@ -112,6 +112,9 @@ public class ComProjectMembersDTO extends BaseDTO {
/** URL */
@ApiModelProperty
(
value
=
"URL"
,
position
=
7
)
private
String
downloadUrl
;
/** 转换文件URL */
@ApiModelProperty
(
value
=
"转换文件URL"
,
position
=
7
)
private
String
convertUrl
;
/** 证件类型 */
@ApiModelProperty
(
value
=
"证件类型"
,
position
=
9
)
...
...
science-admin/src/main/java/com/yiboshi/science/utils/ProjectInfoToPDF.java
View file @
bf1699a7
...
...
@@ -79,8 +79,14 @@ public class ProjectInfoToPDF {
addProjectBudgetTable
(
document
,
project
,
bfChinese
,
fsChinese
);
// 插入申请书正文PDF
if
(
project
.
getConvertUrl
()
!=
null
&&
!
project
.
getConvertUrl
().
trim
().
isEmpty
())
{
insertPdfContent
(
document
,
System
.
getProperty
(
"user.dir"
)
+
project
.
getConvertUrl
(),
writer
);
if
(
null
!=
project
.
getConvertUrl
()
&&
!
project
.
getConvertUrl
().
trim
().
isEmpty
())
{
InsertPdfContent
(
document
,
"申请书正文"
,
System
.
getProperty
(
"user.dir"
)
+
project
.
getConvertUrl
(),
writer
);
}
// 加载项目组成员简历
List
<
ComProjectMembersDTO
>
MemberList
=
project
.
getMembers
();
if
(
null
!=
MemberList
&&
MemberList
.
size
()
>
0
)
{
LoadProjectMember
(
document
,
MemberList
,
writer
);
}
// 添加新页面
...
...
@@ -972,19 +978,22 @@ public class ProjectInfoToPDF {
/**
* 插入PDF文件到指定位置
* @param document 目标文档
* @param titleName 标题名称
* @param pdfPath 要插入的PDF文件路径
* @throws DocumentException
* @throws IOException
*/
private
static
void
insertPdfContent
(
Document
document
,
String
pdfPath
,
PdfWriter
writer
)
throws
DocumentException
,
IOException
{
private
static
void
InsertPdfContent
(
Document
document
,
String
titleName
,
String
pdfPath
,
PdfWriter
writer
)
throws
DocumentException
,
IOException
{
PdfReader
reader
=
null
;
try
{
// 添加标题
Font
titleFont
=
new
Font
(
BaseFont
.
createFont
(),
12
,
Font
.
BOLD
);
Paragraph
title
=
new
Paragraph
(
"申请书正文"
,
titleFont
);
title
.
setAlignment
(
Element
.
ALIGN_CENTER
);
title
.
setSpacingAfter
(
20
f
);
document
.
add
(
title
);
if
(
Objects
.
nonNull
(
titleName
))
{
// 添加标题
Font
titleFont
=
new
Font
(
BaseFont
.
createFont
(),
12
,
Font
.
BOLD
);
Paragraph
title
=
new
Paragraph
(
titleName
,
titleFont
);
title
.
setAlignment
(
Element
.
ALIGN_CENTER
);
title
.
setSpacingAfter
(
20
f
);
document
.
add
(
title
);
}
// 读取PDF文件内容
byte
[]
pdfBytes
=
readPdfToBytes
(
pdfPath
);
...
...
@@ -1010,6 +1019,21 @@ public class ProjectInfoToPDF {
// 不在这里关闭reader,让它在document关闭时自动关闭
}
/**
* 加载项目组成员简历
* @param document PDF文档
* @param MemberList 成员列表
* @param writer PDF写入器
*/
private
static
void
LoadProjectMember
(
Document
document
,
List
<
ComProjectMembersDTO
>
MemberList
,
PdfWriter
writer
)
throws
DocumentException
,
IOException
{
// 遍历每个成员的简历
for
(
ComProjectMembersDTO
member
:
MemberList
)
{
if
(
Objects
.
nonNull
(
member
.
getFileId
()))
{
InsertPdfContent
(
document
,
""
,
System
.
getProperty
(
"user.dir"
)
+
member
.
getConvertUrl
(),
writer
);
}
}
}
/**
* 读取PDF文件并返回字节数组
* @param pdfPath PDF文件路径
...
...
science-admin/src/main/resources/application.yml
View file @
bf1699a7
...
...
@@ -8,7 +8,7 @@ spring:
application
:
name
:
science-admin
profiles
:
active
:
'
prod'
active
:
@
profileActive@
http
:
encoding
:
force
:
true
...
...
science-admin/src/main/resources/mapper/ComProjectMembersDAO.xml
View file @
bf1699a7
...
...
@@ -12,7 +12,7 @@
</select>
<select
id=
"getListByObjectId"
parameterType=
"java.lang.String"
resultType=
"com.yiboshi.science.param.dto.ComProjectMembersDTO"
>
SELECT a.*,b.name certificate_type_name,c.name nation_name,d.name title_name,e.name degree_name,f.name spec_name
,g.id download_id,g.download_url,g.file_name
,g.id download_id,g.download_url,g.
convert_url,g.
file_name
FROM com_project_members a
left join system_parameter b on a.certificate_type=b.id and b.type_id=49
left join system_parameter c on a.nation=c.id and c.type_id=11
...
...
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