Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
江名洋
/
linkwe-scrm
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 024fd64a
authored
Dec 22, 2020
by
18356073052
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
群发消息任务修改
1 parent
8cd2ada0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
14 deletions
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerMessagePushServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerMessagePushServiceImpl.java
View file @
024fd64
...
@@ -72,8 +72,9 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
...
@@ -72,8 +72,9 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
@Transactional
@Transactional
public
void
addWeCustomerMessagePush
(
CustomerMessagePushDto
customerMessagePushDto
)
throws
JsonProcessingException
{
public
void
addWeCustomerMessagePush
(
CustomerMessagePushDto
customerMessagePushDto
)
throws
JsonProcessingException
{
//立即发送
//立即发送
if
(
null
==
customerMessagePushDto
.
getSettingTime
())
{
if
(
null
==
customerMessagePushDto
.
getSettingTime
()
||
customerMessagePushDto
.
getSettingTime
().
equals
(
""
)
)
{
customerMessagePushDto
.
setMessageType
(
"1"
);
sendMessgae
(
customerMessagePushDto
);
sendMessgae
(
customerMessagePushDto
);
}
else
{
}
else
{
...
@@ -130,14 +131,12 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
...
@@ -130,14 +131,12 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
//发给客户
//发给客户
if
(
customerMessagePushDto
.
getPushType
().
equals
(
"0"
)){
if
(
customerMessagePushDto
.
getPushType
().
equals
(
"0"
)){
WeCustomerMessagePushDto
messagePushDto
=
new
WeCustomerMessagePushDto
();
WeCustomerMessagePushDto
messagePushDto
=
new
WeCustomerMessagePushDto
();
messagePushDto
.
setChat_type
(
ChatType
.
of
(
customerMessagePushDto
.
getPushType
()).
get
Typ
e
());
messagePushDto
.
setChat_type
(
ChatType
.
of
(
customerMessagePushDto
.
getPushType
()).
get
Nam
e
());
externalUserIds
=
externalUserIds
(
customerMessagePushDto
.
getPushRange
(),
customerMessagePushDto
.
getStaffId
()
externalUserIds
=
externalUserIds
(
customerMessagePushDto
.
getPushRange
(),
customerMessagePushDto
.
getStaffId
()
,
customerMessagePushDto
.
getDepartment
(),
customerMessagePushDto
.
getTag
());
,
customerMessagePushDto
.
getDepartment
(),
customerMessagePushDto
.
getTag
());
messagePushDto
.
setExternal_userid
(
externalUserIds
);
messagePushDto
.
setExternal_userid
(
externalUserIds
);
messagePushDto
.
setImage
(
customerMessagePushDto
.
getImageMessage
());
messagePushDto
.
setLink
(
customerMessagePushDto
.
getLinkMessage
());
seedMessage
(
messagePushDto
,
customerMessagePushDto
);
messagePushDto
.
setMiniprogram
(
customerMessagePushDto
.
getMiniprogramMessage
());
messagePushDto
.
setText
(
customerMessagePushDto
.
getTextMessage
());
SendMessageResultDto
sendMessageResultDto
=
weCustomerMessagePushClient
.
sendCustomerMessageToUser
(
messagePushDto
);
SendMessageResultDto
sendMessageResultDto
=
weCustomerMessagePushClient
.
sendCustomerMessageToUser
(
messagePushDto
);
if
(
WeConstans
.
WE_SUCCESS_CODE
.
equals
(
sendMessageResultDto
.
getErrcode
())){
if
(
WeConstans
.
WE_SUCCESS_CODE
.
equals
(
sendMessageResultDto
.
getErrcode
())){
msgIds
.
add
(
sendMessageResultDto
.
getMsgid
());
msgIds
.
add
(
sendMessageResultDto
.
getMsgid
());
...
@@ -147,28 +146,28 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
...
@@ -147,28 +146,28 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
//发给客户群
//发给客户群
if
(
customerMessagePushDto
.
getPushType
().
equals
(
"1"
)){
if
(
customerMessagePushDto
.
getPushType
().
equals
(
"1"
)){
if
(
customerMessagePushDto
.
getStaffId
()==
null
||
customerMessagePushDto
.
getStaffId
().
equals
(
""
)){
throw
new
WeComException
(
"参数异常!"
);
}
//通过员工id查询群列表
//通过员工id查询群列表
WeGroup
weGroup
=
new
WeGroup
();
WeGroup
weGroup
=
new
WeGroup
();
weGroup
.
setUserIds
(
customerMessagePushDto
.
getStaffId
());
weGroup
.
setUserIds
(
customerMessagePushDto
.
getStaffId
());
List
<
WeGroup
>
groups
=
weGroupService
.
selectWeGroupList
(
weGroup
);
List
<
WeGroup
>
groups
=
weGroupService
.
selectWeGroupList
(
weGroup
);
if
(
CollectionUtils
.
isNotEmpty
(
groups
)){
if
(
CollectionUtils
.
isNotEmpty
(
groups
)){
List
<
String
>
owners
=
groups
.
stream
().
map
(
WeGroup:
:
getOwner
).
collect
(
Collectors
.
toList
());
List
<
String
>
owners
=
groups
.
stream
().
map
(
WeGroup:
:
getOwner
).
collect
(
Collectors
.
toList
());
owners
.
forEach
(
s
->
{
for
(
String
owner:
owners
)
{
WeCustomerMessagePushDto
messagePushDto
=
new
WeCustomerMessagePushDto
();
WeCustomerMessagePushDto
messagePushDto
=
new
WeCustomerMessagePushDto
();
messagePushDto
.
setChat_type
(
ChatType
.
of
(
customerMessagePushDto
.
getPushType
()).
getType
());
messagePushDto
.
setChat_type
(
ChatType
.
of
(
customerMessagePushDto
.
getPushType
()).
getType
());
//客户群的员工id
//客户群的员工id
messagePushDto
.
setSender
(
s
);
messagePushDto
.
setSender
(
owner
);
messagePushDto
.
setImage
(
customerMessagePushDto
.
getImageMessage
());
seedMessage
(
messagePushDto
,
customerMessagePushDto
);
messagePushDto
.
setLink
(
customerMessagePushDto
.
getLinkMessage
());
messagePushDto
.
setMiniprogram
(
customerMessagePushDto
.
getMiniprogramMessage
());
messagePushDto
.
setText
(
customerMessagePushDto
.
getTextMessage
());
SendMessageResultDto
sendMessageResultDto
=
weCustomerMessagePushClient
.
sendCustomerMessageToUser
(
messagePushDto
);
SendMessageResultDto
sendMessageResultDto
=
weCustomerMessagePushClient
.
sendCustomerMessageToUser
(
messagePushDto
);
if
(
WeConstans
.
WE_SUCCESS_CODE
.
equals
(
sendMessageResultDto
.
getErrcode
())){
if
(
WeConstans
.
WE_SUCCESS_CODE
.
equals
(
sendMessageResultDto
.
getErrcode
())){
//发送的msgId
//发送的msgId
msgIds
.
add
(
sendMessageResultDto
.
getMsgid
());
msgIds
.
add
(
sendMessageResultDto
.
getMsgid
());
senders
.
add
(
s
);
senders
.
add
(
owner
);
}
}
}
});
}
}
}
}
...
@@ -194,6 +193,43 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
...
@@ -194,6 +193,43 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
saveSeedMessage
(
customerMessagePushDto
,
messageId
);
saveSeedMessage
(
customerMessagePushDto
,
messageId
);
}
}
/**
* 子消息体
*
* @param weCustomerMessagePushDto 群发消息体
* @param customerMessagePushDto 群发消息
*/
public
void
seedMessage
(
WeCustomerMessagePushDto
weCustomerMessagePushDto
,
CustomerMessagePushDto
customerMessagePushDto
){
// 消息类型 0 文本消息 1 图片消息 2 链接消息 3 小程序消息
if
(
customerMessagePushDto
.
getMessageType
().
equals
(
"0"
)){
weCustomerMessagePushDto
.
setImage
(
null
);
weCustomerMessagePushDto
.
setLink
(
null
);
weCustomerMessagePushDto
.
setMiniprogram
(
null
);
weCustomerMessagePushDto
.
setText
(
customerMessagePushDto
.
getTextMessage
());
}
if
(
customerMessagePushDto
.
getMessageType
().
equals
(
"1"
)){
weCustomerMessagePushDto
.
setImage
(
customerMessagePushDto
.
getImageMessage
());
weCustomerMessagePushDto
.
setLink
(
null
);
weCustomerMessagePushDto
.
setMiniprogram
(
null
);
weCustomerMessagePushDto
.
setText
(
null
);
}
if
(
customerMessagePushDto
.
getMessageType
().
equals
(
"2"
)){
weCustomerMessagePushDto
.
setImage
(
null
);
weCustomerMessagePushDto
.
setLink
(
customerMessagePushDto
.
getLinkMessage
());
weCustomerMessagePushDto
.
setMiniprogram
(
null
);
weCustomerMessagePushDto
.
setText
(
null
);
}
if
(
customerMessagePushDto
.
getMessageType
().
equals
(
"3"
)){
weCustomerMessagePushDto
.
setImage
(
customerMessagePushDto
.
getImageMessage
());
weCustomerMessagePushDto
.
setLink
(
customerMessagePushDto
.
getLinkMessage
());
weCustomerMessagePushDto
.
setMiniprogram
(
customerMessagePushDto
.
getMiniprogramMessage
());
weCustomerMessagePushDto
.
setText
(
customerMessagePushDto
.
getTextMessage
());
}
}
/**
/**
* 各分类消息表
* 各分类消息表
* @param customerMessagePushDto 群发消息
* @param customerMessagePushDto 群发消息
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment