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
4ff42940
Commit
4ff42940
authored
Apr 11, 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
8141ead7
7b77963f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
109 additions
and
7 deletions
+109
-7
PdfTemplateManagementService.java
.../java/com/ruoyi/service/PdfTemplateManagementService.java
+8
-0
PdfTemplateManagementServiceImpl.java
.../ruoyi/service/impl/PdfTemplateManagementServiceImpl.java
+33
-0
StrategyModelTestTaskPending.java
.../com/ruoyi/service/impl/StrategyModelTestTaskPending.java
+64
-6
PdfTemplateManagementController.java
...n/java/com/ruoyi/web/PdfTemplateManagementController.java
+4
-1
No files found.
quality-review/src/main/java/com/ruoyi/service/PdfTemplateManagementService.java
View file @
4ff42940
...
...
@@ -22,4 +22,12 @@ public interface PdfTemplateManagementService {
* @throws Exception
*/
String
generateRetentionFile
(
Long
taskId
)
throws
Exception
;
/**
* 原始记录PDF下载
* @param taskId
* @return
*/
String
generateOriginalRecord
(
Long
taskId
);
}
quality-review/src/main/java/com/ruoyi/service/impl/PdfTemplateManagementServiceImpl.java
View file @
4ff42940
...
...
@@ -259,6 +259,39 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
return
uploadMinio
(
outputStream
,
"企业留档文件-"
+
getReportName
());
}
/**
* 原始记录PDF下载
* @param taskId
* @return
*/
@Override
public
String
generateOriginalRecord
(
Long
taskId
)
{
return
null
;
}
public
static
class
OriginalRecordHeaderFooter
extends
PdfPageEventHelper
{
// 一页加载完成触发,写入页眉和页脚
@Override
public
void
onEndPage
(
PdfWriter
writer
,
Document
document
)
{
PdfPTable
table
=
new
PdfPTable
(
2
);
try
{
table
.
setTotalWidth
(
PageSize
.
A4
.
getWidth
()
-
80
);
table
.
setWidths
(
new
int
[]
{
40
,
40
});
table
.
setLockedWidth
(
true
);
table
.
getDefaultCell
().
setFixedHeight
(-
10
);
table
.
getDefaultCell
().
setBorder
(
Rectangle
.
BOTTOM
);
table
.
getDefaultCell
().
setBorderWidth
(
0.6f
);
BaseFont
font
=
BaseFont
.
createFont
(
"/fonts/STSong.TTF"
,
BaseFont
.
IDENTITY_H
,
BaseFont
.
EMBEDDED
);
table
.
addCell
(
new
Paragraph
(
headerText
,
new
Font
(
font
)));
// 可以直接使用addCell(str),不过不能指定字体,中文无法显示
// 将页眉写到document中,位置可以指定,指定到下面就是页脚
table
.
writeSelectedRows
(
0
,
-
1
,
40
,
PageSize
.
A4
.
getHeight
()
-
20
,
writer
.
getDirectContent
());
}
catch
(
Exception
de
)
{
throw
new
ExceptionConverter
(
de
);
}
}
}
private
static
String
headerText
;
public
static
class
MyHeaderFooter
extends
PdfPageEventHelper
{
...
...
quality-review/src/main/java/com/ruoyi/service/impl/StrategyModelTestTaskPending.java
View file @
4ff42940
package
com
.
ruoyi
.
service
.
impl
;
import
cn.hutool.core.collection.CollUtil
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.ruoyi.common.constant.HttpStatus
;
import
com.ruoyi.common.exception.ServiceException
;
import
com.ruoyi.domain.ModelTestTask
;
import
com.ruoyi.mapper.ModelTestTaskMapper
;
import
com.ruoyi.service.StrategyModelTestTask
;
import
com.ruoyi.service.TestUseCaseService
;
import
com.ruoyi.web.response.ModelTestResponse
;
import
lombok.Data
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.ApplicationContext
;
...
...
@@ -14,7 +18,9 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.concurrent.atomic.AtomicReference
;
@Service
@Transactional
...
...
@@ -32,6 +38,11 @@ public class StrategyModelTestTaskPending implements StrategyModelTestTask, Init
@Autowired
private
StrategyModelTestTaskNew
strategyModelTestTaskNew
;
@Autowired
private
TestUseCaseService
testUseCaseService
;
private
static
String
url
=
"https://10.12.48.78:8090/DescribeProjectTestResult"
;
@Override
public
ModelTestResponse
doView
(
ModelTestTask
modelTestTask
)
{
ModelTestResponse
response
=
strategyModelTestTaskNew
.
getTestScheme
(
modelTestTask
);
...
...
@@ -45,12 +56,31 @@ public class StrategyModelTestTaskPending implements StrategyModelTestTask, Init
@Override
public
void
doConfirmTest
(
ModelTestTask
modelTestTask
)
{
// 进行中的任务, 点击确认后, 状态改为待签字
modelTestTaskMapper
.
update
(
new
ModelTestTask
(),
new
LambdaUpdateWrapper
<
ModelTestTask
>()
.
set
(
ModelTestTask:
:
getTaskEndTime
,
new
Date
())
.
set
(
ModelTestTask:
:
getTaskStatus
,
ModelTestTask
.
TASK_STATUS_SIGNED
)
.
eq
(
ModelTestTask:
:
getId
,
modelTestTask
.
getId
()));
// 查看当前任务-用例完成情况
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"id"
,
modelTestTask
.
getTestSchemeId
());
map
.
put
(
"verbose"
,
"BASIC"
);
JSONObject
jsonObject
=
testUseCaseService
.
callThirdPartyInterface
(
url
,
map
);
Integer
sumCount
=
(
Integer
)
jsonObject
.
get
(
"case_count"
);
AtomicReference
<
Integer
>
currentCount
=
new
AtomicReference
<>(
0
);
List
<
CaseStatistics
>
caseStatisticsList
=
jsonObject
.
getList
(
"case_statistics"
,
CaseStatistics
.
class
);
if
(
CollUtil
.
isNotEmpty
(
caseStatisticsList
))
{
caseStatisticsList
.
forEach
(
obj
->
{
if
(
CaseStatistics
.
CASE_STATUS_FAILED
.
equals
(
obj
.
status
)
||
CaseStatistics
.
CASE_STATUS_PASSED
.
equals
(
obj
.
status
))
{
currentCount
.
updateAndGet
(
v
->
v
+
obj
.
getCount
());
}
});
}
Integer
integer
=
currentCount
.
get
();
System
.
out
.
println
(
integer
);
// 进行中的任务, 点击返回后, 判断当前用例完成程度, 用例都完成后状态改为待签字
if
(
sumCount
.
equals
(
currentCount
.
get
()))
{
modelTestTaskMapper
.
update
(
new
ModelTestTask
(),
new
LambdaUpdateWrapper
<
ModelTestTask
>()
.
set
(
ModelTestTask:
:
getTaskEndTime
,
new
Date
())
.
set
(
ModelTestTask:
:
getTaskStatus
,
ModelTestTask
.
TASK_STATUS_SIGNED
)
.
eq
(
ModelTestTask:
:
getId
,
modelTestTask
.
getId
()));
}
}
@Override
...
...
@@ -62,4 +92,32 @@ public class StrategyModelTestTaskPending implements StrategyModelTestTask, Init
public
void
afterPropertiesSet
()
throws
Exception
{
strategyModelTestTaskContext
.
putResource
(
ModelTestTask
.
TASK_STATUS_PENDING
,
applicationContext
.
getBean
(
this
.
getClass
()));
}
/**
* 接参DTO
*/
@Data
public
class
CaseStatistics
{
/**
* 通过
*/
private
static
final
String
CASE_STATUS_PASSED
=
"PASSED"
;
/**
* 失败
*/
private
static
final
String
CASE_STATUS_FAILED
=
"FAILED"
;
/**
* 数量
*/
private
Integer
count
;
/**
* 状态
*/
private
String
status
;
}
}
quality-review/src/main/java/com/ruoyi/web/PdfTemplateManagementController.java
View file @
4ff42940
...
...
@@ -100,6 +100,8 @@ public class PdfTemplateManagementController {
url
=
task
.
getModelTestUrl
();
if
(
StrUtil
.
isBlank
(
url
))
{
// TODO 生成车型
url
=
pdfTemplateManagementService
.
generateOriginalRecord
(
request
.
getTaskId
());
taskService
.
update
(
new
UpdateWrapper
<
Task
>().
lambda
().
eq
(
Task:
:
getId
,
request
.
getTaskId
()).
set
(
Task:
:
getModelTestTaskId
,
url
));
}
break
;
default
:
...
...
@@ -136,7 +138,8 @@ public class PdfTemplateManagementController {
break
;
case
2
:
// 更新
// TODO 更新车型
url
=
pdfTemplateManagementService
.
generateOriginalRecord
(
request
.
getTaskId
());
taskService
.
update
(
new
UpdateWrapper
<
Task
>().
lambda
().
eq
(
Task:
:
getId
,
request
.
getTaskId
()).
set
(
Task:
:
getModelTestTaskId
,
url
));
break
;
default
:
break
;
...
...
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