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
d5f8e0d5
Commit
d5f8e0d5
authored
Jun 21, 2022
by
fangxinjiang
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop' into develop
parents
e3a61cc8
39dedb94
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
318 additions
and
12 deletions
+318
-12
TEmployeeInfoController.java
.../v1/yifu/archives/controller/TEmployeeInfoController.java
+84
-1
TEmployeeInfoMapper.java
...oud/plus/v1/yifu/archives/mapper/TEmployeeInfoMapper.java
+4
-0
TEmployeeInfoService.java
...d/plus/v1/yifu/archives/service/TEmployeeInfoService.java
+12
-0
TEmployeeInfoServiceImpl.java
.../yifu/archives/service/impl/TEmployeeInfoServiceImpl.java
+7
-0
TEmployeeInfoMapper.xml
...ves-biz/src/main/resources/mapper/TEmployeeInfoMapper.xml
+77
-0
HttpDaprUtil.java
...ifu/cloud/plus/v1/yifu/common/dapr/util/HttpDaprUtil.java
+2
-2
daprConfig.properties
...yifu-common-dapr/src/main/resources/daprConfig.properties
+1
-8
DataAuthController.java
...oud.plus.v1/yifu/admin/controller/DataAuthController.java
+7
-0
SysDataAuthService.java
....cloud.plus.v1/yifu/admin/service/SysDataAuthService.java
+2
-0
SysDataAuthServiceImpl.java
...us.v1/yifu/admin/service/impl/SysDataAuthServiceImpl.java
+122
-1
No files found.
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/controller/TEmployeeInfoController.java
View file @
d5f8e0d5
...
@@ -20,13 +20,28 @@ package com.yifu.cloud.plus.v1.yifu.archives.controller;
...
@@ -20,13 +20,28 @@ package com.yifu.cloud.plus.v1.yifu.archives.controller;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.dto.UserInfo
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDataAuth
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeInfoService
;
import
com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeInfoService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
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
;
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
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
lombok.SneakyThrows
;
import
org.springframework.cache.Cache
;
import
org.springframework.cache.CacheManager
;
import
org.springframework.cache.support.SimpleValueWrapper
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -45,6 +60,11 @@ public class TEmployeeInfoController {
...
@@ -45,6 +60,11 @@ public class TEmployeeInfoController {
private
final
TEmployeeInfoService
tEmployeeInfoService
;
private
final
TEmployeeInfoService
tEmployeeInfoService
;
// 缓存信息
private
final
CacheManager
cacheManager
;
private
final
DaprUpmsProperties
daprUpmsProperties
;
/**
/**
* 分页查询
* 分页查询
*
*
...
@@ -55,8 +75,71 @@ public class TEmployeeInfoController {
...
@@ -55,8 +75,71 @@ public class TEmployeeInfoController {
@Operation
(
summary
=
"分页查询"
,
description
=
"分页查询"
)
@Operation
(
summary
=
"分页查询"
,
description
=
"分页查询"
)
@GetMapping
(
"/page"
)
@GetMapping
(
"/page"
)
//@PreAuthorize("@pms.hasPermission('demo_temployeeinfo_get')")
//@PreAuthorize("@pms.hasPermission('demo_temployeeinfo_get')")
@SneakyThrows
public
R
<
IPage
<
TEmployeeInfo
>>
getTEmployeeInfoPage
(
Page
<
TEmployeeInfo
>
page
,
TEmployeeInfo
tEmployeeInfo
)
{
public
R
<
IPage
<
TEmployeeInfo
>>
getTEmployeeInfoPage
(
Page
<
TEmployeeInfo
>
page
,
TEmployeeInfo
tEmployeeInfo
)
{
return
R
.
ok
(
tEmployeeInfoService
.
page
(
page
,
Wrappers
.
query
(
tEmployeeInfo
)));
YifuUser
user
=
SecurityUtils
.
getUser
();
if
(
user
==
null
||
Common
.
isEmpty
(
user
.
getId
()))
{
return
R
.
failed
(
"请登录!"
);
}
// 普通用户:
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
user
.
getSystemFlag
()))
{
// 菜单id
String
menuId
=
"1536922631616278529"
;
String
linkId
=
user
.
getId
();
int
linkType
=
1
;
// 用户
SysDataAuth
sysDataAuth
=
new
SysDataAuth
();
sysDataAuth
.
setLinkId
(
linkId
);
sysDataAuth
.
setLinkType
(
linkType
);
// 获取缓存菜单权限的步骤:
Cache
cache
=
cacheManager
.
getCache
(
CacheConstants
.
DATA_AUTH_DETAILS
+
linkType
);
Object
obj
=
null
;
if
(
cache
!=
null
)
{
obj
=
cache
.
get
(
linkId
+
CommonConstants
.
DOWN_LINE_STRING
+
menuId
);
if
(
Common
.
isEmpty
(
obj
))
{
HttpDaprUtil
.
invokeMethodPost
(
daprUpmsProperties
.
getAppUrl
(),
daprUpmsProperties
.
getAppId
()
,
"/dataAuth/refreshAuth"
,
sysDataAuth
,
TEmployeeInfo
.
class
,
SecurityConstants
.
FROM_IN
);
obj
=
cache
.
get
(
linkId
+
CommonConstants
.
DOWN_LINE_STRING
+
menuId
);
if
(
Common
.
isEmpty
(
obj
))
{
linkId
=
user
.
getUserGroup
();
linkType
=
0
;
// 用户组
cache
=
cacheManager
.
getCache
(
CacheConstants
.
DATA_AUTH_DETAILS
+
linkType
);
if
(
cache
!=
null
)
{
obj
=
cache
.
get
(
linkId
+
CommonConstants
.
DOWN_LINE_STRING
+
menuId
);
if
(
Common
.
isEmpty
(
obj
))
{
sysDataAuth
.
setLinkId
(
linkId
);
sysDataAuth
.
setLinkType
(
linkType
);
HttpDaprUtil
.
invokeMethodPost
(
daprUpmsProperties
.
getAppUrl
(),
daprUpmsProperties
.
getAppId
()
,
"/dataAuth/refreshAuth"
,
sysDataAuth
,
TEmployeeInfo
.
class
,
SecurityConstants
.
FROM_IN
);
obj
=
cache
.
get
(
linkId
+
CommonConstants
.
DOWN_LINE_STRING
+
menuId
);
}
}
}
}
}
if
(!
Common
.
isEmpty
(
obj
))
{
SimpleValueWrapper
objs
=
(
SimpleValueWrapper
)
obj
;
String
sql
=
String
.
valueOf
(
objs
.
get
());
if
(
sql
.
contains
(
"#deptId"
))
{
// TODO - 需要关联部门表
}
if
(
sql
.
contains
(
"#create_by"
))
{
sql
=
sql
.
replace
(
"#create_by"
,
user
.
getId
());
}
if
(
sql
.
contains
(
"#settleDomainId"
))
{
// TODO - 获取人员结算主体权限
// sql = sql.replace("#settleDomainId", ",'1','2' ")
sql
=
sql
.
replace
(
"or a.settle_domain_id in ('0'#settleDomainId) "
,
""
);
}
if
(
sql
.
contains
(
"#deptId"
))
{
// TODO - 获取人员部门权限
// sql = sql.replace("#settleDomainId", ",'1','2' ")
sql
=
sql
.
replace
(
" or dept.dept_id = #deptId "
,
""
);
}
return
R
.
ok
(
tEmployeeInfoService
.
getPage
(
page
,
tEmployeeInfo
,
sql
));
}
}
return
R
.
ok
(
tEmployeeInfoService
.
getPage
(
page
,
tEmployeeInfo
,
null
));
}
}
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/mapper/TEmployeeInfoMapper.java
View file @
d5f8e0d5
...
@@ -18,6 +18,8 @@
...
@@ -18,6 +18,8 @@
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
mapper
;
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
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.TEmployeeInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationUpdateVo
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationUpdateVo
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
...
@@ -32,5 +34,7 @@ import org.apache.ibatis.annotations.Param;
...
@@ -32,5 +34,7 @@ import org.apache.ibatis.annotations.Param;
@Mapper
@Mapper
public
interface
TEmployeeInfoMapper
extends
BaseMapper
<
TEmployeeInfo
>
{
public
interface
TEmployeeInfoMapper
extends
BaseMapper
<
TEmployeeInfo
>
{
IPage
<
TEmployeeInfo
>
getPage
(
Page
<
TEmployeeInfo
>
page
,
@Param
(
"employeeInfo"
)
TEmployeeInfo
employeeInfo
,
@Param
(
"sql"
)
String
sql
);
int
updateEducationOfEmp
(
@Param
(
"education"
)
EmpEducationUpdateVo
education
);
int
updateEducationOfEmp
(
@Param
(
"education"
)
EmpEducationUpdateVo
education
);
}
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/TEmployeeInfoService.java
View file @
d5f8e0d5
...
@@ -17,6 +17,8 @@
...
@@ -17,6 +17,8 @@
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
service
;
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
service
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationUpdateVo
;
import
com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationUpdateVo
;
...
@@ -29,5 +31,15 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationUpdateVo;
...
@@ -29,5 +31,15 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationUpdateVo;
*/
*/
public
interface
TEmployeeInfoService
extends
IService
<
TEmployeeInfo
>
{
public
interface
TEmployeeInfoService
extends
IService
<
TEmployeeInfo
>
{
/**
* @param employeeInfo
* @param sql
* @Description: 分页查询
* @Author: hgw
* @Date: 2022/6/20 20:46
* @return: com.baomidou.mybatisplus.core.metadata.IPage<com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo>
**/
IPage
<
TEmployeeInfo
>
getPage
(
Page
<
TEmployeeInfo
>
page
,
TEmployeeInfo
employeeInfo
,
String
sql
);
void
updateEducationOfEmp
(
EmpEducationUpdateVo
education
);
void
updateEducationOfEmp
(
EmpEducationUpdateVo
education
);
}
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmployeeInfoServiceImpl.java
View file @
d5f8e0d5
...
@@ -16,6 +16,8 @@
...
@@ -16,6 +16,8 @@
*/
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
service
.
impl
;
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
archives
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo
;
import
com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeInfoMapper
;
import
com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeInfoMapper
;
...
@@ -32,6 +34,11 @@ import org.springframework.stereotype.Service;
...
@@ -32,6 +34,11 @@ import org.springframework.stereotype.Service;
@Service
@Service
public
class
TEmployeeInfoServiceImpl
extends
ServiceImpl
<
TEmployeeInfoMapper
,
TEmployeeInfo
>
implements
TEmployeeInfoService
{
public
class
TEmployeeInfoServiceImpl
extends
ServiceImpl
<
TEmployeeInfoMapper
,
TEmployeeInfo
>
implements
TEmployeeInfoService
{
@Override
public
IPage
<
TEmployeeInfo
>
getPage
(
Page
<
TEmployeeInfo
>
page
,
TEmployeeInfo
employeeInfo
,
String
sql
)
{
return
baseMapper
.
getPage
(
page
,
employeeInfo
,
sql
);
}
@Override
@Override
public
void
updateEducationOfEmp
(
EmpEducationUpdateVo
education
)
{
public
void
updateEducationOfEmp
(
EmpEducationUpdateVo
education
)
{
baseMapper
.
updateEducationOfEmp
(
education
);
baseMapper
.
updateEducationOfEmp
(
education
);
...
...
yifu-archives/yifu-archives-biz/src/main/resources/mapper/TEmployeeInfoMapper.xml
View file @
d5f8e0d5
...
@@ -74,6 +74,57 @@
...
@@ -74,6 +74,57 @@
<result
property=
"leaveRemark"
column=
"LEAVE_REMARK"
/>
<result
property=
"leaveRemark"
column=
"LEAVE_REMARK"
/>
</resultMap>
</resultMap>
<sql
id=
"baseParam"
>
a.ID,
a.EMP_CODE,
a.EMP_NATRUE,
a.EMP_NAME,
a.EMP_IDCARD,
a.VALIDITY_START,
a.VALIDITY_END,
a.EMP_SEX,
a.EMP_BIRTHDAY,
a.EMP_AGE,
a.EMP_MARRI_STATUS,
a.EMP_NATIONAL,
a.POLITICAL_STATUS,
a.EMP_EMAIL,
a.EMP_PHONE,
a.ID_PROVINCE,
a.ID_CITY,
a.ID_TOWN,
a.EMP_REGIS_TYPE,
a.FILE_PROVINCE,
a.FILE_CITY,
a.FILE_TOWN,
a.IS_COLLEGE,
a.HIGN_EDUCATION,
a.SCHOOL,
a.MAJOR,
a.ADMISSION_DATE,
a.GRADUTION_DATE,
a.REMARK,
a.FILE_SOURCE,
a.STATUS,
a.FILE_STATUS,
a.PROJECT_NUM,
a.CONTRACT_STATUS,
a.INSURANCE_STATUS,
a.SOCIAL_STATUS,
a.FUND_STATUS,
a.SALARY_STATUS,
a.DELETE_FLAG,
a.CREATE_BY,
a.CREATE_NAME,
a.CREATE_TIME,
a.UPDATE_BY,
a.UPDATE_TIME,
a.LEAVE_USER,
a.LEAVE_TIME,
a.LEAVE_REASON,
a.LEAVE_REMARK
</sql>
<update
id=
"updateEducationOfEmp"
>
<update
id=
"updateEducationOfEmp"
>
update t_employee_info
update t_employee_info
<trim
prefix=
"set"
suffixOverrides=
","
>
<trim
prefix=
"set"
suffixOverrides=
","
>
...
@@ -86,4 +137,30 @@
...
@@ -86,4 +137,30 @@
</trim>
</trim>
WHERE id=#{education.empId}
WHERE id=#{education.empId}
</update>
</update>
<sql
id=
"employeeInfo_where"
>
<if
test=
"employeeInfo != null"
>
<if
test=
"employeeInfo.id != null and employeeInfo.id.trim() != ''"
>
AND a.id = #{employeeInfo.id}
</if>
<if
test=
"employeeInfo.empName != null and employeeInfo.empName.trim() != ''"
>
AND a.EMP_NAME = #{employeeInfo.empName}
</if>
<if
test=
"employeeInfo.empIdcard != null and employeeInfo.empIdcard.trim() != ''"
>
AND a.EMP_IDCARD = #{employeeInfo.empIdcard}
</if>
</if>
</sql>
<!-- hgw 分页查询 -->
<select
id=
"getPage"
resultMap=
"tEmployeeInfoMap"
>
select
<include
refid=
"baseParam"
/>
from t_employee_info a
where 1=1
<include
refid=
"employeeInfo_where"
/>
${sql}
order by a.CREATE_TIME desc
</select>
</mapper>
</mapper>
yifu-common/yifu-common-dapr/src/main/java/com/yifu/cloud/plus/v1/yifu/common/dapr/util/HttpDaprUtil.java
View file @
d5f8e0d5
...
@@ -38,7 +38,7 @@ public class HttpDaprUtil {
...
@@ -38,7 +38,7 @@ public class HttpDaprUtil {
String
appId
,
String
appId
,
String
method
,
String
method
,
String
param
,
String
param
,
Class
cs
)
throws
Exception
{
Class
cs
)
{
// 实例化 RestTemplate
// 实例化 RestTemplate
initResTemplate
();
initResTemplate
();
// 初始化请求URL
// 初始化请求URL
...
@@ -61,7 +61,7 @@ public class HttpDaprUtil {
...
@@ -61,7 +61,7 @@ public class HttpDaprUtil {
String
method
,
String
method
,
Object
param
,
Object
param
,
Class
cs
,
Class
cs
,
@RequestHeader
(
SecurityConstants
.
FROM
)
String
from
)
throws
Exception
{
@RequestHeader
(
SecurityConstants
.
FROM
)
String
from
){
// 实例化 RestTemplate
// 实例化 RestTemplate
initResTemplate
();
initResTemplate
();
// 初始化请求URL
// 初始化请求URL
...
...
yifu-common/yifu-common-dapr/src/main/resources/daprConfig.properties
View file @
d5f8e0d5
dapr.upms.appUrl
=
http://
localhost
:3500/v1.0/invoke/
dapr.upms.appUrl
=
http://
yifu-upms.qas-mvp.svc.cluster.local
:3500/v1.0/invoke/
dapr.upms.appId
=
yifu-upms
dapr.upms.appId
=
yifu-upms
dapr.upms.appPort
=
4000
dapr.upms.appPort
=
4000
dapr.upms.httpPort
=
3500
dapr.upms.httpPort
=
3500
dapr.upms.grpcPort
=
52000
dapr.upms.grpcPort
=
52000
dapr.upms.metricsPort
=
9094
dapr.upms.metricsPort
=
9094
dapr.provider.appUrl
=
http://localhost:3500/v1.0/invoke/
dapr.provider.appId
=
provider-sider
dapr.provider.appPort
=
7001
dapr.provider.httpPort
=
3500
dapr.provider.grpcPort
=
52000
dapr.provider.metricsPort
=
9094
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/controller/DataAuthController.java
View file @
d5f8e0d5
...
@@ -22,6 +22,7 @@ import com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysDataAuthVO;
...
@@ -22,6 +22,7 @@ import com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysDataAuthVO;
import
com.yifu.cloud.plus.v1.yifu.admin.service.SysDataAuthService
;
import
com.yifu.cloud.plus.v1.yifu.admin.service.SysDataAuthService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
...
@@ -44,6 +45,12 @@ public class DataAuthController {
...
@@ -44,6 +45,12 @@ public class DataAuthController {
private
final
SysDataAuthService
sysDataAuthService
;
private
final
SysDataAuthService
sysDataAuthService
;
@Inner
@PostMapping
(
"/refreshAuth"
)
public
void
refreshAuth
(
@RequestBody
SysDataAuth
sysDataAuth
)
{
sysDataAuthService
.
refreshAuth
(
sysDataAuth
);
}
/**
/**
* @Description: 分页查询
* @Description: 分页查询
* @Author: hgw
* @Author: hgw
...
...
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/service/SysDataAuthService.java
View file @
d5f8e0d5
...
@@ -32,6 +32,8 @@ import java.util.List;
...
@@ -32,6 +32,8 @@ import java.util.List;
**/
**/
public
interface
SysDataAuthService
extends
IService
<
SysDataAuth
>
{
public
interface
SysDataAuthService
extends
IService
<
SysDataAuth
>
{
void
refreshAuth
(
SysDataAuth
sysDataAuth
);
/**
/**
* @Description: 分页查询
* @Description: 分页查询
* @Author: hgw
* @Author: hgw
...
...
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/service/impl/SysDataAuthServiceImpl.java
View file @
d5f8e0d5
...
@@ -62,6 +62,127 @@ public class SysDataAuthServiceImpl extends ServiceImpl<SysDataAuthMapper, SysDa
...
@@ -62,6 +62,127 @@ public class SysDataAuthServiceImpl extends ServiceImpl<SysDataAuthMapper, SysDa
// 缓存信息
// 缓存信息
private
final
CacheManager
cacheManager
;
private
final
CacheManager
cacheManager
;
/**
* @Description: 刷新缓存
* @Author: hgw
* @Date: 2022/6/20 17:59
* @return: void
**/
@Override
public
void
refreshAuth
(
SysDataAuth
sysDataAuth
)
{
List
<
SysDataAuth
>
authList
=
baseMapper
.
getSysDataAuthPage
(
sysDataAuth
);
if
(
authList
!=
null
&&
!
authList
.
isEmpty
())
{
sysDataAuth
=
authList
.
get
(
0
);
R
<
SysDataAuthVO
>
sysDataAuthVOR
=
this
.
getByMainId
(
sysDataAuth
.
getId
());
if
(
sysDataAuthVOR
!=
null
&&
sysDataAuthVOR
.
getData
()
!=
null
)
{
Cache
cache
=
cacheManager
.
getCache
(
CacheConstants
.
DATA_AUTH_DETAILS
+
sysDataAuth
.
getLinkType
());
if
(
cache
!=
null
)
{
this
.
refreshAuthCache
(
sysDataAuthVOR
.
getData
(),
sysDataAuth
,
cache
);
}
}
}
}
/**
* @Description: 刷新缓存-核心
* @Author: hgw
* @Date: 2022/6/20 17:56
* @return: void
**/
private
void
refreshAuthCache
(
SysDataAuthVO
sysDataAuthVO
,
SysDataAuth
sysDataAuth
,
Cache
cache
)
{
List
<
SysDataAuthDeptRel
>
authDeptList
=
sysDataAuthVO
.
getAuthDeptList
();
List
<
SysDataAuthDiySql
>
authSqlList
=
sysDataAuthVO
.
getAuthSqlList
();
// 类型:1:创建人;2:结算主体;3部门
List
<
SysDataAuthMenuRel
>
menuCreateList
=
sysDataAuthVO
.
getMenuCreateList
();
List
<
SysDataAuthMenuRel
>
menuSettleList
=
sysDataAuthVO
.
getMenuSettleList
();
List
<
SysDataAuthMenuRel
>
menuDeptList
=
sysDataAuthVO
.
getMenuDeptList
();
// 存储sql的map,用作缓存 键:linkId + CommonConstants.DOWN_LINE_STRING + menu.getMenuId()
Map
<
String
,
String
>
authSqlMap
=
new
HashMap
<>();
StringBuilder
sql
=
new
StringBuilder
();
String
mapSql
;
StringBuilder
nowMapSql
;
// Map里的Key
String
linkId
=
sysDataAuth
.
getLinkId
();
// 处理权限部门
if
(
sysDataAuth
.
getIsDeptAuth
()
==
1
||
sysDataAuth
.
getIsDeptAuth
()
==
2
)
{
if
(
sysDataAuth
.
getIsDeptAuth
()
==
2
)
{
sql
.
append
(
" or dept.dept_id in ('0' "
);
for
(
SysDataAuthDeptRel
dept
:
authDeptList
)
{
sql
.
append
(
", '"
).
append
(
dept
.
getDeptId
()).
append
(
"'"
);
}
sql
.
append
(
")"
);
}
else
{
sql
.
append
(
" or dept.dept_id = #deptId "
);
}
for
(
SysDataAuthMenuRel
menu
:
menuDeptList
)
{
authSqlMap
.
put
(
linkId
+
CommonConstants
.
DOWN_LINE_STRING
+
menu
.
getMenuId
(),
sql
.
toString
());
}
}
String
nowSql
;
// 处理创建人
if
(
menuCreateList
!=
null
&&
!
menuCreateList
.
isEmpty
())
{
nowSql
=
" or a.create_by = #create_by "
;
for
(
SysDataAuthMenuRel
menu
:
menuCreateList
)
{
mapSql
=
authSqlMap
.
get
(
linkId
+
CommonConstants
.
DOWN_LINE_STRING
+
menu
.
getMenuId
());
if
(!
Common
.
isEmpty
(
mapSql
))
{
nowMapSql
=
new
StringBuilder
(
nowSql
).
append
(
mapSql
);
}
else
{
nowMapSql
=
new
StringBuilder
(
nowSql
);
}
authSqlMap
.
put
(
linkId
+
CommonConstants
.
DOWN_LINE_STRING
+
menu
.
getMenuId
(),
nowMapSql
.
toString
());
}
}
// 处理结算主体
if
(
menuSettleList
!=
null
&&
!
menuSettleList
.
isEmpty
())
{
nowSql
=
" or a.settle_domain_id in ('0'#settleDomainId) "
;
sysDataAuth
.
setIsSettleAuth
(
1
);
for
(
SysDataAuthMenuRel
menu
:
menuSettleList
)
{
mapSql
=
authSqlMap
.
get
(
linkId
+
CommonConstants
.
DOWN_LINE_STRING
+
menu
.
getMenuId
());
if
(!
Common
.
isEmpty
(
mapSql
))
{
nowMapSql
=
new
StringBuilder
(
nowSql
).
append
(
mapSql
);
}
else
{
nowMapSql
=
new
StringBuilder
(
nowSql
);
}
authSqlMap
.
put
(
linkId
+
CommonConstants
.
DOWN_LINE_STRING
+
menu
.
getMenuId
(),
nowMapSql
.
toString
());
}
}
// 处理自定义sql
if
(
authSqlList
!=
null
&&
!
authSqlList
.
isEmpty
())
{
List
<
SysDiySqlMenuRel
>
menuSqlList
;
for
(
SysDataAuthDiySql
sqls
:
authSqlList
)
{
nowSql
=
sqls
.
getDiySql
();
menuSqlList
=
sqls
.
getSqlMenuList
();
if
(
menuSqlList
!=
null
&&
!
menuSqlList
.
isEmpty
())
{
for
(
SysDiySqlMenuRel
menuSql
:
menuSqlList
)
{
mapSql
=
authSqlMap
.
get
(
linkId
+
CommonConstants
.
DOWN_LINE_STRING
+
menuSql
.
getMenuId
());
if
(!
Common
.
isEmpty
(
mapSql
))
{
nowMapSql
=
new
StringBuilder
(
nowSql
).
append
(
mapSql
);
}
else
{
nowMapSql
=
new
StringBuilder
(
nowSql
);
}
authSqlMap
.
put
(
linkId
+
CommonConstants
.
DOWN_LINE_STRING
+
menuSql
.
getMenuId
(),
nowMapSql
.
toString
());
}
}
}
}
// 更新缓存
// 缓存里放入 id_菜单id, sql
if
(!
authSqlMap
.
isEmpty
())
{
// 前缀
String
prefix
=
" and (1=1 "
;
// 后缀
String
suffix
=
" ) "
;
for
(
Map
.
Entry
<
String
,
String
>
authSql
:
authSqlMap
.
entrySet
())
{
cache
.
put
(
authSql
.
getKey
(),
prefix
+
authSql
.
getValue
()
+
suffix
);
}
}
}
/**
/**
* @Description: 分页查询
* @Description: 分页查询
* @Author: hgw
* @Author: hgw
...
@@ -231,7 +352,7 @@ public class SysDataAuthServiceImpl extends ServiceImpl<SysDataAuthMapper, SysDa
...
@@ -231,7 +352,7 @@ public class SysDataAuthServiceImpl extends ServiceImpl<SysDataAuthMapper, SysDa
// 处理结算主体
// 处理结算主体
if
(
menuSettleList
!=
null
&&
!
menuSettleList
.
isEmpty
())
{
if
(
menuSettleList
!=
null
&&
!
menuSettleList
.
isEmpty
())
{
nowSql
=
" or a.settle
DomainI
d in ('0'#settleDomainId) "
;
nowSql
=
" or a.settle
_domain_i
d in ('0'#settleDomainId) "
;
sysDataAuth
.
setIsSettleAuth
(
1
);
sysDataAuth
.
setIsSettleAuth
(
1
);
for
(
SysDataAuthMenuRel
menu
:
menuSettleList
)
{
for
(
SysDataAuthMenuRel
menu
:
menuSettleList
)
{
mapSql
=
authSqlMap
.
get
(
linkId
+
CommonConstants
.
DOWN_LINE_STRING
+
menu
.
getMenuId
());
mapSql
=
authSqlMap
.
get
(
linkId
+
CommonConstants
.
DOWN_LINE_STRING
+
menu
.
getMenuId
());
...
...
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