Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
O
operate-customer-service
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
沈振路
operate-customer-service
Commits
5f4c729b
提交
5f4c729b
authored
3月 28, 2024
作者:
典文龙
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
分发复用
上级
31eca3f3
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
99 行增加
和
54 行删除
+99
-54
DistributeController.java
...om/yaoyaozw/customer/controller/DistributeController.java
+3
-3
ConditionDTO.java
src/main/java/com/yaoyaozw/customer/dto/ConditionDTO.java
+2
-4
MenuMainCopyDTO.java
src/main/java/com/yaoyaozw/customer/dto/MenuMainCopyDTO.java
+4
-4
AccountDistributeRecord.java
...com/yaoyaozw/customer/entity/AccountDistributeRecord.java
+45
-11
AccountDistributeLogMapper.java
.../yaoyaozw/customer/mapper/AccountDistributeLogMapper.java
+4
-1
DistributeService.java
...java/com/yaoyaozw/customer/service/DistributeService.java
+2
-1
DistributeServiceImpl.java
...yaoyaozw/customer/service/impl/DistributeServiceImpl.java
+29
-20
AccountDistributeLogVO.java
...java/com/yaoyaozw/customer/vo/AccountDistributeLogVO.java
+1
-1
AccountDistributeLogMapper.xml
src/main/resources/mapper/AccountDistributeLogMapper.xml
+9
-9
没有找到文件。
src/main/java/com/yaoyaozw/customer/controller/DistributeController.java
浏览文件 @
5f4c729b
package
com
.
yaoyaozw
.
customer
.
controller
;
import
com.github.pagehelper.PageInfo
;
import
com.yaoyaozw.customer.common.BaseResult
;
import
com.yaoyaozw.customer.common.GenericsResult
;
import
com.yaoyaozw.customer.dto.ConditionDTO
;
...
...
@@ -13,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestBody;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
* @Author: Dwl
...
...
@@ -35,7 +35,7 @@ public class DistributeController {
}
@PostMapping
(
"/logList"
)
public
GenericsResult
<
List
<
AccountDistributeLogVO
>>
getList
(
)
{
return
distributeService
.
logList
();
public
GenericsResult
<
PageInfo
<
AccountDistributeLogVO
>>
getList
(
@RequestBody
ConditionDTO
conditionDTO
)
{
return
distributeService
.
logList
(
conditionDTO
);
}
}
src/main/java/com/yaoyaozw/customer/dto/ConditionDTO.java
浏览文件 @
5f4c729b
package
com
.
yaoyaozw
.
customer
.
dto
;
import
com.yaoyaozw.customer.common.PageParams
;
import
lombok.Data
;
/**
...
...
@@ -10,8 +11,5 @@ import lombok.Data;
* @Description:
*/
@Data
public
class
ConditionDTO
{
private
Integer
currentPage
;
private
Integer
pageSize
;
public
class
ConditionDTO
extends
PageParams
{
}
src/main/java/com/yaoyaozw/customer/dto/MenuMainCopyDTO.java
浏览文件 @
5f4c729b
...
...
@@ -5,7 +5,7 @@ import lombok.Data;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
import
java.util.
ArrayList
;
import
java.util.
Collections
;
import
java.util.List
;
/**
...
...
@@ -31,13 +31,13 @@ public class MenuMainCopyDTO implements Serializable {
@ApiModelProperty
(
"要进行复用的菜单ID"
)
private
List
<
Integer
>
sourceMenuSortList
;
public
void
addList
(
Long
authId
,
List
<
Long
>
targetAuthList
)
{
this
.
authId
=
authId
;
this
.
openImmediately
=
1
;
this
.
targetAuthList
=
targetAuthList
;
List
<
Integer
>
sortList
=
new
ArrayList
<>();
sortList
.
add
(
1
);
this
.
sourceMenuSortList
=
sortList
;
this
.
sourceMenuSortList
=
Collections
.
singletonList
(
1
);
}
}
src/main/java/com/yaoyaozw/customer/entity/AccountDistributeRecord.java
浏览文件 @
5f4c729b
package
com
.
yaoyaozw
.
customer
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.annotation.*
;
import
lombok.Data
;
import
org.springframework.data.annotation.Id
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.concurrent.atomic.AtomicReference
;
/**
* @Author: Dwl
...
...
@@ -19,8 +18,7 @@ import java.util.Date;
@Data
@TableName
(
"account_distribute_record"
)
public
class
AccountDistributeRecord
implements
Serializable
{
@Id
@TableId
(
"id"
)
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Long
id
;
/**
* 原公众号id
...
...
@@ -28,8 +26,8 @@ public class AccountDistributeRecord implements Serializable {
@TableField
(
"auth_id"
)
private
Long
authId
;
@TableField
(
"target_id"
)
private
Long
targetId
;
@TableField
(
"target_
auth_
id"
)
private
Long
target
Auth
Id
;
/**
* 分发的菜单名称
*/
...
...
@@ -38,16 +36,52 @@ public class AccountDistributeRecord implements Serializable {
/**
* 创建时间
*/
@TableField
(
"gmt_create"
)
@TableField
(
value
=
"gmt_create"
,
fill
=
FieldFill
.
INSERT
)
private
Date
gmtCreate
;
@TableField
(
"create_user"
)
@TableField
(
value
=
"create_user"
,
fill
=
FieldFill
.
INSERT
)
private
Long
createUser
;
/**
* 更新时间
*/
@TableField
(
"gmt_modified"
)
@TableField
(
value
=
"gmt_modified"
,
fill
=
FieldFill
.
INSERT_UPDATE
)
private
Date
gmtModified
;
private
static
final
long
serialVersionUID
=
1L
;
public
void
saveDistribute
(
Long
authId
,
Long
targetId
,
List
<
String
>
functionName
,
Long
createUser
)
{
this
.
authId
=
authId
;
this
.
targetAuthId
=
targetId
;
this
.
functionName
=
groupName
(
functionName
);
this
.
createUser
=
createUser
;
this
.
gmtCreate
=
new
Date
();
this
.
gmtModified
=
new
Date
();
}
private
String
groupName
(
List
<
String
>
functionName
)
{
String
name
=
""
;
for
(
String
s
:
functionName
)
{
switch
(
s
)
{
case
"1"
:
name
+=
"关回, "
;
break
;
case
"2"
:
name
+=
"关键词, "
;
break
;
case
"3"
:
name
+=
"延时客服, "
;
break
;
case
"4"
:
name
+=
"菜单管理, "
;
break
;
default
:
break
;
}
}
if
(!
name
.
isEmpty
())
{
name
=
name
.
substring
(
0
,
name
.
length
()
-
2
);
}
return
name
;
}
}
src/main/java/com/yaoyaozw/customer/mapper/AccountDistributeLogMapper.java
浏览文件 @
5f4c729b
...
...
@@ -2,8 +2,10 @@ package com.yaoyaozw.customer.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yaoyaozw.customer.common.GenericsResult
;
import
com.yaoyaozw.customer.dto.ConditionDTO
;
import
com.yaoyaozw.customer.entity.AccountDistributeRecord
;
import
com.yaoyaozw.customer.vo.AccountDistributeLogVO
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
...
...
@@ -17,5 +19,6 @@ import java.util.List;
*/
@Repository
public
interface
AccountDistributeLogMapper
extends
BaseMapper
<
AccountDistributeRecord
>
{
GenericsResult
<
List
<
AccountDistributeLogVO
>>
selectLogList
();
List
<
AccountDistributeLogVO
>
selectLogList
(
@Param
(
"conditionDTO"
)
ConditionDTO
conditionDTO
);
}
src/main/java/com/yaoyaozw/customer/service/DistributeService.java
浏览文件 @
5f4c729b
package
com
.
yaoyaozw
.
customer
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.github.pagehelper.PageInfo
;
import
com.yaoyaozw.customer.common.BaseResult
;
import
com.yaoyaozw.customer.common.GenericsResult
;
import
com.yaoyaozw.customer.dto.ConditionDTO
;
...
...
@@ -20,5 +21,5 @@ import java.util.List;
public
interface
DistributeService
extends
IService
<
AccountDistributeRecord
>
{
BaseResult
distribute
(
DistributeDTO
distributeDTO
);
GenericsResult
<
List
<
AccountDistributeLogVO
>>
logList
(
);
GenericsResult
<
PageInfo
<
AccountDistributeLogVO
>>
logList
(
ConditionDTO
conditionDTO
);
}
src/main/java/com/yaoyaozw/customer/service/impl/DistributeServiceImpl.java
浏览文件 @
5f4c729b
package
com
.
yaoyaozw
.
customer
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.yaoyaozw.customer.common.BaseResult
;
import
com.yaoyaozw.customer.common.GenericsResult
;
import
com.yaoyaozw.customer.components.TokenManager
;
import
com.yaoyaozw.customer.dto.ConditionDTO
;
import
com.yaoyaozw.customer.dto.DistributeDTO
;
import
com.yaoyaozw.customer.dto.MenuMainCopyDTO
;
import
com.yaoyaozw.customer.dto.follow.FollowReplyCopyDTO
;
...
...
@@ -21,9 +25,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
/**
* @Author: Dwl
...
...
@@ -47,69 +51,74 @@ public class DistributeServiceImpl extends ServiceImpl<AccountDistributeLogMappe
@Autowired
private
MenuFeignClient
menuFeignClient
;
@Autowired
private
TokenManager
tokenManager
;
@Override
public
BaseResult
distribute
(
DistributeDTO
distributeDTO
)
{
Long
userId
=
tokenManager
.
getUserIdFromToken
();
List
<
AccountDistributeRecord
>
distributeLogList
=
new
ArrayList
<>();
log
.
info
(
"开始执行复用任务...."
);
AuthInfoVO
sourceAuth
=
distributeDTO
.
getSourceAuth
();
List
<
String
>
targetAppList
=
distributeDTO
.
getTargetAppList
();
List
<
AuthInfoVO
>
targetAuthList
=
distributeDTO
.
getTargetAuthList
();
List
<
String
>
targetApp
=
targetAuthList
.
stream
().
map
(
AuthInfoVO:
:
getAppId
).
collect
(
Collectors
.
toList
());
List
<
Long
>
idList
=
targetAuthList
.
stream
().
map
(
AuthInfoVO:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
String
>
typeList
=
distributeDTO
.
getTypeList
();
idList
.
stream
().
forEach
(
c
->
{
AccountDistributeRecord
distributeLog
=
new
AccountDistributeRecord
();
distributeLog
.
setAuthId
(
distributeLog
.
getAuthId
());
distributeLog
.
setGmtCreate
(
new
Date
());
distributeLog
.
setGmtModified
(
new
Date
());
distributeLog
.
setTargetId
(
c
.
longValue
());
try
{
for
(
String
type
:
typeList
)
{
// 根据 type 的值执行不同的操作
switch
(
type
)
{
case
"1"
:
//关回复用
distributeLog
.
setFunctionName
(
"1"
);
FollowReplyCopyDTO
followReplyCopyDTO
=
new
FollowReplyCopyDTO
();
followReplyCopyDTO
.
setTargetAuthList
(
targetAuthList
);
followReplyCopyDTO
.
setSourceAuth
(
sourceAuth
);
//
followReplyService.copy(followReplyCopyDTO);
followReplyService
.
copy
(
followReplyCopyDTO
);
break
;
case
"2"
:
//关键词复用
distributeLog
.
setFunctionName
(
"2"
);
CustomerKeywordCopyDTO
customerKeywordCopyDTO
=
new
CustomerKeywordCopyDTO
();
customerKeywordCopyDTO
.
setSourceAuth
(
sourceAuth
);
customerKeywordCopyDTO
.
setTargetKeywordList
(
targetAppList
);
customerKeywordCopyDTO
.
setTargetAuthList
(
targetAuthList
);
//
keywordService.copy(customerKeywordCopyDTO);
keywordService
.
copy
(
customerKeywordCopyDTO
);
break
;
case
"3"
:
//延时客服复用
distributeLog
.
setFunctionName
(
"3"
);
//customerGraphicsDelayService.copy(distributeDTO.getAppId(), "", "", null, targetAppList);
customerGraphicsDelayService
.
copy
(
sourceAuth
.
getAppId
(),
""
,
""
,
null
,
targetApp
);
break
;
case
"4"
:
//菜单管理复用
distributeLog
.
setFunctionName
(
"4"
);
MenuMainCopyDTO
menuMainCopyDTO
=
new
MenuMainCopyDTO
();
menuMainCopyDTO
.
addList
(
sourceAuth
.
getId
(),
idList
);
//
menuFeignClient.copy(menuMainCopyDTO);
menuFeignClient
.
copy
(
menuMainCopyDTO
);
break
;
default
:
break
;
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
"Distribution reuse exception:{}"
,
e
.
getMessage
(),
e
);
}
idList
.
forEach
(
c
->
{
AccountDistributeRecord
distributeLog
=
new
AccountDistributeRecord
();
distributeLog
.
saveDistribute
(
sourceAuth
.
getId
(),
c
,
typeList
,
userId
);
distributeLogList
.
add
(
distributeLog
);
});
this
.
saveBatch
(
distributeLogList
);
this
.
saveBatch
(
distributeLogList
);
return
new
BaseResult
().
success
(
"复用进行中, 请等待"
);
}
@Override
public
GenericsResult
<
List
<
AccountDistributeLogVO
>>
logList
()
{
return
this
.
baseMapper
.
selectLogList
();
public
GenericsResult
<
PageInfo
<
AccountDistributeLogVO
>>
logList
(
ConditionDTO
conditionDTO
)
{
PageHelper
.
startPage
(
conditionDTO
.
getCurrentPage
(),
conditionDTO
.
getPageSize
());
List
<
AccountDistributeLogVO
>
accountDistributeLogVOList
=
this
.
baseMapper
.
selectLogList
(
conditionDTO
);
PageInfo
<
AccountDistributeLogVO
>
pageInfoList
=
new
PageInfo
<>(
accountDistributeLogVOList
);
return
new
GenericsResult
<>(
pageInfoList
);
}
}
src/main/java/com/yaoyaozw/customer/vo/AccountDistributeLogVO.java
浏览文件 @
5f4c729b
...
...
@@ -17,6 +17,6 @@ public class AccountDistributeLogVO {
private
String
targetName
;
private
String
functionName
;
private
Date
gmtCreate
;
private
String
userName
;
private
Date
gmtModified
;
private
String
userName
;
}
src/main/resources/mapper/AccountDistributeLogMapper.xml
浏览文件 @
5f4c729b
...
...
@@ -2,16 +2,16 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.yaoyaozw.customer.mapper.AccountDistributeLogMapper"
>
<select
id=
"selectLogList"
resultType=
"java.util.List"
>
SELECT ai.nick_name AS nickName,
ai.nick_name AS targetName,
<select
id=
"selectLogList"
resultType=
"com.yaoyaozw.customer.vo.AccountDistributeLogVO"
>
SELECT a.nick_name AS nickName,
ai.nick_name AS targetName,
adr.function_name AS functionName,
adr.gmt_create AS gmtCreate,
adr.gmt_modified AS gmtModified
adr.gmt_create AS gmtCreate,
adr.gmt_modified AS gmtModified,
au.nick_name AS userName
FROM account_distribute_record adr
LEFT JOIN authorizer_info ai ON ai.id = adr.auth_id
LEFT JOIN authorizer_info ai ON ai.id = adr.
target_
auth_id
LEFT JOIN authorizer_info a ON a.id = adr.auth_id
LEFT JOIN acl_user au ON adr.create_user = au.id
</select>
</mapper>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论