fix(后台管理):首页商户统计功能实现
This commit is contained in:
+7
-7
@@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@@ -33,13 +34,12 @@ public class DashboardController {
|
||||
@Parameter(description = "开始时间") @RequestParam(required = false) String startTime,
|
||||
@Parameter(description = "结束时间") @RequestParam(required = false) String endTime) {
|
||||
try {
|
||||
Map<String, Object> params = Map.of(
|
||||
"tourismId", tourismId,
|
||||
"qrcodeId", qrcodeId,
|
||||
"deviceSn", deviceSn,
|
||||
"startTime", startTime,
|
||||
"endTime", endTime
|
||||
);
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("tourismId", tourismId);
|
||||
params.put("qrcodeId", qrcodeId);
|
||||
params.put("deviceSn", deviceSn);
|
||||
params.put("startTime", startTime);
|
||||
params.put("endTime", endTime);
|
||||
|
||||
DashboardStatisticsVO statistics = dashboardService.getDashboardStatistics(params);
|
||||
return Result.succeed(statistics, "获取首页统计数据成功");
|
||||
|
||||
+11
-6
@@ -94,7 +94,7 @@ public interface DashboardMapper {
|
||||
"SELECT COALESCE(SUM(order_amount), 0)",
|
||||
"FROM orders",
|
||||
"WHERE is_del = 0",
|
||||
"AND order_status IN (2, 3)", // 已支付、已完成
|
||||
"AND order_status IN (1, 3, 4, 5, 6)", // 已支付排队中、设备执行完成、正在服务中、素材上传中、素材上传完成
|
||||
"<if test='p.tourismId != null'>",
|
||||
" AND tourism_id = #{p.tourismId}",
|
||||
"</if>",
|
||||
@@ -215,11 +215,16 @@ public interface DashboardMapper {
|
||||
"<script>",
|
||||
"SELECT",
|
||||
" CASE order_status",
|
||||
" WHEN 1 THEN '待支付'",
|
||||
" WHEN 2 THEN '已支付'",
|
||||
" WHEN 3 THEN '已完成'",
|
||||
" WHEN 4 THEN '已取消'",
|
||||
" WHEN 5 THEN '已退款'",
|
||||
" WHEN 0 THEN '待支付'",
|
||||
" WHEN 1 THEN '已支付排队中'",
|
||||
" WHEN 2 THEN '已取消'",
|
||||
" WHEN 3 THEN '设备执行完成'",
|
||||
" WHEN 4 THEN '正在服务中'",
|
||||
" WHEN 5 THEN '素材上传中'",
|
||||
" WHEN 6 THEN '素材上传完成'",
|
||||
" WHEN 7 THEN '退款中'",
|
||||
" WHEN 8 THEN '已退款'",
|
||||
" WHEN 9 THEN '退款失败'",
|
||||
" ELSE '其他'",
|
||||
" END as type,",
|
||||
" COUNT(*) as value",
|
||||
|
||||
@@ -95,9 +95,15 @@ const Statistics: React.FC = () => {
|
||||
|
||||
// 初始化加载
|
||||
useEffect(() => {
|
||||
console.log('页面初始化,开始加载数据...');
|
||||
console.log('当前 activeTab:', activeTab);
|
||||
|
||||
// 立即执行数据加载
|
||||
fetchQrcodeList();
|
||||
fetchDeviceList();
|
||||
fetchTourismList();
|
||||
|
||||
console.log('数据加载函数已调用');
|
||||
}, []);
|
||||
|
||||
// 生成统计数据
|
||||
|
||||
Reference in New Issue
Block a user