feat(flow): 用户面四查询(todo/done/cc/my)支持 appKey 按应用筛选
build / build-push (push) Successful in 48s

工作台四页签加「按应用筛选」:controller 收可选 appKey,经 FlowQueryService
透传到分页查询;口径=办件定义归属 flw_def.app_key(join flw_instance→flw_def,
均多对一,不影响已办「一个办件一行」的去重与分页)。appKey 空串按不过滤处理
(emptyToNull),避免清筛选后误成空列表。FlwCcRepository 抄送派生查询相应改
@Query 以支持 join 过滤;FlowEngineIT 两处调用补 null 实参。

门禁:mvn compile/test-compile ✓ + 非 DB 单测 44 例 ✓;本机无 MySQL(3306
未监听),新 JPQL 未在真实库执行,FlowEngineIT/OapiFlowContractIT 待有库环境补跑
This commit is contained in:
chenxing
2026-10-12 11:26:11 +08:00
parent b4856a480d
commit c896fbb90b
6 changed files with 51 additions and 25 deletions
@@ -50,8 +50,8 @@ public class FlowQueryService {
private final FlowEngine flowEngine;
public BasePageResult<FlowModels.InstanceItem> pageMy(Long schId, Integer submitterId,
Integer status, Integer page, Integer size) {
Page<FlwInstance> p = instanceRepository.pageMy(schId, submitterId, status,
Integer status, String appKey, Integer page, Integer size) {
Page<FlwInstance> p = instanceRepository.pageMy(schId, submitterId, status, emptyToNull(appKey),
PageRequest.of(normPage(page), normSize(size)));
return toResult(p.getTotalElements(), p.getContent().stream().map(this::toInstanceItem)
.collect(Collectors.toList()), page, size);
@@ -59,8 +59,8 @@ public class FlowQueryService {
/** 抄送我的(NOTIFY 落库行,sent_time 倒序;知会不占待办,独立于 todo/done 口径) */
public BasePageResult<FlowModels.CcItem> pageCc(Long schId, Integer userId,
Integer page, Integer size) {
Page<FlwCc> p = ccRepository.findBySchIdAndUserIdOrderBySentTimeDesc(schId, userId,
String appKey, Integer page, Integer size) {
Page<FlwCc> p = ccRepository.pageCc(schId, userId, emptyToNull(appKey),
PageRequest.of(normPage(page), normSize(size)));
List<FlowModels.CcItem> items = p.getContent().stream()
.map(this::toCcItem).collect(Collectors.toList());
@@ -92,9 +92,9 @@ public class FlowQueryService {
}
}
public BasePageResult<FlowModels.TaskItem> pageTodo(Long schId, Integer assigneeId,
public BasePageResult<FlowModels.TaskItem> pageTodo(Long schId, Integer assigneeId, String appKey,
Integer page, Integer size) {
Page<FlwTask> p = taskRepository.pageTodo(schId, assigneeId,
Page<FlwTask> p = taskRepository.pageTodo(schId, assigneeId, emptyToNull(appKey),
PageRequest.of(normPage(page), normSize(size)));
List<FlowModels.TaskItem> items = p.getContent().stream()
.map(this::toTaskItem).collect(Collectors.toList());
@@ -103,10 +103,10 @@ public class FlowQueryService {
}
/** 已办:一个办件一行(保留本人最后办理的那条),并回填累计办理次数 */
public BasePageResult<FlowModels.TaskItem> pageDone(Long schId, Integer assigneeId,
public BasePageResult<FlowModels.TaskItem> pageDone(Long schId, Integer assigneeId, String appKey,
Integer page, Integer size) {
List<Integer> handled = FlwEnums.TaskStatus.handledCodes();
Page<FlwTask> p = taskRepository.pageDone(schId, assigneeId, handled,
Page<FlwTask> p = taskRepository.pageDone(schId, assigneeId, handled, emptyToNull(appKey),
PageRequest.of(normPage(page), normSize(size)));
List<FlowModels.TaskItem> items = p.getContent().stream()
.map(this::toTaskItem).collect(Collectors.toList());
@@ -522,6 +522,11 @@ public class FlowQueryService {
return page == null || page < 1 ? 0 : page - 1;
}
/** 空串按「不过滤」处理(前端清筛选可能传空值,避免误筛成空列表) */
private static String emptyToNull(String s) {
return s == null || s.trim().isEmpty() ? null : s.trim();
}
private static int normSize(Integer size) {
return size == null || size < 1 || size > 100 ? 10 : size;
}