Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
Overview
Overview
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
haoban3.0
haoban-manage3.0
Commits
6c52c4c5
Commit
6c52c4c5
authored
Apr 01, 2025
by
王祖波
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature-recommend' into 'developer'
抽取校验服务 See merge request
!2736
parents
49f441c9
b63e0d35
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
33 deletions
+20
-33
EnterpriseAdaptor.java
...ge/service/service/content/adaptor/EnterpriseAdaptor.java
+15
-12
MallOrderStatusChangeApiServiceImpl.java
...out/impl/content/MallOrderStatusChangeApiServiceImpl.java
+5
-21
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/content/adaptor/EnterpriseAdaptor.java
View file @
6c52c4c5
...
@@ -3,9 +3,11 @@ package com.gic.haoban.manage.service.service.content.adaptor;
...
@@ -3,9 +3,11 @@ package com.gic.haoban.manage.service.service.content.adaptor;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.enterprise.api.constant.EnterpriseServiceEnum
;
import
com.gic.enterprise.api.constant.EnterpriseServiceEnum
;
import
com.gic.enterprise.api.dto.EnterpriseUsingPermissionDto
;
import
com.gic.enterprise.api.dto.enterprise.EnterpriseUsingStatusDTO
;
import
com.gic.enterprise.api.dto.enterprise.EnterpriseUsingStatusDTO
;
import
com.gic.enterprise.api.service.EnterpriseUseForbidService
;
import
com.gic.enterprise.api.service.EnterpriseUseForbidService
;
import
com.gic.redis.data.util.RedisUtil
;
import
com.gic.redis.data.util.RedisUtil
;
import
com.google.common.collect.Lists
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -124,23 +126,24 @@ public class EnterpriseAdaptor {
...
@@ -124,23 +126,24 @@ public class EnterpriseAdaptor {
}
}
public
boolean
checkEnterpriseHasRight
(
String
enterpriseId
,
String
rightMenuCode
)
{
public
boolean
checkEnterpriseHasRight
(
String
enterpriseId
,
String
rightMenuCode
)
{
String
key
=
"haoban_enterprise_menuCode:"
+
enterpriseId
;
return
checkEnterpriseHasRights
(
enterpriseId
,
Lists
.
newArrayList
(
rightMenuCode
));
}
public
boolean
checkEnterpriseHasRights
(
String
enterpriseId
,
List
<
String
>
rightMenuCodes
)
{
String
key
=
"haoban_enterprise_menuCode:"
+
enterpriseId
+
":"
+
String
.
join
(
":"
,
rightMenuCodes
);
String
cache
=
RedisUtil
.
getCache
(
key
,
String
.
class
);
String
cache
=
RedisUtil
.
getCache
(
key
,
String
.
class
);
if
(
StringUtils
.
isBlank
(
cache
))
{
if
(
StringUtils
.
isBlank
(
cache
))
{
cache
=
"0"
;
List
<
EnterpriseUsingPermissionDto
>
list
=
enterpriseUseForbidService
.
selectUsingEnterprisePermissionByEnterpriseId
(
enterpriseId
);
ServiceResponse
<
List
<
EnterpriseUsingStatusDTO
>>
tempServiceResponse
=
enterpriseUseForbidService
.
getUseEnterpriseByCode
(
rightMenuCode
,
enterpriseId
);
if
(
CollectionUtils
.
isEmpty
(
list
))
{
if
(!
tempServiceResponse
.
isSuccess
()
||
CollectionUtils
.
isEmpty
(
tempServiceResponse
.
getResult
()))
{
log
.
info
(
"企业 {} 没有{}权限"
,
enterpriseId
,
rightMenuCode
);
RedisUtil
.
setCache
(
key
,
cache
,
cache_hour_sec
,
TimeUnit
.
SECONDS
);
return
false
;
return
false
;
}
}
EnterpriseUsingStatusDTO
enterpriseUsingStatusDTO
=
tempServiceResponse
.
getResult
().
get
(
0
);
List
<
String
>
hasList
=
list
.
stream
().
map
(
EnterpriseUsingPermissionDto:
:
getRightMenuCode
).
collect
(
Collectors
.
toList
());
if
(!
Boolean
.
TRUE
.
equals
(
enterpriseUsingStatusDTO
.
getVaild
()))
{
hasList
=
hasList
.
stream
().
filter
(
rightMenuCodes:
:
contains
).
collect
(
Collectors
.
toList
());
log
.
info
(
"企业 {} {}权限已失效"
,
enterpriseId
,
rightMenuCode
);
if
(
CollectionUtils
.
isEmpty
(
hasList
))
{
RedisUtil
.
setCache
(
key
,
cache
,
cache_hour_sec
,
TimeUnit
.
SECONDS
);
cache
=
"0"
;
return
false
;
}
else
{
cache
=
"1"
;
}
}
cache
=
"1"
;
RedisUtil
.
setCache
(
key
,
cache
,
cache_hour_sec
,
TimeUnit
.
SECONDS
);
RedisUtil
.
setCache
(
key
,
cache
,
cache_hour_sec
,
TimeUnit
.
SECONDS
);
}
}
return
StringUtils
.
equals
(
cache
,
"1"
);
return
StringUtils
.
equals
(
cache
,
"1"
);
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/content/MallOrderStatusChangeApiServiceImpl.java
View file @
6c52c4c5
...
@@ -30,6 +30,7 @@ import com.gic.haoban.manage.service.pojo.bo.content.InteractRecordBO;
...
@@ -30,6 +30,7 @@ import com.gic.haoban.manage.service.pojo.bo.content.InteractRecordBO;
import
com.gic.haoban.manage.service.pojo.bo.content.OrderEventMqBO
;
import
com.gic.haoban.manage.service.pojo.bo.content.OrderEventMqBO
;
import
com.gic.haoban.manage.service.pojo.bo.content.binlog.MemberOrderBo
;
import
com.gic.haoban.manage.service.pojo.bo.content.binlog.MemberOrderBo
;
import
com.gic.haoban.manage.service.pojo.bo.content.message.InteractRecordMessageBO
;
import
com.gic.haoban.manage.service.pojo.bo.content.message.InteractRecordMessageBO
;
import
com.gic.haoban.manage.service.service.content.adaptor.EnterpriseAdaptor
;
import
com.gic.haoban.manage.service.service.content.adaptor.InteractRecordBuilder
;
import
com.gic.haoban.manage.service.service.content.adaptor.InteractRecordBuilder
;
import
com.gic.haoban.manage.service.service.content.adaptor.WeekMonthDataAdaptor
;
import
com.gic.haoban.manage.service.service.content.adaptor.WeekMonthDataAdaptor
;
import
com.gic.haoban.manage.service.service.content.message.InteractRecordMessageService
;
import
com.gic.haoban.manage.service.service.content.message.InteractRecordMessageService
;
...
@@ -66,7 +67,7 @@ public class MallOrderStatusChangeApiServiceImpl implements MallOrderStatusChang
...
@@ -66,7 +67,7 @@ public class MallOrderStatusChangeApiServiceImpl implements MallOrderStatusChang
@Autowired
@Autowired
InteractRecordMessageService
interactRecordMessageService
;
InteractRecordMessageService
interactRecordMessageService
;
@Autowired
@Autowired
private
WeekMonthDataAdaptor
weekMonthData
Adaptor
;
private
EnterpriseAdaptor
enterprise
Adaptor
;
@Autowired
@Autowired
private
EnterpriseUseForbidService
enterpriseUseForbidService
;
private
EnterpriseUseForbidService
enterpriseUseForbidService
;
@Autowired
@Autowired
...
@@ -90,7 +91,6 @@ public class MallOrderStatusChangeApiServiceImpl implements MallOrderStatusChang
...
@@ -90,7 +91,6 @@ public class MallOrderStatusChangeApiServiceImpl implements MallOrderStatusChang
EnterpriseServiceEnum
.
CONTENT
.
getRightMenuCode
(),
EnterpriseServiceEnum
.
CONTENT
.
getRightMenuCode
(),
EnterpriseServiceEnum
.
GOODS_ANALYSIS
.
getRightMenuCode
()
EnterpriseServiceEnum
.
GOODS_ANALYSIS
.
getRightMenuCode
()
);
);
/***
/***
* 订单状态变更事件
* 订单状态变更事件
* @param params
* @param params
...
@@ -239,25 +239,9 @@ public class MallOrderStatusChangeApiServiceImpl implements MallOrderStatusChang
...
@@ -239,25 +239,9 @@ public class MallOrderStatusChangeApiServiceImpl implements MallOrderStatusChang
return
ServiceResponse
.
success
();
return
ServiceResponse
.
success
();
}
}
String
enterpriseId
=
memberOrderBo
.
getEnterpriseId
();
String
enterpriseId
=
memberOrderBo
.
getEnterpriseId
();
boolean
check
=
enterpriseAdaptor
.
checkEnterpriseHasRights
(
enterpriseId
,
rightCodeList
);
String
key
=
"haoban_enterprise_content_deal_weimob:"
+
enterpriseId
;
if
(!
check
)
{
String
cache
=
RedisUtil
.
getCache
(
key
,
String
.
class
);
log
.
info
(
"企业 {} 没有权限"
,
enterpriseId
);
if
(
StringUtils
.
isBlank
(
cache
))
{
List
<
EnterpriseUsingPermissionDto
>
list
=
enterpriseUseForbidService
.
selectUsingEnterprisePermissionByEnterpriseId
(
enterpriseId
);
if
(
CollectionUtils
.
isEmpty
(
list
))
{
return
ServiceResponse
.
success
();
}
List
<
String
>
hasList
=
list
.
stream
().
map
(
EnterpriseUsingPermissionDto:
:
getRightMenuCode
).
collect
(
Collectors
.
toList
());
hasList
=
hasList
.
stream
().
filter
(
rightCodeList:
:
contains
).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isEmpty
(
hasList
))
{
cache
=
"0"
;
}
else
{
cache
=
"1"
;
}
RedisUtil
.
setCache
(
key
,
cache
,
cache_hour_sec
,
TimeUnit
.
SECONDS
);
}
if
(!
StringUtils
.
equals
(
cache
,
"1"
))
{
log
.
info
(
"企业 {} 没有内容权限"
,
enterpriseId
);
return
ServiceResponse
.
success
();
return
ServiceResponse
.
success
();
}
}
...
...
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