当前位置: 首页 > news >正文

吴桥网站建设公司种子搜索引擎 磁力天堂

吴桥网站建设公司,种子搜索引擎 磁力天堂,网易免费邮箱注册,网站建设360 全景制作方案更多ruoyi-nbcio功能请看演示系统 gitee源代码地址 前后端代码: https://gitee.com/nbacheng/ruoyi-nbcio 演示地址:RuoYi-Nbcio后台管理系统 上一节说到待办系统的监听器TaskCreateListener,需要在flowable全局监听配置里加入配置 1、Glo…

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

gitee源代码地址

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

演示地址:RuoYi-Nbcio后台管理系统

 

 上一节说到待办系统的监听器TaskCreateListener,需要在flowable全局监听配置里加入配置

  1、GlobalEventListenerConfig.java文件如下:

package com.ruoyi.flowable.config;import com.ruoyi.flowable.listener.GlobalEventListener;
import com.ruoyi.flowable.listener.ProcessCompleteListener;
import com.ruoyi.flowable.listener.TaskCreateListener;import lombok.AllArgsConstructor;
import org.flowable.common.engine.api.delegate.event.FlowableEngineEventType;
import org.flowable.common.engine.api.delegate.event.FlowableEventDispatcher;
import org.flowable.engine.RuntimeService;
import org.flowable.spring.SpringProcessEngineConfiguration;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.event.ContextRefreshedEvent;/*** flowable全局监听配置** @author ssc*/
@Configuration
@AllArgsConstructor
public class GlobalEventListenerConfig implements ApplicationListener<ContextRefreshedEvent> {private final GlobalEventListener globalEventListener;private final RuntimeService runtimeService;private final SpringProcessEngineConfiguration configuration;private final TaskCreateListener taskCreateListener;private final ProcessCompleteListener processCompleteListener;@Overridepublic void onApplicationEvent(ContextRefreshedEvent event) {FlowableEventDispatcher dispatcher = configuration.getEventDispatcher();// 任务创建全局监听-待办消息发送dispatcher.addEventListener(taskCreateListener, FlowableEngineEventType.TASK_CREATED, FlowableEngineEventType.TASK_ASSIGNED);//任务创建全局监听-完成消息发送dispatcher.addEventListener(processCompleteListener, FlowableEngineEventType.PROCESS_COMPLETED);// 流程正常结束runtimeService.addEventListener(globalEventListener, FlowableEngineEventType.PROCESS_COMPLETED);}
}

2、还增加了一个流程结束的通知监听如下:

package com.ruoyi.flowable.listener;import java.util.List;import javax.annotation.Resource;import org.apache.commons.lang3.StringUtils;
import org.flowable.common.engine.api.delegate.event.FlowableEngineEntityEvent;
import org.flowable.common.engine.api.delegate.event.FlowableEvent;
import org.flowable.engine.HistoryService;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.TaskService;
import org.flowable.engine.delegate.event.AbstractFlowableEngineEventListener;
import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.engine.impl.persistence.entity.ExecutionEntityImpl;
import org.flowable.task.api.Task;
import org.flowable.variable.api.persistence.entity.VariableInstance;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;import com.ruoyi.common.core.service.CommonService;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.model.LoginUser;import lombok.RequiredArgsConstructor;/*** 全局监听-工作流完成消息提醒** @author nbacheng*///必须要用 AbstractFlowableEngineEventListener 用FlowableEventListener这个会出现问题,应该是已经完成了
@Component
@RequiredArgsConstructor
public class ProcessCompleteListener extends AbstractFlowableEngineEventListener {private final TaskService taskService;@Resourceprivate CommonService commonService;@Autowiredprotected HistoryService historyService;@Resourceprotected RepositoryService repositoryService;@Overrideprotected void processCompleted(FlowableEngineEntityEvent event) {System.out.println("进入流程结束监听器……");String procInsId = event.getProcessInstanceId();HistoricProcessInstance hi = historyService.createHistoricProcessInstanceQuery().processInstanceId(procInsId).singleResult();List<Task> listtask = taskService.createTaskQuery().processInstanceId(procInsId).active().list();String taskId = "";if(listtask !=null) {taskId = listtask.get(0).getId();}String startUserId = hi.getStartUserId();String businessKey =  hi.getBusinessKey();String deployId = hi.getDeploymentId();String category =  "";if (StringUtils.isNotEmpty(startUserId)) {// TODO:  发送提醒消息if(((ExecutionEntityImpl)event.getEntity()).getVariableInstances().get("category") !=null) {category = ((VariableInstance)((ExecutionEntityImpl)event.getEntity()).getVariableInstances().get("category")).getTextValue();}LoginUser loginUser = commonService.getLoginUser();String taskMessageUrl;if(StringUtils.isNotBlank(businessKey)) {taskMessageUrl = "<a href=" + commonService.getBaseUrl() + "?procInsId=" + procInsId + "&deployId=" + deployId + "&taskId=" + taskId + "&businessKey=" + businessKey + "&category=" + category+ "&finished=false" + ">点击这个进行查看</a>" ;}else {taskMessageUrl = "<a href=" + commonService.getBaseUrl() + "?procInsId=" + procInsId + "&deployId=" + deployId + "&taskId=" + taskId + "&businessKey" + "&category=" + category + "&finished=false" + ">点击这个进行查看</a>" ;}String msgContent = "流程任务结束通知" + taskMessageUrl; commonService.sendSysNotice(loginUser.getUsername(), startUserId, "流程任务结束通知", msgContent, Constants.MSG_CATEGORY_1);//setMsgCategory=1是通知}super.processCompleted(event);}@Overrideprotected void taskCompleted(FlowableEngineEntityEvent event) {System.out.println("进入taskCompleted监听器……");super.taskCompleted(event);}@Overridepublic void onEvent(FlowableEvent flowableEvent) {System.out.println("进入taskCompleted监听器--onEvent……");super.onEvent(flowableEvent);}
}

当然这两个监听还需要根据实际进行个性化定制与修改。

http://www.tj-hxxt.cn/news/65780.html

相关文章:

