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 1d60b09d
authored
Jan 26, 2021
by
18356073052
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
对群发进行优化
1 parent
fa2d81ca
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
51 additions
and
9 deletions
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCustomerMessagePushController.java
linkwe-framework/src/main/java/com/linkwechat/framework/config/SecurityConfig.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/message/AsyncResultDto.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeCustomerMessgaeResultMapper.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeCustomerMessageOriginalService.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerMessageOriginalServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerMessagePushServiceImpl.java
linkwe-wecom/src/main/resources/mapper/wecom/WeCustomerMessgaeResultMapper.xml
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCustomerMessagePushController.java
View file @
1d60b09
...
@@ -6,6 +6,7 @@ import com.linkwechat.common.core.controller.BaseController;
...
@@ -6,6 +6,7 @@ import com.linkwechat.common.core.controller.BaseController;
import
com.linkwechat.common.core.domain.AjaxResult
;
import
com.linkwechat.common.core.domain.AjaxResult
;
import
com.linkwechat.common.core.page.TableDataInfo
;
import
com.linkwechat.common.core.page.TableDataInfo
;
import
com.linkwechat.common.enums.BusinessType
;
import
com.linkwechat.common.enums.BusinessType
;
import
com.linkwechat.wecom.domain.dto.message.AsyncResultDto
;
import
com.linkwechat.wecom.domain.dto.message.CustomerMessagePushDto
;
import
com.linkwechat.wecom.domain.dto.message.CustomerMessagePushDto
;
import
com.linkwechat.wecom.domain.vo.CustomerMessagePushVo
;
import
com.linkwechat.wecom.domain.vo.CustomerMessagePushVo
;
import
com.linkwechat.wecom.domain.vo.WeCustomerMessageResultVo
;
import
com.linkwechat.wecom.domain.vo.WeCustomerMessageResultVo
;
...
@@ -96,10 +97,10 @@ public class WeCustomerMessagePushController extends BaseController {
...
@@ -96,10 +97,10 @@ public class WeCustomerMessagePushController extends BaseController {
/**
/**
* 同步消息发送结果
* 同步消息发送结果
*/
*/
@PreAuthorize
(
"@ss.hasPermi('customerMessagePush:push:asyncResult')"
)
//
@PreAuthorize("@ss.hasPermi('customerMessagePush:push:asyncResult')")
@PostMapping
(
value
=
"asyncResult"
)
@PostMapping
(
value
=
"asyncResult"
)
public
AjaxResult
asyncResult
(
@Request
Param
(
value
=
"msgid"
)
String
msgid
,
@RequestParam
(
value
=
"messageId"
)
Long
messageId
)
{
public
AjaxResult
asyncResult
(
@Request
Body
AsyncResultDto
asyncResultDto
)
throws
JsonProcessingException
{
weCustomerMessageOriginalService
.
asyncResult
(
msgid
,
messageId
);
weCustomerMessageOriginalService
.
asyncResult
(
asyncResultDto
);
return
AjaxResult
.
success
();
return
AjaxResult
.
success
();
}
}
...
...
linkwe-framework/src/main/java/com/linkwechat/framework/config/SecurityConfig.java
View file @
1d60b09
...
@@ -124,6 +124,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
...
@@ -124,6 +124,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
.
antMatchers
(
"/wecom/ticket/**"
).
anonymous
()
.
antMatchers
(
"/wecom/ticket/**"
).
anonymous
()
.
antMatchers
(
"/wecom/user/getUserInfo"
).
anonymous
()
.
antMatchers
(
"/wecom/user/getUserInfo"
).
anonymous
()
.
antMatchers
(
"/common/uploadFile2Cos"
).
anonymous
()
// 除上面外的所有请求全部需要鉴权认证
// 除上面外的所有请求全部需要鉴权认证
.
anyRequest
().
authenticated
()
.
anyRequest
().
authenticated
()
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/message/AsyncResultDto.java
0 → 100644
View file @
1d60b09
package
com
.
linkwechat
.
wecom
.
domain
.
dto
.
message
;
import
lombok.Data
;
import
java.util.List
;
/**
* 同步群发消息dto
* @author Kewen
*/
@Data
public
class
AsyncResultDto
{
private
Long
messageId
;
private
List
<
String
>
msgids
;
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeCustomerMessgaeResultMapper.java
View file @
1d60b09
...
@@ -38,4 +38,11 @@ public interface WeCustomerMessgaeResultMapper extends BaseMapper<WeCustomerMess
...
@@ -38,4 +38,11 @@ public interface WeCustomerMessgaeResultMapper extends BaseMapper<WeCustomerMess
*/
*/
List
<
WeCustomerMessageResultVo
>
customerMessagePushs
(
@Param
(
"messageId"
)
Long
messageId
,
@Param
(
"status"
)
String
status
);
List
<
WeCustomerMessageResultVo
>
customerMessagePushs
(
@Param
(
"messageId"
)
Long
messageId
,
@Param
(
"status"
)
String
status
);
/**
* 检查是否已经同步群发结果
*
* @param messageId 微信消息表id
* @return 已发送消息数
*/
int
checkSendStatus
(
@Param
(
"messageId"
)
Long
messageId
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeCustomerMessageOriginalService.java
View file @
1d60b09
...
@@ -3,6 +3,7 @@ package com.linkwechat.wecom.service;
...
@@ -3,6 +3,7 @@ package com.linkwechat.wecom.service;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.linkwechat.wecom.domain.WeCustomerMessageOriginal
;
import
com.linkwechat.wecom.domain.WeCustomerMessageOriginal
;
import
com.linkwechat.wecom.domain.dto.message.AsyncResultDto
;
import
com.linkwechat.wecom.domain.vo.CustomerMessagePushVo
;
import
com.linkwechat.wecom.domain.vo.CustomerMessagePushVo
;
import
java.util.List
;
import
java.util.List
;
...
@@ -44,8 +45,8 @@ public interface IWeCustomerMessageOriginalService extends IService<WeCustomerMe
...
@@ -44,8 +45,8 @@ public interface IWeCustomerMessageOriginalService extends IService<WeCustomerMe
/**
/**
* 同步发送结果
* 同步发送结果
*
*
* @param
msgid
可以用于获取发送结果
* @param
asyncResultDto
可以用于获取发送结果
*/
*/
void
asyncResult
(
String
msgid
,
Long
messageId
)
;
void
asyncResult
(
AsyncResultDto
asyncResultDto
)
throws
JsonProcessingException
;
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerMessageOriginalServiceImpl.java
View file @
1d60b09
...
@@ -8,6 +8,7 @@ import com.linkwechat.common.constant.WeConstans;
...
@@ -8,6 +8,7 @@ import com.linkwechat.common.constant.WeConstans;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.wecom.client.WeCustomerMessagePushClient
;
import
com.linkwechat.wecom.client.WeCustomerMessagePushClient
;
import
com.linkwechat.wecom.domain.WeCustomerMessageOriginal
;
import
com.linkwechat.wecom.domain.WeCustomerMessageOriginal
;
import
com.linkwechat.wecom.domain.dto.message.AsyncResultDto
;
import
com.linkwechat.wecom.domain.dto.message.DetailMessageStatusResultDto
;
import
com.linkwechat.wecom.domain.dto.message.DetailMessageStatusResultDto
;
import
com.linkwechat.wecom.domain.dto.message.QueryCustomerMessageStatusResultDataObjectDto
;
import
com.linkwechat.wecom.domain.dto.message.QueryCustomerMessageStatusResultDataObjectDto
;
import
com.linkwechat.wecom.domain.dto.message.QueryCustomerMessageStatusResultDto
;
import
com.linkwechat.wecom.domain.dto.message.QueryCustomerMessageStatusResultDto
;
...
@@ -64,16 +65,19 @@ public class WeCustomerMessageOriginalServiceImpl extends ServiceImpl<WeCustomer
...
@@ -64,16 +65,19 @@ public class WeCustomerMessageOriginalServiceImpl extends ServiceImpl<WeCustomer
CustomerMessagePushVo
customerMessagePushDetail
=
weCustomerMessageOriginalMapper
.
findCustomerMessagePushDetail
(
messageId
);
CustomerMessagePushVo
customerMessagePushDetail
=
weCustomerMessageOriginalMapper
.
findCustomerMessagePushDetail
(
messageId
);
//检查是否已经同步发送结果
if
(
weCustomerMessgaeResultMapper
.
checkSendStatus
(
messageId
)==
0
){
//拉取消息发送结果
//拉取消息发送结果
CompletableFuture
.
runAsync
(()
->
syncSendResult
(
customerMessagePushDetail
.
getMsgid
(),
messageId
));
CompletableFuture
.
runAsync
(()
->
syncSendResult
(
customerMessagePushDetail
.
getMsgid
(),
messageId
));
}
return
customerMessagePushDetail
;
return
customerMessagePushDetail
;
}
}
@Override
@Override
public
void
asyncResult
(
String
msgid
,
Long
messageId
)
{
public
void
asyncResult
(
AsyncResultDto
asyncResultDto
)
throws
JsonProcessingException
{
syncSendResult
(
msgid
,
messageId
);
String
msgid
=
new
ObjectMapper
().
writeValueAsString
(
asyncResultDto
.
getMsgids
());
syncSendResult
(
msgid
,
asyncResultDto
.
getMessageId
());
}
}
public
void
syncSendResult
(
String
msgid
,
Long
messageId
)
{
public
void
syncSendResult
(
String
msgid
,
Long
messageId
)
{
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerMessagePushServiceImpl.java
View file @
1d60b09
...
@@ -299,7 +299,7 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
...
@@ -299,7 +299,7 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
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
)
{
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
());
//客户群的员工id
//客户群的员工id
messagePushDto
.
setSender
(
owner
);
messagePushDto
.
setSender
(
owner
);
seedMessage
(
messagePushDto
,
customerMessagePushDto
);
seedMessage
(
messagePushDto
,
customerMessagePushDto
);
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeCustomerMessgaeResultMapper.xml
View file @
1d60b09
...
@@ -38,4 +38,14 @@
...
@@ -38,4 +38,14 @@
</where>
</where>
GROUP BY user_name
GROUP BY user_name
</select>
</select>
<select
id=
"checkSendStatus"
resultType=
"java.lang.Integer"
>
SELECT
COUNT(1)
FROM
we_customer_messgaeResult
<where>
message_id =#{messageId} AND `status`='1'
</where>
</select>
</mapper>
</mapper>
\ No newline at end of file
\ No newline at end of file
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