Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
dj
/
rpc-dj-pe-analysis
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 7858fe82
authored
Jan 09, 2026
by
zhouhaibao
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[+]全国排名调整
1 parent
50839840
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
15 deletions
rpc-dj-pe-analysis/src/main/java/cn/com/glsx/dj/peanalysis/service/BusinessAnalysisService.java
rpc-dj-pe-analysis/src/main/java/cn/com/glsx/dj/peanalysis/service/BusinessAnalysisService.java
View file @
7858fe8
...
...
@@ -465,15 +465,13 @@ public class BusinessAnalysisService {
* @param last 上期值
* @return 环比
*/
private
BigDecimal
calculateMom
(
BigDecimal
current
,
BigDecimal
last
)
{
private
BigDecimal
calculateMom
(
BigDecimal
current
,
BigDecimal
last
)
{
if
(
current
==
null
)
{
return
null
;
current
=
BigDecimal
.
ZERO
;
}
if
(
last
==
null
||
last
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
// 上期为0:若本期>0,通常视为 +100% 或无穷大;这里按业务常见做法返回 100%
return
current
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
?
new
BigDecimal
(
"100.00"
)
:
BigDecimal
.
ZERO
;
return
null
;
}
return
current
.
subtract
(
last
)
.
divide
(
last
,
6
,
RoundingMode
.
HALF_UP
)
// 高精度中间计算
...
...
@@ -814,7 +812,7 @@ public class BusinessAnalysisService {
List
<
CompletableFuture
<
List
<
DataBusinessDTO
>>>
futures
=
new
ArrayList
<>();
if
(
checkSup
(
req
.
getLoginRole
()))
{
if
(
checkSup
(
req
.
getLoginRole
())
||
checkQuyu
(
req
.
getLoginRole
())
)
{
// 获取当前所有区域产值
BaseReq
baseReq
=
copyReq
(
req
);
baseReq
.
setSearchAllFlag
(
true
);
...
...
@@ -858,7 +856,7 @@ public class BusinessAnalysisService {
}
}
if
(
checkSup
(
req
.
getLoginRole
()))
{
if
(
checkSup
(
req
.
getLoginRole
())
||
checkQuyu
(
req
.
getLoginRole
())
)
{
currentAll
=
results
.
get
(
0
);
allOutputGroupByMerchantRegionId
=
results
.
get
(
1
);
lastputGroupByMerchant
=
results
.
get
(
2
);
...
...
@@ -960,7 +958,7 @@ public class BusinessAnalysisService {
}
// 只有超管才会处理排名
if
(
checkSup
(
req
.
getLoginRole
()))
{
if
(
checkSup
(
req
.
getLoginRole
())
||
checkQuyu
(
req
.
getLoginRole
())
)
{
// 按省份分组
Map
<
Integer
,
List
<
DataBusinessDTO
>>
dataGroupedByProvince
=
groupByProvice
(
currentAll
);
...
...
@@ -971,8 +969,10 @@ public class BusinessAnalysisService {
response
.
setTotalOutputNationalRank
(
provinceRank
);
if
(
checkSearchType
(
req
.
getCycleType
()))
{
// 毛利率排名
List
<
DistributioncConfigResponse
>
allcurrentlist
=
findDisConfigByMerchantIdsAndMonth
(
null
,
req
.
getStartTime
());
int
marginRank
=
getProvinceGrossMarginRank
(
req
.
getProvinceId
(),
dataGroupedByProvince
,
currentlist
);
all
currentlist
);
response
.
setGrossProfitMarginNationalRank
(
marginRank
);
}
}
...
...
@@ -981,6 +981,10 @@ public class BusinessAnalysisService {
return
response
;
}
private
boolean
checkQuyu
(
Integer
loginRole
)
{
return
loginRole
!=
null
&&
(
loginRole
==
7
||
loginRole
==
8
);
}
/**
* 设置商户权限
*
...
...
@@ -1120,7 +1124,7 @@ public class BusinessAnalysisService {
})
.
sorted
(
Map
.
Entry
.<
Integer
,
BigDecimal
>
comparingByValue
().
reversed
())
// 降序
.
collect
(
Collectors
.
toList
());
log
.
info
(
"rankList: {}"
,
rankList
);
log
.
info
(
"
dpl
rankList: {}"
,
rankList
);
// 3. 找到目标省份的排名(从1开始)
for
(
int
i
=
0
;
i
<
rankList
.
size
();
i
++)
{
if
(
proviceId
.
intValue
()
==
rankList
.
get
(
i
).
getKey
().
intValue
())
{
...
...
@@ -1144,6 +1148,8 @@ public class BusinessAnalysisService {
condition
.
setMerchantIds
(
merchantIds
);
condition
.
setMonthYear
(
toYearMonth
(
startTime
));
rpcPagination
.
setCondition
(
condition
);
rpcPagination
.
setPageNum
(
1
);
rpcPagination
.
setPageSize
(
100000
);
Page
<
MerchantProfitRecordDTO
>
merchantProfitRecordDTOS
=
biAnalyseBackgroundService
.
merchantProfitRecordPage
(
rpcPagination
);
return
merchantProfitRecordDTOS
.
stream
()
...
...
@@ -1389,12 +1395,21 @@ public class BusinessAnalysisService {
result
.
setMultiSceneStoreRatio
(
calculateLongPercent
(
dplMerchantIds
.
size
(),
prototalStoreCount
));
// 多品类门店占比排名
if
(
checkSup
(
req
.
getLoginRole
()))
{
if
(
checkSup
(
req
.
getLoginRole
())
||
checkQuyu
(
req
.
getLoginRole
())
)
{
// 按省份分组
Map
<
Integer
,
List
<
DataBusinessDTO
>>
dataGroupedByProvince
=
groupByProvice
(
alllist
);
if
(
dataGroupedByProvince
!=
null
)
{
int
marginRank
=
getProvinceDplMdRank
(
req
.
getProvinceId
(),
dataGroupedByProvince
);
result
.
setMultiSceneStoreRatioRank
(
marginRank
);
if
(
checkSearchType
(
req
.
getCycleType
()))
{
DataBizQueryParamsDTO
query
=
new
DataBizQueryParamsDTO
();
query
.
setDateType
(
req
.
getCycleType
());
query
.
setStartDate
(
req
.
getStartTime
());
query
.
setEndDate
(
req
.
getEndTime
());
query
.
setItemCodes
(
DataStatsConstants
.
ITEM_CODE_A0018
);
query
.
setExts
(
"merchantIds,bizs"
);
List
<
DataBusinessDTO
>
alllistDto
=
getTotalOutputGroupByMerchant
(
query
);
Map
<
Integer
,
List
<
DataBusinessDTO
>>
dataGroupedByProvince
=
groupByProvice
(
alllistDto
);
if
(
dataGroupedByProvince
!=
null
)
{
int
marginRank
=
getProvinceDplMdRank
(
req
.
getProvinceId
(),
dataGroupedByProvince
);
result
.
setMultiSceneStoreRatioRank
(
marginRank
);
}
}
}
...
...
@@ -1457,6 +1472,12 @@ public class BusinessAnalysisService {
return
result
;
}
private
List
<
DataBusinessDTO
>
getALLOutputGroupByBiz
(
BaseReq
req
)
{
DataBizQueryParamsDTO
query1
=
buildQuery
(
DataStatsConstants
.
ITEM_CODE_A0018
,
req
);
query1
.
setExts
(
"merchantIds,bizs"
);
return
getTotalOutputGroupByMerchant
(
query1
);
}
/**
* 计算门店占比
*
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment