新增banner打印支持

This commit is contained in:
hubin 2025-01-09 21:30:04 +08:00
parent f7dcad4090
commit a191a11bf8
6 changed files with 40 additions and 11 deletions

View File

@ -177,7 +177,7 @@ public class FlowLongContext {
* @param configEngine 流程配置引擎 * @param configEngine 流程配置引擎
* @return {@link FlowLongEngine} * @return {@link FlowLongEngine}
*/ */
public FlowLongContext build(FlowLongEngine configEngine) { public FlowLongContext build(FlowLongEngine configEngine, boolean banner) {
if (log.isInfoEnabled()) { if (log.isInfoEnabled()) {
log.info("FlowLongEngine start......"); log.info("FlowLongEngine start......");
} }
@ -189,6 +189,13 @@ public class FlowLongContext {
log.info("FlowLongEngine be found {}", configEngine.getClass()); log.info("FlowLongEngine be found {}", configEngine.getClass());
} }
configEngine.configure(this); configEngine.configure(this);
if (banner) {
System.err.println("┌─┐┬ ┌─┐┬ ┬┬ ┌─┐┌┐┌┌─┐");
System.err.println("├┤ │ │ │││││ │ │││││ ┬");
System.err.println("└ ┴─┘└─┘└┴┘┴─┘└─┘┘└┘└─┘ 1.1.1");
}
return this; return this;
} }

View File

@ -130,6 +130,7 @@ public class FlowLongAutoConfiguration {
TaskAccessStrategy taskAccessStrategy, TaskAccessStrategy taskAccessStrategy,
TaskActorProvider taskActorProvider, TaskActorProvider taskActorProvider,
FlowLongEngine flowLongEngine, FlowLongEngine flowLongEngine,
FlowLongProperties flp,
@Inject(required = false) FlowCache flowCache, @Inject(required = false) FlowCache flowCache,
@Inject(required = false) ProcessModelParser processModelParser, @Inject(required = false) ProcessModelParser processModelParser,
@Inject(required = false) FlowJsonHandler flowJsonHandler, @Inject(required = false) FlowJsonHandler flowJsonHandler,
@ -158,7 +159,7 @@ public class FlowLongAutoConfiguration {
flc.setCreateTaskHandler(createTaskHandler); flc.setCreateTaskHandler(createTaskHandler);
flc.setTaskReminder(taskReminder); flc.setTaskReminder(taskReminder);
flc.setTaskTrigger(taskTrigger); flc.setTaskTrigger(taskTrigger);
return flc.build(flowLongEngine); return flc.build(flowLongEngine, flp.isBanner());
} }
@Bean @Bean

View File

@ -5,6 +5,8 @@
package com.aizuda.bpm.solon.autoconfigure; package com.aizuda.bpm.solon.autoconfigure;
import com.aizuda.bpm.engine.scheduling.RemindParam; import com.aizuda.bpm.engine.scheduling.RemindParam;
import lombok.Getter;
import lombok.Setter;
import org.noear.solon.annotation.Configuration; import org.noear.solon.annotation.Configuration;
import org.noear.solon.annotation.Inject; import org.noear.solon.annotation.Inject;
@ -18,19 +20,18 @@ import org.noear.solon.annotation.Inject;
* @author hubin * @author hubin
* @since 1.0 * @since 1.0
*/ */
@Getter
@Setter
@Inject("${flowlong}") @Inject("${flowlong}")
@Configuration @Configuration
public class FlowLongProperties { public class FlowLongProperties {
/**
* 是否打印 banner
*/
private boolean banner = true;
/** /**
* 提醒时间 * 提醒时间
*/ */
private RemindParam remind; private RemindParam remind;
public RemindParam getRemind() {
return remind;
}
public void setRemind(RemindParam remind) {
this.remind = remind;
}
} }

View File

@ -111,7 +111,7 @@ public class FlowLongAutoConfiguration {
@ConditionalOnMissingBean @ConditionalOnMissingBean
public FlowLongContext flowLongContext(ProcessService processService, QueryService queryService, RuntimeService runtimeService, public FlowLongContext flowLongContext(ProcessService processService, QueryService queryService, RuntimeService runtimeService,
TaskService taskService, Expression expression, TaskAccessStrategy taskAccessStrategy, TaskService taskService, Expression expression, TaskAccessStrategy taskAccessStrategy,
TaskActorProvider taskActorProvider, FlowLongEngine flowLongEngine, TaskActorProvider taskActorProvider, FlowLongEngine flowLongEngine, FlowLongProperties flp,
@Autowired(required = false) FlowCache flowCache, @Autowired(required = false) FlowCache flowCache,
@Autowired(required = false) ProcessModelParser processModelParser, @Autowired(required = false) ProcessModelParser processModelParser,
@Autowired(required = false) FlowJsonHandler flowJsonHandler, @Autowired(required = false) FlowJsonHandler flowJsonHandler,
@ -139,7 +139,7 @@ public class FlowLongAutoConfiguration {
flc.setCreateTaskHandler(createTaskHandler); flc.setCreateTaskHandler(createTaskHandler);
flc.setTaskReminder(taskReminder); flc.setTaskReminder(taskReminder);
flc.setTaskTrigger(taskTrigger); flc.setTaskTrigger(taskTrigger);
return flc.build(flowLongEngine); return flc.build(flowLongEngine, flp.isBanner());
} }
/** /**

View File

@ -24,6 +24,10 @@ import org.springframework.boot.context.properties.NestedConfigurationProperty;
@Setter @Setter
@ConfigurationProperties(prefix = "flowlong") @ConfigurationProperties(prefix = "flowlong")
public class FlowLongProperties { public class FlowLongProperties {
/**
* 是否打印 banner
*/
private boolean banner = true;
/** /**
* 提醒时间 * 提醒时间
*/ */

View File

@ -36,6 +36,22 @@ public class TestSupervisor extends MysqlTest {
this.flowLongEngine.getContext().setTaskActorProvider( this.flowLongEngine.getContext().setTaskActorProvider(
new TaskActorProvider() { new TaskActorProvider() {
@Override
public Integer getActorType(NodeModel nodeModel) {
// 1角色
if (NodeSetType.role.eq(nodeModel.getSetType())) {
return 1;
}
// 2部门
if (NodeSetType.department.eq(nodeModel.getSetType())) {
return 2;
}
return 0;
}
@Override @Override
public List<FlwTaskActor> getTaskActors(NodeModel nodeModel, Execution execution) { public List<FlwTaskActor> getTaskActors(NodeModel nodeModel, Execution execution) {
if (nodeModel.getType() == 0) { if (nodeModel.getType() == 0) {