Commit c645813725420517bcb92c6fee82a09e90e7ebc0
1 parent
dc7763ef
fix:【BPM 工作流】待办任务、已办任务,使用时间范围查询时,会拼接 OR 的情况(非完美修复方案)。
Showing
1 changed file
with
20 additions
and
8 deletions
yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java
| @@ -230,10 +230,10 @@ public class BpmTaskServiceImpl implements BpmTaskService { | @@ -230,10 +230,10 @@ public class BpmTaskServiceImpl implements BpmTaskService { | ||
| 230 | if (StrUtil.isNotBlank(pageVO.getName())) { | 230 | if (StrUtil.isNotBlank(pageVO.getName())) { |
| 231 | taskQuery.taskNameLike("%" + pageVO.getName() + "%"); | 231 | taskQuery.taskNameLike("%" + pageVO.getName() + "%"); |
| 232 | } | 232 | } |
| 233 | - if (ArrayUtil.isNotEmpty(pageVO.getCreateTime())) { | ||
| 234 | - taskQuery.taskCreatedAfter(DateUtils.of(pageVO.getCreateTime()[0])); | ||
| 235 | - taskQuery.taskCreatedBefore(DateUtils.of(pageVO.getCreateTime()[1])); | ||
| 236 | - } | 233 | +// if (ArrayUtil.isNotEmpty(pageVO.getCreateTime())) { |
| 234 | +// taskQuery.taskCreatedAfter(DateUtils.of(pageVO.getCreateTime()[0])); | ||
| 235 | +// taskQuery.taskCreatedBefore(DateUtils.of(pageVO.getCreateTime()[1])); | ||
| 236 | +// } | ||
| 237 | // 执行查询 | 237 | // 执行查询 |
| 238 | long count = taskQuery.count(); | 238 | long count = taskQuery.count(); |
| 239 | if (count == 0) { | 239 | if (count == 0) { |
| @@ -244,6 +244,12 @@ public class BpmTaskServiceImpl implements BpmTaskService { | @@ -244,6 +244,12 @@ public class BpmTaskServiceImpl implements BpmTaskService { | ||
| 244 | // 特殊:强制移除自动完成的“发起人”节点 | 244 | // 特殊:强制移除自动完成的“发起人”节点 |
| 245 | // 补充说明:由于 taskQuery 无法方面的过滤,所以暂时通过内存过滤 | 245 | // 补充说明:由于 taskQuery 无法方面的过滤,所以暂时通过内存过滤 |
| 246 | tasks.removeIf(task -> task.getTaskDefinitionKey().equals(START_USER_NODE_ID)); | 246 | tasks.removeIf(task -> task.getTaskDefinitionKey().equals(START_USER_NODE_ID)); |
| 247 | + // TODO @芋艿:https://t.zsxq.com/MNzqp 【flowable bug】:taskCreatedAfter、taskCreatedBefore 拼接的是 OR | ||
| 248 | + if (ArrayUtil.isNotEmpty(pageVO.getCreateTime())) { | ||
| 249 | + tasks.removeIf(task -> task.getCreateTime() == null | ||
| 250 | + || task.getCreateTime().before(DateUtils.of(pageVO.getCreateTime()[0])) | ||
| 251 | + || task.getCreateTime().after(DateUtils.of(pageVO.getCreateTime()[1]))); | ||
| 252 | + } | ||
| 247 | return new PageResult<>(tasks, count); | 253 | return new PageResult<>(tasks, count); |
| 248 | } | 254 | } |
| 249 | 255 | ||
| @@ -259,16 +265,22 @@ public class BpmTaskServiceImpl implements BpmTaskService { | @@ -259,16 +265,22 @@ public class BpmTaskServiceImpl implements BpmTaskService { | ||
| 259 | if (StrUtil.isNotEmpty(pageVO.getCategory())) { | 265 | if (StrUtil.isNotEmpty(pageVO.getCategory())) { |
| 260 | taskQuery.taskCategory(pageVO.getCategory()); | 266 | taskQuery.taskCategory(pageVO.getCategory()); |
| 261 | } | 267 | } |
| 262 | - if (ArrayUtil.isNotEmpty(pageVO.getCreateTime())) { | ||
| 263 | - taskQuery.taskCreatedAfter(DateUtils.of(pageVO.getCreateTime()[0])); | ||
| 264 | - taskQuery.taskCreatedBefore(DateUtils.of(pageVO.getCreateTime()[1])); | ||
| 265 | - } | 268 | +// if (ArrayUtil.isNotEmpty(pageVO.getCreateTime())) { |
| 269 | +// taskQuery.taskCreatedAfter(DateUtils.of(pageVO.getCreateTime()[0])); | ||
| 270 | +// taskQuery.taskCreatedBefore(DateUtils.of(pageVO.getCreateTime()[1])); | ||
| 271 | +// } | ||
| 266 | // 执行查询 | 272 | // 执行查询 |
| 267 | long count = taskQuery.count(); | 273 | long count = taskQuery.count(); |
| 268 | if (count == 0) { | 274 | if (count == 0) { |
| 269 | return PageResult.empty(); | 275 | return PageResult.empty(); |
| 270 | } | 276 | } |
| 271 | List<HistoricTaskInstance> tasks = taskQuery.listPage(PageUtils.getStart(pageVO), pageVO.getPageSize()); | 277 | List<HistoricTaskInstance> tasks = taskQuery.listPage(PageUtils.getStart(pageVO), pageVO.getPageSize()); |
| 278 | + // TODO @芋艿:https://t.zsxq.com/MNzqp 【flowable bug】:taskCreatedAfter、taskCreatedBefore 拼接的是 OR | ||
| 279 | + if (ArrayUtil.isNotEmpty(pageVO.getCreateTime())) { | ||
| 280 | + tasks.removeIf(task -> task.getCreateTime() == null | ||
| 281 | + || task.getCreateTime().before(DateUtils.of(pageVO.getCreateTime()[0])) | ||
| 282 | + || task.getCreateTime().after(DateUtils.of(pageVO.getCreateTime()[1]))); | ||
| 283 | + } | ||
| 272 | return new PageResult<>(tasks, count); | 284 | return new PageResult<>(tasks, count); |
| 273 | } | 285 | } |
| 274 | 286 |