Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
haoban3.0
haoban-manage3.0
Commits
6d228b2a
Commit
6d228b2a
authored
Sep 13, 2022
by
墨竹
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:恢复代码
parent
4c0f3a70
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
1 deletions
+45
-1
NoticeMessageUtil.java
.../gic/haoban/manage/api/util/notify/NoticeMessageUtil.java
+45
-1
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/util/notify/NoticeMessageUtil.java
View file @
6d228b2a
...
...
@@ -5,9 +5,12 @@ import com.gic.commons.util.GICMQClientUtil;
import
com.gic.haoban.manage.api.dto.notify.qdto.NoticeMessageQDTO
;
import
com.gic.haoban.manage.api.enums.NoticeMessageTypeEnum
;
import
com.gic.mq.sdk.GicMQClient
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
static
org
.
slf4j
.
LoggerFactory
.
getLogger
;
...
...
@@ -52,13 +55,54 @@ public class NoticeMessageUtil {
logger
.
info
(
"发送消息:{}"
,
ret
);
GicMQClient
clientInstance
=
GICMQClientUtil
.
getClientInstance
();
try
{
// com.gic.haoban.manage.api.service.notify.NoticeMessageApiService.run
clientInstance
.
sendMessage
(
NOTICE_MESSAGE
,
ret
);
}
catch
(
Exception
e
)
{
logger
.
info
(
"发送消息异常:{}"
,
e
);
}
}
/**
* 发送消息 对象里面的字段 解析
* enterpriseId 企业id
* clerkId 执行人导购
* messageType 消息类型 NoticeMessageTypeEnum
* optTargetId 操作对象
* fieldMap 解析模板的字段
* extendField 拓展字段给前端使用 没有可以为null
* @param list
*/
public
static
void
sendNoticeMessageBatch
(
List
<
NoticeMessageQDTO
>
list
)
{
if
(
CollectionUtils
.
isEmpty
(
list
))
{
logger
.
info
(
"没有哦需要发送的消息"
);
return
;
}
List
<
String
>
ret
=
new
ArrayList
<
String
>();
for
(
NoticeMessageQDTO
noticeMessageQDTO
:
list
)
{
String
retStr
=
JSONObject
.
toJSONString
(
noticeMessageQDTO
);
if
(
StringUtils
.
isAnyBlank
(
noticeMessageQDTO
.
getEnterpriseId
(),
noticeMessageQDTO
.
getClerkId
()))
{
logger
.
info
(
"参数不存在:{}"
,
retStr
);
throw
new
RuntimeException
(
"必传参数没传:"
+
noticeMessageQDTO
.
getClerkId
());
}
NoticeMessageTypeEnum
messageTypeEnum
=
NoticeMessageTypeEnum
.
getByType
(
noticeMessageQDTO
.
getMessageType
());
if
(
messageTypeEnum
==
null
)
{
logger
.
info
(
"类型不存在:{}"
,
retStr
);
throw
new
RuntimeException
(
"消息类型不存在"
);
}
ret
.
add
(
retStr
);
logger
.
info
(
"发送消息单条:{}"
,
retStr
);
}
logger
.
info
(
"批量发送消息:{}"
,
ret
.
size
());
GicMQClient
clientInstance
=
GICMQClientUtil
.
getClientInstance
();
try
{
clientInstance
.
sendBatchMessages
(
NOTICE_MESSAGE
,
ret
);
}
catch
(
Exception
e
)
{
logger
.
info
(
"发送消息异常:{}"
,
e
);
}
}
/**
* 发送消息 使用staffId发送
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment