update 升级warm-flow1.7.4->1.7.5-m2 优化流程图悬浮窗

This commit is contained in:
AprilWind 2025-06-26 11:26:17 +08:00
parent 1ad0d5387b
commit 8f5d60f543
5 changed files with 70 additions and 57 deletions

View File

@ -48,7 +48,7 @@
<!-- 面向运行时的D-ORM依赖 --> <!-- 面向运行时的D-ORM依赖 -->
<anyline.version>8.7.2-20250603</anyline.version> <anyline.version>8.7.2-20250603</anyline.version>
<!-- 工作流配置 --> <!-- 工作流配置 -->
<warm-flow.version>1.7.4</warm-flow.version> <warm-flow.version>1.7.5-m2</warm-flow.version>
<!-- 插件版本 --> <!-- 插件版本 -->
<maven-jar-plugin.version>3.4.2</maven-jar-plugin.version> <maven-jar-plugin.version>3.4.2</maven-jar-plugin.version>

View File

@ -13,6 +13,7 @@ import org.dromara.common.mybatis.helper.DataBaseHelper;
import org.dromara.common.satoken.utils.LoginHelper; import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.warm.flow.core.service.DefService; import org.dromara.warm.flow.core.service.DefService;
import org.dromara.warm.flow.orm.entity.FlowDefinition; import org.dromara.warm.flow.orm.entity.FlowDefinition;
import org.dromara.warm.flow.ui.service.CategoryService;
import org.dromara.workflow.common.ConditionalOnEnable; import org.dromara.workflow.common.ConditionalOnEnable;
import org.dromara.workflow.common.constant.FlowConstant; import org.dromara.workflow.common.constant.FlowConstant;
import org.dromara.workflow.domain.FlowCategory; import org.dromara.workflow.domain.FlowCategory;
@ -35,7 +36,7 @@ import java.util.List;
@ConditionalOnEnable @ConditionalOnEnable
@RequiredArgsConstructor @RequiredArgsConstructor
@Service @Service
public class FlwCategoryServiceImpl implements IFlwCategoryService { public class FlwCategoryServiceImpl implements IFlwCategoryService, CategoryService {
private final DefService defService; private final DefService defService;
private final FlwCategoryMapper baseMapper; private final FlwCategoryMapper baseMapper;
@ -102,22 +103,37 @@ public class FlwCategoryServiceImpl implements IFlwCategoryService {
} }
// 获取当前列表中每一个节点的parentId然后在列表中查找是否有id与其parentId对应若无对应则表明此时节点列表中该节点在当前列表中属于顶级节点 // 获取当前列表中每一个节点的parentId然后在列表中查找是否有id与其parentId对应若无对应则表明此时节点列表中该节点在当前列表中属于顶级节点
List<Tree<String>> treeList = CollUtil.newArrayList(); List<Tree<String>> treeList = CollUtil.newArrayList();
for (FlowCategoryVo d : categorys) { for (FlowCategoryVo current : categorys) {
String parentId = d.getParentId().toString(); String parentId = current.getParentId().toString();
FlowCategoryVo categoryVo = StreamUtils.findFirst(categorys, it -> it.getCategoryId().toString().equals(parentId)); FlowCategoryVo categoryVo = StreamUtils.findFirst(categorys, it -> it.getCategoryId().toString().equals(parentId));
if (ObjectUtil.isNull(categoryVo)) { if (ObjectUtil.isNull(categoryVo)) {
List<Tree<String>> trees = TreeBuildUtils.build(categorys, parentId, (dept, tree) -> List<Tree<String>> trees = TreeBuildUtils.build(categorys, parentId, (node, tree) ->
tree.setId(dept.getCategoryId().toString()) tree.setId(node.getCategoryId().toString())
.setParentId(dept.getParentId().toString()) .setParentId(node.getParentId().toString())
.setName(dept.getCategoryName()) .setName(node.getCategoryName())
.setWeight(dept.getOrderNum())); .setWeight(node.getOrderNum()));
Tree<String> tree = StreamUtils.findFirst(trees, it -> it.getId().equals(d.getCategoryId().toString())); Tree<String> tree = StreamUtils.findFirst(trees, it -> it.getId().equals(current.getCategoryId().toString()));
treeList.add(tree); treeList.add(tree);
} }
} }
return treeList; return treeList;
} }
/**
* 工作流查询分类
*
* @return 分类树结构列表
*/
@Override
public List<org.dromara.warm.flow.core.dto.Tree> queryCategory() {
List<FlowCategoryVo> list = this.queryList(new FlowCategoryBo());
return StreamUtils.toList(list, category -> new org.dromara.warm.flow.core.dto.Tree()
.setId(String.valueOf(category.getCategoryId()))
.setName(category.getCategoryName())
.setParentId(String.valueOf(category.getParentId()))
);
}
/** /**
* 校验流程分类是否有数据权限 * 校验流程分类是否有数据权限
* *

View File

@ -12,7 +12,6 @@ import org.dromara.common.core.service.DeptService;
import org.dromara.common.core.service.DictService; import org.dromara.common.core.service.DictService;
import org.dromara.common.core.service.UserService; import org.dromara.common.core.service.UserService;
import org.dromara.common.core.utils.DateUtils; import org.dromara.common.core.utils.DateUtils;
import org.dromara.common.core.utils.ServletUtils;
import org.dromara.common.core.utils.StreamUtils; import org.dromara.common.core.utils.StreamUtils;
import org.dromara.common.core.utils.StringUtils; import org.dromara.common.core.utils.StringUtils;
import org.dromara.warm.flow.core.dto.DefJson; import org.dromara.warm.flow.core.dto.DefJson;
@ -53,12 +52,8 @@ public class FlwChartExtServiceImpl implements ChartExtService {
*/ */
@Override @Override
public void execute(DefJson defJson) { public void execute(DefJson defJson) {
// 临时修复 后续版本将通过defjson获取流程实例ID
String[] parts = ServletUtils.getRequest().getRequestURI().split("/");
Long instanceId = Convert.toLong(parts[parts.length - 1]);
// 根据流程实例ID查询所有相关的历史任务列表 // 根据流程实例ID查询所有相关的历史任务列表
List<FlowHisTask> flowHisTasks = this.getHisTaskGroupedByNode(instanceId); List<FlowHisTask> flowHisTasks = this.getHisTaskGroupedByNode(defJson.getInstance().getId());
if (CollUtil.isEmpty(flowHisTasks)) { if (CollUtil.isEmpty(flowHisTasks)) {
return; return;
} }
@ -74,14 +69,12 @@ public class FlwChartExtServiceImpl implements ChartExtService {
Map<String, String> dictType = dictService.getAllDictByDictType(FlowConstant.WF_TASK_STATUS); Map<String, String> dictType = dictService.getAllDictByDictType(FlowConstant.WF_TASK_STATUS);
// 遍历流程定义中的每个节点调用处理方法将对应节点的任务列表及用户信息传入生成扩展提示内容
for (NodeJson nodeJson : defJson.getNodeList()) { for (NodeJson nodeJson : defJson.getNodeList()) {
// 获取当前节点对应的历史任务列表如果没有则返回空列表避免空指针
List<FlowHisTask> taskList = groupedByNode.get(nodeJson.getNodeCode()); List<FlowHisTask> taskList = groupedByNode.get(nodeJson.getNodeCode());
if (CollUtil.isEmpty(taskList)) { if (CollUtil.isEmpty(taskList)) {
continue; continue;
} }
// 处理当前节点的扩展信息包括构建审批人提示内容等 // 处理当前节点的扩展信息
this.processNodeExtInfo(nodeJson, taskList, userMap, dictType); this.processNodeExtInfo(nodeJson, taskList, userMap, dictType);
} }
} }
@ -96,44 +89,44 @@ public class FlwChartExtServiceImpl implements ChartExtService {
defJson.setTopText("流程名称: " + defJson.getFlowName()); defJson.setTopText("流程名称: " + defJson.getFlowName());
defJson.getNodeList().forEach(nodeJson -> { defJson.getNodeList().forEach(nodeJson -> {
nodeJson.setPromptContent( nodeJson.setPromptContent(
new PromptContent() new PromptContent()
// 提示信息 // 提示信息主体内容样式
.setInfo( .setInfo(
CollUtil.newArrayList( CollUtil.newArrayList(
new PromptContent.InfoItem() new PromptContent.InfoItem()
.setPrefix("任务名称: ") .setPrefix("任务名称: ")
.setContent(nodeJson.getNodeName()) .setContent(nodeJson.getNodeName())
.setContentStyle(Map.of( .setContentStyle(Map.of(
"border", "1px solid #d1e9ff", "border", "1px solid #d1e9ff",
"backgroundColor", "#e8f4ff", "backgroundColor", "#e8f4ff",
"padding", "4px 8px", "padding", "4px 8px",
"borderRadius", "4px" "borderRadius", "4px"
)) ))
.setRowStyle(Map.of( .setRowStyle(Map.of(
"fontWeight", "bold", "fontWeight", "bold",
"margin", "0 0 6px 0", "margin", "0 0 6px 0",
"padding", "0 0 8px 0", "padding", "0 0 8px 0",
"borderBottom", "1px solid #ccc" "borderBottom", "1px solid #ccc"
)) ))
) ))
) // 弹窗容器样式包含滚动条设置
// 弹窗样式 .setDialogStyle(MapUtil.mergeAll(
.setDialogStyle(MapUtil.mergeAll( "position", "absolute",
"position", "absolute", "backgroundColor", "#fff",
"backgroundColor", "#fff", "border", "1px solid #ccc",
"border", "1px solid #ccc", "borderRadius", "4px",
"borderRadius", "4px", "boxShadow", "0 2px 8px rgba(0, 0, 0, 0.15)",
"boxShadow", "0 2px 8px rgba(0, 0, 0, 0.15)", "padding", "8px 12px",
"padding", "8px 12px", "fontSize", "14px",
"fontSize", "14px", "zIndex", "1000",
"zIndex", "1000", "maxWidth", "500px",
"maxWidth", "500px", "maxHeight", "300px", // 设置最大高度超过触发滚动
"overflowY", "visible", "overflowY", "auto", // 允许垂直滚动
"overflowX", "hidden", "overflowX", "hidden", // 禁止横向滚动
"color", "#333", "color", "#333",
"pointerEvents", "auto", "pointerEvents", "auto",
"scrollbarWidth", "thin" "scrollbarWidth", "thin" // 滚动条宽度细化部分浏览器支持
)) ))
); );
}); });
} }

