Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vehicle-quality-review
Project
Project
Details
Activity
Releases
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
王飞
vehicle-quality-review
Commits
ddf91dea
Commit
ddf91dea
authored
Mar 12, 2024
by
wdy
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
http://gitlab.91isoft.com:90/wangfei/vehicle-quality-review
into wangdingyi
parents
524adab0
7cf48bec
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
72 additions
and
19 deletions
+72
-19
InspectionReportPdfVO.java
.../main/java/com/ruoyi/domain/vo/InspectionReportPdfVO.java
+6
-1
SampleTaskVo.java
...eview/src/main/java/com/ruoyi/domain/vo/SampleTaskVo.java
+10
-0
PdfTemplateManagementServiceImpl.java
.../ruoyi/service/impl/PdfTemplateManagementServiceImpl.java
+54
-16
SampleManagementMapper.xml
...view/src/main/resources/mapper/SampleManagementMapper.xml
+2
-2
receipt_template_02_27.pdf
...ew/src/main/resources/template/receipt_template_02_27.pdf
+0
-0
No files found.
quality-review/src/main/java/com/ruoyi/domain/vo/InspectionReportPdfVO.java
View file @
ddf91dea
...
...
@@ -131,7 +131,7 @@ public class InspectionReportPdfVO {
private
String
taskNumber
;
/**
*
*
样品数量
*/
private
String
sampleSum
;
...
...
@@ -140,6 +140,11 @@ public class InspectionReportPdfVO {
*/
private
String
vehicleType
;
/**
* 车辆型号
*/
private
String
vehicleModel
;
/**
* 车辆识别码
*/
...
...
quality-review/src/main/java/com/ruoyi/domain/vo/SampleTaskVo.java
View file @
ddf91dea
package
com
.
ruoyi
.
domain
.
vo
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModel
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
...
...
@@ -12,7 +15,14 @@ import java.util.List;
@NoArgsConstructor
@Data
public
class
SampleTaskVo
{
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
)
private
Long
taskId
;
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
)
private
Long
SampleId
;
private
String
taskNo
;
}
quality-review/src/main/java/com/ruoyi/service/impl/PdfTemplateManagementServiceImpl.java
View file @
ddf91dea
...
...
@@ -5,7 +5,7 @@ import com.itextpdf.text.pdf.*;
import
com.ruoyi.common.utils.DateUtils
;
import
com.ruoyi.common.utils.PdfBaseWriter
;
import
com.ruoyi.common.utils.StringUtils
;
import
com.ruoyi.domain.vo.
PhotoStorage
VO
;
import
com.ruoyi.domain.vo.
InspectionReportPdf
VO
;
import
com.ruoyi.domain.vo.ReviewEnterpriseArchiveViewVO
;
import
com.ruoyi.service.PdfTemplateManagementService
;
import
com.ruoyi.service.ReviewEnterpriseArchiveService
;
...
...
@@ -76,23 +76,15 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
BaseFont
bf
=
BaseFont
.
createFont
(
"STSongStd-Light"
,
"UniGB-UCS2-H"
,
BaseFont
.
NOT_EMBEDDED
);
fields
.
addSubstitutionFont
(
bf
);
// 渲染
// fillData(fields, map, ps);
renderData
(
fields
);
// 测试数据
InspectionReportPdfVO
inspectionReportPdfVO
=
requireData
();
PhotoStorageVO
photoStorageVO
=
new
PhotoStorageVO
();
Class
<?
extends
PhotoStorageVO
>
aClass
=
photoStorageVO
.
getClass
();
Field
[]
declaredFields
=
aClass
.
getDeclaredFields
();
for
(
Field
field
:
declaredFields
)
{
String
name
=
field
.
getName
();
System
.
out
.
println
(
name
);
}
// 渲染数据
renderData
(
fields
,
inspectionReportPdfVO
);
//必须要调用这个,否则文档不会生成的
ps
.
setFormFlattening
(
true
);
if
(
ps
!=
null
){
ps
.
close
();
}
ps
.
close
();
//生成pdf路径存放的路径
fos
=
response
.
getOutputStream
();
fos
.
write
(
bos
.
toByteArray
());
...
...
@@ -113,6 +105,40 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
}
}
private
InspectionReportPdfVO
requireData
()
{
InspectionReportPdfVO
inspectionReportPdfVO
=
InspectionReportPdfVO
.
builder
()
.
reportNumber
(
"报告编号"
)
.
productName
(
"产品名称"
)
.
productModel
(
"产品型号"
)
.
entrustedUnit
(
"委托单位"
)
.
inspectionCenterName
(
"检验中心名称"
)
.
inspectionCenterAddress
(
"检验中心地址"
)
.
inspectionCenterTelephone
(
"检验中心电话"
)
.
inspectionCenterPostcode
(
"检验中心邮编"
)
.
clientAddress
(
"委托单位地址"
)
.
entrustedUnitTelephone
(
"委托单位电话"
)
.
clientPostalCode
(
"委托单位邮编"
)
.
sampleName
(
"样品名称"
)
.
typeSpecification
(
"型号规格"
)
.
productionEnterprise
(
"生产企业"
)
.
sampleSender
(
"送养着"
)
.
sampleDeliveryDate
(
"送样日期"
)
.
sampleQuantity
(
"样品数量"
)
.
productionDate
(
"生产日期"
)
.
inspectionItem
(
"检验项目"
)
.
testConclusion
(
"检验结论"
)
.
issueDate
(
"签发日期"
)
.
remark
(
"备注"
)
.
taskNumber
(
"任务编号"
)
.
sampleSum
(
"样品数量"
)
.
vehicleType
(
"车俩类型"
)
.
vehicleModel
(
"车辆型号"
)
.
vehicleIdentificationNumber
(
"车辆识别码"
)
.
sampleNumberSummary
(
"样品编号汇总"
)
.
build
();
return
inspectionReportPdfVO
;
}
/**
* 企业留档文件PDF下载
* @param taskId
...
...
@@ -213,8 +239,20 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
* 渲染数据
* @param fields
*/
private
void
renderData
(
AcroFields
fields
)
{
private
void
renderData
(
AcroFields
fields
,
InspectionReportPdfVO
inspectionReportPdfVO
)
throws
Exception
{
// 取出当前对象所有属性,并赋值到模板里
Class
<?
extends
InspectionReportPdfVO
>
aClass
=
inspectionReportPdfVO
.
getClass
();
Field
[]
declaredFields
=
aClass
.
getDeclaredFields
();
for
(
Field
field
:
declaredFields
)
{
String
name
=
field
.
getName
();
String
key
=
name
.
replaceAll
(
"([a-z])([A-Z])"
,
"$1_$2"
).
toLowerCase
();
field
.
setAccessible
(
true
);
Object
o
=
field
.
get
(
inspectionReportPdfVO
);
if
(
o
!=
null
)
{
String
value
=
o
.
toString
();
fields
.
setField
(
key
,
value
);
}
}
}
...
...
quality-review/src/main/resources/mapper/SampleManagementMapper.xml
View file @
ddf91dea
...
...
@@ -172,8 +172,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"sampleName"
column=
"sample_name"
/>
<result
property=
"enterpriseId"
column=
"enterprise_id"
/>
</resultMap>
<select
id=
"findByIdList"
resultMap=
"Sample
ListResponse
"
>
select id,identification_code,sample_number,sample_name,enterprise_id from t_sample
<select
id=
"findByIdList"
resultMap=
"Sample
ManagementResult
"
>
select id,identification_code,sample_number,sample_name,enterprise_id
,trademark,sample_photos,number_of_samples,delivery_date,sample_sender,manufacturing_enterprise,manufacture_date
from t_sample
WHERE id IN
<foreach
collection=
"relationList"
item=
"relation"
open=
"("
separator=
","
close=
")"
>
#{relation.sampleId}
...
...
quality-review/src/main/resources/template/receipt_template_02_27.pdf
View file @
ddf91dea
No preview for this file type
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