基于jeecg-boot的flowable流程历史记录显示修改

更多nbcio-boot功能请看演示系统

gitee源代码地址

后端代码: https://gitee.com/nbacheng/nbcio-boot

前端代码:https://gitee.com/nbacheng/nbcio-vue.git

在线演示(包括H5) : http://122.227.135.243:9888
 

历史记录增加开始与结束的显示,以方便用户查看。

1、前端修改,代码如下:

<el-card class="box-card" v-if="flowRecordList"><div slot="header" class="clearfix"><span class="el-icon-notebook-1">审批记录</span></div><el-col :span="16" :offset="4"><div class="block"><el-timeline><el-timeline-item v-for="(item,index ) in flowRecordList" :key="index" :icon="setIcon(item.finishTime)":color="setColor(item.finishTime)"><p style="font-weight: 700">{{item.taskName}}</p><el-card v-if="item.activityType === 'startEvent'" class="box-card" shadow="hover">{{ item.assigneeName }} 在 {{ item.createTime }} 发起流程</el-card><el-card v-if="item.activityType === 'userTask'" :body-style="{ padding: '10px' }"><label v-if="item.assigneeName" style="font-weight: normal;margin-right: 30px;">实际办理:{{item.assigneeName}}<el-tag type="info" size="mini">{{item.deptName}}</el-tag></label><label v-if="item.candidate" style="font-weight: normal;margin-right: 30px;">候选办理:{{item.candidate}}</label><label style="font-weight: normal">接收时间: </label><labelstyle="color:#8a909c;font-weight: normal">{{item.createTime}}</label><label v-if="item.finishTime" style="margin-left: 30px;font-weight: normal">办结时间: </label><labelstyle="color:#8a909c;font-weight: normal">{{item.finishTime}}</label><label v-if="item.duration" style="margin-left: 30px;font-weight: normal">耗时: </label><labelstyle="color:#8a909c;font-weight: normal">{{item.duration}}</label><p v-if="item.listFlowCommentDto" v-for="(commentitem,index ) in item.listFlowCommentDto" :key="index"><el-tag type="success" v-if="commentitem.type === '1'"> {{commentitem.comment}}</el-tag><el-form  v-if= "commentitem.type === '1' && fileitem.type === '1'  && item.listcommentFileDto.length>0" v-for="(fileitem,fileindex ) in item.listcommentFileDto" :key="fileindex"><el-form-item label="附件"  prop="listcommentFileDto"><j-upload  v-if="fileitem.type === '1'" v-model="fileitem.fileurl" :disabled = "true"  text="上传的文件" ></j-upload>                 </el-form-item></el-form>  <el-tag type="warning" v-if="commentitem.type === '2'"> {{"退回: "+ commentitem.comment}}</el-tag><el-form v-if= "commentitem.type === '2' && fileitem.type === '2'  && item.listcommentFileDto.length>0" v-for="(fileitem,fileindex ) in item.listcommentFileDto" :key="fileindex"><el-form-item label="附件"  prop="listcommentFileDto"><j-upload v-if="fileitem.type === '2'" v-model="fileitem.fileurl" :disabled = "true"  text="退回上传的文件" ></j-upload> </el-form-item></el-form>  <el-tag type="danger" v-if="commentitem.type === '3'">  {{"驳回: "+commentitem.comment}}</el-tag><el-form v-if= "commentitem.type === '3' && fileitem.type === '3'  && item.listcommentFileDto.length>0" v-for="(fileitem,fileindex ) in item.listcommentFileDto" :key="fileindex"><el-form-item label="附件"  prop="listcommentFileDto"><j-upload v-if="fileitem.type === '3'"  v-model="fileitem.fileurl" :disabled = "true"  text="驳回上传的文件" ></j-upload></el-form-item></el-form>  <el-tag type="success" v-if="commentitem.type === '4'">  {{commentitem.comment}}</el-tag><el-form  v-if= "commentitem.type === '4' && fileitem.type === '4'  && item.listcommentFileDto.length>0" v-for="(fileitem,fileindex ) in item.listcommentFileDto" :key="fileindex"><el-form-item label="附件"  prop="listcommentFileDto"><j-upload  v-if="fileitem.type === '4'" v-model="fileitem.fileurl" :disabled = "true"  text="委派上传的文件" ></j-upload>                 </el-form-item></el-form>  <el-tag type="success" v-if="commentitem.type === '5'">  {{commentitem.comment}}</el-tag>  <el-form v-if= "commentitem.type === '5' && fileitem.type === '5' && item.listcommentFileDto.length>0" v-for="(fileitem,fileindex ) in item.listcommentFileDto" :key="fileindex"><el-form-item label="附件"  prop="listcommentFileDto" ><j-upload v-model="fileitem.fileurl" :disabled = "true"  text="转办上传的文件" ></j-upload></el-form-item></el-form>  <el-tag type="warning" v-if="commentitem.type === '7'"> {{"撤回: "+commentitem.comment}}</el-tag>  <!--撤回信息--><el-tag type="warning" v-if="commentitem.type === '6'"> {{commentitem.comment}}</el-tag>  <!--终止信息--><el-tag type="warning" v-if="commentitem.type === '8'"> {{commentitem.comment}}</el-tag>  <!--跳过信息--><el-tag type="success" v-if="commentitem.type === '9'"> {{commentitem.comment}}</el-tag>  <!--前加签--><el-tag type="success" v-if="commentitem.type === '10'"> {{commentitem.comment}}</el-tag>  <!--后加签--><el-tag type="success" v-if="commentitem.type === '11'"> {{commentitem.comment}}</el-tag>  <!--多实例加签--><el-tag type="success" v-if="commentitem.type === '12'"> {{commentitem.comment}}</el-tag>  <!--跳转信息--></p></el-card><el-card v-if="item.activityType === 'endEvent'" class="box-card" shadow="hover">{{ item.createTime }} 流程结束</el-card></el-timeline-item></el-timeline></div></el-col></el-card>

