fix(任务中心): 修复系统后台任务下次执行时间排序问题

--bug=1048138 --user=王旭 【系统设置】系统-系统后台任务-下次执行时间-排序后顺序错误 https://www.tapd.cn/55049933/s/1602187
This commit is contained in:
WangXu10 2024-10-30 15:46:33 +08:00 committed by Craftsman
parent 962aeb7772
commit e7526c0d1d
2 changed files with 1 additions and 24 deletions

View File

@ -259,29 +259,9 @@ public class BaseTaskHubService {
.flatMap(item -> Stream.of(item.getCreateUserName())) .flatMap(item -> Stream.of(item.getCreateUserName()))
.collect(Collectors.toSet()); .collect(Collectors.toSet());
Map<String, String> userMap = userLoginService.getUserNameMap(new ArrayList<>(userSet)); Map<String, String> userMap = userLoginService.getUserNameMap(new ArrayList<>(userSet));
List<String> resourceIds = list.stream()
.map(TaskHubScheduleDTO::getResourceId)
.filter(StringUtils::isNotBlank)
.toList();
Map<String, TaskHubScheduleDTO> trigerTimeMap = Map.of();
if (CollectionUtils.isNotEmpty(resourceIds)) {
trigerTimeMap = extScheduleMapper.getLastAndNextTime(resourceIds)
.stream()
.collect(Collectors.toMap(TaskHubScheduleDTO::getResourceId, Function.identity()));
}
for (TaskHubScheduleDTO item : list) { for (TaskHubScheduleDTO item : list) {
item.setCreateUserName(userMap.getOrDefault(item.getCreateUserName(), StringUtils.EMPTY)); item.setCreateUserName(userMap.getOrDefault(item.getCreateUserName(), StringUtils.EMPTY));
item.setOrganizationName(orgMap.getOrDefault(item.getProjectId(), StringUtils.EMPTY)); item.setOrganizationName(orgMap.getOrDefault(item.getProjectId(), StringUtils.EMPTY));
if (trigerTimeMap.get(item.getResourceId()) != null) {
item.setNextTime(trigerTimeMap.get(item.getResourceId()).getNextTime());
item.setLastTime(trigerTimeMap.get(item.getResourceId()).getLastTime());
} else {
item.setNextTime(item.getNextTime());
item.setLastTime(item.getLastTime());
}
} }
} }

View File

@ -53,10 +53,6 @@
/> />
<span v-else>{{ record.value }}</span> <span v-else>{{ record.value }}</span>
</template> </template>
<template #nextTime="{ record }">
<span v-if="record.enable">{{ record.nextTime }}</span>
<span v-else>-</span>
</template>
<template #action="{ record }"> <template #action="{ record }">
<MsButton <MsButton
v-if="['API_IMPORT', 'TEST_PLAN', 'API_SCENARIO'].includes(record.resourceType)" v-if="['API_IMPORT', 'TEST_PLAN', 'API_SCENARIO'].includes(record.resourceType)"
@ -549,6 +545,7 @@
try { try {
await currentSwitchSchedule(record.id); await currentSwitchSchedule(record.id);
Message.success(t(record.enable ? 'ms.taskCenter.closeTaskSuccess' : 'ms.taskCenter.openTaskSuccess')); Message.success(t(record.enable ? 'ms.taskCenter.closeTaskSuccess' : 'ms.taskCenter.openTaskSuccess'));
loadList();
return true; return true;
} catch (error) { } catch (error) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console