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
f64314e1
Commit
f64314e1
authored
May 22, 2024
by
guojx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
流失数据接口
parent
1f5a85d1
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
1466 additions
and
83 deletions
+1466
-83
WechatWorkController.java
...ic/haoban/manage/web/controller/WechatWorkController.java
+256
-73
WechatWorkLostClerkHandle.java
...c/haoban/manage/web/handle/WechatWorkLostClerkHandle.java
+89
-0
WechatWorkLostDetailHandle.java
.../haoban/manage/web/handle/WechatWorkLostDetailHandle.java
+81
-0
WechatWorkLostStoreGroupHandle.java
...ban/manage/web/handle/WechatWorkLostStoreGroupHandle.java
+74
-0
StoreGroupCommonQO.java
...c/haoban/manage/web/qo/wechatwork/StoreGroupCommonQO.java
+57
-0
WechatWorkLostClerkQO.java
...aoban/manage/web/qo/wechatwork/WechatWorkLostClerkQO.java
+99
-0
WechatWorkLostDetailQO.java
...oban/manage/web/qo/wechatwork/WechatWorkLostDetailQO.java
+114
-0
WechatWorkLostOverviewQO.java
...an/manage/web/qo/wechatwork/WechatWorkLostOverviewQO.java
+6
-1
WechatWorkLostStoreGroupQO.java
.../manage/web/qo/wechatwork/WechatWorkLostStoreGroupQO.java
+82
-0
StoreAuthUtils.java
.../com/gic/haoban/manage/web/utils/data/StoreAuthUtils.java
+438
-0
DataPageVO.java
...a/com/gic/haoban/manage/web/vo/wechatwork/DataPageVO.java
+18
-0
StoreGroupCommonVO.java
...c/haoban/manage/web/vo/wechatwork/StoreGroupCommonVO.java
+25
-0
WechatWorkLostClerkVO.java
...aoban/manage/web/vo/wechatwork/WechatWorkLostClerkVO.java
+39
-0
WechatWorkLostDetailVO.java
...oban/manage/web/vo/wechatwork/WechatWorkLostDetailVO.java
+74
-0
WechatWorkLostStoreGroupVO.java
.../manage/web/vo/wechatwork/WechatWorkLostStoreGroupVO.java
+14
-9
No files found.
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/WechatWorkController.java
View file @
f64314e1
...
@@ -3,26 +3,30 @@ package com.gic.haoban.manage.web.controller;
...
@@ -3,26 +3,30 @@ package com.gic.haoban.manage.web.controller;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.api.base.commons.JSONResponse
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.Page
;
import
com.gic.clerk.api.dto.AuthorizedUser
;
import
com.gic.commons.util.DataApiUtils
;
import
com.gic.commons.util.DataApiUtils
;
import
com.gic.commons.util.DateUtil
;
import
com.gic.commons.util.DateUtil
;
import
com.gic.commons.webapi.reponse.RestResponse
;
import
com.gic.commons.webapi.reponse.RestResponse
;
import
com.gic.enterprise.api.dto.StoreDTO
;
import
com.gic.haoban.manage.web.handle.WechatWorkLostClerkHandle
;
import
com.gic.enterprise.api.dto.StoreSearchDTO
;
import
com.gic.haoban.manage.web.handle.WechatWorkLostDetailHandle
;
import
com.gic.enterprise.api.service.StoreGroupService
;
import
com.gic.haoban.manage.web.handle.WechatWorkLostStoreGroupHandle
;
import
com.gic.enterprise.api.service.StoreService
;
import
com.gic.haoban.manage.web.qo.wechatwork.*
;
import
com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO
;
import
com.gic.haoban.common.utils.AuthWebRequestUtil
;
import
com.gic.haoban.manage.api.service.StaffApiService
;
import
com.gic.haoban.manage.web.qo.wechatwork.StoreCommonQO
;
import
com.gic.haoban.manage.web.qo.wechatwork.WechatWorkLostOverviewQO
;
import
com.gic.haoban.manage.web.utils.data.ConcurrencyUtils
;
import
com.gic.haoban.manage.web.utils.data.ConcurrencyUtils
;
import
com.gic.haoban.manage.web.utils.data.MapThreadHandlerRequest
;
import
com.gic.haoban.manage.web.utils.data.MapThreadHandlerRequest
;
import
com.gic.haoban.manage.web.utils.data.StoreAuthUtils
;
import
com.gic.haoban.manage.web.vo.wechatwork.DataPageVO
;
import
com.gic.haoban.manage.web.vo.wechatwork.WechatWorkLostDetailVO
;
import
com.gic.haoban.manage.web.vo.wechatwork.WechatWorkLostVO
;
import
com.gic.haoban.manage.web.vo.wechatwork.WechatWorkLostVO
;
import
com.gic.qcloud.BucketNameEnum
;
import
com.gic.web.common.controller.NewBaseController
;
import
com.gic.web.common.controller.NewBaseController
;
import
com.gic.web.common.download.DownloadTask
;
import
com.gic.web.common.download.DownloadTaskUtil
;
import
com.gic.web.common.download.constants.TaskTypeEnum
;
import
com.gic.web.common.utils.SessionContextUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
@@ -30,7 +34,6 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -30,7 +34,6 @@ import org.springframework.web.bind.annotation.RestController;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -45,11 +48,13 @@ import java.util.stream.Collectors;
...
@@ -45,11 +48,13 @@ import java.util.stream.Collectors;
@RequestMapping
(
"wechat-work"
)
@RequestMapping
(
"wechat-work"
)
public
class
WechatWorkController
extends
NewBaseController
{
public
class
WechatWorkController
extends
NewBaseController
{
@Autowired
@Autowired
private
Store
GroupService
storeGroupService
;
private
Store
AuthUtils
storeAuthUtils
;
@Autowired
@Autowired
private
StaffApiService
staffApiServic
e
;
private
WechatWorkLostClerkHandle
wechatWorkLostClerkHandl
e
;
@Autowired
@Autowired
private
StoreService
storeService
;
private
WechatWorkLostStoreGroupHandle
wechatWorkLostStoreGroupHandle
;
@Autowired
private
WechatWorkLostDetailHandle
wechatWorkLostDetailHandle
;
/**
/**
* 流失数据概览
* 流失数据概览
...
@@ -59,7 +64,7 @@ public class WechatWorkController extends NewBaseController {
...
@@ -59,7 +64,7 @@ public class WechatWorkController extends NewBaseController {
@RequestMapping
(
value
=
"lost-overview"
)
@RequestMapping
(
value
=
"lost-overview"
)
public
RestResponse
<
WechatWorkLostVO
>
lostOverview
(
@RequestBody
WechatWorkLostOverviewQO
qo
)
{
public
RestResponse
<
WechatWorkLostVO
>
lostOverview
(
@RequestBody
WechatWorkLostOverviewQO
qo
)
{
JSONObject
jsonObject
=
(
JSONObject
)
JSONObject
.
toJSON
(
qo
);
JSONObject
jsonObject
=
(
JSONObject
)
JSONObject
.
toJSON
(
qo
);
s
etCommonParam
(
jsonObject
,
qo
);
s
toreAuthUtils
.
setCommonParam
(
jsonObject
,
new
StoreGroupCommonQO
().
setStoreGroupId
(
qo
.
getStoreGroupId
())
);
Map
<
String
,
Object
>
res
=
DataApiUtils
.
http
(
jsonObject
.
toJSONString
(),
"data_mbr_scale_haoban_background_loss"
);
Map
<
String
,
Object
>
res
=
DataApiUtils
.
http
(
jsonObject
.
toJSONString
(),
"data_mbr_scale_haoban_background_loss"
);
List
<
JSONObject
>
list
=
DataApiUtils
.
getDataList
(
res
);
List
<
JSONObject
>
list
=
DataApiUtils
.
getDataList
(
res
);
List
<
WechatWorkLostVO
>
voList
=
JSONArray
.
parseArray
(
JSON
.
toJSONString
(
list
),
WechatWorkLostVO
.
class
);
List
<
WechatWorkLostVO
>
voList
=
JSONArray
.
parseArray
(
JSON
.
toJSONString
(
list
),
WechatWorkLostVO
.
class
);
...
@@ -75,7 +80,7 @@ public class WechatWorkController extends NewBaseController {
...
@@ -75,7 +80,7 @@ public class WechatWorkController extends NewBaseController {
@RequestMapping
(
value
=
"lost-overview-trend"
)
@RequestMapping
(
value
=
"lost-overview-trend"
)
public
RestResponse
<
List
<
WechatWorkLostVO
>>
lostOverviewTrend
(
@RequestBody
WechatWorkLostOverviewQO
qo
)
throws
ParseException
{
public
RestResponse
<
List
<
WechatWorkLostVO
>>
lostOverviewTrend
(
@RequestBody
WechatWorkLostOverviewQO
qo
)
throws
ParseException
{
JSONObject
jsonObject
=
(
JSONObject
)
JSONObject
.
toJSON
(
qo
);
JSONObject
jsonObject
=
(
JSONObject
)
JSONObject
.
toJSON
(
qo
);
s
etCommonParam
(
jsonObject
,
qo
);
s
toreAuthUtils
.
setCommonParam
(
jsonObject
,
new
StoreGroupCommonQO
().
setStoreGroupId
(
qo
.
getStoreGroupId
())
);
List
<
MapThreadHandlerRequest
>
list
=
new
ArrayList
<>();
List
<
MapThreadHandlerRequest
>
list
=
new
ArrayList
<>();
jsonObject
.
put
(
"groupType"
,
1
);
jsonObject
.
put
(
"groupType"
,
1
);
...
@@ -120,72 +125,250 @@ public class WechatWorkController extends NewBaseController {
...
@@ -120,72 +125,250 @@ public class WechatWorkController extends NewBaseController {
return
RestResponse
.
successResult
(
voList
);
return
RestResponse
.
successResult
(
voList
);
}
}
private
void
setCommonParam
(
JSONObject
jsonObject
,
StoreCommonQO
storeCommonQO
)
{
/**
List
<
String
>
storeIds
=
getAuthStoreId
(
storeCommonQO
);
* 流失数据统计-门店分组
if
(
CollectionUtils
.
isNotEmpty
(
storeIds
))
{
* @param qo
jsonObject
.
put
(
"storeId"
,
storeIds
);
* @return
}
*/
WebLoginDTO
login
=
AuthWebRequestUtil
.
getLoginUser
();
@RequestMapping
(
value
=
"lost-store-group"
)
jsonObject
.
put
(
"enterpriseId"
,
login
.
getEnterpriseId
());
public
RestResponse
<
DataPageVO
>
lostStoreGroup
(
@RequestBody
WechatWorkLostStoreGroupQO
qo
)
{
JSONObject
jsonObject
=
new
JSONObject
();
qo
.
dealWithParam
(
jsonObject
);
storeAuthUtils
.
setStoreGroupJsonParam
(
jsonObject
,
qo
);
jsonObject
.
put
(
"apolloKey"
,
"data_mbr_scale_haoban_background_loss_statisti"
);
jsonObject
.
put
(
"groupType"
,
1
);
DataPageVO
vo
=
storeAuthUtils
.
getDataCommon
(
jsonObject
.
toJSONString
(),
qo
.
getPageNum
(),
"data_mbr_scale_haoban_background_loss_statisti"
,
qo
.
getPageSize
(),
true
);
return
RestResponse
.
successResult
(
vo
);
}
}
private
List
<
String
>
getAuthStoreId
(
StoreCommonQO
storeCommonQO
)
{
/**
String
storeGroupId
=
storeCommonQO
.
getStoreGroupId
();
* 流失数据统计-门店分组导出
String
storeSearchParam
=
storeCommonQO
.
getStoreSearchParam
();
* @param qo
String
storeId
=
storeCommonQO
.
getStoreId
();
* @return
WebLoginDTO
login
=
AuthWebRequestUtil
.
getLoginUser
();
*/
List
<
String
>
roleStoreIds
=
staffApiService
.
getHaoBanStoreIdsRolesByClerkId
(
login
.
getClerkId
(),
login
.
getWxEnterpriseId
());
@RequestMapping
(
value
=
"export-lost-store-group"
)
if
(
CollectionUtils
.
isEmpty
(
roleStoreIds
))
{
public
RestResponse
exportLostStoreGroup
(
@RequestBody
WechatWorkLostStoreGroupQO
qo
)
{
log
.
info
(
"登录人无门店权限"
);
AuthorizedUser
user
=
SessionContextUtils
.
getLoginUser
();
return
getNoExistStore
();
DownloadTask
task
=
new
DownloadTask
();
task
.
setTaskTypeEnum
(
TaskTypeEnum
.
STORE_RANK_DOWNLOAD
);
task
.
setDataType
(
qo
.
getDataType
());
task
.
setUser
(
user
);
task
.
setTotalCount
(
lostStoreGroup
(
qo
).
getResult
().
getTotalNum
());
JSONObject
jsonObject
=
new
JSONObject
();
qo
.
dealWithParam
(
jsonObject
);
storeAuthUtils
.
setStoreGroupJsonParam
(
jsonObject
,
qo
);
jsonObject
.
put
(
"apolloKey"
,
"data_mbr_scale_haoban_background_loss_statisti"
);
jsonObject
.
put
(
"groupType"
,
1
);
//Excel的标题是字段进行计算
List
<
String
>
indexList
=
new
ArrayList
<>();
List
<
String
>
fieldList
=
new
ArrayList
<>();
Integer
storeGroup
=
jsonObject
.
getInteger
(
"storeGroup"
);
boolean
isStore
=
storeGroup
!=
null
&&
storeGroup
==
7
;
if
(
isStore
)
{
indexList
.
add
(
"门店名称"
);
fieldList
.
add
(
"storeName"
);
indexList
.
add
(
"门店code"
);
fieldList
.
add
(
"storeCode"
);
}
else
{
indexList
.
add
(
"分组名称"
);
fieldList
.
add
(
"storeGroupName"
);
}
}
if
(
StringUtils
.
isNotBlank
(
storeGroupId
)
||
StringUtils
.
isNotBlank
(
storeSearchParam
))
{
StoreSearchDTO
storeSearch
=
new
StoreSearchDTO
();
indexList
.
add
(
"上级分组"
);
storeSearch
.
setEnterpriseId
(
login
.
getEnterpriseId
());
fieldList
.
add
(
"parentStoreGroupName"
);
if
(
StringUtils
.
isNotBlank
(
storeGroupId
))
{
indexList
.
add
(
"删除导购人数"
);
List
<
String
>
storeGroupIds
=
Arrays
.
stream
(
storeGroupId
.
split
(
","
)).
collect
(
Collectors
.
toList
());
fieldList
.
add
(
"deleteSalesNum"
);
List
<
String
>
groupIds
=
storeGroupService
.
getStoreGroupIdsByParentGroupId
(
login
.
getEnterpriseId
(),
storeGroupIds
);
indexList
.
add
(
"导购删除人数"
);
storeSearch
.
setStoreGroupIdList
(
groupIds
);
fieldList
.
add
(
"salesDeleteNum"
);
}
indexList
.
add
(
"单向好友人数"
);
if
(
StringUtils
.
isNotBlank
(
storeSearchParam
))
{
fieldList
.
add
(
"onewayFriendNum"
);
storeSearch
.
setSearchName
(
storeSearchParam
);
}
Page
pageStore
=
new
Page
<>();
task
.
setFileName
(
"流失好友-门店维度数据统计-"
+
qo
.
getStartDate
()
+
"_"
+
qo
.
getEndDate
());
//-1代表不分页
task
.
setChannelName
(
"数据-企微数据-流失好友"
);
pageStore
.
setCurrentPage
(-
1
);
task
.
setBucketName
(
BucketNameEnum
.
REPORT_50000
.
getName
());
Page
resultPage
=
storeService
.
storeListPage
(
pageStore
,
storeSearch
);
jsonObject
.
put
(
"indexList"
,
indexList
);
List
<
StoreDTO
>
storeDTOList
=
resultPage
.
getResult
();
jsonObject
.
put
(
"fieldList"
,
fieldList
);
if
(
CollectionUtils
.
isEmpty
(
storeDTOList
))
{
task
.
setSearchDataParams
(
jsonObject
.
toJSONString
());
return
getNoExistStore
();
task
.
setHandler
(
wechatWorkLostStoreGroupHandle
);
}
JSONResponse
downloadTask
=
DownloadTaskUtil
.
createDownloadTask
(
task
);
List
<
String
>
searchStoreIdList
=
storeDTOList
.
stream
().
map
(
e
->
e
.
getStoreId
()).
collect
(
Collectors
.
toList
());
return
RestResponse
.
successResult
(
downloadTask
.
getResult
());
if
(
isAllAuth
(
roleStoreIds
))
{
}
return
searchStoreIdList
;
}
/**
//交集
* 流失数据统计-导购
roleStoreIds
.
retainAll
(
searchStoreIdList
);
* @param qo
if
(
CollectionUtils
.
isEmpty
(
roleStoreIds
))
{
* @return
return
getNoExistStore
();
*/
}
@RequestMapping
(
value
=
"lost-clerk"
)
public
RestResponse
<
DataPageVO
>
lostClerk
(
@RequestBody
WechatWorkLostClerkQO
qo
)
{
JSONObject
jsonObject
=
new
JSONObject
();
qo
.
dealWithParam
(
jsonObject
);
storeAuthUtils
.
setCommonParam
(
jsonObject
,
new
StoreGroupCommonQO
());
jsonObject
.
put
(
"groupType"
,
2
);
Map
<
String
,
Object
>
res
=
DataApiUtils
.
http
(
jsonObject
.
toJSONString
(),
"data_mbr_scale_haoban_background_loss_statisti"
);
Page
page
=
DataApiUtils
.
getPageData
(
res
);
DataPageVO
vo
=
new
DataPageVO
();
vo
.
setPageSize
(
page
.
getPageSize
());
vo
.
setPageNum
(
page
.
getCurrentPage
());
List
<
JSONObject
>
list
=
page
.
getResult
();
vo
.
setTotalNum
(
page
.
getTotalCount
());
jsonObject
.
put
(
"groupType"
,
1
);
jsonObject
.
put
(
"storeGroup"
,
8
);
JSONObject
total
=
storeAuthUtils
.
getTotalJson
(
jsonObject
,
"data_mbr_scale_haoban_background_loss_statisti"
);
if
(
list
==
null
)
{
list
=
new
ArrayList
<>();
}
}
if
(
StringUtils
.
isNotBlank
(
storeId
))
{
if
(
total
!=
null
)
{
List
<
String
>
ids
=
Arrays
.
stream
(
storeId
.
split
(
","
)).
collect
(
Collectors
.
toList
());
storeAuthUtils
.
setChannelGroupList
(
total
);
roleStoreIds
.
retainAll
(
ids
);
list
.
add
(
0
,
total
);
if
(
CollectionUtils
.
isEmpty
(
roleStoreIds
))
{
return
getNoExistStore
();
}
}
}
return
roleStoreIds
;
vo
.
setRows
(
list
);
return
RestResponse
.
successResult
(
vo
);
}
}
private
static
boolean
isAllAuth
(
List
<
String
>
roleStoreIds
)
{
/**
return
roleStoreIds
.
size
()
==
1
&&
"-1"
.
equals
(
roleStoreIds
.
get
(
0
));
* 流失数据统计-导购导出
* @param qo
* @return
*/
@RequestMapping
(
value
=
"export-lost-clerk"
)
public
RestResponse
exportLostClerk
(
@RequestBody
WechatWorkLostClerkQO
qo
)
{
AuthorizedUser
user
=
SessionContextUtils
.
getLoginUser
();
DownloadTask
task
=
new
DownloadTask
();
task
.
setTaskTypeEnum
(
TaskTypeEnum
.
STORE_RANK_DOWNLOAD
);
task
.
setDataType
(
qo
.
getDataType
());
task
.
setUser
(
user
);
task
.
setTotalCount
(
lostClerk
(
qo
).
getResult
().
getTotalNum
());
JSONObject
jsonObject
=
new
JSONObject
();
qo
.
dealWithParam
(
jsonObject
);
storeAuthUtils
.
setCommonParam
(
jsonObject
,
new
StoreGroupCommonQO
());
jsonObject
.
put
(
"apolloKey"
,
"data_mbr_scale_haoban_background_loss_statisti"
);
jsonObject
.
put
(
"groupType"
,
2
);
//Excel的标题是字段进行计算
List
<
String
>
indexList
=
new
ArrayList
<>();
List
<
String
>
fieldList
=
new
ArrayList
<>();
indexList
.
add
(
"导购姓名"
);
fieldList
.
add
(
"clerkName"
);
indexList
.
add
(
"导购code"
);
fieldList
.
add
(
"clerkCode"
);
indexList
.
add
(
"所属门店名称"
);
fieldList
.
add
(
"storeName"
);
indexList
.
add
(
"所属门店code"
);
fieldList
.
add
(
"storeCode"
);
indexList
.
add
(
"所属分组"
);
fieldList
.
add
(
"storeGroupName"
);
indexList
.
add
(
"删除导购人数"
);
fieldList
.
add
(
"deleteSalesNum"
);
indexList
.
add
(
"导购删除人数"
);
fieldList
.
add
(
"salesDeleteNum"
);
indexList
.
add
(
"单向好友人数"
);
fieldList
.
add
(
"onewayFriendNum"
);
task
.
setFileName
(
"流失好友-导购维度数据统计-"
+
qo
.
getStartDate
()
+
"_"
+
qo
.
getEndDate
());
task
.
setChannelName
(
"数据-企微数据-流失好友"
);
task
.
setBucketName
(
BucketNameEnum
.
REPORT_50000
.
getName
());
jsonObject
.
put
(
"indexList"
,
indexList
);
jsonObject
.
put
(
"fieldList"
,
fieldList
);
task
.
setSearchDataParams
(
jsonObject
.
toJSONString
());
task
.
setHandler
(
wechatWorkLostClerkHandle
);
JSONResponse
downloadTask
=
DownloadTaskUtil
.
createDownloadTask
(
task
);
return
RestResponse
.
successResult
(
downloadTask
.
getResult
());
}
}
private
static
List
<
String
>
getNoExistStore
()
{
/**
List
<
String
>
list
=
new
ArrayList
<>(
1
);
* 流失明细
list
.
add
(
"no_exist_store_id"
);
* @param qo
return
list
;
* @return
*/
@RequestMapping
(
value
=
"lost-detail"
)
public
RestResponse
<
DataPageVO
<
WechatWorkLostDetailVO
>>
lostDetail
(
@RequestBody
WechatWorkLostDetailQO
qo
)
{
JSONObject
jsonObject
=
new
JSONObject
();
qo
.
dealWithParam
(
jsonObject
);
storeAuthUtils
.
setCommonParam
(
jsonObject
,
new
StoreGroupCommonQO
());
Map
<
String
,
Object
>
res
=
DataApiUtils
.
http
(
jsonObject
.
toJSONString
(),
"data_mbr_scale_haoban_background_loss_detail"
);
Page
page
=
DataApiUtils
.
getPageData
(
res
);
DataPageVO
<
WechatWorkLostDetailVO
>
vo
=
new
DataPageVO
();
vo
.
setPageSize
(
page
.
getPageSize
());
vo
.
setPageNum
(
page
.
getCurrentPage
());
List
<
JSONObject
>
list
=
page
.
getResult
();
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
List
<
WechatWorkLostDetailVO
>
voList
=
JSONArray
.
parseArray
(
JSON
.
toJSONString
(
list
),
WechatWorkLostDetailVO
.
class
);
vo
.
setRows
(
voList
);
}
vo
.
setTotalNum
(
page
.
getTotalCount
());
return
RestResponse
.
successResult
(
vo
);
}
}
/**
* 流失明细-导出
* @param qo
* @return
*/
@RequestMapping
(
value
=
"export-lost-clerk"
)
public
RestResponse
exportLostClerk
(
@RequestBody
WechatWorkLostDetailQO
qo
)
{
AuthorizedUser
user
=
SessionContextUtils
.
getLoginUser
();
DownloadTask
task
=
new
DownloadTask
();
task
.
setTaskTypeEnum
(
TaskTypeEnum
.
STORE_RANK_DOWNLOAD
);
task
.
setDataType
(
qo
.
getDataType
());
task
.
setUser
(
user
);
task
.
setTotalCount
(
lostDetail
(
qo
).
getResult
().
getTotalNum
());
JSONObject
jsonObject
=
new
JSONObject
();
qo
.
dealWithParam
(
jsonObject
);
storeAuthUtils
.
setCommonParam
(
jsonObject
,
new
StoreGroupCommonQO
());
jsonObject
.
put
(
"apolloKey"
,
"data_mbr_scale_haoban_background_loss_detail"
);
//Excel的标题是字段进行计算
List
<
String
>
indexList
=
new
ArrayList
<>();
List
<
String
>
fieldList
=
new
ArrayList
<>();
indexList
.
add
(
"客户姓名"
);
fieldList
.
add
(
"memberName"
);
indexList
.
add
(
"客户昵称"
);
fieldList
.
add
(
"memberNick"
);
indexList
.
add
(
"客户手机号"
);
fieldList
.
add
(
"memberPhone"
);
indexList
.
add
(
"导购姓名"
);
fieldList
.
add
(
"clerkName"
);
indexList
.
add
(
"导购code"
);
fieldList
.
add
(
"clerkCode"
);
indexList
.
add
(
"所属门店名称"
);
fieldList
.
add
(
"storeName"
);
indexList
.
add
(
"所属门店code"
);
fieldList
.
add
(
"storeCode"
);
indexList
.
add
(
"删除类型"
);
fieldList
.
add
(
"deleteType"
);
indexList
.
add
(
"留存天数"
);
fieldList
.
add
(
"remainDays"
);
indexList
.
add
(
"添加好友时间"
);
fieldList
.
add
(
"addTime"
);
indexList
.
add
(
"最近消费时间"
);
fieldList
.
add
(
"lastCsmeDate"
);
indexList
.
add
(
"删除时间"
);
fieldList
.
add
(
"deleteTime"
);
task
.
setFileName
(
"流失好友-流失明细-"
+
qo
.
getStartDate
()
+
"_"
+
qo
.
getEndDate
());
task
.
setChannelName
(
"数据-企微数据-流失好友"
);
task
.
setBucketName
(
BucketNameEnum
.
REPORT_50000
.
getName
());
jsonObject
.
put
(
"indexList"
,
indexList
);
jsonObject
.
put
(
"fieldList"
,
fieldList
);
task
.
setSearchDataParams
(
jsonObject
.
toJSONString
());
task
.
setHandler
(
wechatWorkLostDetailHandle
);
JSONResponse
downloadTask
=
DownloadTaskUtil
.
createDownloadTask
(
task
);
return
RestResponse
.
successResult
(
downloadTask
.
getResult
());
}
}
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/handle/WechatWorkLostClerkHandle.java
0 → 100644
View file @
f64314e1
package
com
.
gic
.
haoban
.
manage
.
web
.
handle
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.commons.util.DataApiUtils
;
import
com.gic.enterprise.api.dto.security.DownloadReportDTO
;
import
com.gic.haoban.manage.web.utils.data.StoreAuthUtils
;
import
com.gic.haoban.manage.web.vo.wechatwork.WechatWorkLostClerkVO
;
import
com.gic.web.common.download.DownloadHandlerAbstract
;
import
com.gic.web.common.download.context.Context
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.*
;
/**
* 数据-企微数据-流失好友-导购
*/
@Component
public
class
WechatWorkLostClerkHandle
extends
DownloadHandlerAbstract
<
WechatWorkLostClerkVO
>
{
private
static
final
Logger
LOGGER
=
LogManager
.
getLogger
(
WechatWorkLostClerkHandle
.
class
);
@Autowired
private
StoreAuthUtils
storeAuthUtils
;
@Override
public
List
<
WechatWorkLostClerkVO
>
getData
(
Context
context
,
String
searchDataParams
,
Integer
currentPage
)
{
boolean
isFirst
=
currentPage
!=
null
&&
currentPage
==
1
;
if
(
isFirst
)
{
LOGGER
.
info
(
"数据-企微数据-流失好友-导购导出日志"
);
}
JSONObject
jsonObject
=
JSON
.
parseObject
(
searchDataParams
);
Map
<
String
,
Object
>
res
=
DataApiUtils
.
http
(
jsonObject
.
toJSONString
(),
"data_mbr_scale_haoban_background_loss_statisti"
);
List
<
JSONObject
>
list
=
DataApiUtils
.
getPageList
(
res
);
jsonObject
.
put
(
"groupType"
,
1
);
jsonObject
.
put
(
"storeGroup"
,
8
);
JSONObject
total
=
storeAuthUtils
.
getTotalJson
(
jsonObject
,
"data_mbr_scale_haoban_background_loss_statisti"
);
if
(
list
==
null
)
{
list
=
new
ArrayList
<>();
}
if
(
total
!=
null
)
{
storeAuthUtils
.
setChannelGroupList
(
total
);
list
.
add
(
0
,
total
);
}
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
List
<
WechatWorkLostClerkVO
>
result
=
JSONObject
.
parseArray
(
JSON
.
toJSONString
(
list
),
WechatWorkLostClerkVO
.
class
);
return
result
;
}
return
Collections
.
EMPTY_LIST
;
}
@Override
public
List
<
String
>
getColumnNames
()
{
return
Collections
.
EMPTY_LIST
;
}
@Override
public
List
<
String
>
getColumnNames
(
Context
context
){
DownloadReportDTO
downloadReportDTO
=
context
.
getDownloadReportDTO
();
String
searchDataParams
=
downloadReportDTO
.
getSearchDataParams
();
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
searchDataParams
);
List
<
String
>
list
=
(
List
<
String
>)
jsonObject
.
get
(
"indexList"
);
return
list
;
}
@Override
public
LinkedHashMap
<
String
,
List
<
String
>>
doubleColumnNames
()
{
return
null
;
}
@Override
public
List
<
String
>
getColumns
()
{
return
Collections
.
EMPTY_LIST
;
}
@Override
public
List
<
String
>
getColumns
(
Context
context
)
{
DownloadReportDTO
downloadReportDTO
=
context
.
getDownloadReportDTO
();
String
searchDataParams
=
downloadReportDTO
.
getSearchDataParams
();
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
searchDataParams
);
List
<
String
>
list
=
(
List
<
String
>)
jsonObject
.
get
(
"fieldList"
);
return
list
;
}
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/handle/WechatWorkLostDetailHandle.java
0 → 100644
View file @
f64314e1
package
com
.
gic
.
haoban
.
manage
.
web
.
handle
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.commons.util.DataApiUtils
;
import
com.gic.enterprise.api.dto.security.DownloadReportDTO
;
import
com.gic.haoban.manage.web.utils.data.StoreAuthUtils
;
import
com.gic.haoban.manage.web.vo.wechatwork.WechatWorkLostDetailVO
;
import
com.gic.web.common.download.DownloadHandlerAbstract
;
import
com.gic.web.common.download.context.Context
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.Collections
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 数据-企微数据-流失好友-明细
*/
@Component
public
class
WechatWorkLostDetailHandle
extends
DownloadHandlerAbstract
<
WechatWorkLostDetailVO
>
{
private
static
final
Logger
LOGGER
=
LogManager
.
getLogger
(
WechatWorkLostDetailHandle
.
class
);
@Autowired
private
StoreAuthUtils
storeAuthUtils
;
@Override
public
List
<
WechatWorkLostDetailVO
>
getData
(
Context
context
,
String
searchDataParams
,
Integer
currentPage
)
{
boolean
isFirst
=
currentPage
!=
null
&&
currentPage
==
1
;
if
(
isFirst
)
{
LOGGER
.
info
(
"数据-企微数据-流失好友-明细导出日志"
);
}
JSONObject
jsonObject
=
JSON
.
parseObject
(
searchDataParams
);
Map
<
String
,
Object
>
res
=
DataApiUtils
.
http
(
jsonObject
.
toJSONString
(),
"data_mbr_scale_haoban_background_loss_detail"
);
List
<
JSONObject
>
list
=
DataApiUtils
.
getPageList
(
res
);
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
List
<
WechatWorkLostDetailVO
>
result
=
JSONObject
.
parseArray
(
JSON
.
toJSONString
(
list
),
WechatWorkLostDetailVO
.
class
);
return
result
;
}
return
Collections
.
EMPTY_LIST
;
}
@Override
public
List
<
String
>
getColumnNames
()
{
return
Collections
.
EMPTY_LIST
;
}
@Override
public
List
<
String
>
getColumnNames
(
Context
context
){
DownloadReportDTO
downloadReportDTO
=
context
.
getDownloadReportDTO
();
String
searchDataParams
=
downloadReportDTO
.
getSearchDataParams
();
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
searchDataParams
);
List
<
String
>
list
=
(
List
<
String
>)
jsonObject
.
get
(
"indexList"
);
return
list
;
}
@Override
public
LinkedHashMap
<
String
,
List
<
String
>>
doubleColumnNames
()
{
return
null
;
}
@Override
public
List
<
String
>
getColumns
()
{
return
Collections
.
EMPTY_LIST
;
}
@Override
public
List
<
String
>
getColumns
(
Context
context
)
{
DownloadReportDTO
downloadReportDTO
=
context
.
getDownloadReportDTO
();
String
searchDataParams
=
downloadReportDTO
.
getSearchDataParams
();
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
searchDataParams
);
List
<
String
>
list
=
(
List
<
String
>)
jsonObject
.
get
(
"fieldList"
);
return
list
;
}
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/handle/WechatWorkLostStoreGroupHandle.java
0 → 100644
View file @
f64314e1
package
com
.
gic
.
haoban
.
manage
.
web
.
handle
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.enterprise.api.dto.security.DownloadReportDTO
;
import
com.gic.haoban.manage.web.utils.data.StoreAuthUtils
;
import
com.gic.haoban.manage.web.vo.wechatwork.WechatWorkLostStoreGroupVO
;
import
com.gic.web.common.download.DownloadHandlerAbstract
;
import
com.gic.web.common.download.context.Context
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.Collections
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
/**
* 数据-企微数据-流失好友
*/
@Component
public
class
WechatWorkLostStoreGroupHandle
extends
DownloadHandlerAbstract
<
WechatWorkLostStoreGroupVO
>
{
private
static
final
Logger
LOGGER
=
LogManager
.
getLogger
(
WechatWorkLostStoreGroupHandle
.
class
);
@Autowired
private
StoreAuthUtils
storeAuthUtils
;
@Override
public
List
<
WechatWorkLostStoreGroupVO
>
getData
(
Context
context
,
String
searchDataParams
,
Integer
currentPage
)
{
List
<
JSONObject
>
list
=
storeAuthUtils
.
getDataCommon
(
searchDataParams
,
currentPage
,
"数据-企微数据-流失好友导出日志进来"
,
getPageSize
(),
false
).
getRows
();
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
List
<
WechatWorkLostStoreGroupVO
>
result
=
JSONObject
.
parseArray
(
JSON
.
toJSONString
(
list
),
WechatWorkLostStoreGroupVO
.
class
);
return
result
;
}
return
Collections
.
EMPTY_LIST
;
}
@Override
public
List
<
String
>
getColumnNames
()
{
return
Collections
.
EMPTY_LIST
;
}
@Override
public
List
<
String
>
getColumnNames
(
Context
context
){
DownloadReportDTO
downloadReportDTO
=
context
.
getDownloadReportDTO
();
String
searchDataParams
=
downloadReportDTO
.
getSearchDataParams
();
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
searchDataParams
);
List
<
String
>
list
=
(
List
<
String
>)
jsonObject
.
get
(
"indexList"
);
return
list
;
}
@Override
public
LinkedHashMap
<
String
,
List
<
String
>>
doubleColumnNames
()
{
return
null
;
}
@Override
public
List
<
String
>
getColumns
()
{
return
Collections
.
EMPTY_LIST
;
}
@Override
public
List
<
String
>
getColumns
(
Context
context
)
{
DownloadReportDTO
downloadReportDTO
=
context
.
getDownloadReportDTO
();
String
searchDataParams
=
downloadReportDTO
.
getSearchDataParams
();
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
searchDataParams
);
List
<
String
>
list
=
(
List
<
String
>)
jsonObject
.
get
(
"fieldList"
);
return
list
;
}
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/qo/wechatwork/StoreGroupCommonQO.java
0 → 100644
View file @
f64314e1
package
com
.
gic
.
haoban
.
manage
.
web
.
qo
.
wechatwork
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
/**
* @Author guojx
* @Date 2024/5/22 9:16
*/
@Data
@Accessors
(
chain
=
true
)
public
class
StoreGroupCommonQO
implements
Serializable
{
/**
* 门店code/名称
*/
private
String
storeSearchParam
;
/**
* 可以多选,英文逗号隔开。优先级高于storeId
*/
private
String
storeGroupId
;
/**
* 可以多选,英文逗号隔开
*/
private
String
storeId
;
/**
* 分组下钻的时候,当前点击的分组id参数.如果是无归属,则值是-1
* @return
*/
private
String
nextStoreGroupId
;
/**
* 因为存在nextStoreGroupId = -1的无归属分组。当下钻无归属,值为无归属上一层级的分组id。如果为空,说明上一层级是所有哦门店,否则必有值
*/
private
String
preStoreGroupId
;
/**
* 分组维度查询,勾选展示门店 1:是
*/
private
Integer
showStore
;
public
boolean
isRecycle
()
{
return
"-3"
.
equals
(
nextStoreGroupId
);
}
public
boolean
isNoBelongStoreGroup
()
{
return
"-1"
.
equals
(
nextStoreGroupId
);
}
public
boolean
isSelectStore
()
{
return
showStore
!=
null
&&
showStore
==
1
;
}
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/qo/wechatwork/WechatWorkLostClerkQO.java
0 → 100644
View file @
f64314e1
package
com
.
gic
.
haoban
.
manage
.
web
.
qo
.
wechatwork
;
import
com.alibaba.fastjson.JSONObject
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
lombok.Data
;
import
org.apache.commons.lang3.StringUtils
;
import
java.io.Serializable
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @Author guojx
* @Date 2024/5/21 14:12
*/
@Data
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
WechatWorkLostClerkQO
implements
Serializable
{
/**
* yyyy-MM-dd
*/
private
String
startDate
;
/**
* yyyy-MM-dd
*/
private
String
endDate
;
/**
* 门店名称/code
*/
private
String
vagueQueryStore
;
/**
* 导购名称/code
*/
private
String
vagueQueryClerk
;
/**
* 排序类型 1 正序 2 倒序
*/
private
Integer
orderByType
;
/**
* 排序字段名称
*/
private
String
orderByFields
;
private
Integer
pageNum
;
private
Integer
pageSize
;
/**
* 下载导出参数:数据脱敏 1:脱敏 2:完整
*/
private
Integer
dataType
=
1
;
/**
* 下载导出参数:为了兼容前端传参
*/
private
String
requestProject
;
public
Integer
getDataApiOrderField
()
{
Map
<
String
,
Integer
>
map
=
new
HashMap
<>(
8
);
map
.
put
(
"onewayFriendNum"
,
1
);
map
.
put
(
"totalLostNum"
,
2
);
map
.
put
(
"deleteSalesNum"
,
3
);
map
.
put
(
"salesDeleteNum"
,
4
);
return
map
.
get
(
orderByFields
)
==
null
?
1
:
map
.
get
(
orderByFields
);
}
public
void
dealWithParam
(
JSONObject
jsonObject
)
{
if
(
jsonObject
==
null
)
{
jsonObject
=
new
JSONObject
();
}
if
(
StringUtils
.
isNotBlank
(
startDate
))
{
jsonObject
.
put
(
"startDate"
,
startDate
);
}
if
(
StringUtils
.
isNotBlank
(
endDate
))
{
jsonObject
.
put
(
"endDate"
,
endDate
);
}
if
(
orderByType
!=
null
)
{
jsonObject
.
put
(
"orderByType"
,
orderByType
);
}
if
(
orderByFields
!=
null
)
{
jsonObject
.
put
(
"orderByFields"
,
getDataApiOrderField
());
}
jsonObject
.
put
(
"pageNum"
,
pageNum
);
jsonObject
.
put
(
"pageSize"
,
pageNum
);
if
(
StringUtils
.
isNotBlank
(
vagueQueryClerk
))
{
jsonObject
.
put
(
"vagueQueryClerk"
,
vagueQueryClerk
);
}
if
(
StringUtils
.
isNotBlank
(
vagueQueryStore
))
{
jsonObject
.
put
(
"vagueQueryStore"
,
vagueQueryStore
);
}
}
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/qo/wechatwork/WechatWorkLostDetailQO.java
0 → 100644
View file @
f64314e1
package
com
.
gic
.
haoban
.
manage
.
web
.
qo
.
wechatwork
;
import
com.alibaba.fastjson.JSONObject
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
lombok.Data
;
import
org.apache.commons.lang3.StringUtils
;
import
java.io.Serializable
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @Author guojx
* @Date 2024/5/21 14:12
*/
@Data
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
WechatWorkLostDetailQO
implements
Serializable
{
/**
* yyyy-MM-dd
*/
private
String
startDate
;
/**
* yyyy-MM-dd
*/
private
String
endDate
;
/**
* 用户模糊
*/
private
String
vagueQueryUser
;
/**
* 导购名称/code
*/
private
String
vagueQueryClerk
;
/**
* 是/否
* 是否已解除双向好友
*/
private
String
isDelete
;
/**
* 导购删除好友/好友删除导购
* 删除类型
*/
private
String
deleteType
;
/**
* 排序类型 1 正序 2 倒序
*/
private
Integer
orderByType
;
/**
* 排序字段名称
*/
private
String
orderByFields
;
private
Integer
pageNum
;
private
Integer
pageSize
;
/**
* 下载导出参数:数据脱敏 1:脱敏 2:完整
*/
private
Integer
dataType
=
1
;
/**
* 下载导出参数:为了兼容前端传参
*/
private
String
requestProject
;
public
Integer
getDataApiOrderField
()
{
Map
<
String
,
Integer
>
map
=
new
HashMap
<>(
8
);
map
.
put
(
"remainDays"
,
1
);
return
map
.
get
(
orderByFields
)
==
null
?
1
:
map
.
get
(
orderByFields
);
}
public
void
dealWithParam
(
JSONObject
jsonObject
)
{
if
(
jsonObject
==
null
)
{
jsonObject
=
new
JSONObject
();
}
if
(
StringUtils
.
isNotBlank
(
startDate
))
{
jsonObject
.
put
(
"startDate"
,
startDate
);
}
if
(
StringUtils
.
isNotBlank
(
endDate
))
{
jsonObject
.
put
(
"endDate"
,
endDate
);
}
if
(
orderByType
!=
null
)
{
jsonObject
.
put
(
"orderByType"
,
orderByType
);
}
if
(
orderByFields
!=
null
)
{
jsonObject
.
put
(
"orderByFields"
,
getDataApiOrderField
());
}
jsonObject
.
put
(
"pageNum"
,
pageNum
);
jsonObject
.
put
(
"pageSize"
,
pageNum
);
if
(
StringUtils
.
isNotBlank
(
vagueQueryClerk
))
{
jsonObject
.
put
(
"vagueQueryClerk"
,
vagueQueryClerk
);
}
if
(
StringUtils
.
isNotBlank
(
vagueQueryUser
))
{
jsonObject
.
put
(
"vagueQueryUser"
,
vagueQueryUser
);
}
if
(
StringUtils
.
isNotBlank
(
isDelete
))
{
jsonObject
.
put
(
"isDelete"
,
isDelete
);
}
if
(
StringUtils
.
isNotBlank
(
deleteType
))
{
jsonObject
.
put
(
"deleteType"
,
deleteType
);
}
}
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/qo/wechatwork/WechatWorkLostOverviewQO.java
View file @
f64314e1
...
@@ -11,7 +11,7 @@ import java.io.Serializable;
...
@@ -11,7 +11,7 @@ import java.io.Serializable;
*/
*/
@Data
@Data
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
WechatWorkLostOverviewQO
extends
StoreCommonQO
implements
Serializable
{
public
class
WechatWorkLostOverviewQO
implements
Serializable
{
/**
/**
* yyyy-MM-dd
* yyyy-MM-dd
*/
*/
...
@@ -21,4 +21,9 @@ public class WechatWorkLostOverviewQO extends StoreCommonQO implements Serializa
...
@@ -21,4 +21,9 @@ public class WechatWorkLostOverviewQO extends StoreCommonQO implements Serializa
* yyyy-MM-dd
* yyyy-MM-dd
*/
*/
private
String
endDate
;
private
String
endDate
;
/**
* 分组ID,支持多选,英文逗号隔开
*/
private
String
storeGroupId
;
}
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/qo/wechatwork/WechatWorkLostStoreGroupQO.java
0 → 100644
View file @
f64314e1
package
com
.
gic
.
haoban
.
manage
.
web
.
qo
.
wechatwork
;
import
com.alibaba.fastjson.JSONObject
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
lombok.Data
;
import
org.apache.commons.lang3.StringUtils
;
import
java.io.Serializable
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @Author guojx
* @Date 2024/5/22 9:27
*/
@Data
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
WechatWorkLostStoreGroupQO
extends
StoreGroupCommonQO
implements
Serializable
{
/**
* 开始日期, 非日类型的时候。根据数据组api文档
*/
private
String
startDate
;
/**
* 结束日期, 非日类型的时候。根据数据组api文档
*/
private
String
endDate
;
/**
* 排序类型 1 正序 2 倒序
*/
private
Integer
orderByType
;
/**
* 排序字段名称
*/
private
String
orderByFields
;
private
Integer
pageNum
;
private
Integer
pageSize
;
/**
* 下载导出参数:数据脱敏 1:脱敏 2:完整
*/
private
Integer
dataType
=
1
;
/**
* 下载导出参数:为了兼容前端传参
*/
private
String
requestProject
;
public
Integer
getDataApiOrderField
()
{
Map
<
String
,
Integer
>
map
=
new
HashMap
<>(
8
);
map
.
put
(
"onewayFriendNum"
,
1
);
map
.
put
(
"totalLostNum"
,
2
);
map
.
put
(
"deleteSalesNum"
,
3
);
map
.
put
(
"salesDeleteNum"
,
4
);
return
map
.
get
(
orderByFields
)
==
null
?
1
:
map
.
get
(
orderByFields
);
}
public
void
dealWithParam
(
JSONObject
jsonObject
)
{
if
(
jsonObject
==
null
)
{
jsonObject
=
new
JSONObject
();
}
if
(
StringUtils
.
isNotBlank
(
startDate
))
{
jsonObject
.
put
(
"startDate"
,
startDate
);
}
if
(
StringUtils
.
isNotBlank
(
endDate
))
{
jsonObject
.
put
(
"endDate"
,
endDate
);
}
if
(
orderByType
!=
null
)
{
jsonObject
.
put
(
"orderByType"
,
orderByType
);
}
if
(
orderByFields
!=
null
)
{
jsonObject
.
put
(
"orderByFields"
,
getDataApiOrderField
());
}
jsonObject
.
put
(
"pageNum"
,
pageNum
);
jsonObject
.
put
(
"pageSize"
,
pageNum
);
}
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/utils/data/StoreAuthUtils.java
0 → 100644
View file @
f64314e1
package
com
.
gic
.
haoban
.
manage
.
web
.
utils
.
data
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.api.base.commons.Page
;
import
com.gic.commons.util.DataApiUtils
;
import
com.gic.enterprise.api.dto.StoreDTO
;
import
com.gic.enterprise.api.dto.StoreGroupDTO
;
import
com.gic.enterprise.api.dto.StoreSearchDTO
;
import
com.gic.enterprise.api.service.StoreGroupService
;
import
com.gic.enterprise.api.service.StoreService
;
import
com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO
;
import
com.gic.haoban.common.utils.AuthWebRequestUtil
;
import
com.gic.haoban.manage.api.service.StaffApiService
;
import
com.gic.haoban.manage.web.qo.wechatwork.StoreGroupCommonQO
;
import
com.gic.haoban.manage.web.vo.wechatwork.DataPageVO
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
* @Author guojx
* @Date 2024/5/22 9:44
*/
@Component
@Slf4j
public
class
StoreAuthUtils
{
@Autowired
private
StoreGroupService
storeGroupService
;
@Autowired
private
StaffApiService
staffApiService
;
@Autowired
private
StoreService
storeService
;
private
static
final
String
NO_EXIST_STORE_ID
=
"no_exist_store_id"
;
public
void
setCommonParam
(
JSONObject
jsonObject
,
StoreGroupCommonQO
storeCommonQO
)
{
List
<
String
>
storeIds
=
getAuthStoreId
(
storeCommonQO
);
if
(
CollectionUtils
.
isNotEmpty
(
storeIds
))
{
jsonObject
.
put
(
"storeId"
,
storeIds
);
}
WebLoginDTO
login
=
AuthWebRequestUtil
.
getLoginUser
();
jsonObject
.
put
(
"enterpriseId"
,
login
.
getEnterpriseId
());
}
public
List
<
String
>
getAuthStoreId
(
StoreGroupCommonQO
storeCommonQO
)
{
String
storeGroupId
=
storeCommonQO
.
getStoreGroupId
();
String
storeSearchParam
=
storeCommonQO
.
getStoreSearchParam
();
String
storeId
=
storeCommonQO
.
getStoreId
();
List
<
String
>
storeIdList
=
new
ArrayList
<>();
List
<
String
>
statusList
=
getAllStoreStatus
();
if
(
StringUtils
.
isNotBlank
(
storeId
))
{
storeIdList
.
addAll
(
Arrays
.
stream
(
storeId
.
split
(
","
)).
collect
(
Collectors
.
toList
()));
}
String
nextStoreGroupId
=
storeCommonQO
.
getNextStoreGroupId
();
String
preStoreGroupId
=
storeCommonQO
.
getPreStoreGroupId
();
boolean
isSelectStore
=
storeCommonQO
.
isSelectStore
();
WebLoginDTO
login
=
AuthWebRequestUtil
.
getLoginUser
();
List
<
String
>
roleStoreIds
=
staffApiService
.
getHaoBanStoreIdsRolesByClerkId
(
login
.
getClerkId
(),
login
.
getWxEnterpriseId
());
if
(
CollectionUtils
.
isEmpty
(
roleStoreIds
))
{
log
.
info
(
"登录人无门店权限"
);
return
getNoExistStore
();
}
List
<
String
>
groupIds
=
null
;
List
<
String
>
storeGroupIds
=
new
ArrayList
<>();
if
(
StringUtils
.
isNotBlank
(
storeGroupId
)
||
StringUtils
.
isNotBlank
(
nextStoreGroupId
))
{
if
(
StringUtils
.
isNotBlank
(
storeGroupId
))
{
storeGroupIds
=
Arrays
.
stream
(
storeGroupId
.
split
(
","
)).
collect
(
Collectors
.
toList
());
}
else
if
(
StringUtils
.
isNotBlank
(
nextStoreGroupId
))
{
if
(
storeCommonQO
.
isNoBelongStoreGroup
())
{
storeIdList
.
addAll
(
getPreStoreIdList
(
preStoreGroupId
,
login
.
getEnterpriseId
()));
}
else
if
(
storeCommonQO
.
isRecycle
())
{
statusList
.
clear
();
statusList
.
add
(
"-3"
);
}
else
{
storeGroupIds
.
add
(
nextStoreGroupId
);
}
}
if
(
CollectionUtils
.
isNotEmpty
(
storeGroupIds
))
{
groupIds
=
storeGroupService
.
getStoreGroupIdsByParentGroupId
(
login
.
getEnterpriseId
(),
storeGroupIds
);
}
}
List
<
String
>
searchStoreIdList
=
getStore
(
login
.
getEnterpriseId
(),
login
.
getClerkId
(),
storeSearchParam
,
groupIds
,
statusList
,
storeIdList
);
if
(
isAllAuth
(
roleStoreIds
))
{
return
searchStoreIdList
;
}
//交集
roleStoreIds
.
retainAll
(
searchStoreIdList
);
if
(
CollectionUtils
.
isEmpty
(
roleStoreIds
))
{
return
getNoExistStore
();
}
return
roleStoreIds
;
}
public
void
setStoreGroupJsonParam
(
JSONObject
jsonObject
,
StoreGroupCommonQO
qo
)
{
WebLoginDTO
login
=
AuthWebRequestUtil
.
getLoginUser
();
jsonObject
.
put
(
"enterpriseId"
,
login
.
getEnterpriseId
());
Integer
storeGroup
=
getStoreGroupLevel
(
qo
);
jsonObject
.
put
(
"storeGroup"
,
storeGroup
);
List
<
String
>
storeIds
=
getAuthStoreId
(
qo
);
if
(
CollectionUtils
.
isNotEmpty
(
storeIds
))
{
jsonObject
.
put
(
"storeId"
,
storeIds
);
}
}
public
boolean
needRecycleStoreWhenAllStoreGroup
(
String
enterpriseId
,
StoreGroupCommonQO
qo
)
{
if
(
qo
.
isSelectStore
())
{
return
true
;
}
return
StringUtils
.
isBlank
(
qo
.
getStoreGroupId
())
||
qo
.
getStoreGroupId
().
contains
(
initGroupId
(
enterpriseId
))
||
qo
.
isRecycle
();
}
public
int
getStoreGroupLevel
(
StoreGroupCommonQO
qo
)
{
if
(
qo
.
isSelectStore
())
{
return
7
;
}
WebLoginDTO
login
=
AuthWebRequestUtil
.
getLoginUser
();
String
enterpriseId
=
login
.
getEnterpriseId
();
String
storeGroupId
=
qo
.
getStoreGroupId
();
if
(
StringUtils
.
isNotBlank
(
storeGroupId
))
{
List
<
StoreGroupDTO
>
list
=
storeGroupService
.
listStoreGroup
(
Arrays
.
stream
(
storeGroupId
.
split
(
","
)).
toArray
(
String
[]::
new
),
enterpriseId
);
int
min
=
list
.
stream
().
map
(
e
->
e
.
getGroupLevel
()).
min
(
Integer:
:
compareTo
).
get
();
return
min
==
0
?
1
:
min
;
}
//1:分组1,2:分组2,3:分组3,4:分组4,5:分组5,6:分组6,7:门店,8:区经)
String
nextStoreGroupId
=
qo
.
getNextStoreGroupId
();
if
(
StringUtils
.
isNotBlank
(
nextStoreGroupId
))
{
if
(
qo
.
isNoBelongStoreGroup
()
||
"-3"
.
equals
(
nextStoreGroupId
))
{
//无归属门店
return
7
;
}
//如果是叶子结点的分组,下面没有层级了,就展示门店
List
<
StoreGroupDTO
>
childList
=
storeGroupService
.
getStoreGroupList
(
enterpriseId
,
null
,
nextStoreGroupId
);
if
(
CollectionUtils
.
isEmpty
(
childList
))
{
return
7
;
}
StoreGroupDTO
storeGroupDTO
=
storeGroupService
.
getStoreGroupById
(
nextStoreGroupId
);
return
storeGroupDTO
.
getGroupLevel
()
+
1
;
}
//如果是门店筛选,则直接显示门店
if
(
StringUtils
.
isNotBlank
(
qo
.
getStoreId
()))
{
return
7
;
}
return
1
;
}
public
DataPageVO
getDataCommon
(
String
searchDataParams
,
Integer
currentPage
,
String
logStr
,
Integer
pageSize
,
boolean
hasCountPerPage
)
{
boolean
isFirst
=
currentPage
!=
null
&&
currentPage
==
1
;
if
(
isFirst
)
{
log
.
info
(
logStr
);
}
DataPageVO
vo
=
new
DataPageVO
();
vo
.
setPageNum
(
currentPage
);
vo
.
setPageSize
(
pageSize
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
searchDataParams
);
Integer
storeGroup
=
jsonObject
.
getInteger
(
"storeGroup"
);
boolean
isStore
=
storeGroup
!=
null
&&
storeGroup
==
7
;
boolean
isRecycle
=
storeGroup
==
null
||
storeGroup
==
8
;
boolean
isFirstGroup
=
storeGroup
!=
null
&&
storeGroup
==
1
;
jsonObject
.
put
(
"pageNum"
,
currentPage
);
jsonObject
.
put
(
"pageSize"
,
pageSize
);
String
apolloKey
=
jsonObject
.
getString
(
"apolloKey"
);
String
allApolloKey
=
jsonObject
.
getString
(
"allApolloKey"
);
if
(
isRecycle
)
{
jsonObject
.
put
(
"storeGroup"
,
8
);
JSONObject
recycle
=
getTotalJson
(
jsonObject
,
apolloKey
);
if
(
recycle
==
null
)
{
recycle
=
new
JSONObject
();
recycle
.
put
(
"storeGroupName"
,
"合计(0)"
);
vo
.
setTotalNum
(
0
);
}
else
{
recycle
.
put
(
"storeGroupName"
,
"合计(1)"
);
vo
.
setTotalNum
(
1
);
}
recycle
.
put
(
"storeGroupId"
,
"all"
);
List
<
JSONObject
>
list
=
new
ArrayList
<>();
setChannelGroupList
(
recycle
);
list
.
add
(
recycle
);
JSONObject
temp
=
JSONObject
.
parseObject
(
recycle
.
toJSONString
());
temp
.
remove
(
"channelGroupList"
);
temp
.
put
(
"storeGroupName"
,
"回收站门店"
);
temp
.
put
(
"storeGroupId"
,
"-3"
);
setChannelGroupList
(
temp
);
list
.
add
(
temp
);
vo
.
setRows
(
list
);
return
vo
;
}
List
<
String
>
getRecycleStore
=
null
;
List
<
String
>
storeIdListParam
=
(
List
<
String
>)
jsonObject
.
get
(
"storeId"
);
boolean
hasRecycle
=
jsonObject
.
getInteger
(
"recycleFlag"
)
!=
null
&&
jsonObject
.
getInteger
(
"recycleFlag"
)
==
1
;
if
(
hasRecycle
)
{
getRecycleStore
=
(
List
<
String
>)
jsonObject
.
get
(
"recycleStoreIdList"
);
}
jsonObject
.
put
(
"pageSize"
,
Integer
.
MAX_VALUE
);
jsonObject
.
put
(
"pageNum"
,
1
);
List
<
JSONObject
>
list
=
DataApiUtils
.
getCirclePageData
(
jsonObject
,
apolloKey
,
true
);
Integer
totalCount
=
(
CollectionUtils
.
isEmpty
(
list
)
?
0
:
list
.
size
());
vo
.
setTotalNum
(
totalCount
);
vo
.
setPageSize
(
pageSize
);
vo
.
setPageNum
(
currentPage
);
String
channelMapKey
=
jsonObject
.
containsKey
(
"orderChannel"
)
?
"orderChannel"
:
"mbrChannel"
;
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
vo
.
setPageSize
(
pageSize
);
vo
.
setPageNum
(
currentPage
);
Map
<
String
,
List
<
JSONObject
>>
jsonGroup
=
new
HashMap
<>();
List
<
String
>
idList
=
new
ArrayList
<>();
for
(
JSONObject
tempMap
:
list
)
{
String
id
=
tempMap
.
getString
(
isStore
?
"storeId"
:
"storeGroupId"
);
if
(
jsonGroup
.
containsKey
(
id
))
{
jsonGroup
.
get
(
id
).
add
(
tempMap
);
}
else
{
idList
.
add
(
id
);
List
<
JSONObject
>
mapJson
=
new
ArrayList
<>();
mapJson
.
add
(
tempMap
);
jsonGroup
.
put
(
id
,
mapJson
);
}
}
vo
.
setTotalNum
(
jsonGroup
.
size
());
int
totalPage
=
(
vo
.
getTotalNum
()
%
pageSize
!=
0
?
(
vo
.
getTotalNum
()
/
pageSize
+
1
)
:
(
vo
.
getTotalNum
()
/
pageSize
));
int
start
=
(
currentPage
-
1
)
*
pageSize
;
int
end
=
currentPage
*
pageSize
;
if
(
end
>
idList
.
size
())
{
end
=
idList
.
size
();
}
List
<
JSONObject
>
tempList
=
new
ArrayList
<>();
Set
<
String
>
tempSet
=
new
HashSet
<>();
for
(
int
i
=
start
;
i
<
end
;
i
++)
{
String
indexId
=
idList
.
get
(
i
);
if
(
tempSet
.
contains
(
indexId
))
{
continue
;
}
List
<
JSONObject
>
channelGroupList
=
jsonGroup
.
get
(
indexId
);
JSONObject
copyJson
=
JSONObject
.
parseObject
(
channelGroupList
.
get
(
0
).
toJSONString
());
copyJson
.
put
(
"channelGroupList"
,
sortChannel
(
channelGroupList
,
(
List
<
String
>)
jsonObject
.
get
(
channelMapKey
)));
tempSet
.
add
(
indexId
);
tempList
.
add
(
copyJson
);
}
list
=
tempList
;
}
//调用一次合计
if
(
hasCountPerPage
||
(
isFirst
&&
CollectionUtils
.
isNotEmpty
(
list
)))
{
if
(
hasCountPerPage
&&
CollectionUtils
.
isEmpty
(
list
))
{
list
=
new
ArrayList
<>();
}
jsonObject
.
put
(
"pageNum"
,
1
);
if
(
hasRecycle
)
{
//回收站门店,加回去
storeIdListParam
.
addAll
(
getRecycleStore
);
jsonObject
.
put
(
"storeId"
,
storeIdListParam
.
stream
().
collect
(
Collectors
.
joining
(
","
)));
}
jsonObject
.
put
(
"storeGroup"
,
8
);
String
totalApolloKey
=
apolloKey
;
if
(
StringUtils
.
isNotBlank
(
allApolloKey
))
{
totalApolloKey
=
allApolloKey
;
}
JSONObject
total
=
getTotalJson
(
jsonObject
,
totalApolloKey
);
if
(
total
==
null
)
{
total
=
new
JSONObject
();
}
if
(
isStore
)
{
total
.
put
(
"storeName"
,
"合计("
+
(
hasCountPerPage
?
vo
.
getTotalNum
()
:
totalCount
)
+
")"
);
}
else
{
total
.
put
(
"storeGroupName"
,
"合计("
+
(
hasCountPerPage
?
vo
.
getTotalNum
()
:
totalCount
)
+
")"
);
}
total
.
put
(
"storeGroupId"
,
"all"
);
setChannelGroupList
(
total
);
list
.
add
(
0
,
total
);
if
(
hasRecycle
)
{
jsonObject
.
put
(
"storeId"
,
getRecycleStore
.
stream
().
collect
(
Collectors
.
joining
(
","
)));
JSONObject
recycle
=
getTotalJson
(
jsonObject
,
apolloKey
);
if
(
recycle
==
null
)
{
recycle
=
new
JSONObject
();
}
recycle
.
put
(
"storeGroupName"
,
"回收站门店"
);
recycle
.
put
(
"storeGroupId"
,
"-3"
);
setChannelGroupList
(
recycle
);
list
.
add
(
1
,
recycle
);
}
}
vo
.
setRows
(
list
);
return
vo
;
}
private
List
<
String
>
getStore
(
String
enterpriseId
,
String
userId
,
String
search
,
List
<
String
>
storeGroupIdList
,
List
<
String
>
status
,
List
<
String
>
storeIdList
)
{
StoreSearchDTO
storeSearchDTO
=
new
StoreSearchDTO
();
storeSearchDTO
.
setEnterpriseId
(
enterpriseId
);
if
(
StringUtils
.
isNotBlank
(
search
))
{
storeSearchDTO
.
setSearchName
(
search
);
}
if
(
CollectionUtils
.
isNotEmpty
(
status
))
{
storeSearchDTO
.
setStatusAnyIn
(
status
);
if
(
status
.
contains
(
"-3"
))
{
storeSearchDTO
.
setStatusIn
(
"-3"
);
}
}
if
(
CollectionUtils
.
isNotEmpty
(
storeIdList
))
{
storeSearchDTO
.
setStoreIdList
(
storeIdList
);
}
storeSearchDTO
.
setUserId
(
userId
);
if
(
CollectionUtils
.
isNotEmpty
(
storeGroupIdList
))
{
storeSearchDTO
.
setStoreGroupIdList
(
storeGroupIdList
);
}
Page
pageStore
=
new
Page
<>();
//-1代表不分页
pageStore
.
setCurrentPage
(-
1
);
Page
resultPage
=
storeService
.
storeListPage
(
pageStore
,
storeSearchDTO
);
List
<
StoreDTO
>
storeDTOList
=
resultPage
.
getResult
();
if
(
CollectionUtils
.
isEmpty
(
storeDTOList
))
{
return
getNoExistStore
();
}
return
storeDTOList
.
stream
().
map
(
e
->
e
.
getStoreId
()).
collect
(
Collectors
.
toList
());
}
public
List
<
String
>
getPreStoreIdList
(
String
preStoreGroupId
,
String
enterpriseId
)
{
preStoreGroupId
=
getPreStoreGroupId
(
preStoreGroupId
,
enterpriseId
);
String
[]
queryArr
=
new
String
[]{
preStoreGroupId
};
List
<
String
>
storeIdList
=
storeService
.
getStoreIdListByGroupId
(
queryArr
,
getAllStoreStatus
().
stream
().
mapToInt
(
e
->
Integer
.
parseInt
(
e
)).
boxed
().
collect
(
Collectors
.
toList
()));
if
(
CollectionUtils
.
isEmpty
(
storeIdList
))
{
storeIdList
.
add
(
NO_EXIST_STORE_ID
);
}
return
storeIdList
;
}
private
String
getPreStoreGroupId
(
String
preStoreGroupId
,
String
enterpriseId
)
{
if
(
isAllStoreGroup
(
preStoreGroupId
))
{
return
initGroupId
(
enterpriseId
);
}
return
preStoreGroupId
;
}
private
static
boolean
isAllStoreGroup
(
String
preStoreGroupId
)
{
if
(
StringUtils
.
isBlank
(
preStoreGroupId
)
||
"preStoreGroupId"
.
equals
(
preStoreGroupId
))
{
return
true
;
}
return
false
;
}
private
static
boolean
isAllAuth
(
List
<
String
>
roleStoreIds
)
{
return
roleStoreIds
.
size
()
==
1
&&
"-1"
.
equals
(
roleStoreIds
.
get
(
0
));
}
public
String
initGroupId
(
String
enterpriseId
)
{
List
<
StoreGroupDTO
>
groups
=
storeGroupService
.
getStoreGroupList
(
enterpriseId
,
null
,
"0"
);
if
(
groups
!=
null
&&
groups
.
size
()
>
0
&&
groups
.
get
(
0
)
!=
null
)
{
return
groups
.
get
(
0
).
getStoreGroupId
();
}
else
{
return
null
;
}
}
private
static
List
<
String
>
getAllStoreStatus
()
{
List
<
String
>
list
=
new
ArrayList
<>();
list
.
add
(
"2"
);
list
.
add
(
"3"
);
list
.
add
(
"4"
);
list
.
add
(
"6"
);
list
.
add
(
"7"
);
//好办不要回收站
//list.add("-3");
return
list
;
}
private
static
List
<
String
>
getNoExistStore
()
{
List
<
String
>
list
=
new
ArrayList
<>(
1
);
list
.
add
(
NO_EXIST_STORE_ID
);
return
list
;
}
public
void
setChannelGroupList
(
JSONObject
jsonObject
)
{
jsonObject
.
put
(
"channelGroupList"
,
Arrays
.
asList
(
JSONObject
.
parseObject
(
jsonObject
.
toJSONString
())));
}
public
JSONObject
getTotalJson
(
JSONObject
param
,
String
apolloKey
)
{
Map
<
String
,
Object
>
totalRes
=
DataApiUtils
.
http
(
param
.
toJSONString
(),
apolloKey
);
List
<
JSONObject
>
totalList
=
DataApiUtils
.
getPageList
(
totalRes
);
if
(
CollectionUtils
.
isEmpty
(
totalList
))
{
return
null
;
}
JSONObject
total
=
totalList
.
get
(
0
);
return
total
;
}
public
static
List
<
JSONObject
>
sortChannel
(
List
<
JSONObject
>
channelGroupList
,
List
<
String
>
mbrChannel
)
{
if
(
CollectionUtils
.
isNotEmpty
(
channelGroupList
))
{
for
(
JSONObject
temp
:
channelGroupList
)
{
if
(
"c_all"
.
equals
(
temp
.
getString
(
"channelCode"
))
&&
StringUtils
.
isBlank
(
temp
.
getString
(
"channelName"
)))
{
temp
.
put
(
"channelName"
,
"全渠道"
);
}
else
if
(!
temp
.
containsKey
(
"channelCode"
))
{
temp
.
put
(
"channelName"
,
"全渠道"
);
}
}
if
(
channelGroupList
.
stream
().
noneMatch
(
e
->
e
.
containsKey
(
"channelCode"
)))
{
return
channelGroupList
;
}
}
if
(
CollectionUtils
.
isEmpty
(
mbrChannel
))
{
return
channelGroupList
;
}
List
<
JSONObject
>
result
=
new
ArrayList
<>();
for
(
String
str
:
mbrChannel
)
{
for
(
JSONObject
jsonObject
:
channelGroupList
)
{
if
(
str
.
equals
(
jsonObject
.
getString
(
"channelCode"
)))
{
result
.
add
(
jsonObject
);
}
}
}
return
result
;
}
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/vo/wechatwork/DataPageVO.java
0 → 100644
View file @
f64314e1
package
com
.
gic
.
haoban
.
manage
.
web
.
vo
.
wechatwork
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* @Author guojx
* @Date 2024/1/11 14:22
*/
@Data
public
class
DataPageVO
<
T
>
implements
Serializable
{
private
Integer
pageNum
;
private
Integer
pageSize
;
private
List
<
T
>
rows
;
private
Integer
totalNum
;
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/vo/wechatwork/StoreGroupCommonVO.java
0 → 100644
View file @
f64314e1
package
com
.
gic
.
haoban
.
manage
.
web
.
vo
.
wechatwork
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @Author guojx
* @Date 2024/5/22 9:35
*/
@Data
public
class
StoreGroupCommonVO
implements
Serializable
{
private
String
storeGroupId
;
private
String
storeGroupName
;
private
String
storeId
;
private
String
storeName
;
private
String
storeCode
;
private
String
parentStoreGroupName
;
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/vo/wechatwork/WechatWorkLostClerkVO.java
0 → 100644
View file @
f64314e1
package
com
.
gic
.
haoban
.
manage
.
web
.
vo
.
wechatwork
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @Author guojx
* @Date 2024/5/21 15:56
*/
@Data
public
class
WechatWorkLostClerkVO
extends
StoreGroupCommonVO
implements
Serializable
{
/**
* 单向好友人数
*/
private
Integer
onewayFriendNum
;
/**
* 总流失人数
*/
private
Integer
totalLostNum
;
/**
* 删除导购人数
*/
private
Integer
deleteSalesNum
;
/**
* 导购删除好友人数
*/
private
Integer
salesDeleteNum
;
private
String
clerkCode
;
private
String
clerkName
;
private
String
clerkId
;
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/vo/wechatwork/WechatWorkLostDetailVO.java
0 → 100644
View file @
f64314e1
package
com
.
gic
.
haoban
.
manage
.
web
.
vo
.
wechatwork
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.gic.web.common.jsonSeralizer.PhoneNumberJsonSeralizer
;
import
com.gic.web.common.jsonSeralizer.UserNameJsonSeralizer
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @Author guojx
* @Date 2024/5/21 15:56
*/
@Data
public
class
WechatWorkLostDetailVO
extends
StoreGroupCommonVO
implements
Serializable
{
/**
* 删除类型
*/
private
String
deleteType
;
/**
* 留存天数
*/
private
Integer
remainDays
;
/**
* 是否已经解除双向好友
*/
private
String
isDelete
;
/**
* 添加好友时间
*/
private
String
addTime
;
/**
* 最近消费时间
*/
private
String
lastCsmeDate
;
/**
* 删除时间
*/
private
String
deleteTime
;
private
String
clerkCode
;
private
String
clerkName
;
private
String
clerkId
;
/**
* 客户姓名
*/
@JsonSerialize
(
using
=
UserNameJsonSeralizer
.
class
)
private
String
memberName
;
/**
* 客户手机号
*/
@JsonSerialize
(
using
=
PhoneNumberJsonSeralizer
.
class
)
private
String
memberPhone
;
/**
* 会员昵称
*/
private
String
memberNick
;
/**
* 会员id -1:不存在
*/
private
String
memberId
;
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/
qo/wechatwork/StoreCommonQ
O.java
→
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/
vo/wechatwork/WechatWorkLostStoreGroupV
O.java
View file @
f64314e1
package
com
.
gic
.
haoban
.
manage
.
web
.
q
o
.
wechatwork
;
package
com
.
gic
.
haoban
.
manage
.
web
.
v
o
.
wechatwork
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -6,23 +6,28 @@ import java.io.Serializable;
...
@@ -6,23 +6,28 @@ import java.io.Serializable;
/**
/**
* @Author guojx
* @Author guojx
* @Date 2024/5/21 15:
43
* @Date 2024/5/21 15:
56
*/
*/
@Data
@Data
public
class
StoreCommonQ
O
implements
Serializable
{
public
class
WechatWorkLostStoreGroupVO
extends
StoreGroupCommonV
O
implements
Serializable
{
/**
/**
*
分组ID,支持多选,英文逗号隔开
*
单向好友人数
*/
*/
private
String
storeGroupId
;
private
Integer
onewayFriendNum
;
/**
/**
*
门店code/名称
*
总流失人数
*/
*/
private
String
storeSearchPara
m
;
private
Integer
totalLostNu
m
;
/**
/**
*
门店ID
*
删除导购人数
*/
*/
private
String
storeId
;
private
Integer
deleteSalesNum
;
/**
* 导购删除好友人数
*/
private
Integer
salesDeleteNum
;
}
}
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