mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 15:21:53 +08:00
仿钉钉流程设计- 新增获取流程表单字段权限接口,需要分离开
This commit is contained in:
parent
764a242d07
commit
da690a2b1c
@ -30,7 +30,7 @@ public enum BpmSimpleModelNodeType implements IntArrayValuable {
|
||||
CONDITION_NODE(50, "条件节点"), // 用于构建流转条件的表达式
|
||||
CONDITION_BRANCH_NODE(51, "条件分支节点"), // TODO @jason:是不是改成叫 条件分支?
|
||||
PARALLEL_BRANCH_NODE(52, "并行分支节点"), // TODO @jason:是不是一个 并行分支 ?就可以啦? 后面是否去掉并行网关。只用包容网关
|
||||
INCLUSIVE_BRANCH_NODE(53, "包容分叉节点"),
|
||||
INCLUSIVE_BRANCH_NODE(53, "包容分支节点"),
|
||||
// TODO @jason:建议整合 join,最终只有 条件分支、并行分支、包容分支,三种~
|
||||
// TODO @芋艿。 感觉还是分开好理解一点,也好处理一点。前端结构中把聚合节点显示并传过来。
|
||||
;
|
||||
|
@ -4,10 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.number.NumberUtils;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstanceCancelReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstanceCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstancePageReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstanceRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.*;
|
||||
import cn.iocoder.yudao.module.bpm.convert.task.BpmProcessInstanceConvert;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmCategoryDO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessDefinitionInfoDO;
|
||||
@ -160,4 +157,12 @@ public class BpmProcessInstanceController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/form-fields-permission")
|
||||
@Operation(summary = "获得流程实例表单字段权限", description = "在【我的流程】菜单中,进行调用")
|
||||
@PreAuthorize("@ss.hasPermission('bpm:process-instance:query')")
|
||||
public CommonResult<Map<String, String>> getProcessInstanceFormFieldsPermission(
|
||||
@Valid BpmProcessInstanceFormFieldsPermissionReqVO reqVO){
|
||||
return success(processInstanceService.getProcessInstanceFormFieldsPermission(reqVO));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author jason
|
||||
*/
|
||||
@Schema(description = "管理后台 - 流程实例表单字段权限 Request VO")
|
||||
@Data
|
||||
public class BpmProcessInstanceFormFieldsPermissionReqVO {
|
||||
|
||||
@Schema(description = "流程实例的编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
@NotEmpty(message = "流程实例的编号不能为空")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "流程活动编号", example = "StartUserNode")
|
||||
private String activityId; // 对应 BPMN XML 节点 Id
|
||||
|
||||
@Schema(description = "流程任务的编号", example = "95f2f08b-621b-11ef-bf39-00ff4722db8b")
|
||||
private String taskId; // UserTask 对应的Id
|
||||
}
|
@ -67,10 +67,9 @@ public class BpmTaskRespVO {
|
||||
private List<String> formFields;
|
||||
@Schema(description = "提交的表单值", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Map<String, Object> formVariables;
|
||||
// TODO @jason:fieldsPermissions
|
||||
// @芋艿 都改成了 fieldsPermission。 buttonsSetting。和 BpmSimpleModelNodeVO 统一
|
||||
@Schema(description = "表单字段权限值")
|
||||
private Map<String, String> fieldsPermission;
|
||||
// TODO @jason:buttonsSettings
|
||||
@Schema(description = "操作按钮设置值")
|
||||
private Map<Integer, OperationButtonSetting> buttonsSetting;
|
||||
|
||||
|
@ -114,6 +114,7 @@ public interface BpmTaskConvert {
|
||||
if (BpmTaskStatusEnum.RUNNING.getStatus().equals(taskStatus)){
|
||||
// 设置表单权限 TODO @芋艿 是不是还要加一个全局的权限 基于 processInstance 的权限;回复:可能不需要,但是发起人,需要有个权限配置
|
||||
// TODO @jason:貌似这么返回,主要解决当前审批 task 的表单权限,但是不同抄送人的表单权限,可能不太对。例如说,对 A 抄送人是隐藏某个字段。
|
||||
// @芋艿 表单权限需要分离开。单独的接口来获取了 BpmProcessInstanceService.getProcessInstanceFormFieldsPermission
|
||||
taskVO.setFieldsPermission(BpmnModelUtils.parseFormFieldsPermission(bpmnModel, task.getTaskDefinitionKey()));
|
||||
// 操作按钮设置
|
||||
taskVO.setButtonsSetting(BpmnModelUtils.parseButtonsSetting(bpmnModel, task.getTaskDefinitionKey()));
|
||||
|
@ -80,15 +80,16 @@ public interface BpmnModelConstants {
|
||||
*/
|
||||
String FORM_FIELD_PERMISSION_ELEMENT_PERMISSION_ATTRIBUTE = "permission";
|
||||
|
||||
// TODO @jason:上面是 fieldsPermission,然后这里是 buttonsSettings;感觉有点不统一。然后 BpmSimpleModelNodeVO 里面是 fieldsPermission、buttonsSetting;
|
||||
/**
|
||||
* BPMN ExtensionElement 操作按钮设置元素, 用于审批节点操作按钮设置
|
||||
*/
|
||||
String BUTTON_SETTING_ELEMENT = "buttonsSettings";
|
||||
String BUTTON_SETTING_ELEMENT = "buttonsSetting";
|
||||
|
||||
/**
|
||||
* BPMN ExtensionElement Attribute, 用于标记按钮编号
|
||||
*/
|
||||
String BUTTON_SETTING_ELEMENT_ID_ATTRIBUTE = "id";
|
||||
|
||||
/**
|
||||
* BPMN ExtensionElement Attribute, 用于标记按钮显示名称
|
||||
*/
|
||||
|
@ -79,6 +79,9 @@ public class BpmnModelUtils {
|
||||
}
|
||||
|
||||
public static Map<String, String> parseFormFieldsPermission(BpmnModel bpmnModel, String flowElementId) {
|
||||
if (bpmnModel == null || StrUtil.isEmpty(flowElementId)) {
|
||||
return null;
|
||||
}
|
||||
FlowElement flowElement = getFlowElementById(bpmnModel, flowElementId);
|
||||
if (flowElement == null) {
|
||||
return null;
|
||||
|
@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstanceCancelReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstanceCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstanceFormFieldsPermissionReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstancePageReqVO;
|
||||
import jakarta.validation.Valid;
|
||||
import org.flowable.engine.history.HistoricProcessInstance;
|
||||
@ -76,8 +77,6 @@ public interface BpmProcessInstanceService {
|
||||
return convertMap(getHistoricProcessInstances(ids), HistoricProcessInstance::getId);
|
||||
}
|
||||
|
||||
// ========== Update 写入相关方法 ==========
|
||||
|
||||
/**
|
||||
* 获得流程实例的分页
|
||||
*
|
||||
@ -88,6 +87,16 @@ public interface BpmProcessInstanceService {
|
||||
PageResult<HistoricProcessInstance> getProcessInstancePage(Long userId,
|
||||
@Valid BpmProcessInstancePageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得流程实例表单字段权限
|
||||
*
|
||||
* @param reqVO 请求消息
|
||||
* @return 表单字段权限
|
||||
*/
|
||||
Map<String, String> getProcessInstanceFormFieldsPermission(@Valid BpmProcessInstanceFormFieldsPermissionReqVO reqVO);
|
||||
|
||||
// ========== Update 写入相关方法 ==========
|
||||
|
||||
/**
|
||||
* 创建流程实例(提供给前端)
|
||||
*
|
||||
@ -117,7 +126,7 @@ public interface BpmProcessInstanceService {
|
||||
/**
|
||||
* 管理员取消流程实例
|
||||
*
|
||||
* @param userId 用户编号
|
||||
* @param userId 用户编号
|
||||
* @param cancelReqVO 取消信息
|
||||
*/
|
||||
void cancelProcessInstanceByAdmin(Long userId, BpmProcessInstanceCancelReqVO cancelReqVO);
|
||||
@ -125,8 +134,8 @@ public interface BpmProcessInstanceService {
|
||||
/**
|
||||
* 更新 ProcessInstance 为不通过
|
||||
*
|
||||
* @param processInstance 流程实例
|
||||
* @param reason 理由。例如说,审批不通过时,需要传递该值
|
||||
* @param processInstance 流程实例
|
||||
* @param reason 理由。例如说,审批不通过时,需要传递该值
|
||||
*/
|
||||
void updateProcessInstanceReject(ProcessInstance processInstance, String reason);
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -85,6 +85,14 @@ public interface BpmTaskService {
|
||||
*/
|
||||
Task getTask(String id);
|
||||
|
||||
/**
|
||||
* 获取历史任务
|
||||
*
|
||||
* @param id 任务编号
|
||||
* @return 历史任务
|
||||
*/
|
||||
HistoricTaskInstance getHistoricTask(String id);
|
||||
|
||||
/**
|
||||
* 根据条件查询正在进行中的任务
|
||||
*
|
||||
|
@ -214,6 +214,11 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
return taskService.createTaskQuery().taskId(id).includeTaskLocalVariables().singleResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HistoricTaskInstance getHistoricTask(String id) {
|
||||
return historyService.createHistoricTaskInstanceQuery().taskId(id).includeTaskLocalVariables().singleResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Task> getRunningTaskListByProcessInstanceId(String processInstanceId, Boolean assigned, String defineKey) {
|
||||
Assert.notNull(processInstanceId, "processInstanceId 不能为空");
|
||||
@ -230,10 +235,6 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
return taskQuery.list();
|
||||
}
|
||||
|
||||
private HistoricTaskInstance getHistoricTask(String id) {
|
||||
return historyService.createHistoricTaskInstanceQuery().taskId(id).includeTaskLocalVariables().singleResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserTask> getUserTaskListByReturn(String id) {
|
||||
// 1.1 校验当前任务 task 存在
|
||||
|
Loading…
Reference in New Issue
Block a user