Explorar el Código

流程:条件分支

4.0
郑根木 hace 2 años
padre
commit
51e099b2d3
Se han modificado 6 ficheros con 221 adiciones y 60 borrados
  1. +4
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/flow/ModelProc.java
  2. +1
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/flow/ModelProcSaveHandler.java
  3. +1
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/flow/define/Trans.java
  4. +2
    -2
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowHelper.java
  5. +5
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowTransHandler.java
  6. +208
    -57
      smtweb-framework/core/src/main/resources/demo.json

+ 4
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/flow/ModelProc.java Ver fichero

@@ -21,6 +21,10 @@ public class ModelProc extends DefaultEntity {
super(ENTITY_NAME);
}

public void clear() {
procInfo = null;
}
public ProcInfo getProcInfo() {
if (procInfo == null) {
synchronized ("ModelProc_" + getId()) {


+ 1
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/flow/ModelProcSaveHandler.java Ver fichero

@@ -73,6 +73,7 @@ public class ModelProcSaveHandler extends DefaultSaveHandler<ModelProc> {
ModelTable table = ModelTableCache.getInstance().getByName(tableName);
ModelField field = table.findFieldByType(SwEnum.FieldType.UPDATE_USER.value);
if (field != null) bean.put(field.getName(), us.getUserId());
bean.clear();
dao.updateEntity(bean, "prc_content");
}



+ 1
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/flow/define/Trans.java Ver fichero

@@ -13,7 +13,7 @@ public class Trans {
//序号
private int seq;
//条件表达式
private String expr;
private String filter;
//源活动
private String src;
//目标活动


+ 2
- 2
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowHelper.java Ver fichero

@@ -86,7 +86,7 @@ public class FlowHelper {
if (act.getType() == FlowConst.ActivityType.CONDITION.value) {//条件分支
List<Trans> list = ModelProcHelper.getNextTrans(flowInstance.getProcInst().getPrcId(), act.getId());
for (Trans t : list) {
if (flowInstance.execTrans(t.getExpr())) {
if (flowInstance.execTrans(t.getFilter())) {
Activity a = proc.findActivity(t.getDst());
if (a == null) {
throw new BizException("无效的活动节点定义(" + t.getDst() + ")!");
@@ -98,7 +98,7 @@ public class FlowHelper {
} else if (act.getType() == FlowConst.ActivityType.PARALLEL.value) {//并发分支
List<Trans> list = ModelProcHelper.getNextTrans(flowInstance.getProcDef().getId(), act.getId());
for (Trans t : list) {
if (flowInstance.execTrans(t.getExpr())) {
if (flowInstance.execTrans(t.getFilter())) {
Activity a = proc.findActivity(t.getDst());
if (a == null) {
throw new BizException("无效的活动节点定义(" + t.getDst() + ")!");


+ 5
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowTransHandler.java Ver fichero

@@ -26,6 +26,11 @@ public class FlowTransHandler<T extends DefaultEntity> extends AbstractDynPageHa

protected T bean;

@Override
public void setExprParam(SwMap param) {
param.putAll(bean.getData());
}

private SwMap buildRetData() {
SwMap ret = new SwMap();
ret.put(LCSingleHelper.DATASET_NAME_CARD, DynRetBean.createBean(bean));


+ 208
- 57
smtweb-framework/core/src/main/resources/demo.json Ver fichero

@@ -9,8 +9,8 @@
"cells": [
{
"position": {
"x": 100,
"y": 40
"x": 130,
"y": 30
},
"size": {
"width": 50,
@@ -23,37 +23,40 @@
},
"visible": true,
"shape": "flow-end",
"id": "d88319d5-66a6-4f37-90a6-1186ddb7b337",
"id": "5bc72ca4-58b3-4c95-9da5-a08bff6ec2e6",
"data": {},
"zIndex": 1
},
{
"position": {
"x": 100,
"y": 456
"x": 313,
"y": 23
},
"size": {
"width": 50,
"width": 120,
"height": 50
},
"attrs": {
"body": {
"stroke": "#303133"
"text": {
"text": "任务"
},
"label": {
"text": "制单"
},
"icon": {
"xlink:href": "/src/assets/images/svg/stop.svg"
"xlink:href": "/src/assets/images/svg/people.svg"
}
},
"visible": true,
"shape": "flow-end",
"id": "08c500dd-28e7-488a-bf79-56d6fc783194",
"shape": "flow-action",
"id": "2fed55d9-d72c-4355-9208-a034477af0d7",
"data": {},
"zIndex": 7
"zIndex": 11
},
{
"position": {
"x": 65,
"y": 179
"x": 454,
"y": 322
},
"size": {
"width": 120,
@@ -64,7 +67,7 @@
"text": "任务"
},
"label": {
"text": "制单"
"text": "审1"
},
"icon": {
"xlink:href": "/src/assets/images/svg/people.svg"
@@ -72,14 +75,34 @@
},
"visible": true,
"shape": "flow-action",
"id": "a06b3e2f-588e-4b77-aa83-c3949399213d",
"id": "24051177-ae41-49cf-8f33-495b885c4177",
"data": {},
"zIndex": 12
},
{
"position": {
"x": 65,
"y": 314
"x": 572,
"y": 30
},
"size": {
"width": 120,
"height": 50
},
"attrs": {
"text": {
"text": "条件"
}
},
"visible": true,
"shape": "flow-choice",
"id": "2fd67664-bd5d-4f88-978e-5ea1a2c27a28",
"data": {},
"zIndex": 13
},
{
"position": {
"x": 724,
"y": 322
},
"size": {
"width": 120,
@@ -90,7 +113,7 @@
"text": "任务"
},
"label": {
"text": "审"
"text": "审2"
},
"icon": {
"xlink:href": "/src/assets/images/svg/people.svg"
@@ -98,9 +121,50 @@
},
"visible": true,
"shape": "flow-action",
"id": "c0cf8077-a879-4299-be0b-4dd041e8dac9",
"id": "22870145-800c-46d5-a6ad-74fc819ecd89",
"data": {},
"zIndex": 13
"zIndex": 14
},
{
"position": {
"x": 760,
"y": 470
},
"size": {
"width": 50,
"height": 50
},
"attrs": {
"body": {
"stroke": "#303133"
},
"icon": {
"xlink:href": "/src/assets/images/svg/stop.svg"
}
},
"visible": true,
"shape": "flow-end",
"id": "d51521e3-186a-46ad-b093-b0e6f2c644be",
"data": {},
"zIndex": 15
},
{
"shape": "edge",
"attrs": {
"line": {
"stroke": "#4D5B62",
"strokeWidth": 1
}
},
"id": "49cc6225-8420-47d5-8f9f-55108a8b6c51",
"zIndex": 28,
"data": {},
"source": {
"cell": "5bc72ca4-58b3-4c95-9da5-a08bff6ec2e6"
},
"target": {
"cell": "2fed55d9-d72c-4355-9208-a034477af0d7"
}
},
{
"shape": "edge",
@@ -110,14 +174,14 @@
"strokeWidth": 1
}
},
"id": "03c8e73d-e009-49b5-ad4c-c9f060b8c24a",
"zIndex": 27,
"id": "f0061f8e-e1fd-453c-8bea-418e8473e77a",
"zIndex": 34,
"data": {},
"source": {
"cell": "d88319d5-66a6-4f37-90a6-1186ddb7b337"
"cell": "2fed55d9-d72c-4355-9208-a034477af0d7"
},
"target": {
"cell": "a06b3e2f-588e-4b77-aa83-c3949399213d"
"cell": "2fd67664-bd5d-4f88-978e-5ea1a2c27a28"
}
},
{
@@ -128,14 +192,14 @@
"strokeWidth": 1
}
},
"id": "9be76069-399c-4782-a141-5550d8d635e3",
"zIndex": 37,
"id": "d254cdb3-8ccc-49e9-a44e-39077598b253",
"zIndex": 56,
"data": {},
"source": {
"cell": "a06b3e2f-588e-4b77-aa83-c3949399213d"
"cell": "2fd67664-bd5d-4f88-978e-5ea1a2c27a28"
},
"target": {
"cell": "c0cf8077-a879-4299-be0b-4dd041e8dac9"
"cell": "24051177-ae41-49cf-8f33-495b885c4177"
}
},
{
@@ -146,15 +210,51 @@
"strokeWidth": 1
}
},
"id": "b7b53812-8392-448a-8158-f3f9242fab50",
"zIndex": 43,
"id": "0feaea9c-76f7-4421-8e96-05de4f802513",
"zIndex": 66,
"data": {},
"source": {
"cell": "c0cf8077-a879-4299-be0b-4dd041e8dac9"
"cell": "2fd67664-bd5d-4f88-978e-5ea1a2c27a28"
},
"target": {
"cell": "08c500dd-28e7-488a-bf79-56d6fc783194"
"cell": "22870145-800c-46d5-a6ad-74fc819ecd89"
}
},
{
"shape": "edge",
"attrs": {
"line": {
"stroke": "#4D5B62",
"strokeWidth": 1
}
},
"id": "7d1b7308-496f-483a-b40f-50212aca8cdb",
"zIndex": 87,
"data": {},
"source": {
"cell": "22870145-800c-46d5-a6ad-74fc819ecd89"
},
"target": {
"cell": "d51521e3-186a-46ad-b093-b0e6f2c644be"
}
},
{
"shape": "edge",
"attrs": {
"line": {
"stroke": "#4D5B62",
"strokeWidth": 1
}
},
"id": "45c7e0a9-a067-4ac7-8cb2-ac6823c0e175",
"source": {
"cell": "24051177-ae41-49cf-8f33-495b885c4177"
},
"target": {
"cell": "22870145-800c-46d5-a6ad-74fc819ecd89"
},
"zIndex": 135,
"data": {}
}
]
}
@@ -163,16 +263,43 @@
"activities": [
{
"label": "开始",
"id": "d88319d5-66a6-4f37-90a6-1186ddb7b337",
"id": "5bc72ca4-58b3-4c95-9da5-a08bff6ec2e6",
"type": 1
},
{
"label": "接受",
"id": "08c500dd-28e7-488a-bf79-56d6fc783194",
"type": 9
"label": "制单",
"buttons": [
{
"type": "submit",
"label": "提交",
"valid": true
},
{
"type": "reject",
"label": "驳回",
"valid": true
},
{
"type": "retake",
"label": "取回",
"valid": true
},
{
"type": "cancel",
"label": "作废",
"valid": true
},
{
"type": "delete",
"label": "删除",
"valid": true
}
],
"id": "2fed55d9-d72c-4355-9208-a034477af0d7",
"type": 2
},
{
"label": "制单",
"label": "审1",
"buttons": [
{
"type": "submit",
@@ -200,15 +327,16 @@
"valid": true
}
],
"code": "make",
"page": "749216083826708481",
"canEdit": true,
"needSign": false,
"id": "a06b3e2f-588e-4b77-aa83-c3949399213d",
"id": "24051177-ae41-49cf-8f33-495b885c4177",
"type": 2
},
{
"label": "审批",
"label": "条件",
"id": "2fd67664-bd5d-4f88-978e-5ea1a2c27a28",
"type": 3
},
{
"label": "审2",
"buttons": [
{
"type": "submit",
@@ -236,32 +364,55 @@
"valid": true
}
],
"code": "approve",
"page": "749216083826708481",
"id": "c0cf8077-a879-4299-be0b-4dd041e8dac9",
"id": "22870145-800c-46d5-a6ad-74fc819ecd89",
"type": 2
},
{
"label": "接受",
"id": "d51521e3-186a-46ad-b093-b0e6f2c644be",
"type": 9
}
],
"trans": [
{
"label": "连接线",
"id": "03c8e73d-e009-49b5-ad4c-c9f060b8c24a",
"src": "d88319d5-66a6-4f37-90a6-1186ddb7b337",
"dst": "a06b3e2f-588e-4b77-aa83-c3949399213d"
"id": "49cc6225-8420-47d5-8f9f-55108a8b6c51",
"src": "5bc72ca4-58b3-4c95-9da5-a08bff6ec2e6",
"dst": "2fed55d9-d72c-4355-9208-a034477af0d7"
},
{
"label": "连接线",
"id": "f0061f8e-e1fd-453c-8bea-418e8473e77a",
"src": "2fed55d9-d72c-4355-9208-a034477af0d7",
"dst": "2fd67664-bd5d-4f88-978e-5ea1a2c27a28"
},
{
"label": "连接线",
"filter": "dcb_number>10",
"id": "d254cdb3-8ccc-49e9-a44e-39077598b253",
"src": "2fd67664-bd5d-4f88-978e-5ea1a2c27a28",
"dst": "24051177-ae41-49cf-8f33-495b885c4177"
},
{
"label": "连接线",
"filter": "dcb_number<=10",
"id": "0feaea9c-76f7-4421-8e96-05de4f802513",
"src": "2fd67664-bd5d-4f88-978e-5ea1a2c27a28",
"dst": "22870145-800c-46d5-a6ad-74fc819ecd89"
},
{
"label": "连接线",
"id": "9be76069-399c-4782-a141-5550d8d635e3",
"src": "a06b3e2f-588e-4b77-aa83-c3949399213d",
"dst": "c0cf8077-a879-4299-be0b-4dd041e8dac9"
"id": "7d1b7308-496f-483a-b40f-50212aca8cdb",
"src": "22870145-800c-46d5-a6ad-74fc819ecd89",
"dst": "d51521e3-186a-46ad-b093-b0e6f2c644be"
},
{
"label": "连接线",
"id": "b7b53812-8392-448a-8158-f3f9242fab50",
"src": "c0cf8077-a879-4299-be0b-4dd041e8dac9",
"dst": "08c500dd-28e7-488a-bf79-56d6fc783194"
"id": "45c7e0a9-a067-4ac7-8cb2-ac6823c0e175",
"src": "24051177-ae41-49cf-8f33-495b885c4177",
"dst": "22870145-800c-46d5-a6ad-74fc819ecd89"
}
],
"page": "749216083826708481"
"page": "751767421940928514"
}
}

Cargando…
Cancelar
Guardar