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

网站建站解决方案营销策划方案公司

网站建站解决方案,营销策划方案公司,平顶山河南网站建设,美容院网站建设方案书更多ruoyi-nbcio功能请看演示系统 gitee源代码地址 前后端代码: https://gitee.com/nbacheng/ruoyi-nbcio 演示地址:RuoYi-Nbcio后台管理系统 1、上一节说到RedisReceiver ,这里有调用了NbcioRedisListener自定义业务监听,如下…

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

gitee源代码地址

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

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

1、上一节说到RedisReceiver ,这里有调用了NbcioRedisListener自定义业务监听,如下:

package com.ruoyi.common.redis.listener;import com.ruoyi.common.base.BaseMap;/***  自定义消息监听*  @author nbacheng*  @date 2023-09-20*/public interface NbcioRedisListener {void onMessage(BaseMap message);
}

2、实现这个代码如下:

package com.ruoyi.common.websocket;import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;import com.ruoyi.common.base.BaseMap;
import com.ruoyi.common.constant.CommonSendStatus;
import com.ruoyi.common.redis.listener.NbcioRedisListener;import cn.hutool.core.util.ObjectUtil;
import lombok.extern.slf4j.Slf4j;/*** 监听消息(采用redis发布订阅方式发送消息)*/
@Slf4j
@Component
public class SocketHandler implements NbcioRedisListener {@Autowiredprivate WebSocketServer webSocket;@Overridepublic void onMessage(BaseMap map) {log.info("【SocketHandler消息】Redis Listerer:" + map.toString());String userId = map.get("userId");String message = map.get("message");if (ObjectUtil.isNotEmpty(userId)) {webSocket.pushMessage(userId, message);//app端消息推送webSocket.pushMessage(userId+CommonSendStatus.APP_SESSION_SUFFIX, message);} else {webSocket.pushMessage(message);}}

       这里进行了websocket的服务器给用户推送,同时之前第一个节里公共类方法也同时往两个表增加数据,以便失败后后续可以进行发送,以确保能真正通知到用户。

3、接下来就是需要在用户提起流程发给审批人进行消息发送了

package com.ruoyi.flowable.listener;import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;import org.apache.commons.lang3.StringUtils;
import org.flowable.common.engine.api.delegate.event.FlowableEngineEventType;
import org.flowable.common.engine.api.delegate.event.FlowableEvent;
import org.flowable.common.engine.api.delegate.event.FlowableEventListener;
import org.flowable.common.engine.api.delegate.event.FlowableEventType;
import org.flowable.engine.HistoryService;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.TaskService;
import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.task.service.impl.persistence.entity.TaskEntity;
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 javax.annotation.Resource;/*** 全局监听-工作流待办消息提醒** @author nbacheng*/
@Slf4j
@Component
@RequiredArgsConstructor
public class TaskCreateListener implements FlowableEventListener {private final TaskService taskService;@Resourceprivate CommonService commonService;@Resourceprotected RepositoryService repositoryService;@Resourceprotected HistoryService historyService;@Overridepublic void onEvent(FlowableEvent flowableEvent) {FlowableEventType type = flowableEvent.getType();if (type == FlowableEngineEventType.TASK_ASSIGNED) { if(flowableEvent instanceof org.flowable.engine.delegate.event.impl.FlowableEntityEventImpl ) {TaskEntity taskEntity = (TaskEntity) ((org.flowable.engine.delegate.event.impl.FlowableEntityEventImpl) flowableEvent).getEntity();String taskId = taskEntity.getId();String procInsId = taskEntity.getProcessInstanceId();HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(procInsId).singleResult();String businessKey =  historicProcessInstance.getBusinessKey();String deployId = historicProcessInstance.getDeploymentId();String startUserId = historicProcessInstance.getStartUserId();//获取任务接收人String receiver = taskEntity.getAssignee();if (StringUtils.isNotEmpty(receiver)) {//发送提醒消息String category = "";if(taskService.getVariables(taskId).get("category") != null) {category = taskService.getVariables(taskId).get("category").toString();}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=true" + ">点击这个进行处理</a>" ;}else {taskMessageUrl = "<a href=" + commonService.getBaseUrl() + "?procInsId=" + procInsId + "&deployId=" + deployId + "&taskId=" + taskId + "&businessKey" + "&category=" + category + "&finished=true" + ">点击这个进行处理</a>" ;}String msgContent = "流程待办通知" + taskMessageUrl;if(!StringUtils.equals(startUserId, receiver) || !StringUtils.equals((loginUser.getUserId()).toString(),receiver)) {//发起人或登录人自己不发送log.info("流程待办通知给:" + receiver);commonService.sendSysNotice(loginUser.getUserId().toString(), receiver, "流程待办通知", msgContent, Constants.MSG_CATEGORY_3);//setMsgCategory=3是待办}}}}	}@Overridepublic boolean isFailOnException() {return false;}@Overridepublic boolean isFireOnTransactionLifecycleEvent() {return false;}@Overridepublic String getOnTransaction() {return null;}
}

http://www.khdw.cn/news/18593.html

相关文章:

  • 下瓦房做网站公司产品怎样推广有效
  • 免费网站客服系统app开发费用标准
  • 网站运营规划关键词排名怎么做好
  • 云服务器安装win系统做网站网页设计论文
  • 做网站 php和javaseo工程师
  • 怎么创建公司网站空间企业网站优化服务公司
  • 西樵建网站谷歌搜索引擎网页版入口
  • 本地门户网站源码快速排名服务平台
  • 温州网站建设公司排名百度一下官网首页下载
  • 深圳市疫情最新消息seo软件优化工具软件
  • 网站建设与网页设计案例教程代写文章
  • 做演讲视频的网站网站seo优化发布高质量外链
  • 江西宜春市建设局网站济南网站优化公司哪家好
  • 网站案例响应式本地网络seo公司
  • 网站建设 犀牛seo教程网站优化推广排名
  • wordpress左边栏轻松seo优化排名 快排
  • shopify建站费用怎么从网上找国外客户
  • 查企业免费百度seo收录软件
  • 手机网站建设企业seo专员的工作内容
  • 福田蒙派克空调滤芯安装位置图seo兼职平台
  • wordpress版主seo搜索推广
  • 个人博客网站开发历程百度如何优化
  • 淄博市淄川疫情最新情况seo搜索引擎优化排名
  • 网页界面设计总结与体会seo查询排名系统
  • 局域网及网站建设内容好看的seo网站
  • 滨江做网站百度招商客服电话
  • 怎么样在网上卖东西seo综合检测
  • 鞍山百姓网深圳seo
  • 做网站用html5问卷调查网站
  • 深圳云购网站制作南安seo