update 调整设计器保存发起人变量,修改菜单sql

This commit is contained in:
gssong 2023-11-30 21:21:16 +08:00
parent 9e2e58ff29
commit 61a45cb4f8
4 changed files with 19 additions and 18 deletions

View File

@ -64,6 +64,16 @@ public interface FlowConstant {
*/ */
String INITIATOR = "INITIATOR"; String INITIATOR = "INITIATOR";
/**
* 设计器中节点设置流程发起人
*/
String INITIATOR_SET = "$INITIATOR";
/**
* 修改设计器设置的变量错误内容
*/
String INITIATOR_SET_UPDATE = "${INITIATOR}";
/** /**
* 开启跳过表达式变量 * 开启跳过表达式变量
*/ */

View File

@ -1,7 +1,6 @@
package org.dromara.workflow.service.impl; package org.dromara.workflow.service.impl;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
@ -235,21 +234,6 @@ public class ActModelServiceImpl implements IActModelService {
repositoryService.saveModel(model); repositoryService.saveModel(model);
//解决设计器选择设置流程发起人设置变量有问题 //解决设计器选择设置流程发起人设置变量有问题
JsonNode jsonNode = objectMapper.readTree(values.getFirst("json_xml")); JsonNode jsonNode = objectMapper.readTree(values.getFirst("json_xml"));
JsonNode childShapes = jsonNode.get("childShapes");
for (JsonNode childShape : childShapes) {
JsonNode properties = childShape.get("properties");
if (!properties.path("usertaskassignment").isMissingNode()) {
JsonNode usertaskassignment = properties.get("usertaskassignment");
if (!usertaskassignment.path("assignment").isMissingNode()) {
JsonNode assignment = usertaskassignment.get("assignment");
if (!assignment.path("assignee").isMissingNode()) {
if ("$INITIATOR".equals(assignment.get("assignee").textValue())) {
((ObjectNode) assignment).put("assignee", "${INITIATOR}");
}
}
}
}
}
byte[] xmlBytes = WorkflowUtils.bpmnJsonToXmlBytes(Objects.requireNonNull(JsonUtils.toJsonString(jsonNode)).getBytes(StandardCharsets.UTF_8)); byte[] xmlBytes = WorkflowUtils.bpmnJsonToXmlBytes(Objects.requireNonNull(JsonUtils.toJsonString(jsonNode)).getBytes(StandardCharsets.UTF_8));
if (ArrayUtil.isEmpty(xmlBytes)) { if (ArrayUtil.isEmpty(xmlBytes)) {
throw new ServiceException("模型不能为空!"); throw new ServiceException("模型不能为空!");

View File

@ -50,7 +50,7 @@ import java.rmi.ServerException;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static org.dromara.workflow.common.constant.FlowConstant.PROCESS_INSTANCE_VO; import static org.dromara.workflow.common.constant.FlowConstant.*;
/** /**
* 工作流工具 * 工作流工具
@ -83,6 +83,13 @@ public class WorkflowUtils {
if (bpmnModel.getProcesses().isEmpty()) { if (bpmnModel.getProcesses().isEmpty()) {
return new byte[0]; return new byte[0];
} }
//解决设计器选择设置流程发起人设置变量有问题
Collection<FlowElement> flowElements = bpmnModel.getMainProcess().getFlowElements();
for (FlowElement flowElement : flowElements) {
if (flowElement instanceof UserTask && INITIATOR_SET.equals(((UserTask) flowElement).getAssignee())) {
((UserTask) flowElement).setAssignee(INITIATOR_SET_UPDATE);
}
}
// 2.将bpmnModel转为xml // 2.将bpmnModel转为xml
return new BpmnXMLConverter().convertToXML(bpmnModel); return new BpmnXMLConverter().convertToXML(bpmnModel);
} }

View File

@ -72,7 +72,7 @@ INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component,
INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (1510, '测试树表删除', 1506, 4, '#', '', 1, 0, 'F', '0', '0', 'demo:tree:remove', '#', 103, 1, sysdate(), NULL, NULL, ''); INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (1510, '测试树表删除', 1506, 4, '#', '', 1, 0, 'F', '0', '0', 'demo:tree:remove', '#', 103, 1, sysdate(), NULL, NULL, '');
INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (1511, '测试树表导出', 1506, 5, '#', '', 1, 0, 'F', '0', '0', 'demo:tree:export', '#', 103, 1, sysdate(), NULL, NULL, ''); INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (1511, '测试树表导出', 1506, 5, '#', '', 1, 0, 'F', '0', '0', 'demo:tree:export', '#', 103, 1, sysdate(), NULL, NULL, '');
INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (1638, '请假申请', 5, 1, 'leave', 'demo/leave/index', 1, 0, 'C', '0', '0', 'demo:leave:list', '#', 103, 1, sysdate(), NULL, NULL, '请假申请菜单'); INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (1638, '请假申请', 5, 1, 'leave', 'workflow/leave/index', 1, 0, 'C', '0', '0', 'demo:leave:list', '#', 103, 1, sysdate(), NULL, NULL, '请假申请菜单');
INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (1639, '请假申请查询', 1638, 1, '#', '', 1, 0, 'F', '0', '0', 'demo:leave:query', '#', 103, 1, sysdate(), NULL, NULL, ''); INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (1639, '请假申请查询', 1638, 1, '#', '', 1, 0, 'F', '0', '0', 'demo:leave:query', '#', 103, 1, sysdate(), NULL, NULL, '');
INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (1640, '请假申请新增', 1638, 2, '#', '', 1, 0, 'F', '0', '0', 'demo:leave:add', '#', 103, 1, sysdate(), NULL, NULL, ''); INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (1640, '请假申请新增', 1638, 2, '#', '', 1, 0, 'F', '0', '0', 'demo:leave:add', '#', 103, 1, sysdate(), NULL, NULL, '');
INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (1641, '请假申请修改', 1638, 3, '#', '', 1, 0, 'F', '0', '0', 'demo:leave:edit', '#', 103, 1, sysdate(), NULL, NULL, ''); INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (1641, '请假申请修改', 1638, 3, '#', '', 1, 0, 'F', '0', '0', 'demo:leave:edit', '#', 103, 1, sysdate(), NULL, NULL, '');