2、后端修改

/*** 流程历史流转记录* add by nbacheng* @param  procInsId 流程实例Id, 流程发布id, 任务id* @return*/@Overridepublic Result flowRecord(String procInsId,String deployId, String businessKey, String taskId, String category) {Map<String, Object> map = new HashMap<String, Object>();if (StringUtils.isNotBlank(procInsId)) {List<HistoricActivityInstance> list = historyService.createHistoricActivityInstanceQuery().processInstanceId(procInsId).activityTypes(CollUtil.newHashSet(BpmnXMLConstants.ELEMENT_EVENT_START, BpmnXMLConstants.ELEMENT_EVENT_END, BpmnXMLConstants.ELEMENT_TASK_USER)).orderByHistoricActivityInstanceStartTime().desc().orderByHistoricActivityInstanceEndTime().desc().list();List<FlowTaskDto> hisFlowList = new ArrayList<>();// 获取流程实例HistoricProcessInstance historicProcIns = historyService.createHistoricProcessInstanceQuery().processInstanceId(procInsId).includeProcessVariables().singleResult();String startUserId = historicProcIns.getStartUserId();for (HistoricActivityInstance histIns : list) {FlowTaskDto flowTask = new FlowTaskDto();if (BpmnXMLConstants.ELEMENT_EVENT_START.equals(histIns.getActivityType())) {SysUser startUser = iFlowThirdService.getUserByUsername(startUserId);flowTask.setAssigneeId(startUser.getUsername());flowTask.setAssigneeName(startUser.getRealname());flowTask.setCreateTime(histIns.getStartTime());flowTask.setFinishTime(histIns.getEndTime());flowTask.setActivityType(histIns.getActivityType());}if (BpmnXMLConstants.ELEMENT_EVENT_END.equals(histIns.getActivityType())) {flowTask.setCreateTime(histIns.getStartTime());flowTask.setFinishTime(histIns.getEndTime());flowTask.setActivityType(histIns.getActivityType());}if (StringUtils.isNotBlank(histIns.getTaskId())) {flowTask.setTaskId(histIns.getTaskId());flowTask.setTaskName(histIns.getActivityName());flowTask.setCreateTime(histIns.getStartTime());flowTask.setFinishTime(histIns.getEndTime());flowTask.setActivityType(histIns.getActivityType());if (StringUtils.isNotBlank(histIns.getAssignee())) {SysUser sysUser = iFlowThirdService.getUserByUsername(histIns.getAssignee());if(sysUser !=null) {flowTask.setAssigneeId(sysUser.getUsername());flowTask.setAssigneeName(sysUser.getRealname());List<String> departNamesByUsername = iFlowThirdService.getDepartNamesByUsername(histIns.getAssignee());flowTask.setDeptName(CollUtil.join(departNamesByUsername,","));}}// 展示审批人员List<HistoricIdentityLink> linksForTask = historyService.getHistoricIdentityLinksForTask(histIns.getTaskId());StringBuilder stringBuilder = new StringBuilder();for (HistoricIdentityLink identityLink : linksForTask) {if ("candidate".equals(identityLink.getType())) {if (StringUtils.isNotBlank(identityLink.getUserId())) {SysUser sysUser = iFlowThirdService.getUserByUsername(identityLink.getUserId());stringBuilder.append(sysUser.getRealname()).append(",");}if (StringUtils.isNotBlank(identityLink.getGroupId())) {List<SysRole> allRole = iFlowThirdService.getAllRole();SysRole sysRole = allRole.stream().filter(o -> StringUtils.equals(identityLink.getGroupId(), o.getId())).findAny().orElse(new SysRole());stringBuilder.append(sysRole.getRoleName()).append(",");}}}if (StringUtils.isNotBlank(stringBuilder)) {flowTask.setCandidate(stringBuilder.substring(0, stringBuilder.length() - 1));}flowTask.setDuration(histIns.getDurationInMillis() == null || histIns.getDurationInMillis() == 0 ? null : getDate(histIns.getDurationInMillis()));// 获取意见评论内容List<Comment> commentList = taskService.getProcessInstanceComments(histIns.getProcessInstanceId());List<FlowCommentDto> listFlowCommentDto = new ArrayList<FlowCommentDto>();commentList.forEach(comment -> {if (histIns.getTaskId().equals(comment.getTaskId())) {//flowTask.setComment(FlowCommentDto.builder().type(comment.getType()).comment(comment.getFullMessage()).build());//FlowCommentDto flowcommentDto = FlowCommentDto.builder().type(comment.getType()).comment(comment.getFullMessage()).build();FlowCommentDto flowcommentDto = new FlowCommentDto();flowcommentDto.setType(comment.getType());flowcommentDto.setComment(comment.getFullMessage());listFlowCommentDto.add(flowcommentDto);}});flowTask.setListFlowCommentDto(listFlowCommentDto);//获取附件List<Attachment> commentfileList = taskService.getProcessInstanceAttachments(histIns.getProcessInstanceId());List<FlowCommentFileDto> listcommentFileDto =  new ArrayList<FlowCommentFileDto>();commentfileList.forEach(commentfile -> {if (histIns.getTaskId().equals(commentfile.getTaskId())) {FlowCommentFileDto flowcommenfiletDto = new FlowCommentFileDto();flowcommenfiletDto.setType(commentfile.getType());flowcommenfiletDto.setFileurl(commentfile.getUrl());listcommentFileDto.add(flowcommenfiletDto);}});flowTask.setListcommentFileDto(listcommentFileDto);// 获取历史任务节点表单数据值List<HistoricVariableInstance> listHistoricVariableInstance = historyService.createHistoricVariableInstanceQuery().processInstanceId(procInsId).taskId(histIns.getTaskId()).list();  Map<String, Object> variables = new HashedMap<String, Object>();Map<String, Object> formconf = new HashedMap<String, Object>();for(HistoricVariableInstance historicVariableInstance:listHistoricVariableInstance) {variables.put(historicVariableInstance.getVariableName(), historicVariableInstance.getValue());}formconf.put("formValue", variables);// 获取历史任务节点表单参数if(Objects.nonNull(histIns.getTaskId())) {HistoricTaskInstance taskIns = historyService.createHistoricTaskInstanceQuery().taskId(histIns.getTaskId()).includeIdentityLinks().includeProcessVariables().includeTaskLocalVariables().finished().singleResult();if (Objects.nonNull(taskIns)) {{String formId = taskIns.getFormKey();SysForm sysForm = sysDeployFormService.selectCurSysDeployForm(formId, deployId, taskIns.getTaskDefinitionKey());if (Objects.nonNull(sysForm)) {formconf.put("config", JSONObject.parseObject(sysForm.getFormContent()).get("config"));formconf.put("list", JSONObject.parseObject(sysForm.getFormContent()).get("list"));}}}}    flowTask.setTaskFormValues(formconf);}hisFlowList.add(flowTask);}map.put("flowList", hisFlowList);}if (Objects.nonNull(category) && category.equalsIgnoreCase("online") && StringUtils.isNotBlank(businessKey)) {// 获取online数据表单配置LambdaQueryWrapper<FlowMyOnline> flowMyOnlineLambdaQueryWrapper = new LambdaQueryWrapper<>();flowMyOnlineLambdaQueryWrapper.eq(FlowMyOnline::getDataId, businessKey);//以后这里还要加上onlineIdFlowMyOnline online = flowMyOnlineService.getOne(flowMyOnlineLambdaQueryWrapper);if (Objects.nonNull(online)) {Map<String, Object> onlCgformHeadMap = flowOnlCgformHeadService.getOnlCgformHeadByFormId(online.getOnlineId());map.put("onlineConfig", onlCgformHeadMap.get("formData"));map.put("onlineId", online.getOnlineId());}}else if (Objects.nonNull(category) && StringUtils.isNotBlank(businessKey) && !Objects.equals(businessKey, "null") && (category != "online")) { // 获取初始化自定义表单FlowMyBusiness business = flowMyBusinessService.getByDataId(businessKey);String serviceImplName = business.getServiceImplName();FlowCallBackServiceI flowCallBackService = (FlowCallBackServiceI) SpringContextUtils.getBean(serviceImplName);// 流程处理完后,进行回调业务层if (flowCallBackService!=null){Object businessDataById = flowCallBackService.getBusinessDataById(businessKey);map.put("formData",businessDataById);map.put("routeName", business.getRouteName());}}else {if (StringUtils.isNotBlank(deployId)) {//获取当前节点的初始化表单if(Objects.nonNull(taskId)) {HistoricTaskInstance taskIns = historyService.createHistoricTaskInstanceQuery().taskId(taskId).includeIdentityLinks().includeProcessVariables().includeTaskLocalVariables().singleResult();if (Objects.nonNull(taskIns)) {String formId = taskIns.getFormKey();SysForm sysForm = sysDeployFormService.selectCurSysDeployForm(formId, deployId, taskIns.getTaskDefinitionKey());if (Objects.nonNull(sysForm)) {map.put("taskFormData", JSONObject.parseObject(sysForm.getFormContent()));}}}else {SysForm sysForm = sysDeployFormService.selectSysDeployFormByDeployId(deployId);if (Objects.isNull(sysForm)) {return Result.error("请先配置流程表单");}map.put("formData", JSONObject.parseObject(sysForm.getFormContent()));}}}if(isStartUserNode(taskId)) {map.put("isStartUserNode", true);}return Result.OK(map);}

3、效果图

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/101431.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

vue中v-for循环数组使用方法中splice删除数组元素(每次都删掉点击的下面的一项)

总结&#xff1a;平常使用v-for的key都是使用index&#xff0c;这里vue官方文档也不推荐&#xff0c;这个时候就出问题了&#xff0c;我们需要key为唯一标识&#xff0c;这里我使用了时间戳&#xff08;new Date().getTime()&#xff09;处理比较复杂的情况&#xff0c; 本文章…

OSPF路由协议

OSPF基本信息 OSPF&#xff08;Open Shortest Path First&#xff09;开放式最短路径优先协议是用于网际协议&#xff08;IP&#xff09;网络的链路状态路由协议。该协议使用链路状态路由算法的内部网关协议&#xff08;IGP&#xff09;&#xff0c;在单一自治系统&#xff08…

算法通关村-----快速排序的应用

数组中的第K个最大元素 问题描述 给定整数数组 nums 和整数 k&#xff0c;请返回数组中第 k 个最大的元素。请注意&#xff0c;你需要找的是数组排序后的第 k 个最大的元素&#xff0c;而不是第 k 个不同的元素。详见leetcode215 问题分析 之前我们已经使用堆排序/堆查找的…

在CentOS7中,安装并配置Redis【个人笔记】

一、拓展——Ubuntu上安装Redis 输入命令su --->切换到root用户【如果已经是&#xff0c;则不需要进行该操作】apt search redis --->使用apt命令来搜索redis相关的软件包【查询后&#xff0c;检查redis版本是否是你需要的&#xff0c;如果不是则需要看看其他资料~】ap…

安卓10创建文件夹失败

最近在做拍照录像功能&#xff0c;已经有了文件读写权限&#xff0c;却发现在9.0手机上正常使用&#xff0c;但是在安卓12系统上根本没有创建文件夹。经过研究发现&#xff0c;创建名称为“DCIM”的文件夹可以&#xff0c;别的又都不行。而且是getExternalStorageDirectory和ge…

OpenCV基本操(IO操作,读取、显示、保存)

图像的IO操作&#xff0c;读取和保存方法 1.1 API cv.imread()参数&#xff1a; 要读取的图像 读取图像的方式&#xff1a; cv.IMREAD*COLOR:以彩色模式加载图像&#xff0c;任何图像的图像的透明度都将被忽略。这是默认参数 标志&#xff1a; 1 cv.IMREAD*GRAYSCALE :以…

由Qt::BlockingQueuedConnection引起的关闭Qt主页面而后台仍有进程残留

BUG&#xff1a;由Qt::BlockingQueuedConnection引起的关闭Qt主页面而后台仍有进程残留 1、错误代码示例 首先我们看下下面的代码&#xff0c;可以思考一下代码的错误之处 /** BlockingQueueDeadLock.h **/ #pragma once#include <QtWidgets/QMainWindow> #include &q…

【C刷题训练营】第三讲(c语言入门训练)

前言: 大家好&#xff0c;我决定日后逐渐更新c刷题训练营的内容&#xff0c;或许能帮到入门c语言的初学者&#xff0c;如果文章有错误&#xff0c;非常欢迎你的指正&#xff01; &#x1f4a5;&#x1f388;个人主页:​​​​​​Dream_Chaser&#xff5e; &#x1f388;&…

Linux命令200例:Yum强大的包管理工具使用(常用)

&#x1f3c6;作者简介&#xff0c;黑夜开发者&#xff0c;CSDN领军人物&#xff0c;全栈领域优质创作者✌。CSDN专家博主&#xff0c;阿里云社区专家博主&#xff0c;2023年6月csdn上海赛道top4。 &#x1f3c6;数年电商行业从业经验&#xff0c;历任核心研发工程师&#xff0…

MindsDB为许多不支持内置机器学习的数据库带来了机器学习功能

选择平台的首要原则是“靠近数据”,让代码靠近数据是保持低延迟的必要条件。 机器学习,特别是深度学习往往会多次遍历所有数据(遍历一次被称为一个epoch)。对于非常大的数据集来说,理想的情况是在存储数据的地方建立模型,这样就不需要大量的数据传输。目前已经有部分数据…

不用额外插件?RunnerGo内置压测模式怎么选

我们在做性能测试时需要根据性能需求配置不同的压测模式如&#xff1a;阶梯模式。使用jmeter时我们需要安装插件来配置测试模式&#xff0c;为了方便用户使用&#xff0c;RunnerGo内嵌了压测模式这一选项&#xff0c;今天给大家介绍一下RunnerGo的几种压测模式和怎么根据性能需…

手写Spring:第19章-JDBC功能整合

文章目录 一、目标&#xff1a;JDBC功能整合二、设计&#xff1a;JDBC功能整合三、实现&#xff1a;JDBC功能整合3.1 工程结构3.2 整合JDBC功能核心类图3.3 数据源操作3.3.1 数据源操作抽象类3.3.2 JDBC 工具类 3.4 数据库执行3.4.1 语句处理器接口3.4.2 结果处理器接口3.4.3 行…