Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
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
91d40026
Commit
91d40026
authored
Aug 22, 2025
by
wangxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
ff98cb64
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
261 additions
and
9 deletions
+261
-9
ComProjectTaskController.java
...com/yiboshi/science/rest/v1/ComProjectTaskController.java
+7
-1
TaskInfoToPDFUtil.java
...ain/java/com/yiboshi/science/utils/TaskInfoToPDFUtil.java
+254
-8
No files found.
science-admin/src/main/java/com/yiboshi/science/rest/v1/ComProjectTaskController.java
View file @
91d40026
...
@@ -8,12 +8,14 @@ import com.yiboshi.science.config.security.SecurityUserHolder;
...
@@ -8,12 +8,14 @@ import com.yiboshi.science.config.security.SecurityUserHolder;
import
com.yiboshi.science.entity.ComProjectAudit
;
import
com.yiboshi.science.entity.ComProjectAudit
;
import
com.yiboshi.science.entity.ComProjectTask
;
import
com.yiboshi.science.entity.ComProjectTask
;
import
com.yiboshi.science.entity.SelectListItem
;
import
com.yiboshi.science.entity.SelectListItem
;
import
com.yiboshi.science.entity.SystemParameter
;
import
com.yiboshi.science.enumeration.CommonEnum
;
import
com.yiboshi.science.enumeration.CommonEnum
;
import
com.yiboshi.science.param.dto.ComProjectTaskDTO
;
import
com.yiboshi.science.param.dto.ComProjectTaskDTO
;
import
com.yiboshi.science.param.dto.DataStatisticsDTO
;
import
com.yiboshi.science.param.dto.DataStatisticsDTO
;
import
com.yiboshi.science.param.query.ComProjectTaskQueryVO
;
import
com.yiboshi.science.param.query.ComProjectTaskQueryVO
;
import
com.yiboshi.science.rest.BaseController
;
import
com.yiboshi.science.rest.BaseController
;
import
com.yiboshi.science.service.ComProjectTaskService
;
import
com.yiboshi.science.service.ComProjectTaskService
;
import
com.yiboshi.science.service.SystemParameterService
;
import
com.yiboshi.science.utils.*
;
import
com.yiboshi.science.utils.*
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
...
@@ -41,6 +43,9 @@ public class ComProjectTaskController extends BaseController<ComProjectTaskServi
...
@@ -41,6 +43,9 @@ public class ComProjectTaskController extends BaseController<ComProjectTaskServi
@Autowired
@Autowired
private
ComProjectTaskService
ComProjectTaskService
;
private
ComProjectTaskService
ComProjectTaskService
;
@Autowired
private
SystemParameterService
systemParameterService
;
/**
/**
* 功能:分页查询
* 功能:分页查询
...
@@ -147,9 +152,10 @@ public class ComProjectTaskController extends BaseController<ComProjectTaskServi
...
@@ -147,9 +152,10 @@ public class ComProjectTaskController extends BaseController<ComProjectTaskServi
public
void
export
(
@PathVariable
String
id
)
throws
DocumentException
,
IOException
{
public
void
export
(
@PathVariable
String
id
)
throws
DocumentException
,
IOException
{
try
{
try
{
ComProjectTaskDTO
dto
=
ComProjectTaskService
.
getTaskByProjId
(
id
);
ComProjectTaskDTO
dto
=
ComProjectTaskService
.
getTaskByProjId
(
id
);
List
<
SystemParameter
>
list
=
systemParameterService
.
getListByType
(
67
);
// WordUtils.getHtmlContent(dto, "C:\\Users\\kylin\\Desktop\\导出Pdf\\output.docx");
// WordUtils.getHtmlContent(dto, "C:\\Users\\kylin\\Desktop\\导出Pdf\\output.docx");
// 生成PDF文件字节数组
// 生成PDF文件字节数组
byte
[]
pdfBytes
=
TaskInfoToPDFUtil
.
createContractPdf
(
dto
);
byte
[]
pdfBytes
=
TaskInfoToPDFUtil
.
createContractPdf
(
dto
,
list
);
// byte[] pdfBytes = TaskToPDF.createContractPdf(dto);
// byte[] pdfBytes = TaskToPDF.createContractPdf(dto);
// byte[] pdfBytes = TalentToPDF.createContractPdf(dto);
// byte[] pdfBytes = TalentToPDF.createContractPdf(dto);
// 设置响应头
// 设置响应头
...
...
science-admin/src/main/java/com/yiboshi/science/utils/TaskInfoToPDFUtil.java
View file @
91d40026
...
@@ -2,10 +2,14 @@ package com.yiboshi.science.utils;
...
@@ -2,10 +2,14 @@ package com.yiboshi.science.utils;
import
com.itextpdf.text.*
;
import
com.itextpdf.text.*
;
import
com.itextpdf.text.pdf.*
;
import
com.itextpdf.text.pdf.*
;
import
com.yiboshi.science.entity.SystemParameter
;
import
com.yiboshi.science.enumeration.CommonEnum
;
import
com.yiboshi.science.enumeration.CommonEnum
;
import
com.yiboshi.science.param.dto.*
;
import
com.yiboshi.science.param.dto.*
;
import
com.yiboshi.science.service.SystemParameterService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
java.io.ByteArrayOutputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -19,13 +23,14 @@ public class TaskInfoToPDFUtil {
...
@@ -19,13 +23,14 @@ public class TaskInfoToPDFUtil {
static
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
static
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
static
SimpleDateFormat
sdfM
=
new
SimpleDateFormat
(
"yyyy年MM月"
);
static
SimpleDateFormat
sdfM
=
new
SimpleDateFormat
(
"yyyy年MM月"
);
/**
/**
* 生成项目合同书PDF
* 生成项目合同书PDF
*
*
* @param dto 项目任务信息
* @param dto 项目任务信息
* @return PDF文件字节数组
* @return PDF文件字节数组
*/
*/
public
static
byte
[]
createContractPdf
(
ComProjectTaskDTO
dto
)
throws
DocumentException
{
public
static
byte
[]
createContractPdf
(
ComProjectTaskDTO
dto
,
List
<
SystemParameter
>
list
)
throws
DocumentException
{
ByteArrayOutputStream
baos
=
new
ByteArrayOutputStream
();
ByteArrayOutputStream
baos
=
new
ByteArrayOutputStream
();
Document
document
=
new
Document
(
PageSize
.
A4
,
54
f
,
54
f
,
72
f
,
72
f
);
Document
document
=
new
Document
(
PageSize
.
A4
,
54
f
,
54
f
,
72
f
,
72
f
);
...
@@ -33,7 +38,10 @@ public class TaskInfoToPDFUtil {
...
@@ -33,7 +38,10 @@ public class TaskInfoToPDFUtil {
// 宋体
// 宋体
BaseFont
sfChinese
=
loadChineseFont
(
"simsun.ttc"
);
BaseFont
sfChinese
=
loadChineseFont
(
"simsun.ttc"
);
// 仿宋
// 仿宋
BaseFont
fsChinese
=
loadChineseFont
(
"simfang.ttf"
);
// BaseFont fsChinese = loadChineseFont("simfang.ttf");
BaseFont
fsChinese
=
loadChineseFont
(
"simsun.ttf"
);
// WINGDNG2
BaseFont
WINGDNG2
=
loadChineseFont
(
"WINGDNG2.ttf"
);
PdfWriter
writer
=
PdfWriter
.
getInstance
(
document
,
baos
);
PdfWriter
writer
=
PdfWriter
.
getInstance
(
document
,
baos
);
...
@@ -75,7 +83,10 @@ public class TaskInfoToPDFUtil {
...
@@ -75,7 +83,10 @@ public class TaskInfoToPDFUtil {
projectSubInfo
(
document
,
dto
,
sfChinese
,
fsChinese
);
projectSubInfo
(
document
,
dto
,
sfChinese
,
fsChinese
);
// 添加项目绩效目标表
// 添加项目绩效目标表
addProjectKPITable
(
document
,
dto
,
sfChinese
,
fsChinese
);
// addProjectKPITable(document, dto, sfChinese, fsChinese);
// 添加项目绩效目标表
addProjectKPITable
(
document
,
dto
,
list
,
sfChinese
,
fsChinese
,
WINGDNG2
);
// 附件清单
// 附件清单
addFileTable
(
document
,
dto
,
sfChinese
,
fsChinese
);
addFileTable
(
document
,
dto
,
sfChinese
,
fsChinese
);
...
@@ -929,12 +940,232 @@ public class TaskInfoToPDFUtil {
...
@@ -929,12 +940,232 @@ public class TaskInfoToPDFUtil {
document
.
add
(
table
);
document
.
add
(
table
);
}
}
private
static
void
addProjectKPITable
(
Document
document
,
ComProjectTaskDTO
dto
,
BaseFont
bfChinese
,
BaseFont
fsChinese
)
throws
DocumentException
{
// private static void addProjectKPITable(Document document, ComProjectTaskDTO dto, BaseFont bfChinese, BaseFont fsChinese) throws DocumentException {
// document.newPage();
// Font titleFont = new Font(bfChinese, 14f, Font.BOLD);
// Font normalFont = new Font(bfChinese, 12f, Font.NORMAL);
// // 添加标题
// addSection(document, "八、项目绩效目标表", titleFont);
// }
private
static
void
addProjectKPITable
(
Document
document
,
ComProjectTaskDTO
task
,
List
<
SystemParameter
>
projAttributeList
,
BaseFont
bfChinese
,
BaseFont
fsChinese
,
BaseFont
WINGDNG2
)
throws
DocumentException
{
document
.
newPage
();
document
.
newPage
();
Font
titleFont
=
new
Font
(
bfChinese
,
14
f
,
Font
.
BOLD
);
Font
normalFont
=
new
Font
(
bfChinese
,
12
f
,
Font
.
NORMAL
);
Font
titleFont
=
new
Font
(
bfChinese
,
12
,
Font
.
BOLD
);
// 添加标题
Font
contentFont
=
new
Font
(
bfChinese
,
12
,
Font
.
NORMAL
);
addSection
(
document
,
"八、项目绩效目标表"
,
titleFont
);
Font
wingdng2Font
=
new
Font
(
WINGDNG2
,
12
,
Font
.
NORMAL
);
ProjectKPIStatisticDTO
kpitDTO
=
task
.
getProjectKPI
();
List
<
ComProjectKpitDTO
>
detail
=
task
.
getProjectKPI
().
getThreeLevel
();
// 添加表格标题
Paragraph
title
=
new
Paragraph
(
"八、绩效目标表"
,
titleFont
);
title
.
setAlignment
(
Element
.
ALIGN_CENTER
);
title
.
setSpacingAfter
(
10
f
);
document
.
add
(
title
);
// 创建主表格
PdfPTable
mainTable
=
new
PdfPTable
(
5
);
mainTable
.
setWidthPercentage
(
98
);
float
[]
widths
=
{
0.8f
,
1
f
,
2
f
,
1
f
,
2
f
};
mainTable
.
setWidths
(
widths
);
// 添加年度标题
PdfPCell
yearCell
=
new
PdfPCell
(
new
Phrase
(
kpitDTO
.
getReportYear
()
+
"年度"
,
titleFont
));
yearCell
.
setColspan
(
5
);
yearCell
.
setHorizontalAlignment
(
Element
.
ALIGN_CENTER
);
yearCell
.
setMinimumHeight
(
25
f
);
mainTable
.
addCell
(
yearCell
);
// 项目名称
addLabelValueRow
(
mainTable
,
"项目名称"
,
kpitDTO
.
getProjName
(),
5
,
titleFont
,
contentFont
);
// 主管处室和实施单位
addLabelValueRow
(
mainTable
,
"主管处室"
,
kpitDTO
.
getManagerDept
(),
2
,
titleFont
,
contentFont
);
addLabelValueRow
(
mainTable
,
"实施单位"
,
kpitDTO
.
getAppUnitName
(),
1
,
titleFont
,
contentFont
);
// 项目属性
PdfPCell
labelCell
=
new
PdfPCell
(
new
Phrase
(
"项目属性"
,
titleFont
));
labelCell
.
setMinimumHeight
(
25
f
);
labelCell
.
setHorizontalAlignment
(
Element
.
ALIGN_CENTER
);
mainTable
.
addCell
(
labelCell
);
// 创建复选框和文字组合
Phrase
checkboxPhrase
=
new
Phrase
();
if
(
Objects
.
nonNull
(
kpitDTO
.
getProjAttribute
()))
{
for
(
SystemParameter
param
:
projAttributeList
)
{
if
(
param
.
getId
().
toLowerCase
().
equals
(
kpitDTO
.
getProjAttribute
().
toLowerCase
()))
{
checkboxPhrase
.
add
(
new
Chunk
(
"R"
,
wingdng2Font
));
// 选中状态
}
else
{
checkboxPhrase
.
add
(
new
Chunk
(
"£"
,
wingdng2Font
));
// 未选中状态
}
checkboxPhrase
.
add
(
new
Chunk
(
" "
+
param
.
getName
()
+
" "
,
contentFont
));
// 使用中文字体显示文字
}
}
else
{
checkboxPhrase
.
add
(
new
Chunk
(
"£"
,
wingdng2Font
));
checkboxPhrase
.
add
(
new
Chunk
(
" 新增项目 "
,
contentFont
));
checkboxPhrase
.
add
(
new
Chunk
(
"£"
,
wingdng2Font
));
checkboxPhrase
.
add
(
new
Chunk
(
" 延续项目"
,
contentFont
));
}
PdfPCell
valueCell
=
new
PdfPCell
(
checkboxPhrase
);
valueCell
.
setMinimumHeight
(
25
f
);
valueCell
.
setColspan
(
2
);
mainTable
.
addCell
(
valueCell
);
// 项目期
addLabelValueRow
(
mainTable
,
"项目期"
,
kpitDTO
.
getProjDeadline
(),
1
,
titleFont
,
contentFont
);
// 项目资金(万元)标题行
PdfPCell
fundTitle
=
new
PdfPCell
(
new
Phrase
(
"项目资金\n(万元)"
,
titleFont
));
fundTitle
.
setRowspan
(
3
);
fundTitle
.
setVerticalAlignment
(
Element
.
ALIGN_MIDDLE
);
fundTitle
.
setHorizontalAlignment
(
Element
.
ALIGN_CENTER
);
mainTable
.
addCell
(
fundTitle
);
// 总体资金总额和年度资金总额
addLabelValueRow
(
mainTable
,
"总体资金总额"
,
kpitDTO
.
getTotalBudget
().
toString
(),
1
,
titleFont
,
contentFont
);
addLabelValueRow
(
mainTable
,
"年度资金总额"
,
kpitDTO
.
getYearTotal
().
toString
(),
1
,
titleFont
,
contentFont
);
// 其中:财政拨款(两行)
addLabelValueRow
(
mainTable
,
"其中:财政拨款"
,
kpitDTO
.
getApplyFunds
().
toString
(),
1
,
titleFont
,
contentFont
);
addLabelValueRow
(
mainTable
,
"其中:财政拨款"
,
kpitDTO
.
getYearApply
().
toString
(),
1
,
titleFont
,
contentFont
);
// 其他资金(两行)
addLabelValueRow
(
mainTable
,
"其他资金"
,
kpitDTO
.
getSelfFunds
().
toString
(),
1
,
titleFont
,
contentFont
);
addLabelValueRow
(
mainTable
,
"其他资金"
,
kpitDTO
.
getYearSelf
().
toString
(),
1
,
titleFont
,
contentFont
);
document
.
add
(
mainTable
);
// 总体考核目标
PdfPTable
middleTable
=
new
PdfPTable
(
5
);
middleTable
.
setWidthPercentage
(
98
);
float
[]
middleWidths
=
{
0.8f
,
3.2f
,
1
f
,
1
f
,
1
f
};
middleTable
.
setWidths
(
middleWidths
);
// 添加左侧标题单元格
PdfPCell
titleCell
=
new
PdfPCell
(
new
Phrase
(
"总体考核\n目标"
,
titleFont
));
titleCell
.
setRowspan
(
3
);
// 合并三行
titleCell
.
setVerticalAlignment
(
Element
.
ALIGN_MIDDLE
);
titleCell
.
setHorizontalAlignment
(
Element
.
ALIGN_CENTER
);
middleTable
.
addCell
(
titleCell
);
// 添加总体目标标题行
int
startYear
=
DateUtils
.
getDateYear
(
kpitDTO
.
getStartDate
());
int
endYear
=
DateUtils
.
getDateYear
(
kpitDTO
.
getEndDate
());
PdfPCell
totalTargetCell
=
new
PdfPCell
(
new
Phrase
(
"总体目标("
+
startYear
+
"年—"
+
endYear
+
"年)"
,
titleFont
));
totalTargetCell
.
setHorizontalAlignment
(
Element
.
ALIGN_CENTER
);
totalTargetCell
.
setMinimumHeight
(
25
f
);
middleTable
.
addCell
(
totalTargetCell
);
// 添加分年度指标标题行
PdfPCell
yearlyTitleCell
=
new
PdfPCell
(
new
Phrase
(
"分年度指标"
,
titleFont
));
yearlyTitleCell
.
setColspan
(
3
);
// 合并三列
yearlyTitleCell
.
setHorizontalAlignment
(
Element
.
ALIGN_CENTER
);
yearlyTitleCell
.
setMinimumHeight
(
25
f
);
middleTable
.
addCell
(
yearlyTitleCell
);
// 添加总体目标内容
PdfPCell
totalTargetContentCell
=
new
PdfPCell
(
new
Phrase
(
kpitDTO
.
getYearTarget
(),
contentFont
));
totalTargetContentCell
.
setRowspan
(
2
);
// 合并两行
totalTargetContentCell
.
setVerticalAlignment
(
Element
.
ALIGN_MIDDLE
);
totalTargetContentCell
.
setMinimumHeight
(
50
f
);
// 设置较大的高度以容纳多行内容
middleTable
.
addCell
(
totalTargetContentCell
);
// 添加年度标题行
for
(
int
i
=
0
;
i
<
3
;
i
++)
{
PdfPCell
yearCCell
=
new
PdfPCell
(
new
Phrase
((
startYear
+
i
)
+
"年"
,
titleFont
));
yearCCell
.
setHorizontalAlignment
(
Element
.
ALIGN_CENTER
);
yearCCell
.
setVerticalAlignment
(
Element
.
ALIGN_MIDDLE
);
yearCCell
.
setMinimumHeight
(
25
f
);
middleTable
.
addCell
(
yearCCell
);
}
// 添加年度内容
PdfPCell
yearContentCell
=
new
PdfPCell
(
new
Phrase
(
kpitDTO
.
getYear1Goal
(),
contentFont
));
yearContentCell
.
setMinimumHeight
(
50
f
);
yearContentCell
.
setVerticalAlignment
(
Element
.
ALIGN_MIDDLE
);
middleTable
.
addCell
(
yearContentCell
);
yearContentCell
=
new
PdfPCell
(
new
Phrase
(
kpitDTO
.
getYear2Goal
(),
contentFont
));
yearContentCell
.
setMinimumHeight
(
50
f
);
yearContentCell
.
setVerticalAlignment
(
Element
.
ALIGN_MIDDLE
);
middleTable
.
addCell
(
yearContentCell
);
yearContentCell
=
new
PdfPCell
(
new
Phrase
(
kpitDTO
.
getYear3Goal
(),
contentFont
));
yearContentCell
.
setMinimumHeight
(
50
f
);
yearContentCell
.
setVerticalAlignment
(
Element
.
ALIGN_MIDDLE
);
middleTable
.
addCell
(
yearContentCell
);
document
.
add
(
middleTable
);
addTargetDetailTable
(
document
,
kpitDTO
,
titleFont
,
contentFont
);
}
private
static
void
addTargetDetailTable
(
Document
document
,
ProjectKPIStatisticDTO
kpitDTO
,
Font
titleFont
,
Font
contentFont
)
throws
DocumentException
{
PdfPTable
detailTable
=
new
PdfPTable
(
11
);
detailTable
.
setWidthPercentage
(
98
);
float
[]
detailWidths
=
{
0.5f
,
0.5f
,
0.5f
,
1.5f
,
0.5f
,
0.5f
,
0.5f
,
1.5f
,
0.5f
,
0.5f
,
0.5f
};
detailTable
.
setWidths
(
detailWidths
);
//总考核目标
addTitleCell
(
detailTable
,
"总体考核目标"
,
0
,
kpitDTO
.
getTotalRowSpan
(),
titleFont
);
//一级指标
addTitleCell
(
detailTable
,
"一级指标"
,
0
,
2
,
titleFont
);
//二级指标
addTitleCell
(
detailTable
,
"二级指标"
,
0
,
2
,
titleFont
);
//三级指标
addTitleCell
(
detailTable
,
"三级指标"
,
0
,
2
,
titleFont
);
//指标值
addTitleCell
(
detailTable
,
"指标值"
,
0
,
2
,
titleFont
);
//绩效标准
addTitleCell
(
detailTable
,
"绩效标准"
,
0
,
2
,
titleFont
);
//二级指标
addTitleCell
(
detailTable
,
"二级指标"
,
0
,
2
,
titleFont
);
//三级指标
addTitleCell
(
detailTable
,
"三级指标"
,
0
,
2
,
titleFont
);
//指标值
addTitleCell
(
detailTable
,
"指标值"
,
3
,
0
,
titleFont
);
int
startYear
=
DateUtils
.
getDateYear
(
kpitDTO
.
getStartDate
());
addTitleCell
(
detailTable
,
startYear
+
"年"
,
0
,
0
,
contentFont
);
addTitleCell
(
detailTable
,
(
startYear
+
1
)
+
"年"
,
0
,
0
,
contentFont
);
addTitleCell
(
detailTable
,
(
startYear
+
2
)
+
"年"
,
0
,
0
,
contentFont
);
List
<
ComProjectKpitDTO
>
list
=
kpitDTO
.
getThreeLevel
();
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
ComProjectKpitDTO
model
=
list
.
get
(
i
);
if
(
model
.
getOneDisplay
())
addTitleCell
(
detailTable
,
model
.
getOneLevelName
(),
0
,
model
.
getOneRowSpan
(),
contentFont
);
if
(
model
.
getTowDisplay
())
addTitleCell
(
detailTable
,
model
.
getTowLevelName
(),
0
,
model
.
getTowRowSpan
(),
contentFont
);
addTitleCell
(
detailTable
,
model
.
getKpitName
(),
0
,
0
,
contentFont
);
addTitleCell
(
detailTable
,
model
.
getTargetValue
()
!=
null
?
model
.
getTargetValue
().
toString
()
:
""
,
0
,
0
,
contentFont
);
addTitleCell
(
detailTable
,
model
.
getPerformanceStandard
()
!=
null
?
model
.
getPerformanceStandard
().
toString
()
:
""
,
0
,
0
,
contentFont
);
if
(
model
.
getTowDisplay
())
addTitleCell
(
detailTable
,
model
.
getTowLevelName
(),
0
,
model
.
getTowRowSpan
(),
contentFont
);
addTitleCell
(
detailTable
,
model
.
getKpitName
(),
0
,
0
,
contentFont
);
addTitleCell
(
detailTable
,
model
.
getYearValue1
()
!=
null
?
model
.
getYearValue1
().
toString
()
:
""
,
0
,
0
,
contentFont
);
addTitleCell
(
detailTable
,
model
.
getYearValue2
()
!=
null
?
model
.
getYearValue2
().
toString
()
:
""
,
0
,
0
,
contentFont
);
addTitleCell
(
detailTable
,
model
.
getYearValue3
()
!=
null
?
model
.
getYearValue3
().
toString
()
:
""
,
0
,
0
,
contentFont
);
}
document
.
add
(
detailTable
);
}
private
static
void
addTitleCell
(
PdfPTable
detailTable
,
String
title
,
int
colSpan
,
int
rowSpan
,
Font
contentFont
)
{
PdfPCell
titleCell
=
new
PdfPCell
(
new
Phrase
(
title
,
contentFont
));
if
(
colSpan
>
1
)
titleCell
.
setColspan
(
colSpan
);
if
(
rowSpan
>
1
)
titleCell
.
setRowspan
(
rowSpan
);
titleCell
.
setVerticalAlignment
(
Element
.
ALIGN_MIDDLE
);
titleCell
.
setHorizontalAlignment
(
Element
.
ALIGN_CENTER
);
detailTable
.
addCell
(
titleCell
);
}
}
private
static
void
addFileTable
(
Document
document
,
ComProjectTaskDTO
dto
,
BaseFont
bfChinese
,
BaseFont
fsChinese
)
throws
DocumentException
{
private
static
void
addFileTable
(
Document
document
,
ComProjectTaskDTO
dto
,
BaseFont
bfChinese
,
BaseFont
fsChinese
)
throws
DocumentException
{
...
@@ -1201,6 +1432,21 @@ public class TaskInfoToPDFUtil {
...
@@ -1201,6 +1432,21 @@ public class TaskInfoToPDFUtil {
table
.
addCell
(
valueCell
);
table
.
addCell
(
valueCell
);
}
}
private
static
void
addLabelValueRow
(
PdfPTable
table
,
String
label
,
String
value
,
int
valueColspan
,
Font
titleFont
,
Font
contentFont
)
{
PdfPCell
labelCell
=
new
PdfPCell
(
new
Phrase
(
label
,
titleFont
));
labelCell
.
setMinimumHeight
(
25
f
);
labelCell
.
setVerticalAlignment
(
Element
.
ALIGN_MIDDLE
);
labelCell
.
setHorizontalAlignment
(
Element
.
ALIGN_CENTER
);
table
.
addCell
(
labelCell
);
PdfPCell
valueCell
=
new
PdfPCell
(
new
Phrase
(
value
!=
null
?
value
:
""
,
contentFont
));
valueCell
.
setMinimumHeight
(
25
f
);
valueCell
.
setVerticalAlignment
(
Element
.
ALIGN_MIDDLE
);
valueCell
.
setHorizontalAlignment
(
Element
.
ALIGN_LEFT
);
valueCell
.
setColspan
(
valueColspan
);
table
.
addCell
(
valueCell
);
}
private
static
void
addTableContentCell
(
PdfPTable
table
,
String
label
,
String
value
,
Integer
valueColspan
,
Font
font
,
Float
height
)
{
private
static
void
addTableContentCell
(
PdfPTable
table
,
String
label
,
String
value
,
Integer
valueColspan
,
Font
font
,
Float
height
)
{
if
(
Objects
.
isNull
(
height
))
if
(
Objects
.
isNull
(
height
))
height
=
25.5f
;
height
=
25.5f
;
...
...
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