Bladeren bron

流程引擎-删除

4.0
郑根木 2 jaren geleden
bovenliggende
commit
0901fb476b
7 gewijzigde bestanden met toevoegingen van 56 en 15 verwijderingen
  1. +14
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowInstance.java
  2. +22
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowDelHandler.java
  3. +3
    -5
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleLoadHandler.java
  4. +2
    -3
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleSaveHandler.java
  5. +1
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleService.java
  6. +2
    -2
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/normal/LCNormalDelHandler.java
  7. +12
    -3
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleDelHandler.java

+ 14
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowInstance.java Bestand weergeven

@@ -59,7 +59,20 @@ public class FlowInstance {

private FlowListener listener;

public FlowInstance(@NonNull FlowListener listener, UserSession us) {
public static FlowInstance createById(UserSession us, FlowListener listener, long billId, long taskId) {
FlowInstance flowInstance = new FlowInstance(listener, us);
flowInstance.load(billId, taskId);
return flowInstance;
}

public static FlowInstance createByBillType(UserSession us, FlowListener listener, long billType) {
FlowInstance flowInstance = new FlowInstance(listener, us);
flowInstance.create(billType);
return flowInstance;
}


private FlowInstance(@NonNull FlowListener listener, UserSession us) {
this.listener = listener;
this.us = us;
}


+ 22
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowDelHandler.java Bestand weergeven

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

import cc.smtweb.framework.core.db.vo.ModelTable;
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.LCSingleDelHandler;

/**
* Created by Akmm at 2022-09-01 15:03
* 流程删除
*/
public class FlowDelHandler extends LCSingleDelHandler implements FlowListener {
protected FlowInstance flowInstance;
@Override
protected void localDel(long id, ModelTable table) {
long taskId = params.readLong("taskId");
flowInstance = FlowInstance.createById(us, this, id, taskId);
flowInstance.delete();
super.localDel(id, table);
}
}

+ 3
- 5
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleLoadHandler.java Bestand weergeven

@@ -30,9 +30,8 @@ public class FlowSingleLoadHandler extends LCSingleLoadHandler implements FlowLi

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

flowInstance = FlowInstance.createByBillType(us, this, form.getBillType());
PageDataset cardDataset = LCSingleHelper.findCardDataset(datasets);
ModelTable table = cardDataset.getModelTable();
bean.put(table.getIdField(), flowInstance.getProcInst().getId());
@@ -57,8 +56,7 @@ public class FlowSingleLoadHandler extends LCSingleLoadHandler implements FlowLi
ret.put(cardDataset.name, data);

//加载流程信息
flowInstance = new FlowInstance(this, us);
flowInstance.load(id, taskId);
flowInstance = FlowInstance.createById(us,this, 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)));


+ 2
- 3
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleSaveHandler.java Bestand weergeven

@@ -35,11 +35,10 @@ public class FlowSingleSaveHandler<T extends DefaultEntity> extends LCSingleSave
data = data.readMap("form");
if (data == null) throw new BizException("没有找到待保存的流程数据!");

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


+ 1
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleService.java Bestand weergeven

@@ -25,6 +25,6 @@ public class FlowSingleService extends LCSingleService {

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

+ 2
- 2
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/normal/LCNormalDelHandler.java Bestand weergeven

@@ -29,7 +29,7 @@ public class LCNormalDelHandler extends LCSingleDelHandler {
//数据集
String dataSet = params.readString("dataset");
PageDataset delDataSet = this.datasets.findByName(dataSet);
Assert.notNull(delDataSet,"未获取到数据集:"+dataSet);
Assert.notNull(delDataSet, "未获取到数据集:" + dataSet);
//
checkBean(delDataSet, id);
//
@@ -50,7 +50,7 @@ public class LCNormalDelHandler extends LCSingleDelHandler {
AbstractCache cache = CacheManager.getIntance().getCache(table.getName());
cache.remove(id);
}
localDelSuccess(id, table);
afterCommit(id, table);
}
});
return R.success();


+ 12
- 3
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleDelHandler.java Bestand weergeven

@@ -57,17 +57,26 @@ public class LCSingleDelHandler extends AbstractDynPageHandler {
AbstractCache cache = CacheManager.getIntance().getCache(table.getName());
cache.remove(id);
}
localDelSuccess(id, table);
afterCommit(id, table);
}

@Override
public void doAfterDbRollback() {
afterRollback(id);
}
});
return R.success();
}

protected void localDel(long id, ModelTable table) {
//回调:::删除之后
protected void localDel(long id, ModelTable table) {}

//回调:::提交成功后
protected void afterCommit(long id, ModelTable table) {
}

protected void localDelSuccess(long id, ModelTable table) {
//回调:::提交失败,事务回滚后
protected void afterRollback(long id) {

}



Laden…
Annuleren
Opslaan