View File

@ -6,6 +6,7 @@ CREATE TABLE `flow_definition`
`id` bigint NOT NULL COMMENT '主键id', `id` bigint NOT NULL COMMENT '主键id',
`flow_code` varchar(40) NOT NULL COMMENT '流程编码', `flow_code` varchar(40) NOT NULL COMMENT '流程编码',
`flow_name` varchar(100) NOT NULL COMMENT '流程名称', `flow_name` varchar(100) NOT NULL COMMENT '流程名称',
`mode` varchar(40) NOT NULL DEFAULT 'CLASSICS' COMMENT '设计器模式CLASSICS经典模式 MIMIC仿钉钉模式',
`category` varchar(100) DEFAULT NULL COMMENT '流程类别', `category` varchar(100) DEFAULT NULL COMMENT '流程类别',
`version` varchar(20) NOT NULL COMMENT '流程版本', `version` varchar(20) NOT NULL COMMENT '流程版本',
`is_publish` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否发布0未发布 1已发布 9失效', `is_publish` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否发布0未发布 1已发布 9失效',

View File

@ -7,6 +7,9 @@ ALTER TABLE `flow_instance`
ALTER TABLE `flow_his_task` ALTER TABLE `flow_his_task`
MODIFY COLUMN `flow_status` varchar(20) NOT NULL COMMENT '流程状态0待提交 1审批中 2审批通过 4终止 5作废 6撤销 8已完成 9已退回 10失效 11拿回' AFTER `skip_type`; MODIFY COLUMN `flow_status` varchar(20) NOT NULL COMMENT '流程状态0待提交 1审批中 2审批通过 4终止 5作废 6撤销 8已完成 9已退回 10失效 11拿回' AFTER `skip_type`;
ALTER TABLE `flow_definition`
ADD COLUMN `mode` varchar(40) NOT NULL DEFAULT 'CLASSICS' COMMENT '设计器模式CLASSICS经典模式 MIMIC仿钉钉模式' AFTER `flow_name`;
ALTER TABLE `sys_social` ALTER TABLE `sys_social`
MODIFY COLUMN `access_token` varchar(2000) NOT NULL COMMENT '用户的授权令牌' AFTER `avatar`; MODIFY COLUMN `access_token` varchar(2000) NOT NULL COMMENT '用户的授权令牌' AFTER `avatar`;
ALTER TABLE `sys_social` ALTER TABLE `sys_social`