Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
O
operate-customer-service
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
沈振路
operate-customer-service
Commits
e46b30b8
提交
e46b30b8
authored
11月 14, 2022
作者:
gh
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/master'
上级
c3972804
d7097e5c
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
75 行增加
和
57 行删除
+75
-57
CustomerDelayGraphicsController.java
.../customer/controller/CustomerDelayGraphicsController.java
+2
-1
CustomerGraphicsDelayService.java
...oyaozw/customer/service/CustomerGraphicsDelayService.java
+2
-1
CustomerDelayPublishServiceImpl.java
...ustomer/service/impl/CustomerDelayPublishServiceImpl.java
+54
-52
CustomerGraphicsDelayServiceImpl.java
...stomer/service/impl/CustomerGraphicsDelayServiceImpl.java
+6
-2
WeChatServiceImpl.java
...zw/customer/service/wechat/service/WeChatServiceImpl.java
+6
-1
CustomerMessageListVO.java
.../yaoyaozw/customer/vo/customer/CustomerMessageListVO.java
+3
-0
application-dev.yml
src/main/resources/application-dev.yml
+1
-0
CustomerGraphicsMapper.xml
src/main/resources/mapper/CustomerGraphicsMapper.xml
+1
-0
没有找到文件。
src/main/java/com/yaoyaozw/customer/controller/CustomerDelayGraphicsController.java
浏览文件 @
e46b30b8
...
...
@@ -71,8 +71,9 @@ public class CustomerDelayGraphicsController {
public
BaseResult
copy
(
@RequestParam
String
appId
,
@RequestParam
(
required
=
false
)
String
bookId
,
@RequestParam
(
required
=
false
)
String
bookName
,
@RequestParam
(
required
=
false
)
Integer
chapterIdx
,
@RequestBody
List
<
String
>
targetAppList
)
{
return
customerGraphicsDelayService
.
copy
(
appId
,
bookId
,
bookName
,
targetAppList
);
return
customerGraphicsDelayService
.
copy
(
appId
,
bookId
,
bookName
,
chapterIdx
,
targetAppList
);
}
@ApiOperation
(
"所有公众号"
)
...
...
src/main/java/com/yaoyaozw/customer/service/CustomerGraphicsDelayService.java
浏览文件 @
e46b30b8
...
...
@@ -90,10 +90,11 @@ public interface CustomerGraphicsDelayService extends IService<CustomerGraphicsD
* @param appId 应用程序id
* @param bookId 选择目标书
* @param bookName 书名
* @param chapterIdx 章节
* @param targetAppList 目标应用程序列表
* @return {@link BaseResult}
*/
BaseResult
copy
(
String
appId
,
String
bookId
,
String
bookName
,
List
<
String
>
targetAppList
);
BaseResult
copy
(
String
appId
,
String
bookId
,
String
bookName
,
Integer
chapterIdx
,
List
<
String
>
targetAppList
);
/**
* 获得认证列表
...
...
src/main/java/com/yaoyaozw/customer/service/impl/CustomerDelayPublishServiceImpl.java
浏览文件 @
e46b30b8
...
...
@@ -8,6 +8,8 @@ import com.yaoyaozw.customer.service.CustomerGraphicsDelayService;
import
com.yaoyaozw.customer.service.wechat.service.WeChatService
;
import
com.yaoyaozw.customer.utils.YYZWDateUtil
;
import
com.yaoyaozw.customer.vo.customer.CustomerDelayItemVO
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
...
...
@@ -29,6 +31,7 @@ import com.yaoyaozw.customer.service.CustomerDelayPublishService;
@Service
public
class
CustomerDelayPublishServiceImpl
extends
ServiceImpl
<
CustomerDelayPublishMapper
,
CustomerDelayPublish
>
implements
CustomerDelayPublishService
{
private
final
static
Logger
localLog
=
LoggerFactory
.
getLogger
(
CustomerDelayPublishServiceImpl
.
class
);
@Autowired
private
CustomerGraphicsDelayService
customerGraphicsDelayService
;
...
...
@@ -47,67 +50,66 @@ public class CustomerDelayPublishServiceImpl extends ServiceImpl<CustomerDelayPu
//涉及的appid
Set
<
String
>
appidSet
=
allPostUser
.
stream
().
map
(
CustomerDelayPublish:
:
getAppId
).
collect
(
Collectors
.
toSet
());
if
(!
allPostUser
.
isEmpty
()){
//号-用户
Map
<
String
,
Map
<
String
,
CustomerDelayPublish
>>
userMap
=
allPostUser
.
stream
().
filter
(
a
->
a
.
getCustomerSort
()!=
null
).
collect
(
Collectors
.
groupingBy
(
CustomerDelayPublish:
:
getAppId
,
Collectors
.
toMap
(
CustomerDelayPublish:
:
getOpenId
,
a
->
a
,(
v1
,
v2
)->
v1
)));
//获取所有延时客服
List
<
CustomerDelayItemVO
>
allDelayCustomerMessage
=
customerGraphicsDelayService
.
findAllDelayCustomerSort
(
appidSet
,
null
);
if
(
allDelayCustomerMessage
!=
null
&&!
allDelayCustomerMessage
.
isEmpty
()){
List
<
Future
<
CustomerDelayPublish
>>
futureList
=
new
ArrayList
<>();
//号-发送序列-客服id
Map
<
String
,
Map
<
Integer
,
List
<
CustomerDelayItemVO
>>>
customerMap
=
allDelayCustomerMessage
.
stream
().
collect
(
Collectors
.
groupingBy
(
CustomerDelayItemVO:
:
getAppId
,
Collectors
.
groupingBy
(
CustomerDelayItemVO:
:
getPostSort
)));
Set
<
CustomerDelayItemVO
>
needUpdateCustomerDelay
=
new
HashSet
<>();
for
(
Map
.
Entry
<
String
,
Map
<
String
,
CustomerDelayPublish
>>
userEntry
:
userMap
.
entrySet
())
{
String
appid
=
userEntry
.
getKey
();
//获取该号token
AuthorizerToken
authorizerToken
=
authorizerTokenService
.
findTokenByAppid
(
appid
);
String
token
=
authorizerToken
.
getAuthorizerAppid
();
//没token过滤
if
(
token
==
null
||
""
.
equals
(
token
)){
continue
;
}
//该号下延时客服
Map
<
Integer
,
List
<
CustomerDelayItemVO
>>
delaySortMap
=
customerMap
.
get
(
appid
);
//所有的用户
Map
<
String
,
CustomerDelayPublish
>
userPublishMap
=
userEntry
.
getValue
();
//去重
List
<
CustomerDelayPublish
>
userList
=
new
ArrayList
<>(
userPublishMap
.
values
())
;
if
(
delaySortMap
!=
null
&&!
delaySortMap
.
isEmpty
()){
//将所有待用延时客服收集
for
(
CustomerDelayPublish
userPublish
:
userList
)
{
//发送延时客服
futureList
.
add
(
weChatService
.
sendCustomerDelayMessage
(
authorizerToken
,
userPublish
,
delaySortMap
,
needUpdateCustomerDelay
))
;
try
{
if
(!
allPostUser
.
isEmpty
()){
//号-用户
Map
<
String
,
Map
<
String
,
CustomerDelayPublish
>>
userMap
=
allPostUser
.
stream
().
filter
(
a
->
a
.
getCustomerSort
()!=
null
).
collect
(
Collectors
.
groupingBy
(
CustomerDelayPublish:
:
getAppId
,
Collectors
.
toMap
(
CustomerDelayPublish:
:
getOpenId
,
a
->
a
,(
v1
,
v2
)->
v1
)));
//获取所有延时客服
List
<
CustomerDelayItemVO
>
allDelayCustomerMessage
=
customerGraphicsDelayService
.
findAllDelayCustomerSort
(
appidSet
,
null
);
if
(
allDelayCustomerMessage
!=
null
&&!
allDelayCustomerMessage
.
isEmpty
()){
List
<
Future
<
CustomerDelayPublish
>>
futureList
=
new
ArrayList
<>();
//号-发送序列-客服id
Map
<
String
,
Map
<
Integer
,
List
<
CustomerDelayItemVO
>>>
customerMap
=
allDelayCustomerMessage
.
stream
().
collect
(
Collectors
.
groupingBy
(
CustomerDelayItemVO:
:
getAppId
,
Collectors
.
groupingBy
(
CustomerDelayItemVO:
:
getPostSort
)));
Set
<
CustomerDelayItemVO
>
needUpdateCustomerDelay
=
new
HashSet
<>();
for
(
Map
.
Entry
<
String
,
Map
<
String
,
CustomerDelayPublish
>>
userEntry
:
userMap
.
entrySet
())
{
String
appid
=
userEntry
.
getKey
();
//获取该号token
AuthorizerToken
authorizerToken
=
authorizerTokenService
.
findTokenByAppid
(
appid
);
String
token
=
authorizerToken
.
getAuthorizerAppid
();
//没token过滤
if
(
token
==
null
||
""
.
equals
(
token
)){
continue
;
}
//该号下延时客服
Map
<
Integer
,
List
<
CustomerDelayItemVO
>>
delaySortMap
=
customerMap
.
get
(
appid
);
//所有的用户
Map
<
String
,
CustomerDelayPublish
>
userPublishMap
=
userEntry
.
getValue
();
//去重
List
<
CustomerDelayPublish
>
userList
=
new
ArrayList
<>(
userPublishMap
.
values
())
;
if
(
delaySortMap
!=
null
&&!
delaySortMap
.
isEmpty
()){
//将所有待用延时客服收集
for
(
CustomerDelayPublish
userPublish
:
userList
)
{
//发送延时客服
futureList
.
add
(
weChatService
.
sendCustomerDelayMessage
(
authorizerToken
,
userPublish
,
delaySortMap
,
needUpdateCustomerDelay
))
;
}
}
}
}
List
<
CustomerDelayPublish
>
registerUserEntities
=
new
ArrayList
<>();
//更新下次延时排期
for
(
Future
<
CustomerDelayPublish
>
delayPublishFuture
:
futureList
)
{
try
{
List
<
CustomerDelayPublish
>
registerUserEntities
=
new
ArrayList
<>();
//更新下次延时排期
for
(
Future
<
CustomerDelayPublish
>
delayPublishFuture
:
futureList
)
{
registerUserEntities
.
add
(
delayPublishFuture
.
get
())
;
}
if
(!
registerUserEntities
.
isEmpty
()){
}
catch
(
InterruptedException
|
ExecutionException
e
)
{
e
.
printStackTrace
();
updateBatchById
(
registerUserEntities
);
}
}
if
(!
registerUserEntities
.
isEmpty
()){
//更新延时客服的发送人数数据
if
(!
needUpdateCustomerDelay
.
isEmpty
()){
updateBatchById
(
registerUserEntities
);
customerGraphicsDelayService
.
updateSendNumById
(
needUpdateCustomerDelay
);
}
}
//更新延时客服的发送人数数据
if
(!
needUpdateCustomerDelay
.
isEmpty
()){
customerGraphicsDelayService
.
updateSendNumById
(
needUpdateCustomerDelay
);
}
}
}
catch
(
Exception
e
)
{
localLog
.
error
(
"发生异常: {}, 位置: {}"
,
e
.
getMessage
(),
e
.
getStackTrace
()[
0
]);
}
}
}
src/main/java/com/yaoyaozw/customer/service/impl/CustomerGraphicsDelayServiceImpl.java
浏览文件 @
e46b30b8
...
...
@@ -238,7 +238,7 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
}
@Override
public
BaseResult
copy
(
String
appId
,
String
bookId
,
String
bookName
,
List
<
String
>
targetAppList
)
{
public
BaseResult
copy
(
String
appId
,
String
bookId
,
String
bookName
,
Integer
chapterIdx
,
List
<
String
>
targetAppList
)
{
List
<
AuthorizerInfo
>
authorizerInfoList
=
authorizerInfoService
.
list
();
Map
<
String
,
AuthorizerInfo
>
authMap
=
authorizerInfoList
.
stream
().
collect
(
Collectors
.
toMap
(
AuthorizerInfo:
:
getAppid
,
Function
.
identity
()));
...
...
@@ -258,9 +258,13 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
Stream
<
ReferralEntity
>
stream
=
referralEntityList
.
stream
();
if
(
StringUtil
.
isNotBlank
(
bookId
))
{
stream
=
stream
.
peek
(
item
->
{
if
(
StringUtil
.
isNotBlank
(
item
.
getBookId
()))
{
// 选了书,将推广类型的链接书籍换成选择的书籍
if
(
StringUtil
.
isNotBlank
(
item
.
getBookId
())
&&
CustomerCommonConstant
.
BOOK_NEWS_TYPE
.
equals
(
item
.
getNewsType
()))
{
item
.
setBookId
(
bookId
);
item
.
setBookName
(
bookName
);
if
(
ObjectUtil
.
isNotNull
(
chapterIdx
))
{
item
.
setChapterIdx
(
chapterIdx
);
}
}
});
}
...
...
src/main/java/com/yaoyaozw/customer/service/wechat/service/WeChatServiceImpl.java
浏览文件 @
e46b30b8
...
...
@@ -8,6 +8,7 @@ import com.yaoyaozw.customer.entity.CustomerDelayPublish;
import
com.yaoyaozw.customer.entity.CustomerGraphics
;
import
com.yaoyaozw.customer.service.AuthorizerTokenService
;
import
com.yaoyaozw.customer.service.ReferralEntityService
;
import
com.yaoyaozw.customer.service.impl.CustomerDelayPublishServiceImpl
;
import
com.yaoyaozw.customer.service.wechat.entity.WeChatResponseEntity
;
import
com.yaoyaozw.customer.service.wechat.entity.customerRequest.CustomerNewsArticleItem
;
import
com.yaoyaozw.customer.service.wechat.entity.customerRequest.CustomerNewsItem
;
...
...
@@ -15,6 +16,8 @@ import com.yaoyaozw.customer.service.wechat.entity.customerRequest.WeChatCustome
import
com.yaoyaozw.customer.vo.customer.CrowdPackageUserVO
;
import
com.yaoyaozw.customer.vo.customer.CustomerDelayItemVO
;
import
com.yaoyaozw.customer.vo.referral.ReferralEntityVo
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.scheduling.annotation.Async
;
...
...
@@ -30,6 +33,8 @@ import java.util.stream.Collectors;
@Service
public
class
WeChatServiceImpl
implements
WeChatService
{
private
final
static
Logger
localLog
=
LoggerFactory
.
getLogger
(
WeChatServiceImpl
.
class
);
private
String
customerPath
=
"https://api.weixin.qq.com/cgi-bin/message/custom/send"
;
private
static
final
String
CUSTOMER_TEXT
=
"text"
;
...
...
@@ -100,7 +105,7 @@ public class WeChatServiceImpl implements WeChatService{
return
sendCustomerDelayMessage
(
updateToken
,
user
,
delaySortMap
,
needUpdateVoList
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
localLog
.
error
(
"发生异常: {}, 位置: {}"
,
e
.
getMessage
(),
e
.
getStackTrace
()[
0
]
);
}
}
}
...
...
src/main/java/com/yaoyaozw/customer/vo/customer/CustomerMessageListVO.java
浏览文件 @
e46b30b8
...
...
@@ -41,6 +41,9 @@ public class CustomerMessageListVO implements Serializable {
@ApiModelProperty
(
"人数"
)
private
Integer
peopleNum
;
@ApiModelProperty
(
"人数"
)
private
Integer
sendNum
;
@ApiModelProperty
(
"发送状态值"
)
private
Integer
sendStatus
;
...
...
src/main/resources/application-dev.yml
浏览文件 @
e46b30b8
...
...
@@ -18,6 +18,7 @@ mybatis-plus:
call-setters-on-nulls
:
true
jdbc-type-for-null
:
'
null'
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
log-impl
:
org.apache.ibatis.logging.nologging.NoLoggingImpl
logging
:
level
:
com.example.material.mapper
:
debug
src/main/resources/mapper/CustomerGraphicsMapper.xml
浏览文件 @
e46b30b8
...
...
@@ -28,6 +28,7 @@
cg.post_time as postTime,
cg.extend_title as extendTitle,
cg.send_status as sendStatus,
cg.send_num as sendNum,
dic.dic_value as sendStatusStr,
cpm.id as packId,
cpm.package_name as packName,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论