feat(workflow): 待办列表展示请假和销假的班级名称
审批人在我的待办里可以直接看到学生班级,不必再打开单据。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
d3f9472cca
commit
51abfca40f
8 files changed
+144
No files matched your search
+5
@@ -174,6 +174,11 @@ public class FlowTaskVo implements Serializable {
|
||||
@Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "createBy")
|
||||
private String createByName;
|
||||
|
||||
/**
|
||||
* 班级名称。仅请假、销假等待办由业务模块回填,其他流程保持 null。
|
||||
*/
|
||||
private String className;
|
||||
|
||||
/**
|
||||
* 是否为申请人节点
|
||||
*/
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package org.dromara.workflow.service;
|
||||
|
||||
import org.dromara.workflow.domain.vo.FlowTaskVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 运行中待办的业务字段回填。工作流模块只定义扩展点,具体业务在各自模块实现。
|
||||
*/
|
||||
public interface FlowTaskEnricher {
|
||||
|
||||
/**
|
||||
* 为一页待办补业务展示字段。未识别的任务保持原值。
|
||||
*
|
||||
* @param tasks 当前页待办
|
||||
*/
|
||||
void enrich(List<FlowTaskVo> tasks);
|
||||
|
||||
}
|
||||
+5
@@ -47,6 +47,7 @@ import org.dromara.workflow.domain.vo.FlowHisTaskVo;
|
||||
import org.dromara.workflow.domain.vo.FlowTaskVo;
|
||||
import org.dromara.workflow.mapper.FlwCategoryMapper;
|
||||
import org.dromara.workflow.mapper.FlwTaskMapper;
|
||||
import org.dromara.workflow.service.FlowTaskEnricher;
|
||||
import org.dromara.workflow.service.IFlwCommonService;
|
||||
import org.dromara.workflow.service.IFlwNodeExtService;
|
||||
import org.dromara.workflow.service.IFlwTaskAssigneeService;
|
||||
@@ -88,6 +89,7 @@ public class FlwTaskServiceImpl implements IFlwTaskService {
|
||||
private final IFlwCommonService flwCommonService;
|
||||
private final IFlwNodeExtService flwNodeExtService;
|
||||
private final FlwHisTaskExtMapper flwHisTaskExtMapper;
|
||||
private final List<FlowTaskEnricher> flowTaskEnrichers;
|
||||
|
||||
/**
|
||||
* 启动任务
|
||||
@@ -345,6 +347,9 @@ public class FlwTaskServiceImpl implements IFlwTaskService {
|
||||
t.setAssigneeNames(StreamUtils.join(userList, UserDTO::getNickName));
|
||||
}
|
||||
});
|
||||
if (CollUtil.isNotEmpty(flowTaskEnrichers)) {
|
||||
flowTaskEnrichers.forEach(enricher -> enricher.enrich(records));
|
||||
}
|
||||
}
|
||||
return page;
|
||||
}
|
||||
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
package org.dromara.xg.workflow;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.workflow.common.ConditionalOnEnable;
|
||||
import org.dromara.workflow.domain.vo.FlowTaskVo;
|
||||
import org.dromara.workflow.service.FlowTaskEnricher;
|
||||
import org.dromara.xg.domain.XgStudentCancelLeave;
|
||||
import org.dromara.xg.domain.XgStudentLeave;
|
||||
import org.dromara.xg.mapper.XgStudentCancelLeaveMapper;
|
||||
import org.dromara.xg.mapper.XgStudentLeaveMapper;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 为请假、销假待办回填班级名称。
|
||||
*/
|
||||
@ConditionalOnEnable
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class XgLeaveFlowTaskEnricher implements FlowTaskEnricher {
|
||||
|
||||
private static final String LEAVE_FLOW_PREFIX = "hzdyjs-qj";
|
||||
private static final String CANCEL_FLOW_PREFIX = "hzdyjs-xj";
|
||||
|
||||
private final XgStudentLeaveMapper leaveMapper;
|
||||
private final XgStudentCancelLeaveMapper cancelLeaveMapper;
|
||||
|
||||
@Override
|
||||
public void enrich(List<FlowTaskVo> tasks) {
|
||||
if (CollUtil.isEmpty(tasks)) {
|
||||
return;
|
||||
}
|
||||
List<Long> leaveIds = distinctBusinessIds(tasks, LEAVE_FLOW_PREFIX);
|
||||
List<Long> cancelIds = distinctBusinessIds(tasks, CANCEL_FLOW_PREFIX);
|
||||
Map<Long, String> leaveClassNames = loadLeaveClassNames(leaveIds);
|
||||
Map<Long, String> cancelClassNames = loadCancelClassNames(cancelIds);
|
||||
for (FlowTaskVo task : tasks) {
|
||||
String flowCode = task.getFlowCode();
|
||||
Long businessId = parseBusinessId(task.getBusinessId());
|
||||
if (businessId == null || StringUtils.isBlank(flowCode)) {
|
||||
continue;
|
||||
}
|
||||
if (flowCode.startsWith(LEAVE_FLOW_PREFIX) && leaveClassNames.containsKey(businessId)) {
|
||||
task.setClassName(leaveClassNames.get(businessId));
|
||||
} else if (flowCode.startsWith(CANCEL_FLOW_PREFIX) && cancelClassNames.containsKey(businessId)) {
|
||||
task.setClassName(cancelClassNames.get(businessId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<Long> distinctBusinessIds(List<FlowTaskVo> tasks, String flowPrefix) {
|
||||
return tasks.stream()
|
||||
.filter(task -> StringUtils.isNotBlank(task.getFlowCode()) && task.getFlowCode().startsWith(flowPrefix))
|
||||
.map(task -> parseBusinessId(task.getBusinessId()))
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.toList();
|
||||
}
|
||||
|
||||
private Map<Long, String> loadLeaveClassNames(List<Long> ids) {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return Map.of();
|
||||
}
|
||||
List<XgStudentLeave> rows = leaveMapper.selectList(Wrappers.<XgStudentLeave>lambdaQuery()
|
||||
.select(XgStudentLeave::getId, XgStudentLeave::getClassName)
|
||||
.in(XgStudentLeave::getId, ids));
|
||||
Map<Long, String> classNames = new HashMap<>();
|
||||
for (XgStudentLeave row : rows) {
|
||||
classNames.put(row.getId(), StringUtils.blankToDefault(row.getClassName(), ""));
|
||||
}
|
||||
return classNames;
|
||||
}
|
||||
|
||||
private Map<Long, String> loadCancelClassNames(List<Long> ids) {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return Map.of();
|
||||
}
|
||||
List<XgStudentCancelLeave> rows = cancelLeaveMapper.selectList(Wrappers.<XgStudentCancelLeave>lambdaQuery()
|
||||
.select(XgStudentCancelLeave::getId, XgStudentCancelLeave::getClassName)
|
||||
.in(XgStudentCancelLeave::getId, ids));
|
||||
Map<Long, String> classNames = new HashMap<>();
|
||||
for (XgStudentCancelLeave row : rows) {
|
||||
classNames.put(row.getId(), StringUtils.blankToDefault(row.getClassName(), ""));
|
||||
}
|
||||
return classNames;
|
||||
}
|
||||
|
||||
private Long parseBusinessId(String businessId) {
|
||||
if (StringUtils.isBlank(businessId)) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return Long.valueOf(businessId.trim());
|
||||
} catch (NumberFormatException ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -164,6 +164,8 @@ public interface IFlwTaskService {
|
||||
}
|
||||
```
|
||||
|
||||
运行中待办(`pageByTaskWait`、`pageByAllTaskWait`)可返回 `className`。该字段由学工模块按请假(`hzdyjs-qj*`)、销假(`hzdyjs-xj*`)业务单回填,其他流程保持空。
|
||||
|
||||
### 3.2 前端核心组件
|
||||
|
||||
#### 3.2.1 审批按钮组件 (approvalButton.vue)
|
||||
|
||||
@@ -106,6 +106,10 @@
|
||||
<text class="label">申请人:</text>
|
||||
<text class="value">{{ item.createByName || '-' }}</text>
|
||||
</view>
|
||||
<view v-if="item.className != null" class="info-item">
|
||||
<text class="label">班级:</text>
|
||||
<text class="value">{{ item.className || '-' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="label">办理人:</text>
|
||||
<view class="assignee-tags">
|
||||
|
||||
@@ -31,6 +31,8 @@ export interface FlowTaskVO {
|
||||
version?: string;
|
||||
applyNode?: boolean;
|
||||
buttonList?: buttonList[];
|
||||
/** 班级名称,仅请假、销假待办由后端回填 */
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export interface buttonList {
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
<el-table-column align="center" prop="categoryName" label="流程分类"></el-table-column>
|
||||
<el-table-column align="center" prop="nodeName" label="任务名称"></el-table-column>
|
||||
<el-table-column align="center" prop="createByName" label="申请人"></el-table-column>
|
||||
<el-table-column align="center" prop="className" label="班级" min-width="140" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column align="center" label="办理人">
|
||||
<template #default="scope">
|
||||
<template v-if="scope.row.assigneeNames">
|
||||
|
||||
Reference in new issue
Block a user