重置统计数据

This commit is contained in:
2026-04-27 16:55:23 +08:00
parent 880d19b0fa
commit 604a42fa4d
3 changed files with 34 additions and 155 deletions

View File

@@ -1,6 +1,7 @@
package com.czg.controller;
import com.czg.task.StatisticTask;
import com.czg.utils.FunUtils;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -33,8 +34,10 @@ public class StatisticTaskController {
statisticTask.statisticAndInsertProd(shopId, date);
} else if ("table".equals(type)) {
statisticTask.statisticAndInsertTable(shopId, date);
} else {
return "未知错误";
} else if ("all".equals(type)) {
FunUtils.safeRunVoid(() -> statisticTask.statisticAndInsertOrder(shopId, date));
FunUtils.safeRunVoid(() -> statisticTask.statisticAndInsertProd(shopId, date));
FunUtils.safeRunVoid(() -> statisticTask.statisticAndInsertTable(shopId, date));
}
return "success";
}

View File

@@ -6,13 +6,18 @@ import com.czg.order.param.SaleSummaryCountParam;
import com.czg.order.service.FinanceStsService;
import com.czg.resp.CzgResult;
import com.czg.sa.StpKit;
import com.czg.task.StatisticTask;
import com.czg.utils.FunUtils;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.time.LocalDate;
/**
* 管理端/财务报表
* @author yjjie
@@ -25,6 +30,30 @@ public class FinanceStsController {
@Resource
private FinanceStsService financeStsService;
@Resource
private StatisticTask statisticTask;
/**
* 基础统计 预留重置统计
*
* @param date 日期yyyy-MM-dd
*/
@GetMapping("/base")
public String baseStatistic(@RequestParam LocalDate date, @RequestParam Long shopId, @RequestParam String type) {
if ("order".equals(type)) {
statisticTask.statisticAndInsertOrder(shopId, date);
} else if ("prod".equals(type)) {
statisticTask.statisticAndInsertProd(shopId, date);
} else if ("table".equals(type)) {
statisticTask.statisticAndInsertTable(shopId, date);
} else if ("all".equals(type)) {
FunUtils.safeRunVoid(() -> statisticTask.statisticAndInsertOrder(shopId, date));
FunUtils.safeRunVoid(() -> statisticTask.statisticAndInsertProd(shopId, date));
FunUtils.safeRunVoid(() -> statisticTask.statisticAndInsertTable(shopId, date));
}
return "success";
}
/**
* 查询财务报表
*/