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
07ec99a8
Commit
07ec99a8
authored
Mar 27, 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
1fb3b15e
2f682d97
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
230 additions
and
11 deletions
+230
-11
InspectionReportPdfVO.java
.../main/java/com/ruoyi/domain/vo/InspectionReportPdfVO.java
+5
-0
QuantityStatisticsVO.java
...c/main/java/com/ruoyi/domain/vo/QuantityStatisticsVO.java
+46
-0
StandardCategoryStatisticsVO.java
...ava/com/ruoyi/domain/vo/StandardCategoryStatisticsVO.java
+20
-0
StatisticsHomeMapper.java
.../src/main/java/com/ruoyi/mapper/StatisticsHomeMapper.java
+17
-0
StatisticsHomeService.java
...rc/main/java/com/ruoyi/service/StatisticsHomeService.java
+14
-0
PdfTemplateManagementServiceImpl.java
.../ruoyi/service/impl/PdfTemplateManagementServiceImpl.java
+22
-8
StatisticsHomeServiceImpl.java
...ava/com/ruoyi/service/impl/StatisticsHomeServiceImpl.java
+28
-0
StatisticsHomeController.java
...src/main/java/com/ruoyi/web/StatisticsHomeController.java
+35
-0
StatisticsHomeMapper.xml
...review/src/main/resources/mapper/StatisticsHomeMapper.xml
+39
-0
TaskMapper.xml
quality-review/src/main/resources/mapper/TaskMapper.xml
+4
-3
receipt_template_03_27.pdf
...ew/src/main/resources/template/receipt_template_03_27.pdf
+0
-0
No files found.
quality-review/src/main/java/com/ruoyi/domain/vo/InspectionReportPdfVO.java
View file @
07ec99a8
...
...
@@ -160,4 +160,9 @@ public class InspectionReportPdfVO {
*/
private
String
sampleNumberSummary
;
/**
* 品牌图片
*/
private
String
brandImage
;
}
quality-review/src/main/java/com/ruoyi/domain/vo/QuantityStatisticsVO.java
0 → 100644
View file @
07ec99a8
package
com
.
ruoyi
.
domain
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel
(
value
=
"首页数量统计"
)
public
class
QuantityStatisticsVO
{
@ApiModelProperty
(
"支持标准数量"
)
private
Long
standardQuantity
;
@ApiModelProperty
(
"测试用例数量"
)
private
Long
numberUseCases
;
@ApiModelProperty
(
"任务数量"
)
private
Long
numberTasks
;
@ApiModelProperty
(
"检验报告数量"
)
private
Long
numberReports
;
@ApiModelProperty
(
"检验员数量"
)
private
Long
numberInspectors
;
@ApiModelProperty
(
"车企数量"
)
private
Long
numberCompanies
;
@ApiModelProperty
(
"整车样品数量"
)
private
Long
numberVehicleSamples
;
@ApiModelProperty
(
"零部件样品数量"
)
private
Long
numberComponentSamples
;
@ApiModelProperty
(
"测试方法数量"
)
private
Long
numberMethods
;
@ApiModelProperty
(
"场景数量"
)
private
Long
numberScenes
;
}
quality-review/src/main/java/com/ruoyi/domain/vo/StandardCategoryStatisticsVO.java
0 → 100644
View file @
07ec99a8
package
com
.
ruoyi
.
domain
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel
(
value
=
"首页标准类别统计"
)
public
class
StandardCategoryStatisticsVO
{
@ApiModelProperty
(
"类别数量"
)
private
Long
value
;
@ApiModelProperty
(
"类别名称"
)
private
String
name
;
}
quality-review/src/main/java/com/ruoyi/mapper/StatisticsHomeMapper.java
0 → 100644
View file @
07ec99a8
package
com
.
ruoyi
.
mapper
;
import
com.ruoyi.domain.vo.QuantityStatisticsVO
;
import
com.ruoyi.domain.vo.StandardCategoryStatisticsVO
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
@Repository
public
interface
StatisticsHomeMapper
{
// 数量统计
public
QuantityStatisticsVO
selectQuantityStatistics
(
QuantityStatisticsVO
quantityStatisticsHome
);
// 标准类别统计
public
List
<
StandardCategoryStatisticsVO
>
selectStandardCategoryStatistics
();
}
quality-review/src/main/java/com/ruoyi/service/StatisticsHomeService.java
0 → 100644
View file @
07ec99a8
package
com
.
ruoyi
.
service
;
import
com.ruoyi.domain.vo.QuantityStatisticsVO
;
import
com.ruoyi.domain.vo.StandardCategoryStatisticsVO
;
import
java.util.List
;
public
interface
StatisticsHomeService
{
// 数量统计
public
QuantityStatisticsVO
selectQuantityStatistics
(
QuantityStatisticsVO
quantityStatisticsHome
);
// 标准类别统计
public
List
<
StandardCategoryStatisticsVO
>
selectStandardCategoryStatistics
();
}
quality-review/src/main/java/com/ruoyi/service/impl/PdfTemplateManagementServiceImpl.java
View file @
07ec99a8
package
com
.
ruoyi
.
service
.
impl
;
import
cn.hutool.core.util.StrUtil
;
import
com.itextpdf.text.*
;
import
com.itextpdf.text.pdf.*
;
import
com.ruoyi.common.core.domain.entity.SysDictData
;
...
...
@@ -70,26 +71,24 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
ByteArrayOutputStream
bos
=
null
;
try
{
// 模板绝对路径--服务器
String
fileName
=
"/template/receipt_template_0
2
_27.pdf"
;
String
fileName
=
"/template/receipt_template_0
3
_27.pdf"
;
// 读取现有模板内容
reader
=
new
PdfReader
(
fileName
);
// 创建输出流
bos
=
new
ByteArrayOutputStream
();
// 实例化PdfStamper准备编辑pdf内容
ps
=
new
PdfStamper
(
reader
,
bos
);
// 获取表单所有元素
AcroFields
fields
=
ps
.
getAcroFields
();
// 设置具体字体格式的编码, 不设置的话中文可能不会显示
BaseFont
bf
=
BaseFont
.
createFont
(
"STSongStd-Light"
,
"UniGB-UCS2-H"
,
BaseFont
.
NOT_EMBEDDED
);
fields
.
addSubstitutionFont
(
bf
);
// 测试数据
InspectionReportPdfVO
inspectionReportPdfVO
=
requireData
(
taskId
);
// 渲染数据
renderData
(
fields
,
inspectionReportPdfVO
);
renderData
(
fields
,
inspectionReportPdfVO
,
ps
);
//必须要调用这个,否则文档不会生成的
ps
.
setFormFlattening
(
true
);
...
...
@@ -106,7 +105,12 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
}
}
assert
bos
!=
null
;
return
uploadMinio
(
bos
,
"检验报告_"
+
taskId
);
// 名字
return
uploadMinio
(
bos
,
"整车信息安全检验报告-"
+
getReportName
());
}
private
String
getReportName
()
{
return
DateUtils
.
parseDateToStr
(
"yyyyMMddHHmm"
,
new
Date
());
}
/**
...
...
@@ -172,7 +176,7 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
document
.
close
();
// 上传到Minio
return
uploadMinio
(
outputStream
,
"企业留档文件
_"
+
taskId
);
return
uploadMinio
(
outputStream
,
"企业留档文件
-"
+
getReportName
()
);
}
/**
...
...
@@ -252,8 +256,9 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
* 渲染数据
* @param fields
*/
private
void
renderData
(
AcroFields
fields
,
InspectionReportPdfVO
inspectionReportPdfVO
)
throws
Exception
{
private
void
renderData
(
AcroFields
fields
,
InspectionReportPdfVO
inspectionReportPdfVO
,
PdfStamper
ps
)
throws
Exception
{
// 取出当前对象所有属性,并赋值到模板里
// 文本域
Class
<?
extends
InspectionReportPdfVO
>
aClass
=
inspectionReportPdfVO
.
getClass
();
Field
[]
declaredFields
=
aClass
.
getDeclaredFields
();
for
(
Field
field
:
declaredFields
)
{
...
...
@@ -266,6 +271,15 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
fields
.
setField
(
key
,
value
);
}
}
// 图片域
// 样品
String
url
=
inspectionReportPdfVO
.
getBrandImage
();
if
(
StrUtil
.
isNotBlank
(
url
))
{
if
(
url
.
startsWith
(
","
))
{
url
=
inspectionReportPdfVO
.
getBrandImage
().
substring
(
1
);
}
addImageToPdf
(
"brand"
,
fields
,
ps
,
"http://49.232.167.247:22038"
+
url
.
split
(
","
)[
0
]);
}
}
...
...
@@ -314,7 +328,7 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
// 获取操作的页面
PdfContentByte
under
=
stamper
.
getOverContent
(
pageNo
);
// 根据域的大小缩放图片
image
.
scaleToFit
(
signRect
.
getWidth
()
*
2
,
signRect
.
getHeight
());
image
.
scaleToFit
(
signRect
.
getWidth
(),
signRect
.
getHeight
());
// 添加图片并设置位置(个人通过此设置使得图片垂直水平居中,可参考,具体情况已实际为准)
image
.
setAbsolutePosition
(
x
,
y
);
under
.
addImage
(
image
);
...
...
quality-review/src/main/java/com/ruoyi/service/impl/StatisticsHomeServiceImpl.java
0 → 100644
View file @
07ec99a8
package
com
.
ruoyi
.
service
.
impl
;
import
com.ruoyi.domain.vo.QuantityStatisticsVO
;
import
com.ruoyi.domain.vo.StandardCategoryStatisticsVO
;
import
com.ruoyi.mapper.StatisticsHomeMapper
;
import
com.ruoyi.service.StatisticsHomeService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
@Service
@Transactional
public
class
StatisticsHomeServiceImpl
implements
StatisticsHomeService
{
@Autowired
private
StatisticsHomeMapper
statisticsHomeMapper
;
@Override
public
QuantityStatisticsVO
selectQuantityStatistics
(
QuantityStatisticsVO
quantityStatisticsHome
){
return
statisticsHomeMapper
.
selectQuantityStatistics
(
quantityStatisticsHome
);
}
@Override
public
List
<
StandardCategoryStatisticsVO
>
selectStandardCategoryStatistics
(){
return
statisticsHomeMapper
.
selectStandardCategoryStatistics
();
}
}
quality-review/src/main/java/com/ruoyi/web/StatisticsHomeController.java
0 → 100644
View file @
07ec99a8
package
com
.
ruoyi
.
web
;
import
com.ruoyi.common.core.domain.R
;
import
com.ruoyi.domain.vo.QuantityStatisticsVO
;
import
com.ruoyi.domain.vo.StandardCategoryStatisticsVO
;
import
com.ruoyi.service.StatisticsHomeService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
@Api
(
tags
=
{
"首页统计"
})
@RestController
@RequestMapping
(
"/home/statistics"
)
public
class
StatisticsHomeController
{
@Autowired
private
StatisticsHomeService
statisticsHomeService
;
@ApiOperation
(
"首页数量统计"
)
@PostMapping
(
"/quantityStatistics"
)
public
R
<
QuantityStatisticsVO
>
selectQuantityStatistics
(
@Validated
@RequestBody
QuantityStatisticsVO
quantityStatisticsHome
){
return
R
.
ok
(
statisticsHomeService
.
selectQuantityStatistics
(
quantityStatisticsHome
));
}
@ApiOperation
(
"首页标准分类占比"
)
@PostMapping
(
"/standardCategory"
)
public
R
<
List
<
StandardCategoryStatisticsVO
>>
selectStandardCategoryStatistics
(){
return
R
.
ok
(
statisticsHomeService
.
selectStandardCategoryStatistics
());
}
}
quality-review/src/main/resources/mapper/StatisticsHomeMapper.xml
0 → 100644
View file @
07ec99a8
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.ruoyi.mapper.StatisticsHomeMapper"
>
<select
id=
"selectQuantityStatistics"
resultType=
"com.ruoyi.domain.vo.QuantityStatisticsVO"
parameterType=
"com.ruoyi.domain.vo.QuantityStatisticsVO"
>
SELECT
( SELECT count( id ) FROM t_standard ) AS standardQuantity,
( SELECT count( id ) FROM t_test_usecase ) AS numberUseCases,
( SELECT count( id ) FROM t_task ) AS numberTasks,
( SELECT count( id ) FROM t_automobile_enterprise WHERE deleted = 0 ) AS numberCompanies,
(
SELECT
count( su.user_id )
FROM
sys_user su
LEFT JOIN sys_user_role sur ON sur.user_id = su.user_id
WHERE
sur.role_id = 106
) AS numberInspectors,
( SELECT count( id ) FROM t_sample WHERE flag = '0' AND deleted = 0 ) AS numberVehicleSamples,
( SELECT count( id ) FROM t_sample WHERE flag = '1' AND deleted = 0 ) AS numberComponentSamples,
( SELECT count( id ) FROM t_test_scenario ) AS numberScenes,
( SELECT count( id ) FROM t_test_type ) AS numberMethods,
( SELECT count( id ) FROM t_task WHERE vehicle_information_url IS NOT NULL ) AS numberReports
</select>
<select
id=
"selectStandardCategoryStatistics"
resultType=
"com.ruoyi.domain.vo.StandardCategoryStatisticsVO"
>
SELECT
count( id ) AS value,
standard_type AS name
FROM
t_standard
GROUP BY
standard_type
</select>
</mapper>
\ No newline at end of file
quality-review/src/main/resources/mapper/TaskMapper.xml
View file @
07ec99a8
...
...
@@ -311,14 +311,15 @@
GROUP_CONCAT(distinct s.sample_sender) AS sampleSender,
GROUP_CONCAT(distinct DATE_FORMAT(s.delivery_date, '%Y-%m-%d')) AS sampleDeliveryDate,
count(s.id) AS sampleQuantity,
sum(s.number_of_samples
) AS sampleSum,
CONVERT(sum(s.number_of_samples), UNSIGNED
) AS sampleSum,
GROUP_CONCAT(distinct DATE_FORMAT(s.manufacture_date, '%Y-%m-%d')) AS sampleDeliveryDate,
t.product_model AS vehicle
Type
,
t.product_model AS vehicle
Model
,
t.id AS taskNumber,
GROUP_CONCAT(distinct s.sample_number) AS sampleNumberSummary,
GROUP_CONCAT(distinct s.identification_code) AS vehicleIdentificationNumber,
t.task_list AS inspectionItem,
DATE_FORMAT(t.create_time, '%Y-%m-%d') AS productionDate
DATE_FORMAT(t.create_time, '%Y-%m-%d') AS productionDate,
GROUP_CONCAT(distinct s.trademark) AS brandImage
from
t_task t
left join t_task_sample_relation tsr on t.id = tsr.task_id
...
...
quality-review/src/main/resources/template/receipt_template_0
2
_27.pdf
→
quality-review/src/main/resources/template/receipt_template_0
3
_27.pdf
View file @
07ec99a8
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