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 36a758f9
authored
Dec 10, 2025
by
张富康
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
定时任务处理历史数据
1 parent
4bd06c47
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
125 additions
and
10 deletions
rpc-dj-pe-analysis-api/src/main/java/cn/com/glsx/dj/peanalysis/dto/job/MerchantFirstOrderDate.java
rpc-dj-pe-analysis/src/main/java/cn/com/glsx/dj/peanalysis/mapper/BusinessIntelligenceMapper.java
rpc-dj-pe-analysis/src/main/java/cn/com/glsx/dj/peanalysis/service/BusinessIntelligenceService.java
rpc-dj-pe-analysis/src/main/resources/META-INF/orm/BusinessIntelligenceMapper.xml
rpc-dj-pe-analysis-api/src/main/java/cn/com/glsx/dj/peanalysis/dto/job/MerchantFirstOrderDate.java
0 → 100644
View file @
36a758f
package
cn
.
com
.
glsx
.
dj
.
peanalysis
.
dto
.
job
;
import
lombok.Data
;
import
java.util.Date
;
/**
* 商户首单日期
*/
@Data
public
class
MerchantFirstOrderDate
{
/**
* 商户ID
*/
private
Integer
merchantId
;
/**
* 首单时间
*/
private
Date
firstOrderDate
;
}
\ No newline at end of file
\ No newline at end of file
rpc-dj-pe-analysis/src/main/java/cn/com/glsx/dj/peanalysis/mapper/BusinessIntelligenceMapper.java
View file @
36a758f
package
cn
.
com
.
glsx
.
dj
.
peanalysis
.
mapper
;
package
cn
.
com
.
glsx
.
dj
.
peanalysis
.
mapper
;
import
cn.com.glsx.dj.peanalysis.dto.job.BiInsertFailure
;
import
cn.com.glsx.dj.peanalysis.dto.job.*
;
import
cn.com.glsx.dj.peanalysis.dto.job.BiRecord
;
import
cn.com.glsx.dj.peanalysis.dto.job.BusinessFirstTimesEntity
;
import
cn.com.glsx.dj.peanalysis.dto.job.BusinessOrderStatusEntity
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
...
@@ -13,7 +10,7 @@ import java.util.List;
...
@@ -13,7 +10,7 @@ import java.util.List;
/**
/**
* BI数据生成Mapper接口 - 实体类接收版
* BI数据生成Mapper接口 - 实体类接收版
*
*
<p>
* 优化点:
* 优化点:
* 1. 使用实体类接收查询结果,替代Map结构
* 1. 使用实体类接收查询结果,替代Map结构
* 2. 简化接口定义
* 2. 简化接口定义
...
@@ -27,6 +24,14 @@ public interface BusinessIntelligenceMapper {
...
@@ -27,6 +24,14 @@ public interface BusinessIntelligenceMapper {
List
<
Integer
>
getTargetMerchantIds
();
List
<
Integer
>
getTargetMerchantIds
();
/**
/**
* 获取每个商户的首单日期
*
* @param merchantIds 商户ID列表
* @return 商户ID -> 首单日期映射
*/
List
<
MerchantFirstOrderDate
>
getMerchantFirstOrderDates
(
List
<
Integer
>
merchantIds
);
/**
* 批量获取指定商户列表的各业务首单时间
* 批量获取指定商户列表的各业务首单时间
*
*
* @param merchantIds 商户ID列表
* @param merchantIds 商户ID列表
...
@@ -53,6 +58,7 @@ public interface BusinessIntelligenceMapper {
...
@@ -53,6 +58,7 @@ public interface BusinessIntelligenceMapper {
/**
/**
* 批量插入BI记录
* 批量插入BI记录
*
* @param records BI记录
* @param records BI记录
* @return 受影响行数
* @return 受影响行数
*/
*/
...
...
rpc-dj-pe-analysis/src/main/java/cn/com/glsx/dj/peanalysis/service/BusinessIntelligenceService.java
View file @
36a758f
This diff is collapsed.
Click to expand it.
rpc-dj-pe-analysis/src/main/resources/META-INF/orm/BusinessIntelligenceMapper.xml
View file @
36a758f
...
@@ -4,9 +4,97 @@
...
@@ -4,9 +4,97 @@
<select
id=
"getTargetMerchantIds"
resultType=
"java.lang.Integer"
>
<select
id=
"getTargetMerchantIds"
resultType=
"java.lang.Integer"
>
SELECT merchant_id
select distinct smf.main_merchant_id
FROM dj_car_life_service_merchant
FROM dj_car_life_scene_merchant_ref smf
WHERE merchant_type = 2 AND deleted_flag = 'N'
left join dj_car_life_service_merchant sm on smf.main_merchant_id = sm.merchant_id and sm.deleted_flag = 'N'
where smf.main_merchant_type = 2 and smf.deleted_flag = 'N' and smf.sub_merchant_type in (6,8)
</select>
<select
id=
"getMerchantFirstOrderDates"
resultType=
"cn.com.glsx.dj.peanalysis.dto.job.MerchantFirstOrderDate"
>
SELECT
merchant_id as merchantId,
MIN(first_order_date) AS firstOrderDate
FROM (
<!-- 权益业务 -->
SELECT
go.merchant_id,
MIN(po.success_date) AS first_order_date
FROM dj_car_life_goods_order go
LEFT JOIN dj_car_life_pay_order po
ON go.order_code = po.order_code AND po.success_date IS NOT NULL AND po.deleted_flag = 'N'
WHERE
go.scene_type = 0
AND go.business_type = 1
AND go.deleted_flag = 'N'
<if
test =
"merchantIds != null and merchantIds.size() > 0"
>
AND go.merchant_id IN
<foreach
item=
"id"
collection=
"merchantIds"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</if>
GROUP BY go.merchant_id
UNION ALL
<!-- 延保业务 -->
SELECT
go.merchant_id,
MIN(po.success_date) AS first_order_date
FROM dj_car_life_goods_order go
LEFT JOIN dj_car_life_pay_order po
ON go.order_code = po.order_code AND po.success_date IS NOT NULL AND po.deleted_flag = 'N'
WHERE
go.scene_type = 0
AND go.business_type = 2
AND go.deleted_flag = 'N'
<if
test =
"merchantIds != null and merchantIds.size() > 0"
>
AND go.merchant_id IN
<foreach
item=
"id"
collection=
"merchantIds"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</if>
GROUP BY go.merchant_id
UNION ALL
<!-- 轻改业务 -->
SELECT
go.merchant_id,
MIN(po.success_date) AS first_order_date
FROM dj_car_life_goods_order go
LEFT JOIN dj_car_life_pay_order po
ON go.order_code = po.order_code AND po.success_date IS NOT NULL AND po.deleted_flag = 'N'
WHERE
go.scene_type = 1
AND go.deleted_flag = 'N'
<if
test =
"merchantIds != null and merchantIds.size() > 0"
>
AND go.merchant_id IN
<foreach
item=
"id"
collection=
"merchantIds"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</if>
GROUP BY go.merchant_id
UNION ALL
<!-- 二手车业务 -->
SELECT
v.source_store AS merchant_id,
MIN(v.purchase_time) AS first_order_date
FROM vcp_car_manage_info v
WHERE
v.deleted_flag = 'N'
<if
test =
"merchantIds != null and merchantIds.size() > 0"
>
AND v.source_store IN
<foreach
item=
"id"
collection=
"merchantIds"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</if>
and v.purchase_time is not null
GROUP BY v.source_store
) AS combined
GROUP BY merchant_id
</select>
</select>
<select
id=
"getBusinessFirstTimes"
resultType=
"cn.com.glsx.dj.peanalysis.dto.job.BusinessFirstTimesEntity"
>
<select
id=
"getBusinessFirstTimes"
resultType=
"cn.com.glsx.dj.peanalysis.dto.job.BusinessFirstTimesEntity"
>
...
@@ -352,6 +440,4 @@
...
@@ -352,6 +440,4 @@
</mapper>
</mapper>
\ No newline at end of file
\ No newline at end of file
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