仿钉钉流程设计 - 获取表单字段权限接口修改

This commit is contained in:
jason 2024-09-25 22:27:32 +08:00
parent 1ae726f312
commit b6c78ad04f
7 changed files with 58 additions and 32 deletions

View File

@ -158,11 +158,11 @@ public class BpmProcessInstanceController {
} }
@GetMapping("/get-form-fields-permission") @GetMapping("/get-form-fields-permission")
@Operation(summary = "获得流程实例表单字段权限") @Operation(summary = "获得表单字段权限")
@PreAuthorize("@ss.hasPermission('bpm:process-instance:query')") @PreAuthorize("@ss.hasPermission('bpm:process-instance:query')")
public CommonResult<Map<String, String>> getProcessInstanceFormFieldsPermission( public CommonResult<Map<String, String>> getFormFieldsPermission(
@Valid BpmProcessInstanceFormFieldsPermissionReqVO reqVO) { @Valid BpmFormFieldsPermissionReqVO reqVO) {
return success(processInstanceService.getProcessInstanceFormFieldsPermission(reqVO)); return success(processInstanceService.getFormFieldsPermission(reqVO));
} }
@GetMapping("/get-approval-detail") @GetMapping("/get-approval-detail")

View File

@ -1,6 +1,9 @@
package cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance; package cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance;
import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.AssertTrue;
import lombok.Data; import lombok.Data;
@Schema(description = "管理后台 - 审批详情 Request VO") @Schema(description = "管理后台 - 审批详情 Request VO")
@ -12,4 +15,11 @@ public class BpmApprovalDetailReqVO {
@Schema(description = "流程实例的编号", example = "1024") @Schema(description = "流程实例的编号", example = "1024")
private String processInstanceId; private String processInstanceId;
@AssertTrue(message = "流程定义的编号和流程实例的编号不能同时为空")
@JsonIgnore
public boolean isValidProcessParam() {
return StrUtil.isNotEmpty(processDefinitionId) || StrUtil.isNotEmpty(processInstanceId);
}
} }

View File

@ -0,0 +1,40 @@
package cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance;
import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.AssertTrue;
import lombok.Data;
/**
* @author jason
*/
@Schema(description = "管理后台 - 表单字段权限 Request VO")
@Data
public class BpmFormFieldsPermissionReqVO {
@Schema(description = "流程定义的编号", example = "1024")
private String processDefinitionId;
@Schema(description = "流程实例的编号", example = "1024")
private String processInstanceId;
@Schema(description = "流程活动编号", example = "StartUserNode")
private String activityId; // 对应 BPMN XML 节点 Id
@Schema(description = "流程任务编号", example = "95f2f08b-621b-11ef-bf39-00ff4722db8b")
private String taskId; // UserTask 对应的Id
@AssertTrue(message = "流程定义的编号和流程实例的编号不能同时为空")
@JsonIgnore
public boolean isValidProcessParam() {
return StrUtil.isNotEmpty(processDefinitionId) || StrUtil.isNotEmpty(processInstanceId);
}
@AssertTrue(message = "流程活动编号和流程任务编号编号不能同时为空")
@JsonIgnore
public boolean isValidActivityParam() {
return StrUtil.isNotEmpty(activityId) || StrUtil.isNotEmpty(taskId);
}
}

View File

@ -1,23 +0,0 @@
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
}

View File

@ -5,7 +5,6 @@ import cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.BpmTaskCand
import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmTaskCandidateStrategyEnum; import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmTaskCandidateStrategyEnum;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi; import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.flowable.engine.delegate.DelegateExecution;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Set; import java.util.Set;

View File

@ -85,12 +85,12 @@ public interface BpmProcessInstanceService {
@Valid BpmProcessInstancePageReqVO pageReqVO); @Valid BpmProcessInstancePageReqVO pageReqVO);
/** /**
* 获得流程实例表单字段权限 * 获得表单字段权限
* *
* @param reqVO 请求消息 * @param reqVO 请求消息
* @return 表单字段权限 * @return 表单字段权限
*/ */
Map<String, String> getProcessInstanceFormFieldsPermission(@Valid BpmProcessInstanceFormFieldsPermissionReqVO reqVO); Map<String, String> getFormFieldsPermission(@Valid BpmFormFieldsPermissionReqVO reqVO);
// TODO @芋艿重点在 review // TODO @芋艿重点在 review
/** /**
@ -102,7 +102,7 @@ public interface BpmProcessInstanceService {
* @param reqVO 请求信息 * @param reqVO 请求信息
* @return 流程实例的进度 * @return 流程实例的进度
*/ */
BpmApprovalDetailRespVO getApprovalDetail(Long loginUserId, BpmApprovalDetailReqVO reqVO); BpmApprovalDetailRespVO getApprovalDetail(Long loginUserId, @Valid BpmApprovalDetailReqVO reqVO);
// ========== Update 写入相关方法 ========== // ========== Update 写入相关方法 ==========