瀏覽代碼

Merge remote-tracking branch 'origin/4.0' into 4.0

# Conflicts:
#	smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/model/ModelFactory.java
#	smtweb-framework/bpm/src/main/resources/static/template/default/incModel/inc_list_table.ftl
#	smtweb-framework/core/src/main/java/cc/smtweb/framework/core/common/SwEnum.java
4.0
lip 2 年之前
父節點
當前提交
6e9a0b1a1c
共有 41 個檔案被更改,包括 1310 行新增174 行删除
  1. +14
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/db/ModelTableService.java
  2. +1
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/flow/FlowConst.java
  3. +1
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/flow/ModelProcHelper.java
  4. +54
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/flow/ModelProcService.java
  5. +44
    -3
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/CodeBuildHandler.java
  6. +1
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelForm.java
  7. +5
    -3
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormDelHandler.java
  8. +4
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormHelper.java
  9. +9
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormLoadHandler.java
  10. +2
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/model/BaseModelWorker.java
  11. +2
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/model/ModelFactory.java
  12. +75
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/model/flow/LcFlowWorker.java
  13. +1
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageHelper.java
  14. +1
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageListHandler.java
  15. +4
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynRetBean.java
  16. +4
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowHelper.java
  17. +46
    -41
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowInstance.java
  18. +7
    -8
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowListener.java
  19. +6
    -9
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowProvider.java
  20. +75
    -22
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/Comment.java
  21. +100
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/FlowLog.java
  22. +69
    -45
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/ProcInst.java
  23. +12
    -4
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/Task.java
  24. +69
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleLoadHandler.java
  25. +12
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleSaveHandler.java
  26. +27
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleService.java
  27. +12
    -6
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleLoadHandler.java
  28. +17
    -17
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleSaveHandler.java
  29. +15
    -3
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleService.java
  30. +1
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/base/billFlow/BillFlowCache.java
  31. +55
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/base/billType/BillType.java
  32. +34
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/base/billType/BillTypeCache.java
  33. +21
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/base/billType/BillTypeSaveHandler.java
  34. +30
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/base/billType/BillTypeService.java
  35. +358
    -0
      smtweb-framework/bpm/src/main/resources/static/template/default/model_card_flow.ftl
  36. +109
    -0
      smtweb-framework/bpm/src/main/resources/static/template/default/model_list_flow.ftl
  37. +3
    -0
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/common/SwConsts.java
  38. +1
    -0
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/common/SwEnum.java
  39. +1
    -0
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/db/EntityDao.java
  40. +7
    -6
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/db/EntityHelper.java
  41. +1
    -0
      smtweb-framework/core/src/main/resources/流程定义.json

+ 14
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/db/ModelTableService.java 查看文件

@@ -8,6 +8,7 @@ import cc.smtweb.framework.core.db.cache.ModelTableCache;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.mvc.service.*;
import cc.smtweb.framework.core.session.UserSession;
import cc.smtweb.system.bpm.web.design.form.CodeBuildHandler;

