feat: liteflow任务保存到数据库
This commit is contained in:
@@ -29,5 +29,9 @@ public class TaskTemplate extends SimpleEntity {
|
|||||||
@Column(nullable = false, length = 500)
|
@Column(nullable = false, length = 500)
|
||||||
private String description;
|
private String description;
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
|
private String application;
|
||||||
|
@Column(nullable = false)
|
||||||
private String chain;
|
private String chain;
|
||||||
|
@Column(nullable = false)
|
||||||
|
private String expression;
|
||||||
}
|
}
|
||||||
@@ -45,6 +45,10 @@
|
|||||||
<groupId>com.yomahub</groupId>
|
<groupId>com.yomahub</groupId>
|
||||||
<artifactId>liteflow-spring-boot-starter</artifactId>
|
<artifactId>liteflow-spring-boot-starter</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.yomahub</groupId>
|
||||||
|
<artifactId>liteflow-rule-sql</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.hutool</groupId>
|
<groupId>cn.hutool</groupId>
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
package com.lanyuanxiaoyao.leopard.server.controller;
|
package com.lanyuanxiaoyao.leopard.server.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
import com.lanyuanxiaoyao.leopard.core.entity.TaskTemplate;
|
import com.lanyuanxiaoyao.leopard.core.entity.TaskTemplate;
|
||||||
import com.lanyuanxiaoyao.leopard.server.service.TaskTemplateService;
|
import com.lanyuanxiaoyao.leopard.server.service.TaskTemplateService;
|
||||||
import com.lanyuanxiaoyao.service.template.controller.SimpleControllerSupport;
|
import com.lanyuanxiaoyao.service.template.controller.SimpleControllerSupport;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@@ -12,6 +14,9 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("task_template")
|
@RequestMapping("task_template")
|
||||||
public class TaskTemplateController extends SimpleControllerSupport<TaskTemplate, TaskTemplateController.Item, TaskTemplateController.Item, TaskTemplateController.Item> {
|
public class TaskTemplateController extends SimpleControllerSupport<TaskTemplate, TaskTemplateController.Item, TaskTemplateController.Item, TaskTemplateController.Item> {
|
||||||
|
@Value("${spring.application.name}")
|
||||||
|
private String application;
|
||||||
|
|
||||||
public TaskTemplateController(TaskTemplateService service) {
|
public TaskTemplateController(TaskTemplateService service) {
|
||||||
super(service);
|
super(service);
|
||||||
}
|
}
|
||||||
@@ -23,7 +28,9 @@ public class TaskTemplateController extends SimpleControllerSupport<TaskTemplate
|
|||||||
template.setId(item.id());
|
template.setId(item.id());
|
||||||
template.setName(item.name());
|
template.setName(item.name());
|
||||||
template.setDescription(item.description());
|
template.setDescription(item.description());
|
||||||
template.setChain(item.chain());
|
template.setApplication(application);
|
||||||
|
template.setChain(IdUtil.simpleUUID());
|
||||||
|
template.setExpression(item.expression());
|
||||||
return template;
|
return template;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -33,7 +40,7 @@ public class TaskTemplateController extends SimpleControllerSupport<TaskTemplate
|
|||||||
template.getId(),
|
template.getId(),
|
||||||
template.getName(),
|
template.getName(),
|
||||||
template.getDescription(),
|
template.getDescription(),
|
||||||
template.getChain()
|
template.getExpression()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,7 +58,7 @@ public class TaskTemplateController extends SimpleControllerSupport<TaskTemplate
|
|||||||
Long id,
|
Long id,
|
||||||
String name,
|
String name,
|
||||||
String description,
|
String description,
|
||||||
String chain
|
String expression
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.lanyuanxiaoyao.leopard.server.service;
|
|||||||
import com.lanyuanxiaoyao.leopard.core.entity.TaskTemplate;
|
import com.lanyuanxiaoyao.leopard.core.entity.TaskTemplate;
|
||||||
import com.lanyuanxiaoyao.leopard.core.repository.TaskTemplateRepository;
|
import com.lanyuanxiaoyao.leopard.core.repository.TaskTemplateRepository;
|
||||||
import com.lanyuanxiaoyao.service.template.service.SimpleServiceSupport;
|
import com.lanyuanxiaoyao.service.template.service.SimpleServiceSupport;
|
||||||
|
import com.yomahub.liteflow.meta.LiteflowMetaOperator;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@@ -10,4 +11,29 @@ public class TaskTemplateService extends SimpleServiceSupport<TaskTemplate> {
|
|||||||
public TaskTemplateService(TaskTemplateRepository repository) {
|
public TaskTemplateService(TaskTemplateRepository repository) {
|
||||||
super(repository);
|
super(repository);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long save(TaskTemplate entity) {
|
||||||
|
Long id = super.save(entity);
|
||||||
|
LiteflowMetaOperator.reloadAllChain();
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void save(Iterable<TaskTemplate> taskTemplates) {
|
||||||
|
super.save(taskTemplates);
|
||||||
|
LiteflowMetaOperator.reloadAllChain();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remove(Iterable<Long> ids) {
|
||||||
|
super.remove(ids);
|
||||||
|
LiteflowMetaOperator.reloadAllChain();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remove(Long id) {
|
||||||
|
super.remove(id);
|
||||||
|
LiteflowMetaOperator.reloadAllChain();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,5 +37,11 @@ fenix:
|
|||||||
print-banner: false
|
print-banner: false
|
||||||
liteflow:
|
liteflow:
|
||||||
print-banner: false
|
print-banner: false
|
||||||
rule-source: flow.xml
|
|
||||||
check-node-exists: false
|
check-node-exists: false
|
||||||
|
rule-source-ext-data-map:
|
||||||
|
applicationName: ${spring.application.name}
|
||||||
|
sqlLogEnabled: true
|
||||||
|
chainTableName: leopard_task_template
|
||||||
|
chainApplicationNameField: application
|
||||||
|
chainNameField: chain
|
||||||
|
elDataField: expression
|
||||||
|
|||||||
@@ -55,8 +55,8 @@ function TaskTemplateSave() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'input-text',
|
type: 'input-text',
|
||||||
name: 'chain',
|
name: 'expression',
|
||||||
label: '流程编号',
|
label: 'EL表达式',
|
||||||
required: true,
|
required: true,
|
||||||
clearable: true,
|
clearable: true,
|
||||||
},
|
},
|
||||||
|
|||||||
5
pom.xml
5
pom.xml
@@ -68,6 +68,11 @@
|
|||||||
<artifactId>liteflow-spring-boot-starter</artifactId>
|
<artifactId>liteflow-spring-boot-starter</artifactId>
|
||||||
<version>${liteflow.version}</version>
|
<version>${liteflow.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.yomahub</groupId>
|
||||||
|
<artifactId>liteflow-rule-sql</artifactId>
|
||||||
|
<version>${liteflow.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
|||||||
Reference in New Issue
Block a user