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
809838a8
Commit
809838a8
authored
Jun 01, 2022
by
墨竹
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:门店权限所有门店返回-1
parent
6be234b3
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
131 additions
and
24 deletions
+131
-24
StaffApiService.java
...va/com/gic/haoban/manage/api/service/StaffApiService.java
+13
-1
TabHaobanStoreRelationMapper.java
...nage/service/dao/mapper/TabHaobanStoreRelationMapper.java
+15
-0
StoreRangeService.java
.../gic/haoban/manage/service/service/StoreRangeService.java
+11
-0
StoreRangeServiceImpl.java
...an/manage/service/service/impl/StoreRangeServiceImpl.java
+5
-0
StaffApiServiceImpl.java
.../manage/service/service/out/impl/StaffApiServiceImpl.java
+78
-23
TabHaobanStoreRelationMapper.xml
...rc/main/resources/mapper/TabHaobanStoreRelationMapper.xml
+9
-0
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/StaffApiService.java
View file @
809838a8
...
...
@@ -250,7 +250,7 @@ public interface StaffApiService {
/**
* 导购gic门店和好办企业门店交集
*
超管返回所有门店
*
所有门店返回所有门店列表
*
* @param clerkId 职员id
* @param wxEnterpriseId wx企业标识
...
...
@@ -260,6 +260,18 @@ public interface StaffApiService {
*/
List
<
String
>
getHaoBanStoreRolesByClerkId
(
String
clerkId
,
String
wxEnterpriseId
);
/**
* 导购gic门店和好办企业门店交集
* 所有门店返回 -1
*
* @param clerkId 职员id
* @param wxEnterpriseId wx企业标识
* @return {@link List }<{@link String }>
* @author mozhu
* @date 2022-06-01 11:04:40
*/
List
<
String
>
getHaoBanStoreIdsRolesByClerkId
(
String
clerkId
,
String
wxEnterpriseId
);
/**
* 门店筛选器id和好办企业门店交集
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/TabHaobanStoreRelationMapper.java
View file @
809838a8
...
...
@@ -104,4 +104,18 @@ public interface TabHaobanStoreRelationMapper {
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"enterpriseId"
)
String
enterpriseId
);
/**
* 查询所有门店分组id
*
* @param wxEnterpriseId wx企业标识
* @param enterpriseId 企业标识
* @return {@link List }<{@link String }>
* @author mozhu
* @date 2022-06-01 10:34:17
*/
List
<
String
>
listStoreGroupIdByWxEnterpriseId
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"enterpriseId"
)
String
enterpriseId
);
}
\ No newline at end of file
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/StoreRangeService.java
View file @
809838a8
...
...
@@ -118,4 +118,15 @@ public interface StoreRangeService {
*/
boolean
isFlagByStoreId
(
String
storeId
,
String
wxEnterpriseId
,
String
enterpriseId
);
/**
* 查询所有门店分组id
*
* @param wxEnterpriseId wx企业标识
* @param enterpriseId 企业标识
* @return {@link List }<{@link String }>
* @author mozhu
* @date 2022-06-01 10:34:17
*/
List
<
String
>
listStoreGroupIdByWxEnterpriseId
(
String
wxEnterpriseId
,
String
enterpriseId
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/StoreRangeServiceImpl.java
View file @
809838a8
...
...
@@ -272,4 +272,9 @@ public class StoreRangeServiceImpl implements StoreRangeService {
List
<
String
>
storeIds
=
tabHaobanStoreRelationMapper
.
listStoreIdByStoreIdWxEnterpriseId
(
storeId
,
wxEnterpriseId
,
enterpriseId
);
return
CollectionUtils
.
isNotEmpty
(
storeIds
);
}
@Override
public
List
<
String
>
listStoreGroupIdByWxEnterpriseId
(
String
wxEnterpriseId
,
String
enterpriseId
)
{
return
tabHaobanStoreRelationMapper
.
listStoreGroupIdByWxEnterpriseId
(
wxEnterpriseId
,
enterpriseId
);
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/StaffApiServiceImpl.java
View file @
809838a8
...
...
@@ -23,6 +23,7 @@ import com.gic.enterprise.api.service.StoreWidgetService;
import
com.gic.haoban.base.api.common.BasePageInfo
;
import
com.gic.haoban.base.api.common.ServiceResponse
;
import
com.gic.haoban.common.utils.PageUtil
;
import
com.gic.haoban.common.utils.RolesListUtils
;
import
com.gic.haoban.common.utils.StringUtil
;
import
com.gic.haoban.common.utils.UuidUtil
;
import
com.gic.haoban.manage.api.dto.*
;
...
...
@@ -30,7 +31,6 @@ import com.gic.haoban.manage.api.enums.SecretTypeEnum;
import
com.gic.haoban.manage.api.service.StaffApiService
;
import
com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper
;
import
com.gic.haoban.manage.service.dao.mapper.StaffMapper
;
import
com.gic.haoban.manage.service.dao.mapper.WxEnterpriseRelatedMapper
;
import
com.gic.haoban.manage.service.entity.*
;
import
com.gic.haoban.manage.service.service.*
;
import
com.gic.haoban.manage.service.util.EmojiFilterUtil
;
...
...
@@ -44,7 +44,7 @@ import com.github.pagehelper.PageHelper;
import
com.github.pagehelper.PageInfo
;
import
com.google.common.collect.Sets
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang
3
.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -1297,14 +1297,16 @@ public class StaffApiServiceImpl implements StaffApiService {
@Override
public
List
<
String
>
getHaoBanStoreRolesByClerkId
(
String
clerkId
,
String
wxEnterpriseId
)
{
if
(
StringUtils
.
isBlank
(
clerkId
)
||
StringUtils
.
isBlank
(
wxEnterpriseId
))
{
logger
.
info
(
"参数为空clerkId={},wxEid={}"
,
clerkId
,
wxEnterpriseId
);
logger
.
info
(
"查询导购权限,clerkId={},wxEnterpriseId={}"
,
clerkId
,
wxEnterpriseId
);
if
(
StringUtils
.
isAnyBlank
(
clerkId
,
wxEnterpriseId
))
{
logger
.
info
(
"参数为空clerkId={},wxEnterpriseId={}"
,
clerkId
,
wxEnterpriseId
);
return
Collections
.
emptyList
();
}
String
cacheKey
=
"hb:clerk:store:"
+
clerkId
+
wxEnterpriseId
;
Object
cache
=
RedisUtil
.
getCache
(
cacheKey
)
;
String
cacheKey
=
"hb:clerk:store:"
+
clerkId
+
wxEnterpriseId
;
Object
cache
=
RedisUtil
.
getCache
(
cacheKey
);
if
(
cache
!=
null
)
{
logger
.
info
(
"从缓存中获取通道={},{}"
,
cacheKey
,
JSON
.
toJSONString
(
cache
));
logger
.
info
(
"从缓存中获取通道={},{}"
,
cacheKey
,
JSON
.
toJSONString
(
cache
));
return
(
List
<
String
>)
cache
;
}
ClerkDTO
clerkDTO
=
clerkService
.
getClerkByClerkId
(
clerkId
);
...
...
@@ -1312,9 +1314,10 @@ public class StaffApiServiceImpl implements StaffApiService {
logger
.
info
(
"导购不存在:clerkId:{}"
,
clerkId
);
return
Collections
.
emptyList
();
}
List
<
String
>
enterpriseIdStoreIds
=
storeRangeService
.
listStoreIdByWxEnterpriseId
(
wxEnterpriseId
,
clerkDTO
.
getEnterpriseId
());
if
(
CollectionUtils
.
isEmpty
(
enterpriseIdStoreIds
))
{
logger
.
info
(
"好办门店空,eid={}"
,
clerkDTO
.
getEnterpriseId
());
String
enterpriseId
=
clerkDTO
.
getEnterpriseId
();
List
<
String
>
enterpriseIdStoreIds
=
storeRangeService
.
listStoreIdByWxEnterpriseId
(
wxEnterpriseId
,
enterpriseId
);
if
(
CollectionUtils
.
isEmpty
(
enterpriseIdStoreIds
))
{
logger
.
info
(
"好办门店空,eid={}"
,
enterpriseId
);
return
Collections
.
emptyList
();
}
logger
.
info
(
"好办门店id数量:{}"
,
enterpriseIdStoreIds
.
size
());
...
...
@@ -1324,16 +1327,70 @@ public class StaffApiServiceImpl implements StaffApiService {
return
Collections
.
emptyList
();
}
if
(
gicStoreIds
.
contains
(
"-1"
))
{
//gic管理员返回好办企业
RedisUtil
.
setCache
(
cacheKey
,
enterpriseIdStoreIds
,
10L
,
TimeUnit
.
MINUTES
);
logger
.
info
(
"gic超管,clerkId:{}"
,
clerkId
);
RedisUtil
.
setCache
(
cacheKey
,
enterpriseIdStoreIds
,
10L
,
TimeUnit
.
MINUTES
);
return
enterpriseIdStoreIds
;
}
logger
.
info
(
"gic门店数量:{}"
,
gicStoreIds
.
size
());
//取交集
Sets
.
SetView
<
String
>
intersection
=
Sets
.
intersection
(
Sets
.
newHashSet
(
enterpriseIdStoreIds
),
Sets
.
newHashSet
(
gicStoreIds
));
List
<
String
>
storeList
=
intersection
.
stream
().
collect
(
Collectors
.
toList
());
List
<
String
>
storeList
=
RolesListUtils
.
mergeList
(
enterpriseIdStoreIds
,
gicStoreIds
);
logger
.
info
(
"该导购权限:clerkId:{},门店数量:{}"
,
clerkId
,
storeList
.
size
());
RedisUtil
.
setCache
(
cacheKey
,
storeList
,
10L
,
TimeUnit
.
MINUTES
);
RedisUtil
.
setCache
(
cacheKey
,
storeList
,
10L
,
TimeUnit
.
MINUTES
);
return
storeList
;
}
@Override
public
List
<
String
>
getHaoBanStoreIdsRolesByClerkId
(
String
clerkId
,
String
wxEnterpriseId
)
{
logger
.
info
(
"查询导购权限,clerkId={},wxEnterpriseId={}"
,
clerkId
,
wxEnterpriseId
);
if
(
StringUtils
.
isAnyBlank
(
clerkId
,
wxEnterpriseId
))
{
logger
.
info
(
"参数为空clerkId={},wxEnterpriseId={}"
,
clerkId
,
wxEnterpriseId
);
return
Collections
.
emptyList
();
}
String
cacheKey
=
"hb:clerk:store:"
+
clerkId
+
wxEnterpriseId
;
Object
cache
=
RedisUtil
.
getCache
(
cacheKey
);
if
(
cache
!=
null
)
{
logger
.
info
(
"从缓存中获取通道={},{}"
,
cacheKey
,
JSON
.
toJSONString
(
cache
));
return
(
List
<
String
>)
cache
;
}
ClerkDTO
clerkDTO
=
clerkService
.
getClerkByClerkId
(
clerkId
);
if
(
clerkDTO
==
null
)
{
logger
.
info
(
"导购不存在:clerkId:{}"
,
clerkId
);
return
Collections
.
emptyList
();
}
String
enterpriseId
=
clerkDTO
.
getEnterpriseId
();
List
<
String
>
enterpriseIdStoreIds
=
storeRangeService
.
listStoreIdByWxEnterpriseId
(
wxEnterpriseId
,
enterpriseId
);
if
(
CollectionUtils
.
isEmpty
(
enterpriseIdStoreIds
))
{
logger
.
info
(
"好办门店空,eid={}"
,
enterpriseId
);
return
Collections
.
emptyList
();
}
logger
.
info
(
"好办门店id数量:{}"
,
enterpriseIdStoreIds
.
size
());
List
<
String
>
gicStoreIds
=
getStoreIdList
(
clerkDTO
);
if
(
CollectionUtils
.
isEmpty
(
gicStoreIds
))
{
logger
.
info
(
"gic门店为空"
);
return
Collections
.
emptyList
();
}
if
(
gicStoreIds
.
contains
(
"-1"
))
{
logger
.
info
(
"gic超管,clerkId:{}"
,
clerkId
);
List
<
String
>
storeGroupIds
=
storeRangeService
.
listStoreGroupIdByWxEnterpriseId
(
wxEnterpriseId
,
enterpriseId
);
if
(
CollectionUtils
.
isEmpty
(
storeGroupIds
))
{
logger
.
info
(
"好办门店分组id为空"
);
return
Collections
.
emptyList
();
}
String
[]
array
=
storeGroupIds
.
toArray
(
new
String
[
0
]);
List
<
StoreGroupDTO
>
storeGroupDTOS
=
storeGroupService
.
listStoreGroup
(
array
,
enterpriseId
);
List
<
String
>
parentGroupIds
=
storeGroupDTOS
.
stream
().
map
(
StoreGroupDTO:
:
getParentGroupId
).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isNotEmpty
(
parentGroupIds
)
&&
parentGroupIds
.
contains
(
"0"
))
{
logger
.
info
(
"gic是超管,企微包含所有门店,clerkId:{}"
,
clerkId
);
enterpriseIdStoreIds
=
Collections
.
singletonList
(
"-1"
);
}
RedisUtil
.
setCache
(
cacheKey
,
enterpriseIdStoreIds
,
10L
,
TimeUnit
.
MINUTES
);
return
enterpriseIdStoreIds
;
}
logger
.
info
(
"gic门店数量:{}"
,
gicStoreIds
.
size
());
//取交集
List
<
String
>
storeList
=
RolesListUtils
.
mergeList
(
enterpriseIdStoreIds
,
gicStoreIds
);
logger
.
info
(
"该导购权限:clerkId:{},门店数量:{}"
,
clerkId
,
storeList
.
size
());
RedisUtil
.
setCache
(
cacheKey
,
storeList
,
10L
,
TimeUnit
.
MINUTES
);
return
storeList
;
}
...
...
@@ -1341,9 +1398,7 @@ public class StaffApiServiceImpl implements StaffApiService {
public
List
<
String
>
getHaoBanStoreRolesByStoreWidgetId
(
String
storeWidgetId
,
String
wxEnterpriseId
,
String
enterpriseId
)
{
List
<
String
>
enterpriseIdStoreIds
=
storeRangeService
.
listStoreIdByWxEnterpriseId
(
wxEnterpriseId
,
enterpriseId
);
List
<
String
>
storeWidgetIdStoreIds
=
getStoreWidgetIdStoreIds
(
storeWidgetId
,
enterpriseId
);
//取交集
Sets
.
SetView
<
String
>
intersection
=
Sets
.
intersection
(
Sets
.
newHashSet
(
enterpriseIdStoreIds
),
Sets
.
newHashSet
(
storeWidgetIdStoreIds
));
return
intersection
.
stream
().
collect
(
Collectors
.
toList
());
return
RolesListUtils
.
mergeList
(
enterpriseIdStoreIds
,
storeWidgetIdStoreIds
);
}
@Override
...
...
@@ -1369,13 +1424,13 @@ public class StaffApiServiceImpl implements StaffApiService {
/**
* 门店筛选器id企业端获取gic门店id列表
*
* @param clerk
Id 职员id
* @param clerk
DTO 职员dto
* @return {@link List }<{@link String }>
* @author mozhu
* @date 2022-0
5-06 16:00:05
* @date 2022-0
6-01 11:08:41
*/
private
List
<
String
>
getStoreIdList
(
ClerkDTO
clerkDTO
)
{
String
clerkId
=
clerkDTO
.
getClerkId
()
;
String
clerkId
=
clerkDTO
.
getClerkId
();
Integer
superAdmin
=
clerkDTO
.
getSuperAdmin
();
if
(
superAdmin
!=
null
&&
superAdmin
==
1
)
{
logger
.
info
(
"gic超管,clerkId:{}"
,
clerkId
);
...
...
@@ -1385,7 +1440,7 @@ public class StaffApiServiceImpl implements StaffApiService {
String
enterpriseId
=
clerkDTO
.
getEnterpriseId
();
EnterpriseSettingDTO
enterpriseSetting
=
enterpriseService
.
getEnterpriseSettingByEnterpriseId
(
enterpriseId
);
if
(
enterpriseSetting
.
getEnableAccessControl
()
!=
null
&&
enterpriseSetting
.
getEnableAccessControl
()
==
1
)
{
String
storeWidgetId
=
this
.
powerService
.
getStoreWidgetId
(
new
Date
()
,
clerkId
)
;
String
storeWidgetId
=
this
.
powerService
.
getStoreWidgetId
(
new
Date
()
,
clerkId
)
;
if
(
StringUtils
.
isBlank
(
storeWidgetId
))
{
logger
.
info
(
"导购权限不存在"
);
return
Collections
.
emptyList
();
...
...
@@ -1423,7 +1478,7 @@ public class StaffApiServiceImpl implements StaffApiService {
if
(
CollectionUtils
.
isEmpty
(
storeIdList
))
{
return
Collections
.
emptyList
();
}
logger
.
info
(
"门店筛选器查询结果
:{}"
,
JSON
.
toJSONString
(
storeIdList
));
logger
.
info
(
"门店筛选器查询结果
数量:{}"
,
storeIdList
.
size
(
));
return
storeIdList
;
}
}
haoban-manage3-service/src/main/resources/mapper/TabHaobanStoreRelationMapper.xml
View file @
809838a8
...
...
@@ -223,4 +223,12 @@
and store_id = #{storeId}
and status_flag = 1
</select>
<select
id=
"listStoreGroupIdByWxEnterpriseId"
resultType=
"String"
>
select store_group_id
from tab_haoban_store_relation
where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and enterprise_id = #{enterpriseId,jdbcType=VARCHAR}
and status_flag = 1 group by store_group_id
</select>
</mapper>
\ No newline at end of file
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