yxk-20260409-集成流程引擎bpm代码

This commit is contained in:
ye1023
2026-04-09 15:55:31 +08:00
parent d94e9c9bc4
commit 9a65463105
582 changed files with 364516 additions and 0 deletions
@@ -0,0 +1,28 @@
//package org.jeecg;
//
//import java.util.HashMap;
//import java.util.Map;
//
//import org.flowable.engine.RuntimeService;
//import org.junit.jupiter.api.Test;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.test.context.SpringBootTest;
//
//@SpringBootTest(classes = JeecgBpmApplication.class)
//public class ActivitiTest {
//
// @Autowired
// RuntimeService runtimeService;
//
// /**
// * 发起流程
// */
// @Test
// public void TestStartProcess() {
// Map<String, Object> variables = new HashMap<>();
// variables.put("applyUserId", "admin");
// variables.put("email", "john.doe@activiti.com");
// variables.put("phoneNumber", "123456789");
// runtimeService.startProcessInstanceByKey("jeecgboot-bpm01", variables);
// }
//}
@@ -0,0 +1,47 @@
package org.jeecg.test;
import org.flowable.common.engine.impl.de.odysseus.el.ExpressionFactoryImpl;
import org.flowable.common.engine.impl.de.odysseus.el.util.SimpleContext;
import org.flowable.common.engine.impl.javax.el.ExpressionFactory;
import org.flowable.common.engine.impl.javax.el.ValueExpression;
import org.junit.jupiter.api.Test;
import java.util.HashMap;
import java.util.Map;
/**
* @Description: 测试流程表达式
* @author: scott
* @date: 2023年09月15日 10:24
*/
public class TestExpression {
public Boolean checkFormDataByRuleEl(String el, Map<String, Object> formData) throws Exception {
ExpressionFactory factory = new ExpressionFactoryImpl();
SimpleContext context = new SimpleContext();
for (Object k : formData.keySet()) {
if (formData.get(k) != null) {
context.setVariable(k.toString(), factory.createValueExpression(formData.get(k), formData.get(k).getClass()));
}
}
ValueExpression e = factory.createValueExpression(context, el, Boolean.class);
return (Boolean) e.getValue(context);
}
@Test
public void testBooleanExpression() {
String el = "${请假天数>3 && 部门 == '产品部'}";
Map<String, Object> formData = new HashMap<>();
formData.put("请假天数", 4);
formData.put("部门", "产品部");
formData.put("test", "123");
try {
System.out.println(checkFormDataByRuleEl(el, formData));
} catch (Exception e) {
e.printStackTrace();
}
}
}