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 229618f4
authored
Dec 12, 2025
by
张富康
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
整体收车成本分布接口抽取
1 parent
d44649d0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
24 deletions
rpc-dj-pe-analysis/src/main/java/cn/com/glsx/dj/peanalysis/remote/UsedCarDataStatsRemoteImpl.java
rpc-dj-pe-analysis/src/main/java/cn/com/glsx/dj/peanalysis/service/BusinessIntelligenceService.java
rpc-dj-pe-analysis/src/main/java/cn/com/glsx/dj/peanalysis/service/UsedCarDataStatsService.java
rpc-dj-pe-analysis/src/main/java/cn/com/glsx/dj/peanalysis/remote/UsedCarDataStatsRemoteImpl.java
View file @
229618f
...
...
@@ -56,6 +56,8 @@ public class UsedCarDataStatsRemoteImpl implements UsedCarDataStatsRemote {
}
}
/**
* 按周期统计数据
*/
...
...
@@ -70,6 +72,9 @@ public class UsedCarDataStatsRemoteImpl implements UsedCarDataStatsRemote {
}
/**
* todz趋势图
*/
/**
* 存量门店分析
*/
@Override
...
...
rpc-dj-pe-analysis/src/main/java/cn/com/glsx/dj/peanalysis/service/BusinessIntelligenceService.java
View file @
229618f
...
...
@@ -196,14 +196,14 @@ public class BusinessIntelligenceService {
// 获取该商户的首单日期
Date
firstOrderDate
=
merchantFirstOrderDates
.
get
(
merchantId
);
if
(
firstOrderDate
==
null
)
{
log
.
warn
(
"商户ID {} 无首单日期,跳过"
,
merchantId
);
log
.
info
(
"商户ID {} 无首单日期,跳过"
,
merchantId
);
continue
;
}
// 为该商户生成有效时间范围(从首单日期到当前处理的结束日期)
List
<
Date
>
merchantDateRange
=
generateMerchantDateRange
(
firstOrderDate
,
dateRange
);
if
(
CollUtil
.
isEmpty
(
merchantDateRange
))
{
log
.
warn
(
"商户ID {} 无有效时间范围,跳过"
,
merchantId
);
log
.
info
(
"商户ID {} 无有效时间范围,跳过"
,
merchantId
);
continue
;
}
log
.
info
(
"商户ID {} 的有效时间范围:{} 至 {}"
,
merchantId
,
format
(
merchantDateRange
.
get
(
0
)),
format
(
merchantDateRange
.
get
(
merchantDateRange
.
size
()
-
1
)));
...
...
rpc-dj-pe-analysis/src/main/java/cn/com/glsx/dj/peanalysis/service/UsedCarDataStatsService.java
View file @
229618f
...
...
@@ -8,10 +8,13 @@ import cn.com.glsx.dj.peanalysis.dto.req.UserdCarDataStats.*;
import
cn.com.glsx.dj.peanalysis.dto.res.UserdCarDataStats.*
;
import
cn.com.glsx.dj.peanalysis.mapper.ServiceMerchantMapper
;
import
cn.com.glsx.dj.peanalysis.utils.response.DataResp
;
import
cn.com.glsx.framework.core.beans.rpc.RpcResponse
;
import
cn.com.glsx.framework.core.exception.RpcServiceException
;
import
cn.com.glsx.merchants.dto.merchant.CarBrandProvinceRequestDTO
;
import
cn.com.glsx.merchants.model.response.MerchantSimpleResponse
;
import
cn.com.glsx.merchants.remote.MerchantRemote
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.NumberUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.json.JSONUtil
;
...
...
@@ -22,12 +25,8 @@ import org.springframework.transaction.annotation.Propagation;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
* 二手车数据统计
...
...
@@ -43,24 +42,33 @@ public class UsedCarDataStatsService {
private
GetDataStatsService
getDataStatsService
;
@Resource
private
TaskExecutor
taskExecutor
;
@Resource
private
MerchantRemote
merchantRemote
;
/**
* 经营情况-累计至今
*/
public
OperationStatusRes
getOperationStatus
(
OperationStatusReq
request
)
{
// todz
// 登录角色 1-其他角色 2-服务商老板 3-区域运营 4-广联销售(业务负责人) 5-飞行督导 6-线上运营 7-区域运营大区经理 8-销售大区经理
// 如果不为其他角色则获取可查看的商户id
// List<Integer> canSeeMerchantIds = Arrays.asList(1, 2, 3);
// 筛选业务,品牌,区域后的商户id
List
<
Integer
>
filterMerchantIds
=
Arrays
.
asList
(
1
,
5
,
6
);
// 两个id取交集
// todz 判空
// List<Integer> merchantIdList = canSeeMerchantIds.stream().filter(filterMerchantIds::contains).distinct().collect(Collectors.toList());
// 判断merchantIdList是否为空 如果为空则返回空结果
if
(
CollUtil
.
isEmpty
(
filterMerchantIds
))
{
return
new
OperationStatusRes
();
Integer
brandId
=
request
.
getBrandId
();
Integer
provinceId
=
request
.
getProvinceId
();
// 是否通过品牌,区域
boolean
filterBoolean
=
ObjectUtil
.
isNotEmpty
(
brandId
)
||
ObjectUtil
.
isNotEmpty
(
provinceId
);
List
<
MerchantSimpleResponse
>
filterMerchantResponse
;
List
<
Integer
>
merchantIdList
=
new
ArrayList
<>();
if
(
filterBoolean
)
{
// 筛选品牌,区域后的商户id
CarBrandProvinceRequestDTO
carBrandProvinceRequestDTO
=
new
CarBrandProvinceRequestDTO
();
carBrandProvinceRequestDTO
.
setFirstBrandIdList
(
Collections
.
singletonList
(
brandId
));
carBrandProvinceRequestDTO
.
setProvinceIds
(
Collections
.
singletonList
(
provinceId
));
RpcResponse
<
List
<
MerchantSimpleResponse
>>
filterMerchantIdsResponse
=
merchantRemote
.
findMerchantListByBrandIdsProvince
(
carBrandProvinceRequestDTO
);
filterMerchantResponse
=
filterMerchantIdsResponse
.
getResult
();
// 如果为空则返回空结果
if
(
CollUtil
.
isEmpty
(
filterMerchantResponse
))
{
return
new
OperationStatusRes
();
}
merchantIdList
=
filterMerchantResponse
.
stream
().
map
(
MerchantSimpleResponse:
:
getMerchantNo
).
collect
(
Collectors
.
toList
());
}
OperationStatusRes
result
=
new
OperationStatusRes
();
// 并行查询指标接口
DataBizQueryParamsDTO
queryDataBiz
=
new
DataBizQueryParamsDTO
();
...
...
@@ -68,11 +76,13 @@ public class UsedCarDataStatsService {
queryDataBiz
.
setBrandIds
(
"-1,-3"
);
queryDataBiz
.
setDateType
(
4
);
queryDataBiz
.
setExts
(
null
);
queryDataBiz
.
setMerchantIds
(
StrUtil
.
join
(
","
,
filterMerchantIds
)
);
queryDataBiz
.
setMerchantIds
(
filterBoolean
?
StrUtil
.
join
(
","
,
merchantIdList
)
:
null
);
queryDataBiz
.
setStartDate
(
"2000-01-01"
);
queryDataBiz
.
setEndDate
(
DateUtil
.
format
(
new
Date
(),
"yyyy-MM-dd"
));
List
<
String
>
itemCodes
=
Arrays
.
asList
(
"在库车辆"
,
"在库成本"
,
"在库天数>7天"
,
"在库天数>30天"
,
"卖车总产值"
,
"总毛利"
,
"平均周转天数"
,
"平均收车成本"
);
// 在库车辆数-A0004 在库成本-A0005 在库超过7天-A0006 在库超过30天-A0007
// 二手车产值 A0001 二手车毛利-A0002 平均周转天数-A0008 平均收车成本-A0011
List
<
String
>
itemCodes
=
Arrays
.
asList
(
"A0004"
,
"A0005"
,
"A0006"
,
"A0007"
,
"A0001"
,
"A0002"
,
"A0008"
,
"A0011"
);
for
(
String
itemCode
:
itemCodes
)
{
queryDataBiz
.
setItemCodes
(
itemCode
);
String
jsonBody
=
JSONUtil
.
toJsonStr
(
queryDataBiz
);
...
...
@@ -127,6 +137,10 @@ public class UsedCarDataStatsService {
}
/**
* todz趋势图
*/
/**
* 存量门店分析
*/
public
StockStoreAnalysisRes
getStockStoreAnalysis
(
StockStoreAnalysisReq
request
)
{
...
...
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