  • 长春网站建设小程营销和销售的区别
  • 百度这个网站怎么做宁波厂家关键词优化
  • 舌尖上的西安 网站怎么做百度软件安装
  • 杭州做网站的好公司有哪些全球网络营销公司排行榜
  • 宜昌网站设计制作公司单页面seo搜索引擎优化
  • 免费做网站模板在哪里做网络营销推广方案前言
  • 微信公共平台开发seo文章代写平台
  • 网页设计与网站建设连接数据库广告软文是什么意思
  • 做网站 多页面网址怎么弄网域名查询地址
  • c 鲜花店网站建设石家庄最新新闻事件
  • 织梦做商城网站舆情通
  • 个人网站名称有哪些百度竞价广告的位置
  • 黄山网站建设费用国内广告联盟平台
  • 鄂州市网站娃哈哈软文推广
  • 做网站都用到哪些软件咸阳seo公司
  • 中国建设招标网是个假网站优化设计答案六年级上册语文
  • 途牛电子商务网站建设百度指数怎么看城市
  • 网站开发与规划附近的电脑培训班在哪里
  • 网站设计方案应该怎么做百度网站首页提交入口
  • 网站建设的实际价值网站在线客服系统 免费
  • wordpress 企业整站sem是什么品牌
  • 网站建设和管理中 经验seo百度刷排名
  • 400全国服务热线佛山手机网站建设免费下载百度一下
  • 网站开发公司企业官网win7优化大师
  • wordpress文档插件seo关键词挖掘
  • wordpress建站赚钱seo知识是什么意思
  • 做版权素材网站门槛市场推广的方法和规划
  • 网站做的好坏主要看什么是网络营销?
  • 网站做跳转会有什么影响诊断网站seo现状的方法
  • 学校门户网站作用百度搜索下载安装