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
e3e3d842
Commit
e3e3d842
authored
1 year ago
by
wdy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
定时任务
parent
0da67341
dev
gaixiankang
gaoying
master
songyuanshuo
wangdingyi
wangfei
19.0
18.0
17.0
16.0
15.0
14.0
13.0
12.0
11.0
10.0
9.0
8.0
7.0
6.0
5.0
4.0
3.0
2.0
1.0
2 merge requests
!292
Dev - master 6.0
,
!289
定时任务
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
4 deletions
+38
-4
TestRecordsServiceImpl.java
...n/java/com/ruoyi/service/impl/TestRecordsServiceImpl.java
+38
-4
No files found.
quality-review/src/main/java/com/ruoyi/service/impl/TestRecordsServiceImpl.java
View file @
e3e3d842
...
@@ -9,6 +9,11 @@ import com.ruoyi.domain.vo.CaseResultVO;
...
@@ -9,6 +9,11 @@ import com.ruoyi.domain.vo.CaseResultVO;
import
com.ruoyi.domain.vo.StepResultVO
;
import
com.ruoyi.domain.vo.StepResultVO
;
import
com.ruoyi.mapper.TestRecordsMapper
;
import
com.ruoyi.mapper.TestRecordsMapper
;
import
com.ruoyi.service.TestRecordsService
;
import
com.ruoyi.service.TestRecordsService
;
import
org.commonmark.node.Node
;
import
org.commonmark.parser.Parser
;
import
org.commonmark.renderer.html.HtmlRenderer
;
import
org.jsoup.Jsoup
;
import
org.jsoup.nodes.Entities
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
...
@@ -88,6 +93,7 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR
...
@@ -88,6 +93,7 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR
List
<
String
>
stepList
=
new
ArrayList
<>();
List
<
String
>
stepList
=
new
ArrayList
<>();
List
<
String
>
testDetailsList
=
new
ArrayList
<>();
List
<
String
>
testDetailsList
=
new
ArrayList
<>();
int
index
=
1
;
// 序号从1开始
int
index
=
1
;
// 序号从1开始
String
testDetailsVO
=
""
;
for
(
StepResultVO
stepResultVO
:
stepResultVOS
)
{
for
(
StepResultVO
stepResultVO
:
stepResultVOS
)
{
// 测试方法
// 测试方法
String
stepName
=
stepResultVO
.
getName
();
String
stepName
=
stepResultVO
.
getName
();
...
@@ -100,10 +106,14 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR
...
@@ -100,10 +106,14 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR
// 测试详情
// 测试详情
String
testDetails
=
stepResultVO
.
getDescription
();
String
testDetails
=
stepResultVO
.
getDescription
();
testDetailsList
.
add
(
testDetails
);
if
(
testDetails
!=
null
)
{
convertMarkdownToHtml
(
testDetails
);
}
}
testDetailsVO
+=
testDetails
+
"`"
;
}
testDetailsVO
=
testDetailsVO
.
substring
(
0
,
testDetailsVO
.
length
()
-
1
);
testRecords
.
setTestMethod
(
StringUtils
.
join
(
stepList
,
"`"
));
testRecords
.
setTestMethod
(
StringUtils
.
join
(
stepList
,
"`"
));
testRecords
.
setTestDetails
(
StringUtils
.
join
(
testDetailsList
,
"\n"
)
);
testRecords
.
setTestDetails
(
testDetailsVO
);
}
}
list
.
add
(
testRecords
);
list
.
add
(
testRecords
);
...
@@ -161,6 +171,7 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR
...
@@ -161,6 +171,7 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR
List
<
String
>
stepList
=
new
ArrayList
<>();
List
<
String
>
stepList
=
new
ArrayList
<>();
List
<
String
>
testDetailsList
=
new
ArrayList
<>();
List
<
String
>
testDetailsList
=
new
ArrayList
<>();
int
index
=
1
;
// 序号从1开始
int
index
=
1
;
// 序号从1开始
String
testDetailsVO
=
""
;
for
(
StepResultVO
stepResultVO
:
stepResultVOS
)
{
for
(
StepResultVO
stepResultVO
:
stepResultVOS
)
{
// 测试方法
// 测试方法
String
stepName
=
stepResultVO
.
getName
();
String
stepName
=
stepResultVO
.
getName
();
...
@@ -173,10 +184,14 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR
...
@@ -173,10 +184,14 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR
// 测试详情
// 测试详情
String
testDetails
=
stepResultVO
.
getDescription
();
String
testDetails
=
stepResultVO
.
getDescription
();
testDetailsList
.
add
(
testDetails
);
if
(
testDetails
!=
null
)
{
convertMarkdownToHtml
(
testDetails
);
}
testDetailsVO
+=
testDetails
+
"`"
;
}
}
testDetailsVO
=
testDetailsVO
.
substring
(
0
,
testDetailsVO
.
length
()
-
1
);
testRecords
.
setTestMethod
(
StringUtils
.
join
(
stepList
,
"`"
));
testRecords
.
setTestMethod
(
StringUtils
.
join
(
stepList
,
"`"
));
testRecords
.
setTestDetails
(
StringUtils
.
join
(
testDetailsList
,
"\n"
)
);
testRecords
.
setTestDetails
(
testDetailsVO
);
}
}
list
.
add
(
testRecords
);
list
.
add
(
testRecords
);
...
@@ -189,6 +204,25 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR
...
@@ -189,6 +204,25 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR
}
}
}
}
public
static
String
convertMarkdownToHtml
(
String
markdownContent
)
{
// 创建 Markdown 解析器
Parser
parser
=
Parser
.
builder
().
build
();
// 解析 Markdown
Node
document
=
parser
.
parse
(
markdownContent
);
// 创建 HTML 渲染器
HtmlRenderer
renderer
=
HtmlRenderer
.
builder
().
build
();
// 渲染 HTML
org
.
jsoup
.
nodes
.
Document
doc
=
Jsoup
.
parse
(
renderer
.
render
(
document
).
replaceAll
(
"\\\\n"
,
"<br>"
));
// jsoup标准化标签,生成闭合标签
doc
.
outputSettings
().
syntax
(
org
.
jsoup
.
nodes
.
Document
.
OutputSettings
.
Syntax
.
xml
);
doc
.
outputSettings
().
escapeMode
(
Entities
.
EscapeMode
.
xhtml
);
return
doc
.
html
();
}
@Override
@Override
public
List
<
TestRecords
>
findByTaskId
(
String
id
)
{
public
List
<
TestRecords
>
findByTaskId
(
String
id
)
{
return
testRecordsMapper
.
findByTaskId
(
id
);
return
testRecordsMapper
.
findByTaskId
(
id
);
...
...
This diff is collapsed.
Click to expand it.
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