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