浏览代码

增加SWConsts.debug,是否调试模式,调试模式缓存从数据库加载

4.0
郑根木 2 年前
父节点
当前提交
d736624007
共有 3 个文件被更改,包括 68 次插入37 次删除
  1. +53
    -26
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowInstance.java
  2. +10
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleHelper.java
  3. +5
    -11
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleLoadHandler.java

+ 53
- 26
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowInstance.java 查看文件

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

import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.db.DbEngine;
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.exception.SwException;
@@ -290,14 +291,14 @@ public class FlowInstance {
//启动流程
public void save() {
if (opt_mode == FlowConst.OperatorType.NEW) {
DbEngine.getInstance().findDao(ProcInst.class).insertEntity(procInst);
DbEngine.getInstance().findDao(Task.class).insertEntity(actInst);
getProcInstDao().insertEntity(procInst);
getTaskDao().insertEntity(actInst);
buildBillLog(FlowConst.Button.ADD.value, null, null);
opt_mode = FlowConst.OperatorType.EDIT;
} else {
DbEngine.getInstance().findDao(ProcInst.class).updateEntity(procInst);
getProcInstDao().updateEntity(procInst);
if (actInst != null) {
DbEngine.getInstance().findDao(Task.class).updateEntity(actInst);
getTaskDao().updateEntity(actInst);
}
}
}
@@ -308,13 +309,13 @@ public class FlowInstance {
* @throws Exception
*/
public void delete() {
DbEngine.getInstance().findDao(ProcInst.class).deleteEntity(procInst);
DbEngine.getInstance().findDao(Task.class).deleteEntity("where bill_id=?", procInst.getId());
DbEngine.getInstance().findDao(Candidate.class).deleteEntity("where bill_id=?", procInst.getId());
DbEngine.getInstance().findDao(Care.class).deleteEntity("where bill_id=?", procInst.getId());
DbEngine.getInstance().findDao(Comment.class).deleteEntity("where bill_id=?", procInst.getId());
DbEngine.getInstance().findDao(Sign.class).deleteEntity("where bill_id=?", procInst.getId());
DbEngine.getInstance().findDao(TaskRel.class).deleteEntity("where bill_id=?", procInst.getId());
getProcInstDao().deleteEntity(procInst);
getTaskDao().deleteEntity("where bill_id=?", procInst.getId());
getCandidateDao().deleteEntity("where bill_id=?", procInst.getId());
getCareDao().deleteEntity("where bill_id=?", procInst.getId());
getCommentDao().deleteEntity("where bill_id=?", procInst.getId());
getSignDao().deleteEntity("where bill_id=?", procInst.getId());
getTaskRelDao().deleteEntity("where bill_id=?", procInst.getId());
}

/**
@@ -452,7 +453,7 @@ public class FlowInstance {
throw new BizException("非制单步骤,必须办理人本人操作!");
}
}
/*
public void submitToEnd() {
long user_id = us.getUserId();
//校验权限,当前人员有权限干不,没权限直接抛异常
@@ -477,7 +478,7 @@ public class FlowInstance {
List<Candidate> listInsertCand = new ArrayList<>();

for (Activity act : new_acts) {
buildTask(act, listInsertTask, listInsertCand, listTaskRel, user_id);
// buildTask(act, listInsertTask, listInsertCand, listTaskRel, user_id); todo
}

actInst.setHandler(user_id);
@@ -491,27 +492,25 @@ public class FlowInstance {
procInst.setTaskId(actInst.getEntityId());
}

if (new_acts.size() == 1 && new_acts.get(0).getType() == FlowConst.ActivityType.endEvent.value) {
procInst.setstatu(FlowConst.InstanceStatu.FINISH.value);
procInst.setEndTime(UtilDateTime.nowDateTimeString());
if (new_acts.size() == 1 && new_acts.get(0).getType() == FlowConst.ActivityType.END.value) {
procInst.setStatu(FlowConst.InstanceStatu.FINISH.value);
procInst.setEndTime(DateUtil.nowDateTimeLong());
} else {
procInst.setstatu(FlowConst.InstanceStatu.RUNING.value);
procInst.setStatu(FlowConst.InstanceStatu.RUNING.value);
}

//保存入库
if (!listInsertTask.isEmpty()) {
actDao.batchInsert(listInsertTask);
new CandidateDao().batchInsert(listInsertCand);
new ActinstRelDao().batchInsert(listTaskRel);
getTaskDao().batchInsertEntity(listInsertTask);
getCandidateDao().batchInsertEntity(listInsertCand);
getTaskRelDao().batchInsertEntity(listTaskRel);
}
actDao.update(actInst);
new ProcinstDao().update(procInst);

buildBillLog(FlowConst.FlowOptType.SUBMIT.value, actInst, listInsertTask);
comp.transCallback(FlowConst.FlowOptType.SUBMIT.value, actInst, listInsertTask);
getTaskDao().updateEntity(actInst);
getProcInstDao().updateEntity(procInst);

buildBillLog(FlowConst.Button.SUBMIT.value, actInst, listInsertTask);
}
*/

/**
* 提交
@@ -947,4 +946,32 @@ public class FlowInstance {
new LogDao().insert(logEntity);
*/
}

private EntityDao<ProcInst> getProcInstDao() {
return DbEngine.getInstance().findDao(ProcInst.class);
}

private EntityDao<Task> getTaskDao() {
return DbEngine.getInstance().findDao(Task.class);
}

private EntityDao<Candidate> getCandidateDao() {
return DbEngine.getInstance().findDao(Candidate.class);
}

private EntityDao<Care> getCareDao() {
return DbEngine.getInstance().findDao(Care.class);
}

private EntityDao<Comment> getCommentDao() {
return DbEngine.getInstance().findDao(Comment.class);
}

private EntityDao<Sign> getSignDao() {
return DbEngine.getInstance().findDao(Sign.class);
}

private EntityDao<TaskRel> getTaskRelDao() {
return DbEngine.getInstance().findDao(TaskRel.class);
}
}

