Просмотр исходного кода

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

4.0
ht 2 лет назад
Родитель
Сommit
8541bed84d
35 измененных файлов: 767 добавлений и 509 удалений
  1. +5
    -2
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/flow/FlowConst.java
  2. +0
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/flow/ModelProcHelper.java
  3. +2
    -2
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/flow/ModelProcSaveHandler.java
  4. +5
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/CodeBuildHandler.java
  5. +4
    -8
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormSaveHandler.java
  6. +3
    -3
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageDelHandler.java
  7. +3
    -4
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageSaveHandler.java
  8. +5
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowHelper.java
  9. +261
    -146
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowInstance.java
  10. +12
    -2
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowProvider.java
  11. +91
    -62
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/Task.java
  12. +17
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleService.java
  13. +33
    -5
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowTransHandler.java
  14. +2
    -2
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/AbsDelHandler.java
  15. +2
    -2
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/AbsSaveHandler.java
  16. +2
    -2
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/mastersub/LCMsDelHandler.java
  17. +2
    -2
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/mastersub/LCMsSaveHandler.java
  18. +2
    -11
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleDelHandler.java
  19. +2
    -2
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleSaveHandler.java
  20. +3
    -3
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/menuPlan/MenuPlanHandler.java
  21. +4
    -4
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/user/UserHandler.java
  22. +223
    -73
      smtweb-framework/bpm/src/main/resources/static/template/default/model_card_flow.ftl
  23. +20
    -104
      smtweb-framework/bpm/src/main/resources/static/template/default/model_card_ms.ftl
  24. +2
    -29
      smtweb-framework/bpm/src/main/resources/static/template/default/model_card_normal.ftl
  25. +12
    -8
      smtweb-framework/bpm/src/main/resources/static/template/default/model_list_list_1.ftl
  26. +15
    -11
      smtweb-framework/bpm/src/main/resources/static/template/default/model_list_list_2.ftl
  27. +1
    -1
      smtweb-framework/bpm/src/main/resources/static/template/java_bean.ftl
  28. +2
    -1
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/db/jdbc/AbsDbWorker.java
  29. +3
    -3
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/db/jdbc/IDbWorker.java
  30. +8
    -0
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/db/jdbc/ISimpleWorker.java
  31. +13
    -3
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/db/jdbc/JdbcEngine.java
  32. +2
    -4
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractDelHandler.java
  33. +2
    -2
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractSaveHandler.java
  34. +3
    -4
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/mvc/service/DefaultSaveHandler.java
  35. +1
    -1
      smtweb-framework/core/src/main/resources/流程定义.json

+ 5
- 2
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/flow/FlowConst.java Просмотреть файл

@@ -66,9 +66,12 @@ 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 INTERRUPT = instance.addEnum(7, "已中止");
public static IntEnumBean DISUSE = instance.addEnum(8, "已作废");
public static IntEnumBean REJECT = instance.addEnum(9, "已驳回");
//并发流程中,因其他任务被驳回,导致该任务的停止
public static IntEnumBean STOP = instance.addEnum(6, "已停止");
}

