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
7ebdd490
Commit
7ebdd490
authored
Sep 13, 2022
by
fangxinjiang
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop' into develop
parents
41c91056
577c1cb3
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
125 additions
and
62 deletions
+125
-62
TEmployeeInfoController.java
.../v1/yifu/archives/controller/TEmployeeInfoController.java
+6
-59
TEmployeeInfoMapper.xml
...ves-biz/src/main/resources/mapper/TEmployeeInfoMapper.xml
+3
-1
pom.xml
yifu-common/yifu-common-dapr/pom.xml
+4
-1
MenuUtil.java
...om/yifu/cloud/plus/v1/yifu/common/dapr/util/MenuUtil.java
+96
-0
spring.factories
...-common-dapr/src/main/resources/META-INF/spring.factories
+1
-0
BaseEntity.java
...fu.cloud.plus.v1/yifu/common/mybatis/base/BaseEntity.java
+14
-0
TSalaryAccountMapper.xml
...ry-biz/src/main/resources/mapper/TSalaryAccountMapper.xml
+1
-1
No files found.
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/controller/TEmployeeInfoController.java
View file @
7ebdd490
...
...
@@ -32,7 +32,9 @@ 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.dapr.util.MenuUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity
;
import
com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner
;
import
com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils
;
import
io.swagger.v3.oas.annotations.Operation
;
...
...
@@ -70,6 +72,7 @@ public class TEmployeeInfoController {
// 缓存信息
private
final
CacheManager
cacheManager
;
private
final
MenuUtil
menuUtil
;
private
final
DaprUpmsProperties
daprUpmsProperties
;
...
...
@@ -87,66 +90,10 @@ public class TEmployeeInfoController {
if
(
user
==
null
||
Common
.
isEmpty
(
user
.
getId
()))
{
return
R
.
failed
(
CommonConstants
.
PLEASE_LOG_IN
);
}
// 普通用户:
if
(
CommonConstants
.
ONE_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
.
isNotNull
(
obj
))
{
SimpleValueWrapper
objs
=
(
SimpleValueWrapper
)
obj
;
if
(
objs
!=
null
)
{
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
));
}
}
if
(
Common
.
isEmpty
(
tEmployeeInfo
.
getMId
()))
{
tEmployeeInfo
.
setMId
(
"1536922631616278529"
);
}
menuUtil
.
setAuthSql
(
user
,
tEmployeeInfo
);
return
R
.
ok
(
tEmployeeInfoService
.
getPage
(
page
,
tEmployeeInfo
,
null
));
}
...
...
yifu-archives/yifu-archives-biz/src/main/resources/mapper/TEmployeeInfoMapper.xml
View file @
7ebdd490
...
...
@@ -493,7 +493,9 @@
from t_employee_info a
where a.DELETE_FLAG = '0'
<include
refid=
"employeeInfo_where"
/>
${sql}
<if
test=
"tEmployeeInfo.authSql != null and tEmployeeInfo.authSql.trim() != ''"
>
${tEmployeeInfo.authSql}
</if>
order by a.CREATE_TIME desc
</select>
...
...
yifu-common/yifu-common-dapr/pom.xml
View file @
7ebdd490
...
...
@@ -12,7 +12,10 @@
<artifactId>
yifu-common-dapr
</artifactId>
<packaging>
jar
</packaging>
<dependencies>
<dependency>
<groupId>
com.yifu.cloud.plus.v1
</groupId>
<artifactId>
yifu-common-mybatis
</artifactId>
</dependency>
<dependency>
<groupId>
com.yifu.cloud.plus.v1
</groupId>
<artifactId>
yifu-upms-api
</artifactId>
...
...
yifu-common/yifu-common-dapr/src/main/java/com/yifu/cloud/plus/v1/yifu/common/dapr/util/MenuUtil.java
0 → 100644
View file @
7ebdd490
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
common
.
dapr
.
util
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDataAuth
;
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.vo.YifuUser
;
import
com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprUpmsProperties
;
import
com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.cache.Cache
;
import
org.springframework.cache.CacheManager
;
import
org.springframework.cache.support.SimpleValueWrapper
;
/**
* @author hgw
* 2022-9-13 16:14:34
* @Description 公共获取菜单权限的工具
*/
@EnableConfigurationProperties
({
DaprUpmsProperties
.
class
})
@RequiredArgsConstructor
@Slf4j
public
class
MenuUtil
{
// 缓存信息
private
final
CacheManager
cacheManager
;
private
final
DaprUpmsProperties
daprUpmsProperties
;
private
final
String
DEPT
=
"#deptId"
;
public
void
setAuthSql
(
YifuUser
user
,
BaseEntity
entity
)
{
// 普通用户:
if
(
CommonConstants
.
ONE_STRING
.
equals
(
user
.
getSystemFlag
()))
{
// 菜单id
String
menuId
=
entity
.
getMId
();
if
(
Common
.
isNotNull
(
menuId
))
{
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
,
SysDataAuth
.
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
,
SysDataAuth
.
class
,
SecurityConstants
.
FROM_IN
);
obj
=
cache
.
get
(
linkId
+
CommonConstants
.
DOWN_LINE_STRING
+
menuId
);
}
}
}
}
}
if
(
Common
.
isNotNull
(
obj
))
{
SimpleValueWrapper
objs
=
(
SimpleValueWrapper
)
obj
;
if
(
objs
!=
null
)
{
String
sql
=
String
.
valueOf
(
objs
.
get
());
if
(
sql
.
contains
(
DEPT
))
{
entity
.
setIsDept
(
CommonConstants
.
ONE_INT
);
}
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
(
DEPT
))
{
sql
=
sql
.
replace
(
DEPT
,
String
.
valueOf
(
user
.
getDeptId
()));
//sql = sql.replace(" or dept.dept_id = #deptId ", "")
}
entity
.
setAuthSql
(
sql
);
}
}
}
}
}
}
yifu-common/yifu-common-dapr/src/main/resources/META-INF/spring.factories
View file @
7ebdd490
...
...
@@ -3,4 +3,5 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.yifu.cloud.plus.v1.yifu.common.dapr.util.UpmsDaprUtils,\
com.yifu.cloud.plus.v1.yifu.common.dapr.util.CheckDaprUtil,\
com.yifu.cloud.plus.v1.yifu.common.dapr.util.SocialDaprUtils,\
com.yifu.cloud.plus.v1.yifu.common.dapr.util.MenuUtil,\
com.yifu.cloud.plus.v1.yifu.common.dapr.util.SalaryDaprUtil
yifu-common/yifu-common-mybatis/src/main/java/com/yifu.cloud.plus.v1/yifu/common/mybatis/base/BaseEntity.java
View file @
7ebdd490
...
...
@@ -70,4 +70,18 @@ public class BaseEntity implements Serializable {
@TableField
(
exist
=
false
)
private
String
mId
;
/**
* 是否关联部门表;0否;1是
*/
@TableField
(
exist
=
false
)
@ExcelIgnore
private
Integer
isDept
;
/**
* 权限sql
*/
@TableField
(
exist
=
false
)
@ExcelIgnore
private
String
authSql
;
}
yifu-salary/yifu-salary-biz/src/main/resources/mapper/TSalaryAccountMapper.xml
View file @
7ebdd490
...
...
@@ -472,7 +472,7 @@
,'' fd_3adfee1ff1ca6a
,'' fd_3adfee203f86b2
,ifnull(a.ACTUAL_SALARY,'0') fd_3adfee20fe5ba4
,
''
fd_3adfee21802434
,
ifnull(a.RELAY_SALARY,'0') - ifnull(ifnull(withholidingPersonSocial.SALARY_MONEY,personalSocial.SALARY_MONEY),'0') - ifnull(ifnull(withholidingPersonFund.SALARY_MONEY,personalFund.SALARY_MONEY),'')
fd_3adfee21802434
,'' fd_3adfee4ba5ad36
,'' fd_3adfee4c0c59ee
,'' fd_3adfee5dd14866
...
...
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