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 87f516ae
authored
Feb 09, 2021
by
18356073052
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
群发代码修改
1 parent
5c0a8c37
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
11 deletions
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerMessagePushServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerMessageServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerMessagePushServiceImpl.java
View file @
87f516a
...
@@ -74,7 +74,6 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
...
@@ -74,7 +74,6 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
throw
new
WeComException
(
"发送时间不能小于当前时间"
);
throw
new
WeComException
(
"发送时间不能小于当前时间"
);
}
}
List
<
WeCustomer
>
customers
=
Lists
.
newArrayList
();
List
<
WeCustomer
>
customers
=
Lists
.
newArrayList
();
List
<
WeGroup
>
groups
=
new
ArrayList
<>();
List
<
WeGroup
>
groups
=
new
ArrayList
<>();
// 0 发给客户
// 0 发给客户
...
@@ -82,15 +81,27 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
...
@@ -82,15 +81,27 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
//查询客户信息列表
//查询客户信息列表
customers
=
externalUserIds
(
customerMessagePushDto
.
getPushRange
(),
customerMessagePushDto
.
getStaffId
()
customers
=
externalUserIds
(
customerMessagePushDto
.
getPushRange
(),
customerMessagePushDto
.
getStaffId
()
,
customerMessagePushDto
.
getDepartment
(),
customerMessagePushDto
.
getTag
());
,
customerMessagePushDto
.
getDepartment
(),
customerMessagePushDto
.
getTag
());
if
(
CollectionUtils
.
isEmpty
(
customers
)){
throw
new
WeComException
(
"没有外部联系人"
);
}
}
}
// 0 发给客户群
// 0 发给客户群
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
());
groups
=
weGroupService
.
selectWeGroupList
(
weGroup
);
groups
=
weGroupService
.
selectWeGroupList
(
weGroup
);
if
(
CollectionUtils
.
isEmpty
(
customers
)){
throw
new
WeComException
(
"没有客户群!"
);
}
}
}
//保存原始数据信息表
//保存原始数据信息表
...
@@ -119,10 +130,6 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
...
@@ -119,10 +130,6 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
//定义一个任务执行队列
//定义一个任务执行队列
//把任务放入执行队列
//把任务放入执行队列
//任务执行 sendMessgae(WeMessagePush weMessagePush) 方法
//任务执行 sendMessgae(WeMessagePush weMessagePush) 方法
if
(
DateUtils
.
diffTime
(
new
Date
(),
DateUtil
.
parse
(
customerMessagePushDto
.
getSettingTime
(),
"yyyy-MM-dd HH:mm:ss"
))
>
0
)
{
throw
new
WeComException
(
"发送时间不能小于当前时间"
);
}
Timer
timer
=
new
Timer
();
Timer
timer
=
new
Timer
();
List
<
WeCustomer
>
finalCustomers
=
customers
;
List
<
WeCustomer
>
finalCustomers
=
customers
;
List
<
WeGroup
>
finalGroups
=
groups
;
List
<
WeGroup
>
finalGroups
=
groups
;
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerMessageServiceImpl.java
View file @
87f516a
...
@@ -91,26 +91,23 @@ public class WeCustomerMessageServiceImpl extends ServiceImpl<WeCustomerMessageM
...
@@ -91,26 +91,23 @@ public class WeCustomerMessageServiceImpl extends ServiceImpl<WeCustomerMessageM
//发送类类型: 给单个客户发,群发
//发送类类型: 给单个客户发,群发
//发给客户
//发给客户
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
()).
getName
());
messagePushDto
.
setChat_type
(
ChatType
.
of
(
customerMessagePushDto
.
getPushType
()).
getName
());
List
<
String
>
externalUserIds
=
customers
.
stream
().
map
(
WeCustomer:
:
getExternalUserid
).
collect
(
Collectors
.
toList
());
List
<
String
>
externalUserIds
=
customers
.
stream
().
map
(
WeCustomer:
:
getExternalUserid
).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isEmpty
(
externalUserIds
)){
throw
new
WeComException
(
"没有外部联系人"
);
}
messagePushDto
.
setExternal_userid
(
externalUserIds
);
messagePushDto
.
setExternal_userid
(
externalUserIds
);
childMessage
(
messagePushDto
,
customerMessagePushDto
);
childMessage
(
messagePushDto
,
customerMessagePushDto
);
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
.
add
(
sendMessageResultDto
.
getMsgid
());
msgid
.
add
(
sendMessageResultDto
.
getMsgid
());
}
}
}
}
//发给客户群
//发给客户群
if
(
customerMessagePushDto
.
getPushType
().
equals
(
"1"
))
{
if
(
customerMessagePushDto
.
getPushType
().
equals
(
"1"
))
{
if
(
customerMessagePushDto
.
getStaffId
()
==
null
||
customerMessagePushDto
.
getStaffId
().
equals
(
""
))
{
throw
new
WeComException
(
"参数异常!"
);
}
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
());
for
(
String
owner
:
owners
)
{
for
(
String
owner
:
owners
)
{
...
@@ -126,6 +123,7 @@ public class WeCustomerMessageServiceImpl extends ServiceImpl<WeCustomerMessageM
...
@@ -126,6 +123,7 @@ public class WeCustomerMessageServiceImpl extends ServiceImpl<WeCustomerMessageM
}
}
}
}
}
}
}
}
this
.
updateMsgId
(
messageId
,
msgid
);
this
.
updateMsgId
(
messageId
,
msgid
);
...
...
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