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
d2e0b78b
Commit
d2e0b78b
authored
Jul 07, 2022
by
徐高华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
门店
parent
116cf866
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
72 deletions
+14
-72
HmStoreController.java
...ic/haoban/manage/web/controller/hm/HmStoreController.java
+14
-72
No files found.
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/hm/HmStoreController.java
View file @
d2e0b78b
package
com
.
gic
.
haoban
.
manage
.
web
.
controller
.
hm
;
package
com
.
gic
.
haoban
.
manage
.
web
.
controller
.
hm
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
...
@@ -21,17 +20,11 @@ import com.alibaba.fastjson.JSON;
...
@@ -21,17 +20,11 @@ import com.alibaba.fastjson.JSON;
import
com.gic.api.base.commons.BasePageInfo
;
import
com.gic.api.base.commons.BasePageInfo
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.Page
;
import
com.gic.clerk.api.dto.ClerkStoreListDTO
;
import
com.gic.clerk.api.dto.ClerkStoreListDTO
;
import
com.gic.clerk.api.dto.PowerClerkDTO
;
import
com.gic.clerk.api.service.ClerkService
;
import
com.gic.clerk.api.service.ClerkService
;
import
com.gic.clerk.api.service.PowerService
;
import
com.gic.commons.webapi.reponse.RestResponse
;
import
com.gic.commons.webapi.reponse.RestResponse
;
import
com.gic.enterprise.api.dto.EnterpriseSettingDTO
;
import
com.gic.enterprise.api.dto.StoreDTO
;
import
com.gic.enterprise.api.dto.StoreWidgetDTO
;
import
com.gic.enterprise.api.service.EnterpriseService
;
import
com.gic.enterprise.api.service.StoreWidgetService
;
import
com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO
;
import
com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO
;
import
com.gic.haoban.common.utils.AuthWebRequestUtil
;
import
com.gic.haoban.common.utils.AuthWebRequestUtil
;
import
com.gic.haoban.manage.api.service.StaffApiService
;
@RestController
@RestController
public
class
HmStoreController
{
public
class
HmStoreController
{
...
@@ -39,13 +32,9 @@ public class HmStoreController {
...
@@ -39,13 +32,9 @@ public class HmStoreController {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
HmStoreController
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
HmStoreController
.
class
);
@Autowired
@Autowired
private
StoreWidgetService
storeWidgetService
;
@Autowired
private
EnterpriseService
enterpriseService
;
@Autowired
private
PowerService
powerService
;
@Autowired
private
ClerkService
clerkService
;
private
ClerkService
clerkService
;
@Autowired
private
StaffApiService
staffApiService
;
@RequestMapping
(
"store-clerk-list"
)
@RequestMapping
(
"store-clerk-list"
)
@ResponseBody
@ResponseBody
...
@@ -62,7 +51,8 @@ public class HmStoreController {
...
@@ -62,7 +51,8 @@ public class HmStoreController {
params
.
put
(
"storeGroupId"
,
storeGroupId
);
params
.
put
(
"storeGroupId"
,
storeGroupId
);
// 是否显示子分组(1显示,其余不显示)
// 是否显示子分组(1显示,其余不显示)
params
.
put
(
"showChildren"
,
0
);
params
.
put
(
"showChildren"
,
0
);
// 只获取导购和店长
params
.
put
(
"clerkTypeList"
,
Arrays
.
asList
(
1
,
0
));
if
(
StringUtils
.
isNotBlank
(
storeSearchParams
))
{
if
(
StringUtils
.
isNotBlank
(
storeSearchParams
))
{
params
.
put
(
"storeSearchParams"
,
"%"
+
storeSearchParams
+
"%"
);
params
.
put
(
"storeSearchParams"
,
"%"
+
storeSearchParams
+
"%"
);
}
}
...
@@ -72,11 +62,15 @@ public class HmStoreController {
...
@@ -72,11 +62,15 @@ public class HmStoreController {
if
(
StringUtils
.
isBlank
(
storeGroupId
))
{
if
(
StringUtils
.
isBlank
(
storeGroupId
))
{
return
RestResponse
.
failure
(
"-1"
,
"门店分组ID不能为空"
);
return
RestResponse
.
failure
(
"-1"
,
"门店分组ID不能为空"
);
}
}
// 如果有权限控制,进行管辖门店过滤
// 如果有权限控制,进行管辖门店过0滤
params
.
put
(
"storeIdList"
,
this
.
getStoreIdListBYKey
());
List
<
String
>
authStoreIdList
=
this
.
staffApiService
.
getHaoBanStoreIdsRolesByClerkId
(
loginUser
.
getClerkId
(),
loginUser
.
getWxEnterpriseId
());
// 只获取导购和店长
if
(
CollectionUtils
.
isEmpty
(
authStoreIdList
))
{
params
.
put
(
"clerkTypeList"
,
Arrays
.
asList
(
1
,
0
));
return
RestResponse
.
failure
(
"-1"
,
"无授权门店"
);
}
if
(!(
authStoreIdList
.
size
()
==
1
&&
authStoreIdList
.
contains
(
"-1"
)))
{
params
.
put
(
"storeIdList"
,
authStoreIdList
);
}
Page
<
ClerkStoreListDTO
>
page
=
new
Page
<>();
Page
<
ClerkStoreListDTO
>
page
=
new
Page
<>();
page
.
setPageSize
(
basePageInfo
.
getPageSize
());
page
.
setPageSize
(
basePageInfo
.
getPageSize
());
page
.
setCurrentPage
(
basePageInfo
.
getPageNum
());
page
.
setCurrentPage
(
basePageInfo
.
getPageNum
());
...
@@ -85,56 +79,4 @@ public class HmStoreController {
...
@@ -85,56 +79,4 @@ public class HmStoreController {
page
=
this
.
clerkService
.
listStoreClerkByPage
(
page
);
page
=
this
.
clerkService
.
listStoreClerkByPage
(
page
);
return
RestResponse
.
successResult
(
page
);
return
RestResponse
.
successResult
(
page
);
}
}
public
List
<
String
>
getStoreIdListBYKey
()
{
List
<
String
>
storeIdList
=
new
ArrayList
<>();
WebLoginDTO
loginUser
=
AuthWebRequestUtil
.
getLoginUser
();
String
enterpriseId
=
loginUser
.
getEnterpriseId
();
// 管辖门店key
String
storeWidgetId
=
this
.
getStoreWidgetId
(
loginUser
.
getClerkId
());
EnterpriseSettingDTO
enterpriseSettingDTO
=
this
.
enterpriseService
.
getEnterpriseSettingByEnterpriseId
(
enterpriseId
);
Integer
enableAccessControl
=
enterpriseSettingDTO
.
getEnableAccessControl
();
// 是否开启权限控制
boolean
isEnableAccessControl
=
enableAccessControl
!=
null
&&
enableAccessControl
.
intValue
()
==
1
;
if
(
isEnableAccessControl
)
{
// 用户是超级管理员或管辖门店为所有门店则不受管辖门店约束
boolean
isAdmin
=
loginUser
.
getSuperAdmin
()
!=
null
&&
loginUser
.
getSuperAdmin
().
intValue
()
==
1
;
// 是否是所有门店类型
boolean
isAllStore
=
false
;
if
(
StringUtils
.
isNotBlank
(
storeWidgetId
))
{
StoreWidgetDTO
storeWidgetDTO
=
this
.
storeWidgetService
.
getStoreWidgetBykey
(
storeWidgetId
);
isAllStore
=
storeWidgetDTO
!=
null
&&
storeWidgetDTO
.
getSelectType
().
intValue
()
==
0
;
}
// 不受管辖门店约束,查询所有
if
(
isAdmin
||
isAllStore
)
{
return
storeIdList
;
}
// 门店控件会控制过滤管辖门店,只要key有值,直接查询数据
if
(
StringUtils
.
isNotBlank
(
storeWidgetId
))
{
Page
pageParam
=
new
Page
();
pageParam
.
setCurrentPage
(
1
);
pageParam
.
setPageSize
(
Integer
.
MAX_VALUE
);
Page
page
=
this
.
storeWidgetService
.
getStoreWidgetStore
(
storeWidgetId
,
null
,
enterpriseId
,
pageParam
);
if
(
page
!=
null
)
{
List
<
StoreDTO
>
storeList
=
page
.
getResult
();
if
(
CollectionUtils
.
isNotEmpty
(
storeList
))
{
for
(
StoreDTO
storeDTO
:
storeList
)
{
storeIdList
.
add
(
storeDTO
.
getStoreId
());
}
}
else
{
storeIdList
.
add
(
"-1"
);
}
}
}
}
return
storeIdList
;
}
private
String
getStoreWidgetId
(
String
userId
)
{
PowerClerkDTO
clerkDetail
=
this
.
powerService
.
getClerkDetail
(
userId
);
return
clerkDetail
.
getStoreWidgetId
();
}
}
}
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