Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
O
operate-customer-service
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
沈振路
operate-customer-service
Commits
ec70a097
提交
ec70a097
authored
12月 28, 2022
作者:
gh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
定时刷新过期的延时客服
上级
c6cfdc61
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
103 行增加
和
20 行删除
+103
-20
SchedulingTask.java
...java/com/yaoyaozw/customer/scheduling/SchedulingTask.java
+20
-0
CustomerDelayPublishService.java
...aoyaozw/customer/service/CustomerDelayPublishService.java
+12
-2
RegisterUserEntityService.java
.../yaoyaozw/customer/service/RegisterUserEntityService.java
+7
-1
CustomerDelayPublishServiceImpl.java
...ustomer/service/impl/CustomerDelayPublishServiceImpl.java
+55
-0
RegisterUserEntityServiceImpl.java
.../customer/service/impl/RegisterUserEntityServiceImpl.java
+9
-17
没有找到文件。
src/main/java/com/yaoyaozw/customer/scheduling/SchedulingTask.java
浏览文件 @
ec70a097
...
@@ -81,6 +81,26 @@ public class SchedulingTask {
...
@@ -81,6 +81,26 @@ public class SchedulingTask {
customerDelayPublishService
.
sendCustomerDelayMessage
(
integrationRequestDTO
);
customerDelayPublishService
.
sendCustomerDelayMessage
(
integrationRequestDTO
);
}
}
/**
* 每天跑两次扫过期延时客服
*/
@Scheduled
(
cron
=
"0 3 9/12 * * *"
)
public
void
refreshExpiredDelayCustomer
(){
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
add
(
Calendar
.
MINUTE
,-
5
);
calendar
.
set
(
Calendar
.
SECOND
,
0
);
calendar
.
set
(
Calendar
.
MILLISECOND
,
0
);
customerDelayPublishService
.
updateExpiredCustomerDelayMessage
(
calendar
.
getTime
());
}
/**
/**
* 从redis中更新人群包人数
* 从redis中更新人群包人数
*/
*/
...
...
src/main/java/com/yaoyaozw/customer/service/CustomerDelayPublishService.java
浏览文件 @
ec70a097
...
@@ -4,14 +4,24 @@ import com.yaoyaozw.customer.dto.integration.IntegrationRequestDTO;
...
@@ -4,14 +4,24 @@ import com.yaoyaozw.customer.dto.integration.IntegrationRequestDTO;
import
com.yaoyaozw.customer.entity.CustomerDelayPublish
;
import
com.yaoyaozw.customer.entity.CustomerDelayPublish
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
/**
import
java.util.Date
;
/**
* @author wgh
* @author wgh
* @date 2022/9/28 18:51
* @date 2022/9/28 18:51
*/
*/
public
interface
CustomerDelayPublishService
extends
IService
<
CustomerDelayPublish
>{
public
interface
CustomerDelayPublishService
extends
IService
<
CustomerDelayPublish
>
{
/**
/**
* 延时客服发送
* 延时客服发送
* @param integrationRequestDTO
* @param integrationRequestDTO
*/
*/
public
void
sendCustomerDelayMessage
(
IntegrationRequestDTO
integrationRequestDTO
);
public
void
sendCustomerDelayMessage
(
IntegrationRequestDTO
integrationRequestDTO
);
/**
* 更新过期的延时客服
* @param requestDate
*/
public
void
updateExpiredCustomerDelayMessage
(
Date
requestDate
);
}
}
src/main/java/com/yaoyaozw/customer/service/RegisterUserEntityService.java
浏览文件 @
ec70a097
...
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
...
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import
com.yaoyaozw.customer.vo.customer.CrowdPackageUserVO
;
import
com.yaoyaozw.customer.vo.customer.CrowdPackageUserVO
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
public
interface
RegisterUserEntityService
extends
IService
<
RegisterUserEntity
>{
public
interface
RegisterUserEntityService
extends
IService
<
RegisterUserEntity
>{
...
@@ -37,5 +38,10 @@ public interface RegisterUserEntityService extends IService<RegisterUserEntity>{
...
@@ -37,5 +38,10 @@ public interface RegisterUserEntityService extends IService<RegisterUserEntity>{
List
<
CrowdPackageUserVO
>
getCurrentInPackUserList
(
Long
packageId
,
Boolean
isLeftJoin
);
List
<
CrowdPackageUserVO
>
getCurrentInPackUserList
(
Long
packageId
,
Boolean
isLeftJoin
);
/**
* 找超时的延时客服排期
* @param requestDate 请求时刻
* @return
*/
List
<
RegisterUserEntity
>
getAllExpiredDelayPublish
(
Date
requestDate
);
}
}
src/main/java/com/yaoyaozw/customer/service/impl/CustomerDelayPublishServiceImpl.java
浏览文件 @
ec70a097
package
com
.
yaoyaozw
.
customer
.
service
.
impl
;
package
com
.
yaoyaozw
.
customer
.
service
.
impl
;
import
com.yaoyaozw.customer.dto.integration.IntegrationRequestDTO
;
import
com.yaoyaozw.customer.dto.integration.IntegrationRequestDTO
;
import
com.yaoyaozw.customer.entity.RegisterUserEntity
;
import
com.yaoyaozw.customer.service.CustomerGraphicsDelayService
;
import
com.yaoyaozw.customer.service.CustomerGraphicsDelayService
;
import
com.yaoyaozw.customer.service.RegisterUserEntityService
;
import
com.yaoyaozw.customer.service.wechat.service.WeChatService
;
import
com.yaoyaozw.customer.service.wechat.service.WeChatService
;
import
com.yaoyaozw.customer.vo.customer.CustomerDelayItemVO
;
import
com.yaoyaozw.customer.vo.customer.CustomerDelayItemVO
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
@@ -42,6 +44,8 @@ public class CustomerDelayPublishServiceImpl extends ServiceImpl<CustomerDelayPu
...
@@ -42,6 +44,8 @@ public class CustomerDelayPublishServiceImpl extends ServiceImpl<CustomerDelayPu
@Autowired
@Autowired
private
WeChatService
weChatService
;
private
WeChatService
weChatService
;
@Autowired
private
RegisterUserEntityService
registerUserEntityService
;
@Override
@Override
public
void
sendCustomerDelayMessage
(
IntegrationRequestDTO
integrationRequestDTO
)
{
public
void
sendCustomerDelayMessage
(
IntegrationRequestDTO
integrationRequestDTO
)
{
...
@@ -115,4 +119,55 @@ public class CustomerDelayPublishServiceImpl extends ServiceImpl<CustomerDelayPu
...
@@ -115,4 +119,55 @@ public class CustomerDelayPublishServiceImpl extends ServiceImpl<CustomerDelayPu
localLog
.
error
(
"发生异常: {}, 位置: {}"
,
e
.
getMessage
(),
e
.
getStackTrace
()[
0
]);
localLog
.
error
(
"发生异常: {}, 位置: {}"
,
e
.
getMessage
(),
e
.
getStackTrace
()[
0
]);
}
}
}
}
@Override
public
void
updateExpiredCustomerDelayMessage
(
Date
requestDate
)
{
//超时的延时排期
List
<
RegisterUserEntity
>
allExpiredDelayPublish
=
registerUserEntityService
.
getAllExpiredDelayPublish
(
requestDate
);
Set
<
String
>
appidList
=
allExpiredDelayPublish
.
stream
().
map
(
RegisterUserEntity:
:
getAppId
).
collect
(
Collectors
.
toSet
());
//获取所有延时客服
List
<
CustomerDelayItemVO
>
allDelayCustomerMessage
=
customerGraphicsDelayService
.
findAllDelayCustomerSort
(
appidList
,
null
);
Map
<
String
,
Map
<
Long
,
Integer
>>
collect
=
allDelayCustomerMessage
.
stream
().
collect
(
Collectors
.
groupingBy
(
CustomerDelayItemVO:
:
getAppId
,
Collectors
.
toMap
(
CustomerDelayItemVO:
:
getTimeInterval
,
CustomerDelayItemVO:
:
getPostSort
,
(
v1
,
v2
)
->
v1
)));
Date
currentDate
=
new
Date
();
for
(
RegisterUserEntity
expiredUser
:
allExpiredDelayPublish
)
{
try
{
Map
<
Long
,
Integer
>
longIntegerMap
=
collect
.
get
(
expiredUser
.
getAppId
());
if
(
longIntegerMap
!=
null
&&!
longIntegerMap
.
isEmpty
()){
Date
firstActive
=
expiredUser
.
getFirstActive
();
ArrayList
<
Long
>
timeList
=
new
ArrayList
<>(
longIntegerMap
.
keySet
());
List
<
Long
>
sortTimeList
=
timeList
.
stream
().
sorted
().
collect
(
Collectors
.
toList
());
for
(
Long
aLong
:
sortTimeList
)
{
Date
publishTime
=
new
Date
(((
firstActive
.
getTime
()
+
aLong
)
/
60000
)
*
60000
);
if
(
publishTime
.
compareTo
(
currentDate
)>
0
){
expiredUser
.
setCustomerPublish
(
publishTime
);
expiredUser
.
setCustomerSort
(
longIntegerMap
.
get
(
aLong
));
break
;
}
expiredUser
.
setCustomerSort
(-
1
);
}
}
else
{
expiredUser
.
setCustomerSort
(-
1
);
}
}
catch
(
Exception
e
){
log
.
error
(
e
.
getStackTrace
()[
0
].
toString
());
}
}
registerUserEntityService
.
updateBatchById
(
allExpiredDelayPublish
);
}
}
}
src/main/java/com/yaoyaozw/customer/service/impl/RegisterUserEntityServiceImpl.java
浏览文件 @
ec70a097
package
com
.
yaoyaozw
.
customer
.
service
.
impl
;
package
com
.
yaoyaozw
.
customer
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.yaoyaozw.customer.dto.integration.IntegrationRequestDTO
;
import
com.yaoyaozw.customer.entity.AuthorizerToken
;
import
com.yaoyaozw.customer.entity.CustomerDelayPublish
;
import
com.yaoyaozw.customer.service.AuthorizerTokenService
;
import
com.yaoyaozw.customer.service.CustomerGraphicsDelayService
;
import
com.yaoyaozw.customer.service.CustomerGraphicsService
;
import
com.yaoyaozw.customer.service.wechat.service.WeChatService
;
import
com.yaoyaozw.customer.vo.customer.CrowdPackageUserVO
;
import
com.yaoyaozw.customer.vo.customer.CrowdPackageUserVO
;
import
com.yaoyaozw.customer.vo.customer.CustomerDelayItemVO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yaoyaozw.customer.mapper.RegisterUserEntityMapper
;
import
com.yaoyaozw.customer.mapper.RegisterUserEntityMapper
;
import
com.yaoyaozw.customer.entity.RegisterUserEntity
;
import
com.yaoyaozw.customer.entity.RegisterUserEntity
;
import
com.yaoyaozw.customer.service.RegisterUserEntityService
;
import
com.yaoyaozw.customer.service.RegisterUserEntityService
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.concurrent.ExecutionException
;
import
java.util.concurrent.Future
;
import
java.util.stream.Collectors
;
@Service
@Service
...
@@ -56,4 +43,9 @@ public class RegisterUserEntityServiceImpl extends ServiceImpl<RegisterUserEntit
...
@@ -56,4 +43,9 @@ public class RegisterUserEntityServiceImpl extends ServiceImpl<RegisterUserEntit
}
}
}
}
@Override
public
List
<
RegisterUserEntity
>
getAllExpiredDelayPublish
(
Date
requestDate
){
return
baseMapper
.
findAllExpiredDelayPublish
(
requestDate
);
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论