fix:【BPM 工作流】待办任务、已办任务,使用时间范围查询时,会拼接 OR 的情况(非完美修复方案)。
This commit is contained in:
@@ -230,10 +230,10 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
|||||||
if (StrUtil.isNotBlank(pageVO.getName())) {
|
if (StrUtil.isNotBlank(pageVO.getName())) {
|
||||||
taskQuery.taskNameLike("%" + pageVO.getName() + "%");
|
taskQuery.taskNameLike("%" + pageVO.getName() + "%");
|
||||||
}
|
}
|
||||||
if (ArrayUtil.isNotEmpty(pageVO.getCreateTime())) {
|
// if (ArrayUtil.isNotEmpty(pageVO.getCreateTime())) {
|
||||||
taskQuery.taskCreatedAfter(DateUtils.of(pageVO.getCreateTime()[0]));
|
// taskQuery.taskCreatedAfter(DateUtils.of(pageVO.getCreateTime()[0]));
|
||||||
taskQuery.taskCreatedBefore(DateUtils.of(pageVO.getCreateTime()[1]));
|
// taskQuery.taskCreatedBefore(DateUtils.of(pageVO.getCreateTime()[1]));
|
||||||
}
|
// }
|
||||||
// 执行查询
|
// 执行查询
|
||||||
long count = taskQuery.count();
|
long count = taskQuery.count();
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
@@ -244,6 +244,12 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
|||||||
// 特殊:强制移除自动完成的“发起人”节点
|
// 特殊:强制移除自动完成的“发起人”节点
|
||||||
// 补充说明:由于 taskQuery 无法方面的过滤,所以暂时通过内存过滤
|
// 补充说明:由于 taskQuery 无法方面的过滤,所以暂时通过内存过滤
|
||||||
tasks.removeIf(task -> task.getTaskDefinitionKey().equals(START_USER_NODE_ID));
|
tasks.removeIf(task -> task.getTaskDefinitionKey().equals(START_USER_NODE_ID));
|
||||||
|
// TODO @芋艿:https://t.zsxq.com/MNzqp 【flowable bug】:taskCreatedAfter、taskCreatedBefore 拼接的是 OR
|
||||||
|
if (ArrayUtil.isNotEmpty(pageVO.getCreateTime())) {
|
||||||
|
tasks.removeIf(task -> task.getCreateTime() == null
|
||||||
|
|| task.getCreateTime().before(DateUtils.of(pageVO.getCreateTime()[0]))
|
||||||
|
|| task.getCreateTime().after(DateUtils.of(pageVO.getCreateTime()[1])));
|
||||||
|
}
|
||||||
return new PageResult<>(tasks, count);
|
return new PageResult<>(tasks, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -259,16 +265,22 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
|||||||
if (StrUtil.isNotEmpty(pageVO.getCategory())) {
|
if (StrUtil.isNotEmpty(pageVO.getCategory())) {
|
||||||
taskQuery.taskCategory(pageVO.getCategory());
|
taskQuery.taskCategory(pageVO.getCategory());
|
||||||
}
|
}
|
||||||
if (ArrayUtil.isNotEmpty(pageVO.getCreateTime())) {
|
// if (ArrayUtil.isNotEmpty(pageVO.getCreateTime())) {
|
||||||
taskQuery.taskCreatedAfter(DateUtils.of(pageVO.getCreateTime()[0]));
|
// taskQuery.taskCreatedAfter(DateUtils.of(pageVO.getCreateTime()[0]));
|
||||||
taskQuery.taskCreatedBefore(DateUtils.of(pageVO.getCreateTime()[1]));
|
// taskQuery.taskCreatedBefore(DateUtils.of(pageVO.getCreateTime()[1]));
|
||||||
}
|
// }
|
||||||
// 执行查询
|
// 执行查询
|
||||||
long count = taskQuery.count();
|
long count = taskQuery.count();
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
return PageResult.empty();
|
return PageResult.empty();
|
||||||
}
|
}
|
||||||
List<HistoricTaskInstance> tasks = taskQuery.listPage(PageUtils.getStart(pageVO), pageVO.getPageSize());
|
List<HistoricTaskInstance> tasks = taskQuery.listPage(PageUtils.getStart(pageVO), pageVO.getPageSize());
|
||||||
|
// TODO @芋艿:https://t.zsxq.com/MNzqp 【flowable bug】:taskCreatedAfter、taskCreatedBefore 拼接的是 OR
|
||||||
|
if (ArrayUtil.isNotEmpty(pageVO.getCreateTime())) {
|
||||||
|
tasks.removeIf(task -> task.getCreateTime() == null
|
||||||
|
|| task.getCreateTime().before(DateUtils.of(pageVO.getCreateTime()[0]))
|
||||||
|
|| task.getCreateTime().after(DateUtils.of(pageVO.getCreateTime()[1])));
|
||||||
|
}
|
||||||
return new PageResult<>(tasks, count);
|
return new PageResult<>(tasks, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user