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 3d46a7ca
authored
Dec 26, 2021
by
danmo
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
群发接口接口优化
1 parent
25d7bfad
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
5 deletions
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeGroupMessageTemplateServiceImpl.java
linkwe-wecom/src/main/resources/mapper/wecom/WeGroupMessageTaskMapper.xml
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeGroupMessageTemplateServiceImpl.java
View file @
3d46a7c
...
@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollectionUtil;
...
@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollectionUtil;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.linkwechat.common.constant.WeConstans
;
import
com.linkwechat.common.constant.WeConstans
;
...
@@ -96,7 +97,27 @@ public class WeGroupMessageTemplateServiceImpl extends ServiceImpl<WeGroupMessag
...
@@ -96,7 +97,27 @@ public class WeGroupMessageTemplateServiceImpl extends ServiceImpl<WeGroupMessag
detailVo
.
setRefreshTime
(
weGroupMessageTemplate
.
getRefreshTime
());
detailVo
.
setRefreshTime
(
weGroupMessageTemplate
.
getRefreshTime
());
detailVo
.
setSendTime
(
weGroupMessageTemplate
.
getSendTime
());
detailVo
.
setSendTime
(
weGroupMessageTemplate
.
getSendTime
());
detailVo
.
setContent
(
weGroupMessageTemplate
.
getContent
());
detailVo
.
setContent
(
weGroupMessageTemplate
.
getContent
());
List
<
WeGroupMessageListVo
>
groupMsgDetail
=
weGroupMessageListService
.
getGroupMsgDetail
(
id
);
List
<
WeGroupMessageAttachments
>
attachmentsList
=
attachmentsService
.
lambdaQuery
().
eq
(
WeGroupMessageAttachments:
:
getMsgTemplateId
,
id
).
list
();
detailVo
.
setAttachments
(
attachmentsList
);
List
<
WeGroupMessageTask
>
taskList
=
messageTaskService
.
lambdaQuery
().
eq
(
WeGroupMessageTask:
:
getMsgTemplateId
,
id
).
list
();
if
(
CollectionUtil
.
isNotEmpty
(
taskList
)){
//待发送人员列表
Long
toBeSent
=
taskList
.
stream
().
filter
(
item
->
ObjectUtil
.
equal
(
0
,
item
.
getStatus
())).
count
();
detailVo
.
setToBeSendNum
(
toBeSent
.
intValue
());
//已发送人员列表
Long
alreadySent
=
taskList
.
stream
().
filter
(
item
->
ObjectUtil
.
equal
(
2
,
item
.
getStatus
())).
count
();
detailVo
.
setAlreadySendNum
(
alreadySent
.
intValue
());
}
List
<
WeGroupMessageSendResult
>
resultList
=
messageSendResultService
.
lambdaQuery
().
eq
(
WeGroupMessageSendResult:
:
getMsgTemplateId
,
id
).
list
();
if
(
CollectionUtil
.
isNotEmpty
(
resultList
)){
//未发送客户数
Long
toBeCustomerNum
=
resultList
.
stream
().
filter
(
item
->
ObjectUtil
.
equal
(
0
,
item
.
getStatus
())).
count
();
detailVo
.
setToBeSendCustomerNum
(
toBeCustomerNum
.
intValue
());
//已发送客户数
Long
alreadyCustomerNum
=
resultList
.
stream
().
filter
(
item
->
ObjectUtil
.
equal
(
1
,
item
.
getStatus
())).
count
();
detailVo
.
setAlreadySendCustomerNum
(
alreadyCustomerNum
.
intValue
());
}
/*List<WeGroupMessageListVo> groupMsgDetail = weGroupMessageListService.getGroupMsgDetail(id);
if (CollectionUtil.isNotEmpty(groupMsgDetail)) {
if (CollectionUtil.isNotEmpty(groupMsgDetail)) {
detailVo.setAttachments(groupMsgDetail.get(0).getAttachments());
detailVo.setAttachments(groupMsgDetail.get(0).getAttachments());
//待发送人员列表
//待发送人员列表
...
@@ -116,7 +137,7 @@ public class WeGroupMessageTemplateServiceImpl extends ServiceImpl<WeGroupMessag
...
@@ -116,7 +137,7 @@ public class WeGroupMessageTemplateServiceImpl extends ServiceImpl<WeGroupMessag
.filter(item -> ObjectUtil.equal(1, item.getStatus())).count();
.filter(item -> ObjectUtil.equal(1, item.getStatus())).count();
detailVo.setAlreadySendCustomerNum(alreadyCustomerNum.intValue());
detailVo.setAlreadySendCustomerNum(alreadyCustomerNum.intValue());
//未发送查询每个人员对应客户信息
//未发送查询每个人员对应客户信息
/*
if (CollectionUtil.isNotEmpty(toBeSent)) {
if (CollectionUtil.isNotEmpty(toBeSent)) {
List<WeGroupMessageTaskVo> toBeSentList = toBeSent.stream().map(userInfo -> {
List<WeGroupMessageTaskVo> toBeSentList = toBeSent.stream().map(userInfo -> {
WeGroupMessageTaskVo weGroupMessageTaskVo = new WeGroupMessageTaskVo();
WeGroupMessageTaskVo weGroupMessageTaskVo = new WeGroupMessageTaskVo();
weGroupMessageTaskVo.setUserId(userInfo.getUserId());
weGroupMessageTaskVo.setUserId(userInfo.getUserId());
...
@@ -163,8 +184,8 @@ public class WeGroupMessageTemplateServiceImpl extends ServiceImpl<WeGroupMessag
...
@@ -163,8 +184,8 @@ public class WeGroupMessageTemplateServiceImpl extends ServiceImpl<WeGroupMessag
}).collect(Collectors.toList());
}).collect(Collectors.toList());
detailVo.setAlreadySendList(alreadySentList);
detailVo.setAlreadySendList(alreadySentList);
detailVo.setAlreadySendNum(alreadySentList.size());
detailVo.setAlreadySendNum(alreadySentList.size());
}
*/
}
}
}
*/
return
detailVo
;
return
detailVo
;
}
}
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeGroupMessageTaskMapper.xml
View file @
3d46a7c
...
@@ -27,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -27,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
(select group_concat((select wc.name from we_customer wc where wc.external_userid = wgmsr.external_userid limit 1)) as customer_name
(select group_concat((select wc.name from we_customer wc where wc.external_userid = wgmsr.external_userid limit 1)) as customer_name
from we_group_message_send_result wgmsr where wgmsr.user_id = wgmt.user_id and wgmsr.status = 0) as to_be_customer_name ,
from we_group_message_send_result wgmsr where wgmsr.user_id = wgmt.user_id and wgmsr.status = 0) as to_be_customer_name ,
(select group_concat((select wc.name from we_customer wc where wc.external_userid = wgmsr.external_userid limit 1)) as customer_name
(select group_concat((select wc.name from we_customer wc where wc.external_userid = wgmsr.external_userid limit 1)) as customer_name
from we_group_message_send_result wgmsr where wgmsr.user_id = wgmt.user_id and wgmsr.status = 1) as already_customer_name
,
from we_group_message_send_result wgmsr where wgmsr.user_id = wgmt.user_id and wgmsr.status = 1) as already_customer_name
from we_group_message_task wgmt
from we_group_message_task wgmt
<where>
<where>
<if
test=
"id != null"
>
<if
test=
"id != null"
>
...
...
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