Merge branch 'feature/REQ-3982'
# Conflicts: # workflow-engine-core/src/main/java/cn/axzo/workflow/core/engine/cmd/CustomGetProcessInstanceVariablesCmd.java # workflow-engine-server/src/main/java/cn/axzo/workflow/server/controller/web/bpmn/BpmnProcessModelController.java # workflow-engine-server/src/main/java/cn/axzo/workflow/server/controller/web/manage/PrintAdminController.java
This commit is contained in:
commit
6f5ef4adf8
@ -13,7 +13,6 @@ import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.FileSystem;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
@ -84,7 +83,7 @@ public class WorkflowEngineClientAutoConfiguration {
|
||||
Map<String, String> env = new HashMap<>();
|
||||
env.put("create", "true");
|
||||
try {
|
||||
FileSystem zipfs = FileSystems.newFileSystem(location.toURI(), env);
|
||||
FileSystems.newFileSystem(location.toURI(), env);
|
||||
} catch (Exception e1) {
|
||||
log.error("linux env create new FS error: {}", e1.getMessage());
|
||||
}
|
||||
@ -102,7 +101,7 @@ public class WorkflowEngineClientAutoConfiguration {
|
||||
Map<String, String> env = new HashMap<>();
|
||||
env.put("create", "true");
|
||||
try {
|
||||
FileSystem zipfs = FileSystems.newFileSystem(location.toURI(), env);
|
||||
FileSystems.newFileSystem(location.toURI(), env);
|
||||
} catch (Exception e) {
|
||||
log.error("linux env create new FS error: {}", e.getMessage());
|
||||
}
|
||||
|
||||
@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.NO_TENANT_ID;
|
||||
import static cn.axzo.workflow.common.enums.RpcInvokeModeEnum.SYNC;
|
||||
|
||||
/**
|
||||
@ -79,7 +80,8 @@ public interface ProcessDefinitionApi {
|
||||
*/
|
||||
@GetMapping("/api/process/definition/active/getByKey")
|
||||
@InvokeMode(SYNC)
|
||||
CommonResponse<BpmnProcessDefinitionVO> getActiveProcessDefinitionByKey(@NotBlank(message = "模型定义KEY不能为空") @RequestParam String key);
|
||||
CommonResponse<BpmnProcessDefinitionVO> getActiveProcessDefinitionByKey(@NotBlank(message = "模型定义KEY不能为空") @RequestParam String key,
|
||||
@RequestParam(required = false, defaultValue = NO_TENANT_ID) String tenantId);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -1,12 +1,10 @@
|
||||
package cn.axzo.workflow.client.feign.manage;
|
||||
|
||||
import cn.axzo.workflow.client.annotation.WorkflowEngineFeignClient;
|
||||
import cn.axzo.workflow.client.config.CommonFeignConfiguration;
|
||||
import cn.axzo.workflow.common.annotation.InvokeMode;
|
||||
import cn.axzo.workflow.common.annotation.Manageable;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.BpmnButtonMetaInfo;
|
||||
import cn.azxo.framework.common.model.CommonResponse;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -4,7 +4,6 @@ import cn.axzo.framework.data.mybatisplus.model.BaseEntity;
|
||||
import cn.axzo.workflow.common.enums.AdminDataSource;
|
||||
import cn.axzo.workflow.common.enums.AdminRoleType;
|
||||
import cn.axzo.workflow.common.enums.AdminTypeEnum;
|
||||
import cn.axzo.workflow.common.enums.WorkspaceType;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@ -44,7 +44,7 @@ public enum BpmnProcessInstanceResultEnum {
|
||||
* @param result 结果
|
||||
* @return 是否
|
||||
*/
|
||||
public static boolean isEndResult(Integer result) {
|
||||
public static boolean isEndResult(String result) {
|
||||
return Arrays.asList(PROCESSING.getStatus(), APPROVED.getStatus(), REJECTED.getStatus(),
|
||||
CANCELLED.getStatus()).contains(result);
|
||||
}
|
||||
|
||||
@ -34,4 +34,11 @@ public class PrintFieldQueryDTO {
|
||||
*/
|
||||
@ApiModelProperty(value = "租户 ID")
|
||||
private String tenantId;
|
||||
|
||||
/**
|
||||
* 是否抛出内部异常
|
||||
*/
|
||||
@ApiModelProperty(value = "是否报错内部异常")
|
||||
@Builder.Default
|
||||
private Boolean throwException = true;
|
||||
}
|
||||
|
||||
@ -7,6 +7,8 @@ import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.NO_TENANT_ID;
|
||||
|
||||
/**
|
||||
* 获取打印模板配置内容入参模型
|
||||
*
|
||||
@ -19,6 +21,7 @@ import lombok.NoArgsConstructor;
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class PrintTemplateConfigQueryDTO {
|
||||
|
||||
/**
|
||||
* 审批模型 ID
|
||||
*/
|
||||
@ -30,4 +33,16 @@ public class PrintTemplateConfigQueryDTO {
|
||||
*/
|
||||
@ApiModelProperty(value = "流程实例 ID")
|
||||
private String processInstanceId;
|
||||
|
||||
/**
|
||||
* 业务 ID
|
||||
*/
|
||||
@ApiModelProperty(value = "业务 ID")
|
||||
private String processDefinitionKey;
|
||||
|
||||
/**
|
||||
* 租户 ID,配置 processDefinitionKey 使用
|
||||
*/
|
||||
@ApiModelProperty(value = "租户 ID")
|
||||
private String tenantId = NO_TENANT_ID;
|
||||
}
|
||||
|
||||
@ -35,4 +35,7 @@ public class StartFormSearchDTO {
|
||||
*/
|
||||
@ApiModelProperty(value = "是否显示原始的默认值", hidden = true, notes = "如果为 true 则将默认值中的 ${} 变量不进行替换")
|
||||
private Boolean showOriginDefaultValue = false;
|
||||
|
||||
@ApiModelProperty(value = "是否抛出内部异常")
|
||||
private Boolean throwException = true;
|
||||
}
|
||||
|
||||
@ -85,10 +85,12 @@ public abstract class CommonContext<T> implements OperationContext {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setContext(OperationContext context) {
|
||||
this.context = (T) context;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public T getContext() {
|
||||
return context;
|
||||
|
||||
@ -5,15 +5,12 @@ import cn.axzo.workflow.core.repository.entity.ExtAxApiLog;
|
||||
import cn.axzo.workflow.core.service.ExtAxApiLogService;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@ -5,13 +5,10 @@ import cn.axzo.workflow.common.model.request.bpmn.BpmnCarbonCopyConf;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.BpmnJsonNode;
|
||||
import org.flowable.bpmn.model.ExtensionAttribute;
|
||||
import org.flowable.bpmn.model.ExtensionElement;
|
||||
import org.flowable.bpmn.model.FlowableListener;
|
||||
import org.flowable.bpmn.model.Process;
|
||||
import org.flowable.bpmn.model.ServiceTask;
|
||||
import org.flowable.bpmn.model.UserTask;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
@ -38,6 +38,7 @@ public class PreTaskUserProcessor implements ApproverScopeProcessor {
|
||||
// 上级节点
|
||||
String preActivityId = preUserTaskOpt.get().getId();
|
||||
// 获取上一级节点
|
||||
@SuppressWarnings("unchecked")
|
||||
List<BpmnTaskDelegateAssigner> assigners = (List<BpmnTaskDelegateAssigner>) execution
|
||||
.getVariableLocal(INTERNAL_ACTIVITY_RELATION_ASSIGNEE_LIST_INFO_SNAPSHOT + preActivityId);
|
||||
List<OrgScope> entOrg = CollectionUtils.emptyIfNull(assigners).stream()
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package cn.axzo.workflow.core.engine.cmd;
|
||||
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskDelegateAssigner;
|
||||
import cn.axzo.workflow.common.exception.WorkflowEngineException;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskDelegateAssigner;
|
||||
import cn.axzo.workflow.core.engine.cmd.helper.CustomTaskHelper;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.flowable.common.engine.impl.interceptor.CommandContext;
|
||||
@ -24,16 +24,16 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import static cn.axzo.workflow.common.code.BpmnInstanceRespCode.PROCESS_INSTANCE_ID_NOT_EXISTS;
|
||||
import static cn.axzo.workflow.common.code.BpmnTaskRespCode.ACTIVITY_BIZ_SET_ASSIGNEE_ERROR;
|
||||
import static cn.axzo.workflow.common.code.BpmnTaskRespCode.ACTIVITY_CANT_SET_ASSIGNEE;
|
||||
import static cn.axzo.workflow.common.code.BpmnTaskRespCode.PROCESS_CANT_SET_ASSIGNEE;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.HIDDEN_ASSIGNEE_ID;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_ACTIVITY_RELATION_ASSIGNEE_LIST_INFO_SNAPSHOT;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.NO_ASSIGNEE;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.TASK_COMPLETE_OPERATION_TYPE;
|
||||
import static cn.axzo.workflow.common.enums.BpmnProcessInstanceResultEnum.DELETED;
|
||||
import static cn.axzo.workflow.common.enums.BpmnProcessInstanceResultEnum.PROCESSING;
|
||||
import static cn.axzo.workflow.common.code.BpmnInstanceRespCode.PROCESS_INSTANCE_ID_NOT_EXISTS;
|
||||
import static cn.axzo.workflow.common.code.BpmnTaskRespCode.ACTIVITY_BIZ_SET_ASSIGNEE_ERROR;
|
||||
import static cn.axzo.workflow.common.code.BpmnTaskRespCode.ACTIVITY_CANT_SET_ASSIGNEE;
|
||||
import static cn.axzo.workflow.common.code.BpmnTaskRespCode.PROCESS_CANT_SET_ASSIGNEE;
|
||||
import static cn.axzo.workflow.core.engine.cmd.helper.CustomTaskHelper.validTaskAssignerCount;
|
||||
|
||||
/**
|
||||
@ -133,6 +133,7 @@ public class CustomBizSpecifyAssigneeToTaskCmd extends AbstractCommand<Boolean>
|
||||
CommandContextUtil.getProcessEngineConfiguration(commandContext);
|
||||
RuntimeService runtimeService = processEngineConfiguration.getRuntimeService();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<BpmnTaskDelegateAssigner> originAssingeeList = runtimeService.getVariable(task.getProcessInstanceId(),
|
||||
INTERNAL_ACTIVITY_RELATION_ASSIGNEE_LIST_INFO_SNAPSHOT + task.getTaskDefinitionKey(), List.class);
|
||||
|
||||
|
||||
@ -23,9 +23,7 @@ import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@ -37,7 +35,6 @@ import static cn.axzo.workflow.common.enums.BpmnProcessInstanceResultEnum.COUNTE
|
||||
import static cn.axzo.workflow.core.engine.cmd.helper.CustomTaskHelper.batchAddAttachment;
|
||||
import static cn.axzo.workflow.core.engine.cmd.helper.CustomTaskHelper.completeVirtualTask;
|
||||
import static cn.axzo.workflow.core.engine.cmd.helper.CustomTaskHelper.createVirtualTask;
|
||||
import static cn.axzo.workflow.core.engine.cmd.helper.CustomTaskHelper.deleteMultiTasks;
|
||||
import static cn.axzo.workflow.core.engine.cmd.helper.CustomTaskHelper.getDuplicatePendingTasks;
|
||||
import static cn.axzo.workflow.core.engine.cmd.helper.CustomTaskHelper.validTask;
|
||||
import static cn.axzo.workflow.core.engine.cmd.helper.CustomTaskHelper.validTaskAssignerCount;
|
||||
|
||||
@ -269,7 +269,7 @@ public class CustomGetFormInstanceModelCmd extends GetFormInstanceModelCmd {
|
||||
// explicitly storing them as an array so they're serialized properly
|
||||
if (variables.containsKey(field.getId())) {
|
||||
String uploadValue = (String) variables.get(field.getId());
|
||||
if (uploadValue != null) {
|
||||
if (StringUtils.hasText(uploadValue)) {
|
||||
try {
|
||||
List<UploadFieldDTO> uploadFiles = formEngineConfiguration.getObjectMapper()
|
||||
.readValue(uploadValue, new TypeReference<List<UploadFieldDTO>>() {
|
||||
@ -285,7 +285,7 @@ public class CustomGetFormInstanceModelCmd extends GetFormInstanceModelCmd {
|
||||
|| FORM_FIELD_TYPE_CHANGE_SIGNATURE_ORDER.equals(field.getType())) {
|
||||
if (variables.containsKey(field.getId())) {
|
||||
String listValue = (String) variables.get(field.getId());
|
||||
if (listValue != null) {
|
||||
if (StringUtils.hasText(listValue)) {
|
||||
try {
|
||||
List<Map<String, String>> idMap = formEngineConfiguration.getObjectMapper()
|
||||
.readValue(listValue, new TypeReference<List<Map<String, String>>>() {
|
||||
@ -298,7 +298,7 @@ public class CustomGetFormInstanceModelCmd extends GetFormInstanceModelCmd {
|
||||
}
|
||||
} else if (FORM_FIELD_TYPE_CUSTOM_COMPONENT.equals(field.getType())) {
|
||||
String listJson = (String) variables.get(field.getId());
|
||||
if (listJson != null) {
|
||||
if (StringUtils.hasText(listJson)) {
|
||||
ObjectMapper objectMapper = formEngineConfiguration.getObjectMapper();
|
||||
try {
|
||||
List<Map> rows = objectMapper.readValue(listJson, new TypeReference<List<Map>>() {
|
||||
@ -318,7 +318,7 @@ public class CustomGetFormInstanceModelCmd extends GetFormInstanceModelCmd {
|
||||
|
||||
try {
|
||||
String updateValueJson = objectMapper.writeValueAsString(rows.get(0).get(sf.getId()));
|
||||
if (updateValueJson != null) {
|
||||
if (StringUtils.hasText(updateValueJson)) {
|
||||
List<UploadFieldDTO> uploadFiles = formEngineConfiguration.getObjectMapper()
|
||||
.readValue(updateValueJson, new TypeReference<List<UploadFieldDTO>>() {
|
||||
});
|
||||
@ -354,7 +354,7 @@ public class CustomGetFormInstanceModelCmd extends GetFormInstanceModelCmd {
|
||||
if (rowMap.containsKey(sf.getId())) {
|
||||
try {
|
||||
String updateValueJson = objectMapper.writeValueAsString(rowMap.get(sf.getId()));
|
||||
if (updateValueJson != null) {
|
||||
if (StringUtils.hasText(updateValueJson)) {
|
||||
List<UploadFieldDTO> uploadFiles = formEngineConfiguration.getObjectMapper()
|
||||
.readValue(updateValueJson, new TypeReference<List<UploadFieldDTO>>() {
|
||||
});
|
||||
|
||||
@ -9,7 +9,6 @@ import cn.axzo.workflow.core.engine.listener.EngineExecutionStartListener;
|
||||
import cn.axzo.workflow.core.engine.model.NoticeFlowElement;
|
||||
import cn.axzo.workflow.core.service.converter.BpmnHistoricTaskInstanceConverter;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.flowable.common.engine.impl.interceptor.Command;
|
||||
import org.flowable.common.engine.impl.interceptor.CommandContext;
|
||||
import org.flowable.engine.HistoryService;
|
||||
import org.flowable.engine.RuntimeService;
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
package cn.axzo.workflow.core.engine.cmd;
|
||||
|
||||
import org.flowable.bpmn.model.TimerEventDefinition;
|
||||
import org.flowable.common.engine.impl.interceptor.CommandContext;
|
||||
import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;
|
||||
import org.flowable.engine.impl.util.CommandContextUtil;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
@ -138,6 +138,7 @@ public class CustomTransferUserTaskCmd extends AbstractCommand<Void> implements
|
||||
|
||||
public void processAssignee(ProcessEngineConfigurationImpl processEngineConfiguration, Task task) {
|
||||
RuntimeService runtimeService = processEngineConfiguration.getRuntimeService();
|
||||
@SuppressWarnings("unchecked")
|
||||
List<BpmnTaskDelegateAssigner> originAssingeeList = runtimeService.getVariable(task.getProcessInstanceId(),
|
||||
INTERNAL_ACTIVITY_RELATION_ASSIGNEE_LIST_INFO_SNAPSHOT + task.getTaskDefinitionKey(), List.class);
|
||||
List<BpmnTaskDelegateAssigner> resultList = new ArrayList<>();
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package cn.axzo.workflow.core.engine.job;
|
||||
|
||||
import cn.axzo.workflow.common.model.request.bpmn.process.BpmnProcessInstanceAbortDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.process.BpmnProcessInstanceCancelDTO;
|
||||
import cn.axzo.workflow.core.engine.cmd.CustomAbortProcessInstanceCmd;
|
||||
import cn.axzo.workflow.core.service.ExtAxHiTaskInstService;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
package cn.axzo.workflow.core.engine.job;
|
||||
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskAuditDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskAuditWithFormDTO;
|
||||
import cn.axzo.workflow.core.engine.cmd.CustomApproveTaskCmd;
|
||||
import cn.axzo.workflow.core.engine.cmd.CustomApproveTaskWithFormCmd;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@ -3,10 +3,7 @@ package cn.axzo.workflow.core.engine.job.service;
|
||||
import cn.axzo.workflow.common.constant.LogFieldConstants;
|
||||
import cn.axzo.workflow.core.engine.job.utils.AsyncJobUtils;
|
||||
import cn.azxo.framework.common.constatns.Constants;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.flowable.job.service.JobProcessor;
|
||||
import org.flowable.job.service.JobProcessorContext;
|
||||
import org.flowable.job.service.impl.persistence.entity.AbstractJobEntity;
|
||||
|
||||
@ -30,11 +30,22 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.*;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.AND_SIGN_EXPRESSION;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.COMMENT_TYPE_ADVICE;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.COMMENT_TYPE_OPERATION_DESC;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.HIDDEN_ASSIGNEE_ID;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_ACTIVITY_RELATION_ASSIGNEE_LIST_INFO_SNAPSHOT;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_TASK_RELATION_ASSIGNEE_INFO;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.NO_ASSIGNEE;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.TASK_COMPLETE_OPERATION_TYPE;
|
||||
import static cn.axzo.workflow.common.enums.ApprovalMethodEnum.nobody;
|
||||
import static cn.axzo.workflow.common.enums.BpmnFlowNodeMode.*;
|
||||
import static cn.axzo.workflow.common.enums.BpmnFlowNodeMode.AND;
|
||||
import static cn.axzo.workflow.common.enums.BpmnFlowNodeMode.GENERAL;
|
||||
import static cn.axzo.workflow.common.enums.BpmnFlowNodeMode.OR;
|
||||
import static cn.axzo.workflow.common.enums.BpmnFlowNodeType.NODE_STARTER;
|
||||
import static cn.axzo.workflow.common.enums.BpmnProcessInstanceResultEnum.*;
|
||||
import static cn.axzo.workflow.common.enums.BpmnProcessInstanceResultEnum.APPROVED;
|
||||
import static cn.axzo.workflow.common.enums.BpmnProcessInstanceResultEnum.DELETED;
|
||||
import static cn.axzo.workflow.common.enums.BpmnProcessInstanceResultEnum.PROCESSING;
|
||||
import static cn.axzo.workflow.core.common.enums.BpmnProcessTaskResultEnum.PENDING;
|
||||
import static cn.axzo.workflow.core.common.utils.BpmnMetaParserHelper.getActivitySignature;
|
||||
import static cn.axzo.workflow.core.common.utils.BpmnMetaParserHelper.getApprovalMethod;
|
||||
@ -114,6 +125,7 @@ public class TaskEntityEventHandle implements EntityEventHandle<TaskEntity> {
|
||||
} else {
|
||||
ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration();
|
||||
RuntimeService runtimeService = processEngineConfiguration.getRuntimeService();
|
||||
@SuppressWarnings("unchecked")
|
||||
List<BpmnTaskDelegateAssigner> assigneeList = runtimeService.getVariable(taskEntity.getProcessInstanceId(),
|
||||
INTERNAL_ACTIVITY_RELATION_ASSIGNEE_LIST_INFO_SNAPSHOT + taskEntity.getTaskDefinitionKey(), List.class);
|
||||
ListUtils.emptyIfNull(assigneeList).stream().filter(e -> Objects.equals(e.buildAssigneeId(), taskEntity.getAssignee())).findAny()
|
||||
@ -180,6 +192,7 @@ public class TaskEntityEventHandle implements EntityEventHandle<TaskEntity> {
|
||||
// 判断是否抄送节点,如果是的话,需要将抄送人集合放入对应字段
|
||||
if (isCarbonCopyNode(queryLog)) {
|
||||
// 抄送人集合
|
||||
@SuppressWarnings("unchecked")
|
||||
List<BpmnTaskDelegateAssigner> carbonCopies = runtimeService.getVariable(taskEntity.getProcessInstanceId(), INTERNAL_ACTIVITY_RELATION_ASSIGNEE_LIST_INFO_SNAPSHOT + taskEntity.getTaskDefinitionKey(), List.class);
|
||||
update.setAssigneeFull(carbonCopies);
|
||||
update.setOperationDesc("抄送" + carbonCopies.size() + "人");
|
||||
|
||||
@ -17,11 +17,13 @@ public abstract class AbstractBpmnEventListener<T extends OperationContext> impl
|
||||
|
||||
private T context;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void setContext(OperationContext context) {
|
||||
this.context = (T) context;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public T getContext() {
|
||||
return context;
|
||||
|
||||
@ -4,7 +4,6 @@ import cn.axzo.workflow.common.model.request.bpmn.activity.BpmnActivityTimeoutCa
|
||||
import cn.axzo.workflow.common.model.request.bpmn.activity.BpmnActivityTimeoutTriggerDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnActivitySetAssigneeDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnActivityTriggerDTO;
|
||||
import org.flowable.job.service.impl.persistence.entity.JobEntity;
|
||||
|
||||
/**
|
||||
* 流程活动的 Service
|
||||
|
||||
@ -4,7 +4,6 @@ import cn.axzo.workflow.common.model.dto.BpmnFormRelationCreateDTO;
|
||||
import cn.axzo.workflow.common.model.dto.BpmnFormRelationSearchDTO;
|
||||
import cn.axzo.workflow.common.model.response.BpmPageResult;
|
||||
import cn.axzo.workflow.core.repository.entity.ExtAxBpmnFormRelation;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@ -1,10 +1,8 @@
|
||||
package cn.axzo.workflow.core.service;
|
||||
|
||||
import cn.axzo.workflow.common.model.dto.BpmnFormRelationSearchDTO;
|
||||
import cn.axzo.workflow.common.model.request.form.definition.FormDefinitionSearchDTO;
|
||||
import cn.axzo.workflow.common.model.request.form.definition.StartFormSearchDTO;
|
||||
import cn.axzo.workflow.common.model.request.form.instance.FormDetailDTO;
|
||||
import cn.axzo.workflow.common.model.request.form.instance.FormInstanceSearchDTO;
|
||||
import cn.axzo.workflow.common.model.response.form.FormVO;
|
||||
import cn.axzo.workflow.common.model.response.form.definition.FormDefinitionVO;
|
||||
import cn.axzo.workflow.common.model.response.form.instance.FormInstanceVO;
|
||||
|
||||
@ -11,7 +11,6 @@ import org.flowable.engine.HistoryService;
|
||||
import org.flowable.engine.RepositoryService;
|
||||
import org.flowable.engine.history.HistoricProcessInstance;
|
||||
import org.flowable.engine.history.HistoricProcessInstanceQuery;
|
||||
import org.flowable.engine.impl.HistoryServiceImpl;
|
||||
import org.flowable.spring.SpringProcessEngineConfiguration;
|
||||
import org.flowable.variable.api.history.HistoricVariableInstance;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
|
||||
@ -956,7 +956,7 @@ public class BpmnProcessInstanceServiceImpl implements BpmnProcessInstanceServic
|
||||
|
||||
NativeHistoricProcessInstanceQuery countSqlQuery = query.sql(countSql(baseQuerySql));
|
||||
if (StringUtils.hasText(dto.getKey())) {
|
||||
return new BpmPageResult(historicProcessInstanceConverter.toVos(instances, dto.getKey()),
|
||||
return new BpmPageResult<>(historicProcessInstanceConverter.toVos(instances, dto.getKey()),
|
||||
countSqlQuery.count());
|
||||
} else {
|
||||
Set<String> procDefIds = new HashSet<>();
|
||||
@ -968,7 +968,7 @@ public class BpmnProcessInstanceServiceImpl implements BpmnProcessInstanceServic
|
||||
List<HistoricProcessInstanceVO> vos = new ArrayList<>();
|
||||
instances.forEach(i -> vos.add(historicProcessInstanceConverter.toVo(i,
|
||||
defCategoryMap.getOrDefault(i.getProcessDefinitionId(), ""))));
|
||||
return new BpmPageResult(vos, countSqlQuery.count());
|
||||
return new BpmPageResult<>(vos, countSqlQuery.count());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -891,6 +891,7 @@ public class BpmnProcessTaskServiceImpl implements BpmnProcessTaskService {
|
||||
Process process = ProcessDefinitionUtil.getProcess(processInstance.getProcessDefinitionId());
|
||||
Optional<BpmnNoticeConf> noticeConfig =
|
||||
BpmnMetaParserHelper.getNoticeConfig(process);
|
||||
@SuppressWarnings("unchecked")
|
||||
List<BpmnTaskDelegateAssigner> assigners =
|
||||
(List<BpmnTaskDelegateAssigner>) runtimeService.getVariable(dto.getProcessInstanceId(),
|
||||
INTERNAL_ACTIVITY_RELATION_ASSIGNEE_LIST_INFO_SNAPSHOT + dto.getTaskDefinitionKey());
|
||||
|
||||
@ -19,7 +19,7 @@ import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static cn.axzo.workflow.common.code.BpmnModelRespCode.MODEL_ID_NOT_EXISTS;
|
||||
import static cn.axzo.workflow.common.code.BpmnModelRespCode.MODEL_NOT_EXISTS;
|
||||
|
||||
|
||||
/**
|
||||
@ -57,7 +57,7 @@ public class ExtAxReModelServiceImpl implements ExtAxReModelService {
|
||||
public void changeStatus(String modelId, Integer status, ExtModelStateFieldEnum field) {
|
||||
ExtAxReModel reModel = extAxReModelMapper.selectOne(new QueryWrapper<ExtAxReModel>().eq("model_id", modelId));
|
||||
if (Objects.isNull(reModel)) {
|
||||
throw new WorkflowEngineException(MODEL_ID_NOT_EXISTS, reModel.getModelId());
|
||||
throw new WorkflowEngineException(MODEL_NOT_EXISTS);
|
||||
}
|
||||
if (Objects.equals(field, ExtModelStateFieldEnum.status)) {
|
||||
reModel.setStatus(status);
|
||||
@ -78,7 +78,7 @@ public class ExtAxReModelServiceImpl implements ExtAxReModelService {
|
||||
public void printTemplateConfig(PrintTemplateConfigUpsertDTO dto) {
|
||||
ExtAxReModel model = extAxReModelMapper.selectOne(new QueryWrapper<ExtAxReModel>().eq("model_id", dto.getModelId()));
|
||||
if (Objects.isNull(model)) {
|
||||
throw new WorkflowEngineException(MODEL_ID_NOT_EXISTS, model.getModelId());
|
||||
throw new WorkflowEngineException(MODEL_NOT_EXISTS);
|
||||
}
|
||||
if (Objects.nonNull(dto.getPrintFileName())) {
|
||||
model.setPrintFileName(dto.getPrintFileName());
|
||||
@ -102,7 +102,7 @@ public class ExtAxReModelServiceImpl implements ExtAxReModelService {
|
||||
public PrintModelDTO getPrintTemplateConfig(String modelId) {
|
||||
ExtAxReModel model = extAxReModelMapper.selectOne(new QueryWrapper<ExtAxReModel>().eq("model_id", modelId));
|
||||
if (Objects.isNull(model)) {
|
||||
throw new WorkflowEngineException(MODEL_ID_NOT_EXISTS, model.getModelId());
|
||||
throw new WorkflowEngineException(MODEL_NOT_EXISTS);
|
||||
}
|
||||
return PrintModelDTO.builder()
|
||||
.printFileName(model.getPrintFileName())
|
||||
|
||||
@ -38,6 +38,7 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
@ -94,29 +95,32 @@ public class FormCoreServiceImpl implements FormCoreService {
|
||||
FormInfo formModel;
|
||||
try {
|
||||
formModel = formRepositoryService.getFormModelByKey(dto.getKey(), dto.getTenantId(), true);
|
||||
BpmnProcessDefinitionVO definitionVO = bpmnProcessDefinitionService.getActiveProcessDefinitionByKey(dto.getKey(), dto.getTenantId());
|
||||
CommandExecutor commandExecutor = springProcessEngineConfiguration.getCommandExecutor();
|
||||
BpmnModel bpmnModel = commandExecutor.execute(new GetBpmnModelCmd(definitionVO.getId()));
|
||||
BpmnMetaParserHelper.getFormFieldPermissionConf(bpmnModel.getFlowElement(NODE_STARTER.getType()))
|
||||
.ifPresent(permission -> {
|
||||
if (formModel.getFormModel() instanceof SimpleFormModel) {
|
||||
SimpleFormModel simpleFormModel = (SimpleFormModel) formModel.getFormModel();
|
||||
FormHelper.populateFormModel(simpleFormModel, permission, new HashMap<>(), dto.getShowOriginDefaultValue());
|
||||
}
|
||||
});
|
||||
FormDefinitionVO formDefinitionVO = new FormDefinitionVO();
|
||||
formDefinitionVO.setFormDefinitionId(formModel.getId());
|
||||
formDefinitionVO.setName(formModel.getName());
|
||||
formDefinitionVO.setKey(formModel.getKey());
|
||||
formDefinitionVO.setVersion(formModel.getVersion());
|
||||
formDefinitionVO.setTenantId(dto.getTenantId());
|
||||
List<FormField> fields = ((SimpleFormModel) formModel.getFormModel()).getFields();
|
||||
formDefinitionVO.setFields(formFieldConverter.toVos(fields));
|
||||
return formDefinitionVO;
|
||||
} catch (FlowableObjectNotFoundException e) {
|
||||
log.warn("can't found form model");
|
||||
throw new WorkflowEngineException(FORM_MODEL_NOT_EXISTS);
|
||||
if (Objects.equals(Boolean.TRUE, dto.getThrowException())) {
|
||||
throw new WorkflowEngineException(FORM_MODEL_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
BpmnProcessDefinitionVO definitionVO = bpmnProcessDefinitionService.getActiveProcessDefinitionByKey(dto.getKey(), dto.getTenantId());
|
||||
CommandExecutor commandExecutor = springProcessEngineConfiguration.getCommandExecutor();
|
||||
BpmnModel bpmnModel = commandExecutor.execute(new GetBpmnModelCmd(definitionVO.getId()));
|
||||
BpmnMetaParserHelper.getFormFieldPermissionConf(bpmnModel.getFlowElement(NODE_STARTER.getType()))
|
||||
.ifPresent(permission -> {
|
||||
if (formModel.getFormModel() instanceof SimpleFormModel) {
|
||||
SimpleFormModel simpleFormModel = (SimpleFormModel) formModel.getFormModel();
|
||||
FormHelper.populateFormModel(simpleFormModel, permission, new HashMap<>(), dto.getShowOriginDefaultValue());
|
||||
}
|
||||
});
|
||||
FormDefinitionVO formDefinitionVO = new FormDefinitionVO();
|
||||
formDefinitionVO.setFormDefinitionId(formModel.getId());
|
||||
formDefinitionVO.setName(formModel.getName());
|
||||
formDefinitionVO.setKey(formModel.getKey());
|
||||
formDefinitionVO.setVersion(formModel.getVersion());
|
||||
formDefinitionVO.setTenantId(dto.getTenantId());
|
||||
List<FormField> fields = ((SimpleFormModel) formModel.getFormModel()).getFields();
|
||||
formDefinitionVO.setFields(formFieldConverter.toVos(fields));
|
||||
return formDefinitionVO;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -2,13 +2,11 @@ package org.flowable.engine.impl.cmd;
|
||||
|
||||
import cn.axzo.workflow.core.engine.cmd.AbstractCommand;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import liquibase.pro.packaged.M;
|
||||
import org.flowable.common.engine.api.FlowableException;
|
||||
import org.flowable.common.engine.api.FlowableObjectNotFoundException;
|
||||
import org.flowable.common.engine.api.delegate.event.FlowableEngineEventType;
|
||||
import org.flowable.common.engine.api.delegate.event.FlowableEventDispatcher;
|
||||
import org.flowable.common.engine.impl.identity.Authentication;
|
||||
import org.flowable.common.engine.impl.interceptor.Command;
|
||||
import org.flowable.common.engine.impl.interceptor.CommandContext;
|
||||
import org.flowable.common.engine.impl.persistence.entity.ByteArrayEntity;
|
||||
import org.flowable.common.engine.impl.util.IoUtil;
|
||||
|
||||
@ -4,7 +4,6 @@ package cn.axzo.workflow.form.service;
|
||||
import cn.axzo.workflow.common.model.request.form.instance.FormContentUpdateDTO;
|
||||
import cn.axzo.workflow.common.model.request.form.instance.FormInstanceSearchDTO;
|
||||
import cn.axzo.workflow.common.model.response.form.instance.FormInstanceVO;
|
||||
import org.flowable.form.api.FormInstanceInfo;
|
||||
|
||||
/**
|
||||
* 表单实例相关接口
|
||||
|
||||
@ -6,25 +6,30 @@ package cn.axzo.workflow.form.service.converter;
|
||||
* @author wangli
|
||||
* @since 2024-11-11 13:42
|
||||
*/
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ConversionUtils {
|
||||
public static List<String> convertObjectToList(Object obj) {
|
||||
public static Object convertObject(Object obj) {
|
||||
if (obj instanceof List) {
|
||||
List<?> list = (List<?>) obj;
|
||||
List<String> stringList = new ArrayList<>();
|
||||
for (Object item : list) {
|
||||
if (item instanceof String) {
|
||||
stringList.add((String) item);
|
||||
} else {
|
||||
// 处理非字符串类型的情况,可以选择忽略、抛出异常或进行其他处理
|
||||
}
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return null;
|
||||
}
|
||||
return list;
|
||||
} else if (obj instanceof String) {
|
||||
if (StringUtils.pathEquals(obj.toString(), "[]")) {
|
||||
return null;
|
||||
} else if (StringUtils.hasText(obj.toString()) && ((String) obj).startsWith("[") && ((String) obj).endsWith("]")) {
|
||||
return ((String) obj).replace("[", "").replace("]", "");
|
||||
}
|
||||
return stringList;
|
||||
} else {
|
||||
// 如果输入不是列表类型,返回空列表或进行其他处理
|
||||
return new ArrayList<>();
|
||||
return obj;
|
||||
} else {
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@ public interface FormFieldConverter extends EntityConverter<FormFieldDTO, FormFi
|
||||
@Mapping(target = "id", source = "entity.id")
|
||||
@Mapping(target = "name", source = "entity.name")
|
||||
@Mapping(target = "type", source = "entity.type")
|
||||
@Mapping(target = "value", expression = "java(ConversionUtils.convertObjectToList(entity.getValue()))")
|
||||
@Mapping(target = "value", expression = "java(ConversionUtils.convertObject(entity.getValue()))")
|
||||
@Mapping(target = "placeholder", source = "entity.placeholder")
|
||||
@Mapping(target = "params", source = "entity.params")
|
||||
FormFieldDTO toVo(FormField entity);
|
||||
@ -38,7 +38,7 @@ public interface FormFieldConverter extends EntityConverter<FormFieldDTO, FormFi
|
||||
@Mapping(target = "id", source = "entity.id")
|
||||
@Mapping(target = "name", source = "entity.name")
|
||||
@Mapping(target = "type", source = "entity.type")
|
||||
@Mapping(target = "value", expression = "java(ConversionUtils.convertObjectToList(entity.getValue()))")
|
||||
@Mapping(target = "value", expression = "java(ConversionUtils.convertObject(entity.getValue()))")
|
||||
@Mapping(target = "placeholder", source = "entity.placeholder")
|
||||
@Mapping(target = "params", source = "entity.params")
|
||||
@Mapping(target = "fields", source = "entity.fields")
|
||||
|
||||
@ -61,7 +61,7 @@ public interface FormInstanceConverter extends EntityConverter<FormInstanceVO, F
|
||||
formFieldDTO.setType(formField.getType());
|
||||
formFieldDTO.setId(formField.getId());
|
||||
formFieldDTO.setName(formField.getName());
|
||||
formFieldDTO.setValue(formField.getValue());
|
||||
formFieldDTO.setValue(ConversionUtils.convertObject(formField.getValue()));
|
||||
formFieldDTO.setPlaceholder(formField.getPlaceholder());
|
||||
formFieldDTO.setParams(formField.getParams());
|
||||
if (formField instanceof FormContainer) {
|
||||
|
||||
@ -9,8 +9,6 @@ import org.flowable.common.engine.api.FlowableOptimisticLockingException;
|
||||
import org.flowable.common.engine.impl.interceptor.CommandContext;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static cn.axzo.framework.domain.web.code.BaseCode.UNAVAILABLE_FOR_LEGAL_REASONS;
|
||||
|
||||
/**
|
||||
* 降级 FlowableOptimisticLockingException 异常,该异常在 Flowable 框架中是可以忽略的
|
||||
*
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package cn.axzo.workflow.server.common.util;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import liquibase.pro.packaged.D;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
|
||||
@ -73,6 +73,7 @@ public class BasedInitiatorSpecifiedTaskAssigneeSelector extends AbstractBpmnTas
|
||||
*/
|
||||
private void populateAssigneeByInitiatorSpecify(List<BpmnTaskDelegateAssigner> assigners, FlowElement flowElement, DelegateExecution execution) {
|
||||
String processInstanceId = execution.getProcessInstanceId();
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, List<BpmnTaskDelegateAssigner>> initiatorSpecifyMap = runtimeService.getVariable(processInstanceId, INITIATOR_SPECIFY, Map.class);
|
||||
if (CollectionUtils.isEmpty(initiatorSpecifyMap)) {
|
||||
return;
|
||||
|
||||
@ -13,7 +13,6 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.flowable.bpmn.model.FlowElement;
|
||||
import org.flowable.engine.delegate.DelegateExecution;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
|
||||
@ -363,6 +363,7 @@ public class RocketMqMessagePushEventListener extends AbstractBpmnEventListener<
|
||||
historyService.createHistoricTaskInstanceQuery().taskId(event.getTaskId()).list();
|
||||
if (!CollectionUtils.isEmpty(tasks)) {
|
||||
// 应该只有 1 个, 但是为了防止有多个, 这里只取第一个
|
||||
@SuppressWarnings("unchecked")
|
||||
List<BpmnTaskDelegateAssigner> assigners =
|
||||
(List<BpmnTaskDelegateAssigner>) originVariables.getOrDefault(INTERNAL_ACTIVITY_RELATION_ASSIGNEE_LIST_INFO_SNAPSHOT + tasks.get(0).getTaskDefinitionKey(), Collections.emptyList());
|
||||
assigners.stream().filter(i -> Objects.equals(i.buildAssigneeId(), tasks.get(0).getAssignee())).findAny()
|
||||
|
||||
@ -6,14 +6,12 @@ import cn.axzo.workflow.common.enums.ElasticSearchEventEnum;
|
||||
import cn.axzo.workflow.core.common.context.ProcessOperationContext;
|
||||
import cn.axzo.workflow.core.listener.AbstractBpmnEventListener;
|
||||
import cn.axzo.workflow.core.listener.BpmnProcessEventListener;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.flowable.common.engine.api.delegate.event.FlowableEngineEntityEvent;
|
||||
import org.flowable.engine.delegate.event.FlowableCancelledEvent;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@ -128,6 +128,7 @@ public class MessagePushTaskEvent_103_Listener extends AbstractBpmnEventListener
|
||||
.processInstanceId(delegateTask.getProcessInstanceId())
|
||||
.includeProcessVariables()
|
||||
.singleResult());
|
||||
@SuppressWarnings("unchecked")
|
||||
List<BpmnTaskDelegateAssigner> assigners =
|
||||
(List<BpmnTaskDelegateAssigner>) processInstance.getProcessVariables()
|
||||
.getOrDefault(INTERNAL_ACTIVITY_RELATION_ASSIGNEE_LIST_INFO_SNAPSHOT + delegateTask.getTaskDefinitionKey(), Collections.emptyList());
|
||||
|
||||
@ -46,6 +46,7 @@ public class SnapshotBpmnTaskEvent_100_Listener extends AbstractBpmnEventListene
|
||||
@Override
|
||||
public void onAssigned(DelegateTask delegateTask) {
|
||||
log.info("SnapshotBpmnTaskTaskEventListener#onAssigned...{}, processInstanceId:{}", delegateTask.getTaskDefinitionKey(), delegateTask.getProcessInstanceId());
|
||||
@SuppressWarnings("unchecked")
|
||||
List<BpmnTaskDelegateAssigner> assignerList = runtimeService.getVariable(delegateTask.getProcessInstanceId(),
|
||||
INTERNAL_ACTIVITY_RELATION_ASSIGNEE_LIST_INFO_SNAPSHOT + delegateTask.getTaskDefinitionKey(),
|
||||
List.class);
|
||||
|
||||
@ -11,7 +11,6 @@ import org.flowable.task.service.delegate.DelegateTask;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@ -130,11 +130,10 @@ public class BpmnProcessDefinitionController implements ProcessDefinitionApi {
|
||||
@Operation(summary = "获得流程定义标识对应的激活的流程定义")
|
||||
@GetMapping("/active/getByKey")
|
||||
@Override
|
||||
public CommonResponse<BpmnProcessDefinitionVO> getActiveProcessDefinitionByKey(@NotBlank(message =
|
||||
"模型定义KEY" +
|
||||
"不能为空") @RequestParam String key) {
|
||||
public CommonResponse<BpmnProcessDefinitionVO> getActiveProcessDefinitionByKey(@NotBlank(message = "模型定义KEY不能为空") @RequestParam String key,
|
||||
@RequestParam(required = false, defaultValue = NO_TENANT_ID) String tenantId) {
|
||||
log.info("获得流程定义标识对应的激活的流程定义 getActiveProcessDefinitionByKey===>>>参数:{}", JSONUtil.toJsonStr(key));
|
||||
return success(bpmnProcessDefinitionService.getActiveProcessDefinitionByKey(key, key));
|
||||
return success(bpmnProcessDefinitionService.getActiveProcessDefinitionByKey(key, tenantId));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -216,6 +215,7 @@ public class BpmnProcessDefinitionController implements ProcessDefinitionApi {
|
||||
updateDTO.setTenantId(modelDetail.getTenantId());
|
||||
updateDTO.setJsonModel(processDefinition.getJsonModel());
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, String> metaInfoMap = JSON.parseObject(modelDetail.getMetaInfo(), Map.class);
|
||||
updateDTO.setDescription(metaInfoMap.get(MODEL_DESCRIPTION));
|
||||
|
||||
|
||||
@ -1,9 +1,7 @@
|
||||
package cn.axzo.workflow.server.controller.web.bpmn;
|
||||
|
||||
import cn.axzo.basics.common.BeanMapper;
|
||||
import cn.axzo.nanopart.doc.api.anonymous.DocAnonymousDatabaseApi;
|
||||
import cn.axzo.nanopart.doc.api.index.request.CopyNodeRequest;
|
||||
import cn.axzo.oss.http.api.ServerFileServiceApi;
|
||||
import cn.axzo.oss.http.model.copyobject.ServerFileBatchCopyObjectRequest;
|
||||
import cn.axzo.oss.http.model.copyobject.ServerFileBatchCopyObjectResponse;
|
||||
import cn.axzo.workflow.client.feign.bpmn.ProcessModelApi;
|
||||
@ -30,22 +28,19 @@ import cn.axzo.workflow.common.model.response.BpmPageResult;
|
||||
import cn.axzo.workflow.common.model.response.bpmn.model.BpmnModelDetailVO;
|
||||
import cn.axzo.workflow.common.model.response.bpmn.model.BpmnModelExtVO;
|
||||
import cn.axzo.workflow.common.model.response.bpmn.model.doc.DocBaseVO;
|
||||
import cn.axzo.workflow.common.model.response.bpmn.process.BpmnProcessDefinitionVO;
|
||||
import cn.axzo.workflow.common.model.response.print.PrintModelDTO;
|
||||
import cn.axzo.workflow.core.conf.CustomEventManager;
|
||||
import cn.axzo.workflow.core.engine.cmd.CustomGetModelByDefinitionIdCmd;
|
||||
import cn.axzo.workflow.core.engine.cmd.CustomGetModelDocsCmd;
|
||||
import cn.axzo.workflow.core.engine.event.DocChangeEventImpl;
|
||||
import cn.axzo.workflow.core.repository.entity.ExtAxModelDoc;
|
||||
import cn.axzo.workflow.core.repository.mapper.ExtAxModelDocMapper;
|
||||
import cn.axzo.workflow.core.service.AggregateModelService;
|
||||
import cn.axzo.workflow.core.service.BpmnProcessDefinitionService;
|
||||
import cn.axzo.workflow.core.service.BpmnProcessInstanceService;
|
||||
import cn.axzo.workflow.core.service.BpmnProcessModelService;
|
||||
import cn.axzo.workflow.core.service.ExtAxDocContentService;
|
||||
import cn.axzo.workflow.core.service.ExtAxModelDocService;
|
||||
import cn.axzo.workflow.core.service.ExtAxReModelService;
|
||||
import cn.axzo.workflow.server.common.annotation.ErrorReporter;
|
||||
import cn.axzo.workflow.server.common.annotation.RepeatSubmit;
|
||||
import cn.axzo.workflow.server.common.util.WpsUtil;
|
||||
import cn.azxo.framework.common.model.CommonResponse;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
@ -61,7 +56,7 @@ import lombok.NoArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.flowable.common.engine.impl.interceptor.CommandExecutor;
|
||||
import org.flowable.spring.SpringProcessEngineConfiguration;
|
||||
import org.flowable.engine.repository.Model;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@ -433,12 +428,21 @@ public class BpmnProcessModelController implements ProcessModelApi {
|
||||
@Override
|
||||
public CommonResponse<PrintModelDTO> getPrintTemplateConfig(@Validated @RequestBody PrintTemplateConfigQueryDTO dto) {
|
||||
log.info("获取打印模板配置内容");
|
||||
if (!StringUtils.hasText(dto.getModelId()) && !StringUtils.hasText(dto.getProcessInstanceId())) {
|
||||
throw new WorkflowEngineException(ILLEGAL_PARAM_ERROR, "模型 ID 和实例 ID 不能同时为空");
|
||||
if (!StringUtils.hasText(dto.getModelId()) && !StringUtils.hasText(dto.getProcessInstanceId()) && !StringUtils.hasText(dto.getProcessDefinitionKey())) {
|
||||
if (!StringUtils.hasText(dto.getProcessDefinitionKey()) && !StringUtils.hasText(dto.getTenantId())) {
|
||||
throw new WorkflowEngineException(ILLEGAL_PARAM_ERROR, "processDefinitionKey 与 tenantId 不能同时为空");
|
||||
}
|
||||
throw new WorkflowEngineException(ILLEGAL_PARAM_ERROR, "模型 ID 、实例 ID 和业务 ID 不能同时为空");
|
||||
}
|
||||
if (!StringUtils.hasText(dto.getModelId())) {
|
||||
if (!StringUtils.hasText(dto.getModelId()) && StringUtils.hasText(dto.getProcessInstanceId())) {
|
||||
dto.setModelId(bpmnProcessInstanceService.getModelIdByProcessInstanceId(dto.getProcessInstanceId()));
|
||||
}
|
||||
if (StringUtils.hasText(dto.getProcessDefinitionKey())) {
|
||||
BpmnProcessDefinitionVO definition = bpmnProcessDefinitionService.getActiveProcessDefinitionByKey(dto.getProcessDefinitionKey(), dto.getTenantId());
|
||||
CommandExecutor commandExecutor = springProcessEngineConfiguration.getCommandExecutor();
|
||||
Model model = commandExecutor.execute(new CustomGetModelByDefinitionIdCmd(definition.getId()));
|
||||
dto.setModelId(model.getId());
|
||||
}
|
||||
return success(bpmnProcessModelService.getPrintTemplateConfig(dto.getModelId()));
|
||||
}
|
||||
|
||||
|
||||
@ -137,36 +137,38 @@ public class PrintAdminController implements PrintAdminApi {
|
||||
FormInfo formModel;
|
||||
try {
|
||||
formModel = formRepositoryService.getFormModelByKey(dto.getProcessDefinitionKey(), dto.getTenantId(), false);
|
||||
// 表单字段
|
||||
List<FormField> formFields = ((SimpleFormModel) formModel.getFormModel()).getFields();
|
||||
formFields.forEach(formField -> {
|
||||
FormContainer formContainer = (FormContainer) formField;
|
||||
printFields.addAll(formContainer.getFields().get(0).stream().map(field -> {
|
||||
PrintFieldDTO printFieldDTO = new PrintFieldDTO()
|
||||
.setName(field.getName())
|
||||
.setCode(field.getId())
|
||||
.setFieldCategoryType(form)
|
||||
.setFieldFormType(field.getType());
|
||||
if (field instanceof FormContainer) {
|
||||
FormContainer container = (FormContainer) field;
|
||||
printFieldDTO.setAttributes(container.getFields().get(0)
|
||||
.stream().map(subField -> new FieldAttributeDTO()
|
||||
.setCode(subField.getId())
|
||||
.setFieldFormType(subField.getType())
|
||||
.setName(subField.getName()))
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
return printFieldDTO;
|
||||
}
|
||||
).collect(Collectors.toList()));
|
||||
});
|
||||
} catch (FlowableObjectNotFoundException e) {
|
||||
log.warn("can't found form model");
|
||||
throw new WorkflowEngineException(FORM_MODEL_NOT_EXISTS);
|
||||
if (Objects.equals(Boolean.TRUE, dto.getThrowException())) {
|
||||
throw new WorkflowEngineException(FORM_MODEL_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
// 表单字段
|
||||
List<FormField> formFields = ((SimpleFormModel) formModel.getFormModel()).getFields();
|
||||
formFields.forEach(formField -> {
|
||||
FormContainer formContainer = (FormContainer) formField;
|
||||
printFields.addAll(formContainer.getFields().get(0).stream().map(field -> {
|
||||
PrintFieldDTO printFieldDTO = new PrintFieldDTO()
|
||||
.setName(field.getName())
|
||||
.setCode(field.getId())
|
||||
.setFieldCategoryType(form)
|
||||
.setFieldFormType(field.getType());
|
||||
if (field instanceof FormContainer) {
|
||||
FormContainer container = (FormContainer) field;
|
||||
printFieldDTO.setAttributes(container.getFields().get(0)
|
||||
.stream().map(subField -> new FieldAttributeDTO()
|
||||
.setCode(subField.getId())
|
||||
.setFieldFormType(subField.getType())
|
||||
.setName(subField.getName()))
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
return printFieldDTO;
|
||||
}
|
||||
).collect(Collectors.toList()));
|
||||
});
|
||||
|
||||
// 生成固定的系统字段
|
||||
generateSystemFields(printFields, dto.getProcessDefinitionKey(), dto.getTenantId());
|
||||
printFields.addAll(generateSystemFields(dto.getProcessDefinitionKey(), dto.getTenantId()));
|
||||
|
||||
// 生成业务对应的变量相应字段
|
||||
// generateDictVariables(printFields, dto.getProcessDefinitionKey());
|
||||
@ -208,14 +210,13 @@ public class PrintAdminController implements PrintAdminApi {
|
||||
}
|
||||
}
|
||||
|
||||
private List<PrintFieldDTO> generateSystemFields(List<PrintFieldDTO> printFields, String processDefinitionKey, String tenantId) {
|
||||
if (CollectionUtils.isEmpty(printFields)) {
|
||||
printFields = new ArrayList<>();
|
||||
}
|
||||
private List<PrintFieldDTO> generateSystemFields(String processDefinitionKey, String tenantId) {
|
||||
List<PrintFieldDTO> printFields = new ArrayList<>();
|
||||
|
||||
printFields.add(new PrintFieldDTO().setName("业务名称").setCode("processDefinitionKey").setFieldCategoryType(system).setFieldFormType("input"));
|
||||
printFields.add(new PrintFieldDTO().setName("审批编号").setCode("processInstanceId").setFieldCategoryType(system).setFieldFormType("input"));
|
||||
printFields.add(new PrintFieldDTO().setName("发起时间").setCode("startTime").setFieldCategoryType(system).setFieldFormType("input"));
|
||||
printFields.add(new PrintFieldDTO().setName("审批结束时间").setCode("endTime").setFieldCategoryType(system).setFieldFormType("input"));
|
||||
printFields.add(new PrintFieldDTO().setName("发起人姓名").setCode("initiatorName").setFieldCategoryType(system).setFieldFormType("input"));
|
||||
printFields.add(new PrintFieldDTO().setName("发起人岗位").setCode("initiatorPosition").setFieldCategoryType(system).setFieldFormType("input"));
|
||||
printFields.add(new PrintFieldDTO().setName("发起人联系方式").setCode("initiatorPhone").setFieldCategoryType(system).setFieldFormType("input"));
|
||||
|
||||
@ -3,12 +3,7 @@ package cn.axzo.workflow.server.mq.inside;
|
||||
import cn.axzo.framework.rocketmq.BaseListener;
|
||||
import cn.axzo.framework.rocketmq.EventConsumer;
|
||||
import org.apache.rocketmq.common.message.MessageExt;
|
||||
import org.apache.rocketmq.spring.annotation.ConsumeMode;
|
||||
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
|
||||
import org.apache.rocketmq.spring.core.RocketMQListener;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
@ -10,12 +10,9 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.flowable.engine.HistoryService;
|
||||
import org.flowable.engine.history.HistoricProcessInstance;
|
||||
import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;
|
||||
import org.flowable.engine.impl.util.CommandContextUtil;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
||||
@ -1,12 +1,14 @@
|
||||
package cn.axzo.workflow.starter.common.exception;
|
||||
|
||||
import cn.axzo.framework.domain.ServiceException;
|
||||
|
||||
/**
|
||||
* 流程引擎 starter 的异常类
|
||||
*
|
||||
* @author wangli
|
||||
* @since 2024/5/21 17:57
|
||||
*/
|
||||
public class WorkflowEngineStarterException extends RuntimeException {
|
||||
public class WorkflowEngineStarterException extends ServiceException {
|
||||
|
||||
public WorkflowEngineStarterException(Throwable cause) {
|
||||
super(cause);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user