Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiedao-api-boot-master
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lanbaoming
jiedao-api-boot-master
Commits
62f37383
Commit
62f37383
authored
Nov 16, 2024
by
zhengyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提供跟进列表数据权限接口供前端调用调试(后端数据权限查询业务待完善)
parent
32cd78e1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
101 additions
and
1 deletion
+101
-1
CustomerFollowupQueryVO.java
...customer/vo/customerFollowup/CustomerFollowupQueryVO.java
+5
-0
CustomerFollowupController.java
...er/admin/customerFollowup/CustomerFollowupController.java
+96
-1
No files found.
yudao-module-customer/yudao-module-customer-core/src/main/java/cn/iocoder/yudao/module/customer/vo/customerFollowup/CustomerFollowupQueryVO.java
View file @
62f37383
...
...
@@ -124,4 +124,9 @@ public class CustomerFollowupQueryVO extends PageParam {
@ApiModelProperty
(
value
=
"联系人电话"
)
private
String
contactPhone
;
@ApiModelProperty
(
value
=
"操作用户的所属权限部门ID列表"
)
private
List
<
Long
>
deptIdList
;
}
yudao-module-customer/yudao-module-customer-rest/src/main/java/cn/iocoder/yudao/module/customer/controller/admin/customerFollowup/CustomerFollowupController.java
View file @
62f37383
package
cn
.
iocoder
.
yudao
.
module
.
customer
.
controller
.
admin
.
customerFollowup
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.iocoder.yudao.framework.i18n.core.I18nMessage
;
import
cn.iocoder.yudao.framework.mybatis.core.vo.PageVO
;
import
cn.iocoder.yudao.framework.security.core.LoginUser
;
import
cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils
;
import
cn.iocoder.yudao.module.customer.dto.CustomerExportReqDTO
;
import
cn.iocoder.yudao.module.sale.vo.offer.OfferPageReqVO
;
import
cn.iocoder.yudao.module.system.api.file.FileMakeApi
;
import
cn.iocoder.yudao.module.system.api.file.dto.FileMakeReqDTO
;
import
cn.iocoder.yudao.module.system.api.permission.RoleApi
;
import
cn.iocoder.yudao.module.system.api.permission.dto.RoleRespDTO
;
import
cn.iocoder.yudao.module.system.enums.ErrorCodeConstants
;
import
cn.iocoder.yudao.module.system.enums.download.DownloadTypeEnum
;
import
cn.iocoder.yudao.module.system.enums.permission.DataScopeEnum
;
import
com.alibaba.fastjson.JSONObject
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
...
...
@@ -19,10 +27,14 @@ import java.util.*;
import
java.io.IOException
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.framework.common.pojo.CommonResult
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
exception
.
util
.
ServiceExceptionUtil
.
exception
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
pojo
.
CommonResult
.
success
;
import
cn.iocoder.yudao.framework.excel.util.ExcelUtils
;
import
cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
operatelog
.
core
.
enums
.
OperateTypeEnum
.*;
import
static
cn
.
iocoder
.
yudao
.
module
.
system
.
enums
.
ErrorCodeConstants
.
ROLE_NOT_EXISTS
;
import
cn.iocoder.yudao.module.customer.vo.customerFollowup.*
;
import
cn.iocoder.yudao.module.customer.dal.dataobject.customerFollowup.CustomerFollowupDO
;
import
cn.iocoder.yudao.module.customer.convert.customerFollowup.CustomerFollowupConvert
;
...
...
@@ -37,7 +49,8 @@ public class CustomerFollowupController {
@Resource
private
CustomerFollowupService
followupService
;
@Resource
private
RoleApi
roleApi
;
@Resource
private
FileMakeApi
fileMakeApi
;
...
...
@@ -110,6 +123,48 @@ public class CustomerFollowupController {
return
success
(
CustomerFollowupConvert
.
INSTANCE
.
convertPage
(
pageResult
));
}
@GetMapping
(
"/data/space/page"
)
@ApiOperation
(
"数据权限获得客户跟进分页"
)
// @PreAuthorize("@ss.hasPermission('customer:followup:query')")
public
CommonResult
<
PageResult
<
CustomerFollowupBackVO
>>
getDataSpaceFollowupPage
(
@Valid
CustomerFollowupQueryVO
query
,
PageVO
page
)
{
if
(
Objects
.
isNull
(
query
))
{
query
=
new
CustomerFollowupQueryVO
();
}
LoginUser
loginUser
=
SecurityFrameworkUtils
.
getLoginUser
();
if
(
Objects
.
isNull
(
loginUser
)){
throw
exception
(
ErrorCodeConstants
.
USER_NOT_EXISTS
);
}
List
<
RoleRespDTO
>
roleRespDTOS
=
roleApi
.
getRoles
(
loginUser
.
getRoleIds
());
if
(
Objects
.
isNull
(
roleRespDTOS
)){
throw
exception
(
ROLE_NOT_EXISTS
);
}
addDataScopeQuery
(
query
,
loginUser
,
roleRespDTOS
);
PageResult
<
CustomerFollowupDO
>
pageResult
=
followupService
.
getFollowupPage
(
query
,
page
);
return
success
(
CustomerFollowupConvert
.
INSTANCE
.
convertPage
(
pageResult
));
}
@GetMapping
(
"/data/space/export-excel"
)
@ApiOperation
(
"数据权限导出客户跟进 Excel"
)
@OperateLog
(
type
=
EXPORT
)
public
CommonResult
<
Boolean
>
exportDataSpaceFollowupExcel
(
@Valid
CustomerFollowupQueryVO
query
,
HttpServletResponse
response
)
throws
IOException
{
if
(
Objects
.
isNull
(
query
))
{
query
=
new
CustomerFollowupQueryVO
();
}
LoginUser
loginUser
=
SecurityFrameworkUtils
.
getLoginUser
();
if
(
Objects
.
isNull
(
loginUser
)){
throw
exception
(
ErrorCodeConstants
.
USER_NOT_EXISTS
);
}
List
<
RoleRespDTO
>
roleRespDTOS
=
roleApi
.
getRoles
(
loginUser
.
getRoleIds
());
if
(
Objects
.
isNull
(
roleRespDTOS
)){
throw
exception
(
ROLE_NOT_EXISTS
);
}
addDataScopeQuery
(
query
,
loginUser
,
roleRespDTOS
);
sendFileMake
(
query
,
DownloadTypeEnum
.
CUSTOMER_FOLLOWUP_EXPORT
,
"跟进纪录导出Excel"
);
return
success
(
true
);
}
@GetMapping
(
"/export-excel"
)
@ApiOperation
(
"导出客户跟进 Excel"
)
// @PreAuthorize("@ss.hasPermission('customer:followup:export')")
...
...
@@ -140,4 +195,44 @@ public class CustomerFollowupController {
}
private
static
void
addDataScopeQuery
(
CustomerFollowupQueryVO
query
,
LoginUser
loginUser
,
List
<
RoleRespDTO
>
roleRespDTOS
)
{
List
<
Long
>
deptIdList
=
new
ArrayList
<>();
boolean
isAll
=
Boolean
.
FALSE
;
for
(
RoleRespDTO
roleRespDTO
:
roleRespDTOS
)
{
DataScopeEnum
dataScopeEnum
=
DataScopeEnum
.
valueOf
(
roleRespDTO
.
getDataScope
());
switch
(
dataScopeEnum
){
case
ALL:
// 全部数据权限,不限制
isAll
=
Boolean
.
TRUE
;
break
;
case
DEPT_CUSTOM:
// 指定部门数据权限
if
(
CollectionUtil
.
isNotEmpty
(
roleRespDTO
.
getDataScopeDeptIds
()))
{
deptIdList
.
addAll
(
roleRespDTO
.
getDataScopeDeptIds
());
}
break
;
case
DEPT_ONLY:
// 部门数据权限
if
(
Objects
.
nonNull
(
loginUser
.
getDeptId
()))
{
deptIdList
.
add
(
loginUser
.
getDeptId
());
}
break
;
case
DEPT_AND_CHILD:
// 部门及以下数据权限
deptIdList
.
add
(
loginUser
.
getDeptId
());
break
;
}
}
if
(!
isAll
){
// 非全部数据权限时查询限制条件
if
(
CollectionUtil
.
isEmpty
(
deptIdList
)
||
deptIdList
.
size
()
==
0
){
// 没有部门限制条件时,只查询当前用户自己的
query
.
setFollowUserId
(
String
.
valueOf
(
loginUser
.
getId
()));
}
else
{
// 查询限定部门的数据
query
.
setDeptIdList
(
deptIdList
);
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment