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
5ced7b56
Commit
5ced7b56
authored
Dec 26, 2023
by
guojx
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
销售结构接口
parent
f757a0b4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
189 additions
and
4 deletions
+189
-4
DataController.java
...gic/haoban/manage/web/controller/data/DataController.java
+88
-4
SalesStructureQO.java
...a/com/gic/haoban/manage/web/qo/data/SalesStructureQO.java
+48
-0
SalesStructureVO.java
...a/com/gic/haoban/manage/web/vo/data/SalesStructureVO.java
+53
-0
No files found.
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/controller/data/DataController.java
View file @
5ced7b56
...
@@ -22,13 +22,11 @@ import com.gic.enterprise.api.service.EnterpriseChannelApiService;
...
@@ -22,13 +22,11 @@ import com.gic.enterprise.api.service.EnterpriseChannelApiService;
import
com.gic.enterprise.api.service.EnterpriseService
;
import
com.gic.enterprise.api.service.EnterpriseService
;
import
com.gic.enterprise.api.service.data.DataIndexApiService
;
import
com.gic.enterprise.api.service.data.DataIndexApiService
;
import
com.gic.enterprise.service.CustomSettingApiService
;
import
com.gic.enterprise.service.CustomSettingApiService
;
import
com.gic.haoban.manage.web.qo.data.DataIndexExplainVO
;
import
com.gic.haoban.manage.web.qo.data.*
;
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.DateFillUtils
;
import
com.gic.haoban.manage.web.utils.DateFillUtils
;
import
com.gic.haoban.manage.web.utils.StoreAuthUtils
;
import
com.gic.haoban.manage.web.utils.StoreAuthUtils
;
import
com.gic.haoban.manage.web.vo.data.DataMemberExtendVO
;
import
com.gic.haoban.manage.web.vo.data.DataMemberExtendVO
;
import
com.gic.haoban.manage.web.vo.data.SalesStructureVO
;
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.apache.commons.lang3.StringUtils
;
...
@@ -38,6 +36,7 @@ import org.springframework.web.bind.annotation.RequestBody;
...
@@ -38,6 +36,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -125,6 +124,91 @@ public class DataController {
...
@@ -125,6 +124,91 @@ public class DataController {
}
}
/**
/**
* 销售结构接口
* @param qo
* @return
*/
@RequestMapping
(
value
=
"sales-structure"
)
@ResponseBody
public
RestResponse
<
List
<
SalesStructureVO
>>
salesStructure
(
@RequestBody
SalesStructureQO
qo
)
{
Integer
salesStructureType
=
qo
.
getSalesStructureType
();
String
apolloKey
=
"data_sales_perf_mbr_type_overview"
;
switch
(
salesStructureType
)
{
case
1
:
apolloKey
=
"data_sales_perf_mbr_type_overview"
;
break
;
case
2
:
apolloKey
=
"data_sales_perf_birth_type_overview"
;
break
;
case
3
:
apolloKey
=
"data_sales_perf_grade_type_overview"
;
break
;
default
:
}
JSONObject
jsonParam
=
new
JSONObject
();
jsonParam
.
put
(
"enterpriseId"
,
qo
.
getEnterpriseId
());
getAuthStore
(
qo
.
getStoreId
(),
qo
.
getClerkId
(),
qo
.
getWxEnterpriseId
(),
jsonParam
);
jsonParam
.
put
(
"groupType"
,
1
);
Map
<
String
,
Object
>
res
=
DataApiUtils
.
http
(
jsonParam
.
toJSONString
(),
apolloKey
);
List
<
JSONObject
>
list
=
DataApiUtils
.
getDataList
(
res
);
if
(
list
==
null
)
{
list
=
new
ArrayList
<>();
}
jsonParam
.
put
(
"groupType"
,
2
);
res
=
DataApiUtils
.
http
(
jsonParam
.
toJSONString
(),
apolloKey
);
List
<
JSONObject
>
childList
=
DataApiUtils
.
getDataList
(
res
);
if
(
CollectionUtils
.
isNotEmpty
(
childList
))
{
list
.
addAll
(
childList
);
}
List
<
SalesStructureVO
>
voList
=
JSONObject
.
parseArray
(
JSON
.
toJSONString
(
list
),
SalesStructureVO
.
class
);
if
(
voList
.
size
()
>
1
)
{
SalesStructureVO
total
=
voList
.
get
(
0
);
Double
payAmt
=
total
.
getPayAmt
();
Integer
csmeNum
=
total
.
getCsmeNum
();
Integer
effOrderCnt
=
total
.
getEffOrderCnt
();
for
(
int
i
=
1
;
i
<
voList
.
size
();
i
++)
{
SalesStructureVO
vo
=
voList
.
get
(
i
);
if
(
payAmt
!=
null
&&
payAmt
>
0
)
{
vo
.
setPayAmtRate
(
divide
(
vo
.
getPayAmt
(),
payAmt
));
}
if
(
csmeNum
!=
null
&&
csmeNum
>
0
)
{
vo
.
setCsmeNumRate
(
divide
(
vo
.
getCsmeNum
(),
csmeNum
));
}
if
(
effOrderCnt
!=
null
&&
effOrderCnt
>
0
)
{
vo
.
setEffOrderCntRate
(
divide
(
vo
.
getEffOrderCnt
(),
effOrderCnt
));
}
}
}
return
RestResponse
.
successResult
(
voList
);
}
public
static
String
divide
(
Object
a
,
Object
b
)
{
if
(
a
==
null
)
{
return
"0.00"
;
}
BigDecimal
bd
=
new
BigDecimal
(
a
.
toString
());
bd
=
bd
.
multiply
(
new
BigDecimal
(
100
));
bd
=
bd
.
divide
(
new
BigDecimal
(
b
.
toString
()));
bd
=
bd
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
return
bd
.
toString
();
}
private
void
getAuthStore
(
String
storeId
,
String
clerkId
,
String
wxEnterpriseId
,
JSONObject
jsonObject
)
{
List
<
String
>
storeIdList
=
new
ArrayList
<>();
if
(
StringUtils
.
isBlank
(
storeId
))
{
storeIdList
=
storeAuthUtils
.
queryClerkStoreIds
(
clerkId
,
wxEnterpriseId
);
}
else
{
storeIdList
.
add
(
storeId
);
}
if
(
CollectionUtils
.
isNotEmpty
(
storeIdList
))
{
//区经有全部门店权限
jsonObject
.
put
(
"storeId"
,
storeIdList
.
stream
().
collect
(
Collectors
.
joining
(
","
)));
}
}
/**
* 数据统一调用接口
* 数据统一调用接口
* 参数与返回字段查询数据组的yapi的对应文档
* 参数与返回字段查询数据组的yapi的对应文档
* @param qo
* @param qo
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/qo/data/SalesStructureQO.java
0 → 100644
View file @
5ced7b56
package
com
.
gic
.
haoban
.
manage
.
web
.
qo
.
data
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @Author guojx
* @Date 2023/12/26 14:32
*/
@Data
public
class
SalesStructureQO
implements
Serializable
{
/**
* 1:新老客维度 2:生日会员 3:等级
*/
private
Integer
salesStructureType
=
1
;
/**
* 开始时间
*/
private
String
startDate
;
/**
* 结束时间
*/
private
String
endDate
;
/**
* 门店查询参数. 区经可以为空,查询所有管辖门店
*/
private
String
storeId
;
/**
* 企业ID.
*/
private
String
enterpriseId
;
/**
* 微信企业
*/
private
String
wxEnterpriseId
;
/**
* 如果是区经,用于查询管辖门店权限
*/
private
String
clerkId
;
}
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/vo/data/SalesStructureVO.java
0 → 100644
View file @
5ced7b56
package
com
.
gic
.
haoban
.
manage
.
web
.
vo
.
data
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @Author guojx
* @Date 2023/12/26 14:50
*/
@Data
public
class
SalesStructureVO
implements
Serializable
{
/**
* 1:新老客维度 2:生日会员 3:等级
*/
private
Integer
salesStructureType
=
1
;
/**
* 实付金额
*/
private
Double
payAmt
;
/**
* 消费人数
*/
private
Integer
csmeNum
;
/**
* 有效订单数
*/
private
Integer
effOrderCnt
;
/**
* 名称类型
*/
private
String
mbrType
;
/**
* 实付金额占比
*/
private
String
payAmtRate
;
/**
* 消费人数占比
*/
private
String
csmeNumRate
;
/**
* 有效订单数占比
*/
private
String
effOrderCntRate
;
}
guojx
@guojx
mentioned in commit
eb8d68a5
Dec 26, 2023
mentioned in commit
eb8d68a5
mentioned in commit eb8d68a556b5c8a38f144f4b38202b7ecabf8c5e
Toggle commit list
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