Merge branch 'master' into feature/REQ-3340
# Conflicts: # workflow-engine-api/src/main/java/cn/axzo/workflow/client/feign/bpmn/ProcessInstanceApi.java # workflow-engine-common/src/main/java/cn/axzo/workflow/common/constant/BpmnConstants.java # workflow-engine-core/src/main/java/cn/axzo/workflow/core/engine/cmd/CustomApproveTaskWithFormCmd.java # workflow-engine-core/src/main/java/cn/axzo/workflow/core/engine/cmd/CustomCancelProcessInstanceCmd.java # workflow-engine-core/src/main/java/cn/axzo/workflow/core/engine/event/MessagePushEventBuilder.java # workflow-engine-core/src/main/java/cn/axzo/workflow/core/service/BpmnProcessInstanceService.java # workflow-engine-core/src/main/java/cn/axzo/workflow/core/service/impl/BpmnProcessInstanceServiceImpl.java # workflow-engine-core/src/main/java/cn/axzo/workflow/core/service/impl/BpmnProcessTaskServiceImpl.java # workflow-engine-server/src/main/java/cn/axzo/workflow/server/controller/web/bpmn/BpmnProcessInstanceController.java
This commit is contained in:
commit
e4a85dffd4
@ -1,7 +1,9 @@
|
||||
package cn.axzo.workflow.client.feign.bpmn;
|
||||
|
||||
import cn.axzo.workflow.client.annotation.WorkflowEngineFeignClient;
|
||||
import cn.axzo.workflow.common.annotation.InvokeMode;
|
||||
import cn.axzo.workflow.common.annotation.Manageable;
|
||||
import cn.axzo.workflow.common.enums.RpcInvokeModeEnum;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.activity.BpmnActivityTimeoutCallbackDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.activity.BpmnActivityTimeoutTriggerDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnActivitySetAssigneeDTO;
|
||||
@ -16,6 +18,8 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
import static cn.axzo.workflow.common.enums.RpcInvokeModeEnum.SYNC;
|
||||
|
||||
/**
|
||||
* 流程活动的 API
|
||||
*
|
||||
@ -33,6 +37,7 @@ public interface ProcessActivityApi {
|
||||
*/
|
||||
@Deprecated
|
||||
@GetMapping("/api/process/activity/trigger")
|
||||
@InvokeMode(SYNC)
|
||||
CommonResponse<Boolean> trigger(@NotBlank(message = "触发 ID 不能为空") @RequestParam String triggerId);
|
||||
|
||||
/**
|
||||
|
||||
@ -13,6 +13,7 @@ import cn.axzo.workflow.common.model.request.bpmn.process.BpmnProcessInstanceCre
|
||||
import cn.axzo.workflow.common.model.request.bpmn.process.BpmnProcessInstanceLogQueryDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.process.BpmnProcessInstanceMyPageReqVO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.process.BpmnProcessInstanceQueryDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskButtonSearchDTO;
|
||||
import cn.axzo.workflow.common.model.request.form.instance.FormVariablesUpdateDTO;
|
||||
import cn.axzo.workflow.common.model.response.BpmPageResult;
|
||||
import cn.axzo.workflow.common.model.response.bpmn.BatchOperationResultVO;
|
||||
@ -22,6 +23,7 @@ import cn.axzo.workflow.common.model.response.bpmn.process.BpmnProcessInstancePa
|
||||
import cn.axzo.workflow.common.model.response.bpmn.process.BpmnProcessInstanceVO;
|
||||
import cn.axzo.workflow.common.model.response.bpmn.process.NodesByModelVO;
|
||||
import cn.axzo.workflow.common.model.response.bpmn.process.ProcessNodeDetailVO;
|
||||
import cn.axzo.workflow.common.model.response.bpmn.task.BpmnTaskButtonVo;
|
||||
import cn.azxo.framework.common.model.CommonResponse;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@ -257,6 +259,17 @@ public interface ProcessInstanceApi {
|
||||
@InvokeMode(SYNC)
|
||||
CommonResponse<BpmnProcessInstanceLogVO> getProcessInstanceLogs(@Validated @RequestBody BpmnProcessInstanceLogQueryDTO dto);
|
||||
|
||||
/**
|
||||
* 根据任务id查询任务状态,按钮详情
|
||||
*
|
||||
* @param taskButtonsSearchDTO 请求参数
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "根据任务id查询任务状态,按钮详情")
|
||||
@PostMapping("/api/process/instance/task/buttons/find")
|
||||
@InvokeMode(SYNC)
|
||||
CommonResponse<BpmnTaskButtonVo> findProcessSingleTaskButtons(@Validated @RequestBody BpmnTaskButtonSearchDTO taskButtonsSearchDTO);
|
||||
|
||||
/**
|
||||
* 更新指定流程表单最后一次编辑的内容
|
||||
*
|
||||
|
||||
@ -3,25 +3,10 @@ package cn.axzo.workflow.client.feign.bpmn;
|
||||
import cn.axzo.workflow.client.annotation.WorkflowEngineFeignClient;
|
||||
import cn.axzo.workflow.common.annotation.InvokeMode;
|
||||
import cn.axzo.workflow.common.annotation.Manageable;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnOptionalNodeDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnRobotTaskCompleteDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnRobotTaskCreateDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskAttachmentDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskAuditDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskAuditWithFormDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskBackAuditDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskCommentDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskCountersignDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskPageSearchDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskRemindDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskTransferDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.*;
|
||||
import cn.axzo.workflow.common.model.response.BpmPageResult;
|
||||
import cn.axzo.workflow.common.model.response.bpmn.BatchOperationResultVO;
|
||||
import cn.axzo.workflow.common.model.response.bpmn.task.BpmnHistoricTaskInstanceGroupVO;
|
||||
import cn.axzo.workflow.common.model.response.bpmn.task.BpmnHistoricTaskInstanceVO;
|
||||
import cn.axzo.workflow.common.model.response.bpmn.task.BpmnTaskDonePageItemVO;
|
||||
import cn.axzo.workflow.common.model.response.bpmn.task.BpmnTaskInstanceVO;
|
||||
import cn.axzo.workflow.common.model.response.bpmn.task.BpmnTaskTodoPageItemVO;
|
||||
import cn.axzo.workflow.common.model.response.bpmn.task.*;
|
||||
import cn.azxo.framework.common.model.CommonResponse;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@ -284,4 +269,5 @@ public interface ProcessTaskApi {
|
||||
@InvokeMode(SYNC)
|
||||
CommonResponse<Map<String, String>> findTaskIdByInstanceIdsAndPersonId(@RequestParam(required = false) @NotEmpty(message = "流程实例 ID列表 不能为空") List<String> processInstanceIds,
|
||||
@RequestParam(required = false) @NotBlank(message = "自然人 ID 不能为空") String personId);
|
||||
|
||||
}
|
||||
|
||||
@ -203,6 +203,11 @@ public interface BpmnConstants {
|
||||
* ouId+workspaceId 下限制人员数量为20
|
||||
*/
|
||||
Integer MAX_ORG_WORKSPACE_ADMIN_COUNT = 20;
|
||||
|
||||
/**
|
||||
* 发起人撤回时,当前流程停留住的节点定义key
|
||||
*/
|
||||
String CANCEL_PROCESS_NODE_DEF_KEY_NAME = "[_CANCEL_PROCESS_NODE_DEF_KEY_]";
|
||||
// 被转交人
|
||||
String TRANSFER_TO = "[TRANSFER_TO_]";
|
||||
// 转交时的意见
|
||||
|
||||
@ -0,0 +1,29 @@
|
||||
package cn.axzo.workflow.common.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum BpmnProcessTaskResultEnum {
|
||||
PENDING("PENDING", "待处理"),
|
||||
APPROVED("APPROVED", "已同意"),
|
||||
REJECTED("REJECTED", "已驳回"),
|
||||
DELETED("DELETED", "已删除"),
|
||||
CANCELED("CANCELED", "已撤销"),
|
||||
TRANSFERRED("TRANSFERRED", "已转交"),
|
||||
NONE("NONE", "没有执行动作,例如 抄送"),
|
||||
;
|
||||
/**
|
||||
* 结果
|
||||
*/
|
||||
private final String status;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private final String desc;
|
||||
|
||||
BpmnProcessTaskResultEnum(String status, String desc) {
|
||||
this.status = status;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package cn.axzo.workflow.common.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum ButtonVisibleScopeEnum {
|
||||
|
||||
INITIATOR("INITIATOR", "发起人"),
|
||||
|
||||
EXECUTOR("EXECUTOR", "当前操作人"),
|
||||
;
|
||||
|
||||
/**
|
||||
* 结果
|
||||
*/
|
||||
private final String status;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private final String desc;
|
||||
|
||||
ButtonVisibleScopeEnum(String status, String desc) {
|
||||
this.status = status;
|
||||
this.desc = desc;
|
||||
}
|
||||
}
|
||||
@ -15,6 +15,11 @@ import java.io.Serializable;
|
||||
@Accessors(chain = true)
|
||||
public class BpmnButtonMetaInfo implements Serializable {
|
||||
|
||||
public static final String BUTTON_TYPE_SYSTEM = "SYSTEM";
|
||||
public static final String BUTTON_TYPE_CUSTOM = "CUSTOM";
|
||||
|
||||
private static final long serialVersionUID = -5224316166904752829L;
|
||||
|
||||
/**
|
||||
* 按钮顺序
|
||||
*/
|
||||
|
||||
@ -0,0 +1,27 @@
|
||||
package cn.axzo.workflow.common.model.request.bpmn.task;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@ApiModel("获取审批任务按钮,状态入参模型")
|
||||
public class BpmnTaskButtonSearchDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -3220083731019329293L;
|
||||
|
||||
@ApiModelProperty(value = "流程实例id", required = true)
|
||||
@NotBlank(message = "流程实例id不能为空")
|
||||
private String processInstanceId;
|
||||
|
||||
@ApiModelProperty(value = "审批任务id", required = true)
|
||||
@NotBlank(message = "审批任务id不能为空")
|
||||
private String taskId;
|
||||
|
||||
private Long initiatorPersonId;
|
||||
|
||||
private Long executorPersonId;
|
||||
}
|
||||
@ -3,7 +3,12 @@ package cn.axzo.workflow.common.model.request.bpmn.task;
|
||||
import cn.axzo.workflow.common.enums.BpmnProcessInstanceResultEnum;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 扩展的历史任务表搜索入参模型
|
||||
@ -13,6 +18,9 @@ import lombok.Data;
|
||||
*/
|
||||
@ApiModel("扩展的历史任务表搜索入参模型")
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ExtHiTaskSearchDTO {
|
||||
|
||||
@ApiModelProperty("流程实例 ID")
|
||||
@ -29,4 +37,7 @@ public class ExtHiTaskSearchDTO {
|
||||
|
||||
@ApiModelProperty("任务状态")
|
||||
private BpmnProcessInstanceResultEnum status;
|
||||
|
||||
@ApiModelProperty("需要排除的id列表")
|
||||
private List<Long> excludeIds;
|
||||
}
|
||||
|
||||
@ -0,0 +1,60 @@
|
||||
package cn.axzo.workflow.common.model.response.bpmn.task;
|
||||
|
||||
import cn.axzo.workflow.common.enums.BpmnProcessTaskResultEnum;
|
||||
import cn.axzo.workflow.common.enums.ButtonVisibleScopeEnum;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.BpmnButtonMetaInfo;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class BpmnTaskButtonVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -2701890396246979758L;
|
||||
|
||||
/**
|
||||
* 执行人任务状态
|
||||
*/
|
||||
@ApiModelProperty(value = "执行人任务执行状态")
|
||||
private BpmnProcessTaskResultEnum executorTaskResult;
|
||||
|
||||
/**
|
||||
* 发起人执行状态
|
||||
*/
|
||||
@ApiModelProperty(value = "发起人任务执行状态")
|
||||
private BpmnProcessTaskResultEnum initiatorTaskResult;
|
||||
|
||||
/**
|
||||
* 当前任务执行人以及发起人全量按钮
|
||||
*/
|
||||
@ApiModelProperty(value = "当前任务相关以及发起人的全量按钮")
|
||||
private List<BpmnButtonMetaInfoWithVisibleScope> buttons;
|
||||
|
||||
/**
|
||||
* 需要隐藏的按钮
|
||||
*/
|
||||
@ApiModelProperty(value = "需要隐藏的自定义按钮")
|
||||
private List<BpmnButtonMetaInfo> customHiddenButtons;
|
||||
|
||||
/**
|
||||
* 全量的配置按钮
|
||||
*/
|
||||
@ApiModelProperty(value = "全量的配置按钮")
|
||||
private List<BpmnButtonMetaInfo> allConfigButtons;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public static final class BpmnButtonMetaInfoWithVisibleScope extends BpmnButtonMetaInfo {
|
||||
|
||||
private static final long serialVersionUID = 5758633314769798044L;
|
||||
|
||||
private List<ButtonVisibleScopeEnum> visibleScopes;
|
||||
}
|
||||
}
|
||||
@ -56,6 +56,7 @@ import static cn.axzo.workflow.core.engine.cmd.helper.CustomTaskHelper.validTask
|
||||
*/
|
||||
public class CustomApproveTaskWithFormCmd extends AbstractCommand<Void> implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 2366844598166684546L;
|
||||
private static final Logger log = LoggerFactory.getLogger(CustomApproveTaskWithFormCmd.class);
|
||||
private final String taskId;
|
||||
/**
|
||||
@ -82,12 +83,12 @@ public class CustomApproveTaskWithFormCmd extends AbstractCommand<Void> implemen
|
||||
/**
|
||||
* 指定节点类型
|
||||
*/
|
||||
private List<BpmnFlowNodeType> nodeTypes;
|
||||
private final List<BpmnFlowNodeType> nodeTypes;
|
||||
|
||||
/**
|
||||
* 表单数据
|
||||
*/
|
||||
private Map<String, Object> formVariables;
|
||||
private final Map<String, Object> formVariables;
|
||||
|
||||
@Override
|
||||
public String paramToJsonString() {
|
||||
@ -180,12 +181,12 @@ public class CustomApproveTaskWithFormCmd extends AbstractCommand<Void> implemen
|
||||
if (CollectionUtils.isEmpty(logs) || logs.size() != 1) {
|
||||
throw new WorkflowEngineException(FORM_FIELD_VALIDATOR_ERROR);
|
||||
}
|
||||
ExtAxProcessLog log = logs.get(0);
|
||||
Map<String, FormPermissionMetaInfo> permissionMap = log.getFormFieldPermissionConf().stream()
|
||||
ExtAxProcessLog axProcessLog = logs.get(0);
|
||||
Map<String, FormPermissionMetaInfo> permissionMap = axProcessLog.getFormFieldPermissionConf().stream()
|
||||
.collect(Collectors.toMap(FormPermissionMetaInfo::getFieldId, Function.identity(), (s, t) -> s));
|
||||
formVariables.forEach((k, v) -> {
|
||||
FormPermissionMetaInfo permission = permissionMap.getOrDefault(k, new FormPermissionMetaInfo());
|
||||
if (permission.getRequired()) {
|
||||
if (Boolean.TRUE.equals(permission.getRequired())) {
|
||||
if (Objects.isNull(v)) {
|
||||
throw new WorkflowEngineException(FORM_FIELD_VALIDATOR_ERROR);
|
||||
}
|
||||
|
||||
@ -14,7 +14,9 @@ import org.flowable.engine.RuntimeService;
|
||||
import org.flowable.engine.history.HistoricProcessInstance;
|
||||
import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;
|
||||
import org.flowable.engine.impl.util.CommandContextUtil;
|
||||
import org.flowable.task.api.Task;
|
||||
import org.flowable.task.service.impl.persistence.entity.TaskEntity;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
@ -27,11 +29,9 @@ import static cn.axzo.workflow.common.code.BpmnInstanceRespCode.PROCESS_INSTANCE
|
||||
import static cn.axzo.workflow.common.code.BpmnInstanceRespCode.PROCESS_INSTANCE_CANCEL_FAIL_NOT_SELF;
|
||||
import static cn.axzo.workflow.common.code.BpmnInstanceRespCode.PROCESS_INSTANCE_CANT_CANCEL;
|
||||
import static cn.axzo.workflow.common.code.BpmnInstanceRespCode.PROCESS_INSTANCE_NOT_EXISTS;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CANCEL_PROCESS_NODE_DEF_KEY_NAME;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CLOSE_PROCESS_ASSIGNER;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_DELETE_PROCESS_FLAG;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_END_TENANT_ID;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_END_USER_ID;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_END_USER_NAME;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_PROCESS_DELETE_REASON;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_PROCESS_TYPE_CANCEL;
|
||||
import static cn.axzo.workflow.common.enums.BpmnFlowNodeType.NODE_CANCEL;
|
||||
@ -48,6 +48,7 @@ import static cn.axzo.workflow.core.engine.cmd.helper.CustomTaskHelper.createVir
|
||||
* @since 2024/1/2 18:19
|
||||
*/
|
||||
public class CustomCancelProcessInstanceCmd extends AbstractCommand<Void> implements Serializable {
|
||||
private static final long serialVersionUID = 6556399267210245511L;
|
||||
private final String processInstanceId;
|
||||
private final String tenantId;
|
||||
private final String reason;
|
||||
@ -103,22 +104,31 @@ public class CustomCancelProcessInstanceCmd extends AbstractCommand<Void> implem
|
||||
throw new WorkflowEngineException(PROCESS_INSTANCE_CANT_CANCEL);
|
||||
}
|
||||
|
||||
|
||||
List<Task> tasks = processEngineConfiguration.getTaskService()
|
||||
.createTaskQuery()
|
||||
.processInstanceId(processInstanceId)
|
||||
.active()
|
||||
.list();
|
||||
String taskDefKey = "";
|
||||
if (!CollectionUtils.isEmpty(tasks)) {
|
||||
taskDefKey = tasks.get(0).getTaskDefinitionKey();
|
||||
}
|
||||
Map<String, Object> variables = new HashMap<>();
|
||||
// variables.put(INTERNAL_END_TENANT_ID, tenantId);
|
||||
// variables.put(INTERNAL_END_USER_ID, initiator.buildAssigneeId());
|
||||
// variables.put(INTERNAL_END_USER_NAME, initiator.getAssignerName());
|
||||
variables.put(INTERNAL_DELETE_PROCESS_FLAG, INTERNAL_PROCESS_TYPE_CANCEL);
|
||||
variables.put(INTERNAL_PROCESS_DELETE_REASON, reason);
|
||||
variables.put(CANCEL_PROCESS_NODE_DEF_KEY_NAME, taskDefKey);
|
||||
RuntimeService runtimeService = processEngineConfiguration.getRuntimeService();
|
||||
runtimeService.setVariables(instance.getId(), variables);
|
||||
|
||||
CommandContextUtil.getAgenda(commandContext).planOperation(new DeleteProcessInstanceOperation(commandContext,
|
||||
processInstanceId, extAxHiTaskInstService, CANCELLED));
|
||||
processInstanceId, extAxHiTaskInstService, CANCELLED));
|
||||
|
||||
// 添加自定义的节点,用于展示最后的操作
|
||||
TaskEntity task = createVirtualTask(commandContext, extAxHiTaskInstService, processInstanceId,
|
||||
nodeName, NODE_CANCEL.getType(), reason, initiator, CANCELLED.getStatus(), new AddComment(CANCELLED.getDesc()));
|
||||
nodeName, NODE_CANCEL.getType(), reason, initiator, CANCELLED.getStatus(), new AddComment(CANCELLED.getDesc()));
|
||||
|
||||
batchAddAttachment(commandContext, processInstanceId, task, attachmentList, initiator);
|
||||
|
||||
|
||||
@ -9,13 +9,7 @@ import java.util.List;
|
||||
|
||||
import static cn.axzo.workflow.common.code.OtherRespCode.MESSAGE_PUSH_EVENT_BUILD_ERROR;
|
||||
import static cn.axzo.workflow.common.code.OtherRespCode.MES_PUSH_OBJECT_BUILD_ERROR;
|
||||
import static cn.axzo.workflow.core.engine.event.MessagePushEventType.CARBON_COPY;
|
||||
import static cn.axzo.workflow.core.engine.event.MessagePushEventType.CARBON_COPY_COMPLETE;
|
||||
import static cn.axzo.workflow.core.engine.event.MessagePushEventType.NOTICE;
|
||||
import static cn.axzo.workflow.core.engine.event.MessagePushEventType.PENDING_COMPLETE;
|
||||
import static cn.axzo.workflow.core.engine.event.MessagePushEventType.PENDING_PUSH;
|
||||
import static cn.axzo.workflow.core.engine.event.MessagePushEventType.PENDING_ROLLBACK;
|
||||
import static cn.axzo.workflow.core.engine.event.MessagePushEventType.SMS;
|
||||
import static cn.axzo.workflow.core.engine.event.MessagePushEventType.*;
|
||||
|
||||
/**
|
||||
* 推送事件对象构造器
|
||||
@ -36,7 +30,7 @@ public class MessagePushEventBuilder {
|
||||
case PENDING_COMPLETE:
|
||||
return createPendingCompleteEvent(assigners, noticeConf, processInstanceId, processDefinitionKey, tenantId, taskId, activitySignature);
|
||||
case CARBON_COPY:
|
||||
return createCarbonCopyEvent(assigners, noticeConf, processInstanceId, processDefinitionKey, tenantId, activitySignature);
|
||||
return createCarbonCopyEvent(assigners, noticeConf, processInstanceId, processDefinitionKey, tenantId, taskId, activitySignature);
|
||||
case CARBON_COPY_COMPLETE:
|
||||
return createCarbonCopyCompleteEvent(assigners, noticeConf, processInstanceId, processDefinitionKey, tenantId, activitySignature);
|
||||
case SMS:
|
||||
@ -88,9 +82,11 @@ public class MessagePushEventBuilder {
|
||||
public static MessagePushEventImpl createCarbonCopyEvent(List<BpmnTaskDelegateAssigner> assigners,
|
||||
BpmnNoticeConf noticeConf, String processInstanceId,
|
||||
String processDefinitionKey,
|
||||
String tenantId, Boolean activitySignature) {
|
||||
String tenantId,
|
||||
String taskId,
|
||||
Boolean activitySignature) {
|
||||
MessagePushEventImpl newEvent = new MessagePushEventImpl(CARBON_COPY, assigners, noticeConf,
|
||||
processInstanceId, processDefinitionKey, tenantId, null);
|
||||
processInstanceId, processDefinitionKey, tenantId, taskId);
|
||||
newEvent.setActivitySignature(activitySignature);
|
||||
return newEvent;
|
||||
}
|
||||
|
||||
@ -30,6 +30,8 @@ import java.util.List;
|
||||
@ToString(callSuper = true)
|
||||
public class ExtAxProcessLog extends BaseEntity<ExtAxProcessLog> {
|
||||
|
||||
private static final long serialVersionUID = 461756492937079852L;
|
||||
|
||||
/**
|
||||
* 流程实例 ID
|
||||
*/
|
||||
|
||||
@ -2,6 +2,7 @@ package cn.axzo.workflow.core.repository.mapper;
|
||||
|
||||
import cn.axzo.workflow.core.repository.entity.ExtAxProcessLog;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
@Mapper
|
||||
@ -10,4 +11,7 @@ public interface ExtAxProcessLogMapper extends BaseMapperX<ExtAxProcessLog> {
|
||||
@Update("UPDATE ext_ax_process_log SET is_delete = 0, start_time = NOW() WHERE process_instance_id = #{processInstanceId} and task_id = #{taskId}")
|
||||
void restore(String processInstanceId, String taskId);
|
||||
|
||||
|
||||
@Select("select * from ext_ax_process_log WHERE process_instance_id = #{processInstanceId} and task_id = #{taskId}")
|
||||
ExtAxProcessLog findByProcessIdAndTaskIdWithDeleted(String processInstanceId, String taskId);
|
||||
}
|
||||
|
||||
@ -170,6 +170,14 @@ public interface BpmnProcessInstanceService {
|
||||
*/
|
||||
BpmnProcessInstanceLogVO getProcessInstanceLog(BpmnProcessInstanceLogQueryDTO dto);
|
||||
|
||||
/**
|
||||
* 根据流程实例id,任务id,查询任务状态,按钮配置
|
||||
*
|
||||
* @param taskButtonsSearchDTO 请求参数
|
||||
* @return 任务按钮,状态信息
|
||||
*/
|
||||
BpmnTaskButtonVo findTaskButtons(BpmnTaskButtonSearchDTO taskButtonsSearchDTO);
|
||||
|
||||
/**
|
||||
* 获取指定流程实例对应的模型 ID
|
||||
* @param processInstanceId
|
||||
|
||||
@ -1,24 +1,9 @@
|
||||
package cn.axzo.workflow.core.service;
|
||||
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnOptionalNodeDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnRobotTaskCompleteDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnRobotTaskCreateDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskAttachmentDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskAuditDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskAuditWithFormDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskBackAuditDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskCommentDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskCountersignDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskPageSearchDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskRemindDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskTransferDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.*;
|
||||
import cn.axzo.workflow.common.model.response.BpmPageResult;
|
||||
import cn.axzo.workflow.common.model.response.bpmn.BatchOperationResultVO;
|
||||
import cn.axzo.workflow.common.model.response.bpmn.task.BpmnHistoricTaskInstanceGroupVO;
|
||||
import cn.axzo.workflow.common.model.response.bpmn.task.BpmnHistoricTaskInstanceVO;
|
||||
import cn.axzo.workflow.common.model.response.bpmn.task.BpmnTaskDonePageItemVO;
|
||||
import cn.axzo.workflow.common.model.response.bpmn.task.BpmnTaskInstanceVO;
|
||||
import cn.axzo.workflow.common.model.response.bpmn.task.BpmnTaskTodoPageItemVO;
|
||||
import cn.axzo.workflow.common.model.response.bpmn.task.*;
|
||||
import org.flowable.form.api.FormInfo;
|
||||
|
||||
import java.util.List;
|
||||
@ -151,4 +136,5 @@ public interface BpmnProcessTaskService {
|
||||
String findTaskIdByInstanceIdAndPersonId(String processInstanceId, String personId);
|
||||
|
||||
Map<String, String> findTaskIdByInstanceIdsAndPersonId(List<String> processInstanceIds, String personId);
|
||||
|
||||
}
|
||||
|
||||
@ -55,8 +55,11 @@ public interface ExtAxProcessLogService {
|
||||
|
||||
List<ExtAxProcessLog> genericQuery(ExtAxProcessLog query);
|
||||
|
||||
ExtAxProcessLog findByProcessIdAndTaskIdWithDeleted(String processId, String taskId);
|
||||
|
||||
/**
|
||||
* 机器人节点会删除日志,这里仅仅为了恢复日志都删除标识,并更新时间。
|
||||
*
|
||||
* @param processInstanceId
|
||||
* @param taskId
|
||||
*/
|
||||
|
||||
@ -920,7 +920,7 @@ public class BpmnProcessInstanceServiceImpl implements BpmnProcessInstanceServic
|
||||
instance = runtimeService.createProcessInstanceQuery()
|
||||
.processInstanceId(processInstanceId).singleResult();
|
||||
if (Objects.isNull(instance)) {
|
||||
if (checkAliveThrowException) {
|
||||
if (Boolean.TRUE.equals(checkAliveThrowException)) {
|
||||
throw new WorkflowEngineException(RUNNING_INSTANCE_ONLY_FORECAST);
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
@ -1050,7 +1050,7 @@ public class BpmnProcessInstanceServiceImpl implements BpmnProcessInstanceServic
|
||||
|
||||
@Override
|
||||
public Boolean checkInstanceApprover(BpmnProcessInstanceCheckApproverDTO dto) {
|
||||
if (dto.getOnlyPersonId()) {
|
||||
if (Boolean.TRUE.equals(dto.getOnlyPersonId())) {
|
||||
dto.getApprover().setOuId(null);
|
||||
}
|
||||
List<Task> list = taskService.createTaskQuery()
|
||||
@ -1116,16 +1116,164 @@ public class BpmnProcessInstanceServiceImpl implements BpmnProcessInstanceServic
|
||||
.build();
|
||||
|
||||
|
||||
categoryService.get(BPM_MODEL_CATEGORY, historicProcessInstance.getProcessDefinitionKey()).ifPresent(category -> {
|
||||
logVO.setWorkspaceType(WorkspaceType.getType(Integer.valueOf(category.getWorkspaceTypeCode())));
|
||||
logVO.setCategory(category.getValue());
|
||||
});
|
||||
categoryService.get(BPM_MODEL_CATEGORY, historicProcessInstance.getProcessDefinitionKey())
|
||||
.ifPresent(category -> {
|
||||
logVO.setWorkspaceType(WorkspaceType.getType(Integer.valueOf(category.getWorkspaceTypeCode())));
|
||||
logVO.setCategory(category.getValue());
|
||||
});
|
||||
|
||||
// 根据传入的访问人计算有权限的按钮
|
||||
calcAuthorizedButtons(logVO, dto.getVisitor());
|
||||
return logVO;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public BpmnTaskButtonVo findTaskButtons(BpmnTaskButtonSearchDTO taskButtonsSearchDTO) {
|
||||
BpmnTaskButtonVo bpmnTaskButtonVo = new BpmnTaskButtonVo();
|
||||
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery()
|
||||
.processInstanceId(taskButtonsSearchDTO.getProcessInstanceId())
|
||||
.includeProcessVariables()
|
||||
.singleResult();
|
||||
if (Objects.isNull(historicProcessInstance)) {
|
||||
throw new WorkflowEngineException(PROCESS_INSTANCE_ID_NOT_EXISTS, taskButtonsSearchDTO.getProcessInstanceId());
|
||||
}
|
||||
BpmnModel bpmnModel = repositoryService.getBpmnModel(historicProcessInstance.getProcessDefinitionId());
|
||||
ExtAxHiTaskInst extAxHiTaskInst = extAxHiTaskInstService.getByTaskId(taskButtonsSearchDTO.getTaskId(), taskButtonsSearchDTO.getProcessInstanceId());
|
||||
if (extAxHiTaskInst == null) {
|
||||
log.warn("extAxHiTaskInst is null,request param:{}", JSON.toJSONString(taskButtonsSearchDTO));
|
||||
throw new ServiceException("can find extAxHiTaskInst");
|
||||
}
|
||||
if (Objects.equals(extAxHiTaskInst.getStatus(), DELETED.getStatus())) {
|
||||
ExtHiTaskSearchDTO extHiTaskSearchDTO = ExtHiTaskSearchDTO.builder()
|
||||
.processInstanceId(taskButtonsSearchDTO.getProcessInstanceId())
|
||||
.taskDefinitionKey(extAxHiTaskInst.getTaskDefinitionKey())
|
||||
.assignee(extAxHiTaskInst.getAssignee())
|
||||
.excludeIds(Collections.singletonList(extAxHiTaskInst.getId()))
|
||||
.build();
|
||||
List<ExtAxHiTaskInst> extAxHiTaskInsts = extAxHiTaskInstService.queryList(extHiTaskSearchDTO);
|
||||
log.info("extAxHiTaskInst status is DELETED, find another task list in same assignee and task def key,result is:{}", JSON.toJSONString(extAxHiTaskInsts));
|
||||
if (!CollectionUtils.isEmpty(extAxHiTaskInsts)) {
|
||||
extAxHiTaskInst = extAxHiTaskInsts.get(0);
|
||||
}
|
||||
}
|
||||
//判断节点类型
|
||||
FlowElement flowElement = bpmnModel.getMainProcess().getFlowElement(extAxHiTaskInst.getTaskDefinitionKey());
|
||||
BpmnFlowNodeType nodeType = getNodeType(flowElement).orElse(null);
|
||||
//设置任务状态
|
||||
bpmnTaskButtonVo.setExecutorTaskResult(getTaskStatus(nodeType, extAxHiTaskInst));
|
||||
String buttonConfigName = null;
|
||||
BpmnButtonConf buttonConf = getButtonConfig(bpmnModel.getMainProcess(), extAxHiTaskInst.getTaskDefinitionKey()).orElse(null);
|
||||
BpmnProcessInstanceLogVO logVO = BpmnProcessInstanceLogVO.builder()
|
||||
.id(historicProcessInstance.getId())
|
||||
.defaultButtonConf(getButtonConfig(bpmnModel.getMainProcess()).orElse(new BpmnButtonConf()))
|
||||
.calculatingButtonConf(buttonConf)
|
||||
.build();
|
||||
List<BpmnButtonMetaInfo> carbonCopyButtons = chooseButtons(logVO, CONFIG_BUTTON_TYPE_CARBON_COPY);
|
||||
List<BpmnButtonMetaInfo> initiatorButtons;
|
||||
List<BpmnButtonMetaInfo> executorButtons;
|
||||
if (Objects.equals(historicProcessInstance.getBusinessStatus(), PROCESSING.getStatus())) {
|
||||
//发起人按钮
|
||||
initiatorButtons = chooseButtons(logVO, CONFIG_BUTTON_TYPE_INITIATOR);
|
||||
if (Objects.equals(nodeType, BpmnFlowNodeType.NODE_CARBON_COPY)) {
|
||||
buttonConfigName = CONFIG_BUTTON_TYPE_CARBON_COPY;
|
||||
} else if (Objects.equals(nodeType, BpmnFlowNodeType.NODE_TASK) || //审批节点加业务节点指定审批人
|
||||
(Objects.equals(nodeType, BpmnFlowNodeType.NODE_BUSINESS) && flowElement.getClass().isAssignableFrom(UserTask.class))) {
|
||||
// 待审批的节点
|
||||
if ((Objects.equals(PROCESSING.getStatus(), extAxHiTaskInst.getStatus()))) {
|
||||
buttonConfigName = CONFIG_BUTTON_TYPE_CURRENT;
|
||||
}
|
||||
//已审批节点
|
||||
if (!Objects.equals(PROCESSING.getStatus(), extAxHiTaskInst.getStatus())) {
|
||||
buttonConfigName = CONFIG_BUTTON_TYPE_HISTORY;
|
||||
}
|
||||
} else if (Objects.equals(nodeType, BpmnFlowNodeType.NODE_STARTER)) {
|
||||
buttonConfigName = CONFIG_BUTTON_TYPE_INITIATOR;
|
||||
}
|
||||
if (!StringUtils.hasText(buttonConfigName)) {
|
||||
log.warn("can't find button config name ,req:{},extAxHiTaskInst:{}", JSON.toJSONString(taskButtonsSearchDTO), JSON.toJSONString(extAxHiTaskInst));
|
||||
throw new ServiceException("can't find button config name");
|
||||
}
|
||||
executorButtons = chooseButtons(logVO, buttonConfigName);
|
||||
} else {
|
||||
//需要判断流程是否撤回,撤回需要设置发起人状态
|
||||
if (Objects.equals(historicProcessInstance.getBusinessStatus(), CANCELLED.getStatus())) {
|
||||
Object object = historicProcessInstance.getProcessVariables().get(CANCEL_PROCESS_NODE_DEF_KEY_NAME);
|
||||
if (object instanceof String) {
|
||||
String cancelNodeKey = (String) object;
|
||||
if (StringUtils.hasText(cancelNodeKey) && cancelNodeKey.equals(extAxHiTaskInst.getTaskDefinitionKey())) {
|
||||
bpmnTaskButtonVo.setInitiatorTaskResult(BpmnProcessTaskResultEnum.CANCELED);
|
||||
}
|
||||
}
|
||||
}
|
||||
initiatorButtons = new ArrayList<>(carbonCopyButtons);
|
||||
executorButtons = new ArrayList<>(carbonCopyButtons);
|
||||
}
|
||||
|
||||
bpmnTaskButtonVo.setCustomHiddenButtons(getHiddenCustomButtons(logVO, executorButtons));
|
||||
//设置allConfigButtons
|
||||
List<BpmnButtonMetaInfo> allConfigButtons = new ArrayList<>(executorButtons);
|
||||
bpmnTaskButtonVo.setAllConfigButtons(allConfigButtons);
|
||||
Map<BpmnButtonMetaInfo, Set<ButtonVisibleScopeEnum>> metaInfoListMap = new HashMap<>();
|
||||
if (!CollectionUtils.isEmpty(executorButtons)) {
|
||||
for (BpmnButtonMetaInfo metaInfo : filterValuableButtons(executorButtons)) {
|
||||
metaInfoListMap.computeIfAbsent(metaInfo, k -> new HashSet<>()).add(ButtonVisibleScopeEnum.EXECUTOR);
|
||||
}
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(initiatorButtons)) {
|
||||
for (BpmnButtonMetaInfo metaInfo : filterValuableButtons(initiatorButtons)) {
|
||||
metaInfoListMap.computeIfAbsent(metaInfo, k -> new HashSet<>()).add(ButtonVisibleScopeEnum.INITIATOR);
|
||||
}
|
||||
}
|
||||
|
||||
List<BpmnTaskButtonVo.BpmnButtonMetaInfoWithVisibleScope> scopeButtons = metaInfoListMap.entrySet().stream()
|
||||
.map(m -> {
|
||||
BpmnTaskButtonVo.BpmnButtonMetaInfoWithVisibleScope scopeButton = BeanUtil.copyProperties(m.getKey(), BpmnTaskButtonVo.BpmnButtonMetaInfoWithVisibleScope.class);
|
||||
scopeButton.setVisibleScopes(new ArrayList<>(m.getValue()));
|
||||
return scopeButton;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
bpmnTaskButtonVo.setButtons(scopeButtons);
|
||||
return bpmnTaskButtonVo;
|
||||
}
|
||||
|
||||
private BpmnProcessTaskResultEnum getTaskStatus(BpmnFlowNodeType nodeType, ExtAxHiTaskInst axHiTaskInst) {
|
||||
String logResultStatus = axHiTaskInst.getStatus();
|
||||
if (!StringUtils.hasText(logResultStatus)) {
|
||||
log.warn("log result status is blank!");
|
||||
return null;
|
||||
}
|
||||
BpmnProcessTaskResultEnum taskResult = null;
|
||||
BpmnProcessInstanceResultEnum instanceResultEnum = BpmnProcessInstanceResultEnum.valueOf(logResultStatus);
|
||||
switch (instanceResultEnum) {
|
||||
case CANCELLED:
|
||||
taskResult = BpmnProcessTaskResultEnum.CANCELED;
|
||||
break;
|
||||
case APPROVED:
|
||||
if (Objects.equals(nodeType, BpmnFlowNodeType.NODE_CARBON_COPY)) {
|
||||
taskResult = BpmnProcessTaskResultEnum.NONE;
|
||||
} else {
|
||||
taskResult = BpmnProcessTaskResultEnum.APPROVED;
|
||||
}
|
||||
break;
|
||||
case REJECTED:
|
||||
taskResult = BpmnProcessTaskResultEnum.REJECTED;
|
||||
break;
|
||||
case TRANSFER:
|
||||
taskResult = BpmnProcessTaskResultEnum.TRANSFERRED;
|
||||
break;
|
||||
case PROCESSING:
|
||||
taskResult = BpmnProcessTaskResultEnum.PENDING;
|
||||
break;
|
||||
case DELETED:
|
||||
taskResult = BpmnProcessTaskResultEnum.DELETED;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return taskResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPrintTemplate(String processInstanceId, String processDefinitionId) {
|
||||
return extAxReModelService.hasPrintTemplateConfig(getModelIdByProcessDefinitionId(processInstanceId, processDefinitionId));
|
||||
@ -1200,15 +1348,22 @@ public class BpmnProcessInstanceServiceImpl implements BpmnProcessInstanceServic
|
||||
|
||||
logVO.setCurrentUserButtons(authorizedButtons);
|
||||
// 有权限访问的自定义按钮
|
||||
List<String> customButtonKeys = authorizedButtons.stream()
|
||||
.filter(i -> Objects.equals(i.getType(), "CUSTOM"))
|
||||
logVO.setCustomHiddenButtons(getHiddenCustomButtons(logVO, authorizedButtons));
|
||||
}
|
||||
|
||||
private List<BpmnButtonMetaInfo> getHiddenCustomButtons(BpmnProcessInstanceLogVO logVO, List<BpmnButtonMetaInfo> bpmnButtonMetaInfos) {
|
||||
// 有权限访问的自定义按钮
|
||||
List<String> customButtonKeys = bpmnButtonMetaInfos.stream()
|
||||
.filter(i -> Objects.equals(i.getType(), BpmnButtonMetaInfo.BUTTON_TYPE_CUSTOM))
|
||||
.filter(i -> Boolean.FALSE.equals(i.getDisabled()) && Boolean.TRUE.equals(i.getChecked()))
|
||||
.map(BpmnButtonMetaInfo::getBtnKey)
|
||||
.distinct().collect(Collectors.toList());
|
||||
List<BpmnButtonMetaInfo> customButtons = logVO.getDefaultButtonConf().getInitiator().stream()
|
||||
.filter(i -> Objects.equals(i.getType(), "CUSTOM"))
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
return logVO.getDefaultButtonConf().getInitiator()
|
||||
.stream()
|
||||
.filter(i -> Objects.equals(i.getType(), BpmnButtonMetaInfo.BUTTON_TYPE_CUSTOM))
|
||||
.filter(i -> !customButtonKeys.contains(i.getBtnKey()))
|
||||
.collect(Collectors.toList());
|
||||
logVO.setCustomHiddenButtons(customButtons);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1249,6 +1404,23 @@ public class BpmnProcessInstanceServiceImpl implements BpmnProcessInstanceServic
|
||||
return mergeButtons;
|
||||
}
|
||||
|
||||
/**
|
||||
* 过滤Disabled=false && Checked=true
|
||||
*
|
||||
* @param bpmnButtonMetaInfos 按钮列表
|
||||
* @return 有效的按钮列表
|
||||
*/
|
||||
private List<BpmnButtonMetaInfo> filterValuableButtons(List<BpmnButtonMetaInfo> bpmnButtonMetaInfos) {
|
||||
if (CollectionUtils.isEmpty(bpmnButtonMetaInfos)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return bpmnButtonMetaInfos.stream()
|
||||
.filter(i -> !i.getDisabled())
|
||||
.filter(BpmnButtonMetaInfo::getChecked)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static String getLe130Assignee(BpmnTaskDelegateAssigner visitor) {
|
||||
return visitor.getTenantId() + "|" + visitor.getAssignee() + "|" + visitor.getAssigneeType();
|
||||
}
|
||||
@ -1416,7 +1588,6 @@ public class BpmnProcessInstanceServiceImpl implements BpmnProcessInstanceServic
|
||||
.build());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public List<AttachmentDTO> getAttachmentByType(Map<String, List<Attachment>> attachmentByTaskMap, String
|
||||
|
||||
@ -146,7 +146,6 @@ import static cn.axzo.workflow.common.enums.BpmnProcessInstanceResultEnum.valueO
|
||||
import static cn.axzo.workflow.common.util.BpmnNativeQueryUtil.countSql;
|
||||
import static cn.axzo.workflow.common.util.BpmnNativeQueryUtil.sqlConnectors;
|
||||
import static cn.axzo.workflow.core.common.utils.BpmnCollectionUtils.convertSet;
|
||||
import static cn.axzo.workflow.core.common.utils.BpmnMetaParserHelper.getActivitySignature;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@ -185,6 +184,8 @@ public class BpmnProcessTaskServiceImpl implements BpmnProcessTaskService {
|
||||
private BpmnProcessDefinitionService bpmnProcessModelService;
|
||||
@Resource
|
||||
private ExtAxProcessLogService extAxProcessLogService;
|
||||
@Resource
|
||||
private ExtAxProcessLogService processLogService;
|
||||
|
||||
@Override
|
||||
public BpmPageResult<BpmnTaskTodoPageItemVO> getTodoTaskPage(BpmnTaskPageSearchDTO dto) {
|
||||
@ -349,7 +350,7 @@ public class BpmnProcessTaskServiceImpl implements BpmnProcessTaskService {
|
||||
public void approveTaskWithForm(BpmnTaskAuditWithFormDTO dto) {
|
||||
// 表单级别暂时只允许同步
|
||||
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutor();
|
||||
if(Boolean.TRUE.equals(dto.getAsync())) {
|
||||
if (Boolean.TRUE.equals(dto.getAsync())) {
|
||||
commandExecutor.execute(new CustomApproveTaskWithFormAsyncCmd(dto));
|
||||
} else {
|
||||
commandExecutor.execute(new CustomApproveTaskWithFormCmd(dto));
|
||||
@ -809,7 +810,8 @@ public class BpmnProcessTaskServiceImpl implements BpmnProcessTaskService {
|
||||
Lists.newArrayList(assigner), noticeConfig.orElse(null),
|
||||
processInstance.getProcessInstanceId(),
|
||||
processInstance.getProcessDefinitionKey(),
|
||||
processInstance.getTenantId(), task.getId(), getActivitySignature(process.getFlowElement(dto.getTaskDefinitionKey())));
|
||||
processInstance.getTenantId(), task.getId(),
|
||||
getActivitySignature(process.getFlowElement(dto.getTaskDefinitionKey())));
|
||||
event.setProcessInstanceId(processInstance.getProcessInstanceId());
|
||||
event.setTenantId(processInstance.getTenantId());
|
||||
event.setTaskId(task.getId());
|
||||
|
||||
@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@ -47,7 +48,8 @@ public class ExtAxHiTaskInstServiceImpl implements ExtAxHiTaskInstService {
|
||||
.eq(StringUtils.hasLength(dto.getTaskId()), "task_id", dto.getTaskId())
|
||||
.eq(Objects.nonNull(dto.getStatus()), "status", Objects.isNull(dto.getStatus()) ? "" :
|
||||
dto.getStatus().getStatus())
|
||||
.eq(StringUtils.hasLength(dto.getAssignee()), "assignee", dto.getAssignee());
|
||||
.eq(StringUtils.hasLength(dto.getAssignee()), "assignee", dto.getAssignee())
|
||||
.notIn(!CollectionUtils.isEmpty(dto.getExcludeIds()), "id", dto.getExcludeIds());
|
||||
return extAxHiTaskInstMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
|
||||
@ -16,10 +16,7 @@ import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.DUMMY_ASSIGNEE_ID;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.HIDDEN_ASSIGNEE_ID;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.NO_ASSIGNEE;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.ROBOT_ASSIGNEE_ID;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.*;
|
||||
|
||||
/**
|
||||
* Api Log 表操服务实现
|
||||
@ -80,6 +77,11 @@ public class ExtAxProcessLogServiceImpl implements ExtAxProcessLogService {
|
||||
return extAxProcessLogMapper.selectList(buildQueryWrapper(query));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExtAxProcessLog findByProcessIdAndTaskIdWithDeleted(String processId, String taskId) {
|
||||
return extAxProcessLogMapper.findByProcessIdAndTaskIdWithDeleted(processId,taskId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restore(String processInstanceId, String taskId) {
|
||||
batchRestore(Lists.newArrayList(new SimpleTaskDTO(processInstanceId, taskId)));
|
||||
|
||||
@ -37,6 +37,7 @@ import java.util.Map;
|
||||
*/
|
||||
public class CreateAttachmentCmd extends AbstractCommand<Attachment> implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -2901013696126749407L;
|
||||
protected String attachmentType;
|
||||
protected String taskId;
|
||||
protected String processInstanceId;
|
||||
|
||||
@ -19,13 +19,11 @@ import org.apache.commons.collections4.ListUtils;
|
||||
import org.flowable.bpmn.model.FlowElement;
|
||||
import org.flowable.bpmn.model.UserTask;
|
||||
import org.flowable.engine.delegate.DelegateExecution;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@ -70,7 +68,7 @@ public class TransferToAdminTaskAssigneeSelector extends AbstractBpmnTaskAssigne
|
||||
protected List<BpmnTaskDelegateAssigner> invokeService(FlowElement flowElement, DelegateExecution execution,
|
||||
ApproverScopeDTO scopeDto) {
|
||||
|
||||
if(Boolean.TRUE.equals(supportRefreshProperties.getUseNewToAdminApi())) {
|
||||
if (Boolean.TRUE.equals(supportRefreshProperties.getUseNewToAdminApi())) {
|
||||
return invokeNewQuery(flowElement, execution, scopeDto);
|
||||
} else {
|
||||
return invokeOldQuery(flowElement, execution, scopeDto);
|
||||
@ -90,7 +88,10 @@ public class TransferToAdminTaskAssigneeSelector extends AbstractBpmnTaskAssigne
|
||||
.map(w -> BeanUtil.copyProperties(w, ListFlowTaskAssignerReq.OrgScope.class))
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
ListFlowTaskAssignerReq req = builder.workspaceAdmin(false).build();
|
||||
ListFlowTaskAssignerReq req = builder
|
||||
.procInstId(execution.getProcessInstanceId())
|
||||
.workspaceAdmin(false)
|
||||
.build();
|
||||
BpmnMetaParserHelper.getApproverScope((UserTask) flowElement)
|
||||
.ifPresent(i -> {
|
||||
if (Objects.equals(i, ApproverScopeEnum.projectWorkspace)) {
|
||||
@ -133,13 +134,14 @@ public class TransferToAdminTaskAssigneeSelector extends AbstractBpmnTaskAssigne
|
||||
}
|
||||
ListFlowTaskAssignerReq req = builder.workspaceAdmin(false).build();
|
||||
req.setProcInstId(execution.getProcessInstanceId());
|
||||
if(Objects.equals(ApproverScopeEnum.entWorkspace, approverScope.get()) && Objects.equals(ApproverSpecifyEnum.fixedPerson,optSpecify.get())) {
|
||||
req.setCooperateTypes(Sets.newHashSet(1,2,3,4,5,6,7,8,9,11,30));
|
||||
if (approverScope.isPresent() && Objects.equals(ApproverScopeEnum.entWorkspace, approverScope.get()) &&
|
||||
optSpecify.isPresent() && Objects.equals(ApproverSpecifyEnum.fixedPerson, optSpecify.get())) {
|
||||
req.setCooperateTypes(Sets.newHashSet(1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 30));
|
||||
} else {
|
||||
req.setCooperateTypes(getCooperationTypes(flowElement));
|
||||
}
|
||||
// 发起人主管找其超管时,需要将发起人的数据包装进 orgScope
|
||||
if (Objects.equals(ApproverSpecifyEnum.initiatorLeader, optSpecify.get())) {
|
||||
if (optSpecify.isPresent() && Objects.equals(ApproverSpecifyEnum.initiatorLeader, optSpecify.get())) {
|
||||
BpmnTaskDelegateAssigner initiator = BpmnTaskDelegateAssigner.toObjectCompatible(execution.getVariable(INTERNAL_INITIATOR, String.class));
|
||||
Integer workspaceType = execution.getVariable(INTERNAL_PROCESS_WORKSPACE_TYPE, Integer.class);
|
||||
req.setOrgScopes(Lists.newArrayList(new ListFlowTaskAssignerReq.OrgScope(workspaceType, Long.parseLong(initiator.getTenantId()), Long.parseLong(initiator.getOuId()), null)));
|
||||
|
||||
@ -251,7 +251,8 @@ public class RocketMqMessagePushEventListener extends AbstractBpmnEventListener<
|
||||
JSONUtil.toJsonStr(event.getAssigners()), event.getProcessInstanceId());
|
||||
if (Objects.nonNull(event.getNoticeConfig().getCarbonCopy())) {
|
||||
//按人员拆分为多个批次发送消息
|
||||
getMessagePushDtoSlice(event, event.getNoticeConfig().getCarbonCopy().getCarbonCopyMessageId(), PROCESS_CARBON_COPY).forEach(dto -> sendMessageQueue(dto, PROCESS_CARBON_COPY));
|
||||
getMessagePushDtoSlice(event, event.getNoticeConfig().getCarbonCopy().getCarbonCopyMessageId(), PROCESS_CARBON_COPY)
|
||||
.forEach(dto -> sendMessageQueue(dto, PROCESS_CARBON_COPY));
|
||||
}
|
||||
log.info("RocketMqMessagePushEventListener#onCarbonCopy...end, cc' templateId: {}, receivePerson: {}, processInstanceId: {}",
|
||||
event.getNoticeConfig().getCarbonCopy().getCarbonCopyMessageId(),
|
||||
|
||||
@ -42,14 +42,7 @@ import org.flowable.engine.history.HistoricProcessInstance;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.annotation.Resource;
|
||||
@ -352,6 +345,20 @@ public class BpmnProcessInstanceController extends BasicPopulateAvatarController
|
||||
return success(log);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据任务id查询任务状态,按钮详情
|
||||
*
|
||||
* @param taskButtonsSearchDTO 请求参数
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Operation(summary = "根据流程实例id,任务id查询任务状态,按钮详情")
|
||||
@PostMapping("/task/buttons/find")
|
||||
public CommonResponse<BpmnTaskButtonVo> findProcessSingleTaskButtons(@Validated @RequestBody BpmnTaskButtonSearchDTO taskButtonsSearchDTO) {
|
||||
return success(bpmnProcessInstanceService.findTaskButtons(taskButtonsSearchDTO));
|
||||
}
|
||||
|
||||
private void resetPersonInfo(BpmnProcessInstanceLogVO log) {
|
||||
List<BpmnTaskDelegateAssigner> users = log.getTaskDetails().stream().flatMap(taskLog -> {
|
||||
Stream<BpmnTaskDelegateAssigner> assigner = Objects.nonNull(taskLog.getAssigneeSnapshot()) ? Stream.of(taskLog.getAssigneeSnapshot()) : Stream.empty();
|
||||
|
||||
@ -2,27 +2,10 @@ package cn.axzo.workflow.server.controller.web.bpmn;
|
||||
|
||||
import cn.axzo.workflow.client.feign.bpmn.ProcessTaskApi;
|
||||
import cn.axzo.workflow.common.enums.AttachmentTypeEnum;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.AttachmentDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnOptionalNodeDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnRobotTaskCompleteDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnRobotTaskCreateDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskAttachmentDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskAuditDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskAuditWithFormDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskBackAuditDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskCommentDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskCountersignDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskDelegateAssigner;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskPageSearchDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskRemindDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskTransferDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.*;
|
||||
import cn.axzo.workflow.common.model.response.BpmPageResult;
|
||||
import cn.axzo.workflow.common.model.response.bpmn.BatchOperationResultVO;
|
||||
import cn.axzo.workflow.common.model.response.bpmn.task.BpmnHistoricTaskInstanceGroupVO;
|
||||
import cn.axzo.workflow.common.model.response.bpmn.task.BpmnHistoricTaskInstanceVO;
|
||||
import cn.axzo.workflow.common.model.response.bpmn.task.BpmnTaskDonePageItemVO;
|
||||
import cn.axzo.workflow.common.model.response.bpmn.task.BpmnTaskInstanceVO;
|
||||
import cn.axzo.workflow.common.model.response.bpmn.task.BpmnTaskTodoPageItemVO;
|
||||
import cn.axzo.workflow.common.model.response.bpmn.task.*;
|
||||
import cn.axzo.workflow.core.service.BpmnProcessTaskService;
|
||||
import cn.axzo.workflow.server.common.annotation.ErrorReporter;
|
||||
import cn.axzo.workflow.server.common.annotation.RepeatSubmit;
|
||||
@ -36,12 +19,7 @@ import org.flowable.form.api.FormInfo;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.annotation.Resource;
|
||||
@ -410,4 +388,5 @@ public class BpmnProcessTaskController extends BasicPopulateAvatarController imp
|
||||
@RequestParam @NotBlank(message = "自然人 ID 不能为空") String personId) {
|
||||
return success(bpmnProcessTaskService.findTaskIdByInstanceIdsAndPersonId(processInstanceIds, personId));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -171,7 +171,7 @@ public class CoreServiceCodeGeneration {
|
||||
"该类是根据 API 动态生成,不同版本可能会开放新的接口,或回收一些旧接口\r\n<p>\r\n" +
|
||||
"Auto generation by workflow engine, It cannot be manually modified");
|
||||
classOrInterfaceDeclaration.addAndGetAnnotation("org.springframework.cloud.openfeign.FeignClient")
|
||||
.addPair("name", new StringLiteralExpr("workflow-engine-starter-core"))
|
||||
.addPair("name", new StringLiteralExpr("workflow-engine"))
|
||||
.addPair("url", new StringLiteralExpr("${axzo.service.workflow-engine:http://workflow-engine:8080}"))
|
||||
.addPair("configuration", new ClassExpr(new ClassOrInterfaceType("WorkflowEngineStarterFeignConfiguration")));
|
||||
cu.addImport("cn.axzo.workflow.starter.feign.ext.WorkflowEngineStarterFeignConfiguration", false, false);
|
||||
|
||||
@ -162,7 +162,7 @@ public class ManageServiceCodeGeneration {
|
||||
"该类是根据 API 动态生成,不同版本可能会开放新的接口,或回收一些旧接口\r\n<p>\r\n" +
|
||||
"Auto generation by workflow engine, It cannot be manually modified");
|
||||
classOrInterfaceDeclaration.addAndGetAnnotation("org.springframework.cloud.openfeign.FeignClient")
|
||||
.addPair("name", new StringLiteralExpr("workflow-engine-starter-manage"))
|
||||
.addPair("name", new StringLiteralExpr("workflow-engine"))
|
||||
.addPair("url", new StringLiteralExpr("${axzo.service.workflow-engine:http://workflow-engine:8080}"))
|
||||
.addPair("configuration", new ClassExpr(new ClassOrInterfaceType("WorkflowEngineStarterFeignConfiguration")));
|
||||
cu.addImport("cn.axzo.workflow.starter.feign.ext.WorkflowEngineStarterFeignConfiguration", false, false);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user