+ 10
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleHelper.java 查看文件

@@ -1,9 +1,11 @@
package cc.smtweb.system.bpm.web.engine.model.listcard.single;

import cc.smtweb.framework.core.common.SwEnum;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.exception.SwException;
import cc.smtweb.system.bpm.web.design.form.define.PageDataset;
import cc.smtweb.system.bpm.web.design.form.define.PageDatasets;
import cc.smtweb.system.bpm.web.engine.dynPage.DynRetBean;

/**
* Created by Akmm at 2022-08-16 16:07
@@ -13,6 +15,7 @@ public interface LCSingleHelper {
String DATASET_NAME_LIST = "list";
String DATASET_NAME_CARD = "card";

//卡片数据集
static PageDataset findCardDataset(PageDatasets datasets) {
PageDataset cardDataset = datasets.findByName(DATASET_NAME_CARD);
if (cardDataset == null) throw new SwException("没有找到卡片数据集!");
@@ -22,6 +25,7 @@ public interface LCSingleHelper {
return cardDataset;
}

//列表数据集
static PageDataset findListDataset(PageDatasets datasets) {
PageDataset cardDataset = datasets.findByName(DATASET_NAME_LIST);
if (cardDataset == null) throw new SwException("没有找到列表数据集!");
@@ -30,4 +34,10 @@ public interface LCSingleHelper {
}
return cardDataset;
}

static SwMap buildRetData(String dsName, SwMap data) {
SwMap mapRet = new SwMap();
mapRet.put(dsName, DynRetBean.createBean(data));
return mapRet;
}
}

+ 5
- 11
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleLoadHandler.java 查看文件

@@ -16,7 +16,6 @@ public class LCSingleLoadHandler extends AbstractDynPageHandler {
//新增卡片操作,初始化定义的数据集
public R add() {
//返回的数据,以dataset.name为key,查出的结果(bean或list)为value
SwMap mapRet = new SwMap();
PageDataset cardDataset = LCSingleHelper.findCardDataset(datasets);
SwMap data;
//懒加载,给个空对象
@@ -26,9 +25,8 @@ public class LCSingleLoadHandler extends AbstractDynPageHandler {
data = DynPageHelper.createBean(cardDataset);
}
afterAddBean(cardDataset, data);
mapRet.put(cardDataset.name, DynRetBean.createBean(data));

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

//新增初始化 - bean
@@ -43,16 +41,12 @@ public class LCSingleLoadHandler extends AbstractDynPageHandler {
//过滤条件
SwMap filter = params.readMap("filter");
//对应的数据集定义
PageDataset pageDataSet = LCSingleHelper.findCardDataset(datasets);

DynRetBean bean = null;

SwMap data = provider.loadData(filter, pageDataSet);
afterLoadBean(pageDataSet, data);
bean = DynRetBean.createBean(data);
PageDataset cardDataset = LCSingleHelper.findCardDataset(datasets);

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

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

protected DynPageListHandler getListWorker(SwMap filter, PageDataset pageDataSet) {


正在加载...
取消
保存