/**
@@ -79,7 +82,7 @@ public interface FlowConst {
public static IntEnumBean BEGIN = instance.addEnum(1, "制单");
public static IntEnumBean RUNING = instance.addEnum(2, "审批中");
public static IntEnumBean FINISH = instance.addEnum(99, "生效");
public static IntEnumBean ABORTED = instance.addEnum(98, "中止");
public static IntEnumBean INTERRUPT = instance.addEnum(98, "中止");
public static IntEnumBean DISUSE = instance.addEnum(89, "作废");
}



+ 0
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/flow/ModelProcHelper.java Просмотреть файл

@@ -130,7 +130,6 @@ public class ModelProcHelper {
return listRet;
}


/**
* 获取流程定义属性值
*


+ 2
- 2
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/flow/ModelProcSaveHandler.java Просмотреть файл

@@ -5,7 +5,7 @@ import cc.smtweb.framework.core.common.SwEnum;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.EntityDao;
import cc.smtweb.framework.core.db.cache.ModelTableCache;
import cc.smtweb.framework.core.db.jdbc.AbsDbWorker;
import cc.smtweb.framework.core.db.jdbc.IDbWorker;
import cc.smtweb.framework.core.db.vo.ModelField;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.exception.BizException;
@@ -65,7 +65,7 @@ public class ModelProcSaveHandler extends DefaultSaveHandler<ModelProc> {
throw new BizException("没有待保存的数据!");
}
bean.setContent(data);
DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
EntityDao<ModelProc> dao = DbEngine.getInstance().findDao(tableName);


+ 5
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/CodeBuildHandler.java Просмотреть файл

@@ -184,7 +184,11 @@ public class CodeBuildHandler extends AbstractHandler {
fields.add(fn);
fn.put("name", field.getName());
fn.put("title", field.getTitle());
fn.put("javaName", CodeGenUtil.getBeanName(field.getName()));
String javaName = CodeGenUtil.getBeanName(field.getName());
if (SwEnum.DataType.BOOL.value.equals(field.getDataType()) && javaName.startsWith("Is")) {
javaName = javaName.substring(2);
}
fn.put("javaName", javaName);
SwEnum.DataTypeBean dtb = SwEnum.DataType.instance.getByValue(field.getDataType());
fn.put("javaType", dtb.javaType);
fn.put("shortJavaType", dtb.shortJavaType);


+ 4
- 8
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormSaveHandler.java Просмотреть файл

@@ -2,23 +2,19 @@ package cc.smtweb.system.bpm.web.design.form;

import cc.smtweb.framework.core.common.R;
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.db.cache.ModelTableCache;
import cc.smtweb.framework.core.db.jdbc.AbsDbWorker;
import cc.smtweb.framework.core.db.jdbc.IDbWorker;
import cc.smtweb.framework.core.db.vo.ModelField;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.framework.core.mvc.service.DefaultSaveHandler;
import cc.smtweb.framework.core.util.CommUtil;
import cc.smtweb.framework.core.util.JsonUtil;
import cc.smtweb.system.bpm.web.design.form.model.ModelFactory;
import org.apache.commons.lang3.StringUtils;

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

/**
* Created by Akmm at 2022/5/9 17:05
@@ -81,7 +77,7 @@ public class ModelFormSaveHandler extends DefaultSaveHandler<ModelForm> {
throw new BizException("没有待保存的数据!");
}
bean.setDataset(ModelFormHelper.buildSaveDataset(data));
DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
EntityDao<ModelForm> dao = DbEngine.getInstance().findDao(tableName);
@@ -113,7 +109,7 @@ public class ModelFormSaveHandler extends DefaultSaveHandler<ModelForm> {
throw new BizException("没有待保存的数据!");
}
bean.setContent(ModelFormHelper.buildSaveModel(bean, data));
DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
EntityDao<ModelForm> dao = DbEngine.getInstance().findDao(tableName);
@@ -149,7 +145,7 @@ public class ModelFormSaveHandler extends DefaultSaveHandler<ModelForm> {
//先构建一次,防止有错
String ret = ModelFormHelper.buildReqModel(bean);
// ModelFormHelper.buildSaveModelByTmpl(bean, templateId);
DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
EntityDao<ModelForm> dao = DbEngine.getInstance().findDao(tableName);


+ 3
- 3
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageDelHandler.java Просмотреть файл

@@ -9,7 +9,7 @@ import cc.smtweb.framework.core.db.EntityDao;
import cc.smtweb.framework.core.db.EntityHelper;
import cc.smtweb.framework.core.db.cache.ModelTableCache;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
import cc.smtweb.framework.core.db.jdbc.AbsDbWorker;
import cc.smtweb.framework.core.db.jdbc.IDbWorker;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.system.bpm.web.design.form.define.PageDataset;
@@ -39,7 +39,7 @@ public class DynPageDelHandler extends AbstractDynPageHandler {

checkBean(pageDataSet, id);

DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
ModelTable table = ModelTableCache.getInstance().get(pageDataSet.masterTable);
@@ -107,7 +107,7 @@ public class DynPageDelHandler extends AbstractDynPageHandler {
info.ids.addAll(list);
}
}
DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
for (RemovableInfo info : mapRemovableInfo.values()) {


+ 3
- 4
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageSaveHandler.java Просмотреть файл

@@ -9,12 +9,11 @@ import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.EntityDao;
import cc.smtweb.framework.core.db.cache.ModelTableCache;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
import cc.smtweb.framework.core.db.jdbc.AbsDbWorker;
import cc.smtweb.framework.core.db.jdbc.IDbWorker;
import cc.smtweb.framework.core.db.vo.ModelField;
import cc.smtweb.framework.core.db.vo.ModelIndex;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.framework.core.mvc.service.DefaultSaveHandler;
import cc.smtweb.framework.core.mvc.service.TreeHelper;
import cc.smtweb.framework.core.util.StringUtil;
import cc.smtweb.system.bpm.web.design.form.define.PageDataset;
@@ -55,7 +54,7 @@ public class DynPageSaveHandler extends AbstractDynPageHandler {
}
checkBean(bean);

DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
saveBean(bean);
@@ -108,7 +107,7 @@ public class DynPageSaveHandler extends AbstractDynPageHandler {
}
checkBean(bean);
}
DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
for (DefaultEntity bean : map.values()) {


+ 5
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowHelper.java Просмотреть файл

@@ -47,6 +47,11 @@ public class FlowHelper {
" where r.trl_dst_task_id=? and t.tsk_handler=?", task_id, user_id);
}

public static void stopTask(long billId) {
DbEngine.getInstance().update("update " + EntityHelper.getSchemaTableName(Task.ENTITY_NAME) +
" set tsk_statu=? where tsk_pri_id=? and tsk_statu<?", FlowConst.ActivityStatu.STOP.value, billId, FlowConst.ActivityStatu.SUBMIT.value);
}

/**
* 得到指定活动的下一任务节点
*


+ 261
- 146
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowInstance.java Просмотреть файл

@@ -1,5 +1,6 @@
package cc.smtweb.system.bpm.web.engine.flow;

import cc.smtweb.framework.core.common.AbstractEnum;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.EntityDao;
@@ -9,6 +10,7 @@ import cc.smtweb.framework.core.exception.SwException;
import cc.smtweb.framework.core.session.UserSession;
import cc.smtweb.framework.core.util.CommUtil;
import cc.smtweb.framework.core.util.DateUtil;
import cc.smtweb.framework.core.util.MathUtil;
import cc.smtweb.framework.core.util.NumberUtil;
import cc.smtweb.system.bpm.web.design.flow.FlowConst;
import cc.smtweb.system.bpm.web.design.flow.ModelProc;
@@ -16,6 +18,7 @@ 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.engine.flow.entity.*;
import cc.smtweb.system.bpm.web.sys.base.billFlow.BillFlow;
import cc.smtweb.system.bpm.web.sys.user.dept.Dept;
import cc.smtweb.system.bpm.web.sys.user.dept.DeptCache;
import cc.smtweb.system.bpm.web.sys.user.party.Party;
@@ -157,7 +160,7 @@ public class FlowInstance {
*
* @throws Exception
*/
public void handler() {
public void handle() {
long user_id = us.getUserId();
//校验权限,当前人员有权限干不,没权限直接抛异常
// checkPermission();
@@ -255,7 +258,6 @@ public class FlowInstance {
//获取当前单据活动任务列表及当前任务
// act_inst = null;
List<Task> list = provider.findCurTask(procInst.getId());
listTask.addAll(list);
//当前登录用户
String sqlIn = "";
for (Task act : list) {
@@ -301,6 +303,8 @@ public class FlowInstance {
actInst = provider.findTask(procInst.getTaskId());
}

listTask.addAll(list);

return listTask;
}

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

List<Task> listTask = adjustTasks();
//可选步骤
@@ -361,101 +365,83 @@ public class FlowInstance {
index++;
}
extra.put("tasks", tasks);
resetButtons();

//前置动作
if (!actInst.isMake()) {
//前置动作
listTask = provider.findBeforeTasks(actInst.getId());
if (CommUtil.isEmpty(listTask)) throw new SwException("未发现前置动作!");
List<SwMap> bTasks = new ArrayList<>();
boolean hasMake = false;
for (Task act : listTask) {
SwMap row = new SwMap();
bTasks.add(row);
row.put("id", act.getId());
row.put("label", procDef.getProcInfo().getActNameById(act.getActId()));
if (act.isMake()) {
row.put("type", 0);
hasMake = true;
} else {
row.put("type", 1);
}
}
if (!hasMake && procDef.getProcInfo().isRejectToMake()) {
SwMap row = new SwMap();
bTasks.add(0, row);
Task act = provider.findMakeTask(procInst.getId());
row.put("id", act.getId());
row.put("label", procDef.getProcInfo().getActNameById(act.getActId()));
row.put("type", 0);
}
extra.put("preTasks", bTasks);
}

List<SwMap> buttons = new ArrayList<>();
resetButtons(buttons);
extra.put("buttons", buttons);
}

private SwMap createButton(AbstractEnum.StrEnumBean type, boolean valid) {
SwMap button = new SwMap();
button.put("type", type.value);
button.put("label", type.name);
button.put("valid", valid);
return button;
}

public void resetButtons() {
Map<String, Integer> buttons = new HashMap<>();
public void resetButtons(List<SwMap> buttons) {
//按钮
buttons.clear();
long user_id = us.getUserId();
/*
//菜单权限
Map<String, String> mapPermisson = MenuHelper.getPermission(context);
//新增不要显示历史
boolean isNew = opt_mode == FlowConst.OperatorType.NEW;
boolean isAdmin = UserBaseEntityBuffer.getInstance().isAdmin(user_id);
boolean canEdit = MenuHelper.hasPermisson(mapPermisson, FlowConst.MenuFuncRight.ADD.value) || MenuHelper.hasPermisson(mapPermisson, FlowConst.MenuFuncRight.UPD.value);
boolean isNew = procDef.isNew();
boolean isFinish = procInst.getStatu() > FlowConst.InstanceStatu.RUNING.value;
//能否新增,菜单有授权+单据有流程分配
boolean canAdd = canEdit && BillFlowWfHelper.getBillProc(procInst.getBillType(), user_id) != null;
boolean canDel = MenuHelper.hasPermisson(mapPermisson, FlowConst.MenuFuncRight.DEL.value);
boolean canDis = MenuHelper.hasPermisson(mapPermisson, FlowConst.MenuFuncRight.DIS.value) && canEdit && !isNew;
//非制单人能否修改单据
boolean othCanEdit = BillFlowWfHelper.getPropBool(procDef.getEntityId(), FlowConst.NULL_STR, FlowConst.ProcProperty.CAN_EDIT_OTHER);

buttons.put(FlowConst.Button.LOG, isNew ? 0 : 1);
buttons.put(FlowConst.Button.WORD, isNew || !MenuHelper.hasPermisson(mapPermisson, FlowConst.MenuFuncRight.EXP.value) ? 0 : 1);
buttons.put(FlowConst.Button.EXCEL, isNew || !MenuHelper.hasPermisson(mapPermisson, FlowConst.MenuFuncRight.EXP.value) ? 0 : 1);
buttons.put(FlowConst.Button.DEL, !isNew ? 1 : 0);
buttons.put(FlowConst.Button.ADD, canAdd ? 1 : 0);
//buttons.put(FlowConst.Button.DISUSE, canDis ? 1 : 0);
buttons.put(FlowConst.Button.DISUSE, 0);

//单据作废
if (procInst.getStatu() == FlowConst.InstanceStatu.DISUSE.value) {
buttons.put(FlowConst.Button.DISUSE, 0);
buttons.put(FlowConst.Button.DEL, 0);
context.getDfpResponse().put("buttons", buttons);
return;
}
if (procInst.getStatu() == FlowConst.InstanceStatu.FINISH.value) {
buttons.put(FlowConst.Button.DEL, 0);
}
ActivityEntity act = ActivityEntityBuffer.getInstance().get(actInst.getActId());
//非制单状态时 编辑权限受 功能权限+流程修改权限+流程节点修改权限
boolean notMakeEdit = act != null && act.getActEdit() && othCanEdit && MenuHelper.hasPermisson(mapPermisson, FlowConst.MenuFuncRight.UPD.value);
boolean handler_make = isHandleMakeEx(act);

//当前任务是我办理的(我的待办任务,前面读取的时候也已经写了办理人为我了):
if (act == null || act.getType() == FlowConst.ActivityType.END.value) {
if (isAdmin) buttons.put(FlowConst.Button.RETAKE, 1);
buttons.put(FlowConst.Button.DISUSE, 0);
} else if (user_id.equalsIgnoreCase(actInst.getHandler()) || isAdmin) {
if (actInst.getStatu() == FlowConst.ActivityStatu.WAIT.value) {
//待办任务,显示办理按钮
if (notMakeEdit || handler_make) {
buttons.put(FlowConst.Button.HANDLER, 1);
buttons.put(FlowConst.Button.SUBMIT, 0);
} else {
buttons.put(FlowConst.Button.SUBMIT, 1);
buttons.put(FlowConst.Button.REJECT, 1);
buttons.put(FlowConst.Button.REJECT_MAKE, 1);
}
} else if (actInst.getStatu() == FlowConst.ActivityStatu.HANDLE.value) {
buttons.put(FlowConst.Button.SUBMIT, 1);
//办理中任务,提交/驳回
if (actInst.isMake()) {
buttons.put(FlowConst.Button.SAVE, 1);
if (canDel && !isNew) {
buttons.put(FlowConst.Button.DEL, 1);
}
} else {
if (notMakeEdit || handler_make) {
buttons.put(FlowConst.Button.SAVE, 1);
}
buttons.put(FlowConst.Button.REJECT, 1);
buttons.put(FlowConst.Button.REJECT_MAKE, 1);
}
} else if (actInst.getStatu() == FlowConst.ActivityStatu.SUBMIT.value) {
//我已提交的任务,取回(前面已经过滤掉不能取回的任务:下一任务已办理)
buttons.put(FlowConst.Button.RETAKE, 1);
}
} else if (actInst.getStatu() == FlowConst.ActivityStatu.WAIT.value && new ActinstDao().isMyWaitedTask(actInst.getTaskId(), user_id)) {
//待办任务,显示办理按钮
if (notMakeEdit || handler_make) {
buttons.put(FlowConst.Button.HANDLER, 1);
buttons.put(FlowConst.Button.SUBMIT, 0);
} else buttons.put(FlowConst.Button.SUBMIT, 1);
} else if (actInst.isMake() && actInst.getStatu() == FlowConst.ActivityStatu.HANDLE.value && canEdit && BillFlowWfHelper.getPropBool(procDef.getEntityId(), FlowConst.NULL_STR, FlowConst.ProcProperty.CAN_EDIT_OTHER)) {
//不是我的任务,制单任务判断属性,是否可以修改他人单据
ProcdefEntity def = BillFlowWfHelper.getBillProc(procInst.getBillType(), user_id);
if (def != null && def.getEntityId().equals(procDef.getEntityId())) {
buttons.put(FlowConst.Button.SAVE, 1);
buttons.put(FlowConst.Button.SUBMIT, 1);
}
}
context.getDfpResponse().put("buttons", buttons);
*/
boolean canAdd = ModelProcHelper.getBillProc(procInst.getBillType(), user_id) != null;
buttons.add(createButton(FlowConst.Button.ADD, canAdd));

boolean canDel = !isFinish && actInst.isMake() && !isNew;
buttons.add(createButton(FlowConst.Button.DEL, canDel));
buttons.add(createButton(FlowConst.Button.DISUSE, !isNew));
buttons.add(createButton(FlowConst.Button.LOG, !isNew));
buttons.add(createButton(FlowConst.Button.WORD, !isNew));
buttons.add(createButton(FlowConst.Button.EXCEL, !isNew));
buttons.add(createButton(FlowConst.Button.SAVE, !isFinish && actInst.isMake() && actInst.getHandler() == user_id));

boolean canHandle = !isFinish && actInst.getStatu() == FlowConst.ActivityStatu.WAIT.value && actInst.getHandler() == user_id;
buttons.add(createButton(FlowConst.Button.HANDLE, canHandle));

boolean canSubmit = !isFinish && actInst.getStatu() < FlowConst.ActivityStatu.SUBMIT.value && actInst.getHandler() == user_id;
buttons.add(createButton(FlowConst.Button.SUBMIT, canSubmit));

boolean canReject = !isFinish && !actInst.isMake() && actInst.getStatu() < FlowConst.ActivityStatu.SUBMIT.value && actInst.getHandler() == user_id;
buttons.add(createButton(FlowConst.Button.REJECT, canReject));
buttons.add(createButton(FlowConst.Button.INTERRUPT, canReject));

//我已提交的任务,取回(前面已经过滤掉不能取回的任务:下一任务已办理)
boolean canRetake = !isFinish && actInst.getStatu() == FlowConst.ActivityStatu.SUBMIT.value && actInst.getHandler() == user_id;
buttons.add(createButton(FlowConst.Button.RETAKE, canRetake));
}

/**
@@ -476,7 +462,10 @@ public class FlowInstance {
}
}

/*public void submitToEnd() {
/**
* 中止,不通过
*/
public void interrupt(String comment) {
long user_id = us.getUserId();
//校验权限,当前人员有权限干不,没权限直接抛异常
checkPermission();
@@ -488,51 +477,53 @@ public class FlowInstance {
throw new BizException("您不是当前任务的办理人,不允许提交");
}
//校验完毕,接下来干活。
List<Activity> new_acts = procDef.getProcInfo().findEndActivity();
if (CommUtil.isEmpty(new_acts)) {
throw new BizException("结束任务为空,不允许提交到结束!");
}
List<Activity> new_acts = getProcDef().getProcInfo().findEndActivity();
if (CommUtil.isEmpty(new_acts)) throw new SwException("该流程无结束节点!");

//待新增任务
List<Task> listInsertTask = new ArrayList<>();
List<TaskRel> listTaskRel = new ArrayList<>();
List<Comment> listTaskComment = new ArrayList<>();
//待新增任务候选人
List<Candidate> listInsertCand = new ArrayList<>();

for (Activity act : new_acts) {
buildTask(act, listInsertTask, listInsertCand, listTaskRel, user_id);
}
//只要一个就行
buildTask(new_acts.get(0), listInsertTask, listInsertCand, listTaskRel, listTaskComment);

actInst.setHandler(user_id);
actInst.setStartTime(DateUtil.nowDateTimeLong());
actInst.setStatu(FlowConst.ActivityStatu.SUBMIT.value);
actInst.setRetake(true);
actInst.setStatu(FlowConst.ActivityStatu.INTERRUPT.value);
actInst.setRetake(false);

if (listInsertTask.size() > 0) {
procInst.setTaskId(listInsertTask.get(0).getEntityId());
procInst.setActName(listInsertTask.get(0).getActName());
} else {
procInst.setTaskId(actInst.getEntityId());
procInst.setActName(actInst.getActName());
}

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.INTERRUPT.value);
procInst.setEndTime(DateUtil.nowDateTimeLong());

//保存入库
if (!listInsertTask.isEmpty()) {
getTaskDao().batchInsertEntity(listInsertTask);
getCandidateDao().batchInsertEntity(listInsertCand);
getTaskRelDao().batchInsertEntity(listTaskRel);

if (!listTaskComment.isEmpty()) {
getCommentDao().batchInsertEntity(listTaskComment);
}
}
getTaskDao().updateEntity(actInst);
getProcInstDao().updateEntity(procInst);

buildBillLog(FlowConst.Button.SUBMIT.value, "TODO", actInst, listInsertTask);
listener.submit(actInst, listInsertTask);
}*/
updateComment(comment, FlowConst.Button.INTERRUPT.value);
buildBillLog(FlowConst.Button.INTERRUPT.value, comment, actInst, listInsertTask);
listener.afterSubmit(actInst, listInsertTask);
}


/**
@@ -608,7 +599,7 @@ public class FlowInstance {
*
* @throws Exception
*/
public void disuse() {
public void disuse(String comment) {
long user_id = us.getUserId();
//校验权限,当前人员有权限干不,没权限直接抛异常
checkPermission();
@@ -629,7 +620,8 @@ public class FlowInstance {
getTaskDao().updateEntity(actInst);
getProcInstDao().updateEntity(procInst);

buildBillLog(FlowConst.Button.DISUSE.value, "TODO", actInst, null);
updateComment(comment, FlowConst.Button.DISUSE.value);
buildBillLog(FlowConst.Button.DISUSE.value, comment, actInst, null);
listener.afterDisuse(actInst);
}

@@ -657,7 +649,7 @@ public class FlowInstance {
task.setSign(false);
task.setReject(false);
task.setRetake(false);
task.setIsAuto(false);
task.setAuto(false);

TaskRel rel = new TaskRel();
rel.setEntityId(DbEngine.getInstance().nextId());
@@ -764,7 +756,7 @@ public class FlowInstance {

taskDao.updateEntity(actInst);
taskDao.batchDelete(new_acts);
getCommentDao().deleteEntity("where cmt_tsk_id in ("+ EntityHelper.getSqlInIds(new_acts) + ")");
getCommentDao().deleteEntity("where cmt_tsk_id in (" + EntityHelper.getSqlInIds(new_acts) + ")");
getTaskRelDao().deleteEntity("where trl_src_task_id=?", actInst.getEntityId());
getProcInstDao().updateEntity(procInst);

@@ -779,7 +771,95 @@ public class FlowInstance {
*
* @throws Exception
*/
public void reject() {
public void reject(String comment, String toTasks) {
if (StringUtils.isEmpty(toTasks)) {
throw new BizException("未指定驳回的目标步骤!");
}
String[] dstTasks = toTasks.split(",");
if (dstTasks.length == 0) throw new BizException("未指定驳回的目标步骤!");

long user_id = us.getUserId();
//校验权限,当前人员有权限干不,没权限直接抛异常
checkPermission();
if (actInst.getStatu() == FlowConst.ActivityStatu.SUBMIT.value) {
throw new BizException("当前任务已经提交,不能驳回!");
}

if (actInst.getStatu() == FlowConst.ActivityStatu.WAIT.value && !FlowHelper.isMyWaitedTask(actInst.getEntityId(), user_id)) {
throw new BizException("您不是当前任务的办理人,不允许驳回!");
}

//待新增任务
List<Task> listInsertTask = new ArrayList<>();
List<TaskRel> listTaskRel = new ArrayList<>();
List<Comment> listTaskComment = new ArrayList<>();
//待新增任务候选人
List<Candidate> listInsertCand = new ArrayList<>();

//校验完毕,接下来干活。
//并发考虑:找到此任务的前置任务,创建对应的新任务,原流程其他未办理任务删除,办理中及已提交的,置为
for (String dstTaskId : dstTasks) {
//rejectTo(comment, NumberUtil.getLongIgnoreErr(dstTaskId), listInsertTask, listTaskRel, listTaskComment, listInsertCand);
long toTaskId = NumberUtil.getLongIgnoreErr(dstTaskId);
Task toTask = provider.findTask(toTaskId);
if (toTask == null) throw new SwException("没有找到驳回目标节点(" + toTaskId + ")!");

buildRejectTask(toTask, listInsertTask, listInsertCand, listTaskRel, listTaskComment);
}
//先停止其他待办或办理中的任务
FlowHelper.stopTask(procInst.getId());
//保存入库
if (!listInsertTask.isEmpty()) {
getTaskDao().batchInsertEntity(listInsertTask);
getCandidateDao().batchInsertEntity(listInsertCand);
getTaskRelDao().batchInsertEntity(listTaskRel);

if (!listTaskComment.isEmpty()) {
getCommentDao().batchInsertEntity(listTaskComment);
}
}
getTaskDao().updateEntity(actInst);
getProcInstDao().updateEntity(procInst);

updateComment(comment, FlowConst.Button.REJECT.value);
buildBillLog(FlowConst.Button.SUBMIT.value, comment, actInst, listInsertTask);
listener.afterSubmit(actInst, listInsertTask);
}

private void buildRejectTask(Task oldTask, List<Task> listInsertTask, List<Candidate> listInsertCand, List<TaskRel> listTaskRel, List<Comment> listTaskComment) {
Task task = new Task();
listInsertTask.add(task);
task.getData().putAll(oldTask.getData());
task.setEntityId(DbEngine.getInstance().nextId());

task.setStatu(FlowConst.ActivityStatu.WAIT.value);
task.setReject(true);

TaskRel rel = new TaskRel();
rel.setEntityId(DbEngine.getInstance().nextId());
rel.setPriId(task.getPriId());
rel.setDstTaskId(task.getId());
rel.setSrcTaskId(actInst.getId());
listTaskRel.add(rel);

Candidate cand = new Candidate();
cand.init();
cand.setEntityId(DbEngine.getInstance().nextId());
cand.setPriId(task.getPriId());
cand.setTskId(task.getId());
cand.setUserId(oldTask.getHandler());

listInsertCand.add(cand);

//创建新的审批意见
listTaskComment.add(createComment(task));
}

private void rejectTo(String comment, long toTaskId, List<Task> listInsertTask, List<TaskRel> listTaskRel, List<Comment> listTaskComment, List<Candidate> listInsertCand) {

}

public void rejectEx(String comment) {
long user_id = us.getUserId();
//校验权限,当前人员有权限干不,没权限直接抛异常
checkPermission();
@@ -787,7 +867,7 @@ public class FlowInstance {
throw new BizException("当前任务已提交,不能驳回!");
}

//获取前置任务,前置任务需要置为被驳回的办理状态,同时,前置任务的其他后置任务需要删除
//获取前置任务,前置任务需要置为被驳回的办理状态,为保证流程信息,复制一份,作为新建任务处理
List<Task> new_acts = provider.findBeforeTasks(actInst.getEntityId());
if (CommUtil.isEmpty(new_acts)) {
throw new BizException("没有找到前续任务,驳回失败!");
@@ -819,7 +899,7 @@ public class FlowInstance {
getTaskRelDao().deleteEntity("where trl_src_task_id in (" + sqlIn.substring(1) + ")");
getProcInstDao().updateEntity(procInst);

buildBillLog(FlowConst.Button.REJECT.value, "TODO", actInst, new_acts);
buildBillLog(FlowConst.Button.REJECT.value, comment, actInst, new_acts);
listener.afterReject(actInst, new_acts);
// comp.transCallback(FlowConst.FlowOptType.REJECT.value, actInst, new_acts);
}
@@ -928,35 +1008,6 @@ public class FlowInstance {
return bean;
}

protected void updateComment(String comment, String optType) {
Comment bean = provider.findTaskComment(actInst.getId());
if (bean == null) throw new SwException("没有找到对应的记录(comment)!");
//签收
if (FlowConst.Button.HANDLE.value.equals(optType)) {
bean.setStatu(FlowConst.ActivityStatu.HANDLE.value);
bean.setHandler(us.getUserId());
bean.setHandlerTime(DateUtil.nowDateTimeLong());
} else if (FlowConst.Button.SUBMIT.value.equals(optType)) {
if (bean.getHandlerTime() <= 0L) {
bean.setHandler(us.getUserId());
bean.setHandlerTime(DateUtil.nowDateTimeLong());
}
bean.setStatu(FlowConst.ActivityStatu.SUBMIT.value);
bean.setEndTime(DateUtil.nowDateTimeLong());
bean.setComment(comment);
} else if (FlowConst.Button.RETAKE.value.equals(optType)) {
if (bean.getHandlerTime() <= 0L) {
bean.setHandler(us.getUserId());
bean.setHandlerTime(DateUtil.nowDateTimeLong());
}
bean.setStatu(FlowConst.ActivityStatu.HANDLE.value);
bean.setHandlerTime(DateUtil.nowDateTimeLong());
bean.setEndTime(0L);
}
getCommentDao().updateEntity(bean);
}

private EntityDao<ProcInst> getProcInstDao() {
return DbEngine.getInstance().findDao(ProcInst.class);
}
@@ -984,4 +1035,68 @@ public class FlowInstance {
private EntityDao<TaskRel> getTaskRelDao() {
return DbEngine.getInstance().findDao(TaskRel.class);
}

interface ICommentWorker {
void work(Comment bean, String comment, long userId);
}

private static Map<String, ICommentWorker> mapComment;

static {
mapComment = new HashMap<>();
mapComment.put(FlowConst.Button.HANDLE.value, (bean, comment, userId) -> {
bean.setStatu(FlowConst.ActivityStatu.HANDLE.value);
bean.setHandler(userId);
bean.setHandlerTime(DateUtil.nowDateTimeLong());
});
mapComment.put(FlowConst.Button.SUBMIT.value, (bean, comment, userId) -> {
checkHandler(bean, userId);
bean.setStatu(FlowConst.ActivityStatu.SUBMIT.value);
bean.setEndTime(DateUtil.nowDateTimeLong());
bean.setComment(comment);
});
mapComment.put(FlowConst.Button.RETAKE.value, (bean, comment, userId) -> {
checkHandler(bean, userId);

bean.setStatu(FlowConst.ActivityStatu.HANDLE.value);
bean.setHandlerTime(DateUtil.nowDateTimeLong());
bean.setEndTime(0L);
});
mapComment.put(FlowConst.Button.REJECT.value, (bean, comment, userId) -> {
checkHandler(bean, userId);

bean.setStatu(FlowConst.ActivityStatu.REJECT.value);
bean.setHandlerTime(DateUtil.nowDateTimeLong());
bean.setEndTime(DateUtil.nowDateTimeLong());
bean.setComment(comment);
});
mapComment.put(FlowConst.Button.DISUSE.value, (bean, comment, userId) -> {
checkHandler(bean, userId);
bean.setStatu(FlowConst.ActivityStatu.DISUSE.value);
bean.setEndTime(DateUtil.nowDateTimeLong());
bean.setComment(comment);
});
mapComment.put(FlowConst.Button.INTERRUPT.value, (bean, comment, userId) -> {
checkHandler(bean, userId);
bean.setStatu(FlowConst.ActivityStatu.INTERRUPT.value);
bean.setEndTime(DateUtil.nowDateTimeLong());
bean.setComment(comment);
});
}

private static void checkHandler(Comment bean, long userId) {
if (bean.getHandlerTime() <= 0L) {
bean.setHandler(userId);
bean.setHandlerTime(DateUtil.nowDateTimeLong());
}
}

protected void updateComment(String comment, String optType) {
Comment bean = provider.findTaskComment(actInst.getId());
if (bean == null) throw new SwException("没有找到对应的记录(comment)!");
ICommentWorker worker = mapComment.get(optType);
if (worker == null) throw new SwException("该类型(" + optType + ")没有实现审批意见!");
worker.work(bean, comment, us.getUserId());
getCommentDao().updateEntity(bean);
}
}

+ 12
- 2
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowProvider.java Просмотреть файл

@@ -62,7 +62,7 @@ public class FlowProvider extends AbstractCompProvider {
public List<Task> findBeforeTasks(String taskIds) {
EntityDao<Task> bdao = DbEngine.getInstance().findDao(Task.class);
List<Task> list = bdao.queryEx(" t," + EntityHelper.getSchemaTableName(TaskRel.ENTITY_NAME) + " r " +
"where t.task_id=r.trl_src_task_id and r.trl_dst_task_id in (" + taskIds + ")");
"where t.tsk_id=r.trl_src_task_id and r.trl_dst_task_id in (" + taskIds + ")");
if (CommUtil.isEmpty(list)) return new ArrayList<>();
return list;
}
@@ -97,9 +97,19 @@ public class FlowProvider extends AbstractCompProvider {
});
}

//获取流程所有任务
public List<Task> findTasks(long billId) {
return doGetData("aa_" + billId, () -> {
EntityDao<Task> bdao = DbEngine.getInstance().findDao(Task.class);
List<Task> list = bdao.queryWhere(" tsk_pri_id = ?", billId, FlowConst.ActivityStatu.SUBMIT.value);
if (list == null) return new ArrayList<>();
return list;
});
}

//寻找流程的制单任务
public Task findMakeTask(long bill_id) {
return DbEngine.getInstance().findDao(Task.class).queryEntityWhere(" tsk_pri_id = ? and is_make = 1 ", bill_id);
return DbEngine.getInstance().findDao(Task.class).queryEntityWhere(" tsk_pri_id = ? and is_make = 1 order by tsk_end_time desc", bill_id);
}

public List<Comment> findComment(long bill_id) {


+ 91
- 62
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/Task.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-09-05 15:43:43
* 实体【[流程活动实例](WF_TASK)】的Entity类
*/
@SwTable("WF_TASK")
public class Task extends DefaultEntity {
@@ -15,155 +15,184 @@ public class Task extends DefaultEntity {
super(ENTITY_NAME);
}

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

public void setId(long tskId) {
put("tsk_id", tskId);
/** 主键 */
public void setId(long tsk_id) {
put("tsk_id", tsk_id);
}
/** 流程实例id */
public long getPriId() {
return getLong("tsk_pri_id");
}

public void setPriId(long tskPriId) {
put("tsk_pri_id", tskPriId);
/** 流程实例id */
public void setPriId(long tsk_pri_id) {
put("tsk_pri_id", tsk_pri_id);
}
/** 流程定义id */
public long getPrcId() {
return getLong("tsk_prc_id");
}

public void setPrcId(long tskPrcId) {
put("tsk_prc_id", tskPrcId);
/** 流程定义id */
public void setPrcId(long tsk_prc_id) {
put("tsk_prc_id", tsk_prc_id);
}
/** 活动定义id */
public String getActId() {
return getStr("tsk_act_id");
}

public void setActId(String tskActId) {
put("tsk_act_id", tskActId);
/** 活动定义id */
public void setActId(String tsk_act_id) {
put("tsk_act_id", tsk_act_id);
}
/** 活动名称 */
public String getActName() {
return getStr("tsk_act_name");
}

public void setActName(String tskActName) {
put("tsk_act_name", tskActName);
/** 活动名称 */
public void setActName(String tsk_act_name) {
put("tsk_act_name", tsk_act_name);
}
/** 主办人 */
public long getHandler() {
return getLong("tsk_handler");
}

public void setHandler(long tskHandler) {
put("tsk_handler", tskHandler);
/** 主办人 */
public void setHandler(long tsk_handler) {
put("tsk_handler", tsk_handler);
}
/** 开始时间 */
public long getStartTime() {
return getLong("tsk_start_time");
}

public void setStartTime(long tskStartTime) {
put("tsk_start_time", tskStartTime);
/** 开始时间 */
public void setStartTime(long tsk_start_time) {
put("tsk_start_time", tsk_start_time);
}
public long getHandler_time() {
/** 签收时间 */
public long getHandlerTime() {
return getLong("tsk_handler_time");
}

public void setHandler_time(long tsk_handler_time) {
/** 签收时间 */
public void setHandlerTime(long tsk_handler_time) {
put("tsk_handler_time", tsk_handler_time);
}
/** 结束时间 */
public long getEndTime() {
return getLong("tsk_end_time");
}

public void setEndTime(long tskEndTime) {
put("tsk_end_time", tskEndTime);
/** 结束时间 */
public void setEndTime(long tsk_end_time) {
put("tsk_end_time", tsk_end_time);
}
/** 状态 */
public int getStatu() {
return getInt("tsk_statu");
}

public void setStatu(int tskStatu) {
put("tsk_statu", tskStatu);
/** 状态 */
public void setStatu(int tsk_statu) {
put("tsk_statu", tsk_statu);
}
/** 审批意见 */
public String getComment() {
return getStr("comment");
return getStr("tsk_comment");
}

public void setComment(String comment) {
put("comment", comment);
/** 审批意见 */
public void setComment(String tsk_comment) {
put("tsk_comment", tsk_comment);
}
/** 是否制单步骤 */
public boolean isMake() {
return getBool("tsk_is_make");
}

public void setMake(boolean tskIsMake) {
setBool("tsk_is_make", tskIsMake);
/** 是否制单步骤 */
public void setMake(boolean tsk_is_make) {
setBool("tsk_is_make", tsk_is_make);
}
/** 是否需要会签 */
public boolean isSign() {
return getBool("tsk_is_sign");
}

public void setSign(boolean tskIsSign) {
setBool("tsk_is_sign", tskIsSign);
/** 是否需要会签 */
public void setSign(boolean tsk_is_sign) {
setBool("tsk_is_sign", tsk_is_sign);
}
public String getSignTotal() {
return getStr("tsk_sign_total");
/** 会签人数 */
public int getSignTotal() {
return getInt("tsk_sign_total");
}

public void setSignTotal(String tskSignTotal) {
put("tsk_sign_total", tskSignTotal);
/** 会签人数 */
public void setSignTotal(int tsk_sign_total) {
put("tsk_sign_total", tsk_sign_total);
}
/** 设置会签过关人数 */
public int getSignPass() {
return getInt("tsk_sign_pass");
}

public void setSignPass(int tskSignPass) {
put("tsk_sign_pass", tskSignPass);
/** 设置会签过关人数 */
public void setSignPass(int tsk_sign_pass) {
put("tsk_sign_pass", tsk_sign_pass);
}
/** 会签同意人数 */
public int getSignAgree() {
return getInt("tsk_sign_agree");
}

public void setSignAgree(int tskSignAgree) {
put("tsk_sign_agree", tskSignAgree);
/** 会签同意人数 */
public void setSignAgree(int tsk_sign_agree) {
put("tsk_sign_agree", tsk_sign_agree);
}
public boolean getIsReject() {
/** 是否被驳回 */
public boolean isReject() {
return getBool("tsk_is_reject");
}

public void setReject(boolean tskIsReject) {
setBool("tsk_is_reject", tskIsReject);
/** 是否被驳回 */
public void setReject(boolean tsk_is_reject) {
setBool("tsk_is_reject", tsk_is_reject);
}
/** 是否取回 */
public boolean isRetake() {
return getBool("tsk_is_retake");
}

public void setRetake(boolean tskIsRetake) {
setBool("tsk_is_retake", tskIsRetake);
/** 是否取回 */
public void setRetake(boolean tsk_is_retake) {
setBool("tsk_is_retake", tsk_is_retake);
}
/** 是否自动任务 */
public boolean isAuto() {
return getBool("tsk_is_auto");
}

public void setIsAuto(boolean tskIsAuto) {
setBool("tsk_is_auto", tskIsAuto);
/** 是否自动任务 */
public void setAuto(boolean tsk_is_auto) {
setBool("tsk_is_auto", tsk_is_auto);
}
/** 备注 */
public String getRemark() {
return getStr("tsk_remark");
}

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

+ 17
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleService.java Просмотреть файл

@@ -54,6 +54,22 @@ public class FlowSingleService extends LCSingleService {
}

public R retake(@SwBody SwMap params, UserSession us) {
return flowHandler(params, us, FlowTransHandler::submit);
return flowHandler(params, us, FlowTransHandler::retake);
}

public R reject(@SwBody SwMap params, UserSession us) {
return flowHandler(params, us, FlowTransHandler::reject);
}

public R disuse(@SwBody SwMap params, UserSession us) {
return flowHandler(params, us, FlowTransHandler::disuse);
}

public R handle(@SwBody SwMap params, UserSession us) {
return flowHandler(params, us, FlowTransHandler::handle);
}

public R interrupt(@SwBody SwMap params, UserSession us) {
return flowHandler(params, us, FlowTransHandler::interrupt);
}
}

+ 33
- 5
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowTransHandler.java Просмотреть файл

@@ -2,6 +2,7 @@ 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.DbEngine;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
import cc.smtweb.framework.core.mvc.service.SwListData;
import cc.smtweb.system.bpm.web.design.form.define.PageDataset;
@@ -10,11 +11,8 @@ 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.entity.Task;
import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleHelper;

import java.util.List;

/**
* Created by Akmm at 2022-09-01 15:03
* 流程流转
@@ -54,13 +52,43 @@ public class FlowTransHandler<T extends DefaultEntity> extends AbstractDynPageHa

public R submit() {
load();
flowInstance.submit(params.readString("comment"));
DbEngine.getInstance().doTrans(() -> flowInstance.submit(params.readString("comment")));

return R.success(buildRetData());
}

public R retake() {
load();
flowInstance.retake();
DbEngine.getInstance().doTrans(() -> flowInstance.retake());

return R.success(buildRetData());
}

public R reject() {
load();
DbEngine.getInstance().doTrans(() -> flowInstance.reject(params.readString("comment"), params.readString("toTaskId")));

return R.success(buildRetData());
}

public R disuse() {
load();
DbEngine.getInstance().doTrans(() -> flowInstance.disuse(params.readString("comment")));

return R.success(buildRetData());
}

public R handle() {
load();
DbEngine.getInstance().doTrans(() -> flowInstance.handle());

return R.success(buildRetData());
}

public R interrupt() {
load();
DbEngine.getInstance().doTrans(() -> flowInstance.interrupt(params.readString("comment")));

return R.success(buildRetData());
}
}

+ 2
- 2
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/AbsDelHandler.java Просмотреть файл

@@ -6,7 +6,7 @@ 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.db.cache.ModelTableCache;
import cc.smtweb.framework.core.db.jdbc.AbsDbWorker;
import cc.smtweb.framework.core.db.jdbc.IDbWorker;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.system.bpm.web.design.form.define.PageDataset;
@@ -31,7 +31,7 @@ public abstract class AbsDelHandler extends AbstractDynPageHandler {
//
checkBean(pageDataset, id);
//
DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
ModelTable table = ModelTableCache.getInstance().get(pageDataset.masterTable);


+ 2
- 2
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/AbsSaveHandler.java Просмотреть файл

@@ -8,7 +8,7 @@ import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.EntityDao;
import cc.smtweb.framework.core.db.cache.ModelTableCache;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
import cc.smtweb.framework.core.db.jdbc.AbsDbWorker;
import cc.smtweb.framework.core.db.jdbc.IDbWorker;
import cc.smtweb.framework.core.db.vo.ModelField;
import cc.smtweb.framework.core.db.vo.ModelIndex;
import cc.smtweb.framework.core.db.vo.ModelTable;
@@ -51,7 +51,7 @@ public abstract class AbsSaveHandler <T extends DefaultEntity> extends AbstractD
}
checkBean(bean);

DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
saveBean(bean);


+ 2
- 2
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/mastersub/LCMsDelHandler.java Просмотреть файл

@@ -9,7 +9,7 @@ import cc.smtweb.framework.core.db.EntityDao;
import cc.smtweb.framework.core.db.EntityHelper;
import cc.smtweb.framework.core.db.cache.ModelTableCache;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
import cc.smtweb.framework.core.db.jdbc.AbsDbWorker;
import cc.smtweb.framework.core.db.jdbc.IDbWorker;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.AbsDelHandler;
@@ -64,7 +64,7 @@ public class LCMsDelHandler extends AbsDelHandler {
//
List<? extends DefaultEntity> delDetails = subDao.queryWhere(subForeignKey + " = ?", id);
checkDetails(delDetails);
DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
subDao.batchDelete(delDetails);


+ 2
- 2
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/mastersub/LCMsSaveHandler.java Просмотреть файл

@@ -6,7 +6,7 @@ import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.EntityDao;
import cc.smtweb.framework.core.db.cache.ModelTableCache;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
import cc.smtweb.framework.core.db.jdbc.AbsDbWorker;
import cc.smtweb.framework.core.db.jdbc.IDbWorker;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.system.bpm.web.design.form.define.PageDataset;
@@ -71,7 +71,7 @@ public class LCMsSaveHandler extends AbsSaveHandler<DefaultEntity> {
//
checkBean(masterBean);

DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
saveBean(masterBean);


+ 2
- 11
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleDelHandler.java Просмотреть файл

@@ -3,24 +3,15 @@ package cc.smtweb.system.bpm.web.engine.model.listcard.single;
import cc.smtweb.framework.core.cache.AbstractCache;
import cc.smtweb.framework.core.cache.CacheManager;
import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwEnum;
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.db.cache.ModelTableCache;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
import cc.smtweb.framework.core.db.jdbc.AbsDbWorker;
import cc.smtweb.framework.core.db.jdbc.IDbWorker;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.system.bpm.web.design.form.define.PageDataset;
import cc.smtweb.system.bpm.web.design.form.define.PageDatasetFilter;
import cc.smtweb.system.bpm.web.engine.dynPage.AbstractDynPageHandler;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* Created by Akmm at 2022/4/21 17:53
@@ -40,7 +31,7 @@ public class LCSingleDelHandler extends AbstractDynPageHandler {

checkBean(pageDataSet, id);

DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
ModelTable table = ModelTableCache.getInstance().get(pageDataSet.masterTable);


+ 2
- 2
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleSaveHandler.java Просмотреть файл

@@ -9,7 +9,7 @@ import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.EntityDao;
import cc.smtweb.framework.core.db.cache.ModelTableCache;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
import cc.smtweb.framework.core.db.jdbc.AbsDbWorker;
import cc.smtweb.framework.core.db.jdbc.IDbWorker;
import cc.smtweb.framework.core.db.vo.ModelField;
import cc.smtweb.framework.core.db.vo.ModelIndex;
import cc.smtweb.framework.core.db.vo.ModelTable;
@@ -52,7 +52,7 @@ public class LCSingleSaveHandler<T extends DefaultEntity> extends AbstractDynPag
}
checkBean(bean);

DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
saveBean(bean);


+ 3
- 3
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/menuPlan/MenuPlanHandler.java Просмотреть файл

@@ -3,7 +3,7 @@ package cc.smtweb.system.bpm.web.sys.user.menuPlan;
import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.jdbc.AbsDbWorker;
import cc.smtweb.framework.core.db.jdbc.IDbWorker;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.framework.core.mvc.service.AbstractHandler;
import cc.smtweb.framework.core.mvc.service.SwListData;
@@ -48,7 +48,7 @@ public class MenuPlanHandler {
menuPlanContent.saveItem(menuPlanItem, parent_id);
menuPlan.setContent(menuPlanContent.toContentStr());

DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
DbEngine.getInstance().updateEntity(menuPlan, "smp_content");
@@ -79,7 +79,7 @@ public class MenuPlanHandler {
menuPlanContent.delItem(id);
menuPlan.setContent(menuPlanContent.toContentStr());

DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
DbEngine.getInstance().updateEntity(menuPlan, "smp_content");


+ 4
- 4
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/user/UserHandler.java Просмотреть файл

@@ -6,7 +6,7 @@ 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.impl.DefaultEntity;
import cc.smtweb.framework.core.db.jdbc.AbsDbWorker;
import cc.smtweb.framework.core.db.jdbc.IDbWorker;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.framework.core.mvc.service.AbstractHandler;
@@ -178,7 +178,7 @@ public class UserHandler {
public R batchDelParty() {
Set<Long> idList = params.readLongSet("ids");
Set<Long> roleIdList = UserRoleCache.getInstance().getByParty(idList);
DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
getUserPartyDao().deleteEntity(idList);
@@ -198,7 +198,7 @@ public class UserHandler {
long id = params.readLong("id");
Set<Long> partyIds = UserPartyCache.getInstance().getIdByUser(id);
Set<Long> roleIds = UserRoleCache.getInstance().getByParty(partyIds);
DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
getUserDao().deleteEntity(id);
@@ -224,7 +224,7 @@ public class UserHandler {
userList.forEach(user -> {
user.setPwd(LoginHelper.encodePwd(user.getId(), SwConsts.DEF_PWD));
});
DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
DbEngine.getInstance().findDao(User.ENTITY_NAME).batchUpdateEntity(userList);


+ 223
- 73
smtweb-framework/bpm/src/main/resources/static/template/default/model_card_flow.ftl Просмотреть файл

@@ -43,7 +43,7 @@
"props": {
"alignY": "center",
"size": "200",
"paddingLeft": 20
"paddingLeft": 16
},
"children": [
{
@@ -56,73 +56,13 @@
}
]
},
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"alignY": "center",
"paddingRight": 20
},
"children": [
{
"id": "${newId()}",
"type": "fx-button-group",
"props": {
"menus": [],
"textAlign": ""
},
"slots": {
"default": [
{
"id": "${newId()}",
"type": "fx-button",
"props": {
"name": "button:return",
"label": "返回",
"type": "success",
"size": "default",
"action": "button:backList",
"leftIcon": "list-top"
},
"events": {},
"vars": {
"$ref": "$ref"
}
},
{
"type": "fx-button",
"props": {
"name": "button:delete",
"label": "删除",
"leftIcon": "delete",
"action": "button:delCard"
},
"id": "${newId()}",
"vars": {
"$ref": "$ref"
}
},
{
"id": "${newId()}",
"type": "fx-button",
"props": {
"name": "button:new",
"label": "新增",
"type": "primary",
"leftIcon": "plus",
"action": "button:addCard"
},
"vars": {
"$ref": "$ref"
}
}
],
"dropdown": []
}
}
]
},
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {},
"children": []
},
{
"id": "${newId()}",
"type": "fx-form-panel",
@@ -195,7 +135,7 @@
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "10",
"size": "16",
"backgroundColor": "--color-transparent"
},
"children": []
@@ -308,7 +248,7 @@
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "10",
"size": "16",
"backgroundColor": "--color-transparent"
},
"children": []
@@ -425,11 +365,11 @@
]
},
{
"id": "182e345bb14",
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "10",
"size": "16",
"backgroundColor": "--color-transparent"
},
"children": []
@@ -452,6 +392,19 @@
},
"slots": {
"default": [
{
"id": "${newId()}",
"type": "fx-button",
"props": {
"name": "button:new",
"label": "新增",
"type": "primary",
"action": "button:addCard"
},
"vars": {
"$ref": "$ref"
}
},
{
"type": "fx-button",
"props": {
@@ -542,7 +495,37 @@
"vars": {
"$ref": "$ref"
}
}
},
{
"type": "fx-button",
"props": {
"name": "button:delete",
"label": "删除",
"type": "danger",
"action": "button:delCard"
},
"id": "${newId()}",
"vars": {
"$ref": "$ref"
}
},
{
"id": "${newId()}",
"type": "fx-button",
"props": {
"name": "button:return",
"label": "返回",
"size": "default",
"action": "button:backList"
},
"events": {},
"vars": {
"$ref": "$ref"
}
}



]
}
}
@@ -708,7 +691,174 @@
}
]
}
},
{
"page": {
"id": "${newId()}",
"type": "fx-dialog",
"props": {
"title": "驳回",
"key": "dlgReject",
"width": "450px",
"height": "300px",
"showPrefix": true
},
"events": {}
},
"graph": {
"shape": "panel",
"id": "root_panel",
"type": "fx-split-panel",
"props": {
"horizontal": false,
"shadow": "never"
},
"children": [
{
"id": "${newId()}",
"type": "fx-split-panel",
"shape": "panel",
"props": {
"horizontal": false
},
"children": [
{
"shape": "panel",
"id": "form_panel",
"type": "fx-form-panel",
"props": {
"colNum": 1,
"paddingTop": 24,
"size": "0"
},
"children": [
{
"id": "${newId()}",
"type": "fx-select",
"props": {
"name":"flowToTaskRef",
"label": "驳回到",
"clearable": true,
"labelWidth": 100,
"affixError": true,
"size": "default",
"multiple": true,
"required": true
},
"events": {},
"vars": {
"$ref": "$ref"
}
},
{
"id": "${newId()}",
"type": "fx-select",
"props": {
"label": "备选意见",
"clearable": true,
"labelWidth": 100,
"affixError": true,
"size": "default"
},
"events": {}
},
{
"id": "${newId()}",
"type": "fx-textarea",
"props": {
"label": "处理意见",
"maxlength": 200,
"placeholder": "请输入内容",
"labelWidth": 100,
"affixError": true,
"size": "default",
"dataset": "ds_182edc699cc",
"field": "id_182edc699cd",
"rows": 4
},
"events": {}
}

]
},
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {},
"children": []
}
]
},
{
"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-form-panel",
"shape": "panel",
"props": {
"size": "50",
"alignX": "end",
"alignY": "center",
"paddingRight": 10
},
"children": [
{
"id": "${newId()}",
"type": "fx-button-group",
"props": {
"showDropdown": false
},
"slots": {
"default": [
{
"type": "fx-button",
"props": {
"label": "确认",
"leftIcon": "correct",
"type": "primary",
"action": "button:dlgDynConfirm",
"linkType": ""
},
"id": "${newId()}",
"events": {}
},
{
"type": "fx-button",
"props": {
"label": "取消",
"leftIcon": "error",
"action": "button:closeDialog"
},
"id": "${newId()}",
"events": {}
}
],
"dropdown": []
}
}
]
}
]
}
}
],
"model": [
<#list datasets as dataset>


+ 20
- 104
smtweb-framework/bpm/src/main/resources/static/template/default/model_card_ms.ftl Просмотреть файл

@@ -25,83 +25,6 @@
"type": "fx-split-panel",
"shape": "panel",
"props": {
"size": "56",
"horizontal": true,
"scroll": false,
"name": "s11"
},
"children": [
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"alignY": "center",
"size": "300",
"backgroundImage": "",
"paddingLeft": 30
},
"children": [
{
"id": "${newId()}",
"type": "fx-title",
"props": {
"label": "${title}"
}
}
]
},
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"alignY": "center",
"backgroundImage": "",
"paddingRight": 32
},
"children": [
{
"id": "${newId()}",
"type": "fx-button-group",
"props": {
"menus": [],
"textAlign": "right"
},
"slots": {
"default": [
],
"dropdown": []
}
}
]
}
]
},
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "0"
},
"children": [
{
"id": "id${newId()}",
"type": "fx-divider",
"props": {
"label": "",
"contentPosition": "center",
"direction": "horizontal"
}
}
]
},
{
"id": "${newId()}",
"type": "fx-split-panel",
"shape": "panel",
"props": {
"horizontal": false,
"scroll": true,
"tab": false
@@ -112,24 +35,12 @@
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "10",
"backgroundColor": "--color-transparent"
},
"children": []
},
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "48",
"size": "56",
"label": "${group.label}",
"colNum": 2,
"alignY": "center",
"paddingLeft": 32,
"paddingRight": 32,
"shadow": "",
"backgroundImage": "bgImg-region-title"
"paddingLeft": 16,
"shadow": ""
},
"children": [
{
@@ -183,8 +94,8 @@
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "10",
"backgroundColor": "transparent"
"size": "16",
"backgroundColor": "--color-transparent"
},
"children": []
},
@@ -193,7 +104,7 @@
"type": "fx-split-panel",
"shape": "panel",
"props": {
"size": "48",
"size": "56",
"horizontal": true
},
"children": [
@@ -206,10 +117,8 @@
"label": "",
"colNum": 2,
"alignY": "center",
"paddingLeft": 32,
"paddingRight": 32,
"shadow": "",
"backgroundImage": "bgImg-region-title"
"paddingLeft": 16,
"shadow": ""
},
"children": [
{
@@ -233,10 +142,10 @@
"type": "fx-form-panel",
"shape": "panel",
"props": {
"alignX": "center",
"alignX": "right",
"size": "150",
"alignY": "center",
"backgroundImage": "bgImg-region-title"
"paddingRight": 16
},
"children": [
{
@@ -268,8 +177,8 @@
"size": "400",
"label": "列表",
"colNum": 0,
"paddingLeft": 20,
"paddingRight": 20,
"paddingLeft": 16,
"paddingRight": 16,
"shadow": "",
"paddingTop": 0
},
@@ -338,8 +247,15 @@
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {},
"children": []
},
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "10",
"size": "16",
"backgroundColor": "transparent"
},
"children": []


+ 2
- 29
smtweb-framework/bpm/src/main/resources/static/template/default/model_card_normal.ftl Просмотреть файл

@@ -40,34 +40,8 @@
"shape": "panel",
"props": {
"alignY": "center",
"backgroundImage":"bgImg-region-title",
"size": "50"

},
"children": [
{
"id": "${newId()}",
"type": "fx-button-group",
"props": {
"menus": []
},
"slots": {
"default": [

]
}
}
]
},
{
"id": "${newId()}",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"alignY": "center",
"size": "400",
"backgroundImage":"bgImg-region-title",
"paddingLeft": 10
"paddingLeft": 16
},
"children": [
{
@@ -85,8 +59,7 @@
"shape": "panel",
"props": {
"alignY": "center",
"backgroundImage": "bgImg-region-title",
"paddingRight": 32
"paddingRight": 16
},
"children": [
{


+ 12
- 8
smtweb-framework/bpm/src/main/resources/static/template/default/model_list_list_1.ftl Просмотреть файл

@@ -42,9 +42,8 @@
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "50",
"size": "56",
"alignY": "center",
"backgroundImage": "bgImg-region-title",
"paddingLeft": 16,
"colNum": 2,
"gridTemplateColumns": "",
@@ -170,7 +169,9 @@
"shape": "panel",
"props": {
"size": "",
"colNum": 0
"colNum": 0,
"paddingLeft": 16,
"paddingRight": 16
},
"children": [
{
@@ -248,7 +249,7 @@
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "10",
"size": "16",
"backgroundColor": "--color-transparent"
},
"children": []
@@ -270,7 +271,9 @@
"props": {
"colNum": 3,
"label": "查询条件",
"size": "50",
"paddingLeft": 16,
"paddingRight": 16,
"size": "56",
"alignY": "center"
},
"children": [
@@ -342,7 +345,7 @@
"shape": "panel",
"props": {
"label": "间隔",
"size": "10",
"size": "16",
"backgroundColor": "--color-transparent"
},
"children": []
@@ -355,7 +358,6 @@
"props": {
"label": "${param.rListTitle}",
"size": "50",
"backgroundImage": "bgImg-region-title",
"colNum": 2,
"alignY": "center",
"paddingLeft": 16,
@@ -404,7 +406,9 @@
"shape": "panel",
"props": {
"label": "表格区",
"colNum": 0
"colNum": 0,
"paddingLeft": 16,
"paddingRight": 16
},
"children": [
{


+ 15
- 11
smtweb-framework/bpm/src/main/resources/static/template/default/model_list_list_2.ftl Просмотреть файл

@@ -42,9 +42,8 @@
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "50",
"size": "56",
"alignY": "center",
"backgroundImage": "bgImg-region-title",
"paddingLeft": 16,
"colNum": 2,
"gridTemplateColumns": "",
@@ -143,7 +142,9 @@
"shape": "panel",
"props": {
"size": "",
"colNum": 0
"colNum": 0,
"paddingLeft": 16,
"paddingRight": 16
},
"children": [
{
@@ -191,7 +192,7 @@
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "10",
"size": "16",
"backgroundColor": "--color-transparent"
},
"children": []
@@ -213,7 +214,9 @@
"props": {
"colNum": 3,
"label": "查询条件",
"size": "50",
"size": "56",
"paddingLeft": 16,
"paddingRight": 16,
"alignY": "center"
},
"children": [
@@ -226,7 +229,8 @@
"maxlength": 50,
"placeholder": "请输入${cfilters.label}",
"labelWidth": 100,
"affixError": false
"affixError": false,
"hideLabel": true
},
"events": {}
},
@@ -284,8 +288,7 @@
"type": "fx-form-panel",
"shape": "panel",
"props": {
"label": "间隔",
"size": "10",
"size": "16",
"backgroundColor": "--color-transparent"
},
"children": []
@@ -298,7 +301,6 @@
"props": {
"label": "${param.rListTitle}",
"size": "50",
"backgroundImage": "bgImg-region-title",
"colNum": 2,
"alignY": "center",
"paddingLeft": 16,
@@ -347,7 +349,9 @@
"shape": "panel",
"props": {
"label": "表格区",
"colNum": 0
"colNum": 0,
"paddingLeft": 16,
"paddingRight": 16
},
"children": [
{
@@ -492,7 +496,7 @@
"shape": "panel",
"props": {
"size": "56",
"paddingRight": 10,
"paddingRight": 16,
"alignY": "center"
},
"children": [


+ 1
- 1
smtweb-framework/bpm/src/main/resources/static/template/java_bean.ftl Просмотреть файл

@@ -24,7 +24,7 @@ public class ${beanName} extends DefaultEntity {
}

/** ${field.title} */
public void set${javaName}(boolean ${field.name}) {
public void set${field.javaName}(boolean ${field.name}) {
setBool("${field.name}", ${field.name});
}
<#else >


+ 2
- 1
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/db/jdbc/AbsDbWorker.java Просмотреть файл

@@ -2,8 +2,9 @@ package cc.smtweb.framework.core.db.jdbc;

/**
* Created by Akmm at 14-2-15 下午1:51
* 数据库事务操作方法类
* 数据库事务操作方法类,被废弃,用IDbWorker替代
*/
@Deprecated
public abstract class AbsDbWorker implements IDbWorker {
@Override
public void doAfterDbCommit() {}


+ 3
- 3
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/db/jdbc/IDbWorker.java Просмотреть файл

@@ -5,11 +5,11 @@ package cc.smtweb.framework.core.db.jdbc;
* 数据库事务操作方法类
*/
public interface IDbWorker {
public void work();
default void work(){}

//数据库提交完后的业务或缓存处理
public void doAfterDbCommit();
default void doAfterDbCommit(){}

//数据库回滚后的业务或缓存处理
public void doAfterDbRollback();
default void doAfterDbRollback(){}
}

+ 8
- 0
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/db/jdbc/ISimpleWorker.java Просмотреть файл

@@ -0,0 +1,8 @@
package cc.smtweb.framework.core.db.jdbc;

/**
* Created by Akmm at 2022-09-05 09:42
*/
public interface ISimpleWorker {
void work();
}

+ 13
- 3
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/db/jdbc/JdbcEngine.java Просмотреть файл

@@ -20,7 +20,6 @@ import java.sql.SQLException;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.function.Supplier;

/**
* JDBC访问类,包装了spring jdbcTemplate对象
@@ -281,7 +280,7 @@ public class JdbcEngine {
*
* @param extractor 回调方法
* @return 事务是否成功,如果异常会也会事务回滚后再抛出异常
*/
*//*
public boolean doTrans(Supplier<Boolean> extractor) {
try (JdbcTrans jdbcTrans = openTrans()) {
boolean result = extractor.get();
@@ -292,7 +291,7 @@ public class JdbcEngine {
}

return false;
}
}*/

public void beginTrans() {
Thread t = Thread.currentThread();
@@ -346,6 +345,17 @@ public class JdbcEngine {
dbWorker.doAfterDbCommit();
}

public void doTrans(ISimpleWorker dbWorker) throws SwException {
beginTrans();
try {
dbWorker.work();
commit();
} catch (Exception e) {
rollback(e);
throw new SwException(e);
}
}

//独立事务
public void doTransSingle(IDbWorker worker) throws Exception {
JdbcTrans jdbcTrans = openTrans();


+ 2
- 4
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractDelHandler.java Просмотреть файл

@@ -2,7 +2,7 @@ package cc.smtweb.framework.core.mvc.service;

import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.jdbc.AbsDbWorker;
import cc.smtweb.framework.core.db.jdbc.IDbWorker;
import lombok.extern.slf4j.Slf4j;

/**
@@ -17,7 +17,7 @@ public abstract class AbstractDelHandler extends AbstractHandler{
id = readId();

checkValid();
DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
delDb();
@@ -25,13 +25,11 @@ public abstract class AbstractDelHandler extends AbstractHandler{

@Override
public void doAfterDbCommit() {
super.doAfterDbCommit();
saveSuccess();
}

@Override
public void doAfterDbRollback() {
super.doAfterDbRollback();
saveFailed();
}
});


+ 2
- 2
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractSaveHandler.java Просмотреть файл

@@ -2,7 +2,7 @@ package cc.smtweb.framework.core.mvc.service;

import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.jdbc.AbsDbWorker;
import cc.smtweb.framework.core.db.jdbc.IDbWorker;
import lombok.extern.slf4j.Slf4j;

/**
@@ -29,7 +29,7 @@ public abstract class AbstractSaveHandler<T> extends AbstractHandler {
setNewId();
}
checkValid();
DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work(){
saveDb();


+ 3
- 4
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/mvc/service/DefaultSaveHandler.java Просмотреть файл

@@ -4,13 +4,12 @@ import cc.smtweb.framework.core.cache.AbstractCache;
import cc.smtweb.framework.core.cache.CacheManager;
import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwEnum;
import cc.smtweb.framework.core.db.jdbc.IDbWorker;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.framework.core.exception.SwException;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.EntityDao;
import cc.smtweb.framework.core.db.cache.ModelTableCache;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
import cc.smtweb.framework.core.db.jdbc.AbsDbWorker;
import cc.smtweb.framework.core.db.vo.ModelField;
import cc.smtweb.framework.core.db.vo.ModelIndex;
import cc.smtweb.framework.core.db.vo.ModelTable;
@@ -46,7 +45,7 @@ public class DefaultSaveHandler<T extends DefaultEntity> extends AbstractHandler
readFromPage();
if (bean.getEntityId() <= 0L) bean.setEntityId(DbEngine.getInstance().nextId());
checkValid();
DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work(){
saveDb();
@@ -159,7 +158,7 @@ public class DefaultSaveHandler<T extends DefaultEntity> extends AbstractHandler
ModelField fieldParentId = table.findFieldByType(SwEnum.FieldType.PARENT_ID.value);

bean.put(fieldParentId.getName(), parentId);
DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
listTreeBean = TreeHelper.getTreeHelper(tableName).resetTreeLevel(bean);


+ 1
- 1
smtweb-framework/core/src/main/resources/流程定义.json Просмотреть файл

@@ -530,7 +530,7 @@
"model": {
"page": "默认表单定义",
"canEditOther": "bool是否允许编辑非本人单据",
"rejectToMake": "bool True-驳回到制单 False-逐级驳回",
"rejectToMake": "bool 是否允许驳回到制单",
"activities": [
{
"id": "唯一标识",


Загрузка…
Отмена
Сохранить