Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
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
项目统一框架
amos-boot-biz
Commits
bcc0ebf2
Commit
bcc0ebf2
authored
Aug 16, 2023
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.校验
parent
25b5de69
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
95 additions
and
4 deletions
+95
-4
ControllerAop.java
...a/com/yeejoin/amos/boot/biz/common/aop/ControllerAop.java
+1
-0
PermissionOfUser.java
...amos/boot/module/ymt/biz/permission/PermissionOfUser.java
+78
-0
EquipmentCategoryServiceImpl.java
...le/ymt/biz/service/impl/EquipmentCategoryServiceImpl.java
+8
-4
RedisUtil.java
...com/yeejoin/amos/boot/module/ymt/biz/utils/RedisUtil.java
+8
-0
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/aop/ControllerAop.java
View file @
bcc0ebf2
...
@@ -102,6 +102,7 @@ public class ControllerAop {
...
@@ -102,6 +102,7 @@ public class ControllerAop {
urls
.
add
(
"^/tcm/flc-unit-info/verifyTelCode/[A-Za-z0-9]+/[A-Za-z0-9]+"
);
urls
.
add
(
"^/tcm/flc-unit-info/verifyTelCode/[A-Za-z0-9]+/[A-Za-z0-9]+"
);
urls
.
add
(
"^/tcm/flc-unit-info/hasExistUser/[A-Za-z0-9_-]+"
);
urls
.
add
(
"^/tcm/flc-unit-info/hasExistUser/[A-Za-z0-9_-]+"
);
urls
.
add
(
"/tcm/reg-unit-info/save"
);
urls
.
add
(
"/tcm/reg-unit-info/save"
);
urls
.
add
(
"/ymt/equipment-category/viewJgAll"
);
// 获取请求路径
// 获取请求路径
for
(
String
uri
:
urls
)
{
for
(
String
uri
:
urls
)
{
Pattern
p
=
Pattern
.
compile
(
uri
);
Pattern
p
=
Pattern
.
compile
(
uri
);
...
...
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-biz/src/main/java/com/yeejoin/amos/boot/module/ymt/biz/permission/PermissionOfUser.java
0 → 100644
View file @
bcc0ebf2
package
com
.
yeejoin
.
amos
.
boot
.
module
.
ymt
.
biz
.
permission
;
import
com.alibaba.fastjson.JSON
;
import
com.yeejoin.amos.boot.biz.common.bo.CompanyBo
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.module.ymt.biz.utils.RedisUtil
;
import
com.yeejoin.amos.component.feign.utils.FeignUtil
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
org.redisson.api.RLock
;
import
org.redisson.api.RedissonClient
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
javax.annotation.Resource
;
import
java.util.List
;
/**
* @author Administrator
*/
@Component
public
class
PermissionOfUser
{
@Autowired
RedissonClient
redissonClient
;
@Autowired
RedisUtil
redisUtil
;
private
static
final
String
LOCK_KEY
=
"PERMISSION_SET_KEY"
;
public
ReginParams
getSelectedOrgInfo
()
{
ReginParams
reginParams
=
new
ReginParams
();
String
userId
=
RequestContext
.
getExeUserId
();
String
prefix
=
"REGIN_PARAM_"
+
userId
+
"_"
;
String
reginParamKey
=
prefix
+
RequestContext
.
getToken
();
if
(
redisUtil
.
hasKey
(
reginParamKey
))
{
reginParams
=
JSON
.
parseObject
(
redisUtil
.
get
(
reginParamKey
).
toString
(),
ReginParams
.
class
);
}
else
{
RLock
lock
=
redissonClient
.
getLock
(
LOCK_KEY
);
try
{
lock
.
lock
();
if
(
redisUtil
.
hasKey
(
reginParamKey
))
{
reginParams
=
JSON
.
parseObject
(
redisUtil
.
get
(
reginParamKey
).
toString
(),
ReginParams
.
class
);
}
else
{
this
.
deleteOldKey
(
prefix
);
List
<
CompanyModel
>
companyModels
=
FeignUtil
.
remoteCall
(()
->
Privilege
.
companyClient
.
queryListByChild
(
userId
));
if
(
companyModels
!=
null
&&
!
companyModels
.
isEmpty
())
{
CompanyBo
companyBo
=
new
CompanyBo
();
Bean
.
copyExistPropertis
(
companyModels
.
get
(
0
),
companyBo
);
AgencyUserModel
agencyUserModel
=
new
AgencyUserModel
();
agencyUserModel
.
setUserId
(
userId
);
agencyUserModel
.
setCompanys
(
companyModels
);
reginParams
.
setCompany
(
companyBo
);
reginParams
.
setUserModel
(
agencyUserModel
);
redisUtil
.
set
(
reginParamKey
,
JSON
.
toJSONString
(
reginParams
),
24
*
60
*
60L
);
}
}
}
finally
{
lock
.
unlock
();
}
}
return
reginParams
;
}
/**
* 删除redis 里面登录过期的key
* @param prefix redis前缀
*/
private
void
deleteOldKey
(
String
prefix
)
{
redisUtil
.
getAndDeletePatternKeys
(
prefix
+
"*"
);
}
}
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-biz/src/main/java/com/yeejoin/amos/boot/module/ymt/biz/service/impl/EquipmentCategoryServiceImpl.java
View file @
bcc0ebf2
...
@@ -20,6 +20,7 @@ import com.yeejoin.amos.boot.module.ymt.api.service.IEquipmentCategoryService;
...
@@ -20,6 +20,7 @@ import com.yeejoin.amos.boot.module.ymt.api.service.IEquipmentCategoryService;
import
com.yeejoin.amos.boot.module.ymt.api.vo.EquipExportVo
;
import
com.yeejoin.amos.boot.module.ymt.api.vo.EquipExportVo
;
import
com.yeejoin.amos.boot.module.ymt.biz.dao.ESEquipmentCategory
;
import
com.yeejoin.amos.boot.module.ymt.biz.dao.ESEquipmentCategory
;
import
com.yeejoin.amos.boot.module.ymt.biz.permission.PermissionOfUser
;
import
com.yeejoin.amos.boot.module.ymt.biz.utils.JsonUtils
;
import
com.yeejoin.amos.boot.module.ymt.biz.utils.JsonUtils
;
import
com.yeejoin.amos.boot.module.ymt.flc.api.feign.IdxFeignService
;
import
com.yeejoin.amos.boot.module.ymt.flc.api.feign.IdxFeignService
;
import
com.yeejoin.amos.boot.module.ymt.flc.api.feign.PrivilegeFeginService
;
import
com.yeejoin.amos.boot.module.ymt.flc.api.feign.PrivilegeFeginService
;
...
@@ -121,6 +122,11 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
...
@@ -121,6 +122,11 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
@Autowired
@Autowired
private
RedisUtils
redisUtils
;
private
RedisUtils
redisUtils
;
@Autowired
PermissionOfUser
permissionOfUser
;
//管辖机构redis缓存key
//管辖机构redis缓存key
private
static
final
String
REGULATOR_UNIT_TREE
=
"REGULATOR_UNIT_TREE"
;
private
static
final
String
REGULATOR_UNIT_TREE
=
"REGULATOR_UNIT_TREE"
;
//行政区划redis缓存key
//行政区划redis缓存key
...
@@ -591,10 +597,8 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
...
@@ -591,10 +597,8 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
public
List
<
JSONObject
>
getCompanyType
()
{
public
List
<
JSONObject
>
getCompanyType
()
{
ReginParams
reginParams
=
permissionOfUser
.
getSelectedOrgInfo
();
ReginParams
reginParams
=
JSON
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
List
<
CompanyModel
>
companys
=
reginParams
.
getUserModel
().
getCompanys
();
List
<
CompanyModel
>
companys
=
reginParams
.
getUserModel
().
getCompanys
();
List
<
JSONObject
>
objectList
=
new
ArrayList
<>();
List
<
JSONObject
>
objectList
=
new
ArrayList
<>();
for
(
CompanyModel
company
:
companys
)
{
for
(
CompanyModel
company
:
companys
)
{
JSONObject
object
=
new
JSONObject
();
JSONObject
object
=
new
JSONObject
();
...
@@ -1245,7 +1249,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
...
@@ -1245,7 +1249,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
}
}
public
Page
<
JSONObject
>
queryByKeys
(
JSONObject
map
)
{
public
Page
<
JSONObject
>
queryByKeys
(
JSONObject
map
)
{
//
//根据当前登录人查询
//根据当前登录人查询
if
(!
ValidationUtil
.
isEmpty
(
map
.
get
(
EQUSTATE
)))
{
if
(!
ValidationUtil
.
isEmpty
(
map
.
get
(
EQUSTATE
)))
{
map
.
put
(
EQUSTATE
,
EquimentEnum
.
getCode
.
get
(
map
.
get
(
EQUSTATE
).
toString
()).
toString
());
map
.
put
(
EQUSTATE
,
EquimentEnum
.
getCode
.
get
(
map
.
get
(
EQUSTATE
).
toString
()).
toString
());
}
}
...
...
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-biz/src/main/java/com/yeejoin/amos/boot/module/ymt/biz/utils/RedisUtil.java
View file @
bcc0ebf2
...
@@ -565,4 +565,12 @@ public class RedisUtil {
...
@@ -565,4 +565,12 @@ public class RedisUtil {
return
0
;
return
0
;
}
}
}
}
public
Long
getAndDeletePatternKeys
(
String
pattern
)
{
Set
<
String
>
keys
=
redisTemplate
.
keys
(
pattern
);
if
(!
CollectionUtils
.
isEmpty
(
keys
))
{
return
redisTemplate
.
delete
(
keys
);
}
return
null
;
}
}
}
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