Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
O
operate-customer-service
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
沈振路
operate-customer-service
Commits
896937a2
提交
896937a2
authored
5月 30, 2024
作者:
典文龙
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改权限校验
上级
c78a70c7
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
274 行增加
和
35 行删除
+274
-35
DistributeDTO.java
src/main/java/com/yaoyaozw/customer/dto/DistributeDTO.java
+21
-0
MaterialMenuConfig.java
...java/com/yaoyaozw/customer/entity/MaterialMenuConfig.java
+125
-0
MenuFeignClient.java
...in/java/com/yaoyaozw/customer/feigns/MenuFeignClient.java
+8
-0
AuthorizerTokenMapper.java
...a/com/yaoyaozw/customer/mapper/AuthorizerTokenMapper.java
+0
-8
MaterialMenuConfigMapper.java
...om/yaoyaozw/customer/mapper/MaterialMenuConfigMapper.java
+18
-0
MaterialMenuConfigService.java
.../yaoyaozw/customer/service/MaterialMenuConfigService.java
+22
-0
CustomerGraphicsDelayServiceImpl.java
...stomer/service/impl/CustomerGraphicsDelayServiceImpl.java
+2
-2
DistributeServiceImpl.java
...yaoyaozw/customer/service/impl/DistributeServiceImpl.java
+40
-9
MaterialMenuConfigServiceImpl.java
.../customer/service/impl/MaterialMenuConfigServiceImpl.java
+24
-0
AccountSetupVO.java
.../java/com/yaoyaozw/customer/vo/kanban/AccountSetupVO.java
+2
-1
AuthorizerTokenMapper.xml
src/main/resources/mapper/AuthorizerTokenMapper.xml
+0
-8
KanbanCommonMapper.xml
src/main/resources/mapper/KanbanCommonMapper.xml
+12
-7
没有找到文件。
src/main/java/com/yaoyaozw/customer/dto/DistributeDTO.java
浏览文件 @
896937a2
...
...
@@ -3,7 +3,9 @@ package com.yaoyaozw.customer.dto;
import
com.yaoyaozw.customer.vo.AuthInfoVO
;
import
lombok.Data
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* @Author: Dwl
...
...
@@ -19,4 +21,23 @@ public class DistributeDTO {
private
AuthInfoVO
sourceAuth
;
private
List
<
AuthInfoVO
>
targetAuthList
;
private
List
<
String
>
typeList
;
public
List
<
String
>
getAccountId
()
{
if
(!
this
.
targetAuthList
.
isEmpty
())
{
return
targetAuthList
.
stream
().
map
(
AuthInfoVO:
:
getAccountId
).
collect
(
Collectors
.
toList
());
}
return
null
;
}
public
List
<
AuthInfoVO
>
filterInfo
(
List
<
Long
>
channelIds
)
{
if
(!
this
.
targetAuthList
.
isEmpty
())
{
return
this
.
getTargetAuthList
().
stream
().
filter
(
item
->
channelIds
.
contains
(
Long
.
valueOf
(
item
.
getAccountId
()))).
collect
(
Collectors
.
toList
());
}
return
new
ArrayList
<>();
}
public
List
<
Long
>
getAuthIds
()
{
return
this
.
getTargetAuthList
().
stream
().
map
(
AuthInfoVO:
:
getId
).
collect
(
Collectors
.
toList
());
}
}
src/main/java/com/yaoyaozw/customer/entity/MaterialMenuConfig.java
0 → 100644
浏览文件 @
896937a2
package
com
.
yaoyaozw
.
customer
.
entity
;
import
com.baomidou.mybatisplus.annotation.*
;
import
lombok.Data
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.data.annotation.Id
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* @Author: Dwl
* @Date: 2024/05/30/11:14
* @ClassName: MaterialMenuConfigService
* @Version: V3.2.0
* @Description:
*/
@Data
@TableName
(
"material_menu_config"
)
public
class
MaterialMenuConfig
implements
Serializable
{
/**
*
*/
@Id
@TableId
(
value
=
"id"
,
type
=
IdType
.
ID_WORKER
)
private
Long
id
;
/**
* 公众号id
*/
@TableField
(
"auth_id"
)
private
Long
authId
;
/**
* appId
*/
@TableField
(
exist
=
false
)
private
String
appId
;
/**
* 配置名称
*/
@TableField
(
"config_name"
)
private
String
configName
;
/**
* 0-文本 1-图片 2-图文
*/
@TableField
(
"type"
)
private
Integer
type
;
/**
* 推广标题
*/
@TableField
(
"extend_title"
)
private
String
extendTitle
;
/**
* 图片地址
*/
@TableField
(
"img_url"
)
private
String
imgUrl
;
/**
* 文本内容【文本类型存H5代码】
*/
@TableField
(
"content"
)
private
String
content
;
/**
* 图文链接地址
*/
@TableField
(
"referral"
)
private
String
referral
;
/**
* 图片在公众号后台的地址
*/
@TableField
(
"media_id"
)
private
String
mediaId
;
/**
* 启用状态 0-启用 1-禁用
*/
@TableField
(
"status"
)
private
Integer
status
;
/**
* 逻辑删除
*/
@TableField
(
value
=
"is_deleted"
,
fill
=
FieldFill
.
INSERT
)
@TableLogic
private
Integer
isDeleted
;
/**
* 创建时间
*/
@TableField
(
value
=
"gmt_create"
,
fill
=
FieldFill
.
INSERT
)
private
Date
gmtCreate
;
/**
* 创建人
*/
@TableField
(
value
=
"gmt_create_user"
,
fill
=
FieldFill
.
INSERT
)
private
String
gmtCreateUser
;
/**
* 修改时间
*/
@TableField
(
value
=
"gmt_modified"
,
fill
=
FieldFill
.
INSERT_UPDATE
)
private
Date
gmtModified
;
/**
* 修改人
*/
@TableField
(
value
=
"gmt_modified_user"
,
fill
=
FieldFill
.
INSERT_UPDATE
)
private
String
gmtModifiedUser
;
public
String
getContent
()
{
if
(
StringUtils
.
isBlank
(
this
.
content
))
{
return
null
;
}
return
content
;
}
}
src/main/java/com/yaoyaozw/customer/feigns/MenuFeignClient.java
浏览文件 @
896937a2
package
com
.
yaoyaozw
.
customer
.
feigns
;
import
com.yaoyaozw.customer.annotations.AccountOperateControl
;
import
com.yaoyaozw.customer.common.BaseResult
;
import
com.yaoyaozw.customer.dto.MenuMainCopyDTO
;
import
com.yaoyaozw.customer.enums.AccountParamType
;
import
com.yaoyaozw.customer.enums.AccountTableColumnType
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestParam
;
/**
...
...
@@ -19,4 +24,7 @@ import org.springframework.web.bind.annotation.RequestBody;
public
interface
MenuFeignClient
{
@PostMapping
(
"/copy"
)
public
BaseResult
copy
(
@RequestBody
@Validated
MenuMainCopyDTO
menuMainCopyDTO
);
@GetMapping
(
"/removeMenu"
)
@AccountOperateControl
(
paramType
=
AccountParamType
.
ACCOUNT_PRIMARY
,
paramName
=
"appId"
,
columnType
=
AccountTableColumnType
.
APP_ID
)
public
BaseResult
removeMenu
(
@RequestParam
Long
id
,
@RequestParam
String
appId
);
}
src/main/java/com/yaoyaozw/customer/mapper/AuthorizerTokenMapper.java
浏览文件 @
896937a2
...
...
@@ -14,12 +14,4 @@ public interface AuthorizerTokenMapper extends BaseMapper<AuthorizerToken> {
AuthorizerToken
findByAppid
(
@Param
(
"appid"
)
String
appid
);
List
<
AuthorizerToken
>
findByAppidIn
(
@Param
(
"appidList"
)
Set
<
String
>
appidList
);
/**
* 查看权限等级
*
* @param userId
* @return
*/
Integer
getUserRoleLevel
(
@Param
(
"userId"
)
Long
userId
);
}
src/main/java/com/yaoyaozw/customer/mapper/MaterialMenuConfigMapper.java
0 → 100644
浏览文件 @
896937a2
package
com
.
yaoyaozw
.
customer
.
mapper
;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yaoyaozw.customer.entity.MaterialMenuConfig
;
import
org.springframework.stereotype.Repository
;
/**
* @Author: Dwl
* @Date: 2024/05/30/11:16
* @ClassName: MaterialMenuConfigMapper
* @Version: V3.2.0
* @Description:
*/
@DS
(
"material"
)
@Repository
public
interface
MaterialMenuConfigMapper
extends
BaseMapper
<
MaterialMenuConfig
>
{
}
src/main/java/com/yaoyaozw/customer/service/MaterialMenuConfigService.java
0 → 100644
浏览文件 @
896937a2
package
com
.
yaoyaozw
.
customer
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yaoyaozw.customer.entity.MaterialMenuConfig
;
import
java.util.List
;
/**
* @Author: Dwl
* @Date: 2024/05/30/11:14
* @ClassName: MaterialMenuConfigService
* @Version: V3.2.0
* @Description:
*/
public
interface
MaterialMenuConfigService
extends
IService
<
MaterialMenuConfig
>
{
/**
* 删除目标公众号配置
*
* @param authIds
*/
void
removeById
(
List
<
Long
>
authIds
);
}
src/main/java/com/yaoyaozw/customer/service/impl/CustomerGraphicsDelayServiceImpl.java
浏览文件 @
896937a2
...
...
@@ -328,7 +328,7 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
}
List
<
AuthInfoVO
>
authList
=
super
.
baseMapper
.
getAuthList
(
keyword
,
keywordList
,
storeType
,
appId
);
if
(
ObjectUtil
.
isNotNull
(
appId
))
{
/*
if (ObjectUtil.isNotNull(appId)) {
Long userId = tokenManager.getUserIdFromToken();
Integer userRoleLevel = authorizerTokenMapper.getUserRoleLevel(userId);
if (userRoleLevel <= 3) {
...
...
@@ -341,7 +341,7 @@ public class CustomerGraphicsDelayServiceImpl extends ServiceImpl<CustomerGraphi
authList = authList.stream().filter(item -> appIdList.contains(item.getAppId())).collect(Collectors.toList());
}
}
}
}
*/
Map
<
Object
,
Object
>
entries
=
redisTemplate
.
opsForHash
().
entries
(
STORE_NAME_REDIS_KEY
);
if
(
CollectionUtil
.
isNotEmpty
(
entries
))
{
Map
<
String
,
String
>
map
=
new
HashMap
<>(
entries
.
size
());
...
...
src/main/java/com/yaoyaozw/customer/service/impl/DistributeServiceImpl.java
浏览文件 @
896937a2
package
com
.
yaoyaozw
.
customer
.
service
.
impl
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.json.JSONUtil
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
...
...
@@ -14,20 +16,20 @@ import com.yaoyaozw.customer.dto.keyword.CustomerKeywordCopyDTO;
import
com.yaoyaozw.customer.entity.AccountDistributeRecord
;
import
com.yaoyaozw.customer.feigns.MenuFeignClient
;
import
com.yaoyaozw.customer.mapper.AccountDistributeLogMapper
;
import
com.yaoyaozw.customer.service.CustomerFollowReplyService
;
import
com.yaoyaozw.customer.service.CustomerGraphicsDelayService
;
import
com.yaoyaozw.customer.service.CustomerKeywordService
;
import
com.yaoyaozw.customer.service.DistributeService
;
import
com.yaoyaozw.customer.mapper.AuthorizerTokenMapper
;
import
com.yaoyaozw.customer.mapper.KanbanCommonMapper
;
import
com.yaoyaozw.customer.service.*
;
import
com.yaoyaozw.customer.vo.AccountDistributeLogVO
;
import
com.yaoyaozw.customer.vo.AuthInfoVO
;
import
com.yaoyaozw.customer.vo.kanban.AccountSetupVO
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
/**
* @Author: Dwl
...
...
@@ -53,6 +55,12 @@ public class DistributeServiceImpl extends ServiceImpl<AccountDistributeLogMappe
@Autowired
private
TokenManager
tokenManager
;
@Autowired
private
AuthorizerTokenMapper
authorizerTokenMapper
;
@Autowired
private
KanbanCommonMapper
kanbanCommonMapper
;
@Autowired
private
MaterialMenuConfigService
materialMenuConfigService
;
@Override
...
...
@@ -61,8 +69,33 @@ public class DistributeServiceImpl extends ServiceImpl<AccountDistributeLogMappe
List
<
AccountDistributeRecord
>
distributeLogList
=
new
ArrayList
<>();
log
.
info
(
"开始执行复用任务...."
);
AuthInfoVO
sourceAuth
=
distributeDTO
.
getSourceAuth
();
List
<
Long
>
channelIds
=
new
ArrayList
<>();
List
<
String
>
nickNameList
=
new
ArrayList
<>();
if
(
ObjectUtil
.
isNotNull
(
sourceAuth
.
getAppId
()))
{
List
<
AccountSetupVO
>
accountSetupVOList
=
kanbanCommonMapper
.
getRole
(
userId
,
distributeDTO
.
getAccountId
());
if
(
accountSetupVOList
.
isEmpty
())
{
return
new
BaseResult
().
error
(
"暂无权限"
);
}
channelIds
=
accountSetupVOList
.
stream
().
map
(
AccountSetupVO:
:
getChannelId
).
collect
(
Collectors
.
toList
());
nickNameList
=
accountSetupVOList
.
stream
().
map
(
AccountSetupVO:
:
getNickName
).
collect
(
Collectors
.
toList
());
}
myExecutorDistribute
(
channelIds
,
distributeDTO
,
userId
,
distributeLogList
,
sourceAuth
);
return
new
BaseResult
().
success
(
JSONUtil
.
toJsonStr
(
nickNameList
)
+
":复用进行中, 请等待"
);
}
@Async
(
"myExecutor"
)
public
void
myExecutorDistribute
(
List
<
Long
>
channelIds
,
DistributeDTO
distributeDTO
,
Long
userId
,
List
<
AccountDistributeRecord
>
distributeLogList
,
AuthInfoVO
sourceAuth
)
{
List
<
String
>
targetAppList
=
distributeDTO
.
getTargetAppList
();
List
<
AuthInfoVO
>
targetAuthList
=
distributeDTO
.
getTargetAuthList
();
//获取到当天再投的进行复用
List
<
AuthInfoVO
>
targetAuthList
=
distributeDTO
.
filterInfo
(
channelIds
);
for
(
AuthInfoVO
authInfoVO
:
targetAuthList
)
{
menuFeignClient
.
removeMenu
(
authInfoVO
.
getId
(),
authInfoVO
.
getAppId
());
}
//删除目标公众号配置
List
<
Long
>
authIds
=
distributeDTO
.
getAuthIds
();
materialMenuConfigService
.
removeById
(
authIds
);
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
();
...
...
@@ -103,15 +136,13 @@ public class DistributeServiceImpl extends ServiceImpl<AccountDistributeLogMappe
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
);
return
new
BaseResult
().
success
(
"复用进行中, 请等待"
);
super
.
saveBatch
(
distributeLogList
);
}
@Override
...
...
src/main/java/com/yaoyaozw/customer/service/impl/MaterialMenuConfigServiceImpl.java
0 → 100644
浏览文件 @
896937a2
package
com
.
yaoyaozw
.
customer
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yaoyaozw.customer.entity.MaterialMenuConfig
;
import
com.yaoyaozw.customer.mapper.MaterialMenuConfigMapper
;
import
com.yaoyaozw.customer.service.MaterialMenuConfigService
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
* @Author: Dwl
* @Date: 2024/05/30/11:14
* @ClassName: MaterialMenuConfigServiceImpl
* @Version: V3.2.0
* @Description:
*/
@Service
public
class
MaterialMenuConfigServiceImpl
extends
ServiceImpl
<
MaterialMenuConfigMapper
,
MaterialMenuConfig
>
implements
MaterialMenuConfigService
{
@Override
public
void
removeById
(
List
<
Long
>
authIds
)
{
this
.
baseMapper
.
deleteBatchIds
(
authIds
);
}
}
src/main/java/com/yaoyaozw/customer/vo/kanban/AccountSetupVO.java
浏览文件 @
896937a2
...
...
@@ -11,7 +11,8 @@ import lombok.Data;
*/
@Data
public
class
AccountSetupVO
{
private
Long
id
;
private
String
appId
;
private
Long
account
Id
;
private
Long
channel
Id
;
private
String
nickName
;
}
src/main/resources/mapper/AuthorizerTokenMapper.xml
浏览文件 @
896937a2
...
...
@@ -30,12 +30,4 @@
</foreach>
</select>
<select
id=
"getUserRoleLevel"
resultType=
"java.lang.Integer"
>
select max(role.role_level)
from acl_user_role aur
left join acl_role role
on aur.role_id = role.id
where aur.user_id = #{userId}
</select>
</mapper>
src/main/resources/mapper/KanbanCommonMapper.xml
浏览文件 @
896937a2
...
...
@@ -59,15 +59,20 @@
where is_deleted = 0 and pct_type = 'PROFIT_PCT'
</select>
<select
id=
"getRole"
resultType=
"com.yaoyaozw.customer.vo.kanban.AccountSetupVO"
>
SELECT ae.nick_name,
SELECT
ae.id,
ae.app_id,
acs.account_id,
acs.sales_user
FROM account_entity ae
LEFT JOIN account_cost_setup acs ON acs.account_id = ae.id
WHERE acs.cost_date = CURRENT_DATE
ae.nick_name,
ae.channel_id
FROM
account_entity ae
LEFT JOIN account_cost_setup acs on acs.account_id=ae.id
WHERE
acs.is_deleted=0
AND ae.is_deleted=0
AND acs.cost_date = CURRENT_DATE
AND acs.sales_user = #{userId}
AND a
cs.app_id in
AND a
e.channel_id IN
<foreach
collection=
"appIds"
item=
"appId"
open=
"("
close=
")"
separator=
","
>
#{appId}
</foreach>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论