..
This commit is contained in:
@@ -260,7 +260,6 @@ public class FlowCommonController {
|
||||
flowEngine.executeProcessTask(processTaskId, operator, args);
|
||||
} else if (ObjectUtil.equals(submitType, ProcessSubmitTypeEnum.RE_APPLY.getCode())) {
|
||||
// 重新提交
|
||||
// args.put(FlowConst.FORM_DATA, args.getStr(FlowConst.FORM_DATA));
|
||||
flowEngine.executeProcessTask(processTaskId, operator, args);
|
||||
} else {
|
||||
// 默认执行
|
||||
|
||||
@@ -89,6 +89,7 @@ public class FlowEngineImpl implements FlowEngine {
|
||||
}
|
||||
// 2. 将流程定义文件转成流程模型
|
||||
ProcessModel processModel = processDefineService.processDefineToModel(processDefine);
|
||||
|
||||
// 3. 根据流程定义对象创建流程实例
|
||||
ProcessInstance processInstance = processInstanceService.createProcessInstance(processDefine, businessKey, operator, args, parentId, parentNodeName);
|
||||
args.set(FlowConst.PROCESS_INSTANCE_ID_KEY, processInstance.getId());
|
||||
|
||||
@@ -28,6 +28,7 @@ public class CountersignHandler implements IHandler {
|
||||
boolean isMerged = false;
|
||||
String countersignType = taskModel.getExt().get("countersignType","PARALLEL");
|
||||
String countersignCompletionCondition = taskModel.getExt().get("countersignCompletionCondition","");
|
||||
countersignCompletionCondition = taskModel.getCountersignCompletionCondition();
|
||||
String prefix = FlowConst.COUNTERSIGN_VARIABLE_PREFIX +taskModel.getName()+"_";
|
||||
// 会签办理人列表
|
||||
List<String> operatorList = Convert.toList(String.class,execution.getArgs().get(prefix+FlowConst.COUNTERSIGN_OPERATOR_LIST));
|
||||
|
||||
@@ -460,7 +460,7 @@ public class ProcessInstanceServiceImpl extends BaseServiceImpl<ProcessInstance>
|
||||
addVariable.put(prefix + FlowConst.NR_OF_COMPLETED_INSTANCES, execution.getArgs().get(prefix + FlowConst.NR_OF_COMPLETED_INSTANCES));
|
||||
// 更新会签操作人列表countersignOperatorList
|
||||
addVariable.put(prefix + FlowConst.COUNTERSIGN_OPERATOR_LIST, taskActors);
|
||||
ProcessInstanceService processInstanceService = SpringUtil.getBean(ProcessInstanceService.class);
|
||||
ProcessInstanceService processInstanceService = ServiceContext.find(ProcessInstanceService.class);
|
||||
processInstanceService.addVariable(processInstanceId, addVariable);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.ReflectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.budwk.app.base.exception.BaseException;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
@@ -15,6 +14,7 @@ import com.budwk.app.base.vo.LabelValueVO;
|
||||
import com.budwk.app.flow.constant.FlowConst;
|
||||
import com.budwk.app.flow.engine.AssignmentHandler;
|
||||
import com.budwk.app.flow.engine.core.Execution;
|
||||
import com.budwk.app.flow.engine.core.ServiceContext;
|
||||
import com.budwk.app.flow.engine.event.ProcessEvent;
|
||||
import com.budwk.app.flow.engine.event.ProcessPublisher;
|
||||
import com.budwk.app.flow.engine.model.CustomModel;
|
||||
@@ -179,13 +179,10 @@ public class ProcessTaskServiceImpl extends BaseServiceImpl<ProcessTask> impleme
|
||||
// 增加是否为第一个任务节点标识
|
||||
execution.getArgs().put(FlowConst.IS_FIRST_TASK_NODE, FlowUtil.isFistTaskName(execution.getProcessModel(), taskModel.getName()));
|
||||
//过滤上个任务的表单数据 避免造成污染 每个任务只保存自己的表单数据
|
||||
Dict cleanArgs = Dict.create();
|
||||
execution.getArgs().forEach((k, v) -> {
|
||||
if (!k.startsWith(FlowConst.TASK_FORM_DATA_PREFIX)) {
|
||||
cleanArgs.set(k, v);
|
||||
}
|
||||
});
|
||||
execution.setArgs(cleanArgs);
|
||||
List<String> removeKeys = execution.getArgs().keySet().stream().filter(k -> k.startsWith(FlowConst.TASK_FORM_DATA_PREFIX) || k.equals(FlowConst.SUBMIT_TYPE) || k.startsWith(FlowConst.COUNTERSIGN_VARIABLE_PREFIX)).toList();
|
||||
for (String key : removeKeys) {
|
||||
execution.getArgs().remove(key);
|
||||
}
|
||||
|
||||
processTask.setVariable(JSONUtil.toJsonStr(execution.getArgs()));
|
||||
processTask.setCreatedAt(now);
|
||||
@@ -367,6 +364,7 @@ public class ProcessTaskServiceImpl extends BaseServiceImpl<ProcessTask> impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public List<ProcessTask> createCountersignTask(TaskModel taskModel, Execution execution) {
|
||||
List<ProcessTask> processTaskList = new ArrayList<>();
|
||||
List<String> taskActors = getTaskActors(taskModel, execution);
|
||||
@@ -399,7 +397,15 @@ public class ProcessTaskServiceImpl extends BaseServiceImpl<ProcessTask> impleme
|
||||
processTask.setTaskState(ProcessTaskStateEnum.DOING.getCode());
|
||||
processTask.setTaskType(taskModel.getTaskType().getCode());
|
||||
processTask.setProcessInstanceId(execution.getProcessInstanceId());
|
||||
|
||||
// 增加是否为第一个任务节点标识
|
||||
execution.getArgs().put(FlowConst.IS_FIRST_TASK_NODE, FlowUtil.isFistTaskName(execution.getProcessModel(), taskModel.getName()));
|
||||
//过滤上个任务的表单数据 避免造成污染 每个任务只保存自己的表单数据
|
||||
List<String> removeKeys = execution.getArgs().keySet().stream().filter(k -> k.startsWith(FlowConst.TASK_FORM_DATA_PREFIX) || k.equals(FlowConst.SUBMIT_TYPE) || k.startsWith(FlowConst.COUNTERSIGN_VARIABLE_PREFIX)).toList();
|
||||
for (String key : removeKeys) {
|
||||
execution.getArgs().remove(key);
|
||||
}
|
||||
|
||||
processTask.setVariable(JSONUtil.toJsonStr(execution.getArgs()));
|
||||
processTask.setCreatedAt(now);
|
||||
processTask.setUpdatedAt(now);
|
||||
@@ -414,7 +420,7 @@ public class ProcessTaskServiceImpl extends BaseServiceImpl<ProcessTask> impleme
|
||||
processTaskList.add(processTask);
|
||||
addTaskActor(processTask.getId(), CollectionUtil.newArrayList(taskActor));
|
||||
});
|
||||
ProcessInstanceService processInstanceService = SpringUtil.getBean(ProcessInstanceService.class);
|
||||
ProcessInstanceService processInstanceService = ServiceContext.find(ProcessInstanceService.class);
|
||||
// 更新会签变量到流程实例参数中
|
||||
processInstanceService.updateCountersignVariable(taskModel, execution, taskActors);
|
||||
return processTaskList;
|
||||
|
||||
@@ -1,247 +0,0 @@
|
||||
//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;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//}
|
||||
@@ -1,41 +0,0 @@
|
||||
//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;
|
||||
// }
|
||||
//
|
||||
//}
|
||||
@@ -1,16 +0,0 @@
|
||||
//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;
|
||||
// }
|
||||
//}
|
||||
@@ -1,357 +0,0 @@
|
||||
//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();
|
||||
// }
|
||||
//
|
||||
//
|
||||
//}
|
||||
@@ -1,19 +0,0 @@
|
||||
//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() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
//}
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
package com.budwk.app.zhgh.democratic.proposal.controller.transact;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.flow.engine.FlowEngine;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.democratic.proposal.models.ProposalInfo;
|
||||
import com.budwk.app.zhgh.democratic.proposal.service.ProposalWriteService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
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;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/proposal/apply")
|
||||
@Ok("json:full")
|
||||
@Api("撰写提案")
|
||||
public class ProposalApplyControllerX {
|
||||
|
||||
@Inject
|
||||
private FlowEngine flowEngine;
|
||||
@Inject
|
||||
private ProposalWriteService proposalWriteService;
|
||||
|
||||
@At("/index")
|
||||
@Ok("beetl:/platform/zhgh/democratic/proposal/transact/apply/index.html")
|
||||
@SaCheckLogin
|
||||
public void index() {
|
||||
|
||||
}
|
||||
|
||||
@At("/form")
|
||||
@Ok("beetl:/platform/zhgh/democratic/proposal/transact/apply/form.html")
|
||||
@SaCheckLogin
|
||||
public void form() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
public Result pageData(Integer pageNumber, Integer pageSize) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
type.name AS typeName,
|
||||
tcs.fullName AS sessionName,
|
||||
tcd.`name` AS delegationName,
|
||||
ins.id AS instanceId,
|
||||
ins.businessNo,
|
||||
ins.state instanceState,
|
||||
ins.variable instanceVariable,
|
||||
t.id taskId,
|
||||
t.taskName AS taskKey,
|
||||
t.displayName taskName,
|
||||
t.taskType,
|
||||
t.performType taskPerformType,
|
||||
t.taskState,
|
||||
t.finishTime,
|
||||
t.taskParentId,
|
||||
t.variable taskVariale,
|
||||
IF((SELECT taskName FROM wf_process_task tt WHERE tt.id = t.taskParentId) = 'startTask', 1, 0) canRevoke,
|
||||
(select MAX(id) from wf_process_task where processInstanceId = ins.id and taskName = 'startTask') AS startTaskId
|
||||
FROM
|
||||
proposal_info info
|
||||
LEFT JOIN proposal_type type on type.id = info.typeId
|
||||
LEFT JOIN teacher_congress_session tcs on tcs.id = info.sessionId
|
||||
LEFT JOIN teacher_congress_delegation tcd on tcd.id = info.delegationId
|
||||
LEFT JOIN `wf_process_instance` ins ON ins.businessNo = info.id
|
||||
LEFT JOIN wf_process_task t ON t.processInstanceId = ins.id AND t.taskState = 10
|
||||
LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("info.createdBy", "=", SecurityUtil.getUserId());
|
||||
cnd.desc("info.createdAt");
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pagination = proposalWriteService.listPageMap(pageNumber, pageSize, sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
public Result info(String id) {
|
||||
ProposalInfo info = proposalWriteService.fetch(id);
|
||||
return Result.success(info);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@ApiOperation("删除")
|
||||
public Result delete(@Param("id") String id) {
|
||||
proposalWriteService.delete(id);
|
||||
flowEngine.processInstanceService().deleteProcessInstanceByBusinessKey(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
}
|
||||
+61
-76
@@ -1,14 +1,18 @@
|
||||
package com.budwk.app.zhgh.democratic.proposal.controller.transact;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.bpm.enums.BpmProcessTaskStatusEnum;
|
||||
import com.budwk.app.bpm.param.BpmTaskApprovalParam;
|
||||
import com.budwk.app.bpm.service.BpmService;
|
||||
import com.budwk.app.flow.enums.ProcessTaskStateEnum;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.democratic.proposal.controller.vo.ProposalInfoPageVO;
|
||||
@@ -26,11 +30,13 @@ import org.nutz.dao.util.cri.Static;
|
||||
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 javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 团长审核
|
||||
@@ -42,99 +48,78 @@ import javax.validation.Valid;
|
||||
@Api(tags = "提案-办理-团长审核")
|
||||
public class ProposalDelegationController {
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
@Inject
|
||||
private ProposalCommonService proposalCommonService;
|
||||
@Inject
|
||||
private ProposalDelegationService proposalDelegationService;
|
||||
@Inject
|
||||
private BpmService bpmService;
|
||||
|
||||
@At("")
|
||||
@At("/index")
|
||||
@Ok("beetl:/platform/zhgh/democratic/proposal/transact/delegation/index.html")
|
||||
@SaCheckPermission("proposal.delegation")
|
||||
@SaCheckLogin
|
||||
public void index() {
|
||||
|
||||
}
|
||||
|
||||
@At("/form")
|
||||
@Ok("beetl:/platform/zhgh/democratic/proposal/transact/delegation/form.html")
|
||||
@SaCheckLogin
|
||||
public void form() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("proposal.delegation")
|
||||
@ApiOperation("分页列表")
|
||||
public Result pageData(@Valid ProposalSearchParam pageForm,boolean approval) {
|
||||
@SaCheckPermission("proposal.seconded")
|
||||
@SaCheckLogin
|
||||
public Result pageData(@Valid ProposalSearchParam pageForm, boolean approval) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
type.name AS typeName,
|
||||
tcs.fullName AS sessionName,
|
||||
tcd.`name` AS delegationName,
|
||||
inst.id processInstanceId,
|
||||
inst.processInstanceNodeId,
|
||||
inst.processInstanceNodeName,
|
||||
inst.processInstanceTaskIds,
|
||||
inst.processInstanceStatus,
|
||||
task.id processInstanceTaskId,
|
||||
task.taskStatus processInstanceTaskStatus,
|
||||
EXISTS (
|
||||
SELECT 1
|
||||
FROM bpm_process_task next_task
|
||||
WHERE next_task.prevTaskId = task.id
|
||||
AND next_task.taskStatus = 'COMPLETE'
|
||||
) AS nextTaskIsComplete
|
||||
SELECT
|
||||
info.*,
|
||||
type.name AS typeName,
|
||||
tcs.fullName AS sessionName,
|
||||
tcd.`name` AS delegationName,
|
||||
ins.id AS instanceId,
|
||||
ins.businessNo,
|
||||
ins.state instanceState,
|
||||
ins.variable instanceVariale,
|
||||
t.id taskId,
|
||||
t.taskName AS taskKey,
|
||||
t.displayName taskName,
|
||||
t.taskType,
|
||||
t.performType taskPerformType,
|
||||
t.taskState,
|
||||
t.finishTime,
|
||||
t.taskParentId,
|
||||
t.variable taskVariable,
|
||||
IFNULL(GROUP_CONCAT(DISTINCT nt.displayName),'结束') curTaskName,
|
||||
IF(rt.id IS NOT NULL, 1, 0) AS canRevoke
|
||||
FROM
|
||||
bpm_process_task task
|
||||
INNER JOIN bpm_process_node_define nd ON nd.id = task.processTaskNodeId
|
||||
INNER JOIN bpm_process_instance inst ON inst.id = task.processInstanceId
|
||||
INNER JOIN proposal_info info ON info.id = inst.processInstanceBusinessId
|
||||
LEFT JOIN proposal_type type on type.id = info.typeId
|
||||
LEFT JOIN teacher_congress_session tcs ON tcs.id = info.sessionId
|
||||
LEFT JOIN teacher_congress_delegation tcd ON tcd.id = info.delegationId
|
||||
wf_process_task t
|
||||
LEFT JOIN wf_process_instance ins ON ins.id = t.processInstanceId
|
||||
LEFT JOIN proposal_info info ON info.id = ins.businessNo
|
||||
LEFT JOIN proposal_type type on type.id = info.typeId
|
||||
LEFT JOIN teacher_congress_session tcs on tcs.id = info.sessionId
|
||||
LEFT JOIN teacher_congress_delegation tcd on tcd.id = info.delegationId
|
||||
LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id
|
||||
LEFT JOIN wf_process_task nt ON nt.processInstanceId = ins.id AND nt.taskState = 10
|
||||
LEFT JOIN wf_process_task rt ON rt.processInstanceId = ins.id AND rt.taskParentId = t.id AND rt.taskState = 10
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if(!AuthUtil.hasRole(RoleConstant.SYSADMIN.name())){
|
||||
cnd.and(new Static("JSON_CONTAINS( task.assignments, '\"%s\"' )".formatted(SecurityUtil.getUserLoginname())));
|
||||
}
|
||||
cnd.and("nd.nodeCode", "=", 30);
|
||||
cnd.and("t.taskName", "=", "93d5ba64-8220-4e62-9783-83422f474b36");
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
|
||||
if (approval) {
|
||||
cnd.and("task.taskStatus", "=", BpmProcessTaskStatusEnum.COMPLETE);
|
||||
cnd.groupBy("info.id");
|
||||
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(), ProcessTaskStateEnum.WITHDRAW.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
|
||||
} else {
|
||||
cnd.and("task.taskStatus", "=", BpmProcessTaskStatusEnum.ACTIVE);
|
||||
cnd.and("t.taskState", "=", ProcessTaskStateEnum.DOING.getCode());
|
||||
}
|
||||
ProposalSearchParam.buildSearch(cnd, pageForm);
|
||||
cnd.and(new Static("""
|
||||
NOT EXISTS(
|
||||
SELECT 1
|
||||
FROM bpm_process_task t2
|
||||
WHERE t2.processInstanceId = task.processInstanceId
|
||||
AND t2.processTaskNodeCode = task.processTaskNodeCode
|
||||
AND t2.createdOn > task.createdOn
|
||||
)
|
||||
"""));
|
||||
|
||||
if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
|
||||
cnd.desc("info.createdAt");
|
||||
} else {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
cnd.groupBy("t.id");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageVO(pageForm, sql, ProposalInfoPageVO.class);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("proposal.delegation")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SLog(tag = "提案", msg = "团长审核")
|
||||
@ApiOperation("审核")
|
||||
public Result approval(@Valid @Param("approval") BpmTaskApprovalParam approvalParam) {
|
||||
proposalDelegationService.approval(approvalParam);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("proposal.delegation")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SLog(tag = "提案", msg = "团长审核撤回")
|
||||
@ApiOperation("撤回")
|
||||
public Result revoke(@Valid String taskId) {
|
||||
proposalDelegationService.revokeTask(taskId);
|
||||
// bpmService.revokeTask(taskId);
|
||||
return Result.success();
|
||||
Pagination<NutMap> pageVO = proposalCommonService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pageVO);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+150
@@ -0,0 +1,150 @@
|
||||
package com.budwk.app.zhgh.democratic.proposal.controller.transact;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.flow.engine.FlowEngine;
|
||||
import com.budwk.app.flow.enums.ProcessTaskStateEnum;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.democratic.proposal.param.ProposalSearchParam;
|
||||
import com.budwk.app.zhgh.democratic.proposal.service.ProposalWriteService;
|
||||
import com.budwk.app.zhgh.democratic.proposal.service.common.ProposalCommonService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
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 javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/proposal/invite")
|
||||
@Ok("json:full")
|
||||
@Api("邀请附议人")
|
||||
public class ProposalInviteController {
|
||||
|
||||
@Inject
|
||||
private FlowEngine flowEngine;
|
||||
@Inject
|
||||
private ProposalCommonService proposalCommonService;
|
||||
|
||||
@At("/index")
|
||||
@Ok("beetl:/platform/zhgh/democratic/proposal/transact/invite/index.html")
|
||||
@SaCheckLogin
|
||||
public void index() {
|
||||
|
||||
}
|
||||
|
||||
@At("/form")
|
||||
@Ok("beetl:/platform/zhgh/democratic/proposal/transact/invite/form.html")
|
||||
@SaCheckLogin
|
||||
public void form() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("proposal.seconded")
|
||||
@SaCheckLogin
|
||||
public Result pageData(@Valid ProposalSearchParam pageForm, boolean approval) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
type.name AS typeName,
|
||||
tcs.fullName AS sessionName,
|
||||
tcd.`name` AS delegationName,
|
||||
ins.id AS instanceId,
|
||||
ins.businessNo,
|
||||
ins.state instanceState,
|
||||
ins.variable instanceVariale,
|
||||
t.id taskId,
|
||||
t.taskName AS taskKey,
|
||||
t.displayName taskName,
|
||||
t.taskType,
|
||||
t.performType taskPerformType,
|
||||
t.taskState,
|
||||
t.finishTime,
|
||||
t.taskParentId,
|
||||
t.variable taskVariable,
|
||||
IFNULL(GROUP_CONCAT(DISTINCT nt.displayName),'结束') curTaskName,
|
||||
IF(rt.id IS NOT NULL, 1, 0) AS canRevoke
|
||||
FROM
|
||||
wf_process_task t
|
||||
LEFT JOIN wf_process_instance ins ON ins.id = t.processInstanceId
|
||||
LEFT JOIN proposal_info info ON info.id = ins.businessNo
|
||||
LEFT JOIN proposal_type type on type.id = info.typeId
|
||||
LEFT JOIN teacher_congress_session tcs on tcs.id = info.sessionId
|
||||
LEFT JOIN teacher_congress_delegation tcd on tcd.id = info.delegationId
|
||||
LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id
|
||||
LEFT JOIN wf_process_task nt ON nt.processInstanceId = ins.id AND nt.taskState = 10
|
||||
LEFT JOIN wf_process_task rt ON rt.processInstanceId = ins.id AND rt.taskParentId = t.id AND rt.taskState = 10
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("t.taskName", "=", "85b7b9bd-d706-48cb-99a1-ef1370fb1819");
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
|
||||
if (approval) {
|
||||
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(), ProcessTaskStateEnum.WITHDRAW.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
|
||||
} else {
|
||||
cnd.and("t.taskState", "=", ProcessTaskStateEnum.DOING.getCode());
|
||||
}
|
||||
|
||||
if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
|
||||
cnd.desc("info.createdAt");
|
||||
} else {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
cnd.groupBy("t.id");
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pageVO = proposalCommonService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pageVO);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("proposal.seconded")
|
||||
@SaCheckLogin
|
||||
@ApiOperation("查询附议人")
|
||||
public Result listSeconder(@Valid PageForm pageForm, @Valid String proposalId, @Valid String sessionId,
|
||||
String delegationId, boolean isInvite){
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
t1.userId,
|
||||
t1.loginName,
|
||||
t1.userName,
|
||||
t1.sex,
|
||||
t1.unitName,
|
||||
t1.unionName,
|
||||
t2.NAME AS delegationName
|
||||
FROM
|
||||
teacher_congress_delegate t1
|
||||
LEFT JOIN teacher_congress_delegation t2 ON t2.id = t1.delegationId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.where("t1.sessionId", "=", sessionId);
|
||||
cnd.andEX("t1.delegationId", "=", delegationId);
|
||||
cnd.and("t1.roleId","=","72e24b5b4c4f4e90a6641e6af8487e42");
|
||||
cnd.and("t1.loginName", "!=", SecurityUtil.getUserLoginname());
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("t1.loginName", pageForm.getSearchKeyword());
|
||||
seg.orLike("t1.userName", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pageVO = proposalCommonService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pageVO);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+60
-62
@@ -1,19 +1,23 @@
|
||||
package com.budwk.app.zhgh.democratic.proposal.controller.transact;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.bpm.enums.BpmProcessTaskStatusEnum;
|
||||
import com.budwk.app.bpm.param.BpmTaskApprovalParam;
|
||||
import com.budwk.app.bpm.service.BpmService;
|
||||
import com.budwk.app.flow.enums.ProcessTaskStateEnum;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.democratic.proposal.controller.vo.ProposalInfoPageVO;
|
||||
import com.budwk.app.zhgh.democratic.proposal.param.ProposalSearchParam;
|
||||
import com.budwk.app.zhgh.democratic.proposal.service.ProposalSecondedService;
|
||||
import com.budwk.app.zhgh.democratic.proposal.service.ProposalWriteService;
|
||||
import com.budwk.app.zhgh.democratic.proposal.service.common.ProposalCommonService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -27,11 +31,13 @@ import org.nutz.dao.util.cri.Static;
|
||||
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 javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 附议提案
|
||||
@@ -46,84 +52,76 @@ public class ProposalSecondedController {
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
@Inject
|
||||
private ProposalCommonService proposalCommonService;
|
||||
@Inject
|
||||
private BpmService bpmService;
|
||||
@Inject
|
||||
private ProposalSecondedService proposalSecondedService;
|
||||
|
||||
|
||||
@At("")
|
||||
@At("/index")
|
||||
@Ok("beetl:/platform/zhgh/democratic/proposal/transact/seconded/index.html")
|
||||
@SaCheckPermission("proposal.seconded")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At("/form")
|
||||
@Ok("beetl:/platform/zhgh/democratic/proposal/transact/seconded/form.html")
|
||||
@SaCheckPermission("proposal.seconded")
|
||||
public void form() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("proposal.seconded")
|
||||
public Result pageData(@Valid ProposalSearchParam pageForm, boolean approval) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
type.name AS typeName,
|
||||
tcs.fullName AS sessionName,
|
||||
tcd.`name` AS delegationName,
|
||||
inst.id processInstanceId,
|
||||
inst.processInstanceNodeId,
|
||||
inst.processInstanceNodeName,
|
||||
inst.processInstanceTaskIds,
|
||||
inst.processInstanceStatus,
|
||||
task.id processInstanceTaskId,
|
||||
task.taskStatus processInstanceTaskStatus,
|
||||
JSON_EXTRACT( task.createVariable, '$.userName' ) AS seconderName,
|
||||
COUNT( nt.id ) OVER ( PARTITION BY task.id ) > 0 AS nextTaskIsComplete
|
||||
SELECT
|
||||
info.*,
|
||||
type.name AS typeName,
|
||||
tcs.fullName AS sessionName,
|
||||
tcd.`name` AS delegationName,
|
||||
ins.id AS instanceId,
|
||||
ins.businessNo,
|
||||
ins.state instanceState,
|
||||
ins.variable instanceVariale,
|
||||
t.id taskId,
|
||||
t.taskName AS taskKey,
|
||||
t.displayName taskName,
|
||||
t.taskType,
|
||||
t.performType taskPerformType,
|
||||
t.taskState,
|
||||
t.finishTime,
|
||||
t.taskParentId,
|
||||
t.variable taskVariable,
|
||||
IFNULL(GROUP_CONCAT(DISTINCT nt.displayName),'结束') curTaskName,
|
||||
IF(rt.id IS NOT NULL, 1, 0) AS canRevoke
|
||||
FROM
|
||||
bpm_process_task task
|
||||
INNER JOIN bpm_process_node_define nd ON nd.id = task.processTaskNodeId
|
||||
INNER JOIN bpm_process_instance inst ON inst.id = task.processInstanceId
|
||||
INNER JOIN proposal_info info ON info.id = inst.processInstanceBusinessId
|
||||
LEFT JOIN proposal_type type on type.id = info.typeId
|
||||
LEFT JOIN teacher_congress_session tcs ON tcs.id = info.sessionId
|
||||
LEFT JOIN teacher_congress_delegation tcd ON tcd.id = info.delegationId
|
||||
LEFT JOIN bpm_process_task nt ON nt.prevTaskId = task.id AND nt.taskStatus = 'COMPLETE'
|
||||
wf_process_task t
|
||||
LEFT JOIN wf_process_instance ins ON ins.id = t.processInstanceId
|
||||
LEFT JOIN proposal_info info ON info.id = ins.businessNo
|
||||
LEFT JOIN proposal_type type on type.id = info.typeId
|
||||
LEFT JOIN teacher_congress_session tcs on tcs.id = info.sessionId
|
||||
LEFT JOIN teacher_congress_delegation tcd on tcd.id = info.delegationId
|
||||
LEFT JOIN wf_process_task_actor ta ON ta.processTaskId = t.id
|
||||
LEFT JOIN wf_process_task nt ON nt.processInstanceId = ins.id AND nt.taskState = 10
|
||||
LEFT JOIN wf_process_task rt ON rt.processInstanceId = ins.id AND rt.taskParentId = t.id AND rt.taskState = 10
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if(!AuthUtil.hasRole(RoleConstant.SYSADMIN.name())){
|
||||
cnd.and(new Static("JSON_CONTAINS( task.assignments, '\"%s\"' )".formatted(SecurityUtil.getUserLoginname())));
|
||||
}
|
||||
cnd.and("nd.nodeCode", "=", 20);
|
||||
if (approval) {
|
||||
cnd.and("task.taskStatus", "=", BpmProcessTaskStatusEnum.COMPLETE);
|
||||
} else {
|
||||
cnd.and("task.taskStatus", "=", BpmProcessTaskStatusEnum.ACTIVE);
|
||||
}
|
||||
ProposalSearchParam.buildSearch(cnd, pageForm);
|
||||
// cnd.and(new Static("""
|
||||
// NOT EXISTS(
|
||||
// SELECT 1
|
||||
// FROM bpm_process_task t2
|
||||
// WHERE t2.processInstanceId = task.processInstanceId
|
||||
// AND t2.processTaskNodeCode = task.processTaskNodeCode
|
||||
// AND t2.createdOn > task.createdOn
|
||||
// )
|
||||
// """));
|
||||
// cnd.groupBy("task.id");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageVO(pageForm, sql, ProposalInfoPageVO.class);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
cnd.and("t.taskName", "=", "74458b33-ad6e-46c4-b8d9-1aa897142b25");
|
||||
cnd.and("ta.actorId", "in", List.of(SecurityUtil.getUserId()));
|
||||
|
||||
@At
|
||||
@SaCheckPermission("proposal.seconded")
|
||||
@ApiOperation("附议")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SLog(tag = "提案", msg = "提案人附议")
|
||||
public Result approval(@Valid @Param("approval") BpmTaskApprovalParam approvalParam) {
|
||||
proposalSecondedService.approval(approvalParam);
|
||||
return Result.success();
|
||||
if (approval) {
|
||||
cnd.and("t.taskState", "in", List.of(ProcessTaskStateEnum.FINISHED.getCode(), ProcessTaskStateEnum.WITHDRAW.getCode(), ProcessTaskStateEnum.INTERRUPT.getCode()));
|
||||
} else {
|
||||
cnd.and("t.taskState", "=", ProcessTaskStateEnum.DOING.getCode());
|
||||
}
|
||||
|
||||
if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
|
||||
cnd.desc("info.createdAt");
|
||||
} else {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
cnd.groupBy("t.id");
|
||||
sql.setCondition(cnd);
|
||||
Pagination<NutMap> pageVO = proposalCommonService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pageVO);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package com.budwk.app.zhgh.democratic.proposal.controller.view;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.zhgh.democratic.proposal.models.ProposalInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/proposal/view")
|
||||
@Ok("json:full")
|
||||
@Api("提案查看")
|
||||
public class ProposalViewController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At("/index")
|
||||
@SaCheckLogin
|
||||
@Ok("beetl:/platform/zhgh/democratic/proposal/view/index.html")
|
||||
public void index(){
|
||||
|
||||
}
|
||||
|
||||
@At("/info")
|
||||
@SaCheckLogin
|
||||
public Result info(String id) {
|
||||
ProposalInfo info = dao.fetch(ProposalInfo.class, id);
|
||||
return Result.success(info);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.budwk.app.zhgh.democratic.proposal.interceptor;
|
||||
|
||||
import com.budwk.app.flow.constant.FlowConst;
|
||||
import com.budwk.app.flow.engine.FlowInterceptor;
|
||||
import com.budwk.app.flow.engine.core.Execution;
|
||||
import com.budwk.app.flow.engine.core.ServiceContext;
|
||||
import com.budwk.app.flow.entity.ProcessInstance;
|
||||
import com.budwk.app.zhgh.democratic.proposal.models.ProposalInfo;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.json.Json;
|
||||
|
||||
/**
|
||||
* 提案申请拦截器
|
||||
*/
|
||||
public class ProposalApplyInterceptor implements FlowInterceptor {
|
||||
@Override
|
||||
public void intercept(Execution execution) {
|
||||
String formDataStr = execution.getArgs().getStr(FlowConst.FORM_DATA);
|
||||
ProposalInfo info = Json.fromJson(ProposalInfo.class, formDataStr);
|
||||
|
||||
Dao dao = ServiceContext.find(Dao.class);
|
||||
dao.insertOrUpdate(info);
|
||||
execution.getArgs().set(FlowConst.FORM_DATA, Json.toJson(info));
|
||||
|
||||
int instanceId = execution.getArgs().getInt(FlowConst.PROCESS_INSTANCE_ID_KEY);
|
||||
dao.update(ProcessInstance.class, Chain.make("businessNo", info.getId()), Cnd.where(ProcessInstance::getId, "=", instanceId));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user