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
cf25c2f0
Commit
cf25c2f0
authored
Oct 14, 2024
by
guojx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
门店状态筛选接口优化
parent
d3255f9a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
142 additions
and
53 deletions
+142
-53
StaffApiServiceImpl.java
.../manage/service/service/out/impl/StaffApiServiceImpl.java
+4
-0
WxStaffController.java
...m/gic/haoban/manage/web/controller/WxStaffController.java
+77
-52
DataController.java
...gic/haoban/manage/web/controller/data/DataController.java
+8
-1
StoreStatusFilterUtils.java
...e/web/utils/storestatusfilter/StoreStatusFilterUtils.java
+39
-0
StoreListVO.java
...c/main/java/com/gic/haoban/manage/web/vo/StoreListVO.java
+14
-0
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/StaffApiServiceImpl.java
View file @
cf25c2f0
...
@@ -948,6 +948,10 @@ public class StaffApiServiceImpl implements StaffApiService {
...
@@ -948,6 +948,10 @@ public class StaffApiServiceImpl implements StaffApiService {
storeSearchDTO
.
setStatusAnyIn
(
storeStatusList
);
storeSearchDTO
.
setStatusAnyIn
(
storeStatusList
);
}
}
List
<
String
>
resultList
=
storeService
.
listStoreIds
(
storeSearchDTO
);
List
<
String
>
resultList
=
storeService
.
listStoreIds
(
storeSearchDTO
);
if
(
CollectionUtils
.
isEmpty
(
resultList
))
{
return
Collections
.
singletonList
(
"no_store"
);
}
if
(
addUnassignedStore
&&
isSuperAdminStore
)
{
if
(
addUnassignedStore
&&
isSuperAdminStore
)
{
if
(!
hasStoreStatusFilter
||
storeStatusList
.
contains
(
"2"
))
{
if
(!
hasStoreStatusFilter
||
storeStatusList
.
contains
(
"2"
))
{
//所有门店权限,且选择了上线门店状态,则添加无归属门店id
//所有门店权限,且选择了上线门店状态,则添加无归属门店id
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/controller/WxStaffController.java
View file @
cf25c2f0
...
@@ -20,6 +20,7 @@ import com.gic.enterprise.api.enums.CustomPageTypeEnum;
...
@@ -20,6 +20,7 @@ import com.gic.enterprise.api.enums.CustomPageTypeEnum;
import
com.gic.enterprise.api.service.*
;
import
com.gic.enterprise.api.service.*
;
import
com.gic.haoban.manage.web.qo.StaffAddVO
;
import
com.gic.haoban.manage.web.qo.StaffAddVO
;
import
com.gic.haoban.manage.web.utils.CustomSwitcher
;
import
com.gic.haoban.manage.web.utils.CustomSwitcher
;
import
com.gic.haoban.manage.web.utils.storestatusfilter.StoreStatusFilterUtils
;
import
com.gic.haoban.manage.web.vo.*
;
import
com.gic.haoban.manage.web.vo.*
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
@@ -1802,60 +1803,81 @@ public class WxStaffController extends WebBaseController {
...
@@ -1802,60 +1803,81 @@ public class WxStaffController extends WebBaseController {
@RequestMapping
(
"/list-clerk-store"
)
@RequestMapping
(
"/list-clerk-store"
)
public
RestResponse
<
Object
>
listClerkStore
(
String
wxEnterpriseId
,
String
enterpriseId
,
String
clerkId
,
public
RestResponse
<
Object
>
listClerkStore
(
String
wxEnterpriseId
,
String
enterpriseId
,
String
clerkId
,
@RequestParam
(
defaultValue
=
"20"
)
int
pageSize
,
@RequestParam
(
defaultValue
=
"1"
)
int
currentPage
,
@RequestParam
(
defaultValue
=
"20"
)
int
pageSize
,
@RequestParam
(
defaultValue
=
"1"
)
int
currentPage
,
String
storeSearchParams
)
{
String
storeSearchParams
,
Integer
storeStatusFilter
)
{
List
<
String
>
storeIdList
=
this
.
staffApiService
.
getHaoBanStoreIdsRolesByClerkId
(
clerkId
,
wxEnterpriseId
);
if
(
StringUtils
.
isBlank
(
enterpriseId
))
{
if
(
CollectionUtils
.
isEmpty
(
storeIdList
))
{
return
RestResponse
.
failure
(
"-1"
,
"企业参数为空"
);
}
// List<String> storeIdList = this.staffApiService.getHaoBanStoreIdsRolesByClerkId(clerkId, wxEnterpriseId);
List
<
String
>
storeIdList
=
this
.
staffApiService
.
getHaobanStoreIdsRolesByClerkIdAndStoreStatus
(
clerkId
,
wxEnterpriseId
,
StoreStatusFilterUtils
.
getStoreStatusList
(
storeStatusFilter
),
null
);
if
(
CollectionUtils
.
isNotEmpty
(
storeIdList
)
&&
storeIdList
.
contains
(
"no_store"
))
{
return
RestResponse
.
failure
(
"-1"
,
"无授权门店"
);
return
RestResponse
.
failure
(
"-1"
,
"无授权门店"
);
}
}
List
<
StoreListVO
>
voList
=
new
ArrayList
<>();
List
<
StoreListVO
>
voList
=
new
ArrayList
<>();
int
totalCount
=
0
;
int
totalCount
=
0
;
List
<
StoreDTO
>
storeDTOList
=
new
ArrayList
<>();
List
<
StoreDTO
>
storeDTOList
=
new
ArrayList
<>();
if
(
storeIdList
.
get
(
0
).
contains
(
"-1"
))
{
String
storeWidgetId
=
this
.
powerService
.
getStoreWidgetId
(
null
,
clerkId
);
Page
<
Object
>
pageParam
=
new
Page
<
Object
>();
logger
.
info
(
"权限-所有门店storeWidgetId={}"
,
storeWidgetId
);
pageParam
.
setCurrentPage
(
currentPage
);
Page
<
Object
>
pageParam
=
new
Page
<
Object
>();
pageParam
.
setPageSize
(
pageSize
);
pageParam
.
setCurrentPage
(
currentPage
);
StoreSearchDTO
searchDTO
=
new
StoreSearchDTO
()
;
pageParam
.
setPageSize
(
pageSize
);
searchDTO
.
setEnterpriseId
(
enterpriseId
);
ClerkDTO
clerkDTO
=
clerkService
.
getClerkByClerkIdNoStatus
(
clerkId
);
searchDTO
.
setStatusIn
(
"-3"
);
if
(
clerkDTO
.
getClerkType
()
==
2
)
{
if
(
CollectionUtils
.
isNotEmpty
(
storeIdList
))
{
Page
<
StoreDTO
>
page
=
storeWidgetService
.
getStoreWidgetStore
(
storeWidgetId
,
null
,
enterpriseId
,
pageParam
,
searchDTO
.
setAuthStoreIdList
(
storeIdList
);
null
,
null
);
}
if
(
page
!=
null
)
{
Page
<
StoreDTO
>
resPage
=
this
.
storeService
.
storeListPage
(
pageParam
,
searchDTO
)
;
storeDTOList
=
page
.
getResult
();
if
(
resPage
!=
null
)
{
totalCount
=
page
.
getTotalCount
();
storeDTOList
=
resPage
.
getResult
();
}
totalCount
=
resPage
.
getTotalCount
();
}
else
if
(
clerkDTO
.
getClerkType
()==
3
)
{
}
StoreSearchDTO
searchDTO
=
new
StoreSearchDTO
()
;
searchDTO
.
setEnterpriseId
(
clerkDTO
.
getEnterpriseId
());
// if (storeIdList.get(0).contains("-1")) {
Page
<
StoreDTO
>
page
=
this
.
storeService
.
storeListPage
(
pageParam
,
searchDTO
)
;
// String storeWidgetId = this.powerService.getStoreWidgetId(null, clerkId);
if
(
page
!=
null
)
{
// logger.info("权限-所有门店storeWidgetId={}", storeWidgetId);
storeDTOList
=
page
.
getResult
();
// Page<Object> pageParam = new Page<Object>();
totalCount
=
page
.
getTotalCount
();
// pageParam.setCurrentPage(currentPage);
}
// pageParam.setPageSize(pageSize);
}
// ClerkDTO clerkDTO = clerkService.getClerkByClerkIdNoStatus(clerkId);
}
else
{
// if(clerkDTO.getClerkType() == 2) {
totalCount
=
storeIdList
.
size
();
// Page<StoreDTO> page = storeWidgetService.getStoreWidgetStore(storeWidgetId, null, enterpriseId, pageParam,
int
start
=
pageSize
*
(
currentPage
-
1
);
// null, null);
if
(
start
<
totalCount
)
{
// if (page != null) {
int
end
=
start
+
pageSize
;
// storeDTOList = page.getResult();
if
(
end
>
totalCount
)
{
// totalCount = page.getTotalCount();
end
=
totalCount
;
// }
}
// }else if(clerkDTO.getClerkType()==3) {
List
<
String
>
subStoreIdList
=
storeIdList
.
subList
(
start
,
end
);
// StoreSearchDTO searchDTO = new StoreSearchDTO() ;
if
(
CollectionUtils
.
isNotEmpty
(
subStoreIdList
))
{
// searchDTO.setEnterpriseId(clerkDTO.getEnterpriseId());
logger
.
info
(
"分页当前页storeid数={}"
,
subStoreIdList
.
size
());
// Page<StoreDTO> page = this.storeService.storeListPage(pageParam,searchDTO) ;
String
[]
arr
=
new
String
[
subStoreIdList
.
size
()];
// if (page != null) {
List
<
StoreDTO
>
storeList
=
this
.
storeService
.
getStores
(
subStoreIdList
.
toArray
(
arr
));
// storeDTOList = page.getResult();
Map
<
String
,
StoreDTO
>
storeMap
=
storeList
.
stream
()
// totalCount = page.getTotalCount();
.
collect
(
Collectors
.
toMap
(
StoreDTO:
:
getStoreId
,
o
->
o
,
(
k1
,
k2
)
->
k1
));
// }
for
(
String
id
:
subStoreIdList
)
{
// }
if
(
null
!=
storeMap
.
get
(
id
))
{
// } else {
storeDTOList
.
add
(
storeMap
.
get
(
id
));
// totalCount = storeIdList.size();
}
// int start = pageSize * (currentPage - 1);
}
// if (start < totalCount) {
}
// int end = start + pageSize;
}
// if (end > totalCount) {
}
// end = totalCount;
// }
// List<String> subStoreIdList = storeIdList.subList(start, end);
// if (CollectionUtils.isNotEmpty(subStoreIdList)) {
// logger.info("分页当前页storeid数={}", subStoreIdList.size());
// String[] arr = new String[subStoreIdList.size()];
// List<StoreDTO> storeList = this.storeService.getStores(subStoreIdList.toArray(arr));
// Map<String, StoreDTO> storeMap = storeList.stream()
// .collect(Collectors.toMap(StoreDTO::getStoreId, o -> o, (k1, k2) -> k1));
// for (String id : subStoreIdList) {
// if (null != storeMap.get(id)) {
// storeDTOList.add(storeMap.get(id));
// }
// }
// }
// }
// }
if
(
CollectionUtils
.
isNotEmpty
(
storeDTOList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
storeDTOList
))
{
for
(
StoreDTO
store
:
storeDTOList
)
{
for
(
StoreDTO
store
:
storeDTOList
)
{
StoreListVO
vo
=
new
StoreListVO
();
StoreListVO
vo
=
new
StoreListVO
();
...
@@ -1863,6 +1885,7 @@ public class WxStaffController extends WebBaseController {
...
@@ -1863,6 +1885,7 @@ public class WxStaffController extends WebBaseController {
vo
.
setStoreName
(
store
.
getStoreName
());
vo
.
setStoreName
(
store
.
getStoreName
());
vo
.
setStoreCode
(
store
.
getStoreCode
());
vo
.
setStoreCode
(
store
.
getStoreCode
());
vo
.
setEnterpriseId
(
store
.
getEnterpriseId
());
vo
.
setEnterpriseId
(
store
.
getEnterpriseId
());
vo
.
setStoreStatusFilter
(
StoreStatusFilterUtils
.
getStoreStatusFilter
(
store
.
getStatus
()));
voList
.
add
(
vo
);
voList
.
add
(
vo
);
}
}
}
}
...
@@ -1929,6 +1952,7 @@ public class WxStaffController extends WebBaseController {
...
@@ -1929,6 +1952,7 @@ public class WxStaffController extends WebBaseController {
vo
.
setStoreName
(
dto
.
getStoreName
());
vo
.
setStoreName
(
dto
.
getStoreName
());
vo
.
setStoreCode
(
dto
.
getStoreCode
());
vo
.
setStoreCode
(
dto
.
getStoreCode
());
vo
.
setEnterpriseId
(
dto
.
getEnterpriseId
());
vo
.
setEnterpriseId
(
dto
.
getEnterpriseId
());
vo
.
setStoreStatusFilter
(
StoreStatusFilterUtils
.
getStoreStatusFilter
(
dto
.
getStatus
()));
retList
.
add
(
vo
);
retList
.
add
(
vo
);
}
}
return
retList
;
return
retList
;
...
@@ -1937,13 +1961,14 @@ public class WxStaffController extends WebBaseController {
...
@@ -1937,13 +1961,14 @@ public class WxStaffController extends WebBaseController {
// 区经门店查询
// 区经门店查询
@RequestMapping
(
"search-clerk-store"
)
@RequestMapping
(
"search-clerk-store"
)
public
RestResponse
<
Object
>
listClerkStoreByParams
(
String
wxEnterpriseId
,
String
enterpriseId
,
String
clerkId
,
public
RestResponse
<
Object
>
listClerkStoreByParams
(
String
wxEnterpriseId
,
String
enterpriseId
,
String
clerkId
,
String
storeSearchParams
)
{
String
storeSearchParams
,
Integer
storeStatusFilter
)
{
if
(
StringUtils
.
isEmpty
(
storeSearchParams
))
{
if
(
StringUtils
.
isEmpty
(
storeSearchParams
))
{
return
RestResponse
.
failure
(
"-1"
,
"查询条件为空"
);
return
RestResponse
.
failure
(
"-1"
,
"查询条件为空"
);
}
}
// 如果有权限控制,进行管辖门店过0滤
// 如果有权限控制,进行管辖门店过0滤
List
<
String
>
authStoreIdList
=
this
.
staffApiService
.
getHaoBanStoreIdsRolesByClerkId
(
clerkId
,
wxEnterpriseId
);
List
<
String
>
authStoreIdList
=
this
.
staffApiService
.
getHaobanStoreIdsRolesByClerkIdAndStoreStatus
(
clerkId
,
wxEnterpriseId
,
if
(
CollectionUtils
.
isEmpty
(
authStoreIdList
))
{
StoreStatusFilterUtils
.
getStoreStatusList
(
storeStatusFilter
),
null
);
if
(
CollectionUtils
.
isNotEmpty
(
authStoreIdList
)
&&
authStoreIdList
.
contains
(
"no_store"
))
{
return
RestResponse
.
failure
(
"-1"
,
"无授权门店"
);
return
RestResponse
.
failure
(
"-1"
,
"无授权门店"
);
}
}
Page
page
=
this
.
page
(
wxEnterpriseId
,
enterpriseId
,
clerkId
,
20
,
1
,
storeSearchParams
,
authStoreIdList
);
Page
page
=
this
.
page
(
wxEnterpriseId
,
enterpriseId
,
clerkId
,
20
,
1
,
storeSearchParams
,
authStoreIdList
);
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/controller/data/DataController.java
View file @
cf25c2f0
...
@@ -23,9 +23,11 @@ import com.gic.enterprise.api.service.EnterpriseChannelApiService;
...
@@ -23,9 +23,11 @@ import com.gic.enterprise.api.service.EnterpriseChannelApiService;
import
com.gic.enterprise.api.service.EnterpriseService
;
import
com.gic.enterprise.api.service.EnterpriseService
;
import
com.gic.enterprise.api.service.data.DataIndexApiService
;
import
com.gic.enterprise.api.service.data.DataIndexApiService
;
import
com.gic.enterprise.service.CustomSettingApiService
;
import
com.gic.enterprise.service.CustomSettingApiService
;
import
com.gic.haoban.manage.api.service.StaffApiService
;
import
com.gic.haoban.manage.web.qo.data.*
;
import
com.gic.haoban.manage.web.qo.data.*
;
import
com.gic.haoban.manage.web.utils.DateFillUtils
;
import
com.gic.haoban.manage.web.utils.DateFillUtils
;
import
com.gic.haoban.manage.web.utils.StoreAuthUtils
;
import
com.gic.haoban.manage.web.utils.StoreAuthUtils
;
import
com.gic.haoban.manage.web.utils.storestatusfilter.StoreStatusFilterUtils
;
import
com.gic.haoban.manage.web.vo.data.DataMemberExtendVO
;
import
com.gic.haoban.manage.web.vo.data.DataMemberExtendVO
;
import
com.gic.haoban.manage.web.vo.data.SalesStructureVO
;
import
com.gic.haoban.manage.web.vo.data.SalesStructureVO
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -52,6 +54,8 @@ import java.util.stream.Stream;
...
@@ -52,6 +54,8 @@ import java.util.stream.Stream;
@Slf4j
@Slf4j
public
class
DataController
{
public
class
DataController
{
@Autowired
@Autowired
private
StaffApiService
staffApiService
;
@Autowired
private
StoreAuthUtils
storeAuthUtils
;
private
StoreAuthUtils
storeAuthUtils
;
@Autowired
@Autowired
private
DataIndexApiService
dataIndexApiService
;
private
DataIndexApiService
dataIndexApiService
;
...
@@ -487,7 +491,10 @@ public class DataController {
...
@@ -487,7 +491,10 @@ public class DataController {
String
storeIdParam
=
jsonObject
.
getString
(
"storeId"
);
String
storeIdParam
=
jsonObject
.
getString
(
"storeId"
);
boolean
hasStoreId
=
StringUtils
.
isNotBlank
(
storeIdParam
);
boolean
hasStoreId
=
StringUtils
.
isNotBlank
(
storeIdParam
);
if
(!
hasStoreId
)
{
if
(!
hasStoreId
)
{
getAuthStore
(
qo
.
getStoreId
(),
qo
.
getClerkId
(),
qo
.
getWxEnterpriseId
(),
jsonObject
);
List
<
String
>
authStoreIdList
=
staffApiService
.
getNotEmptyHaobanStoreIdsRolesByClerkIdAndStoreStatus
(
qo
.
getClerkId
(),
qo
.
getWxEnterpriseId
(),
StoreStatusFilterUtils
.
getStoreStatusList
(
jsonObject
.
getInteger
(
"storeStatusFilter"
)),
true
);
jsonObject
.
put
(
"storeId"
,
authStoreIdList
.
stream
().
collect
(
Collectors
.
joining
(
","
)));
//getAuthStore(qo.getStoreId(), qo.getClerkId(), qo.getWxEnterpriseId(), jsonObject);
}
}
String
apolloKey
=
qo
.
getApolloKey
();
String
apolloKey
=
qo
.
getApolloKey
();
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/utils/storestatusfilter/StoreStatusFilterUtils.java
0 → 100644
View file @
cf25c2f0
package
com
.
gic
.
haoban
.
manage
.
web
.
utils
.
storestatusfilter
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
public
class
StoreStatusFilterUtils
{
/**
* 获取门店实际状态值
* @param storeStatusFilter 0或者空:全部 1:上线 2:未上线 -3 :回收站
* @return
*/
public
static
List
<
String
>
getStoreStatusList
(
Integer
storeStatusFilter
)
{
if
(
storeStatusFilter
==
null
||
storeStatusFilter
==
0
)
{
return
Collections
.
emptyList
();
}
switch
(
storeStatusFilter
)
{
case
2
:
return
Stream
.
of
(
"3"
,
"6"
,
"7"
).
collect
(
Collectors
.
toList
());
case
-
3
:
return
Stream
.
of
(
"-3"
).
collect
(
Collectors
.
toList
());
default
:
return
Stream
.
of
(
"2"
).
collect
(
Collectors
.
toList
());
}
}
public
static
Integer
getStoreStatusFilter
(
Integer
storeStatus
)
{
switch
(
storeStatus
)
{
case
2
:
return
1
;
case
-
3
:
return
-
3
;
default
:
return
2
;
}
}
}
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/vo/StoreListVO.java
View file @
cf25c2f0
...
@@ -10,6 +10,20 @@ public class StoreListVO implements Serializable{
...
@@ -10,6 +10,20 @@ public class StoreListVO implements Serializable{
private
String
enterpriseId
;
private
String
enterpriseId
;
/**
* 1:上线 2:未上线 -3 :回收站
*/
private
Integer
storeStatusFilter
;
public
Integer
getStoreStatusFilter
()
{
return
storeStatusFilter
;
}
public
void
setStoreStatusFilter
(
Integer
storeStatusFilter
)
{
this
.
storeStatusFilter
=
storeStatusFilter
;
}
public
String
getStoreId
()
{
public
String
getStoreId
()
{
return
storeId
;
return
storeId
;
}
}
...
...
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