Bläddra i källkod

流程引擎

4.0
郑根木 2 år sedan
förälder
incheckning
69d8e41b59
17 ändrade filer med 372 tillägg och 115 borttagningar
  1. +1
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/flow/ModelProcHelper.java
  2. +1
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageHelper.java
  3. +1
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageListHandler.java
  4. +4
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynRetBean.java
  5. +4
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowHelper.java
  6. +46
    -41
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowInstance.java
  7. +7
    -8
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowListener.java
  8. +6
    -9
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowProvider.java
  9. +11
    -2
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/Comment.java
  10. +100
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/FlowLog.java
  11. +69
    -45
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/ProcInst.java
  12. +69
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleLoadHandler.java
  13. +12
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleSaveHandler.java
  14. +27
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleService.java
  15. +12
    -6
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleLoadHandler.java
  16. +1
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/base/billFlow/BillFlowCache.java
  17. +1
    -0
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/common/SwConsts.java

+ 1
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/flow/ModelProcHelper.java Visa fil

@@ -34,7 +34,7 @@ public class ModelProcHelper {
* @param user_id
* @return
*/
public static ModelProc getBillProc(int bill_type, long user_id) {
public static ModelProc getBillProc(long bill_type, long user_id) {
Set<BillFlow> list = BillFlowCache.getInstance().getByBillType(bill_type);
if (CommUtil.isEmpty(list)) {


+ 1
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageHelper.java Visa fil

@@ -37,7 +37,7 @@ public class DynPageHelper {
* @return
*/
public static SwMap createBean(PageDataset dataSet) {
if (dataSet.masterTable <= 0) {
if (dataSet.masterTable <= 0L) {
return new SwMap();
}
//主表


+ 1
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageListHandler.java Visa fil

@@ -57,7 +57,7 @@ public class DynPageListHandler extends AbstractListHandler {
} else {
list = DbEngine.getInstance().queryN(sql, sp.mapParas, SwMap.class);
}
if(pageDataSet.masterTable != 0 && pageDataSet.masterTable != -1){
if(pageDataSet.masterTable > 0L){
ModelTable masterTable = ModelTableCache.getInstance().get(pageDataSet.masterTable);
EntityHelper.loadBeanText(masterTable.getName(), list, sp.mapFieldAlias);
}


+ 4
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynRetBean.java Visa fil

@@ -1,6 +1,7 @@
package cc.smtweb.system.bpm.web.engine.dynPage;

import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
import cc.smtweb.framework.core.mvc.service.SwListData;
import lombok.Data;

@@ -15,6 +16,9 @@ public class DynRetBean {
//列表返回
private SwListData list = null;

public static DynRetBean createBean(DefaultEntity bean) {
return createBean(bean.getData());
}
public static DynRetBean createBean(SwMap swMap) {
SwMap form = (SwMap) swMap.clone();
DynRetBean bean = new DynRetBean();


+ 4
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowHelper.java Visa fil

@@ -22,6 +22,10 @@ import java.util.List;
* 单据
*/
public class FlowHelper {
//页面定义中流程数据集名
public final static String DATASET_NAME_FLOW = "flow";
//页面定义中流程审批数据集名
public final static String DATASET_NAME_COMMENT = "comment";

//获取页面单据类型
public static long getBillType(String pageId) {


+ 46
- 41
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowInstance.java Visa fil

@@ -14,6 +14,9 @@ import cc.smtweb.system.bpm.web.design.flow.FlowConst;
import cc.smtweb.system.bpm.web.design.flow.ModelProc;
import cc.smtweb.system.bpm.web.design.flow.ModelProcHelper;
import cc.smtweb.system.bpm.web.design.flow.define.Activity;
import cc.smtweb.system.bpm.web.design.flow.define.ProcInfo;
import cc.smtweb.system.bpm.web.design.form.ModelForm;
import cc.smtweb.system.bpm.web.design.form.ModelFormHelper;
import cc.smtweb.system.bpm.web.engine.flow.entity.*;
import cc.smtweb.system.bpm.web.sys.user.dept.Dept;
import cc.smtweb.system.bpm.web.sys.user.dept.DeptCache;
@@ -53,6 +56,7 @@ public class FlowInstance {
private List<Map<String, String>> tasks = new ArrayList<>();
//数据提供者
private FlowProvider provider = new FlowProvider();
private FlowListener listener;

public FlowInstance(@NonNull FlowListener listener, UserSession us) {
@@ -90,7 +94,7 @@ public class FlowInstance {
* @param bill_type
* @throws Exception
*/
public void create(int bill_type) {
public void create(long bill_type) {
Party loginParty = PartyCache.getInstance().get(us.getPartyId());
if (EntityHelper.isEmpty(loginParty)) {
throw new BizException("当前登录人员管理单位信息为空,请检查后保存!");
@@ -165,7 +169,7 @@ public class FlowInstance {
getTaskDao().updateEntity(actInst);
getProcInstDao().updateEntity(procInst);

buildBillLog(FlowConst.Button.HANDLE.value, actInst, null);
buildBillLog(FlowConst.Button.HANDLE.value, "-", actInst, null);
listener.handle(actInst);
}

@@ -191,6 +195,11 @@ public class FlowInstance {
}
}

//加载审批意见
public List<Comment> loadComment() {
return provider.findComment(procInst.getId());
}

/**
* 当前任务处于待办时:
* 上一步办理人进来,看上一个步骤,否则看当前步骤
@@ -204,7 +213,7 @@ public class FlowInstance {
if (EntityHelper.isEmpty(curTask) || curTask.getStatu() != FlowConst.ActivityStatu.WAIT.value) return task_id;
List<Task> preActs = provider.findBeforeTasks(task_id);
if (CommUtil.isEmpty(preActs)) return task_id;
for (Task act: preActs) {
for (Task act : preActs) {
if (act.getHandler() == us.getUserId()) {
return act.getId();
}
@@ -285,7 +294,7 @@ public class FlowInstance {
public void setBillInfo(String bill_code, String bill_info, String bill_url) {
procInst.setBillInfo(bill_info);
procInst.setBillCode(bill_code);
// procInst.setBillUrl(bill_url); todo
procInst.setUrl(bill_url);
}

//启动流程
@@ -293,7 +302,7 @@ public class FlowInstance {
if (opt_mode == FlowConst.OperatorType.NEW) {
getProcInstDao().insertEntity(procInst);
getTaskDao().insertEntity(actInst);
buildBillLog(FlowConst.Button.ADD.value, null, null);
buildBillLog(FlowConst.Button.ADD.value, "-", null, null);
opt_mode = FlowConst.OperatorType.EDIT;
} else {
getProcInstDao().updateEntity(procInst);
@@ -454,7 +463,7 @@ public class FlowInstance {
}
}

public void submitToEnd() {
/*public void submitToEnd() {
long user_id = us.getUserId();
//校验权限,当前人员有权限干不,没权限直接抛异常
checkPermission();
@@ -508,9 +517,9 @@ public class FlowInstance {
getTaskDao().updateEntity(actInst);
getProcInstDao().updateEntity(procInst);

buildBillLog(FlowConst.Button.SUBMIT.value, actInst, listInsertTask);
buildBillLog(FlowConst.Button.SUBMIT.value, "TODO", actInst, listInsertTask);
listener.submit(actInst, listInsertTask);
}
}*/


/**
@@ -569,7 +578,7 @@ public class FlowInstance {
getTaskDao().updateEntity(actInst);
getProcInstDao().updateEntity(procInst);

buildBillLog(FlowConst.Button.SUBMIT.value, actInst, listInsertTask);
buildBillLog(FlowConst.Button.SUBMIT.value, "TODO", actInst, listInsertTask);
listener.submit(actInst, listInsertTask);
}

@@ -613,7 +622,7 @@ public class FlowInstance {
getTaskDao().updateEntity(actInst);
getProcInstDao().updateEntity(procInst);

buildBillLog(FlowConst.Button.DISUSE.value, actInst, null);
buildBillLog(FlowConst.Button.DISUSE.value, "TODO", actInst, null);
listener.disuse(actInst);
}

@@ -706,7 +715,7 @@ public class FlowInstance {
}

procInst.setTaskId(actInst.getEntityId());
procInst.setStatu(actInst.isMake() ? FlowConst.InstanceStatu.BEGIN.value : FlowConst.InstanceStatu.RUNING.value);
procInst.setStatu(actInst.isMake() ? FlowConst.InstanceStatu.BEGIN.value: FlowConst.InstanceStatu.RUNING.value);

taskDao.updateEntity(actInst);
taskDao.deleteEntity(old_act);
@@ -714,7 +723,7 @@ public class FlowInstance {
getProcInstDao().updateEntity(procInst);
new_acts.clear();
new_acts.add(old_act);
buildBillLog(FlowConst.Button.RETAKE.value, actInst, new_acts);
buildBillLog(FlowConst.Button.RETAKE.value, "TODO", actInst, new_acts);
listener.retake(actInst, new_acts);
// comp.transCallback(FlowConst.Button.RETAKE.value, actInst, new_acts);
} else {
@@ -740,7 +749,7 @@ public class FlowInstance {
getTaskRelDao().deleteEntity("where trl_src_task_id=?", actInst.getEntityId());
getProcInstDao().updateEntity(procInst);

buildBillLog(FlowConst.Button.RETAKE.value, actInst, new_acts);
buildBillLog(FlowConst.Button.RETAKE.value, "TODO", actInst, new_acts);
listener.retake(actInst, new_acts);
}
}
@@ -789,7 +798,7 @@ public class FlowInstance {
getTaskRelDao().deleteEntity("where trl_src_task_id in (" + sqlIn.substring(1) + ")");
getProcInstDao().updateEntity(procInst);

buildBillLog(FlowConst.Button.REJECT.value, actInst, new_acts);
buildBillLog(FlowConst.Button.REJECT.value, "TODO", actInst, new_acts);
listener.reject(actInst, new_acts);
// comp.transCallback(FlowConst.FlowOptType.REJECT.value, actInst, new_acts);
}
@@ -833,55 +842,51 @@ public class FlowInstance {
List<Task> make_acts = new ArrayList<>();
make_acts.add(make_act);

buildBillLog(FlowConst.Button.REJECT.value, actInst, make_acts);
buildBillLog(FlowConst.Button.REJECT.value, "TODO", actInst, make_acts);
listener.reject(actInst, make_acts);
}

/**
* 状态变更,构建日志
*/
protected void buildBillLog(final String flow_opt, Task srcTask, List<Task> dstTasks) {
/*LogEntity logEntity = new LogEntity();
logEntity.setSuggestion(context.getDfpRequest().getParams().getStrIgnoreNull("suggestion"));
logEntity.setFlowOpt(flow_opt);
protected void buildBillLog(final String flow_opt, String comment, Task srcTask, List<Task> dstTasks) {
ProcInfo procInfo = procDef.getProcInfo();

logEntity.setBillId(proc_inst.getBillId());
logEntity.setOptTime(UtilPub.getLastTime());
FlowLog flowLog = new FlowLog();
flowLog.setComment(comment);
flowLog.setOpt(flow_opt);

UserBaseEntity user = UtilLogin.getLoginUser(context.getLoginInfo());
logEntity.setUserId(user.getEntityId());
logEntity.setUserName(user.getName());
logEntity.setLogId(PKGenerator.newId());
logEntity.setSignPicture(UserBaseEntityBuffer.getInstance().getUserCardEntity(user.getUserId()).getSignPicture());
flowLog.setPriId(procInst.getId());
flowLog.setTime(DateUtil.nowDateTimeLong());
flowLog.setUsrId(us.getUserId());
flowLog.setId(DbEngine.getInstance().nextId());

String src = null, dst = null;
String step_name = null;
StringBuilder sbDst = null;
if (srcTask != null) {
src = ActivityEntityBuffer.getInstance().getNameById(srcTask.getActId());
step_name = ActivityEntityBuffer.getInstance().getStepName(srcTask.getActId());
src = procInfo.getActNameById(srcTask.getActId());
flowLog.setActName(src);
flowLog.setActId(srcTask.getId());
}
if (UtilPub.isNotEmpty(dstTasks)) {
if (!CommUtil.isEmpty(dstTasks)) {
sbDst = new StringBuilder();
for (Task a : dstTasks) {
sbDst.append("/").append(ActivityEntityBuffer.getInstance().getNameById(a.getActId()));
sbDst.append("/").append(procInfo.getActNameById(a.getActId()));
}
dst = sbDst.substring(1);
}
if (flow_opt == FlowConst.FlowOptType.RETAKE.value) {
logEntity.setInfo(dst + "->" + src);
logEntity.setStepName(step_name);
if (FlowConst.Button.RETAKE.value.equals(flow_opt)) {
flowLog.setInfo(dst + "->" + src);
} else if (dst != null) {
logEntity.setInfo(src + "->" + dst);
logEntity.setStepName(step_name);
flowLog.setInfo(src + "->" + dst);
} else if (src != null) {
logEntity.setInfo(src);
logEntity.setStepName(step_name);
flowLog.setInfo(src);
} else {
logEntity.setInfo("-");
flowLog.setInfo("-");
}
new LogDao().insert(logEntity);
*/
DbEngine.getInstance().findDao(FlowLog.class).insertEntity(flowLog);
}

private EntityDao<ProcInst> getProcInstDao() {


+ 7
- 8
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowListener.java Visa fil

@@ -9,19 +9,18 @@ import java.util.List;
* Created by Akmm at 2022-08-20 16:12
* 流程流转监听
*/
public class FlowListener {
public interface FlowListener {
//设置条件计算参数
public void setExprParam(SwMap param){}

default void setExprParam(SwMap param) {}
//提交
public void submit(Task srcTask, List<Task> dstTasks) {}
default void submit(Task srcTask, List<Task> dstTasks) {}
//取回
public void retake(Task srcTask, List<Task> dstTasks) {}
default void retake(Task srcTask, List<Task> dstTasks) {}
//驳回
public void reject(Task srcTask, List<Task> dstTasks) {}
default void reject(Task srcTask, List<Task> dstTasks) {}
//办理,签收
public void handle(Task srcTask) {}
default void handle(Task srcTask) {}
//作废
public void disuse(Task srcTask) {}
default void disuse(Task srcTask) {}

}

+ 6
- 9
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowProvider.java Visa fil

@@ -5,10 +5,12 @@ import cc.smtweb.framework.core.db.EntityDao;
import cc.smtweb.framework.core.db.EntityHelper;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.framework.core.mvc.service.AbstractCompProvider;
import cc.smtweb.framework.core.session.UserSession;
import cc.smtweb.framework.core.util.CommUtil;
import cc.smtweb.system.bpm.web.design.flow.FlowConst;
import cc.smtweb.system.bpm.web.design.form.ModelForm;
import cc.smtweb.system.bpm.web.design.form.ModelFormHelper;
import cc.smtweb.system.bpm.web.engine.flow.entity.Comment;
import cc.smtweb.system.bpm.web.engine.flow.entity.ProcInst;
import cc.smtweb.system.bpm.web.engine.flow.entity.Task;
import cc.smtweb.system.bpm.web.engine.flow.entity.TaskRel;
@@ -22,15 +24,6 @@ import java.util.List;
*/
public class FlowProvider extends AbstractCompProvider {

//获取FlowInstance
public FlowInstance findFlowInstance(String pageId, long us) {
return doGetData("p_" + pageId, () -> {
ModelForm form = ModelFormHelper.getFromCache(pageId);
if (form == null || form.getBillType() <= 0L) return null;
return null;
});
}

//根据id,获取流程实例
public ProcInst findProcInst(long billId) {
return doGetData("p_" + billId, () -> {
@@ -107,4 +100,8 @@ public class FlowProvider extends AbstractCompProvider {
public Task findMakeTask(long bill_id) {
return DbEngine.getInstance().findDao(Task.class).queryEntityWhere("where tsk_pri_id = ? and is_make = 1 ", bill_id);
}

public List<Comment> findComment(long bill_id) {
return DbEngine.getInstance().findDao(Comment.class).queryWhere("where cmt_pri_id=? order by cmt_end_time");
}
}

+ 11
- 2
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/Comment.java Visa fil

@@ -43,15 +43,24 @@ public class Comment extends DefaultEntity {
public void setTskId(long cmt_tsk_id) {
put("cmt_tsk_id", cmt_tsk_id);
}
/** 步骤id */
/** 活动id */
public long getActId() {
return getLong("cmt_act_id");
}

/** 步骤id */
/** 活动id */
public void setActId(long cmt_act_id) {
put("cmt_act_id", cmt_act_id);
}
/** 活动名 */
public String getActName() {
return getStr("cmt_act_name");
}

/** 活动名 */
public void setActName(String cmt_act_name) {
put("cmt_act_name", cmt_act_name);
}
/** 主办人 */
public long getHandler() {
return getLong("cmt_handler");


+ 100
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/FlowLog.java Visa fil

@@ -0,0 +1,100 @@
package cc.smtweb.system.bpm.web.engine.flow.entity;

import cc.smtweb.framework.core.annotation.SwTable;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.db.impl.DefaultEntity;

/**
* Created by 1 at 2022-08-26 10:02:26
* 实体【[流程日志](WF_FLOW_LOG)】的Entity类
*/
@SwTable("WF_FLOW_LOG")
public class FlowLog extends DefaultEntity {
public static final String ENTITY_NAME = "WF_FLOW_LOG";

public FlowLog() {
super(ENTITY_NAME);
}

/** 主键 */
public long getId() {
return getLong("wfl_id");
}

/** 主键 */
public void setId(long wfl_id) {
put("wfl_id", wfl_id);
}
/** 单据id */
public long getPriId() {
return getLong("wfl_pri_id");
}

/** 单据id */
public void setPriId(long wfl_pri_id) {
put("wfl_pri_id", wfl_pri_id);
}
/** 操作人 */
public long getUsrId() {
return getLong("wfl_usr_id");
}

/** 操作人 */
public void setUsrId(long wfl_usr_id) {
put("wfl_usr_id", wfl_usr_id);
}
/** 步骤id */
public long getActId() {
return getLong("wfl_act_id");
}

/** 步骤id */
public void setActId(long wfl_act_id) {
put("wfl_act_id", wfl_act_id);
}
/** 步骤名 */
public String getActName() {
return getStr("wfl_act_name");
}

/** 步骤名 */
public void setActName(String wfl_act_name) {
put("wfl_act_name", wfl_act_name);
}
/** 操作 */
public String getOpt() {
return getStr("wfl_opt");
}

/** 操作 */
public void setOpt(String wfl_opt) {
put("wfl_opt", wfl_opt);
}
/** 提交信息 */
public String getInfo() {
return getStr("wfl_info");
}

/** 提交信息 */
public void setInfo(String wfl_info) {
put("wfl_info", wfl_info);
}
/** 意见 */
public String getComment() {
return getStr("wfl_comment");
}

/** 意见 */
public void setComment(String wfl_comment) {
put("wfl_comment", wfl_comment);
}
/** 操作时间 */
public long getTime() {
return getLong("wfl_time");
}

/** 操作时间 */
public void setTime(long wfl_time) {
put("wfl_time", wfl_time);
}
}

+ 69
- 45
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/ProcInst.java Visa fil

@@ -4,8 +4,8 @@ import cc.smtweb.framework.core.annotation.SwTable;
import cc.smtweb.framework.core.db.impl.DefaultEntity;

/**
* Created by Akmm at 2022/5/23 14:25
* 流程实例
* Created by 1 at 2022-08-26 10:15:20
* 实体【[流程实例](WF_PROCINST)】的Entity类
*/
@SwTable("WF_PROCINST")
public class ProcInst extends DefaultEntity {
@@ -15,115 +15,139 @@ public class ProcInst extends DefaultEntity {
super(ENTITY_NAME);
}

/** 主键 */
public long getId() {
return getLong("pri_id");
}

public void setId(long priId) {
put("pri_id", priId);
/** 主键 */
public void setId(long pri_id) {
put("pri_id", pri_id);
}
/** 单据编号 */
public String getBillCode() {
return getStr("pri_bill_code");
}

public void setBillCode(String priBillCode) {
put("pri_bill_code", priBillCode);
/** 单据编号 */
public void setBillCode(String pri_bill_code) {
put("pri_bill_code", pri_bill_code);
}
/** 制单日期 */
public long getMakeDate() {
return getLong("pri_make_date");
}

public void setMakeDate(long priMakeDate) {
put("pri_make_date", priMakeDate);
/** 制单日期 */
public void setMakeDate(long pri_make_date) {
put("pri_make_date", pri_make_date);
}
public int getBillType() {
return getInt("pri_bill_type");
/** 单据类别 */
public long getBillType() {
return getLong("pri_bill_type");
}

public void setBillType(int priBillType) {
put("pri_bill_type", priBillType);
/** 单据类别 */
public void setBillType(long pri_bill_type) {
put("pri_bill_type", pri_bill_type);
}
/** 编制单位 */
public long getPartyId() {
return getLong("pri_party_id");
}

public void setPartyId(long priPartyId) {
put("pri_party_id", priPartyId);
/** 编制单位 */
public void setPartyId(long pri_party_id) {
put("pri_party_id", pri_party_id);
}
/** 编制部门 */
public long getDeptId() {
return getLong("pri_dept_id");
}

public void setDeptId(long priDeptId) {
put("pri_dept_id", priDeptId);
/** 编制部门 */
public void setDeptId(long pri_dept_id) {
put("pri_dept_id", pri_dept_id);
}
/** 摘要 */
public String getBillDesc() {
return getStr("pri_bill_desc");
}

public void setBillDesc(String priBillDesc) {
put("pri_bill_desc", priBillDesc);
/** 摘要 */
public void setBillDesc(String pri_bill_desc) {
put("pri_bill_desc", pri_bill_desc);
}
/** 流程定义 */
public long getPrcId() {
return getLong("pri_prc_id");
}

public void setPrcId(long priPrcId) {
put("pri_prc_id", priPrcId);
/** 流程定义 */
public void setPrcId(long pri_prc_id) {
put("pri_prc_id", pri_prc_id);
}
/** 开始时间 */
public long getStartTime() {
return getLong("pri_start_time");
}

public void setStartTime(long priStartTime) {
put("pri_start_time", priStartTime);
/** 开始时间 */
public void setStartTime(long pri_start_time) {
put("pri_start_time", pri_start_time);
}
/** 结束时间 */
public long getEndTime() {
return getLong("pri_end_time");
}

public void setEndTime(long priEndTime) {
put("pri_end_time", priEndTime);
/** 结束时间 */
public void setEndTime(long pri_end_time) {
put("pri_end_time", pri_end_time);
}
/** 最后操作用户 */
public long getUserId() {
return getLong("pri_user_id");
}

public void setUserId(long priUserId) {
put("pri_user_id", priUserId);
/** 最后操作用户 */
public void setUserId(long pri_user_id) {
put("pri_user_id", pri_user_id);
}
/** 当前任务 */
public long getTaskId() {
return getLong("pri_task_id");
}

public void setTaskId(long priTaskId) {
put("pri_task_id", priTaskId);
/** 当前任务 */
public void setTaskId(long pri_task_id) {
put("pri_task_id", pri_task_id);
}
/** 单据状态 */
public int getStatu() {
return getInt("pri_statu");
}

public void setStatu(int priStatu) {
put("pri_statu", priStatu);
/** 单据状态 */
public void setStatu(int pri_statu) {
put("pri_statu", pri_statu);
}
/** 单据描述 */
public String getBillInfo() {
return getStr("pri_bill_info");
}

public void setBillInfo(String priBillInfo) {
put("pri_bill_info", priBillInfo);
/** 单据描述 */
public void setBillInfo(String pri_bill_info) {
put("pri_bill_info", pri_bill_info);
}
/** 单据链接 */
public String getUrl() {
return getStr("pri_url");
}

/** 单据链接 */
public void setUrl(String pri_url) {
put("pri_url", pri_url);
}
}

+ 69
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleLoadHandler.java Visa fil

@@ -0,0 +1,69 @@
package cc.smtweb.system.bpm.web.engine.model.flow.listcard.single;

import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwConsts;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.framework.core.mvc.service.SwListData;
import cc.smtweb.system.bpm.web.design.flow.FlowConst;
import cc.smtweb.system.bpm.web.design.form.ModelForm;
import cc.smtweb.system.bpm.web.design.form.ModelFormHelper;
import cc.smtweb.system.bpm.web.design.form.define.PageDataset;
import cc.smtweb.system.bpm.web.engine.dynPage.DynRetBean;
import cc.smtweb.system.bpm.web.engine.flow.FlowHelper;
import cc.smtweb.system.bpm.web.engine.flow.FlowInstance;
import cc.smtweb.system.bpm.web.engine.flow.FlowListener;
import cc.smtweb.system.bpm.web.engine.flow.FlowProvider;
import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleHelper;
import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleLoadHandler;

import java.util.ArrayList;

/**
* Created by Akmm at 2022-08-26 17:15
*/
public class FlowSingleLoadHandler<T extends DefaultEntity> extends LCSingleLoadHandler implements FlowListener {
protected FlowInstance flowInstance;

@Override
protected void afterAdd(SwMap ret, SwMap bean) {
FlowInstance flowInstance = new FlowInstance(this, us);
flowInstance.create(form.getBillType());

PageDataset cardDataset = LCSingleHelper.findCardDataset(datasets);
ModelTable table = cardDataset.getModelTable();
bean.put(table.getIdField(), flowInstance.getProcInst().getId());

ret.put(FlowHelper.DATASET_NAME_FLOW, DynRetBean.createBean(flowInstance.getProcInst()));
ret.put(FlowHelper.DATASET_NAME_COMMENT, DynRetBean.createList(SwListData.EMPTY));
}

@Override
public R load() {
SwMap ret = new SwMap();
//过滤条件
long id = params.readLong("id");
long taskId = params.readLong("taskId");
// SwMap filter = params.readMap("filter");
SwMap filter = new SwMap();
filter.put(SwConsts.NAME_ID, id);
//对应的数据集定义
PageDataset cardDataset = LCSingleHelper.findCardDataset(datasets);

SwMap data = provider.loadData(filter, cardDataset);
ret.put(cardDataset.name, data);

//加载流程信息
FlowInstance flowInstance = new FlowInstance(this, us);
flowInstance.load(id, taskId);

ret.put(FlowHelper.DATASET_NAME_FLOW, DynRetBean.createBean(flowInstance.getProcInst()));
ret.put(FlowHelper.DATASET_NAME_COMMENT, DynRetBean.createList(SwListData.create(flowInstance.loadComment(), 0)));
afterLoad(ret, data);
return R.success(ret);
}

}

+ 12
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleSaveHandler.java Visa fil

@@ -0,0 +1,12 @@
package cc.smtweb.system.bpm.web.engine.model.flow.listcard.single;

import cc.smtweb.framework.core.db.impl.DefaultEntity;
import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleSaveHandler;

/**
* Created by Akmm at 2022-08-26 16:47
* 带流程的简单卡片之保存
*/
public class FlowSingleSaveHandler<T extends DefaultEntity> extends LCSingleSaveHandler<T> {
}

+ 27
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleService.java Visa fil

@@ -0,0 +1,27 @@
package cc.smtweb.system.bpm.web.engine.model.flow.listcard.single;

import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleDelHandler;
import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleLoadHandler;
import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleSaveHandler;
import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleService;

/**
* Created by Akmm at 2022-08-26 16:35
* 带工作流的简单列表+卡片
*/
public class FlowSingleService extends LCSingleService {
@Override
protected LCSingleSaveHandler getSaveHandler() {
return super.getSaveHandler();
}

@Override
protected LCSingleLoadHandler getLoadHandler() {
return super.getLoadHandler();
}

@Override
protected LCSingleDelHandler getDelHandler() {
return super.getDelHandler();
}
}

+ 12
- 6
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleLoadHandler.java Visa fil

@@ -2,6 +2,7 @@ package cc.smtweb.system.bpm.web.engine.model.listcard.single;

import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
import cc.smtweb.system.bpm.web.design.form.define.PageDataset;
import cc.smtweb.system.bpm.web.engine.dynPage.AbstractDynPageHandler;
import cc.smtweb.system.bpm.web.engine.dynPage.DynPageHelper;
@@ -15,6 +16,7 @@ public class LCSingleLoadHandler extends AbstractDynPageHandler {

//新增卡片操作,初始化定义的数据集
public R add() {
SwMap ret = new SwMap();
//返回的数据,以dataset.name为key,查出的结果(bean或list)为value
PageDataset cardDataset = LCSingleHelper.findCardDataset(datasets);
SwMap data;
@@ -24,29 +26,33 @@ public class LCSingleLoadHandler extends AbstractDynPageHandler {
} else {
data = DynPageHelper.createBean(cardDataset);
}
afterAddBean(cardDataset, data);
ret.put(cardDataset.name, data);

return R.success(LCSingleHelper.buildRetData(cardDataset.name, data));
afterAdd(ret, data);
return R.success(ret);
}


//新增初始化 - bean
protected void afterAddBean(PageDataset dataset, SwMap bean) {
protected void afterAdd(SwMap ret, SwMap bean) {
}

//加载之后
protected void afterLoadBean(PageDataset dataset, SwMap bean) {
protected void afterLoad(SwMap ret, SwMap bean) {
}

public R load() {
SwMap ret = new SwMap();
//过滤条件
SwMap filter = params.readMap("filter");
//对应的数据集定义
PageDataset cardDataset = LCSingleHelper.findCardDataset(datasets);

SwMap data = provider.loadData(filter, cardDataset);
afterLoadBean(cardDataset, data);
ret.put(cardDataset.name, data);

return R.success(LCSingleHelper.buildRetData(cardDataset.name, data));
afterLoad(ret, data);
return R.success(ret);
}

protected DynPageListHandler getListWorker(SwMap filter, PageDataset pageDataSet) {


+ 1
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/base/billFlow/BillFlowCache.java Visa fil

@@ -28,7 +28,7 @@ public class BillFlowCache extends AbstractEntityCache<BillFlow> {
}

//缓存key:按单据类型
public final Set<BillFlow> getByBillType(int billType) {
public final Set<BillFlow> getByBillType(long billType) {
return getListByKey(mk_b, String.valueOf(billType));
}
}

+ 1
- 0
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/common/SwConsts.java Visa fil

@@ -30,6 +30,7 @@ public interface SwConsts {
String DEF_DB_NAME = "sys";
//id自动对应的文本的后缀
String TEXT_SUFFIX = "_text";
String NAME_ID = "id";

String DEF_PWD = "abc@123456"; //初始密码
String LOGIN_VERIFY_CODE = "_VERIFY_CODE";


Laddar…
Avbryt
Spara