Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
J
jyzb_platformV2
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Members
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
赵剑炜
jyzb_platformV2
Commits
b0ddafe4
Commit
b0ddafe4
authored
Dec 01, 2023
by
赵剑炜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
消息推送代码调整
parent
52b0af84
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
45 行增加
和
12 行删除
+45
-12
CounterSignListener.java
jyzb-biz/src/main/java/com/junmp/jyzb/listener/CounterSignListener.java
+8
-5
GlobalEndListener.java
jyzb-biz/src/main/java/com/junmp/jyzb/listener/GlobalEndListener.java
+37
-7
没有找到文件。
jyzb-biz/src/main/java/com/junmp/jyzb/listener/CounterSignListener.java
View file @
b0ddafe4
...
@@ -45,8 +45,7 @@ import org.springframework.stereotype.Component;
...
@@ -45,8 +45,7 @@ import org.springframework.stereotype.Component;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.*
;
import
java.util.*
;
import
static
com
.
junmp
.
junmpProcess
.
common
.
CommonConstants
.
BUSINESS_STATUS_4
;
import
static
com
.
junmp
.
junmpProcess
.
common
.
CommonConstants
.*;
import
static
com
.
junmp
.
junmpProcess
.
common
.
CommonConstants
.
PROCESS_STATUS
;
import
static
com
.
junmp
.
junmpProcess
.
utils
.
BpmnModelUtils
.
getChildNode
;
import
static
com
.
junmp
.
junmpProcess
.
utils
.
BpmnModelUtils
.
getChildNode
;
/**
/**
...
@@ -77,6 +76,7 @@ public class CounterSignListener implements ExecutionListener {
...
@@ -77,6 +76,7 @@ public class CounterSignListener implements ExecutionListener {
public
void
notify
(
DelegateExecution
execution
)
{
public
void
notify
(
DelegateExecution
execution
)
{
String
currentActivityId
=
execution
.
getCurrentActivityId
();
String
currentActivityId
=
execution
.
getCurrentActivityId
();
Process
mainProcess
=
repositoryService
.
getBpmnModel
(
execution
.
getProcessDefinitionId
()).
getMainProcess
();
Process
mainProcess
=
repositoryService
.
getBpmnModel
(
execution
.
getProcessDefinitionId
()).
getMainProcess
();
UserTask
userTask
=
(
UserTask
)
mainProcess
.
getFlowElement
(
currentActivityId
);
UserTask
userTask
=
(
UserTask
)
mainProcess
.
getFlowElement
(
currentActivityId
);
String
flowJson
=
mainProcess
.
getAttributeValue
(
"http://flowable.org/bpmn"
,
"Junmp"
);
String
flowJson
=
mainProcess
.
getAttributeValue
(
"http://flowable.org/bpmn"
,
"Junmp"
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
flowJson
,
new
TypeReference
<
JSONObject
>()
{
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
flowJson
,
new
TypeReference
<
JSONObject
>()
{
...
@@ -300,9 +300,12 @@ public class CounterSignListener implements ExecutionListener {
...
@@ -300,9 +300,12 @@ public class CounterSignListener implements ExecutionListener {
{
{
MessageSendReq
sendReq
=
new
MessageSendReq
();
MessageSendReq
sendReq
=
new
MessageSendReq
();
sendReq
.
setReceiveUserIds
(
String
.
valueOf
(
userId
));
sendReq
.
setReceiveUserIds
(
String
.
valueOf
(
userId
));
sendReq
.
setMsgTitle
(
"单据审批提示"
);
sendReq
.
setMsgTitle
(
"您有新的待办任务"
);
sendReq
.
setBizType
(
"单据审批"
);
sendReq
.
setBizType
(
execution
.
getVariable
(
ORDER_TYPE
).
toString
());
sendReq
.
setMsgContent
(
"您有一条单据流程需要进行审批"
);
sendReq
.
setBizId
(
Long
.
valueOf
(
execution
.
getProcessInstanceId
()));
String
StartUser
=
execution
.
getVariable
(
START_USER_INFO
).
toString
();
UserInfo
user
=
JSONObject
.
parseObject
(
StartUser
,
UserInfo
.
class
);
sendReq
.
setMsgContent
(
user
.
getRealName
()+
" 提交的"
+
mainProcess
.
getName
()+
"需要您审批,请即时处理"
);
sendReq
.
setPriority
(
"0"
);
sendReq
.
setPriority
(
"0"
);
sendReq
.
setSendTime
(
DateTime
.
now
());
sendReq
.
setSendTime
(
DateTime
.
now
());
messageApi
.
sendMessage
(
sendReq
);
messageApi
.
sendMessage
(
sendReq
);
...
...
jyzb-biz/src/main/java/com/junmp/jyzb/listener/GlobalEndListener.java
View file @
b0ddafe4
package
com
.
junmp
.
jyzb
.
listener
;
package
com
.
junmp
.
jyzb
.
listener
;
import
cn.hutool.core.date.DateTime
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.TypeReference
;
import
com.alibaba.fastjson.TypeReference
;
...
@@ -7,6 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
...
@@ -7,6 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.junmp.junmpProcess.dto.json.ChildNode
;
import
com.junmp.junmpProcess.dto.json.ChildNode
;
import
com.junmp.junmpProcess.dto.json.UserInfo
;
import
com.junmp.junmpProcess.utils.RabbitMQUtils2
;
import
com.junmp.junmpProcess.utils.RabbitMQUtils2
;
//import com.rabbitmq.client.Channel;
//import com.rabbitmq.client.Channel;
//import com.rabbitmq.client.Connection;
//import com.rabbitmq.client.Connection;
...
@@ -24,6 +26,9 @@ import com.junmp.jyzb.service.*;
...
@@ -24,6 +26,9 @@ import com.junmp.jyzb.service.*;
import
com.junmp.jyzb.utils.DateTimeUtil
;
import
com.junmp.jyzb.utils.DateTimeUtil
;
import
com.junmp.v2.common.exception.base.ServiceException
;
import
com.junmp.v2.common.exception.base.ServiceException
;
import
com.junmp.v2.common.util.BeanPlusUtil
;
import
com.junmp.v2.common.util.BeanPlusUtil
;
import
com.junmp.v2.message.api.MessageApi
;
import
com.junmp.v2.message.api.bean.req.MessageReq
;
import
com.junmp.v2.message.api.bean.req.MessageSendReq
;
import
com.rabbitmq.client.Channel
;
import
com.rabbitmq.client.Channel
;
import
com.rabbitmq.client.Connection
;
import
com.rabbitmq.client.Connection
;
import
com.rabbitmq.client.MessageProperties
;
import
com.rabbitmq.client.MessageProperties
;
...
@@ -33,6 +38,7 @@ import org.flowable.common.engine.api.delegate.event.FlowableEngineEventType;
...
@@ -33,6 +38,7 @@ import org.flowable.common.engine.api.delegate.event.FlowableEngineEventType;
import
org.flowable.common.engine.impl.event.FlowableEntityEventImpl
;
import
org.flowable.common.engine.impl.event.FlowableEntityEventImpl
;
import
org.flowable.engine.HistoryService
;
import
org.flowable.engine.HistoryService
;
import
org.flowable.engine.delegate.event.AbstractFlowableEngineEventListener
;
import
org.flowable.engine.delegate.event.AbstractFlowableEngineEventListener
;
import
org.flowable.engine.history.HistoricProcessInstance
;
import
org.flowable.task.service.impl.persistence.entity.TaskEntity
;
import
org.flowable.task.service.impl.persistence.entity.TaskEntity
;
import
org.flowable.variable.api.history.HistoricVariableInstance
;
import
org.flowable.variable.api.history.HistoricVariableInstance
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -47,6 +53,9 @@ import java.util.Map;
...
@@ -47,6 +53,9 @@ import java.util.Map;
import
java.util.UUID
;
import
java.util.UUID
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
static
com
.
junmp
.
junmpProcess
.
common
.
CommonConstants
.
ORDER_TYPE
;
import
static
com
.
junmp
.
junmpProcess
.
common
.
CommonConstants
.
START_USER_INFO
;
@Component
@Component
public
class
GlobalEndListener
extends
AbstractFlowableEngineEventListener
{
public
class
GlobalEndListener
extends
AbstractFlowableEngineEventListener
{
...
@@ -73,6 +82,8 @@ import java.util.stream.Collectors;
...
@@ -73,6 +82,8 @@ import java.util.stream.Collectors;
private
InventorySummaryService
inventorySummaryService
;
private
InventorySummaryService
inventorySummaryService
;
@Resource
@Resource
private
MessageApi
messageApi
;
@Resource
private
InventoryService
inventoryService
;
private
InventoryService
inventoryService
;
protected
Logger
logger
=
LoggerFactory
.
getLogger
(
this
.
getClass
());
protected
Logger
logger
=
LoggerFactory
.
getLogger
(
this
.
getClass
());
...
@@ -81,10 +92,15 @@ import java.util.stream.Collectors;
...
@@ -81,10 +92,15 @@ import java.util.stream.Collectors;
@Override
@Override
protected
void
processCompleted
(
FlowableEngineEntityEvent
event
)
{
protected
void
processCompleted
(
FlowableEngineEntityEvent
event
)
{
if
(
event
.
getType
()
==
FlowableEngineEventType
.
PROCESS_COMPLETED
)
{
if
(
event
.
getType
()
==
FlowableEngineEventType
.
PROCESS_COMPLETED
)
{
// 获取流程实例ID
// 获取流程实例ID
String
processInstanceId
=
event
.
getProcessInstanceId
();
String
processInstanceId
=
event
.
getProcessInstanceId
();
HistoricProcessInstance
historicProcessInstance
=
historyService
.
createHistoricProcessInstanceQuery
()
.
processInstanceId
(
processInstanceId
)
.
includeProcessVariables
()
.
singleResult
();
// 获取流程定义ID
// 获取流程定义ID
String
processDefinitionId
=
event
.
getProcessDefinitionId
();
String
processDefinitionId
=
event
.
getProcessDefinitionId
();
List
<
HistoricVariableInstance
>
orderType
=
historyService
.
createHistoricVariableInstanceQuery
().
processInstanceId
(
processInstanceId
).
variableName
(
"orderType"
).
list
();
List
<
HistoricVariableInstance
>
orderType
=
historyService
.
createHistoricVariableInstanceQuery
().
processInstanceId
(
processInstanceId
).
variableName
(
"orderType"
).
list
();
...
@@ -140,6 +156,26 @@ import java.util.stream.Collectors;
...
@@ -140,6 +156,26 @@ import java.util.stream.Collectors;
}
}
//消息推送
// MessageSendReq sendReq = new MessageSendReq();
// historicProcessInstance.getProcessVariables()
// sendReq.setReceiveUserIds(String.valueOf(userId));
// sendReq.setMsgTitle("您有新的待办任务");
// sendReq.setBizType(execution.getVariable(ORDER_TYPE).toString());
// sendReq.setBizId(Long.valueOf(execution.getProcessInstanceId()));
// String StartUser=execution.getVariable(START_USER_INFO).toString();
// UserInfo user= JSONObject.parseObject(StartUser, UserInfo.class);
// sendReq.setMsgContent(user.getRealName()+" 提交的"+mainProcess.getName()+"需要您审批,请即时处理");
// sendReq.setPriority("0");
// sendReq.setSendTime(DateTime.now());
// messageApi.sendMessage(sendReq);
// messageApi.queryCount(new MessageReq());
// /*推送发送未读数量*/
// MessageReq req1 = new MessageReq();
// req1.setReadFlag(0);
// req1.setReceiveUserId(Long.valueOf(userId));
// Integer count1 = messageApi.queryCount(req1);
// messageApi.pushMsgToUser(userId,count1);
}
}
}
}
...
@@ -150,12 +186,6 @@ import java.util.stream.Collectors;
...
@@ -150,12 +186,6 @@ import java.util.stream.Collectors;
System
.
out
.
println
(
"event = "
+
event
);
System
.
out
.
println
(
"event = "
+
event
);
}
}
// 获取流程实例关联的变量
private
Map
<
String
,
Object
>
getProcessVariables
(
String
processInstanceId
)
{
// 根据 processInstanceId 获取流程实例关联的变量
// 这里需要根据你的业务逻辑来实现获取变量的方法
// 返回一个包含流程变量的 Map
return
null
;
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论