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 be8029e1
authored
Dec 30, 2020
by
18356073052
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
重构群发消息任务
1 parent
21bb985f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
33 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 @
be8029e
...
...
@@ -10,6 +10,7 @@ import com.linkwechat.common.exception.wecom.WeComException;
import
com.linkwechat.common.utils.DateUtils
;
import
com.linkwechat.common.utils.SecurityUtils
;
import
com.linkwechat.common.utils.SnowFlakeUtil
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.wecom.client.WeCustomerMessagePushClient
;
import
com.linkwechat.wecom.domain.*
;
import
com.linkwechat.wecom.domain.dto.message.*
;
...
...
@@ -68,11 +69,6 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
throw
new
WeComException
(
"发送时间不能小于当前时间"
);
}
//查询员id
List
<
String
>
senders
=
Lists
.
newArrayList
();
StringBuffer
sendInfo
=
new
StringBuffer
();
//保存原始数据信息表
long
messageOriginalId
=
saveWeCustomerMessageOriginal
(
customerMessagePushDto
);
...
...
@@ -81,10 +77,8 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
//保存映射信息
int
size
=
workerMappingCustomer
(
customerMessagePushDto
,
messageId
);
sendInfo
(
customerMessagePushDto
,
sendInfo
,
size
);
//保存微信消息
saveWeCustomerMessage
(
messageId
,
messageOriginalId
,
customerMessagePushDto
,
s
endInfo
);
saveWeCustomerMessage
(
messageId
,
messageOriginalId
,
customerMessagePushDto
,
s
ize
);
//保存分类消息信息
weCustomerSeedMessageService
.
saveSeedMessage
(
customerMessagePushDto
,
messageId
);
...
...
@@ -214,31 +208,8 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
}
private
void
sendInfo
(
CustomerMessagePushDto
customerMessagePushDto
,
StringBuffer
sendInfo
,
int
size
)
{
if
(
null
!=
customerMessagePushDto
.
getSettingTime
()
&&
!
customerMessagePushDto
.
getSettingTime
().
equals
(
""
))
{
sendInfo
.
append
(
"定时任务"
);
sendInfo
.
append
(
"发送时间:"
);
sendInfo
.
append
(
customerMessagePushDto
.
getSettingTime
());
}
else
{
if
(
customerMessagePushDto
.
getPushType
().
equals
(
"0"
))
{
//预计发送3190人,已成功发送0人
sendInfo
.
append
(
"预计发送"
);
sendInfo
.
append
(
size
);
sendInfo
.
append
(
"人,"
);
sendInfo
.
append
(
"已成功发送0人"
);
}
if
(
customerMessagePushDto
.
getPushType
().
equals
(
"1"
))
{
//预计发送2个群,已成功发送0个群
sendInfo
.
append
(
"预计发送"
);
sendInfo
.
append
(
size
);
sendInfo
.
append
(
"个群,"
);
sendInfo
.
append
(
"已成功发送0个群"
);
}
}
}
//保存微信消息 WeCustomerMessage
public
void
saveWeCustomerMessage
(
long
messageId
,
long
messageOriginalId
,
CustomerMessagePushDto
customerMessagePushDto
,
StringBuffer
sendInfo
)
{
public
void
saveWeCustomerMessage
(
long
messageId
,
long
messageOriginalId
,
CustomerMessagePushDto
customerMessagePushDto
,
int
size
)
{
//保存微信消息
//微信群发消息表 WeCustomerMessage
WeCustomerMessage
customerMessage
=
new
WeCustomerMessage
();
...
...
@@ -250,9 +221,16 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
customerMessage
.
setCheckStatus
(
"0"
);
customerMessage
.
setDelFlag
(
0
);
customerMessage
.
setContent
(
content
(
customerMessagePushDto
));
customerMessage
.
setSendInfo
(
sendInfo
.
toString
());
customerMessage
.
setCreateBy
(
SecurityUtils
.
getUsername
());
customerMessage
.
setMsgid
(
""
);
if
(
StringUtils
.
isNotEmpty
(
customerMessagePushDto
.
getSettingTime
())){
customerMessage
.
setSettingTime
(
customerMessagePushDto
.
getSettingTime
());
customerMessage
.
setTimedTask
(
1
);
}
else
{
customerMessage
.
setTimedTask
(
0
);
}
customerMessage
.
setExpectSend
(
size
);
customerMessage
.
setActualSend
(
0
);
weCustomerMessageService
.
save
(
customerMessage
);
}
...
...
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