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
6658a3e7
Commit
6658a3e7
authored
Mar 15, 2024
by
wdy
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'wangdingyi' into 'dev'
设置存入任务列表顺序 See merge request
!187
parents
6685d732
7c483e30
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
4 deletions
+25
-4
TaskServiceImpl.java
...src/main/java/com/ruoyi/service/impl/TaskServiceImpl.java
+25
-4
No files found.
quality-review/src/main/java/com/ruoyi/service/impl/TaskServiceImpl.java
View file @
6658a3e7
...
@@ -18,7 +18,9 @@ import com.ruoyi.web.request.*;
...
@@ -18,7 +18,9 @@ import com.ruoyi.web.request.*;
import
com.ruoyi.web.response.DataStatisticsResponse
;
import
com.ruoyi.web.response.DataStatisticsResponse
;
import
com.ruoyi.web.response.TaskFindResponse
;
import
com.ruoyi.web.response.TaskFindResponse
;
import
com.ruoyi.web.response.TaskGetInfoResponse
;
import
com.ruoyi.web.response.TaskGetInfoResponse
;
import
org.apache.poi.ss.formula.functions.T
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
...
@@ -133,8 +135,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
...
@@ -133,8 +135,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
task
.
setName
(
standard
.
getName
());
task
.
setName
(
standard
.
getName
());
task
.
setStandardNo
(
standard
.
getStandardNo
());
task
.
setStandardNo
(
standard
.
getStandardNo
());
task
.
setFile
(
standard
.
getFile
());
task
.
setFile
(
standard
.
getFile
());
String
joinTaskList
=
StringUtils
.
join
(
request
.
getTaskList
(),
","
);
setTaskList
(
request
.
getTaskList
(),
task
);
task
.
setTaskList
(
joinTaskList
);
BeanUtils
.
copyBeanProp
(
task
,
request
);
BeanUtils
.
copyBeanProp
(
task
,
request
);
if
(
request
.
getTaskList
().
contains
(
Task
.
SUB_TASK_GRFIS
))
{
if
(
request
.
getTaskList
().
contains
(
Task
.
SUB_TASK_GRFIS
))
{
...
@@ -222,8 +223,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
...
@@ -222,8 +223,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
Task
task
=
taskMapper
.
selectById
(
request
.
getId
());
Task
task
=
taskMapper
.
selectById
(
request
.
getId
());
task
.
setLeaderId
(
leader
.
getUserId
());
task
.
setLeaderId
(
leader
.
getUserId
());
task
.
setLeader
(
leader
.
getName
());
task
.
setLeader
(
leader
.
getName
());
String
joinTaskList
=
StringUtils
.
join
(
request
.
getTaskList
(),
","
);
setTaskList
(
request
.
getTaskList
(),
task
);
task
.
setTaskList
(
joinTaskList
);
BeanUtils
.
copyBeanProp
(
task
,
request
);
BeanUtils
.
copyBeanProp
(
task
,
request
);
// 子任务发送变化
// 子任务发送变化
...
@@ -517,6 +517,27 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
...
@@ -517,6 +517,27 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
}
}
// 按顺序设置taskList
private
void
setTaskList
(
List
<
String
>
taskList
,
Task
task
)
{
// 定义一个比较器,按照 "sraif, grfis, trfis" 的顺序排序
Comparator
<
String
>
customComparator
=
Comparator
.
comparingInt
(
str
->
{
if
(
str
.
equals
(
Task
.
SUB_TASK_SRAIF
))
return
0
;
else
if
(
str
.
equals
(
Task
.
SUB_TASK_GRFIS
))
return
1
;
else
if
(
str
.
equals
(
Task
.
SUB_TASK_TRFIS
))
return
2
;
else
return
-
1
;
// 处理其他情况
});
// 使用自定义的比较器进行排序
List
<
String
>
sortedTaskList
=
taskList
.
stream
()
.
sorted
(
customComparator
)
.
collect
(
Collectors
.
toList
());
// 将排序后的结果用逗号连接起来存入一个字段中
String
concatenatedTasks
=
String
.
join
(
","
,
sortedTaskList
);
task
.
setTaskList
(
concatenatedTasks
);
}
// 保存任务与小组信息
// 保存任务与小组信息
private
void
saveUserRelation
(
List
<
TaskUserRelation
>
auditors
,
Task
task
)
{
private
void
saveUserRelation
(
List
<
TaskUserRelation
>
auditors
,
Task
task
)
{
// 构建并保存该任务所关联的审核组信息
// 构建并保存该任务所关联的审核组信息
...
...
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