..
This commit is contained in:
@@ -0,0 +1,247 @@
|
||||
//package com.budwk.app.snakerflow;
|
||||
//
|
||||
//import cn.hutool.core.util.StrUtil;
|
||||
//import org.apache.commons.beanutils.BeanUtils;
|
||||
//import org.apache.commons.beanutils.PropertyUtils;
|
||||
//import org.snaker.engine.entity.*;
|
||||
//import org.snaker.engine.model.*;
|
||||
//
|
||||
//import java.beans.PropertyDescriptor;
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.HashMap;
|
||||
//import java.util.List;
|
||||
//import java.util.Map;
|
||||
//
|
||||
//public class SnakerHelper {
|
||||
//
|
||||
// private static final Map<Class<? extends NodeModel>, String> mapper = new HashMap<Class<? extends NodeModel>, String>();
|
||||
//
|
||||
// static {
|
||||
// mapper.put(TaskModel.class, "task");
|
||||
// mapper.put(CustomModel.class, "custom");
|
||||
// mapper.put(DecisionModel.class, "decision");
|
||||
// mapper.put(EndModel.class, "end");
|
||||
// mapper.put(ForkModel.class, "fork");
|
||||
// mapper.put(JoinModel.class, "join");
|
||||
// mapper.put(StartModel.class, "start");
|
||||
// mapper.put(SubProcessModel.class, "subprocess");
|
||||
// }
|
||||
//
|
||||
// public static String getStateJson(ProcessModel model, List<Task> activeTasks, List<HistoryTask> historyTasks) {
|
||||
// StringBuffer buffer = new StringBuffer();
|
||||
// buffer.append("{'activeRects':{'rects':[");
|
||||
// if (activeTasks != null && activeTasks.size() > 0) {
|
||||
// for (Task task : activeTasks) {
|
||||
// buffer.append("{'paths':[],'name':'");
|
||||
// buffer.append(task.getTaskName());
|
||||
// buffer.append("'},");
|
||||
// }
|
||||
// buffer.deleteCharAt(buffer.length() - 1);
|
||||
// }
|
||||
// buffer.append("]}, 'historyRects':{'rects':[");
|
||||
// if (historyTasks != null && historyTasks.size() > 0) {
|
||||
// for (HistoryTask historyTask : historyTasks) {
|
||||
// NodeModel parentModel = model.getNode(historyTask.getTaskName());
|
||||
// if (parentModel == null) continue;
|
||||
// buffer.append("{'name':'").append(parentModel.getName()).append("','paths':[");
|
||||
// buffer.append("]},");
|
||||
// }
|
||||
// buffer.deleteCharAt(buffer.length() - 1);
|
||||
// }
|
||||
// buffer.append("]}}");
|
||||
// return buffer.toString();
|
||||
// }
|
||||
//
|
||||
// public static String getModelJson(ProcessModel model) {
|
||||
// StringBuffer buffer = new StringBuffer();
|
||||
// List<TransitionModel> tms = new ArrayList<TransitionModel>();
|
||||
// for (NodeModel node : model.getNodes()) {
|
||||
// for (TransitionModel tm : node.getOutputs()) {
|
||||
// tms.add(tm);
|
||||
// }
|
||||
// }
|
||||
// buffer.append("{");
|
||||
// buffer.append(getNodeJson(model.getNodes()));
|
||||
// buffer.append(getPathJson(tms));
|
||||
// buffer.append("props:{props:{name:{name:'name',value:'");
|
||||
// buffer.append(convert(model.getName()));
|
||||
// buffer.append("'},displayName:{name:'displayName',value:'");
|
||||
// buffer.append(convert(model.getDisplayName()));
|
||||
// buffer.append("'},expireTime:{name:'expireTime',value:'");
|
||||
// buffer.append(convert(model.getExpireTime()));
|
||||
// buffer.append("'},instanceUrl:{name:'instanceUrl',value:'");
|
||||
// buffer.append(convert(model.getInstanceUrl()));
|
||||
// buffer.append("'},instanceNoClass:{name:'instanceNoClass',value:'");
|
||||
// buffer.append(convert(model.getInstanceNoClass()));
|
||||
// buffer.append("'}}}}");
|
||||
// return buffer.toString();
|
||||
// }
|
||||
//
|
||||
// public static String getNodeJson(List<NodeModel> nodes) {
|
||||
// StringBuffer buffer = new StringBuffer();
|
||||
// buffer.append("states: {");
|
||||
// for (NodeModel node : nodes) {
|
||||
// buffer.append(node.getName());
|
||||
// buffer.append(getBase(node));
|
||||
// buffer.append(getLayout(node));
|
||||
// buffer.append(getProperty(node));
|
||||
// buffer.append(",");
|
||||
// }
|
||||
// buffer.deleteCharAt(buffer.length() - 1);
|
||||
// buffer.append("},");
|
||||
// return buffer.toString();
|
||||
// }
|
||||
//
|
||||
// public static String getPathJson(List<TransitionModel> tms) {
|
||||
// StringBuffer buffer = new StringBuffer();
|
||||
// buffer.append("paths:{");
|
||||
// for (TransitionModel tm : tms) {
|
||||
// buffer.append(tm.getName());
|
||||
// buffer.append(":{from:'");
|
||||
// buffer.append(tm.getSource().getName());
|
||||
// buffer.append("',to:'");
|
||||
// buffer.append(tm.getTarget().getName());
|
||||
// buffer.append("', dots:[");
|
||||
// if (StrUtil.isNotEmpty(tm.getG())) {
|
||||
// String[] bendpoints = tm.getG().split(";");
|
||||
// for (String bendpoint : bendpoints) {
|
||||
// buffer.append("{");
|
||||
// String[] xy = bendpoint.split(",");
|
||||
// buffer.append("x:").append(getNumber(xy[0]));
|
||||
// buffer.append(",y:").append(xy[1]);
|
||||
// buffer.append("},");
|
||||
// }
|
||||
// buffer.deleteCharAt(buffer.length() - 1);
|
||||
// }
|
||||
// buffer.append("],text:{text:'");
|
||||
// buffer.append(tm.getDisplayName());
|
||||
// buffer.append("'},textPos:{");
|
||||
// if (StrUtil.isNotEmpty(tm.getOffset())) {
|
||||
// String[] values = tm.getOffset().split(",");
|
||||
// buffer.append("x:").append(values[0]).append(",");
|
||||
// buffer.append("y:").append(values[1]);
|
||||
// }
|
||||
// buffer.append("}, props:{name:{value:'" + tm.getName() + "'},expr:{value:'" + tm.getExpr() + "'}}}");
|
||||
// buffer.append(",");
|
||||
// }
|
||||
// buffer.deleteCharAt(buffer.length() - 1);
|
||||
// buffer.append("},");
|
||||
// return buffer.toString();
|
||||
// }
|
||||
//
|
||||
// private static String getBase(NodeModel node) {
|
||||
// String buffer = ":{type:'" +
|
||||
// mapper.get(node.getClass()) +
|
||||
// "',text:{text:'" +
|
||||
// node.getDisplayName() +
|
||||
// "'},";
|
||||
// return buffer;
|
||||
// }
|
||||
//
|
||||
// private static String getProperty(NodeModel node) {
|
||||
// StringBuffer buffer = new StringBuffer();
|
||||
// buffer.append("props:{");
|
||||
// try {
|
||||
// PropertyDescriptor[] beanProperties = PropertyUtils.getPropertyDescriptors(node);
|
||||
// for (PropertyDescriptor propertyDescriptor : beanProperties) {
|
||||
// if (propertyDescriptor.getReadMethod() == null || propertyDescriptor.getWriteMethod() == null)
|
||||
// continue;
|
||||
// String name = propertyDescriptor.getName();
|
||||
// String value = "";
|
||||
// if (propertyDescriptor.getPropertyType() == String.class) {
|
||||
// value = BeanUtils.getProperty(node, name);
|
||||
// } else {
|
||||
// continue;
|
||||
// }
|
||||
// if (value == null || value.equals("")) continue;
|
||||
// buffer.append(name);
|
||||
// buffer.append(":{value:'");
|
||||
// buffer.append(convert(value));
|
||||
// buffer.append("'},");
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// buffer.deleteCharAt(buffer.length() - 1);
|
||||
// buffer.append("}}");
|
||||
// return buffer.toString();
|
||||
// }
|
||||
//
|
||||
// private static String getLayout(NodeModel node) {
|
||||
// StringBuffer buffer = new StringBuffer();
|
||||
// buffer.append("attr:{");
|
||||
// String[] values = node.getLayout().split(",");
|
||||
// buffer.append("x:").append(getNumber(values[0])).append(",");
|
||||
// buffer.append("y:").append(values[1]).append(",");
|
||||
// if ("-1".equals(values[2])) {
|
||||
// if (node instanceof TaskModel || node instanceof CustomModel || node instanceof SubProcessModel) {
|
||||
// values[2] = "100";
|
||||
// } else {
|
||||
// values[2] = "50";
|
||||
// }
|
||||
// }
|
||||
// if ("-1".equals(values[3])) {
|
||||
// values[3] = "50";
|
||||
// }
|
||||
// buffer.append("width:").append(values[2]).append(",");
|
||||
// buffer.append("height:").append(values[3]);
|
||||
// buffer.append("},");
|
||||
// return buffer.toString();
|
||||
// }
|
||||
//
|
||||
// private static String convert(String value) {
|
||||
// if (StrUtil.isEmpty(value))
|
||||
// return "";
|
||||
// if (value.indexOf("'") != -1) {
|
||||
// value = value.replaceAll("'", "#1");
|
||||
// }
|
||||
// if (value.indexOf("\"") != -1) {
|
||||
// value = value.replaceAll("\"", "#2");
|
||||
// }
|
||||
// if (value.indexOf("\r\n") != -1) {
|
||||
// value = value.replaceAll("\r\n", "#3");
|
||||
// }
|
||||
// if (value.indexOf("\n") != -1) {
|
||||
// value = value.replaceAll("\n", "#4");
|
||||
// }
|
||||
// if (value.indexOf(">") != -1) {
|
||||
// value = value.replaceAll(">", "#5");
|
||||
// }
|
||||
// if (value.indexOf("<") != -1) {
|
||||
// value = value.replaceAll("<", "#6");
|
||||
// }
|
||||
// if (value.indexOf("&") != -1) {
|
||||
// value = value.replaceAll("&", "#7");
|
||||
// }
|
||||
// return value;
|
||||
// }
|
||||
//
|
||||
// public static String convertXml(String value) {
|
||||
// if (value.indexOf("#1") != -1) {
|
||||
// value = value.replaceAll("#1", "'");
|
||||
// }
|
||||
// if (value.indexOf("#2") != -1) {
|
||||
// value = value.replaceAll("#2", "\"");
|
||||
// }
|
||||
// if (value.indexOf("#5") != -1) {
|
||||
// value = value.replaceAll("#5", ">");
|
||||
// }
|
||||
// if (value.indexOf("#6") != -1) {
|
||||
// value = value.replaceAll("#6", "<");
|
||||
// }
|
||||
// if (value.indexOf("&") != -1) {
|
||||
// value = value.replaceAll("#7", "&");
|
||||
// }
|
||||
// return value;
|
||||
// }
|
||||
//
|
||||
// private static int getNumber(String value) {
|
||||
// if (value == null) return 0;
|
||||
// try {
|
||||
// return Integer.parseInt(value) + 180;
|
||||
// } catch (Exception e) {
|
||||
// return 0;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//}
|
||||
@@ -0,0 +1,41 @@
|
||||
//package com.budwk.app.snakerflow.config;
|
||||
//
|
||||
//import org.nutz.ioc.loader.annotation.Inject;
|
||||
//import org.nutz.ioc.loader.annotation.IocBean;
|
||||
//import org.nutz.lang.Mirror;
|
||||
//import org.snaker.engine.SnakerEngine;
|
||||
//import org.snaker.engine.cfg.Configuration;
|
||||
//import org.snaker.engine.core.SnakerEngineImpl;
|
||||
//import org.snaker.engine.impl.JuelExpression;
|
||||
//import org.snaker.engine.impl.SimpleContext;
|
||||
//import org.snaker.nutz.access.NutzAccess;
|
||||
//import org.snaker.nutz.access.NutzTransactionInterceptor;
|
||||
//
|
||||
//import javax.sql.DataSource;
|
||||
//
|
||||
//@IocBean
|
||||
//public class SnakerEngineConfig {
|
||||
//
|
||||
// @Inject
|
||||
// private DataSource dataSource;
|
||||
//
|
||||
// @IocBean
|
||||
// public SnakerEngine snakerEngine() {
|
||||
// SimpleContext ctx = new SimpleContext();
|
||||
// ctx.put(NutzAccess.class.getName(), NutzAccess.class);
|
||||
// ctx.put(JuelExpression.class.getName(), JuelExpression.class);
|
||||
//
|
||||
//// ctx.put(NutzTransactionInterceptor.class.getName(), NutzTransactionInterceptor.class);
|
||||
//
|
||||
// // 初始化配置
|
||||
// Configuration configuration = new Configuration(ctx);
|
||||
//
|
||||
//// Mirror.me(configuration).setValue(configuration, "interceptor", ctx.find(NutzTransactionInterceptor.class));
|
||||
// configuration.initAccessDBObject(dataSource);
|
||||
//
|
||||
//
|
||||
// SnakerEngine engine = configuration.buildSnakerEngine();
|
||||
// return engine;
|
||||
// }
|
||||
//
|
||||
//}
|
||||
@@ -0,0 +1,16 @@
|
||||
//package com.budwk.app.snakerflow.config;
|
||||
//
|
||||
//import cn.hutool.extra.expression.ExpressionUtil;
|
||||
//import org.snaker.engine.Expression;
|
||||
//
|
||||
//import java.util.Map;
|
||||
//
|
||||
//public class SnakerExpression implements Expression {
|
||||
// @Override
|
||||
// public <T> T eval(Class<T> T, String expr, Map<String, Object> args) {
|
||||
//
|
||||
// Object eval = ExpressionUtil.eval(expr, args);
|
||||
//
|
||||
// return null;
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,357 @@
|
||||
//package com.budwk.app.snakerflow.controller;
|
||||
//
|
||||
//import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
//import cn.hutool.core.util.StrUtil;
|
||||
//import cn.hutool.json.JSONObject;
|
||||
//import com.budwk.app.base.page.Pagination;
|
||||
//import com.budwk.app.base.result.Result;
|
||||
//import com.budwk.app.snakerflow.SnakerHelper;
|
||||
//import io.swagger.annotations.ApiOperation;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
//import org.nutz.dao.Dao;
|
||||
//import org.nutz.dao.Sqls;
|
||||
//import org.nutz.dao.sql.Sql;
|
||||
//import org.nutz.ioc.aop.Aop;
|
||||
//import org.nutz.ioc.loader.annotation.Inject;
|
||||
//import org.nutz.ioc.loader.annotation.IocBean;
|
||||
//import org.nutz.lang.util.NutMap;
|
||||
//import org.nutz.mvc.annotation.At;
|
||||
//import org.nutz.mvc.annotation.Ok;
|
||||
//import org.nutz.mvc.annotation.Param;
|
||||
//import org.snaker.engine.SnakerEngine;
|
||||
//import org.snaker.engine.access.Page;
|
||||
//import org.snaker.engine.access.QueryFilter;
|
||||
//import org.snaker.engine.entity.HistoryTask;
|
||||
//import org.snaker.engine.entity.Order;
|
||||
//import org.snaker.engine.entity.Process;
|
||||
//import org.snaker.engine.entity.Task;
|
||||
//import org.snaker.engine.helper.AssertHelper;
|
||||
//import org.snaker.engine.helper.StreamHelper;
|
||||
//import org.snaker.engine.model.ProcessModel;
|
||||
//import org.snaker.engine.model.TaskModel;
|
||||
//import org.snaker.engine.model.TransitionModel;
|
||||
//
|
||||
//import javax.servlet.http.HttpServletRequest;
|
||||
//import java.io.IOException;
|
||||
//import java.io.InputStream;
|
||||
//import java.nio.charset.StandardCharsets;
|
||||
//import java.util.*;
|
||||
//
|
||||
//import static org.snaker.engine.access.QueryFilter.DESC;
|
||||
//
|
||||
//@IocBean
|
||||
//@At("/flow/define")
|
||||
//@Ok("json:full")
|
||||
//@Slf4j
|
||||
//public class SankerFlowDefineController {
|
||||
//
|
||||
// @Inject
|
||||
// private SnakerEngine snakerEngine;
|
||||
// @Inject
|
||||
// private Dao dao;
|
||||
//
|
||||
// @At("")
|
||||
// @Ok("beetl:/platform/flow/definition/index.html")
|
||||
// @SaCheckLogin
|
||||
// public void index() {
|
||||
// }
|
||||
//
|
||||
// @At("/designer")
|
||||
// @Ok("beetl:/platform/flow/definition/designer.html")
|
||||
// @SaCheckLogin
|
||||
// public void designer(HttpServletRequest request) {
|
||||
// request.setAttribute("processId", request.getParameter("processId"));
|
||||
// }
|
||||
//
|
||||
// @At("/designer2")
|
||||
// @Ok("beetl:/platform/flow/designer.html")
|
||||
// @SaCheckLogin
|
||||
// public void designer2(HttpServletRequest request) {
|
||||
// request.setAttribute("processId", request.getParameter("processId"));
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @At("/diagram")
|
||||
// @Ok("beetl:/platform/flow/diagram.html")
|
||||
// @SaCheckLogin
|
||||
// public void diagram(HttpServletRequest request) {
|
||||
// request.setAttribute("processId", request.getParameter("processId"));
|
||||
// request.setAttribute("orderId", request.getParameter("orderId"));
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @At
|
||||
// @SaCheckLogin
|
||||
// @ApiOperation("获取流程定义分页列表")
|
||||
// public Result pageData(Integer pageNumber, Integer pageSize, String displayName, String name) {
|
||||
// QueryFilter filter = new QueryFilter();
|
||||
// if (StrUtil.isNotEmpty(displayName)) {
|
||||
// filter.setDisplayName(displayName);
|
||||
// }
|
||||
// if (StrUtil.isNotEmpty(name)) {
|
||||
// filter.setName(name);
|
||||
// }
|
||||
// filter.orderBy("create_Time").order(DESC);
|
||||
// Page<Process> page = new Page<>();
|
||||
// page.setPageNo(pageNumber);
|
||||
// page.setPageSize(pageSize);
|
||||
// snakerEngine.process().getProcesss(page, filter);
|
||||
// List<Process> result = page.getResult();
|
||||
// Pagination<Process> pagination = new Pagination<>(pageNumber, pageSize, (int) page.getTotalCount(), result);
|
||||
// return Result.success(pagination);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @At
|
||||
// @SaCheckLogin
|
||||
// @ApiOperation("新增流程定义")
|
||||
// public Result insert(){
|
||||
//
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// @At
|
||||
// @SaCheckLogin
|
||||
// @ApiOperation("保存流程定义")
|
||||
// @Aop(TransAop.READ_COMMITTED)
|
||||
// public Result saveProcessXml(String model, String id, boolean xmlHeader) {
|
||||
// InputStream input = null;
|
||||
// try {
|
||||
// String xml = "";
|
||||
// if (!xmlHeader) {
|
||||
// xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n";
|
||||
// }
|
||||
// xml = xml + SnakerHelper.convertXml(model);
|
||||
// input = StreamHelper.getStreamFromString(xml);
|
||||
// if (StrUtil.isNotEmpty(id) && !id.equals("undefined")) {
|
||||
// snakerEngine.process().redeploy(id, input);
|
||||
// } else {
|
||||
// snakerEngine.process().deploy(input);
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// log.error("", e);
|
||||
// return Result.error("保存失败:" + e.getMessage());
|
||||
// } finally {
|
||||
// if (input != null) {
|
||||
// try {
|
||||
// input.close();
|
||||
// } catch (IOException ignored) {
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return Result.success();
|
||||
// }
|
||||
//
|
||||
// @At("/getXml")
|
||||
// @SaCheckLogin
|
||||
// @ApiOperation("获取流程定义")
|
||||
// public Result getProcessXml(String id) {
|
||||
// Process process = snakerEngine.process().getProcessById(id);
|
||||
// if (process != null) {
|
||||
// byte[] bytes = process.getDBContent();
|
||||
// return Result.success().addData(new String(bytes, StandardCharsets.UTF_8));
|
||||
// }
|
||||
// return Result.success();
|
||||
// }
|
||||
//
|
||||
// @At("/process/modelJson")
|
||||
// @ApiOperation(value = "根据流程定义名称获取流程定义json", tags = "流程引擎-流程")
|
||||
// @SaCheckLogin
|
||||
// public Result getProcessJson(String processId) {
|
||||
// if (StrUtil.isBlank(processId)) {
|
||||
// return Result.success();
|
||||
// }
|
||||
// Process process = snakerEngine.process().getProcessById(processId);
|
||||
// if (Objects.isNull(process)) {
|
||||
// return Result.success();
|
||||
// }
|
||||
// ProcessModel processModel = process.getModel();
|
||||
// if (Objects.isNull(processModel)) {
|
||||
// return Result.success();
|
||||
// }
|
||||
// String modelJson = SnakerHelper.getModelJson(processModel);
|
||||
// return Result.success().addData(modelJson);
|
||||
// }
|
||||
//
|
||||
// @At("/process/json")
|
||||
// @SaCheckLogin
|
||||
// @ApiOperation(value = "流程定义+流程状态")
|
||||
// public Result getProcessStateJson(String processId, String orderId) {
|
||||
// if (StrUtil.isBlank(processId)) {
|
||||
// processId = snakerEngine.query().getHistOrder(orderId).getProcessId();
|
||||
// }
|
||||
// Process process = snakerEngine.process().getProcessById(processId);
|
||||
// AssertHelper.notNull(process);
|
||||
// ProcessModel model = process.getModel();
|
||||
// Map<String, String> jsonMap = new HashMap<>();
|
||||
// if (model != null) {
|
||||
// String modelJson = SnakerHelper.getModelJson(model);
|
||||
// jsonMap.put("process", SnakerHelper.getModelJson(model));
|
||||
// }
|
||||
//
|
||||
// if (StrUtil.isNotEmpty(orderId)) {
|
||||
// List<Task> tasks = snakerEngine.query().getActiveTasks(new QueryFilter().setOrderId(orderId));
|
||||
// List<HistoryTask> historyTasks = snakerEngine.query().getHistoryTasks(new QueryFilter().setOrderId(orderId));
|
||||
// jsonMap.put("state", SnakerHelper.getStateJson(model, tasks, historyTasks));
|
||||
// }
|
||||
// return Result.success(jsonMap);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @At
|
||||
// @SaCheckLogin
|
||||
// @ApiOperation("取消部署")
|
||||
// public Result undeploy(String id) {
|
||||
// snakerEngine.process().undeploy(id);
|
||||
// return Result.success();
|
||||
// }
|
||||
//
|
||||
// @At
|
||||
// @SaCheckLogin
|
||||
// @ApiOperation("发布流程")
|
||||
// public Result publish(String id) {
|
||||
// InputStream inputStream = null;
|
||||
// try {
|
||||
// Process process = snakerEngine.process().getProcessById(id);
|
||||
// byte[] bytes = process.getDBContent();
|
||||
// String xml = new String(bytes, StandardCharsets.UTF_8);
|
||||
// inputStream = StreamHelper.getStreamFromString(xml);
|
||||
// snakerEngine.process().redeploy(id, inputStream);
|
||||
// return Result.success();
|
||||
// } catch (Exception e) {
|
||||
// return Result.error("发布失败:" + e.getMessage());
|
||||
// } finally {
|
||||
// if (inputStream != null) {
|
||||
// try {
|
||||
// inputStream.close();
|
||||
// } catch (IOException ignored) {
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @At
|
||||
// @SaCheckLogin
|
||||
// @ApiOperation("删除流程定义")
|
||||
// public Result delete(String id) {
|
||||
// snakerEngine.process().cascadeRemove(id);
|
||||
// return Result.success();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @At
|
||||
// @SaCheckLogin
|
||||
// @ApiOperation("获取流程定义+流程状态")
|
||||
// public Object getProcessJson(String processId, String orderId) {
|
||||
// if (StrUtil.isBlank(processId)) {
|
||||
// processId = snakerEngine.query().getHistOrder(orderId).getProcessId();
|
||||
// }
|
||||
// Process process = snakerEngine.process().getProcessById(processId);
|
||||
// AssertHelper.notNull(process);
|
||||
// ProcessModel model = process.getModel();
|
||||
// Map<String, String> jsonMap = new HashMap<>();
|
||||
// if (model != null) {
|
||||
// jsonMap.put("process", SnakerHelper.getModelJson(model));
|
||||
// }
|
||||
//
|
||||
// if (StrUtil.isNotEmpty(orderId)) {
|
||||
// List<Task> tasks = snakerEngine.query().getActiveTasks(new QueryFilter().setOrderId(orderId));
|
||||
// List<HistoryTask> historyTasks = snakerEngine.query().getHistoryTasks(new QueryFilter().setOrderId(orderId));
|
||||
// jsonMap.put("state", SnakerHelper.getStateJson(model, tasks, historyTasks));
|
||||
// }
|
||||
// return jsonMap;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @At(value = "/flow/task/tip", top = true)
|
||||
// @SaCheckLogin
|
||||
// public Result taskTip(String orderId, String taskName) {
|
||||
// List<Task> tasks = snakerEngine.query().getActiveTasks(new QueryFilter().setOrderId(orderId));
|
||||
// StringBuilder builder = new StringBuilder();
|
||||
// String createTime = StrUtil.EMPTY;
|
||||
// String finishTime = StrUtil.EMPTY;
|
||||
// boolean find = false;
|
||||
// for (Task task : tasks) {
|
||||
// if (task.getTaskName().equalsIgnoreCase(taskName)) {
|
||||
// String[] actors = snakerEngine.query().getTaskActorsByTaskId(task.getId());
|
||||
// for (String actor : actors) {
|
||||
//// SysUser sysUser = sysUserService.getById(Long.valueOf(actor));
|
||||
//// String nickName = sysUser.getNickName();
|
||||
//// builder.append(nickName).append(",");
|
||||
// builder.append(actor);
|
||||
// find = true;
|
||||
// }
|
||||
// createTime = task.getCreateTime();
|
||||
// }
|
||||
// }
|
||||
// if (!find) {
|
||||
// List<HistoryTask> historyTasks = snakerEngine.query().getHistoryTasks(new QueryFilter().setOrderId(orderId));
|
||||
// for (HistoryTask task : historyTasks) {
|
||||
// if (task.getTaskName().equalsIgnoreCase(taskName)) {
|
||||
// String[] actors = snakerEngine.query().getHistoryTaskActorsByTaskId(task.getId());
|
||||
// for (String actor : actors) {
|
||||
//// SysUser sysUser = sysUserService.getById(Long.valueOf(actor));
|
||||
//// String nickName = sysUser.getNickName();
|
||||
//// builder.append(nickName).append(",");
|
||||
// builder.append(actor);
|
||||
// }
|
||||
// createTime = task.getCreateTime();
|
||||
// finishTime = task.getFinishTime();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (!builder.isEmpty()) {
|
||||
// builder.deleteCharAt(builder.length() - 1);
|
||||
// }
|
||||
// Map<String, String> data = new HashMap<>();
|
||||
// data.put("actors", builder.toString());
|
||||
// data.put("createTime", createTime);
|
||||
// data.put("finishTime", finishTime);
|
||||
// return Result.success(data);
|
||||
// }
|
||||
//
|
||||
// @At(value = "/flow/instance/info", top = true)
|
||||
// @SaCheckLogin
|
||||
// @ApiOperation("流程实例信息")
|
||||
// public Result instanceStatus(@Param("instanceId") String instanceId) {
|
||||
// Sql sql = Sqls.create("""
|
||||
// SELECT
|
||||
// o.order_State AS orderState,
|
||||
// p.display_Name AS processName,
|
||||
// concat(t.display_Name) AS currentTaskName\s
|
||||
// FROM
|
||||
// wf_hist_order o
|
||||
// LEFT JOIN wf_process p ON p.id = o.process_Id
|
||||
// LEFT JOIN wf_task t ON t.order_Id = o.id
|
||||
// WHERE o.id = @instanceId
|
||||
// """);
|
||||
// sql.setParam("instanceId", instanceId);
|
||||
// sql.setCallback(Sqls.callback.map());
|
||||
// dao.execute(sql);
|
||||
// NutMap result = (NutMap) sql.getResult();
|
||||
// return Result.success(result);
|
||||
// }
|
||||
//
|
||||
// @At(value = "/flow/task/info", top = true)
|
||||
// @SaCheckLogin
|
||||
// @ApiOperation("任务信息")
|
||||
// public Result taskInfo(@Param("taskId") String taskId) {
|
||||
// Task task = snakerEngine.query().getTask(taskId);
|
||||
// return Result.success(task);
|
||||
// }
|
||||
//
|
||||
// @At(value = "/flow/task/next", top = true)
|
||||
// @ApiOperation("获取可执行的流向任务")
|
||||
// @SaCheckLogin
|
||||
// public Result taskNext(@Param("taskId") String taskId) {
|
||||
//
|
||||
// return Result.success();
|
||||
// }
|
||||
//
|
||||
//
|
||||
//}
|
||||
@@ -0,0 +1,19 @@
|
||||
//package com.budwk.app.snakerflow.controller;
|
||||
//
|
||||
//import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
//import io.swagger.annotations.ApiOperation;
|
||||
//import org.nutz.mvc.annotation.At;
|
||||
//import org.nutz.mvc.annotation.Ok;
|
||||
//
|
||||
//@At("/flow/common")
|
||||
//public class SnakerFlowCommonController {
|
||||
//
|
||||
// @ApiOperation("通用审批页面")
|
||||
// @At("/approval")
|
||||
// @SaCheckLogin
|
||||
// @Ok("beetl:/platform/flow/approval.html")
|
||||
// public void approval() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
//}
|
||||
Reference in New Issue
Block a user