Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
fangxinjiang
yifu-mvp
Commits
5170cc4d
Commit
5170cc4d
authored
Oct 26, 2022
by
hongguangwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
授权
parent
a017dd5e
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
227 additions
and
469 deletions
+227
-469
TCutsomerDataPermisson.java
.../plus/v1/yifu/archives/entity/TCutsomerDataPermisson.java
+66
-95
TCutsomerDataPermissonController.java
...archives/controller/TCutsomerDataPermissonController.java
+27
-22
TCutsomerDataPermissonMapper.java
...v1/yifu/archives/mapper/TCutsomerDataPermissonMapper.java
+5
-15
TCutsomerDataPermissonService.java
.../yifu/archives/service/TCutsomerDataPermissonService.java
+11
-46
TCutsomerDataPermissonServiceImpl.java
...hives/service/impl/TCutsomerDataPermissonServiceImpl.java
+17
-139
TSettleDomainServiceImpl.java
.../yifu/archives/service/impl/TSettleDomainServiceImpl.java
+23
-18
TCutsomerDataPermissonMapper.xml
...rc/main/resources/mapper/TCutsomerDataPermissonMapper.xml
+52
-125
UpmsDaprUtils.java
...fu/cloud/plus/v1/yifu/common/dapr/util/UpmsDaprUtils.java
+3
-2
SysUserListVo.java
...m/yifu.cloud.plus.v1/yifu/admin/api/vo/SysUserListVo.java
+19
-0
UserController.java
...u.cloud.plus.v1/yifu/admin/controller/UserController.java
+4
-7
No files found.
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/entity/TCutsomerDataPermisson.java
View file @
5170cc4d
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
com.alibaba.excel.annotation.ExcelIgnore
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.excel.annotation.write.style.HeadFontStyle
;
import
com.baomidou.mybatisplus.annotation.*
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
org.hibernate.validator.constraints.Length
;
import
javax.validation.constraints.NotBlank
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
/**
...
...
@@ -21,106 +21,77 @@ import java.time.LocalDateTime;
* @date 2019-07-19 16:22:22
*/
@Data
@AllArgsConstructor
@EqualsAndHashCode
(
callSuper
=
true
)
@TableName
(
"t_cutsomer_data_permisson"
)
@Schema
(
description
=
"客户数据权限表"
)
public
class
TCutsomerDataPermisson
extends
Model
<
TCutsomerDataPermisson
>
{
public
class
TCutsomerDataPermisson
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 主键
*/
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
@Schema
(
description
=
"主键"
,
name
=
"id"
)
private
String
id
;
/**
* 是否是数据所有者(0是1否)
*/
@NotBlank
(
message
=
"是否是数据所有者(0是1否)不能为空"
)
@Length
(
max
=
1
,
message
=
"是否是数据所有者(0是1否)不能超过1个字符"
)
@ExcelAttribute
(
name
=
"是否是数据所有者(0是1否)"
,
isNotEmpty
=
true
,
errorInfo
=
"是否是数据所有者(0是1否)不能为空"
,
maxLength
=
1
)
@Schema
(
description
=
"是否是数据所有者(0是1否)"
,
name
=
"isOwner"
)
private
String
isOwner
;
/**
* 客户id
*/
@Length
(
max
=
32
,
message
=
"客户id不能超过32个字符"
)
@ExcelAttribute
(
name
=
"客户id"
,
maxLength
=
32
)
@Schema
(
description
=
"客户id"
,
name
=
"customerId"
)
private
String
customerId
;
/**
* 合同主体id
*/
@Length
(
max
=
32
,
message
=
"合同主体id不能超过32个字符"
)
@ExcelAttribute
(
name
=
"合同主体id"
,
maxLength
=
32
)
@Schema
(
description
=
"合同主体id"
,
name
=
"contractId"
)
private
String
contractId
;
/**
* 项目id
*/
@Length
(
max
=
32
,
message
=
"项目id不能超过32个字符"
)
@ExcelAttribute
(
name
=
"项目id"
,
maxLength
=
32
)
@Schema
(
description
=
"项目id"
,
name
=
"settleDomainId"
)
private
String
settleDomainId
;
/**
* 授权来源
*/
@NotBlank
(
message
=
"授权来源不能为空"
)
@Length
(
max
=
50
,
message
=
"授权来源不能超过50个字符"
)
@ExcelAttribute
(
name
=
"授权来源"
,
isNotEmpty
=
true
,
errorInfo
=
"授权来源不能为空"
,
maxLength
=
50
)
@Schema
(
description
=
"授权来源"
,
name
=
"permissonSrc"
)
private
String
permissonSrc
;
/**
* 授权等级
*/
@NotBlank
(
message
=
"授权等级不能为空"
)
@ExcelAttribute
(
name
=
"授权等级"
,
isNotEmpty
=
true
,
errorInfo
=
"授权等级不能为空"
)
@Schema
(
description
=
"授权等级"
,
name
=
"permissonLevel"
)
private
Integer
permissonLevel
;
/**
* 授权人
*/
@NotBlank
(
message
=
"授权人不能为空"
)
@Length
(
max
=
32
,
message
=
"授权人不能超过32个字符"
)
@Schema
(
description
=
"授权人"
,
name
=
"permissionUser"
)
private
String
permissionUser
;
/**
* 被授权人
*/
@Length
(
max
=
1
,
message
=
"状态不能超过1个字符"
)
@ExcelAttribute
(
name
=
"状态"
,
maxLength
=
1
)
@Schema
(
description
=
"状态0启用1禁用"
)
private
String
status
;
@Length
(
max
=
32
,
message
=
"备注不能超过32个字符"
)
@ExcelAttribute
(
name
=
"备注"
,
maxLength
=
32
)
@Schema
(
description
=
"备注"
)
private
String
remark
;
@Length
(
max
=
32
,
message
=
"项目id不能超过32个字符"
)
@ExcelAttribute
(
name
=
"项目id"
,
maxLength
=
32
)
@Schema
(
description
=
"项目id"
)
private
String
settleDomainId
;
@Length
(
max
=
50
,
message
=
"项目名称不能超过50个字符"
)
@ExcelAttribute
(
name
=
"项目名称"
,
maxLength
=
50
)
@Schema
(
description
=
"项目名称"
)
private
String
settleDomainName
;
@Length
(
max
=
32
,
message
=
"项目编码不能超过32个字符"
)
@ExcelAttribute
(
name
=
"项目编码"
,
maxLength
=
32
)
@Schema
(
description
=
"项目编码"
)
private
String
settleDomainNo
;
@Schema
(
description
=
"创建人-姓名"
)
@TableField
(
fill
=
FieldFill
.
INSERT
)
@HeadFontStyle
(
fontHeightInPoints
=
11
)
@ExcelProperty
(
"创建人"
)
private
String
createName
;
@Schema
(
description
=
"创建人"
)
@TableField
(
fill
=
FieldFill
.
INSERT
)
@ExcelIgnore
private
String
createBy
;
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@Schema
(
description
=
"创建时间"
)
@TableField
(
fill
=
FieldFill
.
INSERT
)
@HeadFontStyle
(
fontHeightInPoints
=
11
)
@ExcelProperty
(
"创建时间"
)
private
LocalDateTime
createTime
;
@NotBlank
(
message
=
"被授权人不能为空"
)
@Length
(
max
=
32
,
message
=
"被授权人不能超过32个字符"
)
@ExcelAttribute
(
name
=
"被授权人"
,
isNotEmpty
=
true
,
errorInfo
=
"被授权人不能为空"
,
maxLength
=
32
)
@Schema
(
description
=
"被授权人"
,
name
=
"bePermissonUser"
)
private
String
bePermissonUser
;
/**
* 被授权时间
*/
@NotBlank
(
message
=
"被授权时间不能为空"
)
@ExcelAttribute
(
name
=
"被授权时间"
,
isNotEmpty
=
true
,
errorInfo
=
"被授权时间不能为空"
)
@Schema
(
description
=
"被授权时间"
,
name
=
"bePermissionTime"
)
private
LocalDateTime
bePermissionTime
;
/**
* 备注
*/
@Length
(
max
=
50
,
message
=
"备注不能超过50个字符"
)
@ExcelAttribute
(
name
=
"备注"
,
maxLength
=
50
)
@Schema
(
description
=
"备注"
,
name
=
"remark"
)
private
String
remark
;
@Schema
(
description
=
"被授权人"
)
private
String
userId
;
@ExcelAttribute
(
name
=
"登录名"
,
maxLength
=
50
)
@Schema
(
description
=
"登录名"
)
private
String
userLoginName
;
@ExcelAttribute
(
name
=
"用户名称"
,
maxLength
=
50
)
@Schema
(
description
=
"用户名称(汉字)"
)
private
String
userNickName
;
@Length
(
max
=
1
,
message
=
"是否是客服不能超过1个字符"
)
@Schema
(
description
=
"
是否是客服(0是1否)"
,
name
=
"isCustomerService
"
)
private
String
isCustomerServic
e
;
@ExcelAttribute
(
name
=
"所在部门"
,
maxLength
=
50
)
@Schema
(
description
=
"
所在部门
"
)
private
String
userDeptNam
e
;
@Schema
(
description
=
"类型0:客户1:合同2:项目"
,
name
=
"type"
)
@ExcelIgnore
@Schema
(
description
=
"授权来源0ekp,1mvp,2mvp复制"
,
name
=
"type"
)
private
String
type
;
/**
* 无参构造方法
* @Author pwang
* @Date 2019-11-15 12:12
* @param
* @return
**/
public
TCutsomerDataPermisson
(){
}
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/controller/TCutsomerDataPermissonController.java
View file @
5170cc4d
...
...
@@ -6,9 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TCutsomerDataPermisson
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.TCutsomerDataPermissonService
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.TSettleDomainService
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.TCutsomerDataPermissonVo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
...
...
@@ -20,6 +18,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Arrays
;
import
java.util.List
;
/**
...
...
@@ -45,9 +44,21 @@ public class TCutsomerDataPermissonController {
*/
@Operation
(
description
=
"简单分页查询"
)
@GetMapping
(
"/page"
)
public
R
<
IPage
<
TCutsomerDataPermisson
Vo
>>
getTCutsomerDataPermissonPage
(
Page
<
TCutsomerDataPermissonVo
>
page
,
TCutsomerDataPermissonVo
tCutsomerDataPermisson
)
{
public
R
<
IPage
<
TCutsomerDataPermisson
>>
getTCutsomerDataPermissonPage
(
Page
<
TCutsomerDataPermisson
>
page
,
TCutsomerDataPermisson
tCutsomerDataPermisson
)
{
return
new
R
<>(
tCutsomerDataPermissonService
.
getTCutsomerDataPermissonPage
(
page
,
tCutsomerDataPermisson
));
}
/**
* 导出list
* @param tCutsomerDataPermisson 客户数据权限表
* @return
*/
@Operation
(
description
=
"导出的list"
)
@GetMapping
(
"/getList"
)
public
R
<
List
<
TCutsomerDataPermisson
>>
getTCutsomerDataPermissonList
(
TCutsomerDataPermisson
tCutsomerDataPermisson
)
{
return
new
R
<>(
tCutsomerDataPermissonService
.
getTCutsomerDataPermissonList
(
tCutsomerDataPermisson
));
}
/**
* @Author fxj
* @Description 获取实体的权限: type-类型0:客户1:合同2:项目(不传默认2项目)
...
...
@@ -55,21 +66,11 @@ public class TCutsomerDataPermissonController {
* @Param
* @return
**/
@Operation
(
description
=
"获取实体的权限:
type-类型0:客户1:合同2:项目(不传默认2项目)
"
)
@Operation
(
description
=
"获取实体的权限:
默认项目
"
)
@GetMapping
(
"/getPermissonByTypeAndId"
)
public
R
<
IPage
<
TCutsomerDataPermisson
>>
getTCutsomerDataPermissonByTypeAndId
(
String
id
,
String
type
)
{
if
(
Common
.
isEmpty
(
id
)){
return
R
.
failed
(
"实体id"
);
}
public
R
<
IPage
<
TCutsomerDataPermisson
>>
getTCutsomerDataPermissonByTypeAndId
(
@RequestParam
String
settleDomainId
)
{
TCutsomerDataPermisson
tp
=
new
TCutsomerDataPermisson
();
if
(
CommonConstants
.
dingleDigitStrArray
[
0
].
equals
(
type
)){
tp
.
setCustomerId
(
id
);
}
else
if
(
CommonConstants
.
dingleDigitStrArray
[
1
].
equals
(
type
)){
tp
.
setContractId
(
id
);
}
else
{
tp
.
setSettleDomainId
(
id
);
}
tp
.
setSettleDomainId
(
settleDomainId
);
return
new
R
(
tCutsomerDataPermissonService
.
list
(
Wrappers
.
lambdaQuery
(
tp
)));
}
...
...
@@ -83,7 +84,7 @@ public class TCutsomerDataPermissonController {
@Operation
(
description
=
"权限复制 权限同项目分配客服(wxhr:tsettledomain_assign_customerservice)"
)
@GetMapping
(
"/copy"
)
@PreAuthorize
(
"@pms.hasPermission('wxhr:tsettledomain_assign_customerservice')"
)
public
R
insertForCopyCutsomerDataPermisson
(
String
[]
srcUser
,
String
[]
beUser
)
{
public
R
<
String
>
insertForCopyCutsomerDataPermisson
(
String
[]
srcUser
,
String
[]
beUser
)
{
YifuUser
user
=
SecurityUtils
.
getUser
();
R
result
=
tCutsomerDataPermissonService
.
insertForCopyCutsomerDataPermisson
(
srcUser
,
beUser
,
user
);
if
(
CommonConstants
.
SUCCESS
.
equals
(
result
.
getCode
())){
//权限刷新
...
...
@@ -112,7 +113,9 @@ public class TCutsomerDataPermissonController {
@SysLog
(
"新增客户数据权限表"
)
@PostMapping
@PreAuthorize
(
"@pms.hasPermission('wxhr:tcutsomerdatapermisson_add')"
)
public
R
save
(
@RequestBody
TCutsomerDataPermisson
tCutsomerDataPermisson
){
public
R
<
Boolean
>
save
(
@RequestBody
TCutsomerDataPermisson
tCutsomerDataPermisson
){
YifuUser
user
=
SecurityUtils
.
getUser
();
settleDomainService
.
removeSettleCache
(
user
,
Arrays
.
asList
(
tCutsomerDataPermisson
.
getUserId
()));
return
new
R
<>(
tCutsomerDataPermissonService
.
save
(
tCutsomerDataPermisson
));
}
...
...
@@ -125,7 +128,9 @@ public class TCutsomerDataPermissonController {
@SysLog
(
"修改客户数据权限表"
)
@PutMapping
@PreAuthorize
(
"@pms.hasPermission('wxhr:tcutsomerdatapermisson_edit')"
)
public
R
update
(
@RequestBody
TCutsomerDataPermisson
tCutsomerDataPermisson
){
public
R
<
Boolean
>
update
(
@RequestBody
TCutsomerDataPermisson
tCutsomerDataPermisson
)
{
YifuUser
user
=
SecurityUtils
.
getUser
();
settleDomainService
.
removeSettleCache
(
user
,
Arrays
.
asList
(
tCutsomerDataPermisson
.
getUserId
()));
return
new
R
<>(
tCutsomerDataPermissonService
.
updateById
(
tCutsomerDataPermisson
));
}
...
...
@@ -138,14 +143,14 @@ public class TCutsomerDataPermissonController {
@SysLog
(
"删除客户数据权限表"
)
@DeleteMapping
(
"/{id}"
)
@PreAuthorize
(
"@pms.hasPermission('wxhr:tcutsomerdatapermisson_del')"
)
public
R
removeById
(
@PathVariable
String
id
){
public
R
<
Boolean
>
removeById
(
@PathVariable
String
id
){
YifuUser
user
=
SecurityUtils
.
getUser
();
TCutsomerDataPermisson
tdp
=
tCutsomerDataPermissonService
.
getById
(
id
);
if
(
null
==
tdp
){
return
new
R
<>(
"权限已删除!"
);
return
new
R
<>(
true
);
}
//刷新缓存
settleDomainService
.
removeSettleCache
(
user
,
Arrays
.
asList
(
tdp
.
get
BePermissonUser
()));
settleDomainService
.
removeSettleCache
(
user
,
Arrays
.
asList
(
tdp
.
get
UserId
()));
return
new
R
<>(
tCutsomerDataPermissonService
.
removeById
(
id
));
}
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/mapper/TCutsomerDataPermissonMapper.java
View file @
5170cc4d
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TCutsomerDataPermisson
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.TCutsomerDataPermissonVo
;
import
org.apache.ibatis.annotations.Mapper
;
...
...
@@ -16,24 +18,16 @@ import java.util.List;
*/
@Mapper
public
interface
TCutsomerDataPermissonMapper
extends
BaseMapper
<
TCutsomerDataPermisson
>
{
/**
* 分页count
* @Author pwang
* @Date 2020-06-28 15:25
* @param tCutsomerDataPermisson
* @return
**/
long
getTCutsomerDataPermissonPageCount
(
@Param
(
"tCutsomerDataPermisson"
)
TCutsomerDataPermisson
tCutsomerDataPermisson
);
/**
* 客户数据权限表简单分页查询
* @param tCutsomerDataPermisson 客户数据权限表
* @return
*/
List
<
TCutsomerDataPermissonVo
>
getTCutsomerDataPermissonPage
(
@Param
(
"tCutsomerDataPermisson"
)
TCutsomerDataPermissonVo
tCutsomerDataPermisson
,
@Param
(
"page"
)
Long
page
,
@Param
(
"size"
)
Long
size
);
IPage
<
TCutsomerDataPermisson
>
getTCutsomerDataPermissonPage
(
Page
<
TCutsomerDataPermisson
>
page
,
@Param
(
"tCutsomerDataPermisson"
)
TCutsomerDataPermisson
tCutsomerDataPermisson
);
String
getOwnerIdByIdAndType
(
@Param
(
"domainId"
)
String
domainId
,
@Param
(
"type"
)
int
type
);
List
<
TCutsomerDataPermisson
>
getTCutsomerDataPermissonPage
(
@Param
(
"tCutsomerDataPermisson"
)
TCutsomerDataPermisson
tCutsomerDataPermisson
);
/**
* 获取当前登录人拥有的所有项目权限
...
...
@@ -43,8 +37,4 @@ public interface TCutsomerDataPermissonMapper extends BaseMapper<TCutsomerDataPe
* @return
**/
List
<
TCutsomerDataPermisson
>
selectAllSettleDomainPermissionByUserId
(
@Param
(
"userId"
)
String
userId
);
String
getCustomerServiceByid
(
@Param
(
"id"
)
String
id
);
String
getUserByid
(
@Param
(
"settleId"
)
String
settleId
);
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/TCutsomerDataPermissonService.java
View file @
5170cc4d
...
...
@@ -8,6 +8,8 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.TCutsomerDataPermissonVo;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser
;
import
java.util.List
;
/**
* 客户数据权限表
*
...
...
@@ -21,44 +23,17 @@ public interface TCutsomerDataPermissonService extends IService<TCutsomerDataPer
* @param tCutsomerDataPermisson 客户数据权限表
* @return
*/
IPage
<
TCutsomerDataPermissonVo
>
getTCutsomerDataPermissonPage
(
Page
<
TCutsomerDataPermissonVo
>
page
,
TCutsomerDataPermissonVo
tCutsomerDataPermisson
);
/**
* 查询数据所有者id
* @Author pwang
* @Date 2019-07-24 15:31
* @param domainId 实体id
* @param type 实体类型0:单位1:部门2:项目
* @return 返回数据所有者的id串
**/
String
findOwnerIdByIdAndType
(
String
domainId
,
int
type
);
/**
* 查询数据所有者
* @Author pwang
* @Date 2019-07-24 15:31
* @param domainId 实体id
* @param type 实体类型0:单位1:部门2:项目
* @return 返回数据所有者
**/
YifuUser
findOwnerByIdAndType
(
String
domainId
,
int
type
);
// /**
// * 获取当前登录人拥有的所有项目权限
// * @Author fxj
// * @Date 2019-08-26
// * @param userId
// * @return
// **/
// List<TCutsomerDataPermisson> selectAllSettleDomainPermissionByUserId(int userId);
IPage
<
TCutsomerDataPermisson
>
getTCutsomerDataPermissonPage
(
Page
<
TCutsomerDataPermisson
>
page
,
TCutsomerDataPermisson
tCutsomerDataPermisson
);
String
getCustomerServiceByid
(
String
id
);
/**
*
获取所有有权限的用户
* @
Author pwang
* @
Date 2019-11-28 14:54
* @
param settleId
* @return
*
@param tCutsomerDataPermisson
* @
Description: 导出获取list
* @
Author: hgw
* @
Date: 2022/10/26 17:23
* @return
: java.util.List<com.yifu.cloud.plus.v1.yifu.archives.entity.TCutsomerDataPermisson>
**/
String
getUserByid
(
String
settleId
);
List
<
TCutsomerDataPermisson
>
getTCutsomerDataPermissonList
(
TCutsomerDataPermisson
tCutsomerDataPermisson
);
/**
* 权限复制 将srcUserList里面的所有用户权限(表)赋给 beUser 所有人
* @Author pwang
...
...
@@ -68,15 +43,5 @@ public interface TCutsomerDataPermissonService extends IService<TCutsomerDataPer
* @param user user授权人
* @return
**/
R
insertForCopyCutsomerDataPermisson
(
String
[]
srcUserList
,
String
[]
beUser
,
YifuUser
user
);
/**
* 专用方法 不建议调用 存在sql注入风险
* @Author pwang
* @Date 2020-07-02 19:00
* @param sql
* @param beUser
* @param user
* @return
**/
R
insertCutsomerDataPermissonBySql
(
String
sql
,
String
beUser
,
YifuUser
user
);
R
<
String
>
insertForCopyCutsomerDataPermisson
(
String
[]
srcUserList
,
String
[]
beUser
,
YifuUser
user
);
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TCutsomerDataPermissonServiceImpl.java
View file @
5170cc4d
...
...
@@ -4,22 +4,16 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.github.abel533.sql.SqlMapper
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TCutsomerDataPermisson
;
import
com.yifu.cloud.plus.v1.yifu.archives.mapper.TCutsomerDataPermissonMapper
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.TCutsomerDataPermissonService
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.TCutsomerDataPermissonVo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser
;
import
com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprUpmsProperties
;
import
com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.ibatis.session.SqlSession
;
import
org.apache.ibatis.session.SqlSessionFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -41,11 +35,6 @@ import java.util.*;
@Slf4j
public
class
TCutsomerDataPermissonServiceImpl
extends
ServiceImpl
<
TCutsomerDataPermissonMapper
,
TCutsomerDataPermisson
>
implements
TCutsomerDataPermissonService
{
private
final
DaprUpmsProperties
daprUpmsProperties
;
@Autowired
private
SqlSessionFactory
sqlSessionFactory
;
/**
* 客户数据权限表简单分页查询
*
...
...
@@ -53,62 +42,18 @@ public class TCutsomerDataPermissonServiceImpl extends ServiceImpl<TCutsomerData
* @return
*/
@Override
public
IPage
<
TCutsomerDataPermissonVo
>
getTCutsomerDataPermissonPage
(
Page
<
TCutsomerDataPermissonVo
>
page
,
TCutsomerDataPermissonVo
tCutsomerDataPermisson
)
{
long
tEmployeeInfoPageCount
=
baseMapper
.
getTCutsomerDataPermissonPageCount
(
tCutsomerDataPermisson
);
page
.
setTotal
(
tEmployeeInfoPageCount
);
if
(
tEmployeeInfoPageCount
>
0L
)
{
page
.
setPages
((
long
)
Math
.
ceil
(
tEmployeeInfoPageCount
/
page
.
getSize
()));
}
if
(
page
.
getCurrent
()
<
1
)
{
page
.
setCurrent
(
1L
);
}
if
(
page
.
getSize
()
<
1
)
{
page
.
setSize
(
10L
);
}
if
(
tEmployeeInfoPageCount
>
((
page
.
getCurrent
()
-
1
)
*
page
.
getSize
()))
{
page
.
setRecords
(
baseMapper
.
getTCutsomerDataPermissonPage
(
tCutsomerDataPermisson
,
(
page
.
getCurrent
()
-
1
)
*
page
.
getSize
(),
page
.
getSize
()));
}
return
page
;
public
IPage
<
TCutsomerDataPermisson
>
getTCutsomerDataPermissonPage
(
Page
<
TCutsomerDataPermisson
>
page
,
TCutsomerDataPermisson
tCutsomerDataPermisson
)
{
return
baseMapper
.
getTCutsomerDataPermissonPage
(
page
,
tCutsomerDataPermisson
);
}
@Override
public
String
findOwnerIdByIdAndType
(
String
domainId
,
int
type
)
{
if
(
CommonConstants
.
dingleDigitIntArray
[
0
]
==
type
||
CommonConstants
.
dingleDigitIntArray
[
1
]
==
type
||
CommonConstants
.
dingleDigitIntArray
[
2
]
==
type
)
{
return
baseMapper
.
getOwnerIdByIdAndType
(
domainId
,
type
);
}
return
null
;
}
@Override
public
YifuUser
findOwnerByIdAndType
(
String
domainId
,
int
type
)
{
if
(
CommonConstants
.
dingleDigitIntArray
[
0
]
==
type
||
CommonConstants
.
dingleDigitIntArray
[
1
]
==
type
||
CommonConstants
.
dingleDigitIntArray
[
2
]
==
type
)
{
String
userid
=
baseMapper
.
getOwnerIdByIdAndType
(
domainId
,
type
);
try
{
if
(
null
!=
userid
)
{
R
<
YifuUser
>
result
=
HttpDaprUtil
.
invokeMethodGet
(
daprUpmsProperties
.
getAppUrl
(),
daprUpmsProperties
.
getAppId
(),
"/user/getSimpleUser/"
+
userid
,
null
,
Integer
.
class
);
return
null
==
result
?
null
:
result
.
getData
();
}
}
catch
(
Exception
e
)
{
log
.
info
(
"findOwnerByIdAndType方法报错:"
,
e
);
return
null
;
}
}
return
null
;
}
@Override
public
String
getCustomerServiceByid
(
String
id
)
{
return
baseMapper
.
getCustomerServiceByid
(
id
);
}
@Override
public
String
getUserByid
(
String
settleId
)
{
return
baseMapper
.
getUserByid
(
settleId
);
public
List
<
TCutsomerDataPermisson
>
getTCutsomerDataPermissonList
(
TCutsomerDataPermisson
tCutsomerDataPermisson
)
{
return
baseMapper
.
getTCutsomerDataPermissonPage
(
tCutsomerDataPermisson
);
}
@Override
@Transactional
public
R
insertForCopyCutsomerDataPermisson
(
String
[]
srcUser
,
String
[]
beUser
,
YifuUser
user
)
{
public
R
<
String
>
insertForCopyCutsomerDataPermisson
(
String
[]
srcUser
,
String
[]
beUser
,
YifuUser
user
)
{
if
(
Common
.
isEmpty
(
srcUser
)){
return
R
.
failed
(
"请选择要被复制人!"
)
;
}
...
...
@@ -118,8 +63,8 @@ public class TCutsomerDataPermissonServiceImpl extends ServiceImpl<TCutsomerData
if
(
beUser
.
length
>
1
){
return
R
.
failed
(
"为了避免权限混乱,暂时只支持权限复制给某一个人!"
)
;
}
List
<
TCutsomerDataPermisson
>
list
=
baseMapper
.
selectList
(
Wrappers
.<
TCutsomerDataPermisson
>
lambdaQuery
().
in
(
TCutsomerDataPermisson:
:
getBePermissonUser
,
srcUser
));
Collection
<
TCutsomerDataPermisson
>
saveColl
=
null
;
List
<
TCutsomerDataPermisson
>
list
=
baseMapper
.
selectList
(
Wrappers
.<
TCutsomerDataPermisson
>
lambdaQuery
().
eq
(
TCutsomerDataPermisson:
:
getUserId
,
srcUser
[
0
]
));
Collection
<
TCutsomerDataPermisson
>
saveColl
;
if
(
Common
.
isNotNull
(
list
)){
LocalDateTime
now
=
LocalDateTime
.
now
();
for
(
String
userId
:
beUser
){
...
...
@@ -145,44 +90,22 @@ public class TCutsomerDataPermissonServiceImpl extends ServiceImpl<TCutsomerData
**/
private
Collection
<
TCutsomerDataPermisson
>
getSaveDataPermissonList
(
YifuUser
user
,
List
<
TCutsomerDataPermisson
>
list
,
LocalDateTime
now
,
String
userId
)
{
Collection
<
TCutsomerDataPermisson
>
result
=
new
HashSet
<>();
Map
<
String
,
TCutsomerDataPermisson
>
cutsomerDataPermissonMap
=
new
HashMap
<>();
Map
<
String
,
TCutsomerDataPermisson
>
contractIdDataPermissonMap
=
new
HashMap
<>();
Map
<
String
,
TCutsomerDataPermisson
>
settleDomianDataPermissonMap
=
new
HashMap
<>();
List
<
TCutsomerDataPermisson
>
oldPermisson
=
baseMapper
.
selectList
(
Wrappers
.<
TCutsomerDataPermisson
>
lambdaQuery
().
in
(
TCutsomerDataPermisson:
:
getBePermissonUser
,
userId
));
Map
<
String
,
TCutsomerDataPermisson
>
settleDomianDataPermissonMap
=
new
HashMap
<>();
List
<
TCutsomerDataPermisson
>
oldPermisson
=
baseMapper
.
selectList
(
Wrappers
.<
TCutsomerDataPermisson
>
lambdaQuery
().
eq
(
TCutsomerDataPermisson:
:
getUserId
,
userId
));
//被复制的权限去重
for
(
TCutsomerDataPermisson
cdp
:
list
){
cdp
.
setId
(
null
);
cdp
.
setBePermissionTime
(
now
);
cdp
.
setIsOwner
(
CommonConstants
.
IS_OWNER_NO
);
cdp
.
setBePermissonUser
(
userId
);
cdp
.
setIsCustomerService
(
CommonConstants
.
ONE_STRING
);
//非客服
cdp
.
setPermissonSrc
(
user
.
getNickname
()
+
"批量复制权限"
);
cdp
.
setPermissionUser
(
String
.
valueOf
(
user
.
getId
()));
cdp
.
setType
(
cdp
.
getType
());
if
(
CommonConstants
.
dingleDigitStrArray
[
0
].
equals
(
cdp
.
getType
())){
cutsomerDataPermissonMap
.
put
(
cdp
.
getCustomerId
(),
cdp
);
}
else
if
(
CommonConstants
.
dingleDigitStrArray
[
1
].
equals
(
cdp
.
getType
())){
contractIdDataPermissonMap
.
put
(
cdp
.
getContractId
(),
cdp
);
}
else
if
(
CommonConstants
.
dingleDigitStrArray
[
2
].
equals
(
cdp
.
getType
())){
settleDomianDataPermissonMap
.
put
(
cdp
.
getSettleDomainId
(),
cdp
);
}
cdp
.
setUserId
(
userId
);
// 注意 :人员部门、登录名等没加
cdp
.
setType
(
CommonConstants
.
TWO_STRING
);
cdp
.
setCreateBy
(
user
.
getId
());
cdp
.
setCreateName
(
user
.
getNickname
());
cdp
.
setCreateTime
(
now
);
settleDomianDataPermissonMap
.
put
(
cdp
.
getSettleDomainId
(),
cdp
);
}
//去除本身有的权限
for
(
TCutsomerDataPermisson
cdp
:
oldPermisson
){
if
(
CommonConstants
.
dingleDigitStrArray
[
0
].
equals
(
cdp
.
getType
())){
cutsomerDataPermissonMap
.
remove
(
cdp
.
getCustomerId
());
}
else
if
(
CommonConstants
.
dingleDigitStrArray
[
1
].
equals
(
cdp
.
getType
())){
contractIdDataPermissonMap
.
remove
(
cdp
.
getCustomerId
());
}
else
if
(
CommonConstants
.
dingleDigitStrArray
[
2
].
equals
(
cdp
.
getType
())){
settleDomianDataPermissonMap
.
remove
(
cdp
.
getCustomerId
());
}
}
if
(
Common
.
isNotNull
(
cutsomerDataPermissonMap
.
values
())){
result
.
addAll
(
cutsomerDataPermissonMap
.
values
());
}
if
(
Common
.
isNotNull
(
contractIdDataPermissonMap
.
values
())){
result
.
addAll
(
contractIdDataPermissonMap
.
values
());
settleDomianDataPermissonMap
.
remove
(
cdp
.
getSettleDomainId
());
}
if
(
Common
.
isNotNull
(
settleDomianDataPermissonMap
.
values
())){
result
.
addAll
(
settleDomianDataPermissonMap
.
values
());
...
...
@@ -190,54 +113,9 @@ public class TCutsomerDataPermissonServiceImpl extends ServiceImpl<TCutsomerData
return
result
;
}
/**
* 专用方法 不建议调用 存在sql注入风险
* @Author pwang
* @Date 2020-07-02 19:00
* @param sql
* @param beUser
* @param user
* @return
**/
@Override
public
R
insertCutsomerDataPermissonBySql
(
String
sql
,
String
beUser
,
YifuUser
user
)
{
if
(
Common
.
isEmpty
(
beUser
)){
return
R
.
failed
(
"请选择被授权的人!"
)
;
}
SqlSession
session
=
sqlSessionFactory
.
openSession
();
SqlMapper
sqlMapper
=
new
SqlMapper
(
session
);
List
<
String
>
list
=
sqlMapper
.
selectList
(
sql
,
String
.
class
);
TCutsomerDataPermisson
cdp
=
null
;
List
<
TCutsomerDataPermisson
>
saveList
=
new
ArrayList
<>();
if
(
Common
.
isNotNull
(
list
)){
LocalDateTime
now
=
LocalDateTime
.
now
();
for
(
String
settleDamainId
:
list
){
cdp
=
new
TCutsomerDataPermisson
();
cdp
.
setBePermissionTime
(
now
);
cdp
.
setSettleDomainId
(
settleDamainId
);
cdp
.
setIsOwner
(
CommonConstants
.
IS_OWNER_NO
);
cdp
.
setBePermissonUser
(
beUser
);
cdp
.
setIsCustomerService
(
CommonConstants
.
ONE_STRING
);
//非客服
cdp
.
setPermissonSrc
(
user
.
getNickname
()
+
"sql授权"
);
cdp
.
setPermissionUser
(
String
.
valueOf
(
user
.
getId
()));
saveList
.
add
(
cdp
);
}
this
.
saveBatch
(
saveList
);
}
else
{
return
R
.
failed
(
"未查到要被复制人的权限表数据,请换个人复制权限"
)
;
}
return
R
.
ok
(
"操作成功"
);
}
@Override
public
boolean
save
(
TCutsomerDataPermisson
cutsomerDataPermisson
){
if
(
null
!=
cutsomerDataPermisson
.
getSettleDomainId
()){
cutsomerDataPermisson
.
setType
(
CommonConstants
.
dingleDigitStrArray
[
2
]);
}
else
if
(
null
!=
cutsomerDataPermisson
.
getContractId
()){
cutsomerDataPermisson
.
setType
(
CommonConstants
.
dingleDigitStrArray
[
1
]);
}
else
if
(
null
!=
cutsomerDataPermisson
.
getCustomerId
()){
cutsomerDataPermisson
.
setType
(
CommonConstants
.
dingleDigitStrArray
[
0
]);
}
return
super
.
save
(
cutsomerDataPermisson
);
}
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TSettleDomainServiceImpl.java
View file @
5170cc4d
...
...
@@ -21,8 +21,10 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysArea
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.AllUserNaVo
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.AreaVo
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysUserListVo
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TCutsomerDataPermisson
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain
;
import
com.yifu.cloud.plus.v1.yifu.archives.mapper.TCutsomerDataPermissonMapper
;
...
...
@@ -169,11 +171,11 @@ public class TSettleDomainServiceImpl extends ServiceImpl<TSettleDomainMapper, T
}
// 处理服务团队数据权限 2022-09-19 fxj
if
(
Common
.
isNotNull
(
tSettleDomain
.
getServiceTeam
())){
R
<
AllUserNa
Vo
>
res
=
upmsDaprUtils
.
getUserIdsByUserNames
(
tSettleDomain
.
getServiceTeam
());
if
(
Common
.
isNotNull
(
res
)
&&
Common
.
isNotNull
(
res
.
getData
())
&&
Common
.
isNotNull
(
res
.
getData
().
getUser
Ids
())){
R
<
SysUserList
Vo
>
res
=
upmsDaprUtils
.
getUserIdsByUserNames
(
tSettleDomain
.
getServiceTeam
());
if
(
Common
.
isNotNull
(
res
)
&&
Common
.
isNotNull
(
res
.
getData
())
&&
Common
.
isNotNull
(
res
.
getData
().
getUser
List
())){
// 先清理缓存
this
.
removeSettleCache
(
null
,
res
.
getData
().
getUserIds
());
saveForEkp
(
res
.
getData
().
getUser
Ids
(),
tSettleDomain
.
getId
()
);
saveForEkp
(
res
.
getData
().
getUser
List
(),
tSettleDomain
);
}
}
tSettleDomain
.
setDeleteFlag
(
CommonConstants
.
ZERO_STRING
);
...
...
@@ -206,25 +208,28 @@ public class TSettleDomainServiceImpl extends ServiceImpl<TSettleDomainMapper, T
* @Param
* @return
**/
public
boolean
saveForEkp
(
List
<
S
tring
>
userIds
,
String
domainId
){
// 1. 先清除现有的这些
认
的项目权限
public
boolean
saveForEkp
(
List
<
S
ysUser
>
userIds
,
TSettleDomain
domain
){
// 1. 先清除现有的这些
人
的项目权限
permissonMapper
.
delete
(
Wrappers
.<
TCutsomerDataPermisson
>
query
().
lambda
()
.
in
(
TCutsomerDataPermisson:
:
get
BePermissonUser
,
userIds
)
.
eq
(
TCutsomerDataPermisson:
:
getSettleDomainId
,
domain
Id
));
.
in
(
TCutsomerDataPermisson:
:
get
UserId
,
userIds
)
.
eq
(
TCutsomerDataPermisson:
:
getSettleDomainId
,
domain
.
getId
()
));
// 2.新增新的项目人员权限
TCutsomerDataPermisson
pm
;
if
(
Common
.
isNotNull
(
userIds
)){
for
(
S
tring
uId:
userIds
){
if
(
Common
.
isNotNull
(
userIds
))
{
for
(
S
ysUser
user
:
userIds
){
pm
=
new
TCutsomerDataPermisson
();
pm
.
setIsCustomerService
(
CommonConstants
.
ZERO_STRING
);
pm
.
setIsOwner
(
CommonConstants
.
ONE_STRING
);
pm
.
setPermissonSrc
(
"EKP服务团队"
);
pm
.
setPermissonLevel
(
CommonConstants
.
ONE_INT
);
pm
.
setBePermissonUser
(
uId
);
pm
.
setBePermissionTime
(
LocalDateTime
.
now
());
pm
.
setSettleDomainId
(
domainId
);
pm
.
setPermissionUser
(
CommonConstants
.
ONE_STRING
);
pm
.
setType
(
CommonConstants
.
TWO_STRING
);
pm
.
setStatus
(
CommonConstants
.
ZERO_STRING
);
pm
.
setUserId
(
user
.
getUserId
());
pm
.
setUserLoginName
(
user
.
getUsername
());
pm
.
setUserNickName
(
user
.
getNickname
());
pm
.
setUserDeptName
(
user
.
getDeptName
());
pm
.
setCreateTime
(
LocalDateTime
.
now
());
pm
.
setSettleDomainId
(
domain
.
getId
());
pm
.
setSettleDomainName
(
domain
.
getDepartName
());
pm
.
setSettleDomainNo
(
domain
.
getDepartNo
());
pm
.
setCreateBy
(
CommonConstants
.
ONE_STRING
);
pm
.
setCreateName
(
"EKP同步"
);
pm
.
setType
(
CommonConstants
.
ZERO_STRING
);
permissonMapper
.
insert
(
pm
);
}
}
...
...
yifu-archives/yifu-archives-biz/src/main/resources/mapper/TCutsomerDataPermissonMapper.xml
View file @
5170cc4d
...
...
@@ -6,145 +6,72 @@
<resultMap
id=
"tCutsomerDataPermissonMap"
type=
"com.yifu.cloud.plus.v1.yifu.archives.entity.TCutsomerDataPermisson"
>
<id
property=
"id"
column=
"ID"
/>
<result
property=
"isOwner"
column=
"IS_OWNER
"
/>
<result
property=
"c
ontractId"
column=
"CONTRACT_ID
"
/>
<result
property=
"c
ustomerId"
column=
"CUSTOMER_ID
"
/>
<result
property=
"
permissonSrc"
column=
"PERMISSON_SRC
"
/>
<result
property=
"
permissonLevel"
column=
"PERMISSON_LEVEL
"
/>
<result
property=
"
permissionUser"
column=
"PERMISSION_USER
"
/>
<result
property=
"
bePermissonUser"
column=
"BE_PERMISSON_USER
"
/>
<result
property=
"
bePermissionTime"
column=
"BE_PERMISSION_TI
ME"
/>
<result
property=
"status"
column=
"STATUS
"
/>
<result
property=
"c
reateBy"
column=
"CREATE_BY
"
/>
<result
property=
"c
reateName"
column=
"CREATE_NAME
"
/>
<result
property=
"
createTime"
column=
"CREATE_TIME
"
/>
<result
property=
"
userId"
column=
"USER_ID
"
/>
<result
property=
"
userLoginName"
column=
"USER_LOGIN_NAME
"
/>
<result
property=
"
userNickName"
column=
"USER_NICK_NAME
"
/>
<result
property=
"
userDeptName"
column=
"USER_DEPT_NA
ME"
/>
<result
property=
"remark"
column=
"REMARK"
/>
<result
property=
"type"
column=
"type"
/>
<result
property=
"settleDomainId"
column=
"SETTLE_DOMAIN_ID"
/>
</resultMap>
<resultMap
id=
"tCutsomerDataPermissonMapVo"
type=
"com.yifu.cloud.plus.v1.yifu.archives.vo.TCutsomerDataPermissonVo"
>
<id
property=
"id"
column=
"ID"
/>
<result
property=
"isOwner"
column=
"IS_OWNER"
/>
<result
property=
"contractId"
column=
"CONTRACT_ID"
/>
<result
property=
"customerId"
column=
"CUSTOMER_ID"
/>
<result
property=
"permissonSrc"
column=
"PERMISSON_SRC"
/>
<result
property=
"permissonLevel"
column=
"PERMISSON_LEVEL"
/>
<result
property=
"permissionUser"
column=
"PERMISSION_USER"
/>
<result
property=
"bePermissonUser"
column=
"BE_PERMISSON_USER"
/>
<result
property=
"bePermissionTime"
column=
"BE_PERMISSION_TIME"
/>
<result
property=
"remark"
column=
"REMARK"
/>
<result
property=
"settleDomainId"
column=
"SETTLE_DOMAIN_ID"
/>
<result
property=
"type"
column=
"type"
/>
<result
property=
"name"
column=
"name"
/>
<result
property=
"permissionUserName"
column=
"nickname"
/>
<result
property=
"settleDomainName"
column=
"SETTLE_DOMAIN_NAME"
/>
<result
property=
"settleDomainNo"
column=
"SETTLE_DOMAIN_NO"
/>
</resultMap>
<sql
id=
"base_column_list"
>
a.ID,
a.IS_OWNER,
a.CONTRACT_ID,
a.CUSTOMER_ID,
a.PERMISSON_SRC,
a.PERMISSON_LEVEL,
a.PERMISSION_USER,
a.BE_PERMISSON_USER,
a.BE_PERMISSION_TIME,
a.REMARK,
a.SETTLE_DOMAIN_ID,
a.type
</sql>
a.ID
,a.STATUS
,a.REMARK
,a.SETTLE_DOMAIN_ID
,a.CREATE_BY
,a.CREATE_NAME
,a.CREATE_TIME
,a.USER_ID
,a.USER_LOGIN_NAME
,a.USER_NICK_NAME
,a.USER_DEPT_NAME
,a.TYPE
,a.SETTLE_DOMAIN_NAME
,a.SETTLE_DOMAIN_NO
</sql>
<sql
id=
"where_getTCutsomerDataPermissonPage"
>
<if
test=
"tCutsomerDataPermisson.bePermissonUser != null and tCutsomerDataPermisson.bePermissonUser.trim() != ''"
>
AND a.BE_PERMISSON_USER = #{tCutsomerDataPermisson.bePermissonUser}
</if>
<if
test=
"tCutsomerDataPermisson.type != null and tCutsomerDataPermisson.type.trim() != ''"
>
AND a.type = #{tCutsomerDataPermisson.type}
</if>
<if
test=
"tCutsomerDataPermisson.name != null and tCutsomerDataPermisson.name.trim() != ''"
>
AND a.name like '%${tCutsomerDataPermisson.name}%'
</if>
<if
test=
"tCutsomerDataPermisson.id != null and tCutsomerDataPermisson.id.trim() != ''"
>
AND a.ID = #{tCutsomerDataPermisson.id}
</if>
<if
test=
"tCutsomerDataPermisson.isOwner != null and tCutsomerDataPermisson.isOwner.trim() != ''"
>
AND a.IS_OWNER = #{tCutsomerDataPermisson.isOwner}
</if>
<if
test=
"tCutsomerDataPermisson.permissonSrc != null and tCutsomerDataPermisson.permissonSrc.trim() != ''"
>
AND a.PERMISSON_SRC = #{tCutsomerDataPermisson.permissonSrc}
</if>
<if
test=
"tCutsomerDataPermisson.permissonLevel != null and tCutsomerDataPermisson.permissonLevel.trim() != ''"
>
AND a.PERMISSON_LEVEL = #{tCutsomerDataPermisson.permissonLevel}
</if>
<if
test=
"tCutsomerDataPermisson.permissionUser != null and tCutsomerDataPermisson.permissionUser.trim() != ''"
>
AND a.PERMISSION_USER = #{tCutsomerDataPermisson.permissionUser}
</if>
<if
test=
"tCutsomerDataPermisson.bePermissionTime != null and tCutsomerDataPermisson.bePermissionTime.trim() != ''"
>
AND a.BE_PERMISSION_TIME = #{tCutsomerDataPermisson.bePermissionTime}
</if>
<if
test=
"tCutsomerDataPermisson.remark != null and tCutsomerDataPermisson.remark.trim() != ''"
>
AND a.REMARK = #{tCutsomerDataPermisson.remark}
</if>
<if
test=
"tCutsomerDataPermisson != null"
>
<if
test=
"tCutsomerDataPermisson.userNickName != null and tCutsomerDataPermisson.userNickName.trim() != ''"
>
AND a.USER_NICK_NAME like concat('%',#{tCutsomerDataPermisson.userNickName},'%')
</if>
<if
test=
"tCutsomerDataPermisson.userLoginName != null and tCutsomerDataPermisson.userLoginName.trim() != ''"
>
AND a.USER_LOGIN_NAME like concat('%',#{tCutsomerDataPermisson.userLoginName},'%')
</if>
<if
test=
"tCutsomerDataPermisson.userDeptName != null and tCutsomerDataPermisson.userDeptName.trim() != ''"
>
AND a.USER_DEPT_NAME like concat('%',#{tCutsomerDataPermisson.userDeptName},'%')
</if>
<if
test=
"tCutsomerDataPermisson.status != null and tCutsomerDataPermisson.status.trim() != ''"
>
AND a.STATUS = #{tCutsomerDataPermisson.status}
</if>
<if
test=
"tCutsomerDataPermisson.settleDomainName != null and tCutsomerDataPermisson.settleDomainName.trim() != ''"
>
AND a.SETTLE_DOMAIN_NAME like '%${tCutsomerDataPermisson.settleDomainName}%'
</if>
<if
test=
"tCutsomerDataPermisson.settleDomainNo != null and tCutsomerDataPermisson.settleDomainNo.trim() != ''"
>
AND a.SETTLE_DOMAIN_NO like '%${tCutsomerDataPermisson.settleDomainNo}%'
</if>
</if>
</sql>
<select
id=
"getTCutsomerDataPermissonPageCount"
resultType=
"java.lang.Long"
>
SELECT
count(1)
FROM view_cutsomer_permisson a
where 1=1
<include
refid=
"where_getTCutsomerDataPermissonPage"
/>
</select>
<!--查询-->
<select
id=
"getTCutsomerDataPermissonPage"
resultMap=
"tCutsomerDataPermissonMapVo"
>
<!--分页查询-->
<select
id=
"getTCutsomerDataPermissonPage"
resultMap=
"tCutsomerDataPermissonMap"
>
SELECT
<include
refid=
"base_column_list"
/>
,a.name
,u.nickname
from view_cutsomer_permisson a
left join yifu_cloud.sys_user u on a.PERMISSION_USER = u.user_id
<include
refid=
"base_column_list"
/>
from t_cutsomer_data_permisson a
where 1=1
<include
refid=
"where_getTCutsomerDataPermissonPage"
/>
ORDER BY a.BE_PERMISSION_TIME DESC
<if
test=
"null != page and null != size"
>
limit #{page},#{size}
</if>
</select>
<select
id=
"getOwnerIdByIdAndType"
resultType=
"java.lang.String"
>
SELECT BE_PERMISSON_USER FROM t_cutsomer_data_permisson
WHERE IS_OWNER = '0'
<if
test=
"0==type"
>
AND CUSTOMER_ID = '${domainId}'
</if>
<if
test=
"1==type"
>
AND CONTRACT_ID = '${domainId}'
</if>
<if
test=
"2==type"
>
AND SETTLE_DOMAIN_ID = '${domainId}'
</if>
ORDER BY BE_PERMISSION_TIME ASC
limit 1
<include
refid=
"where_getTCutsomerDataPermissonPage"
/>
ORDER BY a.CREATE_TIME DESC
</select>
<!-- 获取当前登录人拥有的所有项目权限 -->
<select
id=
"selectAllSettleDomainPermissionByUserId"
resultMap=
"tCutsomerDataPermissonMap"
>
SELECT
<include
refid=
"base_column_list"
/>
FROM t_cutsomer_data_permisson a
WHERE 1=1
AND SETTLE_DOMAIN_ID IS NOT NULL
AND BE_PERMISSON_USER = '${userId}'
</select>
<select
id=
"getCustomerServiceByid"
resultType=
"java.lang.String"
>
SELECT
GROUP_CONCAT(distinct BE_PERMISSON_USER )
FROM
t_cutsomer_data_permisson
WHERE
IS_CUSTOMER_SERVICE = '0'
AND SETTLE_DOMAIN_ID = '${id}'
WHERE a.STATUS = '0' and a.USER_ID = #{userId}
</select>
<select
id=
"getUserByid"
resultType=
"java.lang.String"
>
SELECT
GROUP_CONCAT(distinct BE_PERMISSON_USER )
FROM
t_cutsomer_data_permisson
WHERE
SETTLE_DOMAIN_ID = '${settleId}'
</select>
</mapper>
yifu-common/yifu-common-dapr/src/main/java/com/yifu/cloud/plus/v1/yifu/common/dapr/util/UpmsDaprUtils.java
View file @
5170cc4d
...
...
@@ -2,6 +2,7 @@ package com.yifu.cloud.plus.v1.yifu.common.dapr.util;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.AllUserNaVo
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.AreaVo
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysUserListVo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
...
...
@@ -59,8 +60,8 @@ public class UpmsDaprUtils {
* @Param
* @return
**/
public
R
<
AllUserNa
Vo
>
getUserIdsByUserNames
(
String
usernames
)
{
R
<
AllUserNaVo
>
allUserVoR
=
HttpDaprUtil
.
invokeMethodPost
(
daprUpmsProperties
.
getAppUrl
(),
daprUpmsProperties
.
getAppId
(),
"/user/inner/getUserIdsByUserNames"
,
usernames
,
AllUserNa
Vo
.
class
,
SecurityConstants
.
FROM_IN
);
public
R
<
SysUserList
Vo
>
getUserIdsByUserNames
(
String
usernames
)
{
R
<
SysUserListVo
>
allUserVoR
=
HttpDaprUtil
.
invokeMethodPost
(
daprUpmsProperties
.
getAppUrl
(),
daprUpmsProperties
.
getAppId
(),
"/user/inner/getUserIdsByUserNames"
,
usernames
,
SysUserList
Vo
.
class
,
SecurityConstants
.
FROM_IN
);
if
(
Common
.
isEmpty
(
allUserVoR
)){
return
R
.
failed
(
"获取指定用户名对应用户IDs失败!"
);
}
...
...
yifu-upms/yifu-upms-api/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/api/vo/SysUserListVo.java
0 → 100644
View file @
5170cc4d
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
admin
.
api
.
vo
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* @Author Hgw
* @Date 2022-10-26 17:09:09
* @Description
* @Version 1.0
*/
@Data
public
class
SysUserListVo
implements
Serializable
{
private
List
<
SysUser
>
userList
;
private
List
<
String
>
userIds
;
}
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/controller/UserController.java
View file @
5170cc4d
...
...
@@ -25,10 +25,7 @@ import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
import
com.yifu.cloud.plus.v1.yifu.admin.api.dto.UserDTO
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.dto.UserInfo
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.AllUserNaVo
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.UserExcelVO
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.UserInfoVO
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.UserVO
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.*
;
import
com.yifu.cloud.plus.v1.yifu.admin.service.SysUserService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
...
...
@@ -304,8 +301,8 @@ public class UserController {
**/
@Inner
@PostMapping
(
value
=
{
"/inner/getUserIdsByUserNames"
})
public
AllUserNa
Vo
getUserIdsByUserNames
(
@RequestBody
String
usernames
)
{
AllUserNaVo
naVo
=
new
AllUserNa
Vo
();
public
SysUserList
Vo
getUserIdsByUserNames
(
@RequestBody
String
usernames
)
{
SysUserListVo
naVo
=
new
SysUserList
Vo
();
if
(
Common
.
isEmpty
(
usernames
)){
return
naVo
;
}
...
...
@@ -315,9 +312,9 @@ public class UserController {
List
<
String
>
userIds
=
new
ArrayList
<>();
for
(
SysUser
u:
sysUsers
){
userIds
.
add
(
u
.
getUserId
());
}
naVo
.
setUserIds
(
userIds
);
naVo
.
setUserList
(
sysUsers
);
}
return
naVo
;
}
...
...
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