!1206 feat: BPM-更多设置-标题设置
Merge pull request !1206 from Lesan/feature/bpm-标题设置
This commit is contained in:
commit
e99eb5c813
|
@ -74,6 +74,9 @@ public class BpmModelMetaInfoVO {
|
|||
@InEnum(BpmAutoApproveTypeEnum.class)
|
||||
private Integer autoApprovalType;
|
||||
|
||||
@Schema(description = "标题设置", example = "{}")
|
||||
private CustomTitleSetting customTitleSetting;
|
||||
|
||||
@Schema(description = "流程 ID 规则")
|
||||
@Data
|
||||
@Valid
|
||||
|
@ -98,4 +101,18 @@ public class BpmModelMetaInfoVO {
|
|||
|
||||
}
|
||||
|
||||
@Schema(description = "标题设置")
|
||||
@Data
|
||||
@Valid
|
||||
public static class CustomTitleSetting {
|
||||
|
||||
@Schema(description = "是否自定义", example = "false")
|
||||
@NotNull(message = "是否自定义不能为空")
|
||||
private Boolean enable;
|
||||
|
||||
@Schema(description = "标题", example = "流程标题")
|
||||
private String title;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -170,4 +170,10 @@ public class BpmProcessDefinitionInfoDO extends BaseDO {
|
|||
*/
|
||||
private Integer autoApprovalType;
|
||||
|
||||
/**
|
||||
* 标题设置
|
||||
*/
|
||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||
private BpmModelMetaInfoVO.CustomTitleSetting customTitleSetting;
|
||||
|
||||
}
|
||||
|
|
|
@ -50,6 +50,14 @@ public class BpmnVariableConstants {
|
|||
* @see <a href="https://blog.csdn.net/weixin_42065235/article/details/126039993">Flowable/Activiti之SkipExpression 完成自动审批</a>
|
||||
*/
|
||||
public static final String PROCESS_INSTANCE_SKIP_EXPRESSION_ENABLED = "_FLOWABLE_SKIP_EXPRESSION_ENABLED";
|
||||
/**
|
||||
* 流程实例的变量 - 流程开始时间
|
||||
*/
|
||||
public static final String PROCESS_START_TIME = "PROCESS_START_TIME";
|
||||
/**
|
||||
* 流程实例的变量 - 流程定义名称
|
||||
*/
|
||||
public static final String PROCESS_DEFINITION_NAME = "PROCESS_DEFINITION_NAME";
|
||||
|
||||
/**
|
||||
* 任务的变量 - 状态
|
||||
|
|
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.bpm.service.task;
|
|||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
|
@ -610,14 +611,25 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
|
|||
ProcessInstanceBuilder processInstanceBuilder = runtimeService.createProcessInstanceBuilder()
|
||||
.processDefinitionId(definition.getId())
|
||||
.businessKey(businessKey)
|
||||
.name(definition.getName().trim())
|
||||
.variables(variables);
|
||||
// 3.1 创建流程 ID
|
||||
BpmModelMetaInfoVO.ProcessIdRule processIdRule = processDefinitionInfo.getProcessIdRule();
|
||||
if (processIdRule != null && Boolean.TRUE.equals(processIdRule.getEnable())) {
|
||||
processInstanceBuilder.predefineProcessInstanceId(processIdRedisDAO.generate(processIdRule));
|
||||
}
|
||||
// 3.2 发起流程实例
|
||||
// 3.2 流程名称
|
||||
BpmModelMetaInfoVO.CustomTitleSetting customTitleSetting = processDefinitionInfo.getCustomTitleSetting();
|
||||
if (customTitleSetting != null && Boolean.TRUE.equals(customTitleSetting.getEnable())) {
|
||||
AdminUserRespDTO user = adminUserApi.getUser(userId);
|
||||
Map<String, Object> cloneVariables = ObjectUtil.clone(variables);
|
||||
cloneVariables.put(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_START_USER_ID, user.getNickname());
|
||||
cloneVariables.put(BpmnVariableConstants.PROCESS_START_TIME, DateUtil.now());
|
||||
cloneVariables.put(BpmnVariableConstants.PROCESS_DEFINITION_NAME, definition.getName().trim());
|
||||
processInstanceBuilder.name(StrUtil.format(customTitleSetting.getTitle(), cloneVariables));
|
||||
} else {
|
||||
processInstanceBuilder.name(definition.getName().trim());
|
||||
}
|
||||
// 3.3 发起流程实例
|
||||
ProcessInstance instance = processInstanceBuilder.start();
|
||||
return instance.getId();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue