Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
O
operate-customer-service
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
沈振路
operate-customer-service
Commits
ef3aed86
提交
ef3aed86
authored
6月 26, 2025
作者:
沈振路
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
根据人群包名称批量查询人群包列表接口 & 批量设置客服消息人群包接口
上级
9cfb24a9
显示空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
179 行增加
和
1 行删除
+179
-1
CrowdPackageController.java
.../yaoyaozw/customer/controller/CrowdPackageController.java
+6
-0
CustomerMessageGraphicsController.java
...ustomer/controller/CustomerMessageGraphicsController.java
+11
-0
CustomerBatchSetPackDTO.java
...oyaozw/customer/dto/customer/CustomerBatchSetPackDTO.java
+35
-0
MaterialCrowdPackageMapper.java
.../yaoyaozw/customer/mapper/MaterialCrowdPackageMapper.java
+8
-0
CrowdPackageService.java
...va/com/yaoyaozw/customer/service/CrowdPackageService.java
+8
-0
CustomerGraphicsService.java
...om/yaoyaozw/customer/service/CustomerGraphicsService.java
+7
-0
CrowdPackageServiceImpl.java
...oyaozw/customer/service/impl/CrowdPackageServiceImpl.java
+11
-1
CustomerGraphicsServiceImpl.java
...zw/customer/service/impl/CustomerGraphicsServiceImpl.java
+64
-0
MaterialCrowdPackageMapper.xml
src/main/resources/mapper/MaterialCrowdPackageMapper.xml
+29
-0
没有找到文件。
src/main/java/com/yaoyaozw/customer/controller/CrowdPackageController.java
浏览文件 @
ef3aed86
...
@@ -95,4 +95,10 @@ public class CrowdPackageController {
...
@@ -95,4 +95,10 @@ public class CrowdPackageController {
return
crowdPackageService
.
updateUserPackageBatch
(
openIdList
);
return
crowdPackageService
.
updateUserPackageBatch
(
openIdList
);
}
}
@ApiOperation
(
"根据人群包名称列表完全匹配查询"
)
@PostMapping
(
"/getByPackageNames"
)
public
GenericsResult
<
List
<
CrowdPackageListVO
>>
getByPackageNames
(
@RequestBody
List
<
String
>
packageNames
)
{
return
crowdPackageService
.
getByPackageNames
(
packageNames
);
}
}
}
src/main/java/com/yaoyaozw/customer/controller/CustomerMessageGraphicsController.java
浏览文件 @
ef3aed86
...
@@ -4,6 +4,7 @@ import com.github.pagehelper.PageInfo;
...
@@ -4,6 +4,7 @@ import com.github.pagehelper.PageInfo;
import
com.yaoyaozw.customer.annotations.OperateLog
;
import
com.yaoyaozw.customer.annotations.OperateLog
;
import
com.yaoyaozw.customer.common.BaseResult
;
import
com.yaoyaozw.customer.common.BaseResult
;
import
com.yaoyaozw.customer.common.GenericsResult
;
import
com.yaoyaozw.customer.common.GenericsResult
;
import
com.yaoyaozw.customer.dto.customer.CustomerBatchSetPackDTO
;
import
com.yaoyaozw.customer.dto.customer.CustomerMessageQueryDTO
;
import
com.yaoyaozw.customer.dto.customer.CustomerMessageQueryDTO
;
import
com.yaoyaozw.customer.dto.customer.CustomerMessageSaveDTO
;
import
com.yaoyaozw.customer.dto.customer.CustomerMessageSaveDTO
;
import
com.yaoyaozw.customer.service.CustomerGraphicsService
;
import
com.yaoyaozw.customer.service.CustomerGraphicsService
;
...
@@ -63,4 +64,14 @@ public class CustomerMessageGraphicsController {
...
@@ -63,4 +64,14 @@ public class CustomerMessageGraphicsController {
return
customerGraphicsService
.
setPack
(
id
,
packId
);
return
customerGraphicsService
.
setPack
(
id
,
packId
);
}
}
@ApiOperation
(
"批量设置人群包"
)
@PostMapping
(
"/batchSetPack"
)
@OperateLog
(
module
=
"客服消息"
,
desc
=
"批量设置人群包"
)
public
BaseResult
batchSetPack
(
@RequestBody
List
<
CustomerBatchSetPackDTO
>
batchSetPackList
)
{
// 调用异步方法
customerGraphicsService
.
batchSetPack
(
batchSetPackList
);
// 立即返回成功信息
return
new
BaseResult
().
success
(
"批量生成中,请稍后查看"
);
}
}
}
src/main/java/com/yaoyaozw/customer/dto/customer/CustomerBatchSetPackDTO.java
0 → 100644
浏览文件 @
ef3aed86
package
com
.
yaoyaozw
.
customer
.
dto
.
customer
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* 批量设置人群包DTO
* @author system
* @date 2024/01/01
*/
@Data
public
class
CustomerBatchSetPackDTO
implements
Serializable
{
@ApiModelProperty
(
"客服消息ID"
)
@JsonSerialize
(
using
=
ToStringSerializer
.
class
)
private
Long
customerMessageId
;
@ApiModelProperty
(
"人群包ID"
)
@JsonSerialize
(
using
=
ToStringSerializer
.
class
)
private
Long
packId
;
@ApiModelProperty
(
"人群包名称"
)
private
String
packName
;
@ApiModelProperty
(
"操作人ID"
)
@JsonSerialize
(
using
=
ToStringSerializer
.
class
)
private
Long
operateUserId
;
private
static
final
long
serialVersionUID
=
1L
;
}
\ No newline at end of file
src/main/java/com/yaoyaozw/customer/mapper/MaterialCrowdPackageMapper.java
浏览文件 @
ef3aed86
...
@@ -51,4 +51,12 @@ public interface MaterialCrowdPackageMapper extends BaseMapper<CrowdPackage> {
...
@@ -51,4 +51,12 @@ public interface MaterialCrowdPackageMapper extends BaseMapper<CrowdPackage> {
* @param crowdPackage 人群中包
* @param crowdPackage 人群中包
*/
*/
void
updatePackageFollowTime
(
@Param
(
"crowdPackage"
)
CrowdPackage
crowdPackage
);
void
updatePackageFollowTime
(
@Param
(
"crowdPackage"
)
CrowdPackage
crowdPackage
);
/**
* 根据人群包名称列表完全匹配查询
*
* @param packageNames 人群包名称列表
* @return {@link List}<{@link CrowdPackageListVO}>
*/
List
<
CrowdPackageListVO
>
getByPackageNames
(
@Param
(
"packageNames"
)
List
<
String
>
packageNames
);
}
}
src/main/java/com/yaoyaozw/customer/service/CrowdPackageService.java
浏览文件 @
ef3aed86
...
@@ -108,4 +108,12 @@ public interface CrowdPackageService extends IService<CrowdPackage> {
...
@@ -108,4 +108,12 @@ public interface CrowdPackageService extends IService<CrowdPackage> {
*/
*/
void
updateCrowdPackageNumFromRedis
();
void
updateCrowdPackageNumFromRedis
();
/**
* 根据人群包名称列表完全匹配查询
*
* @param packageNames 人群包名称列表
* @return {@link GenericsResult}<{@link List}<{@link CrowdPackageListVO}>>
*/
GenericsResult
<
List
<
CrowdPackageListVO
>>
getByPackageNames
(
List
<
String
>
packageNames
);
}
}
src/main/java/com/yaoyaozw/customer/service/CustomerGraphicsService.java
浏览文件 @
ef3aed86
...
@@ -66,6 +66,13 @@ public interface CustomerGraphicsService extends IService<CustomerGraphics> {
...
@@ -66,6 +66,13 @@ public interface CustomerGraphicsService extends IService<CustomerGraphics> {
*/
*/
BaseResult
setPack
(
Long
id
,
Long
packId
);
BaseResult
setPack
(
Long
id
,
Long
packId
);
/**
* 批量设置人群包
*
* @param batchSetPackList 批量设置参数列表
* @return {@link BaseResult}
*/
void
batchSetPack
(
List
<
com
.
yaoyaozw
.
customer
.
dto
.
customer
.
CustomerBatchSetPackDTO
>
batchSetPackList
);
/**
/**
* 客服发送
* 客服发送
...
...
src/main/java/com/yaoyaozw/customer/service/impl/CrowdPackageServiceImpl.java
浏览文件 @
ef3aed86
...
@@ -469,6 +469,16 @@ public class CrowdPackageServiceImpl extends ServiceImpl<MaterialCrowdPackageMap
...
@@ -469,6 +469,16 @@ public class CrowdPackageServiceImpl extends ServiceImpl<MaterialCrowdPackageMap
}
}
@Override
public
GenericsResult
<
List
<
CrowdPackageListVO
>>
getByPackageNames
(
List
<
String
>
packageNames
)
{
if
(
CollectionUtil
.
isEmpty
(
packageNames
))
{
return
new
GenericsResult
<>(
true
,
"人群包名称列表为空"
);
}
List
<
CrowdPackageListVO
>
list
=
baseMapper
.
getByPackageNames
(
packageNames
);
if
(
CollectionUtil
.
isEmpty
(
list
))
{
return
new
GenericsResult
<>(
true
,
"暂无数据"
);
}
return
new
GenericsResult
<>(
list
);
}
}
}
src/main/java/com/yaoyaozw/customer/service/impl/CustomerGraphicsServiceImpl.java
浏览文件 @
ef3aed86
...
@@ -3,6 +3,8 @@ package com.yaoyaozw.customer.service.impl;
...
@@ -3,6 +3,8 @@ package com.yaoyaozw.customer.service.impl;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
...
@@ -13,6 +15,7 @@ import com.yaoyaozw.customer.components.SnowflakeComponent;
...
@@ -13,6 +15,7 @@ import com.yaoyaozw.customer.components.SnowflakeComponent;
import
com.yaoyaozw.customer.components.TokenManager
;
import
com.yaoyaozw.customer.components.TokenManager
;
import
com.yaoyaozw.customer.constants.CrowdPackageCommonConstant
;
import
com.yaoyaozw.customer.constants.CrowdPackageCommonConstant
;
import
com.yaoyaozw.customer.constants.CustomerCommonConstant
;
import
com.yaoyaozw.customer.constants.CustomerCommonConstant
;
import
com.yaoyaozw.customer.dto.customer.CustomerBatchSetPackDTO
;
import
com.yaoyaozw.customer.dto.customer.CustomerMessageQueryDTO
;
import
com.yaoyaozw.customer.dto.customer.CustomerMessageQueryDTO
;
import
com.yaoyaozw.customer.dto.customer.CustomerMessageSaveDTO
;
import
com.yaoyaozw.customer.dto.customer.CustomerMessageSaveDTO
;
import
com.yaoyaozw.customer.dto.integration.IntegrationRequestDTO
;
import
com.yaoyaozw.customer.dto.integration.IntegrationRequestDTO
;
...
@@ -30,9 +33,11 @@ import com.yaoyaozw.customer.vo.referral.ReferralEntityVo;
...
@@ -30,9 +33,11 @@ import com.yaoyaozw.customer.vo.referral.ReferralEntityVo;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
java.util.List
;
import
java.util.List
;
...
@@ -211,6 +216,65 @@ public class CustomerGraphicsServiceImpl extends ServiceImpl<CustomerGraphicsMap
...
@@ -211,6 +216,65 @@ public class CustomerGraphicsServiceImpl extends ServiceImpl<CustomerGraphicsMap
return
new
BaseResult
().
error
(
"更新失败"
);
return
new
BaseResult
().
error
(
"更新失败"
);
}
}
@Override
@Async
(
"myExecutor"
)
public
void
batchSetPack
(
List
<
CustomerBatchSetPackDTO
>
batchSetPackList
)
{
if
(
CollectionUtil
.
isEmpty
(
batchSetPackList
))
{
LOCAL_LOG
.
error
(
"批量设置参数不能为空"
);
return
;
}
LOCAL_LOG
.
info
(
"开始批量设置人群包,总数量: {}"
,
batchSetPackList
.
size
());
// 收集所有客服消息ID
List
<
Long
>
customerMessageIds
=
batchSetPackList
.
stream
()
.
map
(
CustomerBatchSetPackDTO:
:
getCustomerMessageId
)
.
collect
(
Collectors
.
toList
());
// 先将所有相关客服消息状态设置为批量生成中(状态值:11)
CustomerGraphics
updateEntity
=
new
CustomerGraphics
();
updateEntity
.
setSendStatus
(
11
);
this
.
update
(
updateEntity
,
new
UpdateWrapper
<
CustomerGraphics
>().
in
(
"id"
,
customerMessageIds
));
LOCAL_LOG
.
info
(
"已将 {} 条客服消息状态设置为批量生成中"
,
customerMessageIds
.
size
());
// 收集执行完成的客服消息ID
List
<
Long
>
finishedIdList
=
new
ArrayList
<>();
try
{
// 遍历执行setPack方法
for
(
CustomerBatchSetPackDTO
dto
:
batchSetPackList
)
{
try
{
LOCAL_LOG
.
info
(
"正在处理客服消息ID: {}, 人群包ID: {}"
,
dto
.
getCustomerMessageId
(),
dto
.
getPackId
());
BaseResult
result
=
setPack
(
dto
.
getCustomerMessageId
(),
dto
.
getPackId
());
if
(
result
.
getSuccess
())
{
LOCAL_LOG
.
info
(
"客服消息ID: {} 设置人群包成功"
,
dto
.
getCustomerMessageId
());
}
else
{
LOCAL_LOG
.
error
(
"客服消息ID: {} 设置人群包失败: {}"
,
dto
.
getCustomerMessageId
(),
result
.
getMessage
());
}
finishedIdList
.
add
(
dto
.
getCustomerMessageId
());
TimeUnit
.
SECONDS
.
sleep
(
30
);
}
catch
(
Exception
e
)
{
LOCAL_LOG
.
error
(
"客服消息ID: {} 设置人群包异常"
,
dto
.
getCustomerMessageId
(),
e
);
}
}
}
catch
(
Exception
e
)
{
LOCAL_LOG
.
error
(
"批量设置人群包整体异常"
,
e
);
// 计算未执行成功的客服消息ID
List
<
Long
>
failedIdList
=
customerMessageIds
.
stream
()
.
filter
(
id
->
!
finishedIdList
.
contains
(
id
))
.
collect
(
Collectors
.
toList
());
if
(!
failedIdList
.
isEmpty
())
{
// 将未执行成功的客服消息状态设置为3(链接生成异常)
updateEntity
.
setSendStatus
(
3
);
this
.
update
(
updateEntity
,
new
UpdateWrapper
<
CustomerGraphics
>().
in
(
"id"
,
failedIdList
));
LOCAL_LOG
.
info
(
"已将 {} 条客服消息状态设置为链接生成异常"
,
failedIdList
.
size
());
}
}
LOCAL_LOG
.
info
(
"批量设置人群包完成,成功数量: {}, 总数量: {}"
,
finishedIdList
.
size
(),
batchSetPackList
.
size
());
}
/**
/**
* 发送客服消息
* 发送客服消息
* @param integrationRequestDTO 请求DTO
* @param integrationRequestDTO 请求DTO
...
...
src/main/resources/mapper/MaterialCrowdPackageMapper.xml
浏览文件 @
ef3aed86
...
@@ -54,4 +54,32 @@
...
@@ -54,4 +54,32 @@
follow_date_end = #{crowdPackage.followDateEnd}
follow_date_end = #{crowdPackage.followDateEnd}
where id = #{crowdPackage.id}
where id = #{crowdPackage.id}
</update>
</update>
<select
id=
"getByPackageNames"
resultType=
"com.yaoyaozw.customer.vo.crowd.CrowdPackageListVO"
>
select
cpm.id, cpm.package_name as packageName,
ifnull(cpm.crowd_num, 0) as numOfCrowdInPackage,
cpm.last_count_time as lastCountTime,
cpm.create_time as createTime, cpm.modified_time as modifiedTime,
cau.nick_name as createUser, mau.nick_name as modifiedUser,
group_concat(concat('【', mat.operator_description, '】')) as packageLabel
from crowd_package_main cpm
left join acl_user cau
on cpm.create_user = cau.id
left join acl_user mau
on cpm.modified_user = mau.id
left join crowd_package_condition_match mat
on cpm.id = mat.package_id
where cpm.package_name is not null
and cpm.package_name in
<foreach
collection=
"packageNames"
item=
"packageName"
open=
"("
separator=
","
close=
")"
>
#{packageName}
</foreach>
group by cpm.id
order by cpm.create_time desc
</select>
</mapper>
</mapper>
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论