@@ -0,0 +1,93 @@ | |||||
package cc.smtweb.system.bpm.web.design.flow; | |||||
import cc.smtweb.framework.core.common.IntEnum; | |||||
/** | |||||
* Created by Akmm at 2022/5/24 9:04 | |||||
* 工作流常量及枚举定义 | |||||
*/ | |||||
public interface FlowConst { | |||||
//流程按钮 | |||||
class Button { | |||||
public static final String DISUSE = "disuse";// 作废 | |||||
public static final String LOG = "log";// 流程历史 | |||||
public static final String WORD = "word";// 导出Word | |||||
public static final String EXCEL = "excel";// 导出Excel | |||||
public static final String HANDLER = "handler";// 办理,签收 | |||||
public static final String SUBMIT = "submit";// 提交 | |||||
public static final String RETAKE = "retake";// 取回 | |||||
public static final String REJECT = "reject";// 驳回 | |||||
public static final String ADD = "add";// 新增 | |||||
public static final String DEL = "del";// 删除 | |||||
public static final String SAVE = "save";// 保存 | |||||
} | |||||
/** | |||||
* 活动类型 1-开始任务 2-用户任务 3-条件分支 4-并行开始 5-并行结束 6-脚本任务 9-结束任务 | |||||
*/ | |||||
class ActivityType extends IntEnum { | |||||
public static ActivityType instance = new ActivityType(); | |||||
public static IntEnumBean START = instance.addEnum(1, "开始任务"); | |||||
public static IntEnumBean USER = instance.addEnum(2, "用户任务"); | |||||
public static IntEnumBean CONDITION = instance.addEnum(3, "判断分支"); | |||||
public static IntEnumBean PARALLEL = instance.addEnum(4, "并行开始"); | |||||
public static IntEnumBean GATHER = instance.addEnum(5, "并行结束"); | |||||
public static IntEnumBean AUTO = instance.addEnum(6, "脚本任务"); | |||||
public static IntEnumBean END = instance.addEnum(9, "结束任务"); | |||||
} | |||||
/** | |||||
* 流程活动状态 0-待办 1-办理中 2-已提交 3-已驳回 | |||||
*/ | |||||
class ActivityStatu extends IntEnum { | |||||
public static ActivityStatu instance = new ActivityStatu(); | |||||
public static IntEnumBean WAIT = instance.addEnum(0, "待办"); | |||||
public static IntEnumBean HANDLE = instance.addEnum(1, "办理中"); | |||||
public static IntEnumBean SUBMIT = instance.addEnum(2, "已提交"); | |||||
public static IntEnumBean DISUSE = instance.addEnum(8, "已作废"); | |||||
public static IntEnumBean REJECT = instance.addEnum(9, "已驳回"); | |||||
} | |||||
/** | |||||
* 流程实例状态 | |||||
*/ | |||||
class InstanceStatu extends IntEnum { | |||||
public static ActivityStatu instance = new ActivityStatu(); | |||||
public static IntEnumBean BEGIN = instance.addEnum(1, "制单"); | |||||
public static IntEnumBean RUNING = instance.addEnum(2, "审批中"); | |||||
public static IntEnumBean FINISH = instance.addEnum(99, "生效"); | |||||
public static IntEnumBean ABORTED = instance.addEnum(98, "中止"); | |||||
public static IntEnumBean DISUSE = instance.addEnum(89, "作废"); | |||||
} | |||||
/** | |||||
* 流程任务创建方式 | |||||
*/ | |||||
class TaskCreateType extends IntEnum { | |||||
public static TaskCreateType instance = new TaskCreateType(); | |||||
public static IntEnumBean AUTO = instance.addEnum(1, "自动"); | |||||
public static IntEnumBean RETAKE = instance.addEnum(2, "取回"); | |||||
public static IntEnumBean REJECT = instance.addEnum(3, "驳回"); | |||||
} | |||||
/** | |||||
* 候选人过滤类别 主办人过滤:制单人所属单位/制单人所属部门/上一步提交人所属单位/上一步提交人所属部门 | |||||
*/ | |||||
class CndFilterType extends IntEnum { | |||||
public static CndFilterType instance = new CndFilterType(); | |||||
public static IntEnumBean BILL_CORP = instance.addEnum(1, "单据所属单位"); | |||||
public static IntEnumBean BILL_DEPT = instance.addEnum(2, "单据所属部门"); | |||||
public static IntEnumBean MAKE_CORP = instance.addEnum(3, "制单人所属单位"); | |||||
public static IntEnumBean MAKE_DEPT = instance.addEnum(4, "制单人所属部门"); | |||||
public static IntEnumBean SUBMITTER_CORP = instance.addEnum(5, "上一步提交人所属单位"); | |||||
public static IntEnumBean SUBMITTER_DEPT = instance.addEnum(6, "上一步提交人所属部门"); | |||||
} | |||||
/** | |||||
* 主办人忽略类型:位运算,上一步提交人/过滤制单人 | |||||
*/ | |||||
class CndIgnoreType extends IntEnum { | |||||
public static CndIgnoreType instance = new CndIgnoreType(); | |||||
public static IntEnumBean MAKER = instance.addEnum(1, "制单人"); | |||||
public static IntEnumBean SUBMITTER = instance.addEnum(2, "上一步提交人"); | |||||
} | |||||
} |
@@ -0,0 +1,90 @@ | |||||
package cc.smtweb.system.bpm.web.design.flow; | |||||
import cc.smtweb.framework.core.annotation.SwTable; | |||||
import cc.smtweb.framework.core.db.impl.DefaultEntity; | |||||
import cc.smtweb.framework.core.util.JsonUtil; | |||||
import cc.smtweb.system.bpm.web.design.flow.define.ProcInfo; | |||||
import com.fasterxml.jackson.annotation.JsonIgnore; | |||||
/** | |||||
* Created by Akmm at 2022/5/21 10:40 | |||||
* 流程定义 | |||||
*/ | |||||
@SwTable("ASP_MODEL_PROC") | |||||
public class ModelProc extends DefaultEntity { | |||||
public static final String ENTITY_NAME = "ASP_MODEL_PROC"; | |||||
//流程定义详情 | |||||
@JsonIgnore | |||||
private transient ProcInfo procInfo = null; | |||||
public ModelProc() { | |||||
super(ENTITY_NAME); | |||||
} | |||||
public ProcInfo getProcInfo() { | |||||
if (procInfo == null) { | |||||
synchronized ("ModelProc_" + getId()) { | |||||
if (procInfo == null) { | |||||
procInfo = JsonUtil.parse(getContent(), ProcInfo.class); | |||||
} | |||||
} | |||||
} | |||||
return procInfo; | |||||
} | |||||
public long getId() { | |||||
return getLong("prc_id"); | |||||
} | |||||
public void setId(long prcId) { | |||||
put("prc_id", prcId); | |||||
} | |||||
public long getPrjId() { | |||||
return getLong("prc_prj_id"); | |||||
} | |||||
public void setPrjId(long prcPrjId) { | |||||
put("prc_prj_id", prcPrjId); | |||||
} | |||||
public long getMcId() { | |||||
return getLong("prc_mc_id"); | |||||
} | |||||
public void setMcId(long prcMcId) { | |||||
put("prc_mc_id", prcMcId); | |||||
} | |||||
public String getCode() { | |||||
return getStr("prc_code"); | |||||
} | |||||
public void setCode(String prcCode) { | |||||
put("prc_code", prcCode); | |||||
} | |||||
public String getName() { | |||||
return getStr("prc_name"); | |||||
} | |||||
public void setName(String prcName) { | |||||
put("prc_name", prcName); | |||||
} | |||||
public String getContent() { | |||||
return getStr("prc_content"); | |||||
} | |||||
public void setContent(String prcContent) { | |||||
put("prc_content", prcContent); | |||||
} | |||||
public String getRemark() { | |||||
return getStr("prc_remark"); | |||||
} | |||||
public void setRemark(String prcRemark) { | |||||
put("prc_remark", prcRemark); | |||||
} | |||||
} |
@@ -0,0 +1,60 @@ | |||||
package cc.smtweb.system.bpm.web.design.flow; | |||||
import cc.smtweb.framework.core.annotation.SwCache; | |||||
import cc.smtweb.framework.core.cache.AbstractCache; | |||||
import cc.smtweb.framework.core.cache.CacheManager; | |||||
import cc.smtweb.framework.core.db.DbEngine; | |||||
import cc.smtweb.framework.core.db.EntityDao; | |||||
import cc.smtweb.system.bpm.web.design.form.ModelForm; | |||||
import java.util.ArrayList; | |||||
import java.util.Comparator; | |||||
import java.util.List; | |||||
import java.util.Set; | |||||
/** | |||||
* Created by Akmm at 2022/1/12 18:34 | |||||
*/ | |||||
@SwCache(ident = "ASP_MODEL_PROC", title = "流程定义") | |||||
public class ModelProcCache extends AbstractCache<ModelProc> { | |||||
private final static String mk = "k"; | |||||
private final static String mp = "prj"; | |||||
private final static String mc = "c"; | |||||
public static ModelProcCache getInstance() { | |||||
return CacheManager.getIntance().getCache(ModelProcCache.class); | |||||
} | |||||
public ModelProcCache() { | |||||
regMap(mk, k-> k.getName().toUpperCase()); | |||||
regList(mp, k-> String.valueOf(k.getPrjId())); | |||||
regList(mc, k-> String.valueOf(k.getMcId())); | |||||
} | |||||
@Override | |||||
protected String getId(ModelProc bean) { | |||||
return String.valueOf(bean.getId()); | |||||
} | |||||
@Override | |||||
protected List<ModelProc> loadAll() { | |||||
EntityDao<ModelProc> dao = DbEngine.getInstance().findDao(ModelProc.class); | |||||
return dao.query(); | |||||
} | |||||
public final ModelProc getByName(String key) { | |||||
return getByKey(mk, key.toUpperCase()); | |||||
} | |||||
public final Set<ModelProc> getFormsByMc(long mcId) { | |||||
return getListByKey(mc, String.valueOf(mcId)); | |||||
} | |||||
public final List<ModelProc> getFormsByMc(long mcId, Comparator<ModelProc> comparator) { | |||||
Set<ModelProc> set = getListByKey(mc, String.valueOf(mcId)); | |||||
if (set == null || set.isEmpty()) return null; | |||||
List<ModelProc> list = new ArrayList<>(set); | |||||
list.sort(comparator); | |||||
return list; | |||||
} | |||||
} |
@@ -0,0 +1,132 @@ | |||||
package cc.smtweb.system.bpm.web.design.flow; | |||||
import cc.smtweb.framework.core.annotation.SwBody; | |||||
import cc.smtweb.framework.core.annotation.SwService; | |||||
import cc.smtweb.framework.core.common.R; | |||||
import cc.smtweb.framework.core.common.SwEnum; | |||||
import cc.smtweb.framework.core.common.SwMap; | |||||
import cc.smtweb.framework.core.db.DbEngine; | |||||
import cc.smtweb.framework.core.mvc.service.AbstractCompService; | |||||
import cc.smtweb.framework.core.mvc.service.DefaultDelHandler; | |||||
import cc.smtweb.framework.core.mvc.service.DefaultListHandler; | |||||
import cc.smtweb.framework.core.mvc.service.IHandler; | |||||
import cc.smtweb.framework.core.session.UserSession; | |||||
import cc.smtweb.framework.core.util.SqlUtil; | |||||
import cc.smtweb.system.bpm.web.design.form.ModelForm; | |||||
import cc.smtweb.system.bpm.web.design.form.ModelFormLoadHandler; | |||||
import cc.smtweb.system.bpm.web.design.form.ModelFormSaveHandler; | |||||
import org.apache.commons.lang3.StringUtils; | |||||
import java.sql.ResultSetMetaData; | |||||
import java.util.ArrayList; | |||||
import java.util.List; | |||||
/** | |||||
* Created by Akmm at 2022/3/22 9:12 | |||||
*/ | |||||
@SwService | |||||
public class ModelProcService extends AbstractCompService { | |||||
@Override | |||||
protected IHandler createHandler(String type) { | |||||
switch (type) { | |||||
case TYPE_LOAD: | |||||
return new ModelFormLoadHandler(); | |||||
case TYPE_SAVE: | |||||
return new ModelFormSaveHandler(); | |||||
case TYPE_DEL: | |||||
return new DefaultDelHandler<ModelForm>(ModelForm.ENTITY_NAME); | |||||
case TYPE_LIST: | |||||
return new DefaultListHandler<ModelForm>(ModelForm.ENTITY_NAME); | |||||
} | |||||
return null; | |||||
} | |||||
//保存数据集 | |||||
public R saveDataset(@SwBody SwMap params, UserSession us) { | |||||
try { | |||||
ModelFormSaveHandler handler = (ModelFormSaveHandler) getHandler(params, us, TYPE_SAVE); | |||||
return handler.saveDataset(); | |||||
} catch (Exception e) { | |||||
return R.error("操作失败!", e); | |||||
} | |||||
} | |||||
//加载数据集 | |||||
public R loadDataset(@SwBody SwMap params, UserSession us) { | |||||
try { | |||||
ModelFormLoadHandler handler = (ModelFormLoadHandler) getHandler(params, us, TYPE_LOAD); | |||||
return handler.loadDataset(); | |||||
} catch (Exception e) { | |||||
return R.error("操作失败!", e); | |||||
} | |||||
} | |||||
//保存页面模型 | |||||
public R saveModel(@SwBody SwMap params, UserSession us) { | |||||
try { | |||||
ModelFormSaveHandler handler = (ModelFormSaveHandler) getHandler(params, us, TYPE_SAVE); | |||||
return handler.saveModel(); | |||||
} catch (Exception e) { | |||||
return R.error("操作失败!", e); | |||||
} | |||||
} | |||||
//加载页面模型 | |||||
public R loadModel(@SwBody SwMap params, UserSession us) { | |||||
try { | |||||
ModelFormLoadHandler handler = (ModelFormLoadHandler) getHandler(params, us, TYPE_LOAD); | |||||
return handler.loadModel(); | |||||
} catch (Exception e) { | |||||
return R.error("操作失败!", e); | |||||
} | |||||
} | |||||
//加载引擎用页面模型 | |||||
public R model(@SwBody SwMap params, UserSession us) { | |||||
try { | |||||
ModelFormLoadHandler handler = (ModelFormLoadHandler) getHandler(params, us, TYPE_LOAD); | |||||
return handler.loadForm(); | |||||
} catch (Exception e) { | |||||
return R.error("操作失败!", e); | |||||
} | |||||
} | |||||
//获取页面使用的控件的filter信息 | |||||
public R loadWidgetFilter(@SwBody SwMap params, UserSession us) { | |||||
try { | |||||
ModelFormLoadHandler handler = (ModelFormLoadHandler) getHandler(params, us, TYPE_LOAD); | |||||
return handler.loadWidgetFilter(); | |||||
} catch (Exception e) { | |||||
return R.error("操作失败!", e); | |||||
} | |||||
} | |||||
//获取自定义sql的字段信息,去库里查 | |||||
public R loadSqlFields(@SwBody SwMap params, UserSession us) { | |||||
try { | |||||
String sql = params.readString("sql"); | |||||
if (StringUtils.isEmpty(sql)) return R.error("没有传入的sql!"); | |||||
sql = sql.trim().toLowerCase(); | |||||
if (!sql.startsWith("select ")) return R.error("非查询类sql,禁止执行!"); | |||||
if (sql.contains(";")) return R.error("sql内禁止出现分号!"); | |||||
sql = SqlUtil.replaceTable(sql); | |||||
List<SwMap> ret = DbEngine.getInstance().query(sql + " where 1=0", rs -> { | |||||
List<SwMap> fields = new ArrayList<>(); | |||||
ResultSetMetaData metaData = rs.getMetaData(); | |||||
for (int i = 1, count = metaData.getColumnCount(); i <= count; i++) { | |||||
SwMap col = new SwMap(2); | |||||
col.put("name", metaData.getColumnLabel(i)); | |||||
SwEnum.DataTypeBean dtb = SwEnum.DataType.getBySqlType(metaData.getColumnType(i), metaData.getPrecision(i), metaData.getScale(i)); | |||||
col.put("dataType", dtb.value); | |||||
fields.add(col); | |||||
} | |||||
return fields; | |||||
}); | |||||
return R.success(ret); | |||||
} catch (Exception e) { | |||||
return R.error("操作失败!", e); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,35 @@ | |||||
package cc.smtweb.system.bpm.web.design.flow.define; | |||||
import lombok.Data; | |||||
import java.util.List; | |||||
/** | |||||
* Created by Akmm at 2022/5/21 10:48 | |||||
* 步骤定义 | |||||
*/ | |||||
@Data | |||||
public class ActivityInfo { | |||||
//"id": "", | |||||
private String id; | |||||
//类别:1-开始任务 2-用户任务 3-条件分支 4-并行开始 5-并行结束 6-脚本任务 9-结束任务 | |||||
private int type; | |||||
//活动编号,代码可调用 | |||||
private String code; | |||||
//活动名称 | |||||
private String label; | |||||
//表单定义 | |||||
private String page; | |||||
//是否可编辑 | |||||
private boolean canEdit; | |||||
//是否需要会签 | |||||
private boolean needSign; | |||||
//可编辑的字段 | |||||
private List<String> eidtFields; | |||||
//不可查看的字段 | |||||
private List<String> disableFields; | |||||
//主办人相关信息 | |||||
private HandlerInfo handler; | |||||
//会签相关信息 | |||||
private SignInfo sign; | |||||
} |
@@ -0,0 +1,19 @@ | |||||
package cc.smtweb.system.bpm.web.design.flow.define; | |||||
import lombok.Data; | |||||
import java.util.List; | |||||
/** | |||||
* Created by Akmm at 2022/5/23 9:45 | |||||
* 主办人设置信息 | |||||
*/ | |||||
@Data | |||||
public class HandlerInfo { | |||||
//主办人分组 | |||||
private List<Long> userGroup; | |||||
//主办人过滤:制单人所属单位/制单人所属部门/上一步提交人所属单位/上一步提交人所属部门 | |||||
private int filter; | |||||
//主办人过滤:上一步提交人/过滤制单人 | |||||
private int ignore; | |||||
} |
@@ -0,0 +1,23 @@ | |||||
package cc.smtweb.system.bpm.web.design.flow.define; | |||||
import lombok.Data; | |||||
import java.util.List; | |||||
/** | |||||
* Created by Akmm at 2022/5/21 10:48 | |||||
* 流程定义信息 | |||||
*/ | |||||
@Data | |||||
public class ProcInfo { | |||||
//默认表单定义 | |||||
private String page; | |||||
//是否允许编辑非本人单据 | |||||
private boolean canEditOther; | |||||
//1-驳回到制单 0-逐级驳回 | |||||
private boolean rejectToMake; | |||||
//活动节点 | |||||
private List<ActivityInfo> activities; | |||||
//连接线 | |||||
private List<TransInfo> trans; | |||||
} |
@@ -0,0 +1,17 @@ | |||||
package cc.smtweb.system.bpm.web.design.flow.define; | |||||
import lombok.Data; | |||||
/** | |||||
* Created by Akmm at 2022/5/23 9:54 | |||||
* 会签信息 | |||||
*/ | |||||
@Data | |||||
public class SignInfo extends HandlerInfo{ | |||||
//最少会签人数 | |||||
private int minSign; | |||||
//最少会签同意人数 | |||||
private int minAgree; | |||||
//最少会签同意人数单位:0-人数 1-会签同意占比 | |||||
private int minAgreeUnit; | |||||
} |
@@ -0,0 +1,23 @@ | |||||
package cc.smtweb.system.bpm.web.design.flow.define; | |||||
import lombok.Data; | |||||
/** | |||||
* Created by Akmm at 2022/5/21 11:38 | |||||
* 连接线 | |||||
*/ | |||||
@Data | |||||
public class TransInfo { | |||||
//唯一标识 | |||||
private String id; | |||||
//序号 | |||||
private int seq; | |||||
//条件表达式 | |||||
private String expr; | |||||
//源活动 | |||||
private String src; | |||||
//目标活动 | |||||
private String dst; | |||||
//说明 | |||||
private String desc; | |||||
} |
@@ -23,12 +23,12 @@ import java.util.List; | |||||
* Created by Akmm at 2022/3/21 18:22 | * Created by Akmm at 2022/3/21 18:22 | ||||
*/ | */ | ||||
public class ModelCatalogTreeHandler extends AbstractTreeHandler<DefaultEntity> { | public class ModelCatalogTreeHandler extends AbstractTreeHandler<DefaultEntity> { | ||||
//查询类型:0-目录;1-表定义;2-页面;3-控件;4-页面和控件 | |||||
//查询类型:0-目录;1-表定义;2-页面;3-控件;23-页面和控件 | |||||
private final static int TYPE_CATALOG = 0; | private final static int TYPE_CATALOG = 0; | ||||
private final static int TYPE_TABLE = 1; | private final static int TYPE_TABLE = 1; | ||||
private final static int TYPE_PAGE = 2; | private final static int TYPE_PAGE = 2; | ||||
private final static int TYPE_WIDGET = 3; | private final static int TYPE_WIDGET = 3; | ||||
private final static int TYPE_FORM = 4; | |||||
private final static int TYPE_FORM = 23; | |||||
private long prj_id;//所属项目 | private long prj_id;//所属项目 | ||||
private int type;//查询类型:0-目录;1-表定义;2-页面定义 | private int type;//查询类型:0-目录;1-表定义;2-页面定义 | ||||
@@ -153,8 +153,8 @@ public class ModelCatalogTreeHandler extends AbstractTreeHandler<DefaultEntity> | |||||
node.put("type", TYPE_CATALOG); | node.put("type", TYPE_CATALOG); | ||||
} else if (bean instanceof ModelTable) { | } else if (bean instanceof ModelTable) { | ||||
node.put("type", TYPE_TABLE); | node.put("type", TYPE_TABLE); | ||||
}/* else if (bean instanceof ModelTable) { | |||||
node.put("type", TYPE_TABLE); | |||||
}*/ | |||||
} else if (bean instanceof ModelForm) { | |||||
node.put("type", ((ModelForm)bean).getType() + 2); | |||||
} | |||||
} | } | ||||
} | } |
@@ -1,4 +1,4 @@ | |||||
package cc.smtweb.system.bpm.web.engine; | |||||
package cc.smtweb.system.bpm.web.engine.dynPage; | |||||
import cc.smtweb.framework.core.common.SwException; | import cc.smtweb.framework.core.common.SwException; | ||||
import cc.smtweb.framework.core.common.SwMap; | import cc.smtweb.framework.core.common.SwMap; |
@@ -1,4 +1,4 @@ | |||||
package cc.smtweb.system.bpm.web.engine; | |||||
package cc.smtweb.system.bpm.web.engine.dynPage; | |||||
import cc.smtweb.framework.core.common.R; | import cc.smtweb.framework.core.common.R; | ||||
import cc.smtweb.framework.core.common.SwMap; | import cc.smtweb.framework.core.common.SwMap; |
@@ -1,4 +1,4 @@ | |||||
package cc.smtweb.system.bpm.web.engine; | |||||
package cc.smtweb.system.bpm.web.engine.dynPage; | |||||
import cc.smtweb.framework.core.common.R; | import cc.smtweb.framework.core.common.R; | ||||
import cc.smtweb.framework.core.common.SwException; | import cc.smtweb.framework.core.common.SwException; |
@@ -1,4 +1,4 @@ | |||||
package cc.smtweb.system.bpm.web.engine; | |||||
package cc.smtweb.system.bpm.web.engine.dynPage; | |||||
import cc.smtweb.framework.core.common.SwException; | import cc.smtweb.framework.core.common.SwException; | ||||
import cc.smtweb.framework.core.common.SwMap; | import cc.smtweb.framework.core.common.SwMap; |
@@ -1,4 +1,4 @@ | |||||
package cc.smtweb.system.bpm.web.engine; | |||||
package cc.smtweb.system.bpm.web.engine.dynPage; | |||||
import cc.smtweb.framework.core.common.R; | import cc.smtweb.framework.core.common.R; | ||||
import cc.smtweb.framework.core.common.SwException; | import cc.smtweb.framework.core.common.SwException; |
@@ -1,4 +1,4 @@ | |||||
package cc.smtweb.system.bpm.web.engine; | |||||
package cc.smtweb.system.bpm.web.engine.dynPage; | |||||
import cc.smtweb.framework.core.common.R; | import cc.smtweb.framework.core.common.R; | ||||
import cc.smtweb.framework.core.common.SwException; | import cc.smtweb.framework.core.common.SwException; |
@@ -1,4 +1,4 @@ | |||||
package cc.smtweb.system.bpm.web.engine; | |||||
package cc.smtweb.system.bpm.web.engine.dynPage; | |||||
import cc.smtweb.framework.core.common.R; | import cc.smtweb.framework.core.common.R; | ||||
import cc.smtweb.framework.core.common.SwMap; | import cc.smtweb.framework.core.common.SwMap; |
@@ -1,4 +1,4 @@ | |||||
package cc.smtweb.system.bpm.web.engine; | |||||
package cc.smtweb.system.bpm.web.engine.dynPage; | |||||
import cc.smtweb.framework.core.common.SwMap; | import cc.smtweb.framework.core.common.SwMap; | ||||
import cc.smtweb.framework.core.mvc.service.SwListData; | import cc.smtweb.framework.core.mvc.service.SwListData; |
@@ -0,0 +1,57 @@ | |||||
package cc.smtweb.system.bpm.web.engine.flow; | |||||
import cc.smtweb.framework.core.annotation.SwTable; | |||||
import cc.smtweb.framework.core.db.impl.DefaultEntity; | |||||
/** | |||||
* Created by Akmm at 2022/5/23 14:25 | |||||
* 候选信息人 | |||||
*/ | |||||
@SwTable("WF_CANDIDATE") | |||||
public class CandidateEntity extends DefaultEntity { | |||||
public static final String ENTITY_NAME = "WF_CANDIDATE"; | |||||
public CandidateEntity() { | |||||
super(ENTITY_NAME); | |||||
} | |||||
public long getId() { | |||||
return getLong("cnd_id"); | |||||
} | |||||
public void setId(long cndId) { | |||||
put("cnd_id", cndId); | |||||
} | |||||
public long getPriId() { | |||||
return getLong("cnd_pri_id"); | |||||
} | |||||
public void setPriId(long cndPriId) { | |||||
put("cnd_pri_id", cndPriId); | |||||
} | |||||
public long getTskId() { | |||||
return getLong("cnd_tsk_id"); | |||||
} | |||||
public void setTskId(long cndTskId) { | |||||
put("cnd_tsk_id", cndTskId); | |||||
} | |||||
public long getUserId() { | |||||
return getLong("cnd_user_id"); | |||||
} | |||||
public void setUserId(long cndUserId) { | |||||
put("cnd_user_id", cndUserId); | |||||
} | |||||
public int getIsSign() { | |||||
return getInt("cnd_is_sign"); | |||||
} | |||||
public void setIsSign(int cndIsSign) { | |||||
put("cnd_is_sign", cndIsSign); | |||||
} | |||||
} |
@@ -0,0 +1,49 @@ | |||||
package cc.smtweb.system.bpm.web.engine.flow; | |||||
import cc.smtweb.framework.core.annotation.SwTable; | |||||
import cc.smtweb.framework.core.db.impl.DefaultEntity; | |||||
/** | |||||
* Created by Akmm at 2022/5/23 14:25 | |||||
* 候选信息人 | |||||
*/ | |||||
@SwTable("WF_CARE") | |||||
public class CareEntity extends DefaultEntity { | |||||
public static final String ENTITY_NAME = "WF_CARE"; | |||||
public CareEntity() { | |||||
super(ENTITY_NAME); | |||||
} | |||||
public long getId() { | |||||
return getLong("cr_id"); | |||||
} | |||||
public void setId(long crId) { | |||||
put("cr_id", crId); | |||||
} | |||||
public long getPriId() { | |||||
return getLong("cr_pri_id"); | |||||
} | |||||
public void setPriId(long crPriId) { | |||||
put("cr_pri_id", crPriId); | |||||
} | |||||
public long getUserId() { | |||||
return getLong("cr_user_id"); | |||||
} | |||||
public void setUserId(long crUserId) { | |||||
put("cr_user_id", crUserId); | |||||
} | |||||
public long getTime() { | |||||
return getLong("cr_time"); | |||||
} | |||||
public void setTime(long crTime) { | |||||
put("cr_time", crTime); | |||||
} | |||||
} |
@@ -0,0 +1,65 @@ | |||||
package cc.smtweb.system.bpm.web.engine.flow; | |||||
import cc.smtweb.framework.core.annotation.SwTable; | |||||
import cc.smtweb.framework.core.db.impl.DefaultEntity; | |||||
/** | |||||
* Created by Akmm at 2022/5/23 14:25 | |||||
* 审批意见 | |||||
*/ | |||||
@SwTable("WF_COMMENT") | |||||
public class CommentEntity extends DefaultEntity { | |||||
public static final String ENTITY_NAME = "WF_COMMENT"; | |||||
public CommentEntity() { | |||||
super(ENTITY_NAME); | |||||
} | |||||
public long getId() { | |||||
return getLong("cmt_id"); | |||||
} | |||||
public void setId(long cmtId) { | |||||
put("cmt_id", cmtId); | |||||
} | |||||
public long getPriId() { | |||||
return getLong("cmt_pri_id"); | |||||
} | |||||
public void setPriId(long cmtPriId) { | |||||
put("cmt_pri_id", cmtPriId); | |||||
} | |||||
public long getTskId() { | |||||
return getLong("cmt_tsk_id"); | |||||
} | |||||
public void setTskId(long cmtTskId) { | |||||
put("cmt_tsk_id", cmtTskId); | |||||
} | |||||
public long getUserId() { | |||||
return getLong("cmt_user_id"); | |||||
} | |||||
public void setUserId(long cmtUserId) { | |||||
put("cmt_user_id", cmtUserId); | |||||
} | |||||
public String getContent() { | |||||
return getStr("cmt_content"); | |||||
} | |||||
public void setContent(String cmtContent) { | |||||
put("cmt_content", cmtContent); | |||||
} | |||||
public long getTime() { | |||||
return getLong("cmt_time"); | |||||
} | |||||
public void setTime(long cmtTime) { | |||||
put("cmt_time", cmtTime); | |||||
} | |||||
} |
@@ -0,0 +1,61 @@ | |||||
package cc.smtweb.system.bpm.web.engine.flow; | |||||
import cc.smtweb.system.bpm.web.design.flow.ModelProc; | |||||
import java.util.*; | |||||
/** | |||||
* Created by Akmm at 2020/3/4 11:35 | |||||
* 单据流程实例组件 | |||||
*/ | |||||
public class FlowInstance { | |||||
//流程定义 | |||||
public ModelProc proc_def; | |||||
//流程实例 | |||||
public ProcinstEntity proc_inst; | |||||
//活动任务 | |||||
public TaskEntity act_inst; | |||||
//操作类型 新增/编辑/查看 | |||||
public int opt_mode = 0;//CmEnum.OperatorType.VIEW; | |||||
//流程执行变量 | |||||
// public Map<String, String> variables = new HashMap<>(); | |||||
public List<Map<String, String>> tasks = new ArrayList<>(); | |||||
public FlowInstance() { | |||||
// this.context = context; | |||||
} | |||||
//能否编辑 | |||||
public boolean canEdit() { | |||||
// return opt_mode == CmEnum.OperatorType.NEW || proc_inst.getstatu() == FlowConsts.InstanceStatu.BEGIN.value; | |||||
return false; | |||||
} | |||||
public boolean notMakeCanEdit() { | |||||
/*Map<String, String> mapPermisson = MenuHelper.getPermission(context); | |||||
boolean othCanEdit = BillFlowWfHelper.getPropBool(proc_def.getEntityId(), FlowConsts.NULL_STR, FlowConsts.ProcProperty.CAN_EDIT_OTHER); | |||||
ActivityEntity act = ActivityEntityBuffer.getInstance().get(act_inst.getActId()); | |||||
return act != null && !act_inst.isMake() && act.getActEdit() && othCanEdit && MenuHelper.hasPermisson(mapPermisson, CmEnum.MenuFuncRight.UPD.value);*/ | |||||
return false; | |||||
} | |||||
public boolean isHandleMake() { | |||||
// ActivityEntity act = ActivityEntityBuffer.getInstance().get(act_inst.getActId()); | |||||
// return !act_inst.isMake() && isHandleMakeEx(act); | |||||
return false; | |||||
} | |||||
private boolean isHandleMakeEx(TaskEntity act) { | |||||
// if (EntityUtil.isNull(act)) return false; | |||||
// return BillFlowWfHelper.getPropInt(proc_inst.getProcDefId(), act.getActId(), FlowConsts.ProcProperty.HANDLER_RANGE) == CmEnum.HandlerRange.MAKE.value; | |||||
return false; | |||||
} | |||||
} |
@@ -0,0 +1,129 @@ | |||||
package cc.smtweb.system.bpm.web.engine.flow; | |||||
import cc.smtweb.framework.core.annotation.SwTable; | |||||
import cc.smtweb.framework.core.db.impl.DefaultEntity; | |||||
/** | |||||
* Created by Akmm at 2022/5/23 14:25 | |||||
* 流程实例 | |||||
*/ | |||||
@SwTable("WF_PROCINST") | |||||
public class ProcinstEntity extends DefaultEntity { | |||||
public static final String ENTITY_NAME = "WF_PROCINST"; | |||||
public ProcinstEntity() { | |||||
super(ENTITY_NAME); | |||||
} | |||||
public long getId() { | |||||
return getLong("pri_id"); | |||||
} | |||||
public void setId(long priId) { | |||||
put("pri_id", priId); | |||||
} | |||||
public String getBillCode() { | |||||
return getStr("pri_bill_code"); | |||||
} | |||||
public void setBillCode(String priBillCode) { | |||||
put("pri_bill_code", priBillCode); | |||||
} | |||||
public long getMakeDate() { | |||||
return getLong("pri_make_date"); | |||||
} | |||||
public void setMakeDate(long priMakeDate) { | |||||
put("pri_make_date", priMakeDate); | |||||
} | |||||
public int getBillType() { | |||||
return getInt("pri_bill_type"); | |||||
} | |||||
public void setBillType(int priBillType) { | |||||
put("pri_bill_type", priBillType); | |||||
} | |||||
public long getPartyId() { | |||||
return getLong("pri_party_id"); | |||||
} | |||||
public void setPartyId(long priPartyId) { | |||||
put("pri_party_id", priPartyId); | |||||
} | |||||
public long getDeptId() { | |||||
return getLong("pri_dept_id"); | |||||
} | |||||
public void setDeptId(long priDeptId) { | |||||
put("pri_dept_id", priDeptId); | |||||
} | |||||
public String getBillDesc() { | |||||
return getStr("pri_bill_desc"); | |||||
} | |||||
public void setBillDesc(String priBillDesc) { | |||||
put("pri_bill_desc", priBillDesc); | |||||
} | |||||
public long getPrcId() { | |||||
return getLong("pri_prc_id"); | |||||
} | |||||
public void setPrcId(long priPrcId) { | |||||
put("pri_prc_id", priPrcId); | |||||
} | |||||
public long getStartTime() { | |||||
return getLong("pri_start_time"); | |||||
} | |||||
public void setStartTime(long priStartTime) { | |||||
put("pri_start_time", priStartTime); | |||||
} | |||||
public long getEndTime() { | |||||
return getLong("pri_end_time"); | |||||
} | |||||
public void setEndTime(long priEndTime) { | |||||
put("pri_end_time", priEndTime); | |||||
} | |||||
public long getUserId() { | |||||
return getLong("pri_user_id"); | |||||
} | |||||
public void setUserId(long priUserId) { | |||||
put("pri_user_id", priUserId); | |||||
} | |||||
public long getTaskId() { | |||||
return getLong("pri_task_id"); | |||||
} | |||||
public void setTaskId(long priTaskId) { | |||||
put("pri_task_id", priTaskId); | |||||
} | |||||
public int getStatu() { | |||||
return getInt("pri_statu"); | |||||
} | |||||
public void setStatu(int priStatu) { | |||||
put("pri_statu", priStatu); | |||||
} | |||||
public String getBillInfo() { | |||||
return getStr("pri_bill_info"); | |||||
} | |||||
public void setBillInfo(String priBillInfo) { | |||||
put("pri_bill_info", priBillInfo); | |||||
} | |||||
} |
@@ -0,0 +1,74 @@ | |||||
package cc.smtweb.system.bpm.web.engine.flow; | |||||
import cc.smtweb.framework.core.annotation.SwTable; | |||||
import cc.smtweb.framework.core.db.impl.DefaultEntity; | |||||
/** | |||||
* Created by Akmm at 2022/5/23 14:25 | |||||
* 会签信息 | |||||
*/ | |||||
@SwTable("WF_SIGN") | |||||
public class SignEntity extends DefaultEntity { | |||||
public static final String ENTITY_NAME = "WF_SIGN"; | |||||
public SignEntity() { | |||||
super(ENTITY_NAME); | |||||
} | |||||
public long getId() { | |||||
return getLong("sgn_id"); | |||||
} | |||||
public void setId(long sgnId) { | |||||
put("sgn_id", sgnId); | |||||
} | |||||
public long getPriId() { | |||||
return getLong("sgn_pri_id"); | |||||
} | |||||
public void setPriId(long sgnPriId) { | |||||
put("sgn_pri_id", sgnPriId); | |||||
} | |||||
public long getTskId() { | |||||
return getLong("sgn_tsk_id"); | |||||
} | |||||
public void setTskId(long sgnTskId) { | |||||
put("sgn_tsk_id", sgnTskId); | |||||
} | |||||
public long getUserId() { | |||||
return getLong("sgn_user_id"); | |||||
} | |||||
public void setUserId(long sgnUserId) { | |||||
put("sgn_user_id", sgnUserId); | |||||
} | |||||
public int getAgree() { | |||||
return getInt("sgn_agree"); | |||||
} | |||||
public void setAgree(int sgnAgree) { | |||||
put("sgn_agree", sgnAgree); | |||||
} | |||||
public String getContent() { | |||||
return getStr("sgn_content"); | |||||
} | |||||
public void setContent(String sgnContent) { | |||||
put("sgn_content", sgnContent); | |||||
} | |||||
public long getTime() { | |||||
return getLong("sgn_time"); | |||||
} | |||||
public void setTime(long sgnTime) { | |||||
put("sgn_time", sgnTime); | |||||
} | |||||
} |
@@ -0,0 +1,161 @@ | |||||
package cc.smtweb.system.bpm.web.engine.flow; | |||||
import cc.smtweb.framework.core.annotation.SwTable; | |||||
import cc.smtweb.framework.core.db.impl.DefaultEntity; | |||||
/** | |||||
* Created by Akmm at 2022/5/23 14:25 | |||||
* 活动实例 | |||||
*/ | |||||
@SwTable("WF_TASK") | |||||
public class TaskEntity extends DefaultEntity { | |||||
public static final String ENTITY_NAME = "WF_TASK"; | |||||
public TaskEntity() { | |||||
super(ENTITY_NAME); | |||||
} | |||||
public long getId() { | |||||
return getLong("tsk_id"); | |||||
} | |||||
public void setId(long tskId) { | |||||
put("tsk_id", tskId); | |||||
} | |||||
public long getPriId() { | |||||
return getLong("tsk_pri_id"); | |||||
} | |||||
public void setPriId(long tskPriId) { | |||||
put("tsk_pri_id", tskPriId); | |||||
} | |||||
public long getPrcId() { | |||||
return getLong("tsk_prc_id"); | |||||
} | |||||
public void setPrcId(long tskPrcId) { | |||||
put("tsk_prc_id", tskPrcId); | |||||
} | |||||
public String getActId() { | |||||
return getStr("tsk_act_id"); | |||||
} | |||||
public void setActId(String tskActId) { | |||||
put("tsk_act_id", tskActId); | |||||
} | |||||
public String getActName() { | |||||
return getStr("tsk_act_name"); | |||||
} | |||||
public void setActName(String tskActName) { | |||||
put("tsk_act_name", tskActName); | |||||
} | |||||
public long getHandler() { | |||||
return getLong("tsk_handler"); | |||||
} | |||||
public void setHandler(long tskHandler) { | |||||
put("tsk_handler", tskHandler); | |||||
} | |||||
public long getStartTime() { | |||||
return getLong("tsk_start_time"); | |||||
} | |||||
public void setStartTime(long tskStartTime) { | |||||
put("tsk_start_time", tskStartTime); | |||||
} | |||||
public long getEndTime() { | |||||
return getLong("tsk_end_time"); | |||||
} | |||||
public void setEndTime(long tskEndTime) { | |||||
put("tsk_end_time", tskEndTime); | |||||
} | |||||
public int getStatu() { | |||||
return getInt("tsk_statu"); | |||||
} | |||||
public void setStatu(int tskStatu) { | |||||
put("tsk_statu", tskStatu); | |||||
} | |||||
public String getSubmitIdea() { | |||||
return getStr("tsk_submit_idea"); | |||||
} | |||||
public void setSubmitIdea(String tskSubmitIdea) { | |||||
put("tsk_submit_idea", tskSubmitIdea); | |||||
} | |||||
public boolean isMake() { | |||||
return getBool("tsk_is_make"); | |||||
} | |||||
public void setMake(boolean tskIsMake) { | |||||
setBool("tsk_is_make", tskIsMake); | |||||
} | |||||
public boolean isSign() { | |||||
return getBool("tsk_is_sign"); | |||||
} | |||||
public void setSign(boolean tskIsSign) { | |||||
setBool("tsk_is_sign", tskIsSign); | |||||
} | |||||
public String getSignTotal() { | |||||
return getStr("tsk_sign_total"); | |||||
} | |||||
public void setSignTotal(String tskSignTotal) { | |||||
put("tsk_sign_total", tskSignTotal); | |||||
} | |||||
public int getSignPass() { | |||||
return getInt("tsk_sign_pass"); | |||||
} | |||||
public void setSignPass(int tskSignPass) { | |||||
put("tsk_sign_pass", tskSignPass); | |||||
} | |||||
public int getSignAgree() { | |||||
return getInt("tsk_sign_agree"); | |||||
} | |||||
public void setSignAgree(int tskSignAgree) { | |||||
put("tsk_sign_agree", tskSignAgree); | |||||
} | |||||
public boolean getIsReject() { | |||||
return getBool("tsk_is_reject"); | |||||
} | |||||
public void setReject(boolean tskIsReject) { | |||||
setBool("tsk_is_reject", tskIsReject); | |||||
} | |||||
public boolean isRetake() { | |||||
return getBool("tsk_is_retake"); | |||||
} | |||||
public void setIsRetake(boolean tskIsRetake) { | |||||
setBool("tsk_is_retake", tskIsRetake); | |||||
} | |||||
public boolean isAuto() { | |||||
return getBool("tsk_is_auto"); | |||||
} | |||||
public void setIsAuto(boolean tskIsAuto) { | |||||
setBool("tsk_is_auto", tskIsAuto); | |||||
} | |||||
} |
@@ -0,0 +1,49 @@ | |||||
package cc.smtweb.system.bpm.web.engine.flow; | |||||
import cc.smtweb.framework.core.annotation.SwTable; | |||||
import cc.smtweb.framework.core.db.impl.DefaultEntity; | |||||
/** | |||||
* Created by Akmm at 2022/5/23 14:25 | |||||
* 活动之间的关系 | |||||
*/ | |||||
@SwTable("WF_CARE") | |||||
public class TaskRelEntity extends DefaultEntity { | |||||
public static final String ENTITY_NAME = "WF_CARE"; | |||||
public TaskRelEntity() { | |||||
super(ENTITY_NAME); | |||||
} | |||||
public long getId() { | |||||
return getLong("trl_id"); | |||||
} | |||||
public void setId(long trlId) { | |||||
put("trl_id", trlId); | |||||
} | |||||
public long getPriId() { | |||||
return getLong("trl_pri_id"); | |||||
} | |||||
public void setPriId(long trlPriId) { | |||||
put("trl_pri_id", trlPriId); | |||||
} | |||||
public long getSrcTaskId() { | |||||
return getLong("trl_src_task_id"); | |||||
} | |||||
public void setSrcTaskId(long trlSrcTaskId) { | |||||
put("trl_src_task_id", trlSrcTaskId); | |||||
} | |||||
public long getDstTaskId() { | |||||
return getLong("trl_dst_task_id"); | |||||
} | |||||
public void setDstTaskId(long trlDstTaskId) { | |||||
put("trl_dst_task_id", trlDstTaskId); | |||||
} | |||||
} |
@@ -1,26 +0,0 @@ | |||||
package cc.smtweb.system.bpm.web.flow; | |||||
import cc.smtweb.framework.core.common.R; | |||||
import cc.smtweb.framework.core.annotation.SwParam; | |||||
import cc.smtweb.framework.core.annotation.SwService; | |||||
import cc.smtweb.framework.core.db.DbEngine; | |||||
import cc.smtweb.framework.core.session.UserSession; | |||||
import cc.smtweb.system.bpm.engine.entity.AspModelPO; | |||||
import java.util.List; | |||||
// @Api(tags = "工作流流程接口") | |||||
@SwService | |||||
public class BpmFlowListService { | |||||
@SwParam | |||||
private DbEngine dbEngine; | |||||
// @ApiOperation(value = "读取流程列表") | |||||
public R list(UserSession us) { | |||||
String sql = "select model_id, model_mc_id, model_site_id, model_name, model_status, model_content, model_type, model_version, model_create_uid, model_update_uid, model_create_time, model_last_time from sw_bpm.asp_model" + | |||||
" where model_type=? order by model_id"; | |||||
List<AspModelPO> list = dbEngine.query(sql, AspModelPO.class, 2); | |||||
return R.success(list); | |||||
} | |||||
} |
@@ -11,19 +11,10 @@ import org.junit.Test; | |||||
public class BuildJavaBean { | public class BuildJavaBean { | ||||
@Test | @Test | ||||
public void buildBean() { | public void buildBean() { | ||||
String str = "`mf_id` bigint(20) NOT NULL,\n" + | |||||
" `mf_prj_id` bigint(20) NOT NULL DEFAULT '-1',\n" + | |||||
" `mf_mc_id` bigint(20) DEFAULT NULL COMMENT '-1',\n" + | |||||
" `mf_name` varchar(32) COLLATE utf8_unicode_ci DEFAULT '名称',\n" + | |||||
" `mf_title` varchar(200) COLLATE utf8_unicode_ci NOT NULL COMMENT '标题',\n" + | |||||
" `mf_type` int(4) DEFAULT '0',\n" + | |||||
" `mf_service` varchar(100) COLLATE utf8_unicode_ci NOT NULL COMMENT '服务名',\n" + | |||||
" `mf_content` text COLLATE utf8_unicode_ci COMMENT '详细信息',\n" + | |||||
" `mf_create_uid` bigint(20) DEFAULT NULL,\n" + | |||||
" `mf_update_uid` bigint(20) DEFAULT NULL,\n" + | |||||
" `mf_create_at` bigint(20) NOT NULL DEFAULT '0',\n" + | |||||
" `mf_update_at` bigint(20) NOT NULL DEFAULT '0',\n" + | |||||
" `mf_remark` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT '备注',\n"; | |||||
String str = "`trl_id` bigint(20) NOT NULL COMMENT 'null',\n" + | |||||
" `trl_pri_id` bigint(20) DEFAULT NULL COMMENT 'null',\n" + | |||||
" `trl_src_task_id` bigint(20) DEFAULT NULL COMMENT 'null',\n" + | |||||
" `trl_dst_task_id` bigint(20) DEFAULT NULL COMMENT 'null',\n"; | |||||
String[] ss = str.split("\n"); | String[] ss = str.split("\n"); | ||||
for (String s: ss) { | for (String s: ss) { | ||||
String[] s0 = s.trim().split(" "); | String[] s0 = s.trim().split(" "); | ||||
@@ -41,6 +32,7 @@ public class BuildJavaBean { | |||||
ttj = "Long"; | ttj = "Long"; | ||||
break; | break; | ||||
case "tinyint": | case "tinyint": | ||||
case "smallint": | |||||
case "int": | case "int": | ||||
tt = "int"; | tt = "int"; | ||||
ttj = "Int"; | ttj = "Int"; | ||||
@@ -3,7 +3,7 @@ package cc.smtweb.system.bpm.test; | |||||
import cc.smtweb.framework.core.common.R; | import cc.smtweb.framework.core.common.R; | ||||
import cc.smtweb.framework.core.common.SwMap; | import cc.smtweb.framework.core.common.SwMap; | ||||
import cc.smtweb.system.bpm.spring.BpmApplication; | import cc.smtweb.system.bpm.spring.BpmApplication; | ||||
import cc.smtweb.system.bpm.web.engine.DynPageService; | |||||
import cc.smtweb.system.bpm.web.engine.dynPage.DynPageService; | |||||
import org.junit.Test; | import org.junit.Test; | ||||
import org.junit.runner.RunWith; | import org.junit.runner.RunWith; | ||||
import org.springframework.boot.test.context.SpringBootTest; | import org.springframework.boot.test.context.SpringBootTest; | ||||