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
9c9bec82
Commit
9c9bec82
authored
Nov 25, 2023
by
guojx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
会员封装数据
parent
91ad61dc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
224 additions
and
5 deletions
+224
-5
DataController.java
...gic/haoban/manage/web/controller/data/DataController.java
+100
-5
DataMemberExtendQO.java
...com/gic/haoban/manage/web/qo/data/DataMemberExtendQO.java
+65
-0
DataMemberExtendVO.java
...com/gic/haoban/manage/web/vo/data/DataMemberExtendVO.java
+59
-0
No files found.
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/controller/data/DataController.java
View file @
9c9bec82
package
com
.
gic
.
haoban
.
manage
.
web
.
controller
.
data
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.ctrip.framework.apollo.Config
;
import
com.ctrip.framework.apollo.ConfigService
;
import
com.gic.api.base.commons.Page
;
import
com.gic.commons.util.DataApiUtils
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.commons.util.GlobalVar
;
import
com.gic.commons.util.HttpClient
;
import
com.gic.commons.webapi.reponse.RestResponse
;
import
com.gic.enterprise.api.dto.data.DataIndexEvaluateLogDTO
;
import
com.gic.enterprise.api.dto.data.DataIndexExplainDTO
;
...
...
@@ -11,8 +16,10 @@ import com.gic.enterprise.api.service.data.DataIndexApiService;
import
com.gic.enterprise.service.CustomSettingApiService
;
import
com.gic.haoban.manage.web.qo.data.DataIndexExplainVO
;
import
com.gic.haoban.manage.web.qo.data.DataIndexQO
;
import
com.gic.haoban.manage.web.qo.data.DataMemberExtendQO
;
import
com.gic.haoban.manage.web.qo.data.HandleQO
;
import
com.gic.haoban.manage.web.utils.StoreAuthUtils
;
import
com.gic.haoban.manage.web.vo.data.DataMemberExtendVO
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -21,10 +28,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -42,6 +46,69 @@ public class DataController {
@Autowired
private
CustomSettingApiService
customSettingApiService
;
private
String
isProd
()
{
Config
config
=
ConfigService
.
getConfig
(
"COMMON.gic-properties"
);
String
env
=
config
.
getProperty
(
"environment.value"
,
""
)
;
return
env
;
}
/**
* 会员封装数据
* @param qo
* @return
*/
@RequestMapping
(
value
=
"get-member-data"
)
@ResponseBody
public
RestResponse
<
List
<
DataMemberExtendVO
>>
getMemberData
(
@RequestBody
DataMemberExtendQO
qo
)
{
if
(
StringUtils
.
isBlank
(
qo
.
getEnterpriseId
()))
{
return
RestResponse
.
failure
(
"-1"
,
"企业id不能为空"
);
}
String
params
=
qo
.
getParams
();
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
params
);
if
(
jsonObject
==
null
)
{
jsonObject
=
new
JSONObject
();
}
jsonObject
.
put
(
"enterpriseId"
,
qo
.
getEnterpriseId
());
List
<
String
>
storeIdList
=
new
ArrayList
<>();
String
storeId
=
qo
.
getStoreId
();
if
(
StringUtils
.
isBlank
(
storeId
))
{
storeIdList
=
storeAuthUtils
.
queryClerkStoreIds
(
qo
.
getClerkId
(),
qo
.
getWxEnterpriseId
());
}
else
{
storeIdList
.
add
(
storeId
);
}
if
(
CollectionUtils
.
isNotEmpty
(
storeIdList
))
{
//区经有全部门店权限
jsonObject
.
put
(
"storeId"
,
storeIdList
.
stream
().
collect
(
Collectors
.
joining
(
","
)));
}
qo
.
setParams
(
jsonObject
.
toJSONString
());
Map
<
String
,
String
>
head
=
new
HashMap
<>();
head
.
put
(
"Content-Type"
,
"application/json"
);
String
mainHost
=
GlobalVar
.
ctxPropertiesMap
.
get
(
"gicweb_service_host"
);
mainHost
=
mainHost
.
replace
(
"gicweb"
,
""
);
//是否是开发环境
boolean
isDev
=
mainHost
.
contains
(
"gicdev"
);
if
(
isDev
)
{
//http://gicdev.demogic.com/
mainHost
=
GlobalVar
.
ctxPropertiesMap
.
get
(
"gicweb_service_host_old"
);
}
String
url
=
mainHost
+
"api-report/data-extend/get-member-data"
;
JSONObject
httpJson
=
new
JSONObject
();
httpJson
.
put
(
"params"
,
jsonObject
.
toJSONString
());
httpJson
.
put
(
"dateType"
,
qo
.
getDateType
());
httpJson
.
put
(
"realFlag"
,
qo
.
getRealFlag
());
httpJson
.
put
(
"totalMemberFlag"
,
qo
.
getTotalMemberFlag
());
httpJson
.
put
(
"channelCodeList"
,
qo
.
getChannelCodeList
());
Map
<
String
,
Object
>
res
=
HttpClient
.
getWinxinResByJson
(
url
,
httpJson
.
toJSONString
(),
head
);
RestResponse
rest
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
res
),
RestResponse
.
class
);
if
(
isSuccess
(
rest
))
{
List
<
DataMemberExtendVO
>
list
=
JSONObject
.
parseArray
(
JSON
.
toJSONString
(
rest
.
getResult
()),
DataMemberExtendVO
.
class
);
rest
.
setResult
(
list
);
}
return
rest
;
}
/**
* 数据统一调用接口
* 参数与返回字段查询数据组的yapi的对应文档
...
...
@@ -119,11 +186,32 @@ public class DataController {
Page
<
JSONObject
>
page
=
customSettingApiService
.
page
(
"tab_gic_channel_platform_dict"
,
""
,
1
,
1000
).
getResult
();
if
(
page
!=
null
)
{
return
RestResponse
.
successResult
(
page
.
getResult
());
List
<
JSONObject
>
list
=
page
.
getResult
();
List
<
JSONObject
>
result
=
new
ArrayList
<>();
for
(
JSONObject
json
:
list
)
{
if
(
"c_wechat_work"
.
equals
(
json
.
getString
(
"channelCode"
))
||
"c_wechat_gh"
.
equals
(
json
.
getString
(
"channelCode"
)))
{
continue
;
}
json
.
put
(
"dataChannelPre"
,
channelMap
().
get
(
json
.
getString
(
"channelCode"
)));
result
.
add
(
json
);
}
return
RestResponse
.
successResult
(
result
);
}
return
RestResponse
.
successResult
(
new
ArrayList
<>());
}
private
static
Map
<
String
,
String
>
channelMap
()
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"c_pos"
,
"pos"
);
map
.
put
(
"c_other"
,
"other"
);
map
.
put
(
"c_douyin_hyt"
,
"dy"
);
map
.
put
(
"c_tmall_hyt"
,
"tmall"
);
map
.
put
(
"c_wechat_mini"
,
"wct"
);
map
.
put
(
"c_weimob"
,
"weimob"
);
return
map
;
}
private
JSONObject
getTotalJson
(
JSONObject
param
,
String
apolloKey
)
{
Map
<
String
,
Object
>
totalRes
=
DataApiUtils
.
http
(
param
.
toJSONString
(),
apolloKey
);
...
...
@@ -134,4 +222,11 @@ public class DataController {
JSONObject
total
=
totalList
.
get
(
0
);
return
total
;
}
protected
boolean
isSuccess
(
RestResponse
response
)
{
if
(
"0"
.
equals
(
response
.
getCode
()))
{
return
true
;
}
return
false
;
}
}
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/qo/data/DataMemberExtendQO.java
0 → 100644
View file @
9c9bec82
package
com
.
gic
.
haoban
.
manage
.
web
.
qo
.
data
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* @Author guojx
* @Date 2023/11/24 12:21
*/
@Data
public
class
DataMemberExtendQO
implements
Serializable
{
/**
* 门店查询参数. 区经可以为空,查询所有管辖门店
*/
private
String
storeId
;
/**
* 企业ID.
*/
private
String
enterpriseId
;
/**
* 微信企业
*/
private
String
wxEnterpriseId
;
/**
* 如果是区经,用于查询管辖门店权限
*/
private
String
clerkId
;
private
String
params
;
/**
* 1:日 2:周 3:月 :4:自定义
*/
private
Integer
dateType
;
/**
* 1:实时 0:离线
*/
private
Integer
realFlag
;
/**
* 1:会员总数 2:新增会员
*/
private
Integer
totalMemberFlag
;
/**
* 权限渠道范围
*/
private
List
<
String
>
channelCodeList
;
public
boolean
isReal
()
{
return
realFlag
!=
null
&&
realFlag
==
1
;
}
public
boolean
isTotalMember
()
{
return
totalMemberFlag
!=
null
&&
totalMemberFlag
==
1
;
}
}
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/vo/data/DataMemberExtendVO.java
0 → 100644
View file @
9c9bec82
package
com
.
gic
.
haoban
.
manage
.
web
.
vo
.
data
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @Author guojx
* @Date 2023/11/24 13:54
*/
@Data
public
class
DataMemberExtendVO
implements
Serializable
{
private
String
channelCode
;
/**
* 开卡会员
*/
private
Integer
openMbrNum
;
/**
* 昨日开卡会员
*/
private
Integer
lastOpenMbrNum
;
/**
* 关联会员
*/
private
Integer
relMbrNum
;
/**
* 昨日关联会员
*/
private
Integer
lastRelMbrNum
;
/**
* 关联会员环比
*/
private
Double
relMbrNumRatio
;
/**
* 关联会员同比
*/
private
Double
relMbrNumSply
;
/**
* 开卡会员环比
*/
private
Double
openMbrNumRatio
;
/**
* 开卡会员同比
*/
private
Double
openMbrNumSply
;
/**
* 1:服务门店
*/
private
Integer
serviceFlag
;
}
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