Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
car-database-api
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
中汽研标准应用数据库
car-database-api
Commits
8e530355
Commit
8e530355
authored
Apr 03, 2025
by
罗林杰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改获取数据重复bug
parent
a7323a08
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
1 deletion
+31
-1
TTestPlanRecordServiceImpl.java
...va/com/ruoyi/service/impl/TTestPlanRecordServiceImpl.java
+31
-1
No files found.
quality-review/src/main/java/com/ruoyi/service/impl/TTestPlanRecordServiceImpl.java
View file @
8e530355
...
@@ -6,6 +6,7 @@ import com.ruoyi.common.core.domain.entity.SysUser;
...
@@ -6,6 +6,7 @@ import com.ruoyi.common.core.domain.entity.SysUser;
import
com.ruoyi.common.utils.SecurityUtils
;
import
com.ruoyi.common.utils.SecurityUtils
;
import
com.ruoyi.domain.TTestPlanRecord
;
import
com.ruoyi.domain.TTestPlanRecord
;
import
com.ruoyi.domain.vo.ItemsByUseCaseVO
;
import
com.ruoyi.domain.vo.ItemsByUseCaseVO
;
import
com.ruoyi.domain.vo.RecaordUseCasesVO
;
import
com.ruoyi.domain.vo.UseCaseUrlVO
;
import
com.ruoyi.domain.vo.UseCaseUrlVO
;
import
com.ruoyi.service.TTestPlanRecordService
;
import
com.ruoyi.service.TTestPlanRecordService
;
import
com.ruoyi.mapper.TTestPlanRecordMapper
;
import
com.ruoyi.mapper.TTestPlanRecordMapper
;
...
@@ -19,6 +20,8 @@ import java.io.IOException;
...
@@ -19,6 +20,8 @@ import java.io.IOException;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
/**
* @author W_YI
* @author W_YI
...
@@ -75,7 +78,34 @@ public class TTestPlanRecordServiceImpl extends ServiceImpl<TTestPlanRecordMappe
...
@@ -75,7 +78,34 @@ public class TTestPlanRecordServiceImpl extends ServiceImpl<TTestPlanRecordMappe
String
string
=
response
.
body
().
string
();
String
string
=
response
.
body
().
string
();
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
string
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
string
);
// List listUseCase = new ArrayList();
// List listUseCase = new ArrayList();
List
listUseCase
=
jsonObject
.
getJSONObject
(
"data"
).
getJSONObject
(
"regulationByName"
).
getList
(
"itemsByUseCase"
,
ItemsByUseCaseVO
.
class
);
List
<
ItemsByUseCaseVO
>
listUseCase
=
jsonObject
.
getJSONObject
(
"data"
).
getJSONObject
(
"regulationByName"
).
getList
(
"itemsByUseCase"
,
ItemsByUseCaseVO
.
class
);
// 遍历listUseCase
for
(
ItemsByUseCaseVO
itemsByUseCaseVO
:
listUseCase
)
{
//进行去重
Map
<
String
,
RecaordUseCasesVO
>
map
=
itemsByUseCaseVO
.
getUseCases
().
stream
()
.
filter
(
useCase
->
useCase
.
getCustomizedID
()
!=
null
)
.
collect
(
Collectors
.
toMap
(
RecaordUseCasesVO:
:
getCustomizedID
,
useCase
->
useCase
,
(
existing
,
replacement
)
->
existing
// 如果遇到重复的ID,选择保留原来的那个
));
itemsByUseCaseVO
.
setUseCases
(
new
ArrayList
<>(
map
.
values
()));
//根据customizedID进行排序
itemsByUseCaseVO
.
getUseCases
().
sort
((
o1
,
o2
)
->
{
String
id1
=
o1
.
getCustomizedID
();
String
id2
=
o2
.
getCustomizedID
();
// 提取子版本号部分("-"后面的部分)
String
subVersion1
=
id1
.
substring
(
id1
.
lastIndexOf
(
'-'
)
+
1
);
String
subVersion2
=
id2
.
substring
(
id2
.
lastIndexOf
(
'-'
)
+
1
);
// 比较子版本号
return
Integer
.
compare
(
Integer
.
parseInt
(
subVersion1
),
Integer
.
parseInt
(
subVersion2
));
});
}
return
listUseCase
;
return
listUseCase
;
...
...
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