Browse Source

流程引擎:extra返回

4.0
郑根木 2 years ago
parent
commit
f634fff6ae
4 changed files with 12 additions and 8 deletions
  1. +8
    -7
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowInstance.java
  2. +2
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleLoadHandler.java
  3. +1
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleSaveHandler.java
  4. +1
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowTransHandler.java

+ 8
- 7
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowInstance.java View File

@@ -46,8 +46,6 @@ public class FlowInstance {
//流程执行变量 //流程执行变量
// public Map<String, String> variables = new HashMap<>(); // public Map<String, String> variables = new HashMap<>();


//当前任务
private List<Map<String, String>> tasks = new ArrayList<>();
//数据提供者 //数据提供者
private FlowProvider provider = new FlowProvider(); private FlowProvider provider = new FlowProvider();


@@ -342,24 +340,27 @@ public class FlowInstance {
/** /**
* 返回页面前的设置 * 返回页面前的设置
*/ */
public void resetPage() {
public void setPageRetExtra(SwMap ret) {
SwMap extra = ret.computeMapIfAbsent("extra", k->new SwMap());

List<Task> listTask = adjustTasks(); List<Task> listTask = adjustTasks();
//可选步骤 //可选步骤
tasks.clear();
List<SwMap> tasks = new ArrayList<>();
String next_text = procDef.getProcInfo().getActNameById(actInst.getActId()); String next_text = procDef.getProcInfo().getActNameById(actInst.getActId());
int index = 0; int index = 0;
for (Task act : listTask) { for (Task act : listTask) {
Map<String, String> row = new HashMap<>();
SwMap row = new SwMap();
tasks.add(row); tasks.add(row);
row.put("id", String.valueOf(act.getId()));
row.put("id", act.getId());
if (act.getId() == actInst.getId() && listTask.size() > 1 && index != 0) { if (act.getId() == actInst.getId() && listTask.size() > 1 && index != 0) {
next_text = "待" + next_text; next_text = "待" + next_text;
} else { } else {
next_text = procDef.getProcInfo().getActNameById(act.getActId()); next_text = procDef.getProcInfo().getActNameById(act.getActId());
} }
row.put("text", next_text);
row.put("label", next_text);
index++; index++;
} }
extra.put("tasks", tasks);
resetButtons(); resetButtons();
} }




+ 2
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleLoadHandler.java View File

@@ -39,6 +39,7 @@ public class FlowSingleLoadHandler<T extends DefaultEntity> extends LCSingleLoad
ret.put(cardDataset.name, DynRetBean.createBean(bean)); ret.put(cardDataset.name, DynRetBean.createBean(bean));
ret.put(FlowHelper.DATASET_NAME_FLOW, DynRetBean.createBean(flowInstance.getProcInst())); ret.put(FlowHelper.DATASET_NAME_FLOW, DynRetBean.createBean(flowInstance.getProcInst()));
ret.put(FlowHelper.DATASET_NAME_COMMENT, DynRetBean.createList(SwListData.EMPTY)); ret.put(FlowHelper.DATASET_NAME_COMMENT, DynRetBean.createList(SwListData.EMPTY));
flowInstance.setPageRetExtra(ret);
} }


@Override @Override
@@ -57,7 +58,7 @@ public class FlowSingleLoadHandler<T extends DefaultEntity> extends LCSingleLoad


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


+ 1
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleSaveHandler.java View File

@@ -58,6 +58,7 @@ public class FlowSingleSaveHandler<T extends DefaultEntity> extends LCSingleSave
super.afterSave(ret, bean); super.afterSave(ret, bean);
ret.put(FlowHelper.DATASET_NAME_FLOW, DynRetBean.createBean(flowInstance.getProcInst())); ret.put(FlowHelper.DATASET_NAME_FLOW, DynRetBean.createBean(flowInstance.getProcInst()));
ret.put(FlowHelper.DATASET_NAME_COMMENT, DynRetBean.createList(SwListData.EMPTY)); ret.put(FlowHelper.DATASET_NAME_COMMENT, DynRetBean.createList(SwListData.EMPTY));
flowInstance.setPageRetExtra(ret);
} }


//单据编号,新增保存时调用 //单据编号,新增保存时调用


+ 1
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowTransHandler.java View File

@@ -33,6 +33,7 @@ public class FlowTransHandler<T extends DefaultEntity> extends AbstractDynPageHa
ret.put(LCSingleHelper.DATASET_NAME_CARD, DynRetBean.createBean(bean)); ret.put(LCSingleHelper.DATASET_NAME_CARD, DynRetBean.createBean(bean));
ret.put(FlowHelper.DATASET_NAME_FLOW, DynRetBean.createBean(flowInstance.getProcInst())); ret.put(FlowHelper.DATASET_NAME_FLOW, DynRetBean.createBean(flowInstance.getProcInst()));
ret.put(FlowHelper.DATASET_NAME_COMMENT, DynRetBean.createList(SwListData.EMPTY)); ret.put(FlowHelper.DATASET_NAME_COMMENT, DynRetBean.createList(SwListData.EMPTY));
flowInstance.setPageRetExtra(ret);
return ret; return ret;
} }




Loading…
Cancel
Save