소스 검색

流程引擎-保存

4.0
郑根木 2 년 전
부모
커밋
621ec86cdc
3개의 변경된 파일41개의 추가작업 그리고 2개의 파일을 삭제
  1. +1
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/flow/FlowConst.java
  2. +1
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowInstance.java
  3. +39
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleSaveHandler.java

+ 1
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/flow/FlowConst.java 파일 보기

@@ -28,6 +28,7 @@ public interface FlowConst {
public static StrEnumBean RETAKE = instance.addEnum("retake", "取回");
//驳回
public static StrEnumBean REJECT = instance.addEnum("reject", "驳回");
public static StrEnumBean INTERRUPT = instance.addEnum("interrupt", "终止");
//新增
public static StrEnumBean ADD = instance.addEnum("add", "新增");
//删除


+ 1
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowInstance.java 파일 보기

@@ -56,7 +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) {


+ 39
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleSaveHandler.java 파일 보기

@@ -1,16 +1,54 @@
package cc.smtweb.system.bpm.web.engine.model.flow.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.framework.core.exception.BizException;
import cc.smtweb.system.bpm.web.design.form.define.PageDataset;
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.model.listcard.single.LCSingleSaveHandler;

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

@Override
public R save() {

return super.save();
}

@Override
protected T readBeanFromPage(PageDataset pageDataSet, SwMap pageData) {
T bean = super.readBeanFromPage(pageDataSet, pageData);

long id = params.readLong("id");
long taskId = params.readLong("taskId");

SwMap data = pageData.readMap(FlowHelper.DATASET_NAME_FLOW);
if (data == null) throw new BizException("没有找到待保存的流程数据!");
data = data.readMap("form");
if (data == null) throw new BizException("没有找到待保存的流程数据!");

FlowInstance flowInstance = new FlowInstance(this, us);
if (bean.isNew()) {
flowInstance.create(form.getBillType());
} else {
flowInstance.load(id, taskId);
}
flowInstance.readFromPage(data);

return bean;
}

@Override
protected void saveBean(T bean) {
super.saveBean(bean);
flowInstance.save();
}
}

불러오는 중...
취소
저장