/**
* Created by Akmm at 2022/3/22 9:12
@@ -44,4 +45,17 @@ public class ModelTableService extends AbstractCompService {
return R.error("操作失败!", e);
}
}

//生成bean
public R buildBean(@SwBody SwMap params, UserSession us) {
CodeBuildHandler handler = new CodeBuildHandler();
if (params == null) params = new SwMap();
if (us == null) us = UserSession.createSys();
handler.init(params, us);
try {
return handler.buildBeanByTable();
} catch (Exception e) {
return R.error("操作失败!", e);
}
}
}

+ 1
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/flow/FlowConst.java 查看文件

@@ -65,6 +65,7 @@ public interface FlowConst {
public static IntEnumBean WAIT = instance.addEnum(0, "待办");
public static IntEnumBean HANDLE = instance.addEnum(1, "办理中");
public static IntEnumBean SUBMIT = instance.addEnum(2, "已提交");
public static IntEnumBean INTERRUPT = instance.addEnum(7, "已终止");
public static IntEnumBean DISUSE = instance.addEnum(8, "已作废");
public static IntEnumBean REJECT = instance.addEnum(9, "已驳回");
}


+ 1
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/flow/ModelProcHelper.java 查看文件

@@ -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)) {


+ 54
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/flow/ModelProcService.java 查看文件

@@ -3,12 +3,26 @@ package cc.smtweb.system.bpm.web.design.flow;
import cc.smtweb.framework.core.annotation.SwBody;
import cc.smtweb.framework.core.annotation.SwService;
import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwConsts;
import cc.smtweb.framework.core.common.SwEnum;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.db.cache.ModelTableCache;
import cc.smtweb.framework.core.db.vo.ModelField;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.mvc.service.AbstractCompService;
import cc.smtweb.framework.core.mvc.service.AbstractHandler;
import cc.smtweb.framework.core.mvc.service.DefaultDelHandler;
import cc.smtweb.framework.core.mvc.service.DefaultListHandler;
import cc.smtweb.framework.core.session.UserSession;
import cc.smtweb.system.bpm.web.design.form.ModelForm;
import cc.smtweb.system.bpm.web.design.form.ModelFormCache;
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 java.util.ArrayList;
import java.util.List;
import java.util.Set;

/**
* Created by Akmm at 2022/3/22 9:12
@@ -40,5 +54,44 @@ public class ModelProcService extends AbstractCompService {
public R loadModel(@SwBody SwMap params, UserSession us) {
return pageHandler(params, us, TYPE_LOAD, handler -> ((ModelProcLoadHandler)handler).loadModel());
}

//加载工作流的列表字段
public R loadProcInstFields(@SwBody SwMap params, UserSession us) {
ModelTable table = ModelTableCache.getInstance().getByName(ProcInst.ENTITY_NAME);
if (table == null) return R.error("没有找到表定义信息(table=" + ProcInst.ENTITY_NAME + ")!");

List<SwMap> ret = new ArrayList<>();
for (ModelField field : table.getFields()) {
SwMap col = new SwMap(2);
ModelFormHelper.buildFieldInfo(table, field, col);
ret.add(col);
}
return R.success(ret);
}

//加载审批意见的列表字段
public R loadCommentFields(@SwBody SwMap params, UserSession us) {
ModelTable table = ModelTableCache.getInstance().getByName(Comment.ENTITY_NAME);
if (table == null) return R.error("没有找到表定义信息(table=" + Comment.ENTITY_NAME + ")!");

List<SwMap> ret = new ArrayList<>();
for (ModelField field : table.getFields()) {
SwMap col = new SwMap(2);
ModelFormHelper.buildFieldInfo(table, field, col);
ret.add(col);
}
ret.add(buildField("cmt_act_code", SwEnum.DataType.CODE.value, "活动编号"));
ret.add(buildField("cmt_act_text", SwEnum.DataType.NAME.value, "活动名称"));
return R.success(ret);
}

private SwMap buildField(String name, String dataType, String title) {
SwMap col = new SwMap();
col.put("name", name);
col.put("dataType", dataType);
col.put("title", title);
col.put("editor", SwEnum.EditorType.INPUT.value);
return col;
}
}

+ 44
- 3
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/CodeBuildHandler.java 查看文件

@@ -57,6 +57,45 @@ public class CodeBuildHandler extends AbstractHandler {
buildJavaTable(tableId, needBean, needCache);
}
if (needBuildService) buildJavaService(pageId);
System.out.println("JAVA代码路径:" + codePath);
return R.success();
}

public R buildBeanByTable() {
userName = String.valueOf(us.getUserId());

//页面id
long tableId = params.readLong("tableId");
ModelTable table = ModelTableCache.getInstance().get(tableId);
if (table == null) throw new BizException("未找到指定的表定义(" + table + ")!");

String moduleName = ModelProjectCache.getInstance().getModule(table.getPrjId());
if (StringUtils.isEmpty(moduleName)) throw new BizException("此项目未定义Module!");
if (moduleName.equals("bpm")) {
packageName = "cc.smtweb.system.bpm.web";
} else {
packageName = "cc.smtweb.biz." + moduleName + ".web";
}
BpmConfigBean bpmConfigBean = SpringUtil.getBean(BpmConfigBean.class);
Map<String, String> mapIdeaModules = IdeaUtil.getModules(bpmConfigBean.getCodeJavaPath(), bpmConfigBean.getMode());
if (mapIdeaModules == null || mapIdeaModules.isEmpty())
throw new BizException("没有定义idea项目的路径(smtweb.bpm.codeJavaPath)!");
codePath = mapIdeaModules.get(moduleName);
if (StringUtils.isEmpty(codePath)) {
throw new BizException("没有找到对应项目在idea中Module的路径(" + moduleName + ")!");
}
codePath += "/src/main/java/";
//加上目录
String cn = ModelCatalogCache.getInstance().getFullName(table.getMcId());
if (StringUtils.isNotEmpty(cn)) {
packageName += "." + cn;
}

codePath += packageName.replaceAll("\\.", "/");
new File(codePath).mkdirs();

buildJavaTable(tableId, true, table.isNeedCache());
System.out.println("JAVA代码路径:" + codePath);
return R.success();
}

@@ -79,6 +118,7 @@ public class CodeBuildHandler extends AbstractHandler {
model.put("title", form.getTitle());
model.put("eventPath", eventPath + "." + form.getName());
CodeGenerator.getInstance().generateJsEvent(model, codePath + "/" + form.getName() + ".js");
System.out.println("JS代码路径:" + codePath);
return R.success();
}

@@ -100,7 +140,8 @@ public class CodeBuildHandler extends AbstractHandler {
}
BpmConfigBean bpmConfigBean = SpringUtil.getBean(BpmConfigBean.class);
Map<String, String> mapIdeaModules = IdeaUtil.getModules(bpmConfigBean.getCodeJavaPath(), bpmConfigBean.getMode());
if (mapIdeaModules == null || mapIdeaModules.isEmpty()) throw new BizException("没有定义idea项目的路径(smtweb.bpm.codeJavaPath)!");
if (mapIdeaModules == null || mapIdeaModules.isEmpty())
throw new BizException("没有定义idea项目的路径(smtweb.bpm.codeJavaPath)!");
codePath = mapIdeaModules.get(moduleName);
if (StringUtils.isEmpty(codePath)) {
throw new BizException("没有找到对应项目在idea中Module的路径(" + moduleName + ")!");
@@ -177,11 +218,11 @@ public class CodeBuildHandler extends AbstractHandler {
if (StringUtils.isEmpty(sName)) {
//模块名称
form = ModelFormCache.getInstance().get(form.getParent());
if(form == null){
if (form == null) {
throw new BizException("页面设置未定义服务名!" + form.getTitle());
}
sName = form.getService();
if(StringUtils.isEmpty(sName)){
if (StringUtils.isEmpty(sName)) {
throw new BizException("模块设置未定义服务名!" + form.getTitle());
}
}


+ 1
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelForm.java 查看文件

@@ -230,6 +230,6 @@ public class ModelForm extends DefaultEntity {

//返回单据类型id
public long getBillType() {
return getOpts().readLong("billType");
return getOpts().readLong(ModelFormHelper.KEY_BILL_TYPE);
}
}

+ 5
- 3
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormDelHandler.java 查看文件

@@ -28,13 +28,15 @@ public class ModelFormDelHandler extends DefaultDelHandler<ModelForm> {
@Override
protected void delDb() {
EntityDao<ModelForm> dao = DbEngine.getInstance().findDao(ModelForm.class);
listDeled = ModelFormCache.getInstance().getListByModule(id);
if (CommUtil.isEmpty(listDeled)) {
Set<ModelForm> list = new HashSet<>(ModelFormCache.getInstance().getListByModule(id));
if (CommUtil.isEmpty(list)) {
listDeled = null;
dao.deleteEntity(id);
} else {
listDeled = new HashSet<>(list);
List<Long> ids = new ArrayList<>();
ids.add(id);
for (ModelForm form: listDeled) {
for (ModelForm form: list) {
ids.add(form.getId());
}
dao.deleteEntity(ids);


+ 4
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormHelper.java 查看文件

@@ -27,6 +27,7 @@ import java.util.*;
*/
public class ModelFormHelper {
public static final String KEY_EVENT_PATH = "eventPath";
public static final String KEY_BILL_TYPE = "billType";
//分组类别-list
public static final String PAGE_TYPE_LIST = "list";
//分组类别-card
@@ -489,7 +490,8 @@ public class ModelFormHelper {
field.put("id", pdf.id);
field.put("field", pdf.field);
field.put("name", pdf.name);
field.put("label", pdf.label);
String label = (String) field.get("field_text");
field.put("label", StringUtils.isEmpty(label)? pdf.label: label);
field.put("required", pdf.isFieldNotNull());
final SwEnum.DataTypeBean dtb = SwEnum.DataType.instance.getByValue(pdf.dataType);
if (dtb != null) {
@@ -516,6 +518,7 @@ public class ModelFormHelper {
public static void buildFieldInfo(ModelTable table, ModelField field, SwMap col) {
col.put("name", field.getName());
col.put("dataType", field.getDataType());
col.put("fieldType", field.getFieldType());
col.put("null", field.getNotNull());
col.put("default", field.getDefaultValue());
col.put("title", field.getTitle());


+ 9
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormLoadHandler.java 查看文件

@@ -1,6 +1,7 @@
package cc.smtweb.system.bpm.web.design.form;

import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwConsts;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.framework.core.exception.SwException;
import cc.smtweb.framework.core.common.SwMap;
@@ -11,6 +12,7 @@ import cc.smtweb.framework.core.util.SpringUtil;
import cc.smtweb.system.bpm.spring.BpmConfigBean;
import cc.smtweb.system.bpm.util.IdeaUtil;
import cc.smtweb.system.bpm.web.design.db.ModelProjectCache;
import cc.smtweb.system.bpm.web.sys.base.billType.BillTypeCache;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
@@ -32,6 +34,13 @@ public class ModelFormLoadHandler extends DefaultLoadHandler<ModelForm> {
if (StringUtils.isEmpty(id)) id = params.readString("pageName");
ModelForm bean = ModelFormHelper.getFromCache(id);
if (bean == null) throw new BizException("没有找到指定的页面定义信息!id=" + id);
long billType = bean.getBillType();
if (billType > 0L) {
SwMap opts = bean.getOpts();
opts.put(ModelFormHelper.KEY_BILL_TYPE + SwConsts.TEXT_SUFFIX, BillTypeCache.getInstance().getName(billType));
bean.setOption(JsonUtil.encodeString(opts));
}

return bean;
}



+ 2
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/model/BaseModelWorker.java 查看文件

@@ -1,5 +1,6 @@
package cc.smtweb.system.bpm.web.design.form.model;

import cc.smtweb.framework.core.common.SwConsts;
import cc.smtweb.framework.core.common.SwEnum;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.db.DbEngine;
@@ -29,6 +30,7 @@ public class BaseModelWorker {
SwMap opts = bean.getOpts();
if (opts != null) {
opts.remove(ModelFormHelper.KEY_EVENT_PATH);
opts.remove(ModelFormHelper.KEY_BILL_TYPE + SwConsts.TEXT_SUFFIX);
bean.setOption(JsonUtil.encodeString(opts));
}
if (bean.getType() == SwEnum.FormType.MODULE.value) {


+ 2
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/model/ModelFactory.java 查看文件

@@ -5,6 +5,7 @@ import cc.smtweb.framework.core.common.SwEnum;
import cc.smtweb.framework.core.exception.SwException;
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.model.flow.LcFlowWorker;
import org.apache.commons.lang3.StringUtils;

import java.util.*;
@@ -25,6 +26,7 @@ public class ModelFactory {
mapWorker.put(SwEnum.ModelType.LC_LT.value, new LcLtWorker());
mapWorker.put(SwEnum.ModelType.LC_MS.value, new LcMsWorker());
mapWorker.put(SwEnum.ModelType.LC_LT_MS.value, new LcLtMsWorker());
mapWorker.put(SwEnum.ModelType.LC_FLOW.value, new LcFlowWorker());
}

public static ModelFactory getInstance() {


+ 75
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/model/flow/LcFlowWorker.java 查看文件

@@ -0,0 +1,75 @@
package cc.smtweb.system.bpm.web.design.form.model.flow;

import cc.smtweb.framework.core.common.SwEnum;
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.exception.SwException;
import cc.smtweb.framework.core.util.JsonUtil;
import cc.smtweb.framework.core.util.StringUtil;
import cc.smtweb.system.bpm.web.design.form.ModelForm;
import cc.smtweb.system.bpm.web.design.form.ModelFormCache;
import cc.smtweb.system.bpm.web.design.form.ModelFormHelper;
import cc.smtweb.system.bpm.web.design.form.model.BaseModelWorker;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.List;

/**
* @Author: tanghp
* @Date: 2022-08-26 9:48
* @Desc: 列表卡片(含工作流)
*/
public class LcFlowWorker extends BaseModelWorker {
private final static String listTmpl = "model_list_flow";
private final static String cardTmpl = "model_card_flow";
@Override
protected void saveModule(ModelForm bean, List<ModelForm> listFormChild) {
EntityDao<ModelForm> dao = DbEngine.getInstance().findDao(ModelForm.class);

SwMap opts = bean.getOpts();
SwMap cfg = opts.readMap(ModelFormHelper.OPT_CONFIG);
SwMap cfgPage = new SwMap();
cfg.put(ModelFormHelper.OPT_PAGE, cfgPage);
// 添加列表页面名称
String listFormName = ModelFormHelper.getPageName(bean) + StringUtil.upFirst(SwEnum.PageType.LIST.value);
cfgPage.put(SwEnum.PageType.LIST.value, listFormName);
// 添加卡片页面名称
String cardFormName = ModelFormHelper.getPageName(bean) + StringUtil.upFirst(SwEnum.PageType.CARD.value);
cfgPage.put(SwEnum.PageType.CARD.value, cardFormName);
bean.setOption(JsonUtil.encodeString(opts));

if (bean.isNew()) {//新增
List<ModelForm> insertList = new ArrayList<>();

ModelForm listPage = createPage(bean, SwEnum.PageType.LIST.value);
listFormChild.add(listPage);
insertList.add(listPage);

ModelForm cardPage = createPage(bean, SwEnum.PageType.CARD.value);
listFormChild.add(cardPage);
insertList.add(cardPage);

dao.batchInsertEntity(insertList);
} else {//修改,先不考虑修改模型的情况 todo

}
}

@Override
public void buildSaveModel(ModelForm bean) {
ModelForm parent = ModelFormCache.getInstance().get(bean.getParent());
if(parent==null){
return;
}
String listFormName = parent.getName()+ StringUtil.upFirst(SwEnum.PageType.LIST.value);
String cardFormName = parent.getName()+ StringUtil.upFirst(SwEnum.PageType.CARD.value);
if(listFormName.equals(bean.getName())){
ModelFormHelper.buildSaveModelByTmpl(bean, listTmpl);
}else if(cardFormName.equals(bean.getName())){
ModelFormHelper.buildSaveModelByTmpl(bean, cardTmpl);
}
}

}

+ 1
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageHelper.java 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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");
}
}

+ 75
- 22
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/Comment.java 查看文件

@@ -1,11 +1,12 @@
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 Akmm at 2022/5/23 14:25
* 审批意见
* Created by 1 at 2022-08-25 17:35:03
* 实体【[流程审批意见](WF_COMMENT)】的Entity类
*/
@SwTable("WF_COMMENT")
public class Comment extends DefaultEntity {
@@ -15,51 +16,103 @@ public class Comment extends DefaultEntity {
super(ENTITY_NAME);
}

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

public void setId(long cmtId) {
put("cmt_id", cmtId);
/** 主键 */
public void setId(long cmt_id) {
put("cmt_id", cmt_id);
}
/** 流程id */
public long getPriId() {
return getLong("cmt_pri_id");
}

public void setPriId(long cmtPriId) {
put("cmt_pri_id", cmtPriId);
/** 流程id */
public void setPriId(long cmt_pri_id) {
put("cmt_pri_id", cmt_pri_id);
}
/** 任务id */
public long getTskId() {
return getLong("cmt_tsk_id");
}

public void setTskId(long cmtTskId) {
put("cmt_tsk_id", cmtTskId);
/** 任务id */
public void setTskId(long cmt_tsk_id) {
put("cmt_tsk_id", cmt_tsk_id);
}
/** 活动id */
public long getActId() {
return getLong("cmt_act_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");
}

public long getUserId() {
return getLong("cmt_user_id");
/** 主办人 */
public void setHandler(long cmt_handler) {
put("cmt_handler", cmt_handler);
}
/** 开始时间 */
public long getStartTime() {
return getLong("cmt_start_time");
}

public void setUserId(long cmtUserId) {
put("cmt_user_id", cmtUserId);
/** 开始时间 */
public void setStartTime(long cmt_start_time) {
put("cmt_start_time", cmt_start_time);
}
/** 签收时间 */
public long getHandlerTime() {
return getLong("cmt_handler_time");
}

public String getContent() {
return getStr("cmt_content");
/** 签收时间 */
public void setHandlerTime(long cmt_handler_time) {
put("cmt_handler_time", cmt_handler_time);
}
/** 结束时间 */
public long getEndTime() {
return getLong("cmt_end_time");
}

public void setContent(String cmtContent) {
put("cmt_content", cmtContent);
/** 结束时间 */
public void setEndTime(long cmt_end_time) {
put("cmt_end_time", cmt_end_time);
}
/** 审批意见 */
public String getComment() {
return getStr("cmt_comment");
}

public long getTime() {
return getLong("cmt_time");
/** 审批意见 */
public void setComment(String cmt_comment) {
put("cmt_comment", cmt_comment);
}
/** 状态 */
public int getStatu() {
return getInt("cmt_statu");
}

public void setTime(long cmtTime) {
put("cmt_time", cmtTime);
/** 状态 */
public void setStatu(int cmt_statu) {
put("cmt_statu", cmt_statu);
}
}

+ 100
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/FlowLog.java 查看文件

@@ -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 查看文件

@@ -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);
}
}

+ 12
- 4
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/Task.java 查看文件

@@ -71,6 +71,14 @@ public class Task extends DefaultEntity {
put("tsk_start_time", tskStartTime);
}

public long getHandler_time() {
return getLong("tsk_handler_time");
}

public void setHandler_time(long tsk_handler_time) {
put("tsk_handler_time", tsk_handler_time);
}

public long getEndTime() {
return getLong("tsk_end_time");
}
@@ -87,12 +95,12 @@ public class Task extends DefaultEntity {
put("tsk_statu", tskStatu);
}

public String getSubmitIdea() {
return getStr("tsk_submit_idea");
public String getComment() {
return getStr("comment");
}

public void setSubmitIdea(String tskSubmitIdea) {
put("tsk_submit_idea", tskSubmitIdea);
public void setComment(String comment) {
put("comment", comment);
}

public boolean isMake() {


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

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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) {


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

@@ -32,10 +32,10 @@ import java.util.Map;
* 保存操作
* 入参:{pageId, data:}
*/
public class LCSingleSaveHandler extends AbstractDynPageHandler {
private Map<String, List<DefaultEntity>> mapTreeBean = new HashMap<>();
public class LCSingleSaveHandler<T extends DefaultEntity> extends AbstractDynPageHandler {
private Map<String, List<T>> mapTreeBean = new HashMap<>();

protected void setNewId(DefaultEntity bean) {
protected void setNewId(T bean) {
bean.setEntityId(DbEngine.getInstance().nextId());
}

@@ -52,7 +52,7 @@ public class LCSingleSaveHandler extends AbstractDynPageHandler {
//对应的数据集定义
PageDataset pageDataSet = LCSingleHelper.findCardDataset(datasets);
//读取待保存的bean
DefaultEntity bean = readBeanFromPage(pageDataSet, data);
T bean = readBeanFromPage(pageDataSet, data);
if (filter != null && bean.isNew()) {//有过滤条件,将关联的值设上
setLinkValue(pageDataSet, bean, f -> filter.get(f.name));
}
@@ -84,7 +84,7 @@ public class LCSingleSaveHandler extends AbstractDynPageHandler {
* @param data
* @return
*/
protected DefaultEntity readBeanFromPage(PageDataset pageDataSet, SwMap pageData) {
protected T readBeanFromPage(PageDataset pageDataSet, SwMap pageData) {
ModelTable table = ModelTableCache.getInstance().get(pageDataSet.masterTable);
if (table == null) throw new BizException("没有找到待保存的表定义:" + pageDataSet.name);

@@ -95,8 +95,8 @@ public class LCSingleSaveHandler extends AbstractDynPageHandler {

long id = data.readLong(table.getIdField());

EntityDao<DefaultEntity> dao = DbEngine.getInstance().findDao(table.getName());
DefaultEntity bean;
EntityDao<T> dao = DbEngine.getInstance().findDao(table.getName());
T bean;
if (id <= 0L) {
bean = dao.createBean();
bean.setIsNew(true);
@@ -121,7 +121,7 @@ public class LCSingleSaveHandler extends AbstractDynPageHandler {
*
* @param bean
*/
protected void checkBean(DefaultEntity bean) {
protected void checkBean(T bean) {
ModelTable table = ModelTableCache.getInstance().getByName(bean.getTableName());
for (ModelField field : table.getFields()) {
String value = bean.getStr(field.getName());
@@ -139,7 +139,7 @@ public class LCSingleSaveHandler extends AbstractDynPageHandler {
}
}
//唯一键校验
EntityDao<DefaultEntity> dao = DbEngine.getInstance().findDao(bean.getTableName());
EntityDao<T> dao = DbEngine.getInstance().findDao(bean.getTableName());
for (ModelIndex mi : table.getIndexes()) {
if (mi.isUnique()) {
dao.checkUnique(bean, mi.getFields().split(","));
@@ -147,9 +147,9 @@ public class LCSingleSaveHandler extends AbstractDynPageHandler {
}
}

protected void saveBean(DefaultEntity bean) {
protected void saveBean(T bean) {
final String tableName = bean.getTableName();
EntityDao<DefaultEntity> dao = DbEngine.getInstance().findDao(tableName);
EntityDao<T> dao = DbEngine.getInstance().findDao(tableName);
if (bean.isNew()) {
dao.insertEntity(bean);
} else {
@@ -159,18 +159,18 @@ public class LCSingleSaveHandler extends AbstractDynPageHandler {

dao.updateEntity(bean);
if (table.getType() == SwEnum.TableType.TYPE_TREE.value) {
List<DefaultEntity> listTreeBean = TreeHelper.getTreeHelper(tableName).resetTreeLevel(bean);
List<T> listTreeBean = TreeHelper.getTreeHelper(tableName).resetTreeLevel(bean);
mapTreeBean.put(tableName, listTreeBean);
}
}
}

protected void afterCommit(DefaultEntity bean) {
protected void afterCommit(T bean) {
final String tableName = bean.getTableName();
ModelTable table = ModelTableCache.getInstance().getByName(tableName);
if (table.isNeedCache()) {
AbstractCache<DefaultEntity> cache = CacheManager.getIntance().getCache(tableName);
List<DefaultEntity> listTreeBean = mapTreeBean.get(tableName);
List<T> listTreeBean = mapTreeBean.get(tableName);
//树型表,父亲改变了,要多处理下缓存;还有个东东:级次码
if (listTreeBean != null && !listTreeBean.isEmpty()) {
for (DefaultEntity b : listTreeBean) {
@@ -182,17 +182,17 @@ public class LCSingleSaveHandler extends AbstractDynPageHandler {
}
}

protected void afterRollback(DefaultEntity bean) {
protected void afterRollback(T bean) {
final String tableName = bean.getTableName();
ModelTable table = ModelTableCache.getInstance().getByName(tableName);
if (table.isNeedCache()) {
AbstractCache<DefaultEntity> cache = CacheManager.getIntance().getCache(tableName);
AbstractCache<T> cache = CacheManager.getIntance().getCache(tableName);
cache.reset(bean);
}
}

//将关联的值设上
protected void setLinkValue(PageDataset pageDataSet, DefaultEntity bean, IGetValue iGetValue) {
protected void setLinkValue(PageDataset pageDataSet, T bean, IGetValue iGetValue) {
ModelTable table = ModelTableCache.getInstance().getByName(bean.getTableName());
for (PageDatasetFilter f : pageDataSet.filters) {
String v = bean.getStr(f.field);


+ 15
- 3
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleService.java 查看文件

@@ -27,15 +27,27 @@ public class LCSingleService extends DynPageService {
case TYPE_MODEL_LIST:
case TYPE_MODEL_LOAD:
case TYPE_MODEL_ADD:
return new LCSingleLoadHandler();
return getLoadHandler();
case TYPE_MODEL_SAVE:
return new LCSingleSaveHandler();
return getSaveHandler();
case TYPE_MODEL_DEL:
return new LCSingleDelHandler();
return getDelHandler();
}
return super.createHandler(type);
}

protected LCSingleSaveHandler getSaveHandler() {
return new LCSingleSaveHandler();
}

protected LCSingleLoadHandler getLoadHandler() {
return new LCSingleLoadHandler();
}

protected LCSingleDelHandler getDelHandler() {
return new LCSingleDelHandler();
}

//保存
public R modelSave(@SwBody SwMap params, UserSession us) {
return pageHandler(params, us, TYPE_MODEL_SAVE, handler -> ((LCSingleSaveHandler)handler).save());


+ 1
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/base/billFlow/BillFlowCache.java 查看文件

@@ -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));
}
}

+ 55
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/base/billType/BillType.java 查看文件

@@ -0,0 +1,55 @@
package cc.smtweb.system.bpm.web.sys.base.billType;

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-25 18:13:32
* 实体【[单据类型](SYS_BILL_TYPE)】的Entity类
*/
@SwTable("SYS_BILL_TYPE")
public class BillType extends DefaultEntity {
public static final String ENTITY_NAME = "SYS_BILL_TYPE";

public BillType() {
super(ENTITY_NAME);
}

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

/** 主键 */
public void setId(long sbtp_id) {
put("sbtp_id", sbtp_id);
}
/** 编码 */
public String getCode() {
return getStr("sbtp_code");
}

/** 编码 */
public void setCode(String sbtp_code) {
put("sbtp_code", sbtp_code);
}
/** 名称 */
public String getName() {
return getStr("sbtp_name");
}

/** 名称 */
public void setName(String sbtp_name) {
put("sbtp_name", sbtp_name);
}
/** 备注 */
public String getRemark() {
return getStr("sbtp_remark");
}

/** 备注 */
public void setRemark(String sbtp_remark) {
put("sbtp_remark", sbtp_remark);
}
}

+ 34
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/base/billType/BillTypeCache.java 查看文件

@@ -0,0 +1,34 @@
package cc.smtweb.system.bpm.web.sys.base.billType;

import cc.smtweb.framework.core.annotation.SwCache;
import cc.smtweb.framework.core.cache.AbstractEntityCache;
import cc.smtweb.framework.core.cache.CacheManager;

/**
* Created by 1 at 2022-08-25 18:13:32
* 实体【[单据类型](SYS_BILL_TYPE)】的缓存类
*/
@SwCache(ident = "SYS_BILL_TYPE", title = "单据类型")
public class BillTypeCache extends AbstractEntityCache<BillType> {
//缓存key:按编码
public final static String mk_code = "code";

public static BillTypeCache getInstance() {
return CacheManager.getIntance().getCache(BillTypeCache.class);
}

public BillTypeCache() {
//缓存key:按编码
regMap(mk_code, "sbtp_code");
}

//缓存key:按编码
public final BillType getByCode(String key) {
return getByKey(mk_code, key);
}

public String getName(long id) {
BillType bean = get(id);
return bean != null ? bean.getName() : String.valueOf(id);
}
}

+ 21
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/base/billType/BillTypeSaveHandler.java 查看文件

@@ -0,0 +1,21 @@
package cc.smtweb.system.bpm.web.sys.base.billType;

import cc.smtweb.framework.core.db.impl.DefaultEntity;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleSaveHandler;
import org.apache.commons.lang3.StringUtils;

/**
* Created by Akmm at 2022-08-25 19:11
*/
public class BillTypeSaveHandler extends LCSingleSaveHandler<BillType> {
//id=code
@Override
protected void setNewId(BillType bean) {
if (StringUtils.isEmpty(bean.getCode())) {
throw new BizException("编码不能为空!");
}

bean.setId(Long.parseLong(bean.getCode()));
}
}

+ 30
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/base/billType/BillTypeService.java 查看文件

@@ -0,0 +1,30 @@
package cc.smtweb.system.bpm.web.sys.base.billType;

import cc.smtweb.framework.core.annotation.SwBody;
import cc.smtweb.framework.core.annotation.SwService;
import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.mvc.service.DefaultComboHandler;
import cc.smtweb.system.bpm.web.engine.dynPage.DynPageService;
import cc.smtweb.framework.core.mvc.service.AbstractHandler;
import cc.smtweb.framework.core.session.UserSession;
import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleSaveHandler;
import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleService;

/**
* Created by 1 at 2022-08-25 18:44:57
* 页面【[单据类型列表]的服务类
*/
@SwService
public class BillTypeService extends LCSingleService {
@Override
protected AbstractHandler createHandler(String type) {
if (TYPE_COMBO.equals(type)) return new DefaultComboHandler<BillType>(BillType.ENTITY_NAME);
return super.createHandler(type);
}

@Override
protected LCSingleSaveHandler getSaveHandler() {
return new BillTypeSaveHandler();
}
}

+ 358
- 0
smtweb-framework/bpm/src/main/resources/static/template/default/model_card_flow.ftl 查看文件

@@ -0,0 +1,358 @@
{
"version": 6,
"form": [
{
"page": {
"id": "id${newId()}",
"type": "fx-page",
"props": {
"title": "编辑",
"key": "${newId()}",
"tipsExpand": false
}
},
"graph": {
"shape": "panel",
"id": "root_panel",
"type": "fx-split-panel",
"props": {
"horizontal": false,
"shadow": "",
"scroll": false,
"size": "",
"name": "s0"
},
"children": [
{
"id": "${newId()}",
"type": "fx-split-panel",
"shape": "panel",
"props": {
"size": "50",
"horizontal": true,
"scroll": false,
"name": "s11"
},
"children": [
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"alignY": "center",
"size": "200",
"paddingLeft": 20
},
"children": [
{
"id": "${newId()}",
"type": "fx-title",
"props": {
"label": "${title}",
"showPrefix": true
}
}
]
},
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"alignY": "center",
"paddingRight": 20
},
"children": [
{
"id": "${newId()}",
"type": "fx-button-group",
"props": {
"menus": [],
"textAlign": "right"
},
"slots": {
"default": [
{
"type": "fx-button",
"props": {
"label": "删除",
"leftIcon": "delete",
"type": "",
"action": "button:remove"
},
"id": "${newId()}"
},
{
"id": "${newId()}",
"type": "fx-button",
"props": {
"label": "新增",
"type": "primary",
"linkType": "curr",
"leftIcon": "plus"
}
},
{
"id": "id182e345bb7b",
"type": "fx-button",
"props": {
"label": "返回",
"type": "success",
"size": "default",
"preAction": "",
"action": "button:return",
"leftIcon": "list-top"
},
"events": {}
}
]
}
}
]
}
]
},
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "0"
},
"children": [
{
"id": "${newId()}",
"type": "fx-divider",
"props": {
"label": "",
"contentPosition": "center",
"direction": "horizontal"
}
}
]
},
{
"id": "${newId()}",
"type": "fx-split-panel",
"shape": "panel",
"props": {
"size": "",
"horizontal": false,
"scroll": true,
"name": "s12"
},
"children": [
{
<#list layout.card as group>
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "0",
<#if param.col lte 1>
"gridTemplateColumns": "1fr 2fr",
<#elseif param.col gte 2>
"gridTemplateColumns": "1fr 1fr 1fr",
</#if>
"paddingTop": 32
},
<#assign fields = group.fields>
"children": [
<#list fields as field>
{
"id": "id${newId()}",
<#if (field.readonly = true)>
"type": "fx-text",
<#else>
"type": "${field.editor}",
</#if>
"props": {
"label": "${field.label}",
"type": "text",
"dataset": "${field.dataset}",
"required": "${field.required}",
"field": "${field.id}",
<#if field.maxlength gt 0>
"maxlength": ${field.maxlength},
</#if>
"placeholder": "请输入内容",
<#if (param.col = 2)>
"tips": "${field.desc}",
</#if>
"labelWidth": 100,
<#if (field.readonly = true)>
"readonly": true,
<#else>
"readonly": false,
</#if>
"affixError": true
},
"events": {}
}
<#if field_has_next>
<#if (param.col lte 1 )>
<#if (field.desc != "")>
,{
"id": "id181d83cdb41",
"type": "fx-label",
"props": {
"label": "${field.desc}",
"labelWidth": 0,
"affixError": true,
"labelAlign": "left"
}
}
<#else>
,{
"id": "id${newId()}",
"type": "fx-placeholder",
"props": {
"label": "占位"
},
"layout": {
"row": 1
}
}
</#if>
</#if>
<#if (param.col = 2 && ((field_index+1) % 2 = 0 ) )>
,{
"id": "id${newId()}",
"type": "fx-placeholder",
"props": {
"label": "占位"
},
"layout": {
"row": 1
}
}
</#if>
,
</#if>
</#list>
]
</#list>
},
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"name": "d2"
},
"children": []
}
]
},
{
"id": "182e345bb14",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "10",
"backgroundColor": "--color-transparent"
},
"children": []
},
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "50",
"alignY": "center",
"alignX": "center"
},
"children": [
{
"id": "${newId()}",
"type": "fx-button-group",
"props": {
"menus": []
},
"slots": {
"default": [
{
"type": "fx-button",
"props": {
"label": "保存并新增",
"type": "primary",
"action": "button:saveAndAdd",
"linkType": "curr"
},
"id": "${newId()}"
},
{
"type": "fx-button",
"props": {
"label": "保存",
"leftIcon": "save",
"type": "success",
"action": "button:save"
},
"id": "${newId()}"
},{
"type": "fx-button",
"props": {
"label": "提交",
"leftIcon": "save",
"type": "success",
"action": "button:submit"
},
"id": "${newId()}"
},{
"type": "fx-button",
"props": {
"label": "取回",
"leftIcon": "save",
"type": "success",
"action": "button:retake"
},
"id": "${newId()}"
},{
"type": "fx-button",
"props": {
"label": "驳回",
"leftIcon": "save",
"type": "success",
"action": "button:reject"
},
"id": "${newId()}"
},{
"type": "fx-button",
"props": {
"label": "作废",
"leftIcon": "save",
"type": "success",
"action": "button:cancel"
},
"id": "${newId()}"
},{
"type": "fx-button",
"props": {
"label": "终止",
"leftIcon": "save",
"type": "success",
"action": "button:interrupt"
},
"id": "${newId()}"
}
]
}
}
]
}
]
}
}
],
"model": [
<#list datasets as dataset>
<#include "incModel/inc_model.ftl"/><#if dataset_has_next>,</#if>
</#list>
],
"option": {
"widgetRef": [${widgetRef}],
"vars": []
}
}

+ 109
- 0
smtweb-framework/bpm/src/main/resources/static/template/default/model_list_flow.ftl 查看文件

@@ -0,0 +1,109 @@
{
<#list layout.list as group>
"form":
[
{
"page": {
"id": "p${newId()}",
"type": "fx-page",
"props": {
"title": "${title}",
"key": "${newId()}"
}
},
"graph": {
"shape": "panel",
"id": "root_panel",
"type": "fx-split-panel",
"props": {
"horizontal": false,
"shadow": ""
},
"children": [
<#if (group.cfilters?size>0)>
<#include "incModel/inc_list_query.ftl"/>
</#if>
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "50",
"label": "查询条件",
"colNum": 2,
"alignY": "center",
"paddingLeft": 20,
"paddingRight": 20,
"shadow": ""
},
"children": [
{
"id": "id${newId()}",
"type": "fx-title",
"props": {
"label": "${title}",
"fontSize": 15,
"color": "#313131",
"fontWeight": "bold",
"showPrefix": true,
"prefixWidth": 5,
"prefixHeight": 15,
"prefixColor": "#1E90FF"
}
},
{
"id": "id${newId()}",
"type": "fx-button-group",
"props": {
"menus": [],
"textAlign": "right"
},
"slots": {
"default": [
{
"id": "id${newId()}",
"type": "fx-button",
"props": {
"label": "新增",
"leftIcon": "plus",
"type": "primary",
"action": "button:addCard",
"link": false,
"linkType": "",
"fxLink": ""
}
}
]
}
}
]
},
<#include "incModel/inc_list_table.ftl"/>
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "15",
"backgroundColor": "transparent"
},
"children": []
}
]
}
}
<#if (group.sfilters?size>0)>
<#include "incModel/inc_query_sfilters.ftl"/>
</#if>
],
</#list>
"model": [
<#list datasets as dataset>
<#include "incModel/inc_model.ftl"/><#if dataset_has_next>,</#if>
</#list>
],
"option": {
"widgetRef": [${widgetRef}],
"vars": []
}
}

+ 3
- 0
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/common/SwConsts.java 查看文件

@@ -28,6 +28,9 @@ public interface SwConsts {
String PARAM_ROWS = "rows";
String TOTAL_KEY = "total_count";
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";


+ 1
- 0
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/common/SwEnum.java 查看文件

@@ -343,6 +343,7 @@ public interface SwEnum {
public static StrEnumBean LC_LT = instance.addEnum("LC_LT", "列表卡片(左树+列表)");
public static StrEnumBean LC_MS = instance.addEnum("LC_MS", "列表卡片(主子表)");
public static StrEnumBean LC_LT_MS = instance.addEnum("LC_LT_MS", "列表卡片(左树+列表+主子表)");
public static StrEnumBean LC_FLOW = instance.addEnum("LC_FLOW", "列表卡片(含工作流)");
}

// 权限类型


+ 1
- 0
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/db/EntityDao.java 查看文件

@@ -359,6 +359,7 @@ public class EntityDao<T> extends AbstractEntityDao<T> {
* 查询对象所有数据,返回列表
*/
public List<T> query(String fields) {
if (StringUtils.isEmpty(fields) && columns.isEmpty()) return null;
StringBuilder sb = new StringBuilder();
handleSelect(sb, fields);



+ 7
- 6
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/db/EntityHelper.java 查看文件

@@ -2,6 +2,7 @@ package cc.smtweb.framework.core.db;

import cc.smtweb.framework.core.cache.AbstractCache;
import cc.smtweb.framework.core.cache.CacheManager;
import cc.smtweb.framework.core.common.SwConsts;
import cc.smtweb.framework.core.common.SwEnum;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.db.cache.ModelTableCache;
@@ -129,7 +130,7 @@ public class EntityHelper {
String sn = (String) dao.readValue(b, l.getLinkNameField());
if (StringUtils.isNotEmpty(sn)) names += "," + sn;
}
bean.put(fieldName + "_text", names.length() > 1 ? names.substring(1) : "");
bean.put(fieldName + SwConsts.TEXT_SUFFIX, names.length() > 1 ? names.substring(1) : "");
} else {
List<String> list = mapIds.computeIfAbsent(l.getLinkTable().getName(), k -> new ArrayList<>());
Collections.addAll(list, ids);
@@ -160,7 +161,7 @@ public class EntityHelper {
String sn = mapV.get(sId);
if (StringUtils.isNotEmpty(sn)) names += "," + sn;
}
bean.put(fieldName + "_text", names.substring(1));
bean.put(fieldName + SwConsts.TEXT_SUFFIX, names.substring(1));
}
}

@@ -189,7 +190,7 @@ public class EntityHelper {
final String fieldName = getFieldAlias(mapFieldAlias, field.getName());
String value = bean.readString(fieldName);
if (StringUtils.isNotEmpty(value)) {
bean.put(fieldName + "_text", formatter.format(value));
bean.put(fieldName + SwConsts.TEXT_SUFFIX, formatter.format(value));
}
}
}
@@ -223,9 +224,9 @@ public class EntityHelper {
if (StringUtils.isNotEmpty(sn)) names += "," + sn;
}
if (StringUtils.isNotEmpty(names)) {
row.put(fieldName + "_text", names.substring(1));
row.put(fieldName + SwConsts.TEXT_SUFFIX, names.substring(1));
} else {
row.put(fieldName + "_text", "");
row.put(fieldName + SwConsts.TEXT_SUFFIX, "");
}
} else {
List<Long> list = mapIds.computeIfAbsent(l.getLinkTable().getName(), k -> new ArrayList<>());
@@ -259,7 +260,7 @@ public class EntityHelper {
String sn = mapV.get(sId);
if (StringUtils.isNotEmpty(sn)) names += "," + sn;
}
row.put(fieldName + "_text", names.substring(1));
row.put(fieldName + SwConsts.TEXT_SUFFIX, names.substring(1));
}
}
}


+ 1
- 0
smtweb-framework/core/src/main/resources/流程定义.json 查看文件

@@ -539,6 +539,7 @@
"label": "活动名称",
"page": "表单定义",
"canEdit": "是否可编辑",
"canEnd": "不同意时,允许直接结束 true/false",
"needSign": "是否需要会签",
"buttons": [
{


Loading…
取消
儲存