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
1c63a19d
Commit
1c63a19d
authored
Apr 04, 2023
by
徐高华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
权限
parent
51be8ac1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
289 additions
and
195 deletions
+289
-195
WxStaffController.java
...m/gic/haoban/manage/web/controller/WxStaffController.java
+267
-195
RightVO.java
...x/src/main/java/com/gic/haoban/manage/web/vo/RightVO.java
+22
-0
No files found.
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/controller/WxStaffController.java
View file @
1c63a19d
...
...
@@ -38,9 +38,12 @@ import com.gic.clerk.api.service.PowerService;
import
com.gic.commons.util.DateUtil
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.commons.webapi.reponse.RestResponse
;
import
com.gic.enterprise.api.constant.EnterpriseServiceEnum
;
import
com.gic.enterprise.api.dto.EnterpriseDTO
;
import
com.gic.enterprise.api.dto.EnterpriseUsingPermissionDto
;
import
com.gic.enterprise.api.dto.StoreDTO
;
import
com.gic.enterprise.api.dto.StoreSearchDTO
;
import
com.gic.enterprise.api.dto.enterprise.EnterpriseUsingStatusDTO
;
import
com.gic.enterprise.api.service.EnterpriseService
;
import
com.gic.enterprise.api.service.EnterpriseUseForbidService
;
import
com.gic.enterprise.api.service.StoreService
;
...
...
@@ -96,6 +99,7 @@ import com.gic.haoban.manage.web.vo.ClerkEditInfoVO;
import
com.gic.haoban.manage.web.vo.ClerkListVO
;
import
com.gic.haoban.manage.web.vo.ClerkStoreVO
;
import
com.gic.haoban.manage.web.vo.OperationSettingVO
;
import
com.gic.haoban.manage.web.vo.RightVO
;
import
com.gic.haoban.manage.web.vo.StaffStoreVO
;
import
com.gic.haoban.manage.web.vo.StaffVO
;
import
com.gic.haoban.manage.web.vo.StoreClerkVO
;
...
...
@@ -155,13 +159,13 @@ public class WxStaffController extends WebBaseController {
@Autowired
private
HaobanRoleApiService
haobanRoleApiService
;
@Autowired
private
PowerService
powerService
;
private
PowerService
powerService
;
@Autowired
private
EnterpriseUseForbidService
enterpriseUseForbidService
;
private
EnterpriseUseForbidService
enterpriseUseForbidService
;
//选择成员列表
//
选择成员列表
@RequestMapping
(
"/staff-list"
)
public
HaobanResponse
staffList
(
String
storeId
,
Integer
manageFlag
,
String
clerkId
,
String
wxEnterpriseId
)
{
public
HaobanResponse
staffList
(
String
storeId
,
Integer
manageFlag
,
String
clerkId
,
String
wxEnterpriseId
)
{
List
<
String
>
storeIds
=
new
ArrayList
<>();
if
(
manageFlag
!=
null
&&
manageFlag
==
1
)
{
List
<
String
>
roleStoreIds
=
staffApiService
.
getHaoBanStoreIdsRolesByClerkId
(
clerkId
,
wxEnterpriseId
);
...
...
@@ -180,7 +184,8 @@ public class WxStaffController extends WebBaseController {
for
(
StaffDTO
staffDTO
:
resultlist
)
{
String
enterpriseId
=
staffDTO
.
getEnterpriseId
();
long
memberCount
=
distributeApiService
.
getClerkMemberCount
(
enterpriseId
,
staffDTO
.
getClerkId
(),
storeId
);
logger
.
info
(
"【获取会员数】enterpriseId={},clerkId={},storeId={},memberCount={}"
,
enterpriseId
,
staffDTO
.
getClerkId
(),
storeId
,
memberCount
);
logger
.
info
(
"【获取会员数】enterpriseId={},clerkId={},storeId={},memberCount={}"
,
enterpriseId
,
staffDTO
.
getClerkId
(),
storeId
,
memberCount
);
staffDTO
.
setMemberCount
(
Convert
.
toInt
(
memberCount
,
0
));
resultList
.
add
(
EntityUtil
.
changeEntityNew
(
StaffVO
.
class
,
staffDTO
));
}
...
...
@@ -199,7 +204,8 @@ public class WxStaffController extends WebBaseController {
* @return
*/
@RequestMapping
(
"/store-clerks"
)
public
HaobanResponse
storeClerks
(
BasePageInfo
basePageInfo
,
String
clerkId
,
String
enterpriseId
,
String
storeId
,
Integer
manageFlag
,
String
wxEnterpriseId
)
{
public
HaobanResponse
storeClerks
(
BasePageInfo
basePageInfo
,
String
clerkId
,
String
enterpriseId
,
String
storeId
,
Integer
manageFlag
,
String
wxEnterpriseId
)
{
List
<
String
>
storeIds
=
new
ArrayList
<>();
if
(
manageFlag
!=
null
&&
manageFlag
==
1
)
{
List
<
String
>
roleStoreIds
=
staffApiService
.
getHaoBanStoreIdsRolesByClerkId
(
clerkId
,
wxEnterpriseId
);
...
...
@@ -213,14 +219,17 @@ public class WxStaffController extends WebBaseController {
if
(
storeIds
.
contains
(
"-1"
))
{
storeIds
=
null
;
}
Page
<
ClerkDTO
>
clerkDTOPage
=
clerkService
.
pageClerkByNameOrCode
(
enterpriseId
,
null
,
storeIds
,
basePageInfo
.
getPageNum
(),
basePageInfo
.
getPageSize
());
Page
<
ClerkDTO
>
clerkDTOPage
=
clerkService
.
pageClerkByNameOrCode
(
enterpriseId
,
null
,
storeIds
,
basePageInfo
.
getPageNum
(),
basePageInfo
.
getPageSize
());
List
<
ClerkDTO
>
clerkDTOS
=
clerkDTOPage
.
getResult
();
if
(
CollectionUtils
.
isEmpty
(
clerkDTOS
))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_10016
);
}
Set
<
String
>
clerkCodeList
=
clerkDTOS
.
stream
().
map
(
ClerkDTO:
:
getClerkCode
).
collect
(
Collectors
.
toSet
());
List
<
StaffClerkRelationDTO
>
bindRelationList
=
staffClerkRelationApiService
.
listBindCode
(
wxEnterpriseId
,
enterpriseId
,
clerkCodeList
);
Map
<
String
,
StaffClerkRelationDTO
>
bindCodeMap
=
bindRelationList
.
stream
().
collect
(
Collectors
.
toMap
(
StaffClerkRelationDTO:
:
getClerkCode
,
s
->
s
));
List
<
StaffClerkRelationDTO
>
bindRelationList
=
staffClerkRelationApiService
.
listBindCode
(
wxEnterpriseId
,
enterpriseId
,
clerkCodeList
);
Map
<
String
,
StaffClerkRelationDTO
>
bindCodeMap
=
bindRelationList
.
stream
()
.
collect
(
Collectors
.
toMap
(
StaffClerkRelationDTO:
:
getClerkCode
,
s
->
s
));
List
<
StoreClerkVO
>
resultList
=
new
ArrayList
<>();
for
(
ClerkDTO
dto
:
clerkDTOS
)
{
String
clerkCode
=
dto
.
getClerkCode
();
...
...
@@ -247,7 +256,7 @@ public class WxStaffController extends WebBaseController {
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
page
);
}
//门店成员列表
//
门店成员列表
@RequestMapping
(
"/clerk-edit-flag"
)
public
HaobanResponse
clerkEditFlag
(
String
wxEnterpriseId
,
String
storeId
)
{
if
(
StringUtils
.
isAnyBlank
(
storeId
))
{
...
...
@@ -257,12 +266,12 @@ public class WxStaffController extends WebBaseController {
if
(
storeDTO
==
null
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_10009
);
}
WxEnterpriseRelationDetailDTO
enterpriseBindInfo
=
wxEnterpriseRelatedApiService
.
getEnterpriseBindInfo
(
wxEnterpriseId
,
storeDTO
.
getEnterpriseId
());
WxEnterpriseRelationDetailDTO
enterpriseBindInfo
=
wxEnterpriseRelatedApiService
.
getEnterpriseBindInfo
(
wxEnterpriseId
,
storeDTO
.
getEnterpriseId
());
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
ClerkEditInfoVO
.
info
(
enterpriseBindInfo
.
getClerkEditFlag
()));
}
/**
* 会员小程序-获取后台认证配置
*
...
...
@@ -297,7 +306,8 @@ public class WxStaffController extends WebBaseController {
}
AuditSettingVO
auditSettingVO
=
new
AuditSettingVO
();
ClerkMainStoreRelatedDTO
mainStore
=
clerkMainStoreRelatedApiService
.
getWxEnterpriseIdAndStaffId
(
wxEnterpriseId
,
staffId
);
ClerkMainStoreRelatedDTO
mainStore
=
clerkMainStoreRelatedApiService
.
getWxEnterpriseIdAndStaffId
(
wxEnterpriseId
,
staffId
);
if
(
mainStore
==
null
)
{
logger
.
info
(
"该门店不存在"
);
return
resultResponse
(
HaoBanErrCode
.
ERR_400023
);
...
...
@@ -308,7 +318,8 @@ public class WxStaffController extends WebBaseController {
logger
.
info
(
"该门店不存在"
);
return
resultResponse
(
HaoBanErrCode
.
ERR_400023
);
}
WxEnterpriseRelationDetailDTO
enterpriseBindInfo
=
wxEnterpriseRelatedApiService
.
getEnterpriseBindInfo
(
wxEnterpriseId
,
storeDTO
.
getEnterpriseId
());
WxEnterpriseRelationDetailDTO
enterpriseBindInfo
=
wxEnterpriseRelatedApiService
.
getEnterpriseBindInfo
(
wxEnterpriseId
,
storeDTO
.
getEnterpriseId
());
if
(
null
==
enterpriseBindInfo
)
{
logger
.
info
(
"该企业未关联"
);
return
resultResponse
(
HaoBanErrCode
.
ERR_400022
);
...
...
@@ -321,7 +332,7 @@ public class WxStaffController extends WebBaseController {
Integer
agreeExternalUseridFlag
=
wxEnterpriseDTO
.
getAgreeExternalUseridFlag
();
int
memberOpenCardFlag
=
enterpriseBindInfo
.
getMemberOpenCardFlag
();
boolean
agreeExternalUserid
=
agreeExternalUseridFlag
==
null
||
agreeExternalUseridFlag
!=
1
;
//同一开平并且未同意转换
//
同一开平并且未同意转换
if
(
memberOpenCardFlag
==
0
&&
agreeExternalUserid
)
{
auditSettingVO
.
setMemberOpenCardFlag
(
0
);
}
else
{
...
...
@@ -340,10 +351,11 @@ public class WxStaffController extends WebBaseController {
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
vo
);
}
//新增店员
//
新增店员
@HttpLimit
@RequestMapping
(
"/staff-add"
)
public
HaobanResponse
staffAdd
(
StaffDTO
staffDTO
,
String
storeId
,
String
clerkCode
,
String
commitName
,
Integer
version
)
{
public
HaobanResponse
staffAdd
(
StaffDTO
staffDTO
,
String
storeId
,
String
clerkCode
,
String
commitName
,
Integer
version
)
{
String
wxEnterpriseId
=
staffDTO
.
getWxEnterpriseId
();
String
staffName
=
staffDTO
.
getStaffName
();
...
...
@@ -357,14 +369,13 @@ public class WxStaffController extends WebBaseController {
if
(
StringUtils
.
isEmpty
(
clerkCode
))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_111116
);
}
if
(
StringUtils
.
isNotEmpty
(
phoneNumber
)
&&
!
GooglePhoneNumberUtil
.
checkPhoneNumber
(
phoneNumber
,
nationcode
))
{
if
(
StringUtils
.
isNotEmpty
(
phoneNumber
)
&&
!
GooglePhoneNumberUtil
.
checkPhoneNumber
(
phoneNumber
,
nationcode
))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_10012
);
}
// 导购code校验-字母和数字
//if (!clerkCode.matches("[a-zA-Z0-9]+")) {
//
return resultResponse(HaoBanErrCode.ERR_10023);
//}
//
if (!clerkCode.matches("[a-zA-Z0-9]+")) {
// return resultResponse(HaoBanErrCode.ERR_10023);
//
}
if
(
version
==
null
)
{
StaffDTO
staff
=
staffApiService
.
selectByNationcodeAndPhoneNumber
(
wxEnterpriseId
,
nationcode
,
phoneNumber
);
if
(
staff
!=
null
)
{
...
...
@@ -372,14 +383,14 @@ public class WxStaffController extends WebBaseController {
}
}
com
.
gic
.
enterprise
.
api
.
dto
.
StoreDTO
store
=
storeService
.
getStoreByIdNoStatus
(
storeId
);
//校验手机是否唯一
//
校验手机是否唯一
if
(
store
==
null
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_10009
);
}
String
enterpriseId
=
store
.
getEnterpriseId
();
boolean
b
=
auditApiService
.
judgeHavePhoneNumberOrCode
(
enterpriseId
,
clerkCode
,
phoneNumber
,
wxEnterpriseId
);
if
(
b
)
{
//待审核中存在code或该手机号
//
待审核中存在code或该手机号
return
resultResponse
(
HaoBanErrCode
.
ERR_10021
);
}
ClerkDTO
clerk
=
clerkService
.
getClerkByCodeNoDel
(
store
.
getEnterpriseId
(),
clerkCode
);
...
...
@@ -389,12 +400,13 @@ public class WxStaffController extends WebBaseController {
}
AuditSettingDTO
dto
=
auditSettingApiService
.
findSettingByWxEnterpriseId
(
wxEnterpriseId
);
if
(
dto
.
getAuditFlag
()
==
1
&&
dto
.
getClerkChangeFlag
()
==
1
)
{
AuditDTO
auditDTO
=
auditApiService
.
findByBindRelatedIdAndAuditType
(
clerkCode
,
AuditType
.
CLERK_ADD
.
getCode
(),
wxEnterpriseId
,
enterpriseId
);
AuditDTO
auditDTO
=
auditApiService
.
findByBindRelatedIdAndAuditType
(
clerkCode
,
AuditType
.
CLERK_ADD
.
getCode
(),
wxEnterpriseId
,
enterpriseId
);
if
(
auditDTO
!=
null
)
{
logger
.
info
(
"已经存在了审核记录,待审核{}"
,
clerkCode
);
return
resultResponse
(
HaoBanErrCode
.
ERR_10018
);
}
//需要审核
//
需要审核
StaffDTO
staff
=
staffApiService
.
selectById
(
staffDTO
.
getStaffId
());
AuditDTO
audit
=
new
AuditDTO
();
audit
.
setCommitStaffName
(
commitName
);
...
...
@@ -423,7 +435,7 @@ public class WxStaffController extends WebBaseController {
auditApiService
.
insert
(
audit
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
else
{
//不用审核
//
不用审核
StaffDTO
staff
=
staffApiService
.
selectById
(
staffDTO
.
getStaffId
());
AuditDTO
audit
=
new
AuditDTO
();
audit
.
setCommitStaffName
(
commitName
);
...
...
@@ -452,15 +464,16 @@ public class WxStaffController extends WebBaseController {
audit
.
setRelatedId
(
clerkCode
);
auditApiService
.
insert
(
audit
);
}
//只新增gic那边的,不新增好办这边
boolean
flag
=
syncHaobanToGicApiService
.
syncClerkToGicClerkAdd
(
storeId
,
clerkCode
,
sex
,
staffName
,
phoneNumber
,
nationcode
,
postion
);
// 只新增gic那边的,不新增好办这边
boolean
flag
=
syncHaobanToGicApiService
.
syncClerkToGicClerkAdd
(
storeId
,
clerkCode
,
sex
,
staffName
,
phoneNumber
,
nationcode
,
postion
);
if
(!
flag
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_10010
);
}
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
//删除店员
//
删除店员
@HttpLimit
@RequestMapping
(
"/staff-del"
)
public
HaobanResponse
staffDel
(
String
wxEnterpriseId
,
String
storeId
,
String
clerkIds
,
String
staffId
)
{
...
...
@@ -468,16 +481,17 @@ public class WxStaffController extends WebBaseController {
return
resultResponse
(
HaoBanErrCode
.
ERR_2
);
}
com
.
gic
.
enterprise
.
api
.
dto
.
StoreDTO
store
=
storeService
.
getStoreByIdNoStatus
(
storeId
);
//校验手机是否唯一
//
校验手机是否唯一
if
(
store
==
null
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_400001
);
}
AuditSettingDTO
dto
=
auditSettingApiService
.
findSettingByWxEnterpriseId
(
wxEnterpriseId
);
if
(
dto
.
getClerkChangeFlag
()
==
1
)
{
//需要审核
//
需要审核
String
[]
clerkIdArr
=
clerkIds
.
split
(
","
);
for
(
String
clerkId
:
clerkIdArr
)
{
AuditDTO
auditDTO
=
auditApiService
.
findByBindRelatedIdAndAuditType
(
clerkId
,
AuditType
.
CLERK_DEL
.
getCode
(),
wxEnterpriseId
,
store
.
getEnterpriseId
());
AuditDTO
auditDTO
=
auditApiService
.
findByBindRelatedIdAndAuditType
(
clerkId
,
AuditType
.
CLERK_DEL
.
getCode
(),
wxEnterpriseId
,
store
.
getEnterpriseId
());
if
(
auditDTO
!=
null
)
{
logger
.
info
(
"已经存在了审核记录,待审核{}"
,
clerkId
);
continue
;
...
...
@@ -512,7 +526,7 @@ public class WxStaffController extends WebBaseController {
auditApiService
.
insert
(
audit
);
}
}
else
{
//无需审核
//
无需审核
String
[]
clerkIdArr
=
clerkIds
.
split
(
","
);
for
(
String
clerkId
:
clerkIdArr
)
{
ClerkDTO
clerkDTO
=
clerkService
.
getClerkByClerkId
(
clerkId
);
...
...
@@ -571,7 +585,7 @@ public class WxStaffController extends WebBaseController {
}
String
yyyyMM
=
DateUtil
.
dateToStr
(
new
Date
(
dateTime
),
"yyyyMMdd"
);
String
key
=
null
;
//设置主门店缓存
//
设置主门店缓存
if
(
Objects
.
equals
(
type
,
1
))
{
int
i
=
cn
.
hutool
.
core
.
date
.
DateUtil
.
weekOfYear
(
new
Date
());
key
=
"haoban_set_main_store_"
+
i
+
":"
+
staffId
;
...
...
@@ -585,8 +599,7 @@ public class WxStaffController extends WebBaseController {
RedisUtil
.
delCache
(
key
);
}
//设置主导购
// 设置主导购
@HttpLimit
@RequestMapping
(
"/set-main-store"
)
public
HaobanResponse
setMainStore
(
String
staffId
,
String
storeId
,
String
wxEnterpriseId
,
String
dateStr
)
{
...
...
@@ -595,7 +608,7 @@ public class WxStaffController extends WebBaseController {
if
(
staff
==
null
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_10006
);
}
//给测试使用
//
给测试使用
if
(
StringUtils
.
isNotBlank
(
dateStr
))
{
curDate
=
cn
.
hutool
.
core
.
date
.
DateUtil
.
parse
(
dateStr
);
}
...
...
@@ -611,8 +624,7 @@ public class WxStaffController extends WebBaseController {
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
//设置主导购
// 设置主导购
@HttpLimit
@RequestMapping
(
"/check-main-store"
)
public
HaobanResponse
checkMainStore
(
String
staffId
,
String
storeId
,
String
wxEnterpriseId
,
String
dateStr
)
{
...
...
@@ -621,7 +633,7 @@ public class WxStaffController extends WebBaseController {
if
(
staff
==
null
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_10006
);
}
//给测试使用
//
给测试使用
if
(
StringUtils
.
isNotBlank
(
dateStr
))
{
curDate
=
cn
.
hutool
.
core
.
date
.
DateUtil
.
parse
(
dateStr
);
}
...
...
@@ -629,18 +641,18 @@ public class WxStaffController extends WebBaseController {
String
key
=
"haoban_set_main_store_"
+
i
+
":"
+
staffId
;
Object
hasSet
=
RedisUtil
.
getCache
(
key
);
if
(
hasSet
==
null
)
{
//可修改
//
可修改
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
1
);
}
else
{
//不可以设置
//
不可以设置
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
0
);
}
}
//刷新微信好友
// 刷新微信好友
@RequestMapping
(
"/fresh-wx-friend"
)
public
HaobanResponse
freshWxFrend
(
String
staffId
,
String
storeId
,
String
wxEnterpriseId
,
String
staffDepartmentRelatedId
,
@RequestParam
(
defaultValue
=
"0"
)
Integer
flushType
)
{
public
HaobanResponse
freshWxFrend
(
String
staffId
,
String
storeId
,
String
wxEnterpriseId
,
String
staffDepartmentRelatedId
,
@RequestParam
(
defaultValue
=
"0"
)
Integer
flushType
)
{
StaffDTO
staff
=
staffApiService
.
selectById
(
staffId
);
String
yyyyMM
=
DateUtil
.
dateToStr
(
new
Date
(),
"yyyyMMdd"
);
if
(
staff
==
null
)
{
...
...
@@ -654,7 +666,8 @@ public class WxStaffController extends WebBaseController {
}
if
(
flushType
==
0
)
{
String
taskName
=
"刷新企业微信好友("
+
staff
.
getStaffName
()
+
")"
;
String
taskId
=
dealSyncOperationApiService
.
createWxFriendTaskSingle
(
wxEnterpriseId
,
taskName
,
staffId
,
staff
.
getStaffName
(),
SyncTaskTypeEnum
.
FRIEND_SINGLE
.
getType
());
String
taskId
=
dealSyncOperationApiService
.
createWxFriendTaskSingle
(
wxEnterpriseId
,
taskName
,
staffId
,
staff
.
getStaffName
(),
SyncTaskTypeEnum
.
FRIEND_SINGLE
.
getType
());
if
(
StringUtils
.
isNotBlank
(
taskId
))
{
dealSyncOperationApiService
.
dealWxFriendClerkSingle
(
taskId
,
staffId
,
staffId
,
wxEnterpriseId
);
}
else
{
...
...
@@ -662,7 +675,8 @@ public class WxStaffController extends WebBaseController {
}
}
else
{
String
taskName
=
"刷新门店好友"
;
String
taskId
=
dealSyncOperationApiService
.
createWxFriendTaskSingle
(
wxEnterpriseId
,
taskName
,
staffId
,
staff
.
getStaffName
(),
SyncTaskTypeEnum
.
FRIEND_STORE
.
getType
());
String
taskId
=
dealSyncOperationApiService
.
createWxFriendTaskSingle
(
wxEnterpriseId
,
taskName
,
staffId
,
staff
.
getStaffName
(),
SyncTaskTypeEnum
.
FRIEND_STORE
.
getType
());
if
(
StringUtils
.
isNotBlank
(
taskId
))
{
dealSyncOperationApiService
.
dealWxFriendStore
(
taskId
,
storeId
,
wxEnterpriseId
);
}
else
{
...
...
@@ -670,7 +684,7 @@ public class WxStaffController extends WebBaseController {
}
}
RedisUtil
.
setCache
(
key
,
1
,
31
*
24
*
60
*
60L
);
//刷新状态变更
//
刷新状态变更
clerkMainStoreRelatedApiService
.
setFreshFriend
(
wxEnterpriseId
,
staffId
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
...
...
@@ -703,15 +717,15 @@ public class WxStaffController extends WebBaseController {
public
HaobanResponse
checkFreshFriend
(
String
staffId
,
String
storeId
,
String
wxEnterpriseId
)
{
String
yyyyMM
=
DateUtil
.
dateToStr
(
new
Date
(),
"yyyyMMdd"
);
String
key
=
"haoban_fresh_wx_friend"
+
yyyyMM
+
staffId
;
//
1代表能刷新
0 不能刷新
//
1代表能刷新
0 不能刷新
Integer
count
=
RedisUtil
.
getCache
(
key
)
==
null
?
1
:
0
;
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
count
);
}
//精确查,根据手机号或者code,查找
// 精确查,根据手机号或者code,查找
@RequestMapping
(
"query-clerk-list-by-code"
)
public
HaobanResponse
queryClerkListByCode
(
String
keyword
,
String
wxEnterpriseId
,
String
staffId
,
Integer
manageFlag
)
{
public
HaobanResponse
queryClerkListByCode
(
String
keyword
,
String
wxEnterpriseId
,
String
staffId
,
Integer
manageFlag
)
{
if
(
StringUtils
.
isAnyBlank
(
staffId
,
wxEnterpriseId
,
keyword
))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_2
);
}
...
...
@@ -737,17 +751,18 @@ public class WxStaffController extends WebBaseController {
List
<
ClerkDTO
>
clerkList
=
new
ArrayList
<>();
if
(
manageFlag
==
-
1
)
{
clerkList
.
addAll
(
clerkService
.
listClerkEnableHaoban
(
enterpriseIdList
,
keyword
));
clerkList
.
addAll
(
clerkNewService
.
listClerkByEnterpriseIdAndSearchAndClerkType
(
enterpriseIdList
,
storeIds
,
keyword
));
clerkList
.
addAll
(
clerkNewService
.
listClerkByEnterpriseIdAndSearchAndClerkType
(
enterpriseIdList
,
storeIds
,
keyword
));
}
else
if
(
manageFlag
==
1
)
{
clerkList
.
addAll
(
clerkService
.
listClerkEnableHaoban
(
enterpriseIdList
,
keyword
));
}
else
{
clerkList
.
addAll
(
clerkNewService
.
listClerkByEnterpriseIdAndSearchAndClerkType
(
enterpriseIdList
,
storeIds
,
keyword
));
clerkList
.
addAll
(
clerkNewService
.
listClerkByEnterpriseIdAndSearchAndClerkType
(
enterpriseIdList
,
storeIds
,
keyword
));
}
List
<
ClerkStoreVO
>
clerkStoreList
=
buildClerkRelation
(
clerkList
,
enterpriseIdList
,
wxEnterpriseId
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
clerkStoreList
);
}
/**
* 未关联导购列表
*
...
...
@@ -782,7 +797,8 @@ public class WxStaffController extends WebBaseController {
* @param enterpriseIdList
* @return
*/
private
List
<
ClerkStoreVO
>
buildClerkRelation
(
List
<
ClerkDTO
>
clerkList
,
List
<
String
>
enterpriseIdList
,
String
wxEnterpriseId
)
{
private
List
<
ClerkStoreVO
>
buildClerkRelation
(
List
<
ClerkDTO
>
clerkList
,
List
<
String
>
enterpriseIdList
,
String
wxEnterpriseId
)
{
List
<
ClerkStoreVO
>
clerkStoreList
=
new
ArrayList
<>();
if
(
CollectionUtil
.
isEmpty
(
clerkList
))
{
return
clerkStoreList
;
...
...
@@ -791,7 +807,8 @@ public class WxStaffController extends WebBaseController {
Map
<
String
,
EnterpriseDTO
>
map
=
com
.
gic
.
commons
.
util
.
CollectionUtil
.
toMap
(
enterpriselist
,
"enterpriseId"
);
List
<
String
>
clerkIds
=
clerkList
.
stream
().
map
(
s
->
s
.
getClerkId
()).
collect
(
Collectors
.
toList
());
List
<
StaffClerkRelationDTO
>
clerkRelations
=
staffClerkRelationApiService
.
listByClerkIds
(
clerkIds
);
Map
<
String
,
StaffClerkRelationDTO
>
clerkBindMap
=
com
.
gic
.
commons
.
util
.
CollectionUtil
.
toMap
(
clerkRelations
,
"clerkId"
);
Map
<
String
,
StaffClerkRelationDTO
>
clerkBindMap
=
com
.
gic
.
commons
.
util
.
CollectionUtil
.
toMap
(
clerkRelations
,
"clerkId"
);
for
(
ClerkDTO
clerk
:
clerkList
)
{
String
enterpriseId
=
clerk
.
getEnterpriseId
();
...
...
@@ -814,10 +831,11 @@ public class WxStaffController extends WebBaseController {
vo
.
setBindFlag
(
staffClerkRelationDTO
==
null
?
0
:
1
);
vo
.
setStaffId
(
staffClerkRelationDTO
==
null
?
""
:
staffClerkRelationDTO
.
getStaffId
());
vo
.
setStoreId
(
clerk
.
getStoreId
());
//区经
//
区经
if
(
clerkType
==
2
)
{
vo
.
setManageFlag
(
1
);
vo
.
setManageStoreCount
(
staffApiService
.
getCountHaoBanStoreIdsByClerkId
(
clerkId
,
wxEnterpriseId
).
getStoreCount
());
vo
.
setManageStoreCount
(
staffApiService
.
getCountHaoBanStoreIdsByClerkId
(
clerkId
,
wxEnterpriseId
).
getStoreCount
());
}
else
{
vo
.
setManageFlag
(
0
);
vo
.
setManageStoreCount
(
0
);
...
...
@@ -844,7 +862,8 @@ public class WxStaffController extends WebBaseController {
logger
.
error
(
"手机号为空,不进行查询,staffId:{}"
,
staffId
);
return
ret
;
}
List
<
ClerkDTO
>
clerkList
=
clerkNewService
.
listClerkByEnterpriseIdAndSearchAndClerkType
(
enterpriseIdList
,
storeIdList
,
phoneNumber
);
List
<
ClerkDTO
>
clerkList
=
clerkNewService
.
listClerkByEnterpriseIdAndSearchAndClerkType
(
enterpriseIdList
,
storeIdList
,
phoneNumber
);
if
(
CollectionUtils
.
isNotEmpty
(
clerkList
))
{
ret
.
addAll
(
clerkList
);
}
...
...
@@ -861,7 +880,8 @@ public class WxStaffController extends WebBaseController {
if
(
StringUtils
.
isEmpty
(
clerkDTO
.
getPhoneNumber
()))
{
continue
;
}
List
<
ClerkDTO
>
clerkList
=
clerkNewService
.
listClerkByEnterpriseIdAndSearchAndClerkType
(
enterpriseIdList
,
storeIdList
,
clerkDTO
.
getPhoneNumber
());
List
<
ClerkDTO
>
clerkList
=
clerkNewService
.
listClerkByEnterpriseIdAndSearchAndClerkType
(
enterpriseIdList
,
storeIdList
,
clerkDTO
.
getPhoneNumber
());
if
(
CollectionUtils
.
isNotEmpty
(
clerkList
))
{
ret
.
addAll
(
clerkList
);
}
...
...
@@ -869,8 +889,10 @@ public class WxStaffController extends WebBaseController {
if
(
CollectionUtils
.
isEmpty
(
clerkDTOS
))
{
return
ret
;
}
return
ret
.
stream
().
filter
(
mid
->
(!
clerkIds
.
contains
(
mid
.
getClerkId
()))).
collect
(
Collectors
.
collectingAndThen
(
Collectors
.
toCollection
(()
->
new
TreeSet
<>(
Comparator
.
comparing
(
n
->
n
.
getClerkId
()))),
ArrayList:
:
new
));
return
ret
.
stream
().
filter
(
mid
->
(!
clerkIds
.
contains
(
mid
.
getClerkId
())))
.
collect
(
Collectors
.
collectingAndThen
(
Collectors
.
toCollection
(()
->
new
TreeSet
<>(
Comparator
.
comparing
(
n
->
n
.
getClerkId
()))),
ArrayList:
:
new
));
}
/**
...
...
@@ -884,7 +906,8 @@ public class WxStaffController extends WebBaseController {
*/
@HttpLimit
@RequestMapping
(
"bind-staff"
)
public
HaobanResponse
bindStaff
(
String
clerkId
,
String
staffId
,
Integer
auditType
,
Integer
manageFlag
,
String
wxEnterpriseId
)
{
public
HaobanResponse
bindStaff
(
String
clerkId
,
String
staffId
,
Integer
auditType
,
Integer
manageFlag
,
String
wxEnterpriseId
)
{
if
(
StringUtils
.
isAnyBlank
(
clerkId
,
staffId
))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_2
);
}
...
...
@@ -899,17 +922,19 @@ public class WxStaffController extends WebBaseController {
if
(
staff
==
null
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_10006
);
}
AuditDTO
auditDTO
=
auditApiService
.
findByBindRelatedIdAndAuditType
(
clerkId
,
AuditType
.
CLERK_BIND
.
getCode
(),
wxEnterpriseId
,
clerk
.
getEnterpriseId
());
AuditDTO
auditDTO
=
auditApiService
.
findByBindRelatedIdAndAuditType
(
clerkId
,
AuditType
.
CLERK_BIND
.
getCode
(),
wxEnterpriseId
,
clerk
.
getEnterpriseId
());
if
(
auditDTO
!=
null
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_10018
);
}
String
storeId
=
""
;
String
storeName
=
""
;
if
(
manageFlag
!=
null
&&
manageFlag
==
1
)
{
//区经无门店
//
区经无门店
}
else
{
storeId
=
clerk
.
getStoreId
();
StaffClerkRelationDTO
haveClerkCode
=
staffClerkRelationApiService
.
getOneByStoreIdAndStaffId
(
storeId
,
staffId
);
StaffClerkRelationDTO
haveClerkCode
=
staffClerkRelationApiService
.
getOneByStoreIdAndStaffId
(
storeId
,
staffId
);
if
(
haveClerkCode
!=
null
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_10020
);
}
...
...
@@ -922,10 +947,11 @@ public class WxStaffController extends WebBaseController {
String
clerkCode
=
clerk
.
getClerkCode
();
String
enterpriseId
=
clerk
.
getEnterpriseId
();
String
wxUserId
=
staff
.
getWxUserId
();
StaffClerkRelationDTO
staffClerkRelation
=
staffClerkRelationApiService
.
getByCodeAndEnterpriseId
(
clerkCode
,
enterpriseId
);
StaffClerkRelationDTO
staffClerkRelation
=
staffClerkRelationApiService
.
getByCodeAndEnterpriseId
(
clerkCode
,
enterpriseId
);
if
(
auditType
==
2
)
{
//无需审核
//
无需审核
if
(
staffClerkRelation
==
null
)
{
staffClerkRelation
=
new
StaffClerkRelationDTO
();
}
...
...
@@ -937,12 +963,14 @@ public class WxStaffController extends WebBaseController {
staffClerkRelation
.
setStaffId
(
staffId
);
staffClerkRelation
.
setManageFlag
(
manageFlag
);
ServiceResponse
serviceResponse
=
staffClerkRelationApiService
.
wxBindStaffClerk
(
staffClerkRelation
,
staffId
,
ChannelCodeEnum
.
SELF_BIND
.
getCode
());
ServiceResponse
serviceResponse
=
staffClerkRelationApiService
.
wxBindStaffClerk
(
staffClerkRelation
,
staffId
,
ChannelCodeEnum
.
SELF_BIND
.
getCode
());
if
(!
serviceResponse
.
isSuccess
())
{
return
resultResponse
(
HaoBanErrCode
.
ERR_DEFINE
,
serviceResponse
.
getMessage
(),
null
,
serviceResponse
.
getMessage
());
return
resultResponse
(
HaoBanErrCode
.
ERR_DEFINE
,
serviceResponse
.
getMessage
(),
null
,
serviceResponse
.
getMessage
());
}
//无需审核
//
无需审核
AuditDTO
audit
=
new
AuditDTO
();
audit
.
setCommitStaffName
(
staff
.
getStaffName
());
audit
.
setCommitStaffId
(
staffId
);
...
...
@@ -968,10 +996,11 @@ public class WxStaffController extends WebBaseController {
audit
.
setCommitTime
(
new
Date
());
audit
.
setAuditType
(
2
);
auditApiService
.
insert
(
audit
);
StaffClerkRelationDTO
resultDTO
=
staffClerkRelationApiService
.
getByCodeAndEnterpriseId
(
clerkCode
,
clerk
.
getEnterpriseId
());
StaffClerkRelationDTO
resultDTO
=
staffClerkRelationApiService
.
getByCodeAndEnterpriseId
(
clerkCode
,
clerk
.
getEnterpriseId
());
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
resultDTO
);
}
else
{
//需要审核
//
需要审核
AuditDTO
audit
=
new
AuditDTO
();
audit
.
setCommitStaffName
(
staff
.
getStaffName
());
audit
.
setCommitStaffId
(
staffId
);
...
...
@@ -1010,18 +1039,17 @@ public class WxStaffController extends WebBaseController {
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"storeId"
,
storeId
);
NoticeMessageUtil
.
sendNoticeMessage
(
clerk
.
getEnterpriseId
()
,
gicClerk
.
getClerkId
()
,
NoticeMessageTypeEnum
.
STORE_ACCOUNT
.
getType
()
,
null
,
fieldMap
,
jsonObject
);
NoticeMessageUtil
.
sendNoticeMessage
(
clerk
.
getEnterpriseId
(),
gicClerk
.
getClerkId
(),
NoticeMessageTypeEnum
.
STORE_ACCOUNT
.
getType
(),
null
,
fieldMap
,
jsonObject
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
}
//解绑
//
解绑
@RequestMapping
(
"unbind-staff"
)
public
HaobanResponse
unBindStaff
(
String
wxEnterpriseId
,
String
clerkId
,
String
clerkCode
,
String
staffId
,
String
storeId
,
String
enterpriseId
,
Integer
manageFlag
)
{
public
HaobanResponse
unBindStaff
(
String
wxEnterpriseId
,
String
clerkId
,
String
clerkCode
,
String
staffId
,
String
storeId
,
String
enterpriseId
,
Integer
manageFlag
)
{
logger
.
info
(
"解绑 操作人:{},备操作人:{},操作门店:{}"
,
staffId
,
clerkId
,
storeId
);
if
(
StringUtils
.
isAnyBlank
(
clerkId
,
clerkCode
,
staffId
))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_2
);
...
...
@@ -1034,11 +1062,13 @@ public class WxStaffController extends WebBaseController {
if
(
staff
==
null
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_10006
);
}
StaffClerkRelationDTO
staffClerkRelation
=
staffClerkRelationApiService
.
getByCodeAndEnterpriseId
(
clerkCode
,
enterpriseId
);
StaffClerkRelationDTO
staffClerkRelation
=
staffClerkRelationApiService
.
getByCodeAndEnterpriseId
(
clerkCode
,
enterpriseId
);
if
(
staffClerkRelation
==
null
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_111145
);
}
staffClerkRelationApiService
.
unbindByStaffAndClerkId
(
staffId
,
clerkId
,
ChannelCodeEnum
.
SELF_UNBIND
.
getCode
(),
wxEnterpriseId
);
staffClerkRelationApiService
.
unbindByStaffAndClerkId
(
staffId
,
clerkId
,
ChannelCodeEnum
.
SELF_UNBIND
.
getCode
(),
wxEnterpriseId
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
...
...
@@ -1050,14 +1080,17 @@ public class WxStaffController extends WebBaseController {
* @return
*/
@RequestMapping
(
"store-clerk-list"
)
public
HaobanResponse
storeClerkList
(
String
storeId
,
String
enterpriseId
,
String
wxEnterpriseId
)
{
List
<
ClerkDTO
>
list
=
clerkService
.
listClerkByNameOrCode
(
enterpriseId
,
null
,
Collections
.
singletonList
(
storeId
));
public
HaobanResponse
storeClerkList
(
String
storeId
,
String
enterpriseId
,
String
wxEnterpriseId
)
{
List
<
ClerkDTO
>
list
=
clerkService
.
listClerkByNameOrCode
(
enterpriseId
,
null
,
Collections
.
singletonList
(
storeId
));
if
(
CollectionUtils
.
isEmpty
(
list
))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_10016
);
}
Set
<
String
>
clerkCodeList
=
list
.
stream
().
map
(
ClerkDTO:
:
getClerkCode
).
collect
(
Collectors
.
toSet
());
List
<
StaffClerkRelationDTO
>
bindRelationList
=
staffClerkRelationApiService
.
listBindCode
(
wxEnterpriseId
,
enterpriseId
,
clerkCodeList
);
Map
<
String
,
StaffClerkRelationDTO
>
bindCodeMap
=
bindRelationList
.
stream
().
collect
(
Collectors
.
toMap
(
StaffClerkRelationDTO:
:
getClerkCode
,
s
->
s
));
List
<
StaffClerkRelationDTO
>
bindRelationList
=
staffClerkRelationApiService
.
listBindCode
(
wxEnterpriseId
,
enterpriseId
,
clerkCodeList
);
Map
<
String
,
StaffClerkRelationDTO
>
bindCodeMap
=
bindRelationList
.
stream
()
.
collect
(
Collectors
.
toMap
(
StaffClerkRelationDTO:
:
getClerkCode
,
s
->
s
));
List
<
BindClerkVO
>
bindList
=
new
ArrayList
<>();
List
<
BindClerkVO
>
unBindList
=
new
ArrayList
<>();
for
(
ClerkDTO
dto
:
list
)
{
...
...
@@ -1072,7 +1105,7 @@ public class WxStaffController extends WebBaseController {
if
(
StringUtils
.
isNotBlank
(
dto
.
getNationcode
()))
{
vo
.
setNationCode
(
dto
.
getNationcode
());
}
}
else
{
}
else
{
vo
.
setPhoneNumber
(
""
);
vo
.
setNationCode
(
""
);
}
...
...
@@ -1095,14 +1128,17 @@ public class WxStaffController extends WebBaseController {
* @return
*/
@RequestMapping
(
"clerk-manage-list"
)
public
RestResponse
clerkManageList
(
String
enterpriseId
,
String
wxEnterpriseId
)
{
public
RestResponse
clerkManageList
(
String
enterpriseId
,
String
wxEnterpriseId
)
{
List
<
ClerkDTO
>
list
=
clerkService
.
listClerkEnableHaoban
(
Collections
.
singletonList
(
enterpriseId
),
null
);
if
(
CollectionUtils
.
isEmpty
(
list
))
{
return
RestResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCode
.
ERR_10016
.
getCode
()),
HaoBanErrCode
.
ERR_10016
.
getMsg
());
return
RestResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCode
.
ERR_10016
.
getCode
()),
HaoBanErrCode
.
ERR_10016
.
getMsg
());
}
Set
<
String
>
clerkCodeList
=
list
.
stream
().
map
(
ClerkDTO:
:
getClerkCode
).
collect
(
Collectors
.
toSet
());
List
<
StaffClerkRelationDTO
>
bindRelationList
=
staffClerkRelationApiService
.
listBindCode
(
wxEnterpriseId
,
enterpriseId
,
clerkCodeList
);
Map
<
String
,
StaffClerkRelationDTO
>
bindCodeMap
=
bindRelationList
.
stream
().
collect
(
Collectors
.
toMap
(
StaffClerkRelationDTO:
:
getClerkCode
,
s
->
s
));
List
<
StaffClerkRelationDTO
>
bindRelationList
=
staffClerkRelationApiService
.
listBindCode
(
wxEnterpriseId
,
enterpriseId
,
clerkCodeList
);
Map
<
String
,
StaffClerkRelationDTO
>
bindCodeMap
=
bindRelationList
.
stream
()
.
collect
(
Collectors
.
toMap
(
StaffClerkRelationDTO:
:
getClerkCode
,
s
->
s
));
List
<
BindClerkVO
>
bindList
=
new
ArrayList
<>();
List
<
BindClerkVO
>
unBindList
=
new
ArrayList
<>();
for
(
ClerkDTO
dto
:
list
)
{
...
...
@@ -1138,17 +1174,22 @@ public class WxStaffController extends WebBaseController {
return
resultResponse
(
HaoBanErrCode
.
ERR_2
);
}
List
<
StaffStoreVO
>
list
=
new
ArrayList
<>();
List
<
EnterpriseDetailDTO
>
enterpriseList
=
wxEnterpriseRelatedApiService
.
listEnterpriseByWxEnterpriseId
(
wxEnterpriseId
);
List
<
String
>
enterpriseIdList
=
enterpriseList
.
stream
().
map
(
EnterpriseDetailDTO:
:
getEnterpriseId
).
collect
(
Collectors
.
toList
());
List
<
StaffClerkRelationDTO
>
bindRelationList
=
staffClerkRelationApiService
.
listBindCodeByStaffId
(
enterpriseIdList
,
staffId
);
//主门店
ClerkMainStoreRelatedDTO
mainDTO
=
clerkMainStoreRelatedApiService
.
getWxEnterpriseIdAndStaffId
(
wxEnterpriseId
,
staffId
);
List
<
EnterpriseDetailDTO
>
enterpriseList
=
wxEnterpriseRelatedApiService
.
listEnterpriseByWxEnterpriseId
(
wxEnterpriseId
);
List
<
String
>
enterpriseIdList
=
enterpriseList
.
stream
().
map
(
EnterpriseDetailDTO:
:
getEnterpriseId
)
.
collect
(
Collectors
.
toList
());
List
<
StaffClerkRelationDTO
>
bindRelationList
=
staffClerkRelationApiService
.
listBindCodeByStaffId
(
enterpriseIdList
,
staffId
);
// 主门店
ClerkMainStoreRelatedDTO
mainDTO
=
clerkMainStoreRelatedApiService
.
getWxEnterpriseIdAndStaffId
(
wxEnterpriseId
,
staffId
);
String
storeId
=
mainDTO
==
null
?
""
:
mainDTO
.
getStoreId
();
for
(
StaffClerkRelationDTO
staffClerkRelationDTO
:
bindRelationList
)
{
ClerkDTO
clerk
=
clerkService
.
getClerkByClerkCode
(
staffClerkRelationDTO
.
getEnterpriseId
(),
staffClerkRelationDTO
.
getClerkCode
());
ClerkDTO
clerk
=
clerkService
.
getClerkByClerkCode
(
staffClerkRelationDTO
.
getEnterpriseId
(),
staffClerkRelationDTO
.
getClerkCode
());
if
(
clerk
!=
null
)
{
StoreDTO
store
=
storeService
.
getStore
(
clerk
.
getStoreId
());
//主门店标志
//
主门店标志
int
mainStoreFlag
=
0
;
if
(
StringUtils
.
isEmpty
(
storeId
))
{
mainStoreFlag
=
0
;
...
...
@@ -1301,7 +1342,8 @@ public class WxStaffController extends WebBaseController {
statusFlags
.
add
(
status
);
}
StaffDTO
staff
=
staffApiService
.
selectById
(
staffId
);
Page
<
ExternalClerkRelatedDTO
>
page
=
externalClerkRelatedApiService
.
pageExternalClerk
(
staff
.
getWxEnterpriseId
(),
staffId
,
statusFlags
,
pageInfo
);
Page
<
ExternalClerkRelatedDTO
>
page
=
externalClerkRelatedApiService
.
pageExternalClerk
(
staff
.
getWxEnterpriseId
(),
staffId
,
statusFlags
,
pageInfo
);
PageResult2
retPage
=
PageUtil
.
getPageInfo
(
page
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
retPage
);
}
...
...
@@ -1331,7 +1373,8 @@ public class WxStaffController extends WebBaseController {
if
(
staffDTO
==
null
)
{
return
RestResponse
.
failure
(
HaoBanErrCode
.
ERR_6
.
getCode
()
+
""
,
HaoBanErrCode
.
ERR_6
.
getMsg
());
}
int
friendCount
=
externalClerkRelatedApiService
.
countFriendCountByClerkId
(
qo
.
getWxEnterpriseId
(),
qo
.
getEnterpriseId
(),
staffDTO
.
getStaffId
(),
qo
.
getClerkId
());
int
friendCount
=
externalClerkRelatedApiService
.
countFriendCountByClerkId
(
qo
.
getWxEnterpriseId
(),
qo
.
getEnterpriseId
(),
staffDTO
.
getStaffId
(),
qo
.
getClerkId
());
int
memberCount
=
customerApiService
.
countMember
(
qo
.
getEnterpriseId
(),
qo
.
getStoreId
(),
qo
.
getClerkId
());
ret
.
setFriendCount
(
friendCount
);
...
...
@@ -1347,7 +1390,8 @@ public class WxStaffController extends WebBaseController {
*/
@RequestMapping
(
"can-relation-count"
)
public
RestResponse
canRelationCount
(
@RequestBody
@Valid
CommonQO
qo
)
{
List
<
StaffClerkInfoDTO
>
staffClerkInfoDTOS
=
staffClerkRelationApiService
.
listBindDetailByStaffId
(
qo
.
getStaffId
());
List
<
StaffClerkInfoDTO
>
staffClerkInfoDTOS
=
staffClerkRelationApiService
.
listBindDetailByStaffId
(
qo
.
getStaffId
());
if
(
CollectionUtils
.
isEmpty
(
staffClerkInfoDTOS
))
{
return
RestResponse
.
successResult
(
0
);
}
...
...
@@ -1365,7 +1409,6 @@ public class WxStaffController extends WebBaseController {
return
RestResponse
.
successResult
(
storeWidgetService
.
getClerkWidgetStore
(
clerkId
));
}
/**
* 根据员工id获取openId
*
...
...
@@ -1373,8 +1416,8 @@ public class WxStaffController extends WebBaseController {
* @author mozhu
* @date 2021-12-29 10:42:24
*/
@RequestMapping
(
value
=
"getOpenIdByStaffId"
,
method
=
{
RequestMethod
.
POST
,
RequestMethod
.
GET
})
public
RestResponse
<
String
>
getOpenIdByStaffId
(
String
staffId
,
String
wxEnterpriseId
)
{
@RequestMapping
(
value
=
"getOpenIdByStaffId"
,
method
=
{
RequestMethod
.
POST
,
RequestMethod
.
GET
})
public
RestResponse
<
String
>
getOpenIdByStaffId
(
String
staffId
,
String
wxEnterpriseId
)
{
StaffDTO
staffDTO
=
staffApiService
.
selectById
(
staffId
);
if
(
staffDTO
==
null
)
{
int
code
=
HaoBanErrCode
.
ERR_6
.
getCode
();
...
...
@@ -1393,7 +1436,8 @@ public class WxStaffController extends WebBaseController {
if
(
qwDTO
.
needOpenUserId3th
())
{
wxUserId
=
staffDTO
.
getWxOpenUseId
();
}
String
openid
=
qywxUserApiService
.
getSelfOpenIdByUserId
(
qwDTO
.
getThirdCorpid
(),
config
.
getWxSuiteid
(),
wxUserId
);
String
openid
=
qywxUserApiService
.
getSelfOpenIdByUserId
(
qwDTO
.
getThirdCorpid
(),
config
.
getWxSuiteid
(),
wxUserId
);
if
(
StringUtils
.
isBlank
(
openid
))
{
int
code
=
HaoBanErrCode
.
ERR_600003
.
getCode
();
return
RestResponse
.
failure
(
String
.
valueOf
(
code
),
HaoBanErrCode
.
ERR_600003
.
getMsg
());
...
...
@@ -1402,30 +1446,32 @@ public class WxStaffController extends WebBaseController {
return
RestResponse
.
successResult
(
openid
);
}
/**
* 根据角色查询菜单
*
* @return
*/
@RequestMapping
(
value
=
"/queryMenuCodesByClerkType"
,
method
=
RequestMethod
.
GET
)
public
RestResponse
<
HaobanRoleDTO
>
queryMenuByClerkType
(
Integer
clerkType
,
String
staffId
,
String
wxEnterpriseId
)
{
public
RestResponse
<
HaobanRoleDTO
>
queryMenuByClerkType
(
Integer
clerkType
,
String
staffId
,
String
wxEnterpriseId
)
{
if
(
clerkType
==
null
)
{
return
RestResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCode
.
ERR_2
.
getCode
()),
HaoBanErrCode
.
ERR_2
.
getMsg
());
}
if
(
clerkType
==
-
1
)
{
logger
.
info
(
"导购类型为-1,游客获取系统级别的导购权限"
);
//游客获取系统级别的导购权限
ServiceResponse
<
HaobanRoleDTO
>
serviceResponse
=
haobanRoleApiService
.
getMenuByWxEnterpriseIdAndClerkType
(
"-1"
,
RoleClerkTypeEnum
.
CLERK
.
getCode
(),
0
);
// 游客获取系统级别的导购权限
ServiceResponse
<
HaobanRoleDTO
>
serviceResponse
=
haobanRoleApiService
.
getMenuByWxEnterpriseIdAndClerkType
(
"-1"
,
RoleClerkTypeEnum
.
CLERK
.
getCode
(),
0
);
return
RestResponse
.
successResult
(
serviceResponse
.
getResult
());
}
if
(
StringUtils
.
isBlank
(
staffId
)
||
"-1"
.
equals
(
staffId
))
{
logger
.
info
(
"未登录游客获取系统级别的导购权限"
);
//游客获取系统级别的导购权限
ServiceResponse
<
HaobanRoleDTO
>
serviceResponse
=
haobanRoleApiService
.
getMenuByWxEnterpriseIdAndClerkType
(
"-1"
,
RoleClerkTypeEnum
.
CLERK
.
getCode
(),
0
);
// 游客获取系统级别的导购权限
ServiceResponse
<
HaobanRoleDTO
>
serviceResponse
=
haobanRoleApiService
.
getMenuByWxEnterpriseIdAndClerkType
(
"-1"
,
RoleClerkTypeEnum
.
CLERK
.
getCode
(),
0
);
return
RestResponse
.
successResult
(
serviceResponse
.
getResult
());
}
ServiceResponse
<
HaobanRoleDTO
>
serviceResponse
=
haobanRoleApiService
.
getMenuByWxEnterpriseIdAndClerkType
(
wxEnterpriseId
,
clerkType
,
1
);
ServiceResponse
<
HaobanRoleDTO
>
serviceResponse
=
haobanRoleApiService
.
getMenuByWxEnterpriseIdAndClerkType
(
wxEnterpriseId
,
clerkType
,
1
);
return
RestResponse
.
successResult
(
serviceResponse
.
getResult
());
}
...
...
@@ -1436,7 +1482,7 @@ public class WxStaffController extends WebBaseController {
* @return
*/
@RequestMapping
(
value
=
"/getCountHaoBanStoreIdsByClerkId"
,
method
=
RequestMethod
.
GET
)
public
RestResponse
<
StoreRoleVO
>
getCountHaoBanStoreIdsByClerkId
(
String
clerkId
,
String
wxEnterpriseId
)
{
public
RestResponse
<
StoreRoleVO
>
getCountHaoBanStoreIdsByClerkId
(
String
clerkId
,
String
wxEnterpriseId
)
{
StoreRoleDTO
storeRoleDTO
=
staffApiService
.
getCountHaoBanStoreIdsByClerkId
(
clerkId
,
wxEnterpriseId
);
StoreRoleVO
storeRoleVO
=
new
StoreRoleVO
();
storeRoleVO
.
setStoreCount
(
storeRoleDTO
.
getStoreCount
());
...
...
@@ -1451,7 +1497,7 @@ public class WxStaffController extends WebBaseController {
* @return
*/
@RequestMapping
(
value
=
"/getHaoBanStoreIdsRolesByClerkId"
,
method
=
RequestMethod
.
GET
)
public
RestResponse
<
List
<
String
>>
getHaoBanStoreIdsRolesByClerkId
(
String
clerkId
,
String
wxEnterpriseId
)
{
public
RestResponse
<
List
<
String
>>
getHaoBanStoreIdsRolesByClerkId
(
String
clerkId
,
String
wxEnterpriseId
)
{
List
<
String
>
storeIds
=
staffApiService
.
getHaoBanStoreIdsRolesByClerkId
(
clerkId
,
wxEnterpriseId
);
return
RestResponse
.
successResult
(
storeIds
);
}
...
...
@@ -1462,13 +1508,14 @@ public class WxStaffController extends WebBaseController {
* @return
*/
@RequestMapping
(
value
=
"/getEnterpriseStoreListByStaffId"
,
method
=
RequestMethod
.
GET
)
public
RestResponse
<
List
<
StaffStoreVO
>>
getEnterpriseStoreListByStaffId
(
String
staffId
,
String
wxEnterpriseId
,
Integer
manageFlag
,
String
gicEnterpriseId
)
{
public
RestResponse
<
List
<
StaffStoreVO
>>
getEnterpriseStoreListByStaffId
(
String
staffId
,
String
wxEnterpriseId
,
Integer
manageFlag
,
String
gicEnterpriseId
)
{
if
(
manageFlag
==
null
)
{
return
RestResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCode
.
ERR_2
.
getCode
()),
HaoBanErrCode
.
ERR_2
.
getMsg
());
}
List
<
StaffClerkRelationDTO
>
bindRelationList
=
new
ArrayList
<>();
List
<
StaffStoreVO
>
list
=
new
ArrayList
<>();
//区经商户
//
区经商户
if
(
manageFlag
==
1
)
{
bindRelationList
=
staffClerkRelationApiService
.
listManageBindByStaffId
(
staffId
);
if
(
CollectionUtils
.
isEmpty
(
bindRelationList
))
{
...
...
@@ -1512,8 +1559,9 @@ public class WxStaffController extends WebBaseController {
}
return
RestResponse
.
successResult
(
list
);
}
//门店列表
List
<
EnterpriseDetailDTO
>
enterpriseList
=
wxEnterpriseRelatedApiService
.
listEnterpriseByWxEnterpriseId
(
wxEnterpriseId
);
// 门店列表
List
<
EnterpriseDetailDTO
>
enterpriseList
=
wxEnterpriseRelatedApiService
.
listEnterpriseByWxEnterpriseId
(
wxEnterpriseId
);
if
(
CollectionUtils
.
isEmpty
(
enterpriseList
))
{
logger
.
info
(
"没有关联任何商户:{}"
,
wxEnterpriseId
);
return
RestResponse
.
successResult
();
...
...
@@ -1527,7 +1575,8 @@ public class WxStaffController extends WebBaseController {
return
RestResponse
.
successResult
();
}
Map
<
String
,
EnterpriseDetailDTO
>
enterpriseTypeMap
=
enterpriseList
.
stream
().
collect
(
Collectors
.
toMap
(
dto
->
dto
.
getEnterpriseId
(),
dto
->
dto
));
Map
<
String
,
EnterpriseDetailDTO
>
enterpriseTypeMap
=
enterpriseList
.
stream
()
.
collect
(
Collectors
.
toMap
(
dto
->
dto
.
getEnterpriseId
(),
dto
->
dto
));
bindRelationList
=
staffClerkRelationApiService
.
listBindCodeByStaffId
(
enterpriseIdList
,
staffId
);
if
(
CollectionUtils
.
isEmpty
(
bindRelationList
))
{
logger
.
info
(
"没有关联任何商户导购:{}"
,
wxEnterpriseId
);
...
...
@@ -1561,7 +1610,7 @@ public class WxStaffController extends WebBaseController {
if
(
enterpriseDTO
==
null
)
{
continue
;
}
//主门店标志
//
主门店标志
int
mainStoreFlag
=
0
;
EnterpriseDetailDTO
enterpriseDetailDTO
=
enterpriseTypeMap
.
get
(
enterpriseId
);
staffDepartmentRelatedApiService
.
listByStaffId
(
staffId
);
...
...
@@ -1592,8 +1641,9 @@ public class WxStaffController extends WebBaseController {
}
List
<
String
>
storeIdList
=
list
.
stream
().
map
(
dto
->
dto
.
getStoreId
()).
collect
(
Collectors
.
toList
());
// 处理主门店
if
(
StringUtils
.
isBlank
(
gicEnterpriseId
))
{
ClerkMainStoreRelatedDTO
mainDTO
=
clerkMainStoreRelatedApiService
.
getWxEnterpriseIdAndStaffId
(
wxEnterpriseId
,
staffId
,
storeIdList
);
if
(
StringUtils
.
isBlank
(
gicEnterpriseId
))
{
ClerkMainStoreRelatedDTO
mainDTO
=
clerkMainStoreRelatedApiService
.
getWxEnterpriseIdAndStaffId
(
wxEnterpriseId
,
staffId
,
storeIdList
);
String
mainStoreId
=
mainDTO
==
null
?
""
:
mainDTO
.
getStoreId
();
if
(
null
!=
mainStoreId
)
{
list
.
forEach
(
item
->
{
...
...
@@ -1616,60 +1666,65 @@ public class WxStaffController extends WebBaseController {
return
RestResponse
.
successResult
(
0
);
}
List
<
Integer
>
statusFlags
=
Arrays
.
asList
(
3
,
4
);
int
countExternalClerk
=
externalClerkRelatedApiService
.
getCountExternalClerk
(
staff
.
getWxEnterpriseId
(),
staffId
,
statusFlags
);
int
countExternalClerk
=
externalClerkRelatedApiService
.
getCountExternalClerk
(
staff
.
getWxEnterpriseId
(),
staffId
,
statusFlags
);
return
RestResponse
.
successResult
(
countExternalClerk
);
}
// 区经门店列表
@RequestMapping
(
"/list-clerk-store"
)
public
RestResponse
<
Object
>
listClerkStore
(
String
wxEnterpriseId
,
String
enterpriseId
,
String
clerkId
,
@RequestParam
(
defaultValue
=
"20"
)
int
pageSize
,
@RequestParam
(
defaultValue
=
"1"
)
int
currentPage
,
String
storeSearchParams
)
{
List
<
String
>
storeIdList
=
this
.
staffApiService
.
getHaoBanStoreIdsRolesByClerkId
(
clerkId
,
wxEnterpriseId
)
;
public
RestResponse
<
Object
>
listClerkStore
(
String
wxEnterpriseId
,
String
enterpriseId
,
String
clerkId
,
@RequestParam
(
defaultValue
=
"20"
)
int
pageSize
,
@RequestParam
(
defaultValue
=
"1"
)
int
currentPage
,
String
storeSearchParams
)
{
List
<
String
>
storeIdList
=
this
.
staffApiService
.
getHaoBanStoreIdsRolesByClerkId
(
clerkId
,
wxEnterpriseId
);
if
(
CollectionUtils
.
isEmpty
(
storeIdList
))
{
return
RestResponse
.
failure
(
"-1"
,
"无授权门店"
);
}
List
<
StoreListVO
>
voList
=
new
ArrayList
<>();
int
totalCount
=
0
;
List
<
StoreDTO
>
storeDTOList
=
new
ArrayList
<>()
;
if
(
storeIdList
.
get
(
0
).
contains
(
"-1"
))
{
int
totalCount
=
0
;
List
<
StoreDTO
>
storeDTOList
=
new
ArrayList
<>();
if
(
storeIdList
.
get
(
0
).
contains
(
"-1"
))
{
String
storeWidgetId
=
this
.
powerService
.
getStoreWidgetId
(
new
Date
(),
clerkId
);
logger
.
info
(
"权限-所有门店storeWidgetId={}"
,
storeWidgetId
);
logger
.
info
(
"权限-所有门店storeWidgetId={}"
,
storeWidgetId
);
Page
<
Object
>
pageParam
=
new
Page
<
Object
>();
pageParam
.
setCurrentPage
(
currentPage
);
pageParam
.
setPageSize
(
pageSize
);
Page
<
StoreDTO
>
page
=
storeWidgetService
.
getStoreWidgetStore
(
storeWidgetId
,
null
,
enterpriseId
,
pageParam
,
null
,
null
);
Page
<
StoreDTO
>
page
=
storeWidgetService
.
getStoreWidgetStore
(
storeWidgetId
,
null
,
enterpriseId
,
pageParam
,
null
,
null
);
if
(
page
!=
null
)
{
storeDTOList
=
page
.
getResult
();
totalCount
=
page
.
getTotalCount
();
}
}
else
{
}
else
{
totalCount
=
storeIdList
.
size
();
int
start
=
pageSize
*
(
currentPage
-
1
)
;
if
(
start
<
totalCount
)
{
int
end
=
start
+
pageSize
;
if
(
end
>
totalCount
)
{
end
=
totalCount
;
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
<
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
))
;
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
))
{
for
(
StoreDTO
store
:
storeDTOList
)
{
if
(
CollectionUtils
.
isNotEmpty
(
storeDTOList
))
{
for
(
StoreDTO
store
:
storeDTOList
)
{
StoreListVO
vo
=
new
StoreListVO
();
vo
.
setStoreId
(
store
.
getStoreId
());
vo
.
setStoreName
(
store
.
getStoreName
());
vo
.
setStoreCode
(
store
.
getStoreCode
());
voList
.
add
(
vo
)
;
voList
.
add
(
vo
);
}
}
Page
<
StoreListVO
>
page
=
new
Page
<>();
...
...
@@ -1679,20 +1734,20 @@ public class WxStaffController extends WebBaseController {
page
.
setPageSize
(
pageSize
);
return
RestResponse
.
successResult
(
page
);
}
@RequestMapping
(
"/search-clerk-store-page"
)
public
RestResponse
<
Object
>
listClerkStorePage
(
String
wxEnterpriseId
,
String
enterpriseId
,
String
clerkId
,
@RequestParam
(
defaultValue
=
"20"
)
int
pageSize
,
@RequestParam
(
defaultValue
=
"1"
)
int
currentPage
,
String
storeSearchParams
)
{
public
RestResponse
<
Object
>
listClerkStorePage
(
String
wxEnterpriseId
,
String
enterpriseId
,
String
clerkId
,
@RequestParam
(
defaultValue
=
"20"
)
int
pageSize
,
@RequestParam
(
defaultValue
=
"1"
)
int
currentPage
,
String
storeSearchParams
)
{
// 如果有权限控制,进行管辖门店过0滤
List
<
String
>
authStoreIdList
=
this
.
staffApiService
.
getHaoBanStoreIdsRolesByClerkId
(
clerkId
,
wxEnterpriseId
);
if
(
CollectionUtils
.
isEmpty
(
authStoreIdList
))
{
return
RestResponse
.
failure
(
"-1"
,
"无授权门店"
);
}
Page
page
=
this
.
page
(
wxEnterpriseId
,
enterpriseId
,
clerkId
,
pageSize
,
currentPage
,
storeSearchParams
,
authStoreIdList
)
;
Page
page
=
this
.
page
(
wxEnterpriseId
,
enterpriseId
,
clerkId
,
pageSize
,
currentPage
,
storeSearchParams
,
authStoreIdList
);
List
<
StoreDTO
>
storeList
=
(
List
<
StoreDTO
>)
page
.
getResult
();
List
<
StoreListVO
>
retList
=
this
.
toList
(
storeList
)
;
List
<
StoreListVO
>
retList
=
this
.
toList
(
storeList
);
Page
<
StoreListVO
>
retPage
=
new
Page
<>();
retPage
.
setResult
(
retList
);
retPage
.
setTotalCount
(
page
.
getTotalCount
());
...
...
@@ -1700,16 +1755,17 @@ public class WxStaffController extends WebBaseController {
retPage
.
setPageSize
(
pageSize
);
return
RestResponse
.
successResult
(
retPage
);
}
private
Page
page
(
String
wxEnterpriseId
,
String
enterpriseId
,
String
clerkId
,
@RequestParam
(
defaultValue
=
"20"
)
int
pageSize
,
@RequestParam
(
defaultValue
=
"1"
)
int
currentPage
,
String
storeSearchParams
,
List
<
String
>
authStoreIdList
)
{
private
Page
page
(
String
wxEnterpriseId
,
String
enterpriseId
,
String
clerkId
,
@RequestParam
(
defaultValue
=
"20"
)
int
pageSize
,
@RequestParam
(
defaultValue
=
"1"
)
int
currentPage
,
String
storeSearchParams
,
List
<
String
>
authStoreIdList
)
{
StoreSearchDTO
searchDTO
=
new
StoreSearchDTO
();
searchDTO
.
setRecycleStoreCount
(
0
);
searchDTO
.
setMemberCountFlag
(
0
);
searchDTO
.
setSearchName
(
storeSearchParams
);
// 企业ID
searchDTO
.
setEnterpriseId
(
enterpriseId
);
if
(!
authStoreIdList
.
contains
(
"-1"
))
{
if
(!
authStoreIdList
.
contains
(
"-1"
))
{
searchDTO
.
setAuthStoreIdList
(
authStoreIdList
);
}
// 门店参数
...
...
@@ -1722,10 +1778,10 @@ public class WxStaffController extends WebBaseController {
logger
.
info
(
"查询条件={}"
,
JSON
.
toJSONString
(
page
));
Map
<
String
,
Object
>
result
=
storeService
.
getStoreListPage
(
page
);
page
=
(
Page
)
result
.
get
(
"page"
);
return
page
;
return
page
;
}
private
List
<
StoreListVO
>
toList
(
List
<
StoreDTO
>
storeList
){
private
List
<
StoreListVO
>
toList
(
List
<
StoreDTO
>
storeList
)
{
List
<
StoreListVO
>
retList
=
new
ArrayList
<
StoreListVO
>();
StoreListVO
vo
=
null
;
for
(
StoreDTO
dto
:
storeList
)
{
...
...
@@ -1735,53 +1791,57 @@ public class WxStaffController extends WebBaseController {
vo
.
setStoreCode
(
dto
.
getStoreCode
());
retList
.
add
(
vo
);
}
return
retList
;
return
retList
;
}
//区经门店查询
//
区经门店查询
@RequestMapping
(
"search-clerk-store"
)
public
RestResponse
<
Object
>
listClerkStoreByParams
(
String
wxEnterpriseId
,
String
enterpriseId
,
String
clerkId
,
String
storeSearchParams
)
{
if
(
StringUtils
.
isEmpty
(
storeSearchParams
))
{
return
RestResponse
.
failure
(
"-1"
,
"查询条件为空"
)
;
public
RestResponse
<
Object
>
listClerkStoreByParams
(
String
wxEnterpriseId
,
String
enterpriseId
,
String
clerkId
,
String
storeSearchParams
)
{
if
(
StringUtils
.
isEmpty
(
storeSearchParams
))
{
return
RestResponse
.
failure
(
"-1"
,
"查询条件为空"
);
}
// 如果有权限控制,进行管辖门店过0滤
List
<
String
>
authStoreIdList
=
this
.
staffApiService
.
getHaoBanStoreIdsRolesByClerkId
(
clerkId
,
wxEnterpriseId
);
if
(
CollectionUtils
.
isEmpty
(
authStoreIdList
))
{
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
);
List
<
StoreDTO
>
storeList
=
(
List
<
StoreDTO
>)
page
.
getResult
();
return
RestResponse
.
successResult
(
toList
(
storeList
));
}
/**
* 门店导购查询
*/
@RequestMapping
(
"list-clerk"
)
public
RestResponse
<
Object
>
listClerk
(
String
enterpriseId
,
String
wxEnterpriseId
,
String
clerkId
,
String
clerkSearchParams
,
BasePageInfo
basePageInfo
)
{
ClerkDTO
clerk
=
this
.
clerkService
.
getclerkById
(
clerkId
)
;
int
clerkType
=
clerk
.
getClerkType
()
;
List
<
ClerkListVO
>
resultList
=
null
;
if
(
clerkType
!=
1
)
{
public
RestResponse
<
Object
>
listClerk
(
String
enterpriseId
,
String
wxEnterpriseId
,
String
clerkId
,
String
clerkSearchParams
,
BasePageInfo
basePageInfo
)
{
ClerkDTO
clerk
=
this
.
clerkService
.
getclerkById
(
clerkId
);
int
clerkType
=
clerk
.
getClerkType
();
List
<
ClerkListVO
>
resultList
=
null
;
if
(
clerkType
!=
1
)
{
return
RestResponse
.
failure
(
"-1"
,
"非店长身份"
);
}
List
<
ClerkListDTO
>
clerkList
=
clerkService
.
getClerkByStoreId
(
enterpriseId
,
clerk
.
getStoreId
());
if
(
CollectionUtils
.
isNotEmpty
(
clerkList
)
&&
StringUtils
.
isNotEmpty
(
clerkSearchParams
))
{
clerkList
=
clerkList
.
stream
().
filter
(
dto
->
dto
.
getClerkCode
().
contains
(
clerkSearchParams
)
||
dto
.
getClerkName
().
contains
(
clerkSearchParams
)).
collect
(
Collectors
.
toList
())
;
clerkList
=
clerkList
.
stream
().
filter
(
dto
->
dto
.
getClerkCode
().
contains
(
clerkSearchParams
)
||
dto
.
getClerkName
().
contains
(
clerkSearchParams
)).
collect
(
Collectors
.
toList
());
}
if
(
CollectionUtils
.
isEmpty
(
clerkList
))
{
return
RestResponse
.
failure
(
"-1"
,
"无导购"
);
}
resultList
=
EntityUtil
.
changeEntityListByJSON
(
ClerkListVO
.
class
,
clerkList
);
List
<
String
>
clerkIdList
=
resultList
.
stream
().
map
(
dto
->
dto
.
getClerkId
()).
collect
(
Collectors
.
toList
())
;
List
<
StaffClerkRelationDTO
>
relationList
=
this
.
staffClerkRelationApiService
.
listByClerkIdsWxEnterpriseId
(
clerkIdList
,
wxEnterpriseId
)
;
if
(
CollectionUtils
.
isEmpty
(
relationList
))
{
List
<
String
>
clerkIdList
=
resultList
.
stream
().
map
(
dto
->
dto
.
getClerkId
()).
collect
(
Collectors
.
toList
());
List
<
StaffClerkRelationDTO
>
relationList
=
this
.
staffClerkRelationApiService
.
listByClerkIdsWxEnterpriseId
(
clerkIdList
,
wxEnterpriseId
);
if
(
CollectionUtils
.
isEmpty
(
relationList
))
{
return
RestResponse
.
failure
(
"-1"
,
"无导购"
);
}
List
<
String
>
retlationIdList
=
relationList
.
stream
().
map
(
dto
->
dto
.
getClerkId
()).
collect
(
Collectors
.
toList
())
;
resultList
.
removeIf
(
item
->
{
return
!
retlationIdList
.
contains
(
item
.
getClerkId
())
;
})
;
List
<
String
>
retlationIdList
=
relationList
.
stream
().
map
(
dto
->
dto
.
getClerkId
()).
collect
(
Collectors
.
toList
())
;
resultList
.
removeIf
(
item
->
{
return
!
retlationIdList
.
contains
(
item
.
getClerkId
())
;
});
Page
<
ClerkListVO
>
retPage
=
new
Page
<>();
retPage
.
setPageSize
(
resultList
.
size
());
retPage
.
setCurrentPage
(
1
);
...
...
@@ -1795,21 +1855,33 @@ public class WxStaffController extends WebBaseController {
* 判断成员是否授权获取敏感信息
*/
@RequestMapping
(
"get-sensitive-status"
)
public
RestResponse
<
Object
>
getSensitiveStatus
(
String
staffId
){
public
RestResponse
<
Object
>
getSensitiveStatus
(
String
staffId
)
{
int
result
=
staffApiService
.
getSensitiveStatus
(
staffId
);
return
RestResponse
.
successResult
(
result
)
;
return
RestResponse
.
successResult
(
result
);
}
@RequestMapping
(
"update-qr-code"
)
public
RestResponse
<
Object
>
updateQrCode
(
String
staffId
,
String
qrCode
)
{
this
.
staffApiService
.
updateQrCodeByStaffId
(
staffId
,
qrCode
)
;
return
RestResponse
.
successResult
()
;
public
RestResponse
<
Object
>
updateQrCode
(
String
staffId
,
String
qrCode
)
{
this
.
staffApiService
.
updateQrCodeByStaffId
(
staffId
,
qrCode
);
return
RestResponse
.
successResult
();
}
// 判断是否有内容中台权限
@RequestMapping
(
"hascontent-right"
)
public
RestResponse
<
Object
>
hasContentRight
(
String
enterpriseId
,
String
staffId
)
{
this
.
enterpriseUseForbidService
.
getUseEnterpriseByCode
(
""
,
enterpriseId
)
;
return
RestResponse
.
successResult
(
true
)
;
@RequestMapping
(
"has-content-right"
)
public
RestResponse
<
Object
>
hasContentRight
(
String
enterpriseId
)
{
ServiceResponse
<
List
<
EnterpriseUsingStatusDTO
>>
resp
=
this
.
enterpriseUseForbidService
.
getUseEnterpriseByCode
(
EnterpriseServiceEnum
.
CONTENT
.
getRightMenuCode
(),
enterpriseId
);
logger
.
info
(
"内容中台权限={},{}"
,
JSON
.
toJSONString
(
resp
),
enterpriseId
);
List
<
EnterpriseUsingStatusDTO
>
list
=
resp
.
getResult
()
;
RightVO
vo
=
new
RightVO
();
if
(
CollectionUtils
.
isEmpty
(
list
))
{
return
RestResponse
.
successResult
(
vo
);
}
EnterpriseUsingStatusDTO
dto
=
list
.
get
(
0
)
;
if
(
dto
.
getVaild
())
{
vo
.
setStatus
(
1
);
}
else
{
vo
.
setStatus
(
2
);
}
return
RestResponse
.
successResult
(
vo
);
}
}
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/vo/RightVO.java
0 → 100644
View file @
1c63a19d
package
com
.
gic
.
haoban
.
manage
.
web
.
vo
;
import
java.io.Serializable
;
public
class
RightVO
implements
Serializable
{
/**
* @Fields serialVersionUID : TODO(用一句话描述这个变量表示什么)
*/
private
static
final
long
serialVersionUID
=
70105969355665707L
;
// 0未购买 1正常 2已过期
private
int
status
;
public
int
getStatus
()
{
return
status
;
}
public
void
setStatus
(
int
status
)
{
this
.
status
=
status
;
}
}
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