fix(订单中心):首页订单状态分布图删除,新增二维码订单数量横向柱状图
This commit is contained in:
@@ -491,6 +491,35 @@ public interface DashboardMapper {
|
||||
})
|
||||
List<IncomeDataVO> getIncomeBreakdown(@Param("p") Map<String, Object> params);
|
||||
|
||||
@Select({
|
||||
"<script>",
|
||||
"SELECT",
|
||||
" q.name as qrcodeName,",
|
||||
" q.code_id as qrcodeId,",
|
||||
" COUNT(o.id) as orderCount",
|
||||
"FROM qrcodes q",
|
||||
"LEFT JOIN orders o ON q.code_id = o.code_id",
|
||||
"WHERE q.is_del = 0",
|
||||
"<if test='p.includeTestQrcodes == null or p.includeTestQrcodes == false'>",
|
||||
" AND q.is_test = 0",
|
||||
"</if>",
|
||||
"<if test='p.tourismId != null'>",
|
||||
" AND q.tourism_id = #{p.tourismId}",
|
||||
"</if>",
|
||||
"<if test='p.startTime != null and p.startTime != \"\"'>",
|
||||
" AND o.create_time >= #{p.startTime}",
|
||||
"</if>",
|
||||
"<if test='p.endTime != null and p.endTime != \"\"'>",
|
||||
" AND o.create_time <= #{p.endTime}",
|
||||
"</if>",
|
||||
"GROUP BY q.code_id, q.name",
|
||||
"HAVING orderCount > 0",
|
||||
"ORDER BY orderCount DESC",
|
||||
"LIMIT 20",
|
||||
"</script>"
|
||||
})
|
||||
List<QrcodeOrderDataVO> getQrcodeOrderCount(@Param("p") Map<String, Object> params);
|
||||
|
||||
// 筛选选项
|
||||
@Select("SELECT id as value, tourism_name as label FROM tourisms WHERE is_del = 0 ORDER BY create_time DESC")
|
||||
List<FilterOptions.OptionItem> getTourismOptions();
|
||||
|
||||
+3
@@ -16,4 +16,7 @@ public class ChartStatistics {
|
||||
|
||||
@Schema(description = "收入构成")
|
||||
private List<IncomeDataVO> incomeBreakdown;
|
||||
|
||||
@Schema(description = "二维码订单数量")
|
||||
private List<QrcodeOrderDataVO> qrcodeOrderCount;
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package com.central.order.model.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Schema(description = "二维码订单数据")
|
||||
public class QrcodeOrderDataVO {
|
||||
@Schema(description = "二维码名称")
|
||||
private String qrcodeName;
|
||||
|
||||
@Schema(description = "二维码ID")
|
||||
private String qrcodeId;
|
||||
|
||||
@Schema(description = "订单数量")
|
||||
private Long orderCount;
|
||||
}
|
||||
+3
@@ -165,6 +165,9 @@ public class DashboardServiceImpl implements IDashboardService {
|
||||
// 获取收入构成
|
||||
stats.setIncomeBreakdown(dashboardMapper.getIncomeBreakdown(params));
|
||||
|
||||
// 获取二维码订单数量
|
||||
stats.setQrcodeOrderCount(dashboardMapper.getQrcodeOrderCount(params));
|
||||
|
||||
return stats;
|
||||
}
|
||||
|
||||
|
||||
@@ -64,6 +64,11 @@ interface Statistics {
|
||||
type: string;
|
||||
value: number;
|
||||
}[];
|
||||
qrcodeOrderCount: {
|
||||
qrcodeName: string;
|
||||
qrcodeId: string;
|
||||
orderCount: number;
|
||||
}[];
|
||||
};
|
||||
// 新增筛选维度数据
|
||||
filterOptions: {
|
||||
@@ -296,15 +301,41 @@ const Welcome: React.FC = () => {
|
||||
},
|
||||
};
|
||||
|
||||
// 订单分布配置
|
||||
const orderDistConfig = {
|
||||
data: chartStats.orderDistribution || [],
|
||||
angleField: 'value',
|
||||
colorField: 'type',
|
||||
radius: 0.8,
|
||||
// 二维码订单数量配置 - 横向柱状图
|
||||
const qrcodeOrderConfig = {
|
||||
data: chartStats.qrcodeOrderCount || [],
|
||||
xField: 'orderCount',
|
||||
yField: 'qrcodeName',
|
||||
seriesField: 'qrcodeName',
|
||||
bar: {
|
||||
style: {
|
||||
fill: '#1890ff',
|
||||
},
|
||||
},
|
||||
label: {
|
||||
type: 'outer',
|
||||
content: '{name} {percentage}',
|
||||
position: 'right' as const,
|
||||
style: {
|
||||
fill: '#666',
|
||||
fontSize: 12,
|
||||
},
|
||||
},
|
||||
xAxis: {
|
||||
title: {
|
||||
text: '订单数量',
|
||||
},
|
||||
},
|
||||
yAxis: {
|
||||
title: {
|
||||
text: '二维码',
|
||||
},
|
||||
},
|
||||
tooltip: {
|
||||
formatter: (datum: any) => {
|
||||
return {
|
||||
name: '订单数量',
|
||||
value: datum.orderCount,
|
||||
};
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -516,8 +547,8 @@ const Welcome: React.FC = () => {
|
||||
</Card>
|
||||
</Col>
|
||||
<Col xs={24} lg={8}>
|
||||
<Card title="订单状态分布" loading={loading}>
|
||||
<Pie {...orderDistConfig} height={300} />
|
||||
<Card title="二维码订单数量" loading={loading}>
|
||||
<Column {...qrcodeOrderConfig} height={300} />
|
||||
</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
Reference in New Issue
Block a user