Commit 6658a3e7 authored by wdy's avatar wdy

Merge branch 'wangdingyi' into 'dev'

设置存入任务列表顺序

See merge request !187
parents 6685d732 7c483e30
...@@ -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) {
// 构建并保存该任务所关联的审核组信息 // 构建并保存该任务所关联的审核